Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-18 22:30:33

0001 #ifndef HLTRIGGEROFFLINE_HIGGS_MATCHSTRUCT_CC
0002 #define HLTRIGGEROFFLINE_HIGGS_MATCHSTRUCT_CC
0003 
0004 /** \class MatchStruct
0005 *  Generate histograms for trigger efficiencies Higgs related
0006 *  Documentation available on the CMS TWiki:
0007 *  https://twiki.cern.ch/twiki/bin/view/CMS/HiggsWGHLTValidate
0008 *
0009 *  \author  J. Duarte Campderros
0010 *
0011 */
0012 
0013 #include "DataFormats/Candidate/interface/Candidate.h"
0014 #include "DataFormats/TrackReco/interface/Track.h"
0015 
0016 #include "TLorentzVector.h"
0017 #include "DataFormats/Math/interface/Vector3D.h"
0018 
0019 #include <vector>
0020 
0021 // Matching structure: helper structure to match gen/reco candidates with
0022 // hlt trigger objects
0023 struct MatchStruct {
0024   unsigned int objType;
0025   float pt;
0026   float eta;
0027   float phi;
0028   float bTag;
0029   math::XYZTLorentzVector lorentzVector;
0030   const void* thepointer;
0031   MatchStruct() : objType(0), pt(0), eta(0), phi(0), bTag(0), lorentzVector(0, 0, 0, 0), thepointer(nullptr) {}
0032   MatchStruct(const reco::Candidate* cand, const unsigned int& obj)
0033       : objType(obj),
0034         pt(cand->pt()),
0035         eta(cand->eta()),
0036         phi(cand->phi()),
0037         thepointer(cand)
0038 
0039   {}
0040   MatchStruct(const reco::Candidate* cand, const unsigned int& obj, const float& bTagVal)
0041       : objType(obj),
0042         pt(cand->pt()),
0043         eta(cand->eta()),
0044         phi(cand->phi()),
0045         bTag(bTagVal),
0046         lorentzVector(cand->p4()),
0047         thepointer(cand)
0048 
0049   {}
0050   // FIXME: If finally the track is disappeared, then recover the last code...
0051   MatchStruct(const reco::Track* cand, const unsigned int& obj)
0052       : objType(obj), pt(cand->pt()), eta(cand->eta()), phi(cand->phi()), thepointer(cand) {}
0053   bool operator<(MatchStruct match) { return this->pt < match.pt; }
0054   bool operator>(MatchStruct match) { return this->pt > match.pt; }
0055 };
0056 
0057 //! Helper structure to order MatchStruct
0058 struct matchesByDescendingPt {
0059   bool operator()(MatchStruct a, MatchStruct b) { return a.pt > b.pt; }
0060 };
0061 struct matchesByDescendingBtag {
0062   bool operator()(MatchStruct a, MatchStruct b) { return a.bTag > b.bTag; }
0063 };
0064 #endif