ATLAS Offline Software
Analysis_ResolutionCosmics.cxx
Go to the documentation of this file.
1 
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 
49 
50 }
51 
52 
53 
54 void 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 
113 
114 }
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 
TIDA::Associator
Definition: TIDAAssociator.h:24
Track.h
Analysis_ResolutionCosmics::phi
double phi(double p)
Definition: Analysis_ResolutionCosmics.cxx:118
Analysis_ResolutionCosmics::initialise
virtual void initialise()
standard operation interface
Definition: Analysis_ResolutionCosmics.cxx:48
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
Analysis_ResolutionCosmics::m_h_pull_invpT
TH1 * m_h_pull_invpT
Definition: Analysis_ResolutionCosmics.h:59
TH1D
Definition: rootspy.cxx:342
M_PI
#define M_PI
Definition: ActiveFraction.h:11
reference
Definition: hcg.cxx:437
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:146
Analysis_ResolutionCosmics::execute
virtual void execute(const std::vector< TIDA::Track * > &referenceTracks, const std::vector< TIDA::Track * > &testTracks, TrackAssociator *associator)
Definition: Analysis_ResolutionCosmics.cxx:54
Analysis_ResolutionCosmics::m_h_res_eta
TH1 * m_h_res_eta
Definition: Analysis_ResolutionCosmics.h:48
Analysis_ResolutionCosmics::m_h_res_z0
TH1 * m_h_res_z0
Definition: Analysis_ResolutionCosmics.h:51
TIDA::Associator::matched
virtual const S * matched(T *t)
Definition: TIDAAssociator.h:45
Analysis_ResolutionCosmics::finalise
virtual void finalise()
Definition: Analysis_ResolutionCosmics.cxx:112
Analysis_ResolutionCosmics::m_h_res_phi
TH1 * m_h_res_phi
Definition: Analysis_ResolutionCosmics.h:49
Analysis_ResolutionCosmics::m_h_pull_d0
TH1 * m_h_pull_d0
Definition: Analysis_ResolutionCosmics.h:57
Analysis_ResolutionCosmics::m_h_res_d0
TH1 * m_h_res_d0
Definition: Analysis_ResolutionCosmics.h:50
TrackAnalysis
Definition: TrackAnalysis.h:32
Analysis_ResolutionCosmics::Analysis_ResolutionCosmics
Analysis_ResolutionCosmics(const std::string &name)
Definition: Analysis_ResolutionCosmics.cxx:18
TH1::Fill
int Fill(double)
Definition: rootspy.cxx:285
Analysis_ResolutionCosmics::m_h_res_invpT
TH1 * m_h_res_invpT
Definition: Analysis_ResolutionCosmics.h:52
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
Analysis_ResolutionCosmics.h
TrackAnalysis::addHistogram
void addHistogram(TH1 *h)
Definition: TrackAnalysis.h:93
dq_make_web_display.reference
reference
Definition: dq_make_web_display.py:44
TIDA::Track
Definition: Trigger/TrigAnalysis/TrigInDetAnalysis/TrigInDetAnalysis/Track.h:26
Analysis_ResolutionCosmics::m_h_pull_eta
TH1 * m_h_pull_eta
Definition: Analysis_ResolutionCosmics.h:55
Analysis_ResolutionCosmics::m_h_pull_phi
TH1 * m_h_pull_phi
Definition: Analysis_ResolutionCosmics.h:56
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_ResolutionCosmics::m_h_pull_z0
TH1 * m_h_pull_z0
Definition: Analysis_ResolutionCosmics.h:58