ATLAS Offline Software
VtxR3Analysis.cxx
Go to the documentation of this file.
1 
12 
14 
15 
16 VtxR3Analysis::VtxR3Analysis( const std::string& n ) : VertexAnalysis( n ), m_initialised(false) { }
17 
18 
20 
21  m_initialised = true;
22 
23  // std::cout << "VtxAnalysis::initialise() " << name() << std::endl;
24 
25 
26  // mdir = new TIDDirectory(name());
27  // mdir->push();
28 
29 
30 
31  m_hnvtx = new TIDA::Histogram<float>( monTool(), "vx_nvtx" );
32  m_hzed = new TIDA::Histogram<float>( monTool(), "vx_zed" );
33  m_hx = new TIDA::Histogram<float>( monTool(), "vx_x" );
34  m_hy = new TIDA::Histogram<float>( monTool(), "vx_y" );
35  m_hntrax = new TIDA::Histogram<float>( monTool(), "vx_ntrax" );
36 
37 
38  m_hnvtx_rec = new TIDA::Histogram<float>( monTool(), "vx_nvtx_rec" );
39  m_hzed_rec = new TIDA::Histogram<float>( monTool(), "vx_zed_rec" );
40  m_hx_rec = new TIDA::Histogram<float>( monTool(), "vx_x_rec" );
41  m_hy_rec = new TIDA::Histogram<float>( monTool(), "vx_y_rec" );
42  m_hntrax_rec = new TIDA::Histogram<float>( monTool(), "vx_ntrax_rec" );
43 
44  m_hzed_res = new TIDA::Histogram<float>( monTool(), "vx_zed_res" );
45  m_hx_res = new TIDA::Histogram<float>( monTool(), "vx_x_res" );
46  m_hy_res = new TIDA::Histogram<float>( monTool(), "vx_y_res" );
47 
48  m_rdz_vs_zed = new TIDA::Histogram<float>( monTool(), "vx_rdz_vs_zed" );
49  m_rdz_vs_ntrax = new TIDA::Histogram<float>( monTool(), "vx_rdz_vs_ntrax" );
50  m_rdz_vs_nvtx = new TIDA::Histogram<float>( monTool(), "vx_rdz_vs_nvtx" );
51 
52  m_eff_zed = new TIDA::Histogram<float>( monTool(), "vx_zed_eff" );
53  m_eff_ntrax = new TIDA::Histogram<float>( monTool(), "vx_ntrax_eff" );
54  m_eff_nvtx = new TIDA::Histogram<float>( monTool(), "vx_nvtx_eff" );
55  m_eff_mu = new TIDA::Histogram<float>( monTool(), "vx_mu_eff" );
56  m_eff_lb = new TIDA::Histogram<float>( monTool(), "vx_lb_eff" );
57 
59 
60 }
61 
62 
63 void VtxR3Analysis::execute( const std::vector<TIDA::Vertex*>& vtx0,
64  const std::vector<TIDA::Vertex*>& vtx1,
65  const TIDA::Event* tevt ) {
66 
67  // std::cout << "VtxAnalysis::execute() initialised: " << m_initialised << "\tevent: " << tevt << std::endl;
68 
69  if ( !m_initialised ) return;
70 
71  // if ( vtx1.size()<2 ) return;
72 
73 #if 0
74  std::cout << "VtxAnalysis::execute() " << name()
75  << "\tvtx0.size() " << vtx0.size()
76  << "\tvtx1.size() " << vtx1.size()
77  << std::endl;
78 #endif
79 
80 
81  VertexMatcher m("vtx_matcher", 10 );
82 
83  m.match( vtx0, vtx1 );
84 
85  m_hnvtx->Fill( vtx0.size() );
86  m_hnvtx_rec->Fill( vtx1.size() );
87 
88  // for ( unsigned i=0 ; i<vtx0.size() ; i++ ) {
89  for ( unsigned i=0 ; i<vtx0.size() ; i++ ) {
90 
91  if ( i>0 ) break;
92 
93  // std::cout << i << "\tref z " << vtx0[i]->z();
94 
95  m_hzed->Fill( vtx0[i]->z() );
96  m_hx->Fill( vtx0[i]->x() );
97  m_hy->Fill( vtx0[i]->y() );
98 
99 
100  m_hntrax->Fill( vtx0[i]->Ntracks() );
101 
102  const TIDA::Vertex* mv = m.matched( vtx0[i] );
103 
104  if ( mv ) {
105 
106  // std::cout << "\ttest z " << mv->z() << " : delta z " << (mv->z()-vtx0[i]->z()) << std::endl;
107 
110 
111  m_hzed_rec->Fill( mv->z() );
112  m_hx_rec->Fill( mv->x() );
113  m_hy_rec->Fill( mv->y() );
114  m_hntrax_rec->Fill( mv->Ntracks() );
115 
116  m_hzed_res->Fill( mv->z() - vtx0[i]->z() );
117  m_hx_res->Fill( mv->x() - vtx0[i]->x() );
118  m_hy_res->Fill( mv->y() - vtx0[i]->y() );
119 
120  m_rdz_vs_zed->Fill( vtx0[i]->z(), mv->z() - vtx0[i]->z() );
121  m_rdz_vs_ntrax->Fill( vtx0[i]->Ntracks(), mv->z() - vtx0[i]->z() );
122  m_rdz_vs_nvtx->Fill( vtx0.size(), mv->z() - vtx0[i]->z() );
123 
124  m_eff_zed->Fill( vtx0[i]->z(), 1 );
125  m_eff_ntrax->Fill( vtx0[i]->Ntracks(), 1 );
126  m_eff_nvtx->Fill( vtx0.size(), 1 );
127 
128  m_eff_mu->Fill( tevt->mu(), 1 );
129  m_eff_lb->Fill( tevt->lumi_block(), 1 );
130 
131  }
132  else {
133  // std::cout << "\t" << "------" << std::endl;
134 
135  m_eff_zed->Fill( vtx0[i]->z(), 0 );
136 
137  m_eff_ntrax->Fill( vtx0[i]->Ntracks(), 0 );
138  m_eff_nvtx->Fill( vtx0.size(), 0 );
139 
140  m_eff_mu->Fill( tevt->mu(), 0 );
141  m_eff_lb->Fill( tevt->lumi_block(), 0 );
142  }
143 
144  }
145 
146 }
147 
148 
149 
150 
152  // std::cout << "VtxAnalysis::finalise() " << name() << std::endl;
153 }
154 
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
VertexAnalysis::name
std::string name() const
Definition: VertexAnalysis.h:33
VtxR3Analysis::m_rdz_vs_nvtx
TIDA::Histogram< float > * m_rdz_vs_nvtx
Definition: VtxR3Analysis.h:70
VtxR3Analysis::monTool
ToolHandle< GenericMonitoringTool > * monTool()
Definition: VtxR3Analysis.h:42
TIDA::Vertex::y
double y() const
Definition: TIDAVertex.h:52
TIDA::Event
Definition: TIDAEvent.h:33
TIDA::Event::lumi_block
void lumi_block(unsigned lb)
Definition: TIDAEvent.h:44
x
#define x
VtxR3Analysis::m_hx_res
TIDA::Histogram< float > * m_hx_res
Definition: VtxR3Analysis.h:65
TIDA::Histogram< float >
VtxR3Analysis::m_hzed
TIDA::Histogram< float > * m_hzed
Definition: VtxR3Analysis.h:53
VtxR3Analysis::m_hntrax_rec
TIDA::Histogram< float > * m_hntrax_rec
Definition: VtxR3Analysis.h:62
TIDA::Histogram::Fill
void Fill(T d) const
Definition: TIDAHistogram.h:35
VtxR3Analysis::initialise
void initialise()
Definition: VtxR3Analysis.cxx:19
VtxR3Analysis::m_hy_rec
TIDA::Histogram< float > * m_hy_rec
Definition: VtxR3Analysis.h:61
VtxR3Analysis::execute
void execute(const std::vector< TIDA::Vertex * > &vtx0, const std::vector< TIDA::Vertex * > &vtx1, const TIDA::Event *te=0)
Definition: VtxR3Analysis.cxx:63
VtxR3Analysis::m_rdz_vs_zed
TIDA::Histogram< float > * m_rdz_vs_zed
Definition: VtxR3Analysis.h:68
VtxR3Analysis::m_eff_zed
TIDA::Histogram< float > * m_eff_zed
Definition: VtxR3Analysis.h:75
VtxR3Analysis::m_hzed_res
TIDA::Histogram< float > * m_hzed_res
Definition: VtxR3Analysis.h:64
lumiFormat.i
int i
Definition: lumiFormat.py:85
z
#define z
beamspotman.n
n
Definition: beamspotman.py:731
VtxR3Analysis::m_hy
TIDA::Histogram< float > * m_hy
Definition: VtxR3Analysis.h:55
VtxR3Analysis::m_eff_mu
TIDA::Histogram< float > * m_eff_mu
Definition: VtxR3Analysis.h:78
VtxR3Analysis::m_hnvtx
TIDA::Histogram< float > * m_hnvtx
Definition: VtxR3Analysis.h:52
VtxR3Analysis::m_hx_rec
TIDA::Histogram< float > * m_hx_rec
Definition: VtxR3Analysis.h:60
VtxR3Analysis::m_initialised
bool m_initialised
Definition: VtxR3Analysis.h:46
VtxR3Analysis::m_rdz_vs_ntrax
TIDA::Histogram< float > * m_rdz_vs_ntrax
Definition: VtxR3Analysis.h:69
VtxR3Analysis::m_eff_lb
TIDA::Histogram< float > * m_eff_lb
Definition: VtxR3Analysis.h:79
TIDA::Vertex
Definition: TIDAVertex.h:23
VtxR3Analysis::m_hzed_rec
TIDA::Histogram< float > * m_hzed_rec
Definition: VtxR3Analysis.h:59
VtxR3Analysis::finalise
void finalise()
Definition: VtxR3Analysis.cxx:151
VtxR3Analysis::m_eff_nvtx
TIDA::Histogram< float > * m_eff_nvtx
Definition: VtxR3Analysis.h:77
VtxR3Analysis::m_hy_res
TIDA::Histogram< float > * m_hy_res
Definition: VtxR3Analysis.h:66
TIDA::Vertex::z
double z() const
Definition: TIDAVertex.h:53
TIDA::Event::mu
void mu(double m)
Definition: TIDAEvent.h:47
VtxR3Analysis::m_hntrax
TIDA::Histogram< float > * m_hntrax
Definition: VtxR3Analysis.h:56
TIDA::Vertex::Ntracks
int Ntracks() const
Definition: TIDAVertex.h:62
VtxR3Analysis.h
y
#define y
VtxR3Analysis::m_eff_ntrax
TIDA::Histogram< float > * m_eff_ntrax
Definition: VtxR3Analysis.h:76
VertexAnalysis
Definition: VertexAnalysis.h:25
VertexMatcher.h
VtxR3Analysis::m_hx
TIDA::Histogram< float > * m_hx
Definition: VtxR3Analysis.h:54
VertexMatcher
Definition: VertexMatcher.h:22
VtxR3Analysis::m_hnvtx_rec
TIDA::Histogram< float > * m_hnvtx_rec
Definition: VtxR3Analysis.h:58
VtxR3Analysis::VtxR3Analysis
VtxR3Analysis(const std::string &n)
Definition: VtxR3Analysis.cxx:16
TIDA::Vertex::x
double x() const
Definition: TIDAVertex.h:51