Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-05-11 03:34:02

0001 #ifndef DataFormats_L1TParticleFlow_PFTau_h
0002 #define DataFormats_L1TParticleFlow_PFTau_h
0003 
0004 #include <algorithm>
0005 #include <vector>
0006 #include "DataFormats/L1Trigger/interface/L1Candidate.h"
0007 #include "DataFormats/L1TParticleFlow/interface/taus.h"
0008 #include "DataFormats/L1TParticleFlow/interface/gt_datatypes.h"
0009 
0010 namespace l1t {
0011 
0012   static constexpr float PFTAU_NN_OFFSET = 0.1;
0013   static constexpr float PFTAU_NN_SLOPE = 0.2;
0014   static constexpr float PFTAU_NN_OVERALL_SCALE = 1. / 20.1;
0015 
0016   static constexpr float PFTAU_NN_LOOSE_CUT = 0.22;
0017   static constexpr float PFTAU_NN_TIGHT_CUT = 0.4;
0018 
0019   static constexpr float PFTAU_PF_LOOSE_CUT = 10.0;
0020   static constexpr float PFTAU_PF_TIGHT_CUT = 5.0;
0021 
0022   static constexpr float PTSCALING_MASSCUT = 40.0;
0023 
0024   static constexpr double PFTAU_NN_PT_CUTOFF = 100.0;
0025 
0026   class PFTau : public L1Candidate {
0027   public:
0028     PFTau() {}
0029     enum { unidentified = 0, oneprong = 1, oneprongpi0 = 2, threeprong = 3 };
0030     PFTau(const LorentzVector& p,
0031           float iVector[80],
0032           float iso = -1,
0033           float fulliso = -1,
0034           int id = 0,
0035           int hwpt = 0,
0036           int hweta = 0,
0037           int hwphi = 0)
0038         : PFTau(PolarLorentzVector(p), iVector, iso, id, hwpt, hweta, hwphi) {}
0039     PFTau(const PolarLorentzVector& p,
0040           float iVector[80],
0041           float iso = -1,
0042           float fulliso = -1,
0043           int id = 0,
0044           int hwpt = 0,
0045           int hweta = 0,
0046           int hwphi = 0);
0047     float chargedIso() const { return iso_; }
0048     float fullIso() const { return fullIso_; }
0049     int id() const { return id_; }
0050 
0051     void setZ0(float z0) { setVertex(reco::Particle::Point(0, 0, z0)); }
0052     void setDxy(float dxy) { dxy_ = dxy; }
0053 
0054     float z0() const { return vz(); }
0055     float dxy() const { return dxy_; }
0056     const float* NNValues() const { return NNValues_; }
0057 
0058     bool passMass() const { return (mass() < 2 + pt() / PTSCALING_MASSCUT); }
0059     bool passLooseNN() const { return iso_ > PFTAU_NN_LOOSE_CUT; }
0060     bool passLooseNNMass() const {
0061       if (!passMass())
0062         return false;
0063       return passLooseNN();
0064     }
0065     bool passLoosePF() const { return fullIso_ < PFTAU_PF_LOOSE_CUT; }
0066     bool passTightNN() const { return iso_ > PFTAU_NN_TIGHT_CUT; }
0067     bool passTightNNMass() const {
0068       if (!passMass())
0069         return false;
0070       return passTightNN();
0071     }
0072     bool passTightPF() const { return fullIso_ < PFTAU_PF_TIGHT_CUT; }
0073 
0074     //Tau encoding for GT
0075     void set_encodedTau(l1gt::PackedTau encodedTau) { encodedTau_ = encodedTau; }
0076     l1gt::PackedTau encodedTau() const { return encodedTau_; }  //Can be unpacked using l1gt::Tau::unpack()
0077 
0078     //Return the l1gt Tau object from the encoded objects
0079     l1gt::Tau getHWTauGT() const { return l1gt::Tau::unpack(encodedTau_); }
0080 
0081   private:
0082     float NNValues_[80];  // Values for each of the 80 NN inputs
0083     float iso_;
0084     float fullIso_;
0085     int id_;
0086     float dxy_;
0087     l1gt::PackedTau encodedTau_;
0088   };
0089 
0090   typedef std::vector<l1t::PFTau> PFTauCollection;
0091 
0092   typedef edm::Ref<l1t::PFTauCollection> PFTauRef;
0093   typedef edm::RefVector<l1t::PFTauCollection> PFTauRefVector;
0094   typedef std::vector<l1t::PFTauRef> PFTauVectorRef;
0095 }  // namespace l1t
0096 #endif