CMS 3D CMS Logo

CaloTower.h

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 // Original author: J. Mans - Minnesota
00022 //
00023 // Modified: Anton Anastassov (Northwestern)
00024 //    Make CaloTower inherit from LeafCandidate,
00025 //    add new members and accessors.
00026 
00027 
00028 class CaloTower : public reco::LeafCandidate {
00029 public:
00030   typedef CaloTowerDetId key_type; // for SortedCollection
00031 
00032   // Default constructor
00033   CaloTower();
00034 
00035   // Constructors from values
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    // setters
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   // getters
00057   CaloTowerDetId id() const { return id_; }
00058   const std::vector<DetId>& constituents() const { return constituents_; }
00059   size_t constituentsSize() const { return constituents_.size(); }
00060   DetId constituent( size_t i ) const { return constituents_[ i ]; }
00061 
00062   double emEnergy() const { return emE_ ; }
00063   double hadEnergy() const { return hadE_ ; }
00064   double outerEnergy() const { return (id_.ietaAbs()<16)? outerE_ : 0.0; }
00065   double emEt() const { return emE_ * sin( theta() ); }
00066   double hadEt() const { return hadE_ * sin( theta() ); }
00067   double outerEt() const { return (id_.ietaAbs()<16)? outerE_ * sin( theta() ) : 0.0; }
00068 
00069   const GlobalPoint& emPosition()  const { return emPosition_ ; }
00070   const GlobalPoint& hadPosition() const { return hadPosition_ ; }
00071 
00072   int emLvl1() const { return emLvl1_; }
00073   int hadLv11() const { return hadLvl1_; }
00074 
00075   double hadEnergyHeOuterLayer() const { return (id_.ietaAbs()<18 || id_.ietaAbs()>29)? 0 : outerE_; }
00076   double hadEnergyHeInnerLayer() const { return (id_.ietaAbs()<18 || id_.ietaAbs()>29)? 0 : hadE_ - outerE_; }
00077 
00078   float ecalTime() const { return float(ecalTime_) * 0.01; }
00079   float hcalTime() const { return float(hcalTime_) * 0.01; }
00080 
00081   int ieta() const { return id_.ieta(); }
00082   int ietaAbs() const { return id_.ietaAbs(); }
00083   int iphi() const { return id_.iphi(); }
00084   int zside() const { return id_.zside(); }
00085 
00086   int numCrystals() const; 
00087 
00088 private:
00089   CaloTowerDetId id_;
00090  
00091    // positions of assumed EM and HAD shower positions
00092    GlobalPoint emPosition_;
00093    GlobalPoint hadPosition_;
00094 
00095    // time
00096    int ecalTime_;
00097    int hcalTime_;
00098 
00099   Double32_t emE_, hadE_, outerE_;
00100 
00101   int emLvl1_,hadLvl1_;
00102   std::vector<DetId> constituents_;
00103 };
00104 
00105 std::ostream& operator<<(std::ostream& s, const CaloTower& ct);
00106 
00107 inline bool operator==( const CaloTower & t1, const CaloTower & t2 ) {
00108   return t1.id() == t2.id();
00109 } 
00110 
00111 #endif

Generated on Tue Jun 9 17:27:14 2009 for CMSSW by  doxygen 1.5.4