ATLAS Offline Software
Loading...
Searching...
No Matches
VtxAnalysis.cxx
Go to the documentation of this file.
1
9
10
12
14
15
16VtxAnalysis::VtxAnalysis( const std::string& n ) : VertexAnalysis( n ), m_initialised(false), m_dir(0) { }
17
18
20
21 m_initialised = true;
22
23 // std::cout << "VtxAnalysis::initialise() " << name() << std::endl;
24
25
26 m_dir = new TIDDirectory(name());
27 m_dir->push();
28
29#if 0
30 double vnbins[81] = {
31 -0.5,
32 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5,
33 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 16.5, 17.5, 18.5, 19.5,
34 20.5, 21.5, 22.5, 23.5, 24.5, 25.5, 26.5, 27.5, 28.5, 29.5,
35 31.5, 32.5, 33.5, 34.5, 36.5, 37.5, 39.5,
36 40.5, 42.5, 43.5, 45.5, 47.5, 49.5,
37 50.5, 52.5, 54.5, 57.5, 59.5,
38 61.5, 63.5, 66.5, 69.5,
39 71.5, 74.5, 77.5,
40 80.5, 83.5, 86.5,
41 90.5, 93.5, 97.5,
42 100.5, 104.5, 108.5,
43 113.5, 117.5,
44 122.5, 126.5,
45 131.5, 136.5,
46 142.5, 147.5,
47 153.5, 159.5,
48 165.5,
49 171.5, 178.5,
50 185.5,
51 192.5,
52 200.5 };
53#endif
54
55 double vnbins[101] = {
56 -0.5,
57 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 17.5, 18.5, 19.5, 21.5,
58 23.5, 24.5, 26.5, 28.5, 30.5, 32.5, 35.5, 37.5, 40.5, 43.5, 46.5, 50.5, 53.5, 57.5, 61.5, 66.5, 71.5, 76.5, 81.5, 87.5,
59 93.5, 100.5, 107.5, 114.5, 123.5, 131.5, 141.5, 150.5, 161.5, 172.5, 185.5, 198.5, 211.5, 226.5, 242.5, 259.5, 277.5, 297.5, 317.5, 340.5,
60 363.5, 389.5, 416.5, 445.5, 476.5, 509.5,
61 544.5, 582.5, 623.5, 666.5, 713.5, 762.5, 815.5, 872.5, 933.5, 998.5, 1067.5,
62 1141.5, 1221.5, 1305.5, 1396.5, 1493.5, 1597.5,
63 1708.5, 1827.5, 1953.5, 2089.5,
64 2234.5, 2389.5, 2555.5,
65 2733.5, 2923.5, 3125.5,
66 3342.5, 3574.5,
67 3823.5, 4088.5,
68 4372.5, 4675.5,
69 5000.5
70 };
71
72 double vnbins_short[78] = {
73 -0.5,
74 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5,
75 10.5, 11.5, 12.5, 13.5, 14.5, 15.5, 17.5, 18.5, 19.5,
76 21.5, 23.5, 24.5, 26.5, 28.5,
77 30.5, 32.5, 35.5, 37.5,
78 40.5, 43.5, 46.5,
79 50.5, 53.5, 57.5,
80 61.5, 66.5,
81 71.5, 76.5,
82 81.5, 87.5,
83 93.5,
84 100.5, 107.5, 114.5, 123.5, 131.5, 141.5, 150.5, 161.5, 172.5, 185.5, 198.5,
85 211.5, 226.5, 242.5, 259.5, 277.5, 297.5,
86 317.5, 340.5, 363.5, 389.5,
87 416.5, 445.5, 476.5,
88 509.5, 544.5, 582.5,
89 623.5, 666.5,
90 713.5, 762.5,
91 815.5, 872.5,
92 933.5, 998.5,
93 1067.5
94 };
95
96
97
98
99
100
101 m_hnvtx = new TH1F( "vx_nvtx", ";number of vertices", 101, -0.5, 100.5 );
102 m_hzed = new TH1F( "vx_zed", ";vtx z [mm]", 100, -250, 250 );
103 m_hntrax = new TH1F( "vx_ntrax", ";number of tracks", 100, vnbins );
104
108
109
110 m_hnvtx_rec = new TH1F( "vx_nvtx_rec", ";number of vertices", 101, -0.5, 100.5 );
111 m_hzed_rec = new TH1F( "vx_zed_rec", ";vtx z [mm]", 100, -250, 250 );
112 m_hntrax_rec = new TH1F( "vx_ntrax_rec", ";number of tracks", 100, vnbins );
113
117
118 m_hzed_res = new TH1F( "vx_zed_res", "Delta z [mm]", 400, -10, 10 );
119
121
122 m_rdz_vs_zed = new TProfile( "vx_rdz_vs_zed", "rdz_vs_zed; vtx z [mm];z residual [mm]", 100, -250, 250 );
123 m_rdz_vs_ntrax = new TProfile( "vx_rdz_vs_ntrax", "rdz_vs_ntrax;number of tracks;z residual [mm]", 77, vnbins_short );
124 m_rdz_vs_nvtx = new TProfile( "vx_rdz_vs_nvtx", "rdz_vs_nvtx;number of vertices;z residual [mm]", 51, -0.125, 50.125 );
125
129
130 // m_rdz_vs_mu = new TProfile( "rdz_vs_mu", 30, 0, 30, 400, -20, 20 );
131
132 m_eff_zed = new TProfile( "vx_zed_eff", "zed_eff;efficiency;offline vtx z [mm]", 50, -250, 250 );
133 m_eff_ntrax = new TProfile( "vx_ntrax_eff", "ntrax_eff;number of tracks;efficiency", 100, vnbins );
134 m_eff_nvtx = new TProfile( "vx_nvtx_eff", "nvtx_eff;number of vertices;efficiency", 101, -0.5, 100.5 );
135 m_eff_mu = new TProfile( "vx_mu_eff", "mu_eff;<#mu>;efficiency", 101, -0.5, 100.5 );
136 m_eff_lb = new TProfile( "vx_lb_eff", "lb_eff;lumi block;efficiency", 151, -0.5, 3019.5 );
137
143
144 m_dir->pop();
145
146}
147
148
149void VtxAnalysis::execute( const std::vector<TIDA::Vertex*>& vtx0,
150 const std::vector<TIDA::Vertex*>& vtx1,
151 const TIDA::Event* tevt ) {
152
153 // std::cout << "VtxAnalysis::execute() initialised: " << m_initialised << "\tevent: " << tevt << std::endl;
154
155 if ( !m_initialised ) return;
156
157 // if ( vtx1.size()<2 ) return;
158
159#if 0
160 std::cout << "VtxAnalysis::execute() " << name()
161 << "\tvtx0.size() " << vtx0.size()
162 << "\tvtx1.size() " << vtx1.size()
163 << std::endl;
164#endif
165
166
167 VertexMatcher m("vtx_matcher", 10 );
168
169 m.match( vtx0, vtx1 );
170
171 m_hnvtx->Fill( vtx0.size() );
172 m_hnvtx_rec->Fill( vtx1.size() );
173
174 // for ( unsigned i=0 ; i<vtx0.size() ; i++ ) {
175 for ( unsigned i=0 ; i<vtx0.size() ; i++ ) {
176
177 if ( i>0 ) break;
178
179 // std::cout << i << "\tref z " << vtx0[i]->z();
180
181 m_hzed->Fill( vtx0[i]->z() );
182 m_hntrax->Fill( vtx0[i]->Ntracks() );
183
184 const TIDA::Vertex* mv = m.matched( vtx0[i] );
185
186 if ( mv ) {
187
188 // std::cout << "\ttest z " << mv->z() << " : delta z " << (mv->z()-vtx0[i]->z()) << std::endl;
189
192
193 m_hzed_rec->Fill( mv->z() );
194 m_hntrax_rec->Fill( mv->Ntracks() );
195
196 m_hzed_res->Fill( mv->z() - vtx0[i]->z() );
197
198 m_rdz_vs_zed->Fill( vtx0[i]->z(), mv->z() - vtx0[i]->z() );
199 m_rdz_vs_ntrax->Fill( vtx0[i]->Ntracks(), mv->z() - vtx0[i]->z() );
200 m_rdz_vs_nvtx->Fill( vtx0.size(), mv->z() - vtx0[i]->z() );
201
202 m_eff_zed->Fill( vtx0[i]->z(), 1 );
203 m_eff_ntrax->Fill( vtx0[i]->Ntracks(), 1 );
204 m_eff_nvtx->Fill( vtx0.size(), 1 );
205
206 m_eff_mu->Fill( tevt->mu(), 1 );
207 m_eff_lb->Fill( tevt->lumi_block(), 1 );
208
209 }
210 else {
211 // std::cout << "\t" << "------" << std::endl;
212
213 m_eff_zed->Fill( vtx0[i]->z(), 0 );
214 m_eff_ntrax->Fill( vtx0[i]->Ntracks(), 0 );
215 m_eff_nvtx->Fill( vtx0.size(), 0 );
216
217 m_eff_mu->Fill( tevt->mu(), 0 );
218 m_eff_lb->Fill( tevt->lumi_block(), 0 );
219 }
220
221 }
222
223}
224
225
226
227
229 // std::cout << "VtxAnalysis::finalise() " << name() << std::endl;
230}
231
#define z
void lumi_block(unsigned lb)
Definition TIDAEvent.h:44
void mu(double m)
Definition TIDAEvent.h:47
int Ntracks() const
Definition TIDAVertex.h:62
double z() const
Definition TIDAVertex.h:53
VertexAnalysis(const std::string &n)
const std::string & name() const
void addHistogram(TH1 *h)
TH1F * m_hnvtx_rec
Definition VtxAnalysis.h:51
bool m_initialised
Definition VtxAnalysis.h:43
TH1F * m_hnvtx
Definition VtxAnalysis.h:47
void execute(const std::vector< TIDA::Vertex * > &vtx0, const std::vector< TIDA::Vertex * > &vtx1, const TIDA::Event *te=0)
TProfile * m_eff_ntrax
Definition VtxAnalysis.h:65
TProfile * m_rdz_vs_ntrax
Definition VtxAnalysis.h:58
TH1F * m_hzed_rec
Definition VtxAnalysis.h:52
VtxAnalysis(const std::string &n)
TIDDirectory * m_dir
Definition VtxAnalysis.h:45
TProfile * m_rdz_vs_zed
Definition VtxAnalysis.h:57
TProfile * m_eff_nvtx
Definition VtxAnalysis.h:66
TProfile * m_rdz_vs_nvtx
Definition VtxAnalysis.h:59
void initialise()
TH1F * m_hzed_res
Definition VtxAnalysis.h:55
TProfile * m_eff_zed
Definition VtxAnalysis.h:64
TH1F * m_hntrax
Definition VtxAnalysis.h:49
TH1F * m_hzed
Definition VtxAnalysis.h:48
TProfile * m_eff_mu
Definition VtxAnalysis.h:67
TH1F * m_hntrax_rec
Definition VtxAnalysis.h:53
TProfile * m_eff_lb
Definition VtxAnalysis.h:68