Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:16

0001 #ifndef ECALTRIGGERPRIMITIVEDIGI_H
0002 #define ECALTRIGGERPRIMITIVEDIGI_H 1
0003 
0004 #include <ostream>
0005 #include <vector>
0006 
0007 #include "DataFormats/EcalDetId/interface/EcalTrigTowerDetId.h"
0008 #include "DataFormats/EcalDigi/interface/EcalTriggerPrimitiveSample.h"
0009 
0010 /** \class EcalTriggerPrimitiveDigi
0011 
0012 see also EcalTrigPrimCompactColl.
0013 
0014 */
0015 
0016 class EcalTriggerPrimitiveDigi {
0017 public:
0018   typedef EcalTrigTowerDetId key_type;  ///< For the sorted collection
0019 
0020   EcalTriggerPrimitiveDigi();  // for persistence
0021   explicit EcalTriggerPrimitiveDigi(const EcalTrigTowerDetId& id);
0022 
0023   void swap(EcalTriggerPrimitiveDigi& rh) {
0024     std::swap(id_, rh.id_);
0025     std::swap(size_, rh.size_);
0026     std::swap(data_, rh.data_);
0027   }
0028 
0029   const EcalTrigTowerDetId& id() const { return id_; }
0030   int size() const { return size_; }
0031 
0032   const EcalTriggerPrimitiveSample& operator[](int i) const { return data_[i]; }
0033   const EcalTriggerPrimitiveSample& sample(int i) const { return data_[i]; }
0034 
0035   void setSize(int size);
0036   void setSample(int i, const EcalTriggerPrimitiveSample& sam) { data_[i] = sam; }
0037   void setSampleValue(int i, uint16_t value) { data_[i].setValue(value); }
0038 
0039   static const int MAXSAMPLES = 20;
0040 
0041   /// get the encoded/compressed Et of interesting sample
0042   int compressedEt() const;
0043 
0044   /// get the fine-grain bit of interesting sample
0045   bool fineGrain() const;
0046 
0047   /// get the Trigger tower Flag of interesting sample
0048   int ttFlag() const;
0049 
0050   /// Gets the "strip fine grain veto bit" (sFGVB) used as L1A spike detection
0051   /// @return 0 spike like pattern
0052   ///         1 EM shower like pattern
0053   int sFGVB() const;
0054 
0055   /// Gets the L1A spike detection flag. Beware the flag is inverted.
0056   /// Deprecated, use instead sFGVB() method, whose name is less missleading
0057   /// @return 0 spike like pattern
0058   ///         1 EM shower like pattern
0059   int l1aSpike() const { return sFGVB(); }
0060 
0061   /// True if debug mode (# of samples > 1)
0062   bool isDebug() const;
0063 
0064   /// Gets the interesting sample
0065   int sampleOfInterest() const;
0066 
0067 private:
0068   EcalTrigTowerDetId id_;
0069   int size_;
0070   std::vector<EcalTriggerPrimitiveSample> data_;
0071 };
0072 
0073 inline void swap(EcalTriggerPrimitiveDigi& lh, EcalTriggerPrimitiveDigi& rh) { lh.swap(rh); }
0074 
0075 std::ostream& operator<<(std::ostream& s, const EcalTriggerPrimitiveDigi& digi);
0076 
0077 #endif