CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_7_hltpatch2/src/HLTriggerOffline/Higgs/src/MatchStruct.cc

Go to the documentation of this file.
00001 #ifndef HLTRIGGEROFFLINE_HIGGS_MATCHSTRUCT_CC
00002 #define HLTRIGGEROFFLINE_HIGGS_MATCHSTRUCT_CC
00003 
00015 #include "DataFormats/Candidate/interface/Candidate.h"
00016 #include "DataFormats/TrackReco/interface/Track.h"
00017 
00018 #include "TLorentzVector.h"
00019 
00020 #include<vector>
00021 
00022 // Matching structure: helper structure to match gen/reco candidates with
00023 // hlt trigger objects
00024 struct MatchStruct 
00025 {
00026         unsigned int objType;
00027         float pt;
00028         float eta;
00029         float phi;
00030         const void * thepointer;
00031         MatchStruct():
00032                 objType(0),
00033                 pt(0),
00034                 eta(0),
00035                 phi(0),
00036                 thepointer(0)
00037         {
00038         }
00039         MatchStruct(const reco::Candidate * cand, const unsigned int & obj) :
00040                 objType(obj),
00041                 pt(cand->pt()),
00042                 eta(cand->eta()),
00043                 phi(cand->phi()),
00044                 thepointer(cand)
00045 
00046         {
00047         }
00048         // FIXME: If finally the track is disappeared, then recover the last code...
00049         MatchStruct(const reco::Track * cand, const unsigned int & obj) :
00050                 objType(obj),
00051                 pt(cand->pt()),
00052                 eta(cand->eta()),
00053                 phi(cand->phi()),
00054                 thepointer(cand)
00055         {
00056         }
00057         bool operator<(MatchStruct match) 
00058         {      
00059                 return this->pt < match.pt;
00060         }
00061         bool operator>(MatchStruct match) 
00062         {
00063                 return this->pt > match.pt;                     
00064         }
00065 };
00066 
00068 struct matchesByDescendingPt 
00069 {
00070         bool operator() (MatchStruct a, MatchStruct b) 
00071         {     
00072                 return a.pt > b.pt;
00073         }
00074 };
00075 #endif