#ifndef _TOWERTYPE_HH_ #define _TOWERTYPE_HH_ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Component: TowerType.hh // Purpose: These are a set of classes that correspond to // each type of calorimeter tower i.e. X = [0,8]. The // classes inherit from CalTower. // // All TowerType classes share the following methods (which do // different things depending on the tower type): // // Manipulation and access // // int time(CellKey& cKey) const; // int time(CellKey& cKey, int ihit) const; // float pmtEnergy(CellKey& cKey, size_t ipmt) const; // bool hasTiming() const; // bool includesDetector(Detector iDet) const; // // gives back a new "DetList" // // based on the tower type e.g. // // for TowerType0 dl would contain // // CEM and CHA // void detectors(DetList& dl) const; // // The following methods are used ONLY in the creation of the CalData // object: // // int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy); // int setTime(CalorKey& bankKey,int time, int ihit); // int setTime(CellKey& cKey,int time, int ihit); // int setTDCHits(CalorKey& bankKey,uint1 nhits); // int setTDCHits(CellKey& cKey,uint1 nhits); // // // this fills members of the CalTower base class // void fillCalTower(int skcut); // // Some printing stuff. To print all the tower // // information, one should use the print method in // // CalTower // void printTower() const; // friend std::ostream& operator<<(std::ostream& os, const TowerType0& t); // // // Created: 09/04/99 by Pierre Savard // History: 16/04/99 Marc Paterno // Added clone() methods to all TowerTypes // Pierre Savard // Use TowerDescription // /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include #include "CalorGeometry/CalorKey.hh" #include "EdmUtilities/FixedSizeTypes.hh" #include "CalorGeometry/CalConstants.hh" #include "CalorGeometry/CalParameters.hh" #include "CalorGeometry/TowerDescription.hh" #include "CalorGeometry/CellKey.hh" #include "CalorObjects/CalTower.hh" #include // namespace calor { class TowerType0 : public CalTower { public: typedef TowerDescription<0> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType0(); // // Testing // // Equality test bool operator==(const TowerType0& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; int nHadPmt() const; uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // the method below is used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void fillCalTower(int skcut, int paramVersion); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType0* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream & os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType0& t); private: mutable float _chaTime[8]; // Central hadron TDC time mutable float _cemTime[CAL_TDC_NHITS]; // Central EM TDC time mutable float _cemEnergy[2]; // Central EM PMT energies mutable float _chaEnergy[2]; // Central HAD PMT energies uint1 _nChaHits; uint2 _iChaTime[8]; // TDC counts from D bank uint2 _iCemEnergy[2]; uint2 _iChaEnergy[2]; uint1 _nCemHits; uint2 _iCemTime[CAL_TDC_NHITS]; // TDC counts from EMTD bank float _stripEnergy; // Strip Energy float _crackEnergy; // Phi Crack energy }; inline TowerType0::TowerType0(){ // _chaTime[2] = 0.0; _cemEnergy[0] = 0.0; _cemEnergy[1] = 0.0; _chaEnergy[0] = 0.0; _chaEnergy[1] = 0.0; _stripEnergy = 0.0; _crackEnergy = 0.0; _nChaHits = 0; _iChaTime[0] = 0; _iChaTime[1] = 0; _iChaTime[2] = 0; _iChaTime[3] = 0; _iChaTime[4] = 0; _iChaTime[5] = 0; _iChaTime[6] = 0; _iChaTime[7] = 0; _chaTime[0] = 0; _chaTime[1] = 0; _chaTime[2] = 0; _chaTime[3] = 0; _chaTime[4] = 0; _chaTime[5] = 0; _chaTime[6] = 0; _chaTime[7] = 0; _nCemHits = 0; memset(_iCemTime,0,sizeof(uint2)*CAL_TDC_NHITS); memset(_cemTime,0,sizeof(float)*CAL_TDC_NHITS); _iCemEnergy[0] = 50; _iCemEnergy[1] = 50; _iChaEnergy[0] = 50; _iChaEnergy[1] = 50; } inline float TowerType0::emPhi() const {return 2.*PI*(iPhi() + emCOGPhi())/TEPSEG[0];} inline float TowerType0::hadPhi() const{return 2.*PI*(iPhi() + hadCOGPhi())/TEPSEG[0];} inline bool TowerType0::hasTiming() const { return true; } inline bool TowerType0::includesDetector(Detector x) const { return (x==CEM || x==CHA || x==CRACK || x==STRIP)?true:false; } inline void TowerType0::detectors(DetList& dl) const { dl.resize(2); dl[0] = CEM; dl[1] = CHA; } inline uint2 TowerType0::emData() const{ return _iCemEnergy[0] +_iCemEnergy[1]; } inline uint2 TowerType0::hadData() const{ return _iChaEnergy[0] +_iChaEnergy[1]; } inline uint2 TowerType0::totData() const{ return this->emData() + this->hadData(); } inline int TowerType0::nEmPmt() const{ return 2; } inline int TowerType0::nHadPmt() const{ return 2; } inline uint2 TowerType0::emPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 1){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ return _iCemEnergy[ipmt]; } } inline uint2 TowerType0::hadPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 1){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ return _iChaEnergy[ipmt]; } } class TowerType1 : public CalTower { public: typedef TowerDescription<1> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType1(); // // Testing // // Equality test bool operator==(const TowerType1& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; int nHadPmt() const; uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // The method belowis used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void fillCalTower(int skcut, int paramVersion); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType1* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType1& t); private: mutable float _chaTime[8]; // Central hadron TDC time mutable float _whaTime[8]; // Wall hadron TDC time mutable float _cemTime[CAL_TDC_NHITS]; // CEM TDC time mutable float _cemEnergy[2]; // Central EM PMT energies mutable float _chaEnergy[2]; // Central HAD PMT energies mutable float _whaEnergy[2]; // Wall HAD PMT energies mutable float _stripEnergy; // Strip Energy mutable float _crackEnergy; // Phi Crack energy uint1 _nChaHits; uint1 _nWhaHits; uint2 _iChaTime[8]; // ADC counts from D bank uint2 _iWhaTime[8]; uint2 _iCemEnergy[2]; uint2 _iChaEnergy[2]; uint2 _iWhaEnergy[2]; uint1 _nCemHits; uint2 _iCemTime[CAL_TDC_NHITS]; // TDC counts from EMTD bank }; inline TowerType1::TowerType1(){ // _chaTime[2] = 0.0; // _whaTime[2] = 0.0; _cemEnergy[0] = 0.0; _cemEnergy[1] = 0.0; _chaEnergy[0] = 0.0; _chaEnergy[1] = 0.0; _whaEnergy[0] = 0.0; _whaEnergy[1] = 0.0; _stripEnergy = 0.0; _crackEnergy = 0.0; _nChaHits = 0; _nWhaHits = 0; _iChaTime[0] = 0; _iChaTime[1] = 0; _iChaTime[2] = 0; _iChaTime[3] = 0; _iChaTime[4] = 0; _iChaTime[5] = 0; _iChaTime[6] = 0; _iChaTime[7] = 0; _chaTime[0] = 0; _chaTime[1] = 0; _chaTime[2] = 0; _chaTime[3] = 0; _chaTime[4] = 0; _chaTime[5] = 0; _chaTime[6] = 0; _chaTime[7] = 0; _iWhaTime[0] = 0; _iWhaTime[1] = 0; _iWhaTime[2] = 0; _iWhaTime[3] = 0; _iWhaTime[4] = 0; _iWhaTime[5] = 0; _iWhaTime[6] = 0; _iWhaTime[7] = 0; _whaTime[0] = 0; _whaTime[1] = 0; _whaTime[2] = 0; _whaTime[3] = 0; _whaTime[4] = 0; _whaTime[5] = 0; _whaTime[6] = 0; _whaTime[7] = 0; _nCemHits = 0; memset(_iCemTime,0,sizeof(uint2)*CAL_TDC_NHITS); memset(_cemTime,0,sizeof(float)*CAL_TDC_NHITS); _iCemEnergy[0] = 50; _iCemEnergy[1] = 50; _iChaEnergy[0] = 50; _iChaEnergy[1] = 50; _iWhaEnergy[0] = 50; _iWhaEnergy[1] = 50; } inline float TowerType1::emPhi() const {return 2.*PI*(iPhi() + emCOGPhi())/TEPSEG[0];} inline float TowerType1::hadPhi() const{return 2.*PI*(iPhi() + hadCOGPhi())/TEPSEG[0];} inline bool TowerType1::hasTiming() const { return true; } inline bool TowerType1::includesDetector(Detector x) const { return (x==CEM || x==CHA || x==WHA || x==CRACK || x==STRIP)?true:false; } inline void TowerType1::detectors(DetList& dl) const { dl.resize(3); dl[0] = CEM; dl[1] = CHA; dl[2] = WHA; } inline uint2 TowerType1::emData() const{ return _iCemEnergy[0] +_iCemEnergy[1]; } inline uint2 TowerType1::hadData() const{ return (_iChaEnergy[0] +_iChaEnergy[1] + _iWhaEnergy[0] +_iWhaEnergy[1]); } inline uint2 TowerType1::totData() const{ return this->emData() + this->hadData(); } inline int TowerType1::nEmPmt() const{ return 2; } inline int TowerType1::nHadPmt() const{ return 4; } inline uint2 TowerType1::emPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 1){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ return _iCemEnergy[ipmt]; } } inline uint2 TowerType1::hadPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 3){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ if(ipmt > 1) return _iWhaEnergy[ipmt-2]; return _iChaEnergy[ipmt]; } } class TowerType2 : public CalTower { public: typedef TowerDescription<2> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType2(); // // Testing // // Equality test bool operator==(const TowerType2& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; int nHadPmt() const; uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // I will eventually switch to exclusively using the method below // which is used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void fillCalTower(int skcut, int paramVersion); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType2* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType2& t); private: mutable float _whaTime[8]; // Wall hadron TDC time mutable float _cemTime[CAL_TDC_NHITS]; // Central EM TDC time mutable float _cemEnergy[2]; // Central EM PMT energies mutable float _whaEnergy[2]; // Wall HAD PMT energies mutable float _stripEnergy; // Strip Energy mutable float _crackEnergy; // Phi Crack energy uint1 _nWhaHits; uint2 _iWhaTime[8]; // ADC counts from D bank uint2 _iCemEnergy[2]; uint2 _iWhaEnergy[2]; uint1 _nCemHits; uint2 _iCemTime[CAL_TDC_NHITS]; // ADC counts from EMTD bank }; inline TowerType2::TowerType2(){ // _whaTime[2] = 0.0; _cemEnergy[0] = 0.0; _cemEnergy[1] = 0.0; _whaEnergy[0] = 0.0; _whaEnergy[1] = 0.0; _stripEnergy = 0.0; _crackEnergy = 0.0; _nWhaHits = 0; _iWhaTime[0] = 0; _iWhaTime[1] = 0; _iWhaTime[2] = 0; _iWhaTime[3] = 0; _iWhaTime[4] = 0; _iWhaTime[5] = 0; _iWhaTime[6] = 0; _iWhaTime[7] = 0; _whaTime[0] = 0; _whaTime[1] = 0; _whaTime[2] = 0; _whaTime[3] = 0; _whaTime[4] = 0; _whaTime[5] = 0; _whaTime[6] = 0; _whaTime[7] = 0; _nCemHits = 0; memset(_iCemTime,0,sizeof(uint2)*CAL_TDC_NHITS); memset(_cemTime,0,sizeof(float)*CAL_TDC_NHITS); _iCemEnergy[0] = 50; _iCemEnergy[1] = 50; _iWhaEnergy[0] = 50; _iWhaEnergy[1] = 50; } inline float TowerType2::emPhi() const {return 2.*PI*(iPhi() + emCOGPhi())/TEPSEG[0];} inline float TowerType2::hadPhi() const{return 2.*PI*(iPhi() + hadCOGPhi())/TEPSEG[0];} inline bool TowerType2::hasTiming() const { return true; } inline bool TowerType2::includesDetector(Detector x) const { return (x==CEM || x==WHA || x==CRACK || x==STRIP)?true:false; } inline void TowerType2::detectors(DetList& dl) const { dl.resize(2); dl[0] = CEM; dl[1] = WHA; } inline uint2 TowerType2::emData() const{ return _iCemEnergy[0] +_iCemEnergy[1]; } inline uint2 TowerType2::hadData() const{ return (_iWhaEnergy[0] +_iWhaEnergy[1]); } inline uint2 TowerType2::totData() const{ return this->emData() + this->hadData(); } inline int TowerType2::nEmPmt() const{ return 2; } inline int TowerType2::nHadPmt() const{ return 2; } inline uint2 TowerType2::emPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 1){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ return _iCemEnergy[ipmt]; } } inline uint2 TowerType2::hadPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 1){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ return _iWhaEnergy[ipmt]; } } class TowerType3 : public CalTower { public: typedef TowerDescription<3> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType3(); // // Testing // // Equality test bool operator==(const TowerType3& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; int nHadPmt() const; uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // I will eventually switch to exclusively using the method below // which is used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void fillCalTower(int skcut, int paramVersion); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType3* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType3& t); private: mutable float _whaTime[8]; // Wall hadron TDC time mutable float _pemTime[CAL_TDC_NHITS]; // Plug EM TDC time mutable float _pemEnergy[2]; // Plug Em energy mutable float _whaEnergy[2]; // Wall HAD PMT energies mutable float _pprEnergy[2]; // Plug PreRadiator Energy uint1 _nWhaHits; uint2 _iWhaTime[8]; uint2 _iPemEnergy[2]; uint2 _iWhaEnergy[2]; uint2 _iPprEnergy[2]; uint1 _nPemHits; uint2 _iPemTime[CAL_TDC_NHITS]; // TDC counts from EMTD bank }; inline TowerType3::TowerType3(){ // _whaTime[2] = 0.0; _pemEnergy[0] = 0.0; _pemEnergy[1] = 0.0; _whaEnergy[0] = 0.0; _whaEnergy[1] = 0.0; _pprEnergy[0] = 0.0; _pprEnergy[1] = 0.0; _nWhaHits = 0; _iWhaTime[0] = 0; _iWhaTime[1] = 0; _iWhaTime[2] = 0; _iWhaTime[3] = 0; _iWhaTime[4] = 0; _iWhaTime[5] = 0; _iWhaTime[6] = 0; _iWhaTime[7] = 0; _whaTime[0] = 0; _whaTime[1] = 0; _whaTime[2] = 0; _whaTime[3] = 0; _whaTime[4] = 0; _whaTime[5] = 0; _whaTime[6] = 0; _whaTime[7] = 0; _nPemHits = 0; memset(_iPemTime,0,sizeof(uint2)*CAL_TDC_NHITS); memset(_pemTime,0,sizeof(float)*CAL_TDC_NHITS); _iPemEnergy[0] = 50; _iPemEnergy[1] = 50; _iWhaEnergy[0] = 50; _iWhaEnergy[1] = 50; _iPprEnergy[0] = 12; _iPprEnergy[1] = 12; } inline float TowerType3::emPhi() const {return 2.*PI*(iPhi() + emCOGPhi())/TEPSEG[0];} inline float TowerType3::hadPhi() const{return 2.*PI*(iPhi() + hadCOGPhi())/TEPSEG[0];} inline bool TowerType3::hasTiming() const { return true; } inline bool TowerType3::includesDetector(Detector x) const { return (x==PEM || x==WHA || x== PPR)?true:false; } inline void TowerType3::detectors(DetList& dl) const { dl.resize(3); dl[0] = PPR; dl[1] = PEM; dl[2] = WHA; } inline uint2 TowerType3::emData() const{ return _iPemEnergy[0] +_iPemEnergy[1]; } inline uint2 TowerType3::hadData() const{ return (_iWhaEnergy[0] +_iWhaEnergy[1]); } inline uint2 TowerType3::totData() const{ return this->emData() + this->hadData(); } inline int TowerType3::nEmPmt() const{ return 4; } inline int TowerType3::nHadPmt() const{ return 2; } inline uint2 TowerType3::hadPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 3){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ return _iWhaEnergy[ipmt]; } } inline uint2 TowerType3::emPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 3){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ if(ipmt > 1) return _iPemEnergy[ipmt-2]; return _iPprEnergy[ipmt]; } } class TowerType4 : public CalTower { public: typedef TowerDescription<4> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType4(); // // Testing // // Equality test bool operator==(const TowerType4& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; int nHadPmt() const; uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // I will eventually switch to exclusively using the method below // which is used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void fillCalTower(int skcut, int paramVersion); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType4* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType4& t); private: mutable float _whaTime[8]; // Wall hadron TDC time mutable float _phaTime[8]; // Plug hadron TDC time mutable float _pemTime[CAL_TDC_NHITS]; // Plug EM TDC time mutable float _pemEnergy[2]; // Plug EM energy mutable float _phaEnergy[2]; // Plug HAD energy mutable float _whaEnergy[2]; // Wall HAD PMT energies mutable float _pprEnergy[2]; // Plug PreRadiator Energy uint1 _nWhaHits; uint1 _nPhaHits; uint2 _iWhaTime[8]; uint2 _iPhaTime[8]; uint2 _iPemEnergy[2]; uint2 _iWhaEnergy[2]; uint2 _iPhaEnergy[2]; uint2 _iPprEnergy[2]; uint1 _nPemHits; uint2 _iPemTime[CAL_TDC_NHITS]; // TDC counts from EMTD bank }; inline TowerType4::TowerType4(){ // _whaTime[2] = 0.0; _pemEnergy[0] = 0.0; _pemEnergy[1] = 0.0; _phaEnergy[0] = 0.0; _phaEnergy[1] = 0.0; _whaEnergy[0] = 0.0; _whaEnergy[1] = 0.0; _pprEnergy[0] = 0.0; _pprEnergy[1] = 0.0; _nWhaHits = 0; _nPhaHits = 0; _iWhaTime[0] = 0; _iWhaTime[1] = 0; _iWhaTime[2] = 0; _iWhaTime[3] = 0; _iWhaTime[4] = 0; _iWhaTime[5] = 0; _iWhaTime[6] = 0; _iWhaTime[7] = 0; _whaTime[0] = 0; _whaTime[1] = 0; _whaTime[2] = 0; _whaTime[3] = 0; _whaTime[4] = 0; _whaTime[5] = 0; _whaTime[6] = 0; _whaTime[7] = 0; _iPhaTime[0] = 0; _iPhaTime[1] = 0; _iPhaTime[2] = 0; _iPhaTime[3] = 0; _iPhaTime[4] = 0; _iPhaTime[5] = 0; _iPhaTime[6] = 0; _iPhaTime[7] = 0; _phaTime[0] = 0; _phaTime[1] = 0; _phaTime[2] = 0; _phaTime[3] = 0; _phaTime[4] = 0; _phaTime[5] = 0; _phaTime[6] = 0; _phaTime[7] = 0; _iPemEnergy[0] = 50; _iPemEnergy[1] = 50; _iPhaEnergy[0] = 50; _iPhaEnergy[1] = 50; _iWhaEnergy[0] = 50; _iWhaEnergy[1] = 50; _iPprEnergy[0] = 12; _iPprEnergy[1] = 12; _nPemHits = 0; memset(_iPemTime,0,sizeof(uint2)*CAL_TDC_NHITS); memset(_pemTime,0,sizeof(float)*CAL_TDC_NHITS); } inline float TowerType4::emPhi() const {return 2.*PI*(iPhi() + emCOGPhi())/TEPSEG[0];} inline float TowerType4::hadPhi() const{return 2.*PI*(iPhi() + hadCOGPhi())/TEPSEG[0];} inline bool TowerType4::hasTiming() const { return true; } inline bool TowerType4::includesDetector(Detector x) const { return (x==PEM || x==PHA || x==WHA || x==PPR)?true:false; } inline void TowerType4::detectors(DetList& dl) const { dl.resize(4); dl[0] = PPR; dl[1] = PEM; dl[2] = PHA; dl[3] = WHA; } inline uint2 TowerType4::emData() const{ return _iPemEnergy[0] +_iPemEnergy[1]; } inline uint2 TowerType4::hadData() const{ return (_iWhaEnergy[0] +_iWhaEnergy[1] + _iPhaEnergy[0] +_iPhaEnergy[1]); } inline uint2 TowerType4::totData() const{ return this->emData() + this->hadData(); } inline int TowerType4::nEmPmt() const{ return 4; } inline int TowerType4::nHadPmt() const{ return 4; } inline uint2 TowerType4::emPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 3){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ if(ipmt > 1) return _iPemEnergy[ipmt-2]; return _iPprEnergy[ipmt]; } } inline uint2 TowerType4::hadPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 3){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ if(ipmt > 1) return _iWhaEnergy[ipmt-2]; return _iPhaEnergy[ipmt]; } } class TowerType5 : public CalTower { public: typedef TowerDescription<5> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType5(); // Equality test bool operator==(const TowerType5& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; int nHadPmt() const; uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // I will eventually switch to exclusively using the method below // which is used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType5* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType5& t); private: mutable float _phaTime[8]; mutable float _pemTime[CAL_TDC_NHITS]; // Plug EM TDC time mutable float _pemEnergy; // Plug EM energy mutable float _phaEnergy; // Plug HAD energy mutable float _pprEnergy; // Plug PreRadiator Energy uint1 _nPhaHits; uint2 _iPhaTime[8]; uint2 _iPemEnergy; uint2 _iPhaEnergy; uint2 _iPprEnergy; uint1 _nPemHits; uint2 _iPemTime[CAL_TDC_NHITS]; // TDC counts from EMTD bank }; inline TowerType5::TowerType5(){ _pemEnergy = 0.0; _phaEnergy = 0.0; _pprEnergy = 0.0; _nPhaHits = 0; _iPhaTime[0] = 0; _iPhaTime[1] = 0; _iPhaTime[2] = 0; _iPhaTime[3] = 0; _iPhaTime[4] = 0; _iPhaTime[5] = 0; _iPhaTime[6] = 0; _iPhaTime[7] = 0; _phaTime[0] = 0; _phaTime[1] = 0; _phaTime[2] = 0; _phaTime[3] = 0; _phaTime[4] = 0; _phaTime[5] = 0; _phaTime[6] = 0; _phaTime[7] = 0; _nPemHits = 0; memset(_iPemTime,0,sizeof(uint2)*CAL_TDC_NHITS); memset(_pemTime,0,sizeof(float)*CAL_TDC_NHITS); _iPemEnergy = 50; _iPhaEnergy = 50; _iPprEnergy = 12; } inline float TowerType5::emPhi() const {return 2.*PI*(iPhi() + 0.5)/TEPSEG[TETTYP[iEta()]];} inline float TowerType5::hadPhi() const{return 2.*PI*(iPhi() + 0.5)/TEPSEG[TETTYP[iEta()]];} inline bool TowerType5::hasTiming() const { return true; } inline bool TowerType5::includesDetector(Detector x) const { return (x==PEM || x==PHA || x==PPR)?true:false; } inline void TowerType5::detectors(DetList& dl) const { dl.resize(3); dl[0] = PPR; dl[1] = PEM; dl[2] = PHA; } inline uint2 TowerType5::emData() const{ return _iPemEnergy; } inline uint2 TowerType5::hadData() const{ return _iPhaEnergy; } inline uint2 TowerType5::totData() const{ return this->emData() + this->hadData(); } inline int TowerType5::nEmPmt() const{ return 2; } inline int TowerType5::nHadPmt() const{ return 1; } inline uint2 TowerType5::emPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 1){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ if(ipmt == 0) return _iPprEnergy; return _iPemEnergy; } } inline uint2 TowerType5::hadPmt(int ipmt) const{ if(ipmt != 0){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ return _iPhaEnergy; } } class TowerType6 : public CalTower { public: typedef TowerDescription<6> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType6(); // // Testing // // Equality test bool operator==(const TowerType6& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; int nHadPmt() const; uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // I will eventually switch to exclusively using the method below // which is used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType6* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType6& t); private: mutable float _phaTime[8]; mutable float _pemEnergy; // Plug EM energy mutable float _phaEnergy; // Plug HAD energy mutable float _pprEnergy; // Plug PreRadiator Energy uint1 _nPhaHits; uint2 _iPhaTime[8]; uint2 _iPemEnergy; uint2 _iPhaEnergy; uint2 _iPprEnergy; }; inline TowerType6::TowerType6(){ _pemEnergy = 0.0; _phaEnergy = 0.0; _pprEnergy = 0.0; _nPhaHits = 0; _iPhaTime[0] = 0; _iPhaTime[1] = 0; _iPhaTime[2] = 0; _iPhaTime[3] = 0; _iPhaTime[4] = 0; _iPhaTime[5] = 0; _iPhaTime[6] = 0; _iPhaTime[7] = 0; _phaTime[0] = 0; _phaTime[1] = 0; _phaTime[2] = 0; _phaTime[3] = 0; _phaTime[4] = 0; _phaTime[5] = 0; _phaTime[6] = 0; _phaTime[7] = 0; _iPemEnergy = 50; _iPhaEnergy = 50; _iPprEnergy = 12; } inline float TowerType6::emPhi() const {return 2.*PI*(iPhi() + 0.5)/TEPSEG[TETTYP[iEta()]];} inline float TowerType6::hadPhi() const{return 2.*PI*(iPhi() + 0.5)/TEPSEG[TETTYP[iEta()]];} inline bool TowerType6::hasTiming() const { return true; } inline bool TowerType6::includesDetector(Detector x) const { return (x==PEM || x==PHA || x==PPR)?true:false; } inline void TowerType6::detectors(DetList& dl) const { dl.resize(3); dl[0] = PPR; dl[1] = PEM; dl[2] = PHA; } inline uint2 TowerType6::emData() const{ return _iPemEnergy; } inline uint2 TowerType6::hadData() const{ return _iPhaEnergy; } inline uint2 TowerType6::totData() const{ return this->emData() + this->hadData(); } inline int TowerType6::nEmPmt() const{ return 2; } inline int TowerType6::nHadPmt() const{ return 1; } inline uint2 TowerType6::emPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 1){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ if(ipmt == 0) return _iPprEnergy; return _iPemEnergy; } } inline uint2 TowerType6::hadPmt(int ipmt) const{ if(ipmt != 0){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ return _iPhaEnergy; } } class TowerType7 : public CalTower { public: typedef TowerDescription<7> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType7(); // // Testing // // Equality test bool operator==(const TowerType7& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; // will not return miniplug towers until detector is there int nHadPmt() const; // will not return miniplug towers until detector is there uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // I will eventually switch to exclusively using the method below // which is used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType7* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType7& t); private: mutable float _phaTime[8]; mutable float _pemEnergy; // Plug EM energy mutable float _phaEnergy; // Plug HAD energy mutable float _pprEnergy; // Plug PreRadiator Energy mutable float _mpaEnergy; // Mini Plug energy uint1 _nPhaHits; uint2 _iPhaTime[8]; uint2 _iPemEnergy; uint2 _iPhaEnergy; uint2 _iPprEnergy; uint2 _iMpaEnergy; }; inline TowerType7::TowerType7(){ _pemEnergy = 0.0; _phaEnergy = 0.0; _pprEnergy = 0.0; _mpaEnergy = 0.0; _nPhaHits = 0; _iPhaTime[0] = 0; _iPhaTime[1] = 0; _iPhaTime[2] = 0; _iPhaTime[3] = 0; _iPhaTime[4] = 0; _iPhaTime[5] = 0; _iPhaTime[6] = 0; _iPhaTime[7] = 0; _phaTime[0] = 0; _phaTime[1] = 0; _phaTime[2] = 0; _phaTime[3] = 0; _phaTime[4] = 0; _phaTime[5] = 0; _phaTime[6] = 0; _phaTime[7] = 0; _iPemEnergy = 50; _iPhaEnergy = 50; _iPprEnergy = 12; _iMpaEnergy = 50; } inline float TowerType7::emPhi() const {return 2.*PI*(iPhi() + emCOGPhi())/TEPSEG[0];} inline float TowerType7::hadPhi() const{return 2.*PI*(iPhi() + hadCOGPhi())/TEPSEG[0];} inline bool TowerType7::hasTiming() const { return true; } inline bool TowerType7::includesDetector(Detector x) const { return (x==PEM || x==PHA || x==PPR || x==MPA)?true:false; } inline void TowerType7::detectors(DetList& dl) const { dl.resize(4); dl[0] = PPR; dl[1] = PEM; dl[2] = PHA; dl[3] = MPA; } inline uint2 TowerType7::emData() const{ return _iPemEnergy; } inline uint2 TowerType7::hadData() const{ return _iPhaEnergy; } inline uint2 TowerType7::totData() const{ return this->emData() + this->hadData(); } inline int TowerType7::nEmPmt() const{ return 2; } inline int TowerType7::nHadPmt() const{ return 1; } inline uint2 TowerType7::emPmt(int ipmt) const{ if(ipmt < 0 || ipmt > 1){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ if(ipmt == 0) return _iPprEnergy; return _iPemEnergy; } } inline uint2 TowerType7::hadPmt(int ipmt) const{ if(ipmt != 0){ std::cerr << "ipmt out of range" << std::endl; return 0; } else{ return _iPhaEnergy; } } class TowerType8 : public CalTower { public: typedef TowerDescription<8> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType8(); // // Testing // // Equality test bool operator==(const TowerType8& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; // will return 0 for miniplug towers until detector is there int nHadPmt() const; // will return 0 for miniplug towers until detector is there uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // following method used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void fillCalTower(int skcut, int paramVersion); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType8* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType8& t); private: mutable float _mpaEnergy; // Mini Plug energy uint2 _iMpaEnergy; }; inline TowerType8::TowerType8(){ _mpaEnergy = 0.0; _iMpaEnergy = 50; } inline float TowerType8::emPhi() const {return 2.*PI*(iPhi() + emCOGPhi())/TEPSEG[8];} inline float TowerType8::hadPhi() const{return 2.*PI*(iPhi() + hadCOGPhi())/TEPSEG[8];} inline bool TowerType8::hasTiming() const { return false; } inline bool TowerType8::includesDetector(Detector x) const { return (x==MPA)?true:false; } inline void TowerType8::detectors(DetList& dl) const { dl.resize(1); dl[0] = MPA; } inline uint2 TowerType8::emData() const{ return _iMpaEnergy; } inline uint2 TowerType8::hadData() const{ return 0; } inline uint2 TowerType8::totData() const{ return this->emData() + this->hadData(); } inline int TowerType8::nEmPmt() const{ return 1; } inline int TowerType8::nHadPmt() const{ return 0; } inline uint2 TowerType8::emPmt(int ipmt) const{ if (ipmt == 0) { return _iMpaEnergy; } else { std::cerr << "ipmt out of range" << std::endl; return 0; } } inline uint2 TowerType8::hadPmt(int ipmt) const{ return 0; } class TowerType9 : public CalTower { public: typedef TowerDescription<9> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType9(); // // Testing // // Equality test bool operator==(const TowerType9& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; // will return 0 for miniplug towers until detector is there int nHadPmt() const; // will return 0 for miniplug towers until detector is there uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // following method used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void fillCalTower(int skcut, int paramVersion); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType9* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType9& t); private: mutable float _mpaEnergy; // Mini Plug energy uint2 _iMpaEnergy; }; inline TowerType9::TowerType9(){ _mpaEnergy = 0.0; _iMpaEnergy = 50; } inline float TowerType9::emPhi() const {return 2.*PI*(iPhi() + emCOGPhi())/TEPSEG[9];} inline float TowerType9::hadPhi() const{return 2.*PI*(iPhi() + hadCOGPhi())/TEPSEG[9];} inline bool TowerType9::hasTiming() const { return false; } inline bool TowerType9::includesDetector(Detector x) const { return (x==MPA)?true:false; } inline void TowerType9::detectors(DetList& dl) const { dl.resize(1); dl[0] = MPA; } inline uint2 TowerType9::emData() const{ return _iMpaEnergy; } inline uint2 TowerType9::hadData() const{ return 0; } inline uint2 TowerType9::totData() const{ return this->emData() + this->hadData(); } inline int TowerType9::nEmPmt() const{ return 0; } inline int TowerType9::nHadPmt() const{ return 1; } inline uint2 TowerType9::emPmt(int ipmt) const{ if (ipmt == 0) { return _iMpaEnergy; } else { std::cerr << "ipmt out of range" << std::endl; return 0; } } inline uint2 TowerType9::hadPmt(int ipmt) const{ return 0; } class TowerType10 : public CalTower { public: typedef TowerDescription<10> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType10(); // // Testing // // Equality test bool operator==(const TowerType10& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; // will return 0 for miniplug towers until detector is there int nHadPmt() const; // will return 0 for miniplug towers until detector is there uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // following method used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void fillCalTower(int skcut, int paramVersion); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType10* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType10& t); private: mutable float _mpaEnergy; // Mini Plug energy uint2 _iMpaEnergy; }; inline TowerType10::TowerType10(){ _mpaEnergy = 0.0; _iMpaEnergy = 50; } inline float TowerType10::emPhi() const {return 2.*PI*(iPhi() + emCOGPhi())/TEPSEG[10];} inline float TowerType10::hadPhi() const{return 2.*PI*(iPhi() + hadCOGPhi())/TEPSEG[10];} inline bool TowerType10::hasTiming() const { return false; } inline bool TowerType10::includesDetector(Detector x) const { return (x==MPA)?true:false; } inline void TowerType10::detectors(DetList& dl) const { dl.resize(1); dl[0] = MPA; } inline uint2 TowerType10::emData() const{ return _iMpaEnergy; } inline uint2 TowerType10::hadData() const{ return 0; } inline uint2 TowerType10::totData() const{ return this->emData() + this->hadData(); } inline int TowerType10::nEmPmt() const{ return 1; } inline int TowerType10::nHadPmt() const{ return 0; } inline uint2 TowerType10::emPmt(int ipmt) const{ if (ipmt == 0) { return _iMpaEnergy; } else { std::cerr << "ipmt out of range" << std::endl; return 0; } } inline uint2 TowerType10::hadPmt(int ipmt) const{ return 0; } class TowerType11 : public CalTower { public: typedef TowerDescription<11> TowerDesc; // // Memory management // // Initialized c'tor. Copy c'tor, assignment and // d'tor do the right thing. TowerType11(); // // Testing // // Equality test bool operator==(const TowerType11& rhs) const; // // Manipulation and access // float emPhi() const; float hadPhi() const; int nTDCHits(CellKey& cKey) const; float time(CellKey& cKey) const; float time(CellKey& cKey, int ihit) const; float pmtEnergy(CellKey& cKey, size_t ipmt) const; int nEmPmt() const; // will return 0 for miniplug towers until detector is there int nHadPmt() const; // will return 0 for miniplug towers until detector is there uint2 emPmt(int ipmt) const; uint2 hadPmt(int ipmt) const; uint2 pmtData(CellKey& cKey, size_t ipmt) const; uint2 emData() const; uint2 hadData() const; uint2 totData() const; bool hasTiming() const; bool includesDetector(Detector iDet) const; void detectors(DetList& dl) const; int iTower() const; int addPmtEnergy(CalorDetInfo::detectorTag d,size_t ipmt,float& energy,uint2 iData); // following method used right now only by the simulation int addPmtEnergy(Detector det, size_t ipmt, float& energy); int setTime(CalorKey& bankKey,int time, int ihit); int setTime(CellKey& cKey,int time, int ihit); int setTDCHits(CalorKey& bankKey,uint1 nhits); int setTDCHits(CellKey& cKey,uint1 nhits); void fillCalTower(int skcut, int paramVersion); void puffTower(const CalDataCalib* calib,float CalOffLer[]); TowerType11* clone() const; // EDM stuff void readFromBuffer(TBuffer& iobuffer,Version_t); void writeToBuffer(TBuffer& iobuffer,Version_t); // // Printing // void printTower(std::ostream& os = std::cout) const; friend std::ostream& operator<<(std::ostream& os, const TowerType11& t); private: mutable float _mpaEnergy; // Mini Plug energy uint2 _iMpaEnergy; }; inline TowerType11::TowerType11(){ _mpaEnergy = 0.0; _iMpaEnergy = 50; } inline float TowerType11::emPhi() const {return 2.*PI*(iPhi() + emCOGPhi())/TEPSEG[11];} inline float TowerType11::hadPhi() const{return 2.*PI*(iPhi() + hadCOGPhi())/TEPSEG[11];} inline bool TowerType11::hasTiming() const { return false; } inline bool TowerType11::includesDetector(Detector x) const { return (x==MPA)?true:false; } inline void TowerType11::detectors(DetList& dl) const { dl.resize(1); dl[0] = MPA; } inline uint2 TowerType11::emData() const{ return _iMpaEnergy; } inline uint2 TowerType11::hadData() const{ return 0; } inline uint2 TowerType11::totData() const{ return this->emData() + this->hadData(); } inline int TowerType11::nEmPmt() const{ return 1; } inline int TowerType11::nHadPmt() const{ return 0; } inline uint2 TowerType11::emPmt(int ipmt) const{ if (ipmt == 0) { return _iMpaEnergy; } else { std::cerr << "ipmt out of range" << std::endl; return 0; } } inline uint2 TowerType11::hadPmt(int ipmt) const{ return 0; } // } // calor namespace #endif // _TOWERTYPE_HH_