00001 #include "DataFormats/CaloTowers/interface/CaloTower.h" 00002 00003 CaloTower::CaloTower() { 00004 emE_=0; 00005 hadE_=0; 00006 outerE_=0; 00007 emLvl1_=0; 00008 hadLvl1_=0; 00009 } 00010 00011 CaloTower::CaloTower(const CaloTowerDetId& id, 00012 double emE, double hadE, double outerE, 00013 int ecal_tp, int hcal_tp, 00014 const PolarLorentzVector p4, 00015 GlobalPoint emPos, GlobalPoint hadPos) : 00016 LeafCandidate(0, p4, Point(0,0,0)), 00017 id_(id), 00018 emE_(emE), hadE_(hadE), outerE_(outerE), 00019 emLvl1_(ecal_tp), hadLvl1_(hcal_tp), 00020 emPosition_(emPos), hadPosition_(hadPos) {} 00021 00022 00023 CaloTower::CaloTower(const CaloTowerDetId& id, 00024 double emE, double hadE, double outerE, 00025 int ecal_tp, int hcal_tp, 00026 const LorentzVector p4, 00027 GlobalPoint emPos, GlobalPoint hadPos) : 00028 LeafCandidate(0, p4, Point(0,0,0)), 00029 id_(id), 00030 emE_(emE), hadE_(hadE), outerE_(outerE), 00031 emLvl1_(ecal_tp), hadLvl1_(hcal_tp), 00032 emPosition_(emPos), hadPosition_(hadPos) {} 00033 00034 00035 void CaloTower::addConstituents( const std::vector<DetId>& ids ) { 00036 constituents_.reserve(constituents_.size()+ids.size()); 00037 constituents_.insert(constituents_.end(),ids.begin(),ids.end()); 00038 } 00039 00040 int CaloTower::numCrystals() const { 00041 if (id_.ietaAbs()>29) return 0; 00042 00043 int nC = 0; 00044 std::vector<DetId>::const_iterator it = constituents_.begin(); 00045 for (; it!=constituents_.end(); ++it) { 00046 if (it->det()==DetId::Ecal) ++nC; 00047 } 00048 00049 return nC; 00050 } 00051 00052 std::ostream& operator<<(std::ostream& s, const CaloTower& ct) { 00053 return s << ct.id() << ":" << ct.et() << " GeV ET (EM=" << ct.emEt() << 00054 " HAD=" << ct.hadEt() << " OUTER=" << ct.outerEt() << ") (" << ct.eta() << "," << ct.phi() << ")"; 00055 }