Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:31

0001 #ifndef DataFormats_L1TCalorimeterPhase2_CaloCrystalsCluster_h
0002 #define DataFormats_L1TCalorimeterPhase2_CaloCrystalsCluster_h
0003 
0004 #include <ap_int.h>
0005 #include <vector>
0006 #include <map>
0007 #include <string>
0008 #include <algorithm>
0009 #include "DataFormats/L1Trigger/interface/L1Candidate.h"
0010 #include "DataFormats/DetId/interface/DetId.h"
0011 
0012 namespace l1tp2 {
0013 
0014   class CaloCrystalCluster : public l1t::L1Candidate {
0015   public:
0016     CaloCrystalCluster()
0017         : l1t::L1Candidate(),
0018           calibratedPt_(0.),
0019           hovere_(0.),
0020           iso_(0.),
0021           puCorrPt_(0.),
0022           bremStrength_(0.),
0023           e2x2_(0.),
0024           e2x5_(0.),
0025           e3x5_(0.),
0026           e5x5_(0.),
0027           standaloneWP_(0.),
0028           electronWP98_(0.),
0029           photonWP80_(0.),
0030           electronWP90_(0.),
0031           looseL1TkMatchWP_(0.),
0032           stage2effMatch_(0.){};
0033 
0034     CaloCrystalCluster(const PolarLorentzVector &p4,
0035                        float calibratedPt,
0036                        float hovere,
0037                        float iso,
0038                        DetId seedCrystal,
0039                        float puCorrPt = 0.,
0040                        float bremStrength = 0.,
0041                        float e2x2 = 0.,
0042                        float e2x5 = 0.,
0043                        float e3x5 = 0.,
0044                        float e5x5 = 0.,
0045                        bool standaloneWP = false,
0046                        bool electronWP98 = false,
0047                        bool photonWP80 = false,
0048                        bool electronWP90 = false,
0049                        bool looseL1TkMatchWP = false,
0050                        bool stage2effMatch = false)
0051         : l1t::L1Candidate(p4),
0052           calibratedPt_(calibratedPt),
0053           hovere_(hovere),
0054           iso_(iso),
0055           seedCrystal_(seedCrystal),
0056           puCorrPt_(puCorrPt),
0057           bremStrength_(bremStrength),
0058           e2x2_(e2x2),
0059           e2x5_(e2x5),
0060           e3x5_(e3x5),
0061           e5x5_(e5x5),
0062           standaloneWP_(standaloneWP),
0063           electronWP98_(electronWP98),
0064           photonWP80_(photonWP80),
0065           electronWP90_(electronWP90),
0066           looseL1TkMatchWP_(looseL1TkMatchWP),
0067           stage2effMatch_(stage2effMatch){};
0068 
0069     ~CaloCrystalCluster() override{};
0070     inline float calibratedPt() const { return calibratedPt_; };
0071     inline float hovere() const { return hovere_; };
0072     inline float isolation() const { return iso_; };
0073     inline float puCorrPt() const { return puCorrPt_; };
0074     inline float bremStrength() const { return bremStrength_; };
0075     inline DetId seedCrystal() const { return seedCrystal_; };
0076     void setCrystalPtInfo(std::vector<float> info) {
0077       std::sort(info.begin(), info.end());
0078       std::reverse(info.begin(), info.end());
0079       crystalPt_ = std::move(info);
0080     };
0081     void setExperimentalParams(const std::map<std::string, float> &params) { experimentalParams_ = params; };
0082     const std::map<std::string, float> &getExperimentalParams() const { return experimentalParams_; };
0083     inline float experimentalParam(const std::string &name) const {
0084       auto iter = experimentalParams_.find(name);
0085       if (iter != experimentalParams_.end()) {
0086         return iter->second;
0087       } else {
0088         warningNoMapping(name);
0089         return -99.;
0090       }
0091     };
0092 
0093     inline float e2x2() const { return e2x2_; };
0094     inline float e2x5() const { return e2x5_; };
0095     inline float e3x5() const { return e3x5_; };
0096     inline float e5x5() const { return e5x5_; };
0097     inline float standaloneWP() const { return standaloneWP_; };
0098     inline float electronWP98() const { return electronWP98_; };
0099     inline float photonWP80() const { return photonWP80_; };
0100     inline float electronWP90() const { return electronWP90_; };
0101     inline float looseL1TkMatchWP() const { return looseL1TkMatchWP_; };
0102     inline float stage2effMatch() const { return stage2effMatch_; };
0103 
0104     // The index range depends on the algorithm eta,phi window, currently 3x5
0105     // The pt should always be ordered.
0106     inline float crystalPt(unsigned int index) const { return (index < crystalPt_.size()) ? crystalPt_[index] : 0.; };
0107 
0108   private:
0109     static void warningNoMapping(const std::string &name);
0110     // pT calibrated to Stage-2 (Phase-I) L1EG Objects.  NOTE
0111     // all working points are defined with respect to cluster.pt(),
0112     // not cluster.calibratedPt()
0113     float calibratedPt_;
0114     // HCal energy in region behind cluster (for size, look in producer) / ECal energy in cluster
0115     float hovere_;
0116     // ECal isolation (for outer window size, again look in producer)
0117     float iso_;
0118     // DetId of seed crystal used to make cluster (could be EBDetId or EEDetId)
0119     DetId seedCrystal_;
0120     // Pileup-corrected energy deposit, not studied carefully yet, don't use
0121     float puCorrPt_;
0122     // Bremstrahlung strength, should be proportional to the likelihood of a brem.
0123     float bremStrength_;
0124     // Shower shape variable - max 2x2 energy containing seed crystal
0125     float e2x2_;
0126     // Shower shape variable - max 2x5 energy containing seed crystal, phi centered
0127     float e2x5_;
0128     // Shower shape variable - 3x5 energy containing seed crystal, phi centered
0129     float e3x5_;
0130     // Shower shape variable - 5x5 energy containing centered on seed crystal
0131     float e5x5_;
0132     // Standalone L1EG WP
0133     bool standaloneWP_;
0134     // 98% efficient electron WP, for electrons above 35 GeV
0135     bool electronWP98_;
0136     // 80% efficient photon WP, for photons above 35 GeV
0137     bool photonWP80_;
0138     // 90% efficient electron based WP, early rise to efficiency plateau
0139     bool electronWP90_;
0140     // loose isolation and shower shape requirements to be used in conjunction with L1Trk matching
0141     bool looseL1TkMatchWP_;
0142     // Stage-2 L1EG efficiency matched WP, for rate comparisons
0143     bool stage2effMatch_;
0144     // Crystal pt (in order of strength) for all crystals in the cluster
0145     std::vector<float> crystalPt_;
0146     // For investigating novel algorithm parameters
0147     std::map<std::string, float> experimentalParams_;
0148   };
0149 
0150   // Concrete collection of output objects (with extra tuning information)
0151   typedef std::vector<l1tp2::CaloCrystalCluster> CaloCrystalClusterCollection;
0152 }  // namespace l1tp2
0153 #endif