ATLAS Offline Software
Loading...
Searching...
No Matches
Analysis_ResolutionCosmics.cxx
Go to the documentation of this file.
1
9
10
11#include <cmath>
12
15
16
17
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(), 50, -0.05, 0.05);
22 m_h_res_phi = new TH1D(std::string(m_name+"-Res-phi").c_str(), std::string(m_name+" phi resolution").c_str(), 50, -0.05, 0.05);
23 m_h_res_z0 = new TH1D(std::string(m_name+"-Res-z0").c_str(), std::string(m_name+" z0 resolution").c_str(), 50, -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(), 50, -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(), 50, -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(), 50, -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(), 50, -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(), 50, -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(), 50, -20.0, 20.0);
43
44}
45
46
47
51
52
53
54void Analysis_ResolutionCosmics::execute(const std::vector<TIDA::Track*>& referenceTracks,
55 const std::vector<TIDA::Track*>& /*testTracks*/,
56 TrackAssociator* associator) {
57
58 // Loop over reference tracks
59 std::vector<TIDA::Track*>::const_iterator reference, referenceEnd=referenceTracks.end();
60 for(reference=referenceTracks.begin(); reference!=referenceEnd; ++reference) {
61
62 // Get reference parameters
63 double referenceEta = (*reference)->eta();
64 double referencePhi = phi((*reference)->phi());
65 double referenceZ0 = (*reference)->z0();
66 double referenceD0 = (*reference)->a0();
67 double referencePT = (*reference)->pT();
68
69 // Find matched tracks
70 const TIDA::Track* test = associator->matched(*reference);
71
72 // Fill histograms
73 if(test) {
74
75 // Get test parameters
76 double testEta = -test->eta();
77 double testPhi = phi(test->phi()+M_PI);
78 double testZ0 = test->z0();
79 double testD0 = -test->a0();
80 double testPT = -test->pT();
81
82 // Skip problematic tracks
83 if(referencePT==0 || testPT==0) continue;
84
85 // Get errors
86 double eeta = sqrt( test->deta()*test->deta() + (*reference)->deta()*(*reference)->deta() );
87 double ephi = sqrt( test->dphi()*test->dphi() + (*reference)->dphi()*(*reference)->dphi() );
88 double ez0 = sqrt( test->dz0() *test->dz0() + (*reference)->dz0() *(*reference)->dz0() );
89 double ed0 = sqrt( test->da0() *test->da0() + (*reference)->da0() *(*reference)->da0() );
90 double einvpT = sqrt( test->dpT() *test->dpT() + (*reference)->dpT() *(*reference)->dpT() );
91
92 // Fill resolution plots
93 m_h_res_eta->Fill(fabs(referenceEta)-fabs(testEta));
94 m_h_res_phi->Fill(phi(referencePhi-testPhi));
95 m_h_res_z0->Fill(fabs(referenceZ0)-fabs(testZ0));
96 m_h_res_d0->Fill(fabs(referenceD0)-fabs(testD0));
97 m_h_res_invpT->Fill(fabs(1.0/referencePT)-fabs(1.0/testPT));
98
99 // Fill pull plots
100 if(eeta!=0) m_h_pull_eta->Fill((fabs(referenceEta)-fabs(testEta))/eeta); else m_h_pull_eta->Fill(-1000.0);
101 if(ephi!=0) m_h_pull_phi->Fill((phi(referencePhi-testPhi))/ephi); else m_h_pull_phi->Fill(-1000.0);
102 if(ez0!=0) m_h_pull_z0->Fill((fabs(referenceZ0)-fabs(testZ0))/ez0); else m_h_pull_z0->Fill(-1000.0);
103 if(ed0!=0) m_h_pull_d0->Fill((fabs(referenceD0)-fabs(testD0))/ed0); else m_h_pull_d0->Fill(-1000.0);
104 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);
105
106 }
107 }
108}
109
110
111
115
116
117
119 if(p < -M_PI) p += 2*M_PI;
120 if(p > M_PI) p -= 2*M_PI;
121 return p;
122}
123
124
#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_ResolutionCosmics(const std::string &name)
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