#ifndef _PHYSICSTOWER_HH_ #define _PHYSICSTOWER_HH_ #ifdef USE_CDFEDM2 //////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Component: PhysicsTower.hh // Purpose: This class represents a calorimeter tower whose energies // were calculated using a specific vertex. This class will // eventually inherit from the (yet to be coded) Clusterable // class. // // Created: 10/06/99 Pierre Savard // History: 27/07/00 Pierre Savard : fixed old adjacency bug // ///////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include "CalorGeometry/CalConstants.hh" #include "CalorGeometry/TowerKey.hh" #include "CalorGeometry/Index.hh" #ifndef __CINT__ # include "CLHEP/Vector/LorentzVector.h" #else class HepLorentzVector; #endif // namespace calor { class CalTower; class PhysicsTower { public: // // Memory management // // Initialization constructor PhysicsTower(float totEta = 0., float emEta = 0., float hadEta = 0., float totPhi = 0., float emPhi = 0., float hadPhi = 0., float emEnergy = 0., float hadEnergy =0., HepLorentzVector fourMomentum = HepLorentzVector(), float emEt = 0., float hadEt = 0., float totEt = 0., size_t iEta = 0, size_t iPhi = 0): _totEta(totEta), _emEta(emEta), _hadEta(hadEta), _totPhi(totPhi), _emPhi(emPhi), _hadPhi(hadPhi), _emEnergy(emEnergy), _hadEnergy(hadEnergy), _fourMomentum(fourMomentum), _emEt(emEt), _hadEt(hadEt), _totEt(totEt), _iEta(iEta), _iPhi(iPhi){} // Default copy constructor and assignment operator do the right thing. // Destructor // ~PhysicsTower(); PhysicsTower* clone() const; // // Testing // // Equality test bool operator==(const PhysicsTower& rhs) const; // // Manipulation and access // // Access methods float totEnergy() const; float emEnergy() const; float hadEnergy() const; float totPhi() const; float emPhi() const; float hadPhi() const; float totEta() const; float emEta() const; float hadEta() const; float emEt() const; float hadEt() const; float totEt() const; float px() const; float py() const; float pz() const; HepLorentzVector fourMomentum() const; size_t iEta() const; size_t iPhi() const; // CalTower* tower() const; TowerKey key() const; Index index() const; int adj(PhysicsTower* tower) const; int adj(const PhysicsTower* tower) const; float dEta(float eta) const; float dPhi(float phi) const; float dEta(const PhysicsTower* tower) const; float dPhi(const PhysicsTower* tower) const; float dR(float eta, float phi) const; float dRsquared(float eta,float phi) const; // // Printing // // this will print PhysicsTower data members void print() const; friend std::ostream& operator<<(std::ostream& os, const PhysicsTower& t); private: float _totEta; // eta calculated according to specified calculator float _emEta; // EM eta center float _hadEta; // HAD eta center float _totPhi; // phi calculated according to specified calculator float _emPhi; // EM phi center-of-gravity float _hadPhi; // HAD phi center-of-gravity float _emEnergy; float _hadEnergy; HepLorentzVector _fourMomentum; float _totEt; // Et calculated according to specified "Calculator" float _emEt; float _hadEt; size_t _iEta; size_t _iPhi; }; // typedef std::vector PhysicsTowerView; inline size_t PhysicsTower::iEta() const {return _iEta;} inline size_t PhysicsTower::iPhi() const {return _iPhi;} inline float PhysicsTower::totEnergy() const{return (_emEnergy+_hadEnergy);} inline float PhysicsTower::emEnergy() const {return _emEnergy;} inline float PhysicsTower::hadEnergy() const {return _hadEnergy;} inline float PhysicsTower::totEt() const{return _totEt;} inline float PhysicsTower::emEt() const {return _emEt;} inline float PhysicsTower::hadEt() const {return _hadEt;} inline float PhysicsTower::emPhi() const {return _emPhi;} inline float PhysicsTower::hadPhi() const {return _hadPhi;} inline float PhysicsTower::totPhi() const {return _totPhi;} inline float PhysicsTower::emEta() const {return _emEta;} inline float PhysicsTower::hadEta() const {return _hadEta;} inline float PhysicsTower::totEta() const {return _totEta;} inline float PhysicsTower::px() const {return _fourMomentum.px();} inline float PhysicsTower::py() const {return _fourMomentum.py();} inline float PhysicsTower::pz() const {return _fourMomentum.pz();} inline Index PhysicsTower::index() const {return Index(_iEta,_iPhi);} inline HepLorentzVector PhysicsTower::fourMomentum() const { return _fourMomentum; } inline TowerKey PhysicsTower::key() const {return TowerKey(_iEta,_iPhi);} inline int PhysicsTower::adj(PhysicsTower* tower) const { int dphi = abs(int(this->iPhi() - tower->iPhi())); if(dphi > 12) dphi = 24 -dphi; return (dphi*dphi + (this->iEta() - tower->iEta())*(this->iEta() - tower->iEta())); } inline int PhysicsTower::adj(const PhysicsTower* tower) const { int dphi = abs(int(this->iPhi() - tower->iPhi())); if(dphi > 12) dphi = 24 -dphi; return (dphi*dphi + (this->iEta() - tower->iEta())*(this->iEta() - tower->iEta())); } inline float PhysicsTower::dPhi(float phi) const { float diff = this->totPhi() - phi; if (fabs(diff)>M_PI) { if (diff>0) { diff = -(2*M_PI - fabs(diff)); } else if (diff<=0) { diff = (2*M_PI - fabs(diff)); } } return diff; } inline float PhysicsTower::dEta(float eta) const { return this->totEta() - eta; } inline float PhysicsTower::dPhi(const PhysicsTower* tower) const { float diff = this->totPhi() - tower->totPhi(); if (fabs(diff)>M_PI) { if (diff>0) { diff = -(2*M_PI - fabs(diff)); } else if (diff<=0) { diff = (2*M_PI - fabs(diff)); } } return diff; } inline float PhysicsTower::dEta(const PhysicsTower* tower) const { return this->totEta() - tower->totEta(); } inline float PhysicsTower::dR(float eta, float phi) const { return sqrt(dPhi(phi)*dPhi(phi) + dEta(eta)*dEta(eta)); } inline float PhysicsTower::dRsquared(float eta, float phi) const { return (dPhi(phi)*dPhi(phi) + dEta(eta)*dEta(eta)); } // } // namespace calor #endif // USE_CDFEDM2 #endif // _PHYSICSTOWER_HH_