00001 #ifndef CASTORTRIGGERPRIMITIVEDIGI_H 00002 #define CASTORTRIGGERPRIMITIVEDIGI_H 1 00003 00004 #include <ostream> 00005 #include <vector> 00006 #include "DataFormats/HcalDetId/interface/HcalCastorDetId.h" 00007 #include "DataFormats/HcalDigi/interface/HcalTriggerPrimitiveSample.h" 00008 00015 class CastorTriggerPrimitiveDigi { 00016 public: 00017 typedef HcalCastorDetId key_type; 00018 00019 CastorTriggerPrimitiveDigi(); // for persistence 00020 explicit CastorTriggerPrimitiveDigi(const HcalCastorDetId& id); 00021 00022 const HcalCastorDetId& id() const { return id_; } 00023 int size() const { return (size_&0xF); } 00024 int presamples() const { return hcalPresamples_&0xF; } 00025 00027 bool zsMarkAndPass() const { return (hcalPresamples_&0x10); } 00029 bool zsUnsuppressed() const { return (hcalPresamples_&0x20); } 00030 00031 void setZSInfo(bool unsuppressed, bool markAndPass); 00032 00033 const HcalTriggerPrimitiveSample& operator[](int i) const { return data_[i]; } 00034 const HcalTriggerPrimitiveSample& sample(int i) const { return data_[i]; } 00035 00037 const HcalTriggerPrimitiveSample& t0() const { return data_[presamples()]; } 00039 bool SOI_fineGrain() const { return t0().fineGrain(); } 00041 int SOI_compressedEt() const { return t0().compressedEt(); } 00042 00043 int tpchannel(int i) const { return ( ( data_[i].raw() & 0xf800 ) >> 11 ); } 00044 int tpdata(int i) const { return ( data_[i].raw() & 0x01ff ); } 00045 bool isSOI(int i ) const { return ( ( data_[i].raw() & 0x0200 ) == 0x0200 ) ; } 00046 int SOI_tpchannel() const { return ( ( data_[presamples()].raw() & 0xf800 ) >> 11 ); } 00047 int SOI_tpdata() const { return ( data_[presamples()].raw() & 0x01ff ); } 00048 00049 void setSize(int size); 00050 void setPresamples(int ps); 00051 void setSample(int i, const HcalTriggerPrimitiveSample& sam) { data_[i]=sam; } 00052 00053 static const int MAXSAMPLES = 10; 00054 private: 00055 HcalCastorDetId id_; 00056 int size_; 00057 int hcalPresamples_; 00058 HcalTriggerPrimitiveSample data_[MAXSAMPLES]; 00059 }; 00060 00061 std::ostream& operator<<(std::ostream& s, const CastorTriggerPrimitiveDigi& digi); 00062 00063 00064 #endif