#ifndef _CALTOWER_HH_ #define _CALTOWER_HH_ //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Component: CalTower.hh // Purpose: This is the base class for the calorimeter towers. It is an // abstract base class. Subclasses of CalTower represent specific // tower types, as defined by the CDF calorimeter hardware. // See CDF/ANAL/JET/CDFR/3952 for a description of the tower types. // // Created: 09/04/99 Pierre Savard // History: 16/04/99 Marc Paterno // Added virtual destructor and pure virtual clone(). // Added typedefs valcode_t and repcode_t // // 03/04/00 Pierre Savard // Change types for ieta and iphi to UChar_t (Root unsigned // 8 bit integer type) // // 02/19/02 Beate Heinemann // New accessors to return the energies per calorimeter // (e.g. pprEnergy, cemEnergy and so on and so forth) // // 18/11/03 Angela Wyatt New accessors to set/return validCode in an understandable way /////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include #include "EdmUtilities/FixedSizeTypes.hh" #include "CalorGeometry/CalConstants.hh" #include "CalorGeometry/CalParameters.hh" #include "CalorGeometry/CellKey.hh" #include "CalorObjects/CalDataCalib.hh" //ROOT headers #include "TBuffer.h" typedef std::vector DetList; //enum validBit { PHATDC=0, WHATDC=1, CHATDC=2, WHASPIKE=3, CHASPIKE=4, CEMSPIKE=5, PEMSPIKE=6, PHASPIKE=7, PPRSPIKE=8, CEMDEAD=9, CHADEAD=10, WHADEAD=11, CEMHOT=12, CHAHOT=13, WHAHOT=14, PEMTDC=15, CEMTDC=16,PEMDEAD=17,PHADEAD=18,PEMHOT=19,PHAHOT=20}; enum validBit { PHATDC=0, WHATDC=1, CHATDC=2, WHASPIKE=3, CHASPIKE=4, CEMSPIKE=5, PEMSPIKE=6, PHASPIKE=7, PPRSPIKE=8, CEMPMT0BAD=9,CEMPMT1BAD=10, CHAPMT0BAD=11, CHAPMT1BAD=12, WHAPMT0BAD=13, WHAPMT1BAD=14, PEMTDC=15, CEMTDC=16, PEMPMT0BAD=17,PEMPMT1BAD=18, PHAPMT0BAD=19, PHAPMT1BAD=20}; // namespace calor { class CalTower { public: typedef ULong_t valcode_t; // // Memory management // // Default constructor, also full initialization constructor. CalTower(UChar_t iEta = 0U, UChar_t iPhi = 0U, valcode_t validCode = 0U, float emEnergy = 0.0, float hadEnergy = 0.0,float emCOGphi = 0.0, float hadCOGphi = 0.0); // Default copy constructor and assignment operator do the right thing. // Destructor virtual ~CalTower(); // // Testing // // Equality test bool operator==(const CalTower& rhs) const; // // Manipulation and access // // Access methods for base class only valcode_t validCode() const; bool isBad(validBit bit) const; float emCOGPhi() const; float hadCOGPhi() const; float energy() const; float emEnergy() const; float hadEnergy() const; float cemEnergy() const; float pemEnergy() const; float chaEnergy() const; float whaEnergy() const; float phaEnergy() const; float pprEnergy() const; UChar_t iEta() const; UChar_t iPhi() const; UChar_t myType() const; // Access methods for derived classes only // Access to "raw" data virtual int nEmPmt() const =0; // number of pmts in em calorimeter virtual int nHadPmt() const =0; // number of pmts in hadron calorimeter virtual uint2 emPmt(int ipmt) const =0; // adc counts of em calorimeter for pmt "ipmt" virtual uint2 hadPmt(int ipmt) const =0; // adc counts of had calorimeter for pmt "ipmt" virtual uint2 pmtData(CellKey& cKey, size_t ipmt) const = 0; // this returns the acd counts for one pmt virtual uint2 emData() const = 0; // this returns the adc counts for the em part of the tower virtual uint2 hadData() const = 0; // this returns the acd counts for had part of the tower virtual uint2 totData() const = 0; // this returns the sum of acd counts for the whole tower // Access to calibrated data etc. virtual float emPhi() const = 0; virtual float hadPhi() const = 0; virtual float time(CellKey& cKey) const = 0; virtual float time(CellKey& cKey, int ihit) const = 0; virtual int nTDCHits(CellKey& cKey) const = 0; virtual float pmtEnergy(CellKey& cKey, size_t ipmt) const = 0; virtual bool includesDetector(Detector iDet) const = 0 ; virtual bool hasTiming() const = 0; virtual void detectors(DetList& dl) const=0; virtual int iTower() const =0; // returns MP tower number (if not MP returns -1) // set methods for base class only void setEmPhi(float& phi); void setHadPhi(float& phi); void setEmEnergy(float& energy); void setHadEnergy(float& energy); void setCemEnergy(float& energy); void setPemEnergy(float& energy); void setChaEnergy(float& energy); void setWhaEnergy(float& energy); void setPhaEnergy(float& energy); void setPprEnergy(float& energy); void setValidCode(valcode_t valCode); void setBad(validBit bit); void setIeta(UChar_t iEta); void setIphi(UChar_t iPhi); // set methods for derived classes only virtual int addPmtEnergy(CalorDetInfo::detectorTag d, size_t ipmt,float& energy, uint2 iData) = 0; // I will eventually switch to exclusively using the method below // which is used right now only by the simulation virtual int addPmtEnergy(Detector det, size_t ipmt, float& energy) = 0; virtual int setTime(CalorKey& bKey,int time, int ihit) = 0; virtual int setTime(CellKey& cKey, int time, int ihit) = 0; virtual int setTDCHits(CalorKey& bKey,uint1 nhits) = 0; virtual int setTDCHits(CellKey& cKey, uint1 nhits) = 0; // EDM stuff virtual void readFromBuffer(TBuffer& iobuffer,Version_t) = 0; virtual void writeToBuffer(TBuffer& iobuffer,Version_t) = 0; // Utilities virtual CalTower* clone() const = 0; virtual void fillCalTower(int skcut,int paramVersion); virtual void puffTower(const CalDataCalib* calib,float CalOffLer[]) = 0; // // Printing // // operator<<() doesn't need to be a friend, because inline accessors // are defined for all members. // this will print CalTower data members void print(std::ostream& os = std::cout) const; // this will print TowerType data members virtual void printTower(std::ostream& os = std::cout) const = 0; int PrintValidCode(int start = 0) const; friend std::ostream& operator<<(std::ostream& os, const CalTower& t); protected: UChar_t _iEta; // eta index UChar_t _iPhi; // phi index valcode_t _validCode; // Validation code // The following data members are filled when the tower is puffed-up mutable float _emEnergy; mutable float _hadEnergy; mutable float _cemEnergy; mutable float _pemEnergy; mutable float _chaEnergy; mutable float _whaEnergy; mutable float _phaEnergy; mutable float _pprEnergy; mutable float _emCOGphi; // EM phi center-of-gravity mutable float _hadCOGphi; // HAD phi center-of-gravity }; inline float CalTower::emCOGPhi() const {return _emCOGphi;} inline float CalTower::hadCOGPhi() const {return _hadCOGphi;} inline CalTower::valcode_t CalTower::validCode() const {return _validCode;} inline float CalTower::energy() const{return (_emEnergy+_hadEnergy);} inline float CalTower::emEnergy() const {return _emEnergy;} inline float CalTower::hadEnergy() const {return _hadEnergy;} inline float CalTower::cemEnergy() const {return _cemEnergy;} inline float CalTower::pemEnergy() const {return _pemEnergy;} inline float CalTower::chaEnergy() const {return _chaEnergy;} inline float CalTower::whaEnergy() const {return _whaEnergy;} inline float CalTower::phaEnergy() const {return _phaEnergy;} inline float CalTower::pprEnergy() const {return _pprEnergy;} inline UChar_t CalTower::myType() const {return TOWER_TYPE[_iEta];} inline void CalTower::setHadEnergy(float& energy){_hadEnergy = energy;} inline void CalTower::setEmEnergy(float& energy){_emEnergy = energy;} inline void CalTower::setCemEnergy(float& energy){_cemEnergy = energy;} inline void CalTower::setPemEnergy(float& energy){_pemEnergy = energy;} inline void CalTower::setChaEnergy(float& energy){_chaEnergy = energy;} inline void CalTower::setWhaEnergy(float& energy){_whaEnergy = energy;} inline void CalTower::setPhaEnergy(float& energy){_phaEnergy = energy;} inline void CalTower::setPprEnergy(float& energy){_pprEnergy = energy;} inline void CalTower::setHadPhi(float& phi){_hadCOGphi = phi;} inline void CalTower::setEmPhi(float& phi){_emCOGphi = phi;} inline void CalTower::setValidCode(valcode_t validCode){ _validCode = validCode;} inline UChar_t CalTower::iEta() const {return _iEta;} inline UChar_t CalTower::iPhi() const {return _iPhi;} inline void CalTower::setIphi(UChar_t iPhi){_iPhi = iPhi;} inline void CalTower::setIeta(UChar_t iEta){_iEta = iEta;} // } // namespace calor #endif // _CALTOWER_HH_