ATLAS Offline Software
Analysis_Resolution.cxx
Go to the documentation of this file.
1 
11 #include <cmath>
12 
15 
16 
17 Analysis_Resolution::Analysis_Resolution(const std::string& name, double pTCut, double etaCut, double d0Cut, double z0Cut) :
18  TrackAnalysis(name), m_pTCut(pTCut), m_etaCut(etaCut), m_d0Cut(d0Cut), m_z0Cut(z0Cut) {
19 
20  // Create resolution histograms
21  m_h_res_eta = new TH1D(std::string(m_name+"-Res-eta").c_str(), std::string(m_name+" eta resolution").c_str(), 100, -0.02, 0.02);
22  m_h_res_phi = new TH1D(std::string(m_name+"-Res-phi").c_str(), std::string(m_name+" phi resolution").c_str(), 100, -0.01, 0.01);
23  m_h_res_z0 = new TH1D(std::string(m_name+"-Res-z0").c_str(), std::string(m_name+" z0 resolution").c_str(), 100, -3.0, 3.0);
24  m_h_res_d0 = new TH1D(std::string(m_name+"-Res-d0").c_str(), std::string(m_name+" d0 resolution").c_str(), 100, -3.0, 3.0);
25  m_h_res_invpT = new TH1D(std::string(m_name+"-Res-pT").c_str(), std::string(m_name+" inv-pT resolution").c_str(), 100, -0.0004, 0.0004);
31 
32  // Create pull histograms
33  m_h_pull_eta = new TH1D(std::string(m_name+"-Pull-eta").c_str(), std::string(m_name+" eta pull").c_str(), 100, -20.0, 20.0);
34  m_h_pull_phi = new TH1D(std::string(m_name+"-Pull-phi").c_str(), std::string(m_name+" phi pull").c_str(), 100, -20.0, 20.0);
35  m_h_pull_z0 = new TH1D(std::string(m_name+"-Pull-z0").c_str(), std::string(m_name+" z0 pull").c_str(), 100, -20.0, 20.0);
36  m_h_pull_d0 = new TH1D(std::string(m_name+"-Pull-d0").c_str(), std::string(m_name+" d0 pull").c_str(), 100, -20.0, 20.0);
37  m_h_pull_invpT = new TH1D(std::string(m_name+"-Pull-pT").c_str(), std::string(m_name+" inv-pT pull").c_str(), 100, -20.0, 20.0);
43 
44  //Create more specific resolution histograms
45  m_h_res_d0VsPt = new TH2D(std::string(m_name+"-Res-d0VsPt").c_str(), std::string(m_name+" d0VsPt resolution").c_str(),
46  50, -3.0, 3.0, 500, -30000.0, 30000.0);
47  m_h_res_z0VsPt = new TH2D(std::string(m_name+"-z0VsPt").c_str(), std::string(m_name+" z0VsPt resolution").c_str(),
48  50, -3.0, 3.0, 500, -30000.0, 30000.0);
49  m_h_res_d0VsD0 = new TH2D(std::string(m_name+"-Res-d0VsD0").c_str(),std::string(m_name+" d0VsD0 resolution").c_str(),
50  50, -3.0, 3.0, 500, -300.0, 300.0);
51  m_h_res_z0VsEta = new TH2D(std::string(m_name+"-Res-z0VsEta").c_str(), std::string(m_name+" z0VsEta resolution").c_str(),
52  50, -3.0, 3.0, 500, -3.0, 3.0);
53  m_h_res_d0VsPixelHits_withBLayer = new TH2D(std::string(m_name+"-Res-d0VsPixel-withBLayer").c_str(),
54  std::string(m_name+" resolution vs pixelHits (w b-layer)").c_str(), 50, -3, 3, 10, 0, 10);
55  m_h_res_d0VsPixelHits_withoutBLayer = new TH2D(std::string(m_name+"-Res-d0VsPixel-withoutBLayer").c_str(),
56  std::string(m_name+" resolution vs pixelHits (w/o b-layer)").c_str(), 50, -3, 3, 10, 0, 10);
63 
64  //Create more specific pull histograms
65  m_h_pull_d0VsEta = new TH2D(std::string(m_name+"-Pull-d0VsEta").c_str(), std::string(m_name+" d0VsEta pull").c_str(),
66  50, -5.0, 5.0, 500, -3.0, 3.0);
67  m_h_pull_z0VsEta = new TH2D(std::string(m_name+"-Pull-z0VsEta").c_str(), std::string(m_name+" z0VsEta pull").c_str(),
68  50, -5.0, 5.0, 500, -3.0, 3.0);
69  m_h_pull_d0VsPixelHits_withoutBLayer = new TH2D(std::string(m_name+"-Pull-d0VsPixelHits_withoutBLayer").c_str(),
70  std::string(m_name+" d0VsPixelHits pull (without b-layer)").c_str(), 50, -5.0, 5.0, 10, 0.0, 10.0);
71  m_h_pull_z0VsPixelHits_withoutBLayer = new TH2D(std::string(m_name+"-Pull-z0VsPixelHits_withoutBLayer").c_str(),
72  std::string(m_name+" z0VsPixelHits pull (without b-layer)").c_str(), 50, -5.0, 5.0, 10, 0.0, 10.0);
73  m_h_pull_d0VsPixelHits_withBLayer = new TH2D(std::string(m_name+"-Pull-d0VsPixelHits_withBLayer").c_str(),
74  std::string(m_name+" d0VsPixelHits pull (with b-layer)").c_str(), 50, -5.0, 5.0, 10, 0.0, 10.0);
75  m_h_pull_z0VsPixelHits_withBLayer = new TH2D(std::string(m_name+"-Pull-z0VsPixelHits_withBLayer").c_str(),
76  std::string(m_name+" z0VsPixelHits pull (with b-layer)").c_str(), 50, -5.0, 5.0, 10, 0.0, 10.0);
83 }
84 
85 
86 
88 
89 }
90 
91 
92 
93 void Analysis_Resolution::execute(const std::vector<TIDA::Track*>& referenceTracks,
94  const std::vector<TIDA::Track*>& /*testTracks*/,
95  TrackAssociator* associator) {
96 
97  // Loop over reference tracks
98  std::vector<TIDA::Track*>::const_iterator reference, referenceEnd=referenceTracks.end();
99  for(reference=referenceTracks.begin(); reference!=referenceEnd; ++reference) {
100 
101  // Get reference parameters
102  double referenceEta = (*reference)->eta();
103  double referencePhi = phi((*reference)->phi());
104  double referenceZ0 = (*reference)->z0();
105  double referenceD0 = (*reference)->a0();
106  double referencePT = (*reference)->pT();
107 
108  if (fabs(referencePT)<m_pTCut) continue;
109  if (fabs(referenceEta)>m_etaCut) continue;
110  if (fabs(referenceD0)>m_d0Cut) continue;
111  if (fabs(referenceZ0)>m_z0Cut) continue;
112 
113  // Find matched tracks
114  const TIDA::Track* test=0;
115  test = associator->matched(*reference);
116 
117  // Fill histograms
118  if(test) {
119 
120  // Get test parameters
121  double testEta = test->eta();
122  double testPhi = phi(test->phi());
123  double testZ0 = test->z0();
124  double testD0 = test->a0();
125  double testPT = test->pT();
126 
127  // Skip problematic tracks
128  if(referencePT==0 || testPT==0) continue;
129 
130  // Get errors
131  double eeta = sqrt( test->deta()*test->deta() + (*reference)->deta()*(*reference)->deta() );
132  double ephi = sqrt( test->dphi()*test->dphi() + (*reference)->dphi()*(*reference)->dphi() );
133  double ez0 = sqrt( test->dz0() *test->dz0() + (*reference)->dz0() *(*reference)->dz0() );
134  double ed0 = sqrt( test->da0() *test->da0() + (*reference)->da0() *(*reference)->da0() );
135  double einvpT = sqrt( test->dpT() *test->dpT() + (*reference)->dpT() *(*reference)->dpT() );
136 
137  // Fill resolution plots
138  m_h_res_eta->Fill(fabs(referenceEta)-fabs(testEta));
139  m_h_res_phi->Fill(phi(referencePhi-testPhi));
140  m_h_res_z0->Fill(fabs(referenceZ0)-fabs(testZ0));
141  m_h_res_d0->Fill(fabs(referenceD0)-fabs(testD0));
142  m_h_res_invpT->Fill(fabs(1.0/referencePT)-fabs(1.0/testPT));
143 
144  // Fill pull plots
145  if(eeta!=0) m_h_pull_eta->Fill((fabs(referenceEta)-fabs(testEta))/eeta); else m_h_pull_eta->Fill(-1000.0);
146  if(ephi!=0) m_h_pull_phi->Fill((phi(referencePhi-testPhi))/ephi); else m_h_pull_phi->Fill(-1000.0);
147  if(ez0!=0) m_h_pull_z0->Fill((fabs(referenceZ0)-fabs(testZ0))/ez0); else m_h_pull_z0->Fill(-1000.0);
148  if(ed0!=0) m_h_pull_d0->Fill((fabs(referenceD0)-fabs(testD0))/ed0); else m_h_pull_d0->Fill(-1000.0);
149  if(einvpT!=0) m_h_pull_invpT->Fill((fabs(1.0/referencePT)-fabs(1.0/testPT))/einvpT); else m_h_pull_invpT->Fill(-1000.0);
150 
151  double referenceBLayerHits = (*reference)->bLayerHits();
152  double referencePixelHits = (*reference)->pixelHits();
153 
154  //Fill resolution 2D plots
155  if (referenceBLayerHits>=1) {
156  m_h_res_d0VsPt->Fill(fabs(referenceD0)-fabs(testD0),referencePT);
157  m_h_res_z0VsPt->Fill(fabs(referenceZ0)-fabs(testZ0),referencePT);
158  }
159 
160  if (referencePT <= 10000 || testPT <= 10000) continue;
161 
162  if (referenceBLayerHits>=1) {
163  m_h_res_d0VsD0->Fill(fabs(referenceD0)-fabs(testD0),referenceD0);
164  m_h_res_z0VsEta->Fill(fabs(referenceZ0)-fabs(testZ0),referenceEta);
165  }
166 
167  if (referenceBLayerHits>=1)
168  m_h_res_d0VsPixelHits_withBLayer->Fill(fabs(referenceD0)-fabs(testD0),referencePixelHits);
169  else
170  m_h_res_d0VsPixelHits_withoutBLayer->Fill(fabs(referenceD0)-fabs(testD0),referencePixelHits);
171 
172  //Fill pull 2D plots
173  if (referenceBLayerHits>=1) {
174  m_h_pull_d0VsEta->Fill(fabs(referenceD0)-fabs(testD0),referenceEta);
175  m_h_pull_z0VsEta->Fill(fabs(referenceZ0)-fabs(testZ0),referenceEta);
176  }
177 
178  if (referenceBLayerHits>=1) {
179  if(ed0!=0) m_h_pull_d0VsPixelHits_withBLayer->Fill((fabs(referenceD0)-fabs(testD0))/ed0,referencePixelHits);
180  // else m_h_pull_d0VsPixelHits_withBLayer->Fill(-1000.0);
181  if(ez0!=0) m_h_pull_z0VsPixelHits_withBLayer->Fill((fabs(referenceZ0)-fabs(testZ0))/ez0,referencePixelHits);
182  // else m_h_pull_z0VsPixelHits_withBLayer->Fill(-1000.0);
183  } else {
184  if(ed0!=0) m_h_pull_d0VsPixelHits_withoutBLayer->Fill((fabs(referenceD0)-fabs(testD0))/ed0,referencePixelHits);
185  // else m_h_pull_d0VsPixelHits_withoutBLayer->Fill(-1000.0);
186  if(ez0!=0) m_h_pull_z0VsPixelHits_withoutBLayer->Fill((fabs(referenceZ0)-fabs(testZ0))/ez0,referencePixelHits);
187  // else m_h_pull_z0VsPixelHits_withoutBLayer->Fill(-1000.0);
188  }
189  }
190  }
191 }
192 
193 
194 
196 
197 }
198 
199 
200 
201 double Analysis_Resolution::phi(double p) {
202  if(p < -M_PI) p += 2*M_PI;
203  if(p > M_PI) p -= 2*M_PI;
204  return p;
205 }
206 
207 
Analysis_Resolution::m_h_res_z0
TH1 * m_h_res_z0
Definition: Analysis_Resolution.h:54
TH2::Fill
int Fill(double, double)
Definition: rootspy.cxx:382
TIDA::Associator
Definition: TIDAAssociator.h:24
Track.h
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Analysis_Resolution::initialise
virtual void initialise()
standard operation interface
Definition: Analysis_Resolution.cxx:87
Analysis_Resolution::finalise
virtual void finalise()
Definition: Analysis_Resolution.cxx:195
Analysis_Resolution::m_h_pull_invpT
TH1 * m_h_pull_invpT
Definition: Analysis_Resolution.h:62
TH1D
Definition: rootspy.cxx:342
Analysis_Resolution::m_h_res_z0VsPt
TH2 * m_h_res_z0VsPt
Definition: Analysis_Resolution.h:66
M_PI
#define M_PI
Definition: ActiveFraction.h:11
Analysis_Resolution::m_h_res_d0
TH1 * m_h_res_d0
Definition: Analysis_Resolution.h:53
Analysis_Resolution::m_h_pull_d0VsPixelHits_withoutBLayer
TH2 * m_h_pull_d0VsPixelHits_withoutBLayer
Definition: Analysis_Resolution.h:73
reference
Definition: hcg.cxx:437
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:146
TIDA::Associator::matched
virtual const S * matched(T *t)
Definition: TIDAAssociator.h:45
Analysis_Resolution::m_h_pull_phi
TH1 * m_h_pull_phi
Definition: Analysis_Resolution.h:59
Analysis_Resolution.h
Analysis_Resolution::m_h_pull_z0VsPixelHits_withoutBLayer
TH2 * m_h_pull_z0VsPixelHits_withoutBLayer
Definition: Analysis_Resolution.h:74
Analysis_Resolution::execute
virtual void execute(const std::vector< TIDA::Track * > &referenceTracks, const std::vector< TIDA::Track * > &testTracks, TrackAssociator *associator)
Definition: Analysis_Resolution.cxx:93
Analysis_Resolution::phi
double phi(double p)
Definition: Analysis_Resolution.cxx:201
Analysis_Resolution::Analysis_Resolution
Analysis_Resolution(const std::string &name, double pTCut, double etaCut, double d0Cut, double z0Cut)
Definition: Analysis_Resolution.cxx:17
Analysis_Resolution::m_h_res_eta
TH1 * m_h_res_eta
Definition: Analysis_Resolution.h:51
TrackAnalysis
Definition: TrackAnalysis.h:32
Analysis_Resolution::m_pTCut
double m_pTCut
Definition: Analysis_Resolution.h:79
Analysis_Resolution::m_h_res_z0VsEta
TH2 * m_h_res_z0VsEta
Definition: Analysis_Resolution.h:68
TH2D
Definition: rootspy.cxx:430
TH1::Fill
int Fill(double)
Definition: rootspy.cxx:285
Analysis_Resolution::m_h_res_d0VsD0
TH2 * m_h_res_d0VsD0
Definition: Analysis_Resolution.h:67
Analysis_Resolution::m_h_pull_d0
TH1 * m_h_pull_d0
Definition: Analysis_Resolution.h:60
Analysis_Resolution::m_h_res_d0VsPt
TH2 * m_h_res_d0VsPt
Definition: Analysis_Resolution.h:65
Analysis_Resolution::m_h_pull_z0
TH1 * m_h_pull_z0
Definition: Analysis_Resolution.h:61
Analysis_Resolution::m_h_pull_d0VsPixelHits_withBLayer
TH2 * m_h_pull_d0VsPixelHits_withBLayer
Definition: Analysis_Resolution.h:75
Analysis_Resolution::m_z0Cut
double m_z0Cut
Definition: Analysis_Resolution.h:82
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Analysis_Resolution::m_h_res_phi
TH1 * m_h_res_phi
Definition: Analysis_Resolution.h:52
Analysis_Resolution::m_h_pull_d0VsEta
TH2 * m_h_pull_d0VsEta
Definition: Analysis_Resolution.h:71
TrackAnalysis::addHistogram
void addHistogram(TH1 *h)
Definition: TrackAnalysis.h:93
Analysis_Resolution::m_h_pull_z0VsEta
TH2 * m_h_pull_z0VsEta
Definition: Analysis_Resolution.h:72
dq_make_web_display.reference
reference
Definition: dq_make_web_display.py:44
Analysis_Resolution::m_h_res_d0VsPixelHits_withoutBLayer
TH2 * m_h_res_d0VsPixelHits_withoutBLayer
Definition: Analysis_Resolution.h:70
TIDA::Track
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:26
Analysis_Resolution::m_d0Cut
double m_d0Cut
Definition: Analysis_Resolution.h:81
Analysis_Resolution::m_h_res_invpT
TH1 * m_h_res_invpT
Definition: Analysis_Resolution.h:55
Analysis_Resolution::m_h_pull_z0VsPixelHits_withBLayer
TH2 * m_h_pull_z0VsPixelHits_withBLayer
Definition: Analysis_Resolution.h:76
Analysis_Resolution::m_h_pull_eta
TH1 * m_h_pull_eta
Definition: Analysis_Resolution.h:58
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:141
Analysis_Resolution::m_h_res_d0VsPixelHits_withBLayer
TH2 * m_h_res_d0VsPixelHits_withBLayer
Definition: Analysis_Resolution.h:69
Analysis_Resolution::m_etaCut
double m_etaCut
Definition: Analysis_Resolution.h:80