Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:17

0001 #ifndef CASTORTRIGGERPRIMITIVEDIGI_H
0002 #define CASTORTRIGGERPRIMITIVEDIGI_H 1
0003 
0004 #include <ostream>
0005 #include <vector>
0006 #include "DataFormats/HcalDetId/interface/HcalCastorDetId.h"
0007 #include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveSample.h"
0008 
0009 /** \class CastorTriggerPrimitiveDigi
0010     
0011 \author A. Campbell - DESY
0012 */
0013 class CastorTriggerPrimitiveDigi {
0014 public:
0015   typedef HcalCastorDetId key_type;  ///< For the sorted collection
0016 
0017   CastorTriggerPrimitiveDigi();  // for persistence
0018   explicit CastorTriggerPrimitiveDigi(const HcalCastorDetId& id);
0019 
0020   const HcalCastorDetId& id() const { return id_; }
0021   int size() const { return (size_ & 0xF); }
0022   int presamples() const { return hcalPresamples_ & 0xF; }
0023 
0024   /// was ZS MarkAndPass?
0025   bool zsMarkAndPass() const { return (hcalPresamples_ & 0x10); }
0026   /// was ZS unsuppressed?
0027   bool zsUnsuppressed() const { return (hcalPresamples_ & 0x20); }
0028 
0029   void setZSInfo(bool unsuppressed, bool markAndPass);
0030 
0031   const HcalTriggerPrimitiveSample& operator[](int i) const { return data_[i]; }
0032   const HcalTriggerPrimitiveSample& sample(int i) const { return data_[i]; }
0033 
0034   /// Full "Sample of Interest"
0035   const HcalTriggerPrimitiveSample& t0() const { return data_[presamples()]; }
0036   /// Fine-grain bit for the "Sample of Interest"
0037   bool SOI_fineGrain() const { return t0().fineGrain(); }
0038   /// Compressed ET for the "Sample of Interest"
0039   int SOI_compressedEt() const { return t0().compressedEt(); }
0040 
0041   int tpchannel(int i) const { return ((data_[i].raw() & 0xf800) >> 11); }
0042   int tpdata(int i) const { return (data_[i].raw() & 0x01ff); }
0043   bool isSOI(int i) const { return ((data_[i].raw() & 0x0200) == 0x0200); }
0044   int SOI_tpchannel() const { return ((data_[presamples()].raw() & 0xf800) >> 11); }
0045   int SOI_tpdata() const { return (data_[presamples()].raw() & 0x01ff); }
0046 
0047   void setSize(int size);
0048   void setPresamples(int ps);
0049   void setSample(int i, const HcalTriggerPrimitiveSample& sam) { data_[i] = sam; }
0050 
0051   static const int MAXSAMPLES = 10;
0052 
0053 private:
0054   HcalCastorDetId id_;
0055   int size_;
0056   int hcalPresamples_;
0057   HcalTriggerPrimitiveSample data_[MAXSAMPLES];
0058 };
0059 
0060 std::ostream& operator<<(std::ostream& s, const CastorTriggerPrimitiveDigi& digi);
0061 
0062 #endif