ATLAS Offline Software
Analysis_Efficiency.cxx
Go to the documentation of this file.
1 
11 #include <cmath>
12 
15 
16 
17 
18 Analysis_Efficiency::Analysis_Efficiency(const std::string& name, double pTCut, double etaCut, double d0Cut, double z0Cut) :
19  TrackAnalysis(name), m_pTCut(pTCut), m_etaCut(etaCut), m_d0Cut(d0Cut), m_z0Cut(z0Cut) {
20 
21  // Create integral efficiency histograms
22  m_h_integralD = new TH1D(std::string(m_name+"-denominator-integral").c_str(), std::string(m_name+" integral efficiency denominator").c_str(), 1, 0.0, 1.0);
23  m_h_integralN = new TH1D(std::string(m_name+"-numerator-integral").c_str(), std::string(m_name+" integral efficiency numerator").c_str(), 1, 0.0, 1.0);
24  m_h_integral = new TH1D(std::string(m_name+"-integral").c_str(), std::string(m_name+" integral efficiency").c_str(), 1, 0.0, 1.0);
28 
29  // Create differential efficiency histograms
30  m_h_etaD = new TH1D(std::string(m_name+"-denominator-eta").c_str(), std::string(m_name+" eta efficiency denominator").c_str(), 100, -2.5, 2.5);
31  m_h_phiD = new TH1D(std::string(m_name+"-denominator-phi").c_str(), std::string(m_name+" phi efficiency denominator").c_str(), 100, -3.142, 3.142);
32  m_h_z0D = new TH1D(std::string(m_name+"-denominator-z0").c_str(), std::string(m_name+" z0 efficiency denominator").c_str(), 100, -200, 200);
33  m_h_d0D = new TH1D(std::string(m_name+"-denominator-d0").c_str(), std::string(m_name+" d0 efficiency denominator").c_str(), 100, -20, 20);
34  m_h_pTD = new TH1D(std::string(m_name+"-denominator-pT").c_str(), std::string(m_name+" pT efficiency denominator").c_str(), 100, -10000, 10000);
40 
41  m_h_etaN = new TH1D(std::string(m_name+"-numerator-eta").c_str(), std::string(m_name+" eta efficiency numerator").c_str(), 100, -2.5, 2.5);
42  m_h_phiN = new TH1D(std::string(m_name+"-numerator-phi").c_str(), std::string(m_name+" phi efficiency numerator").c_str(), 100, -3.142, 3.142);
43  m_h_z0N = new TH1D(std::string(m_name+"-numerator-z0").c_str(), std::string(m_name+" z0 efficiency numerator").c_str(), 100, -200, 200);
44  m_h_d0N = new TH1D(std::string(m_name+"-numerator-d0").c_str(), std::string(m_name+" d0 efficiency numerator").c_str(), 100, -20, 20);
45  m_h_pTN = new TH1D(std::string(m_name+"-numerator-pT").c_str(), std::string(m_name+" pT efficiency numerator").c_str(), 100, -10000, 10000);
51 
52  m_h_eta = new TH1D(std::string(m_name+"-eta").c_str(), std::string(m_name+" eta efficiency").c_str(), 100, -2.5, 2.5);
53  m_h_phi = new TH1D(std::string(m_name+"-phi").c_str(), std::string(m_name+" phi efficiency").c_str(), 100, -3.142, 3.142);
54  m_h_z0 = new TH1D(std::string(m_name+"-z0").c_str(), std::string(m_name+" z0 efficiency").c_str(), 100, -200, 200);
55  m_h_d0 = new TH1D(std::string(m_name+"-d0").c_str(), std::string(m_name+" d0 efficiency").c_str(), 100, -20, 20);
56  m_h_pT = new TH1D(std::string(m_name+"-pT").c_str(), std::string(m_name+" pT efficiency").c_str(), 100, -10000, 10000);
62 
63 }
64 
65 
66 
68 
69 }
70 
71 
72 
73 void Analysis_Efficiency::execute(const std::vector<TIDA::Track*>& referenceTracks,
74  const std::vector<TIDA::Track*>& /*testTracks*/,
75  TrackAssociator* associator) {
76 
77  // Loop over reference tracks
78  std::vector<TIDA::Track*>::const_iterator reference, referenceEnd=referenceTracks.end();
79  for(reference=referenceTracks.begin(); reference!=referenceEnd; ++reference) {
80 
81  // Get reference parameters
82  double referenceEta = (*reference)->eta();
83  double referencePhi = phi((*reference)->phi());
84  double referenceZ0 = (*reference)->z0();
85  double referenceD0 = (*reference)->a0();
86  double referencePT = (*reference)->pT();
87 
88  // Fill denominator
89  bool passesEta = (fabs(referenceEta)<m_etaCut);
90  bool passesPT = (fabs(referencePT)>m_pTCut);
91  bool passesD0 = (fabs(referenceD0)<m_d0Cut);
92  bool passesZ0 = (fabs(referenceZ0)<m_z0Cut);
93  if(passesPT&&passesD0&&passesZ0) m_h_etaD->Fill(referenceEta);
94  if(passesPT&&passesD0&&passesZ0&&passesEta) m_h_phiD->Fill(referencePhi);
95  if(passesPT&&passesD0&&passesEta) m_h_z0D->Fill(referenceZ0);
96  if(passesPT&&passesZ0&&passesEta) m_h_d0D->Fill(referenceD0);
97  if(passesD0&&passesZ0&&passesEta) m_h_pTD->Fill(referencePT);
98  if(passesPT&&passesD0&&passesZ0&&passesEta) m_h_integralD->Fill(0.5);
99 
100  // Find matched tracks
101  const TIDA::Track* test = associator->matched(*reference);
102 
103  // Fill histograms
104  if(test ) {
105 
106  // Fill denominator
107  if(passesPT&&passesD0&&passesZ0) m_h_etaN->Fill(referenceEta);
108  if(passesPT&&passesD0&&passesZ0&&passesEta) m_h_phiN->Fill(referencePhi);
109  if(passesPT&&passesD0&&passesEta) m_h_z0N->Fill(referenceZ0);
110  if(passesPT&&passesZ0&&passesEta) m_h_d0N->Fill(referenceD0);
111  if(passesD0&&passesZ0&&passesEta) m_h_pTN->Fill(referencePT);
112  if(passesPT&&passesD0&&passesZ0&&passesEta) m_h_integralN->Fill(0.5);
113 
114  }
115  }
116 }
117 
118 
119 
121 
122  m_h_phiD->Sumw2(); m_h_phiN->Sumw2(); m_h_phi->Sumw2(); m_h_phi->Divide(m_h_phiN, m_h_phiD, 1.0, 1.0, "B");
123  m_h_etaD->Sumw2(); m_h_etaN->Sumw2(); m_h_eta->Sumw2(); m_h_eta->Divide(m_h_etaN, m_h_etaD, 1.0, 1.0, "B");
124  m_h_z0D->Sumw2(); m_h_z0N->Sumw2(); m_h_z0->Sumw2(); m_h_z0->Divide(m_h_z0N, m_h_z0D, 1.0, 1.0, "B");
125  m_h_d0D->Sumw2(); m_h_d0N->Sumw2(); m_h_d0->Sumw2(); m_h_d0->Divide(m_h_d0N, m_h_d0D, 1.0, 1.0, "B");
126  m_h_pTD->Sumw2(); m_h_pTN->Sumw2(); m_h_pT->Sumw2(); m_h_pT->Divide(m_h_pTN, m_h_pTD, 1.0, 1.0, "B");
127  m_h_integralD->Sumw2(); m_h_integralN->Sumw2(); m_h_integral->Sumw2(); m_h_integral->Divide(m_h_integralN, m_h_integralD, 1.0, 1.0, "B");
128 
129 }
130 
131 
132 
133 double Analysis_Efficiency::phi(double p) {
134  if(p < -M_PI) p += 2*M_PI;
135  if(p > M_PI) p -= 2*M_PI;
136  return p;
137 }
138 
139 
Analysis_Efficiency::m_d0Cut
double m_d0Cut
Definition: Analysis_Efficiency.h:72
Analysis_Efficiency::m_h_d0D
TH1 * m_h_d0D
Definition: Analysis_Efficiency.h:56
Analysis_Efficiency::m_h_d0
TH1 * m_h_d0
Definition: Analysis_Efficiency.h:66
TIDA::Associator
Definition: TIDAAssociator.h:24
Analysis_Efficiency::m_h_integral
TH1 * m_h_integral
Definition: Analysis_Efficiency.h:50
Track.h
Analysis_Efficiency::m_h_z0
TH1 * m_h_z0
Definition: Analysis_Efficiency.h:65
Analysis_Efficiency::phi
double phi(double p)
Definition: Analysis_Efficiency.cxx:133
Analysis_Efficiency::m_h_d0N
TH1 * m_h_d0N
Definition: Analysis_Efficiency.h:61
M_PI
#define M_PI
Definition: ActiveFraction.h:11
reference
Definition: hcg.cxx:437
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:147
Analysis_Efficiency::m_h_z0D
TH1 * m_h_z0D
Definition: Analysis_Efficiency.h:55
TIDA::Associator::matched
virtual const S * matched(T *t)
Definition: TIDAAssociator.h:45
Analysis_Efficiency::m_h_phi
TH1 * m_h_phi
Definition: Analysis_Efficiency.h:64
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Analysis_Efficiency::finalise
virtual void finalise()
Definition: Analysis_Efficiency.cxx:120
Analysis_Efficiency::m_h_z0N
TH1 * m_h_z0N
Definition: Analysis_Efficiency.h:60
Analysis_Efficiency::m_h_pTN
TH1 * m_h_pTN
Definition: Analysis_Efficiency.h:62
TrackAnalysis
Definition: TrackAnalysis.h:32
Analysis_Efficiency::m_h_etaD
TH1 * m_h_etaD
Definition: Analysis_Efficiency.h:53
Analysis_Efficiency.h
Analysis_Efficiency::m_h_phiD
TH1 * m_h_phiD
Definition: Analysis_Efficiency.h:54
Analysis_Efficiency::m_h_pTD
TH1 * m_h_pTD
Definition: Analysis_Efficiency.h:57
Analysis_Efficiency::m_h_phiN
TH1 * m_h_phiN
Definition: Analysis_Efficiency.h:59
Analysis_Efficiency::m_pTCut
double m_pTCut
Definition: Analysis_Efficiency.h:70
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Analysis_Efficiency::m_h_integralD
TH1 * m_h_integralD
Definition: Analysis_Efficiency.h:48
Analysis_Efficiency::execute
virtual void execute(const std::vector< TIDA::Track * > &referenceTracks, const std::vector< TIDA::Track * > &testTracks, TrackAssociator *associator)
Definition: Analysis_Efficiency.cxx:73
Analysis_Efficiency::m_h_integralN
TH1 * m_h_integralN
Definition: Analysis_Efficiency.h:49
TrackAnalysis::addHistogram
void addHistogram(TH1 *h)
Definition: TrackAnalysis.h:97
Analysis_Efficiency::m_etaCut
double m_etaCut
Definition: Analysis_Efficiency.h:71
Analysis_Efficiency::m_h_pT
TH1 * m_h_pT
Definition: Analysis_Efficiency.h:67
dq_make_web_display.reference
reference
Definition: dq_make_web_display.py:44
Analysis_Efficiency::Analysis_Efficiency
Analysis_Efficiency(const std::string &name, double pTCut, double etaCut, double d0Cut, double z0Cut)
Definition: Analysis_Efficiency.cxx:18
TIDA::Track
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:26
Analysis_Efficiency::m_z0Cut
double m_z0Cut
Definition: Analysis_Efficiency.h:73
Analysis_Efficiency::m_h_eta
TH1 * m_h_eta
Definition: Analysis_Efficiency.h:63
Analysis_Efficiency::initialise
virtual void initialise()
standard operation interface
Definition: Analysis_Efficiency.cxx:67
TrackAnalysis::m_name
std::string m_name
identifier of the of the analysis - also used for the root directory into which the histograms are pu...
Definition: TrackAnalysis.h:145
Analysis_Efficiency::m_h_etaN
TH1 * m_h_etaN
Definition: Analysis_Efficiency.h:58