#ifdef USE_CDFEDM2 ////////////////////////////////////////////////////////////////////////// // // Component: CalTower.cc // Purpose: Implementation of CalTower class // // Created: 16/04/99 Marc Paterno // History: 04/05/99 Pierre Savard: add COG phi // ////////////////////////////////////////////////////////////////////////// #include #include #include "CalorObjects/CalTower.hh" #include using namespace std; // namespace calor { // Initialization constructor CalTower::CalTower(UChar_t iEta, UChar_t iPhi, valcode_t validCode, float emEnergy, float hadEnergy, float emCOGphi, float hadCOGphi) : _iEta(iEta), _iPhi(iPhi), _validCode(validCode), _emEnergy(emEnergy), _hadEnergy(hadEnergy),_emCOGphi(emCOGphi),_hadCOGphi(hadCOGphi), _cemEnergy(0.),_pemEnergy(0.),_chaEnergy(0.),_whaEnergy(0.),_phaEnergy(0.),_pprEnergy(0.) { } // // Memory management // CalTower::~CalTower() {} // // Testing // // Equality test bool CalTower::operator==(const CalTower& rhs) const { if (this == &rhs) return true; return (_iEta == rhs._iEta && _iPhi == rhs._iPhi && _emEnergy == rhs._emEnergy && _hadEnergy == rhs._hadEnergy && _emCOGphi == rhs._emCOGphi && _hadCOGphi == rhs._hadCOGphi && _validCode== rhs._validCode); } // // Printing // void CalTower::print(std::ostream& os) const{ // this prints the CalTower data os << *this; // this prints the TowerType data this->printTower(os); } int CalTower::PrintValidCode(int start) const { int word = 0; int place= 1; int iWord = this->validCode(); int end = start + 8; for(int i= start;i> i) & 0x00000001 ; word = word + place*bit; place = place*10; } return word; } ostream& operator<<(std::ostream& os, const CalTower& t) { os << '\n'; os << "Type: " <validCode(); test_bit = (_validCode >> bit) & 0x00000001 ; if (test_bit == 0) return false; else return true; } void CalTower::setBad(validBit bit) { valcode_t _validCode = this->validCode(); valcode_t badbit = (valcode_t) pow(2.,bit); _validCode = (_validCode | badbit); this->setValidCode(_validCode); } // Nothing for Mini-Plug yet void CalTower::fillCalTower(int skcut,int paramVersion){ float pprWeight=pprWeight_0; switch (paramVersion) { case 2: pprWeight=pprWeight_1; } // This is the default. The concrete TowerType classes have // their own fillTower methods (for types 0-4) float phiEm = 0; float ePha = 0; float phiPha = 0; float ePpr = 0; float eCem = 0; float ePem = 0; float eCha = 0; float eWha = 0; CellKey cKey1(this->iEta(),this->iPhi(), PEM); ePem = this->pmtEnergy(cKey1,0); phiEm = 0.5; CellKey cKey2(this->iEta(),this->iPhi(), PHA); ePha = this->pmtEnergy(cKey2,0); phiPha = 0.5; CellKey cKey3(this->iEta(),this->iPhi(), PPR); ePpr = this->pmtEnergy(cKey3,0); // set rest of CalTower member data float eEm=ePem+pprWeight*ePpr; this->setEmEnergy(eEm); this->setEmPhi(phiEm); this->setHadEnergy(ePha); this->setHadPhi(phiPha); this->setCemEnergy(eCem); this->setPemEnergy(ePem); this->setChaEnergy(eCha); this->setWhaEnergy(eWha); this->setPhaEnergy(ePha); this->setPprEnergy(ePpr); } // } // namespace calor #endif // USE_CDFEDM2