1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#ifndef HLTRIGGEROFFLINE_HIGGS_MATCHSTRUCT_CC
#define HLTRIGGEROFFLINE_HIGGS_MATCHSTRUCT_CC
/** \class MatchStruct
* Generate histograms for trigger efficiencies Higgs related
* Documentation available on the CMS TWiki:
* https://twiki.cern.ch/twiki/bin/view/CMS/HiggsWGHLTValidate
*
* \author J. Duarte Campderros
*
*/
#include "DataFormats/Candidate/interface/Candidate.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "TLorentzVector.h"
#include "DataFormats/Math/interface/Vector3D.h"
#include <vector>
// Matching structure: helper structure to match gen/reco candidates with
// hlt trigger objects
struct MatchStruct {
unsigned int objType;
float pt;
float eta;
float phi;
float bTag;
math::XYZTLorentzVector lorentzVector;
const void* thepointer;
MatchStruct() : objType(0), pt(0), eta(0), phi(0), bTag(0), lorentzVector(0, 0, 0, 0), thepointer(nullptr) {}
MatchStruct(const reco::Candidate* cand, const unsigned int& obj)
: objType(obj),
pt(cand->pt()),
eta(cand->eta()),
phi(cand->phi()),
bTag(0),
thepointer(cand)
{}
MatchStruct(const reco::Candidate* cand, const unsigned int& obj, const float& bTagVal)
: objType(obj),
pt(cand->pt()),
eta(cand->eta()),
phi(cand->phi()),
bTag(bTagVal),
lorentzVector(cand->p4()),
thepointer(cand)
{}
// FIXME: If finally the track is disappeared, then recover the last code...
MatchStruct(const reco::Track* cand, const unsigned int& obj)
: objType(obj), pt(cand->pt()), eta(cand->eta()), phi(cand->phi()), thepointer(cand) {}
bool operator<(MatchStruct match) { return this->pt < match.pt; }
bool operator>(MatchStruct match) { return this->pt > match.pt; }
};
//! Helper structure to order MatchStruct
struct matchesByDescendingPt {
bool operator()(MatchStruct a, MatchStruct b) { return a.pt > b.pt; }
};
struct matchesByDescendingBtag {
bool operator()(MatchStruct a, MatchStruct b) { return a.bTag > b.bTag; }
};
#endif
|