Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-07-18 00:47:58

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         bTag(0),
0038         thepointer(cand)
0039 
0040   {}
0041   MatchStruct(const reco::Candidate* cand, const unsigned int& obj, const float& bTagVal)
0042       : objType(obj),
0043         pt(cand->pt()),
0044         eta(cand->eta()),
0045         phi(cand->phi()),
0046         bTag(bTagVal),
0047         lorentzVector(cand->p4()),
0048         thepointer(cand)
0049 
0050   {}
0051   // FIXME: If finally the track is disappeared, then recover the last code...
0052   MatchStruct(const reco::Track* cand, const unsigned int& obj)
0053       : objType(obj), pt(cand->pt()), eta(cand->eta()), phi(cand->phi()), thepointer(cand) {}
0054   bool operator<(MatchStruct match) { return this->pt < match.pt; }
0055   bool operator>(MatchStruct match) { return this->pt > match.pt; }
0056 };
0057 
0058 //! Helper structure to order MatchStruct
0059 struct matchesByDescendingPt {
0060   bool operator()(MatchStruct a, MatchStruct b) { return a.pt > b.pt; }
0061 };
0062 struct matchesByDescendingBtag {
0063   bool operator()(MatchStruct a, MatchStruct b) { return a.bTag > b.bTag; }
0064 };
0065 #endif