ATLAS Offline Software
Loading...
Searching...
No Matches
Analysis_Resolution.cxx
Go to the documentation of this file.
1
9
10
11#include <cmath>
12
15
16
17Analysis_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
90
91
92
93void 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
198
199
200
201double 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
#define M_PI
Scalar phi() const
phi method
TIDA::Associator< TIDA::Track > TrackAssociator
virtual void execute(const std::vector< TIDA::Track * > &referenceTracks, const std::vector< TIDA::Track * > &testTracks, TrackAssociator *associator)
Analysis_Resolution(const std::string &name, double pTCut, double etaCut, double d0Cut, double z0Cut)
virtual void initialise()
standard operation interface
virtual const S * matched(T *t)
void addHistogram(TH1 *h)
std::string m_name
identifier of the of the analysis - also used for the root directory into which the histograms are pu...
const std::string & name() const
return identifier
TrackAnalysis(const std::string &name)
the beam test parts are not really usable in a multithreaded environment