Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:49

0001 #ifndef CastorReco_CastorTower_h
0002 #define CastorReco_CastorTower_h
0003 /** \class reco::CastorTower CastorTower.h DataFormats/CastorReco/CastorTower.h
0004  *  
0005  * Class for Castor towers
0006  *
0007  * \author Hans Van Haevermaet, University of Antwerp
0008  *
0009  *
0010  */
0011 #include <vector>
0012 #include <memory>
0013 #include "DataFormats/Math/interface/Point3D.h"
0014 
0015 #include "DataFormats/Common/interface/RefProd.h"
0016 #include "DataFormats/Common/interface/Ref.h"
0017 #include "DataFormats/Common/interface/RefVector.h"
0018 #include "DataFormats/Common/interface/SortedCollection.h"
0019 
0020 #include "DataFormats/HcalRecHit/interface/CastorRecHit.h"
0021 //#include "DataFormats/HcalRecHit/interface/HcalRecHitDefs.h"
0022 #include "DataFormats/Candidate/interface/LeafCandidate.h"
0023 
0024 namespace reco {
0025 
0026   class CastorTower : public LeafCandidate {
0027   public:
0028     typedef edm::SortedCollection<CastorRecHit> CastorRecHitCollection;
0029     typedef edm::Ref<CastorRecHitCollection> CastorRecHitRef;
0030     typedef edm::RefVector<CastorRecHitCollection> CastorRecHitRefs;
0031 
0032     // default constructor. Set energy and position to zero
0033 
0034     CastorTower()
0035         : energy_(0.),
0036           position_(ROOT::Math::XYZPoint(0., 0., 0.)),
0037           emEnergy_(0.),
0038           hadEnergy_(0.),
0039           fem_(0.),
0040           depth_(0.),
0041           fhot_(0.) {}
0042 
0043     // constructor from values
0044     CastorTower(const double energy,
0045                 const ROOT::Math::XYZPoint& position,
0046                 const double emEnergy,
0047                 const double hadEnergy,
0048                 const double fem,
0049                 const double depth,
0050                 const double fhot,
0051                 const CastorRecHitRefs& usedRecHits);
0052 
0053     /// destructor
0054     ~CastorTower() override;
0055 
0056     /// tower centroid position
0057     ROOT::Math::XYZPoint position() const { return position_; }
0058 
0059     /// tower em energy
0060     double emEnergy() const { return emEnergy_; }
0061 
0062     /// tower had energy
0063     double hadEnergy() const { return hadEnergy_; }
0064 
0065     /// tower em/tot ratio
0066     double fem() const { return fem_; }
0067 
0068     /// tower depth in z
0069     double depth() const { return depth_; }
0070 
0071     /// tower  hotcell/tot ratio
0072     double fhot() const { return fhot_; }
0073 
0074     /// vector of used RecHits
0075     CastorRecHitRefs getUsedRecHits() const { return usedRecHits_; }
0076 
0077     /// fist iterator over CastorRecHit constituents
0078     CastorRecHitRefs::iterator rechitsBegin() const { return usedRecHits_.begin(); }
0079 
0080     /// last iterator over CastorRecHit constituents
0081     CastorRecHitRefs::iterator rechitsEnd() const { return usedRecHits_.end(); }
0082 
0083     /// number of CastorRecHit constituents
0084     size_t rechitsSize() const { return usedRecHits_.size(); }
0085 
0086     /// add reference to constituent CastorRecHit
0087     void add(const CastorRecHitRef& rechit) { usedRecHits_.push_back(rechit); }
0088 
0089     /// comparison >= operator
0090     bool operator>=(const CastorTower& rhs) const { return (energy_ >= rhs.energy_); }
0091 
0092     /// comparison > operator
0093     bool operator>(const CastorTower& rhs) const { return (energy_ > rhs.energy_); }
0094 
0095     /// comparison <= operator
0096     bool operator<=(const CastorTower& rhs) const { return (energy_ <= rhs.energy_); }
0097 
0098     /// comparison <= operator
0099     bool operator<(const CastorTower& rhs) const { return (energy_ < rhs.energy_); }
0100 
0101     /// x of tower centroid
0102     double xPos() const { return position_.x(); }
0103 
0104     /// y of tower centroid
0105     double yPos() const { return position_.y(); }
0106 
0107     /// rho of tower centroid
0108     double rho() const { return position_.rho(); }
0109 
0110   private:
0111     /// tower energy
0112     double energy_;
0113 
0114     /// tower centroid position
0115     ROOT::Math::XYZPoint position_;
0116 
0117     /// tower em energy
0118     double emEnergy_;
0119 
0120     /// tower had energy
0121     double hadEnergy_;
0122 
0123     /// tower em/tot Ratio
0124     double fem_;
0125 
0126     /// tower depth
0127     double depth_;
0128 
0129     /// tower  hotcell/tot ratio
0130     double fhot_;
0131 
0132     /// references to CastorRecHit constituents
0133     CastorRecHitRefs usedRecHits_;
0134   };
0135 
0136   /// collection of CastorTower objects
0137   typedef std::vector<CastorTower> CastorTowerCollection;
0138 
0139   // persistent reference to CastorTower objects
0140   typedef edm::Ref<CastorTowerCollection> CastorTowerRef;
0141 
0142   /// vector of references to CastorTower objects all in the same collection
0143   typedef edm::RefVector<CastorTowerCollection> CastorTowerRefVector;
0144 
0145   /// iterator over a vector of references to CastorTower objects all in the same collection
0146   typedef CastorTowerRefVector::iterator CastorTower_iterator;
0147 
0148 }  // namespace reco
0149 
0150 #endif