Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-16 01:13:06

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