Go to the documentation of this file.00001 #ifndef DATAFORMATS_CALOTOWERS_CALOTOWER_H
00002 #define DATAFORMATS_CALOTOWERS_CALOTOWER_H 1
00003
00004 #include "DataFormats/Candidate/interface/LeafCandidate.h"
00005 #include "DataFormats/DetId/interface/DetId.h"
00006 #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h"
00007 #include "DataFormats/Math/interface/Vector3D.h"
00008 #include "Rtypes.h"
00009 #include <vector>
00010 #include <cmath>
00011
00012 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00013
00021
00022
00023
00024
00025
00026
00027
00028 class CaloTower : public reco::LeafCandidate {
00029 public:
00030 typedef CaloTowerDetId key_type;
00031
00032
00033 CaloTower();
00034
00035
00036
00037 CaloTower(const CaloTowerDetId& id,
00038 double emE, double hadE, double outerE,
00039 int ecal_tp, int hcal_tp,
00040 const PolarLorentzVector p4,
00041 GlobalPoint emPosition, GlobalPoint hadPosition);
00042
00043 CaloTower(const CaloTowerDetId& id,
00044 double emE, double hadE, double outerE,
00045 int ecal_tp, int hcal_tp,
00046 const LorentzVector p4,
00047 GlobalPoint emPosition, GlobalPoint hadPosition);
00048
00049
00050
00051 void addConstituent( DetId id ) { constituents_.push_back( id ); }
00052 void addConstituents( const std::vector<DetId>& ids );
00053 void setEcalTime(int t) { ecalTime_ = t; };
00054 void setHcalTime(int t) { hcalTime_ = t; };
00055
00056
00057
00058
00059 void setCaloTowerStatus(unsigned int numBadHcalChan,unsigned int numBadEcalChan,
00060 unsigned int numRecHcalChan,unsigned int numRecEcalChan,
00061 unsigned int numProbHcalChan,unsigned int numProbEcalChan);
00062
00063 void setCaloTowerStatus(uint32_t s) { twrStatusWord_ = s; }
00064
00065
00066 void setHottestCellE(double e) { hottestCellE_ = e; }
00067
00068
00069
00070
00071
00072 CaloTowerDetId id() const { return id_; }
00073 const std::vector<DetId>& constituents() const { return constituents_; }
00074 size_t constituentsSize() const { return constituents_.size(); }
00075 DetId constituent( size_t i ) const { return constituents_[ i ]; }
00076
00077
00078
00079 double emEnergy() const { return emE_ ; }
00080 double hadEnergy() const { return hadE_ ; }
00081 double outerEnergy() const { return (id_.ietaAbs()<16)? outerE_ : 0.0; }
00082
00083
00084 double emEt() const { return emE_ * sin( theta() ); }
00085 double hadEt() const { return hadE_ * sin( theta() ); }
00086 double outerEt() const { return (id_.ietaAbs()<16)? outerE_ * sin( theta() ) : 0.0; }
00087
00088
00089
00090
00091
00092 using LeafCandidate::p4;
00093 using LeafCandidate::p;
00094 using LeafCandidate::et;
00095
00096
00097
00098
00099 math::PtEtaPhiMLorentzVector p4(double vtxZ) const;
00100 double p (double vtxZ) const { return p4(vtxZ).P(); }
00101 double et(double vtxZ) const { return p4(vtxZ).Et(); }
00102
00103 double emEt(double vtxZ) const { return emE_ * sin(p4(vtxZ).theta()); }
00104 double hadEt(double vtxZ) const { return hadE_ * sin(p4(vtxZ).theta()); }
00105 double outerEt(double vtxZ) const { return (id_.ietaAbs()<16)? outerE_ * sin(p4(vtxZ).theta()) : 0.0; }
00106
00107
00108
00109 math::PtEtaPhiMLorentzVector p4(Point v) const;
00110 double p (Point v) const { return p4(v).P(); }
00111 double et(Point v) const { return p4(v).Et(); }
00112
00113 double emEt(Point v) const { return emE_ * sin(p4(v).theta()); }
00114 double hadEt(Point v) const { return hadE_ * sin(p4(v).theta()); }
00115 double outerEt(Point v) const { return (id_.ietaAbs()<16)? outerE_ * sin(p4(v).theta()) : 0.0; }
00116
00117 double hottestCellE() const { return hottestCellE_; }
00118
00119
00120
00121
00122 math::PtEtaPhiMLorentzVector p4_HO() const;
00123 math::PtEtaPhiMLorentzVector p4_HO(double vtxZ) const;
00124 math::PtEtaPhiMLorentzVector p4_HO(Point v) const;
00125
00126
00127
00128
00129 const GlobalPoint& emPosition() const { return emPosition_ ; }
00130 const GlobalPoint& hadPosition() const { return hadPosition_ ; }
00131
00132 int emLvl1() const { return emLvl1_; }
00133 int hadLv11() const { return hadLvl1_; }
00134
00135
00136 double hadEnergyHeOuterLayer() const { return (id_.ietaAbs()<18 || id_.ietaAbs()>29)? 0 : outerE_; }
00137 double hadEnergyHeInnerLayer() const { return (id_.ietaAbs()<18 || id_.ietaAbs()>29)? 0 : hadE_ - outerE_; }
00138
00139
00140
00141
00142 double energyInHB() const;
00143 double energyInHE() const;
00144 double energyInHF() const;
00145 double energyInHO() const;
00146
00147
00148
00149
00150 float ecalTime() const { return float(ecalTime_) * 0.01; }
00151 float hcalTime() const { return float(hcalTime_) * 0.01; }
00152
00153
00154 int ieta() const { return id_.ieta(); }
00155 int ietaAbs() const { return id_.ietaAbs(); }
00156 int iphi() const { return id_.iphi(); }
00157 int zside() const { return id_.zside(); }
00158
00159 int numCrystals() const;
00160
00161
00162
00163
00164
00165 unsigned int numBadEcalCells() const { return (twrStatusWord_ & 0x1F); }
00166 unsigned int numRecoveredEcalCells() const { return ((twrStatusWord_ >> 5) & 0x1F); }
00167 unsigned int numProblematicEcalCells() const { return ((twrStatusWord_ >> 10) & 0x1F); }
00168
00169 unsigned int numBadHcalCells() const { return ( (twrStatusWord_ >> 15)& 0x7); }
00170 unsigned int numRecoveredHcalCells() const { return ((twrStatusWord_ >> 18) & 0x7); }
00171 unsigned int numProblematicHcalCells() const { return ((twrStatusWord_ >> 21) & 0x7); }
00172
00173
00174 uint32_t towerStatusWord() const { return twrStatusWord_; }
00175
00176
00177 private:
00178 CaloTowerDetId id_;
00179
00180 uint32_t twrStatusWord_;
00181
00182
00183 GlobalPoint emPosition_;
00184 GlobalPoint hadPosition_;
00185
00186
00187 int ecalTime_;
00188 int hcalTime_;
00189
00190 float emE_, hadE_, outerE_;
00191
00192 float hottestCellE_;
00193
00194 int emLvl1_,hadLvl1_;
00195 std::vector<DetId> constituents_;
00196
00197
00198
00199
00200
00201 math::PtEtaPhiMLorentzVector hadP4(Point v) const;
00202 math::PtEtaPhiMLorentzVector emP4(Point v) const;
00203
00204
00205 math::PtEtaPhiMLorentzVector hadP4(double vtxZ) const;
00206 math::PtEtaPhiMLorentzVector emP4(double vtxZ) const;
00207 };
00208
00209 std::ostream& operator<<(std::ostream& s, const CaloTower& ct);
00210
00211 inline bool operator==( const CaloTower & t1, const CaloTower & t2 ) {
00212 return t1.id() == t2.id();
00213 }
00214
00215 #endif