Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:53:20

0001 #ifndef EgammaReco_SuperCluster_h
0002 #define EgammaReco_SuperCluster_h
0003 /** \class reco::SuperCluster SuperCluster.h DataFormats/EgammaReco/interface/SuperCluster.h
0004  *  
0005  * A SuperCluster reconstructed in the Electromagnetic Calorimeter
0006  * contains references to seed and constituent BasicClusters
0007  *
0008  * \author Luca Lista, INFN
0009  *
0010  *
0011  */
0012 #include "DataFormats/Math/interface/Point3D.h"
0013 #include "DataFormats/CaloRecHit/interface/CaloCluster.h"
0014 #include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
0015 #include "DataFormats/DetId/interface/DetId.h"
0016 
0017 namespace reco {
0018   class SuperCluster : public CaloCluster {
0019   public:
0020     typedef math::XYZPoint Point;
0021 
0022     /// default constructor
0023     SuperCluster()
0024         : CaloCluster(0., Point(0., 0., 0.)),
0025           preshowerEnergy_(0),
0026           rawEnergy_(-1.),
0027           phiWidth_(0),
0028           etaWidth_(0),
0029           preshowerEnergy1_(0),
0030           preshowerEnergy2_(0) {}
0031 
0032     /// constructor defined by CaloCluster - will have to use setSeed and add() separately
0033     SuperCluster(double energy, const Point& position);
0034 
0035     SuperCluster(double energy,
0036                  const Point& position,
0037                  const CaloClusterPtr& seed,
0038                  const CaloClusterPtrVector& clusters,
0039                  double Epreshower = 0.,
0040                  double phiWidth = 0.,
0041                  double etaWidth = 0.,
0042                  double Epreshower1 = 0.,
0043                  double Epreshower2 = 0.);
0044 
0045     // to be merged in the previous one? -- FIXME
0046     SuperCluster(double energy,
0047                  const Point& position,
0048                  const CaloClusterPtr& seed,
0049                  const CaloClusterPtrVector& clusters,
0050                  const CaloClusterPtrVector& preshowerClusters,
0051                  double Epreshower = 0.,
0052                  double phiWidth = 0.,
0053                  double etaWidth = 0.,
0054                  double Epreshower1 = 0.,
0055                  double Epreshower2 = 0.);
0056 
0057     /// raw uncorrected energy (sum of energies of component BasicClusters)
0058     double rawEnergy() const { return rawEnergy_; }
0059 
0060     /// energy deposited in preshower
0061     double preshowerEnergy() const { return preshowerEnergy_; }
0062     double preshowerEnergyPlane1() const { return preshowerEnergy1_; }
0063     double preshowerEnergyPlane2() const { return preshowerEnergy2_; }
0064 
0065     /// obtain phi and eta width of the Super Cluster
0066     double phiWidth() const { return phiWidth_; }
0067     double etaWidth() const { return etaWidth_; }
0068 
0069     //Assign new variables to supercluster
0070     void setPreshowerEnergy(double preshowerEnergy) { preshowerEnergy_ = preshowerEnergy; };
0071     void setPreshowerEnergyPlane1(double preshowerEnergy1) { preshowerEnergy1_ = preshowerEnergy1; };
0072     void setPreshowerEnergyPlane2(double preshowerEnergy2) { preshowerEnergy2_ = preshowerEnergy2; };
0073     void setPhiWidth(double pw) { phiWidth_ = pw; }
0074     void setEtaWidth(double ew) { etaWidth_ = ew; }
0075 
0076     /// seed BasicCluster
0077     const CaloClusterPtr& seed() const { return seed_; }
0078 
0079     /// const access to the cluster list itself
0080     const CaloClusterPtrVector& clusters() const { return clusters_; }
0081 
0082     /// const access to the preshower cluster list itself
0083     const CaloClusterPtrVector& preshowerClusters() const { return preshowerClusters_; }
0084 
0085     /// fist iterator over BasicCluster constituents
0086     CaloCluster_iterator clustersBegin() const { return clusters_.begin(); }
0087 
0088     /// last iterator over BasicCluster constituents
0089     CaloCluster_iterator clustersEnd() const { return clusters_.end(); }
0090 
0091     /// fist iterator over PreshowerCluster constituents
0092     CaloCluster_iterator preshowerClustersBegin() const { return preshowerClusters_.begin(); }
0093 
0094     /// last iterator over PreshowerCluster constituents
0095     CaloCluster_iterator preshowerClustersEnd() const { return preshowerClusters_.end(); }
0096 
0097     /// number of BasicCluster constituents
0098     size_t clustersSize() const { return clusters_.size(); }
0099 
0100     /// number of BasicCluster PreShower constituents
0101     size_t preshowerClustersSize() const { return preshowerClusters_.size(); }
0102 
0103     /// list of used xtals by DetId // now inherited by CaloCluster
0104     //std::vector<DetId> getHitsByDetId() const { return usedHits_; }
0105 
0106     /// set reference to seed BasicCluster
0107     void setSeed(const CaloClusterPtr& r) { seed_ = r; }
0108 
0109     //(re)-set clusters
0110     void setClusters(const CaloClusterPtrVector& clusters) {
0111       clusters_ = clusters;
0112       computeRawEnergy();
0113     }
0114 
0115     //(re)-set preshower clusters
0116     void setPreshowerClusters(const CaloClusterPtrVector& clusters) { preshowerClusters_ = clusters; }
0117 
0118     //clear hits and fractions vector (for slimming)
0119     void clearHitsAndFractions() { hitsAndFractions_.clear(); }
0120 
0121     /// add reference to constituent BasicCluster
0122     void addCluster(const CaloClusterPtr& r) {
0123       clusters_.push_back(r);
0124       computeRawEnergy();
0125     }
0126 
0127     /// add reference to constituent BasicCluster
0128     void addPreshowerCluster(const CaloClusterPtr& r) { preshowerClusters_.push_back(r); }
0129 
0130     /** Set preshower planes status :
0131         0 : both planes working
0132         1 : only first plane working
0133         2 : only second plane working
0134         3 : both planes dead */
0135 
0136     void setPreshowerPlanesStatus(const uint32_t& status) {
0137       uint32_t flags = flags_ & flagsMask_;
0138       flags_ = flags | (status << flagsOffset_);
0139     }
0140 
0141     /** Get preshower planes status :
0142         0 : both planes working
0143         1 : only first plane working
0144         2 : only second plane working
0145         3 : both planes dead */
0146     const int getPreshowerPlanesStatus() const { return (flags_ >> flagsOffset_); }
0147 
0148   private:
0149     void computeRawEnergy();
0150 
0151     /// reference to BasicCluster seed
0152     CaloClusterPtr seed_;
0153 
0154     /// references to BasicCluster constitunets
0155     CaloClusterPtrVector clusters_;
0156 
0157     /// references to BasicCluster constitunets
0158     CaloClusterPtrVector preshowerClusters_;
0159 
0160     /// used hits by detId - retrieved from BC constituents -- now inherited from CaloCluster
0161     //std::vector<DetId> usedHits_;
0162 
0163     double preshowerEnergy_;
0164 
0165     double rawEnergy_;
0166 
0167     double phiWidth_;
0168     double etaWidth_;
0169 
0170     double preshowerEnergy1_;
0171     double preshowerEnergy2_;
0172   };
0173 
0174 }  // namespace reco
0175 #endif