12 #include "HepMC/GenEvent.h"
13 #include "HepMC/GenVertex.h"
14 #include "HepMC/GenParticle.h"
58 #include <gsl/gsl_math.h>
59 #include <gsl/gsl_eigen.h>
76 : verbose_( iConfig.getUntrackedParameter<bool>(
"verbose",
false ) )
77 , doMatching_( iConfig.getUntrackedParameter<bool>(
"matching",
false ) )
78 , printXBS_( iConfig.getUntrackedParameter<bool>(
"XBS",
false ) )
79 , dumpThisEvent_(
false )
80 , dumpPUcandidates_( iConfig.getUntrackedParameter<bool>(
"dumpPUcandidates",
false ) )
86 , luminosityBlock_( 0 )
92 , zmatch_( iConfig.getUntrackedParameter<double>(
"zmatch", 0.0500 ) )
94 , theTrackFilter( iConfig.getParameter<edm::
ParameterSet>(
"TkFilterParameters" ) )
95 , recoTrackProducer_( iConfig.getUntrackedParameter<std::
string>(
"recoTrackProducer") )
96 , outputFile_( iConfig.getUntrackedParameter<std::
string>(
"outputFile" ) )
102 , recoBeamSpotToken_( consumes<
reco::
BeamSpot>( iConfig.getParameter<edm::
InputTag>(
"beamSpot" ) ) )
103 , edmView_recoTrack_Token_( consumes< edm::
View<
reco::
Track> >( edm::
InputTag( iConfig.getUntrackedParameter<std::
string>(
"recoTrackProducer" ) ) ) )
107 , std::
string(
"MergedTrackTruth" )
112 , std::
string(
"MergedTrackTruth" )
124 cout <<
"PrimaryVertexAnalyzer4PU: zmatch=" <<
zmatch_ << endl;
146 std::map<std::string, TH1*>
h;
149 h[
"nbtksinvtx"] =
new TH1F(
"nbtksinvtx",
"reconstructed tracks in vertex",40,-0.5,39.5);
150 h[
"nbtksinvtxPU"] =
new TH1F(
"nbtksinvtxPU",
"reconstructed tracks in vertex",40,-0.5,39.5);
151 h[
"nbtksinvtxTag"]=
new TH1F(
"nbtksinvtxTag",
"reconstructed tracks in vertex",40,-0.5,39.5);
152 h[
"resx"] =
new TH1F(
"resx",
"residual x",100,-0.04,0.04);
153 h[
"resy"] =
new TH1F(
"resy",
"residual y",100,-0.04,0.04);
154 h[
"resz"] =
new TH1F(
"resz",
"residual z",100,-0.1,0.1);
155 h[
"resz10"] =
new TH1F(
"resz10",
"residual z",100,-1.0,1.);
156 h[
"pullx"] =
new TH1F(
"pullx",
"pull x",100,-25.,25.);
157 h[
"pully"] =
new TH1F(
"pully",
"pull y",100,-25.,25.);
158 h[
"pullz"] =
new TH1F(
"pullz",
"pull z",100,-25.,25.);
159 h[
"vtxchi2"] =
new TH1F(
"vtxchi2",
"chi squared",100,0.,100.);
160 h[
"vtxndf"] =
new TH1F(
"vtxndf",
"degrees of freedom",500,0.,100.);
161 h[
"vtxndfc"] =
new TH1F(
"vtxndfc",
"expected 2nd highest ndof",500,0.,100.);
163 h[
"vtxndfvsntk"] =
new TH2F(
"vtxndfvsntk",
"ndof vs #tracks",20,0.,100, 20, 0., 200.);
164 h[
"vtxndfoverntk"]=
new TH1F(
"vtxndfoverntk",
"ndof / #tracks",40,0.,2.);
165 h[
"vtxndf2overntk"]=
new TH1F(
"vtxndf2overntk",
"(ndof+2) / #tracks",40,0.,2.);
166 h[
"tklinks"] =
new TH1F(
"tklinks",
"Usable track links",2,-0.5,1.5);
167 h[
"nans"] =
new TH1F(
"nans",
"Illegal values for x,y,z,xx,xy,xz,yy,yz,zz",9,0.5,9.5);
171 add(h,
new TH1F(
"szRecVtx",
"size of recvtx collection",20, -0.5, 19.5));
172 add(h,
new TH1F(
"isFake",
"fake vertex",2, -0.5, 1.5));
173 add(h,
new TH1F(
"isFake1",
"fake vertex or ndof<0",2, -0.5, 1.5));
174 add(h,
new TH1F(
"bunchCrossing",
"bunchCrossing",4000, 0., 4000.));
175 add(h,
new TH2F(
"bunchCrossingLogNtk",
"bunchCrossingLogNtk",4000, 0., 4000.,5,0., 5.));
176 add(h,
new TH1F(
"highpurityTrackFraction",
"fraction of high purity tracks",20, 0., 1.));
177 add(h,
new TH2F(
"trkchi2vsndof",
"vertices chi2 vs ndof",50, 0., 100., 50, 0., 200.));
178 add(h,
new TH1F(
"trkchi2overndof",
"vertices chi2 / ndof",50, 0., 5.));
180 add(h,
new TH2F(
"2trkchi2vsndof",
"two-track vertices chi2 vs ndof",40, 0., 10., 20, 0., 20.));
181 add(h,
new TH1F(
"2trkmassSS",
"two-track vertices mass (same sign)",100, 0., 2.));
182 add(h,
new TH1F(
"2trkmassOS",
"two-track vertices mass (opposite sign)",100, 0., 2.));
183 add(h,
new TH1F(
"2trkdphi",
"two-track vertices delta-phi",360, 0, 2*
M_PI));
184 add(h,
new TH1F(
"2trkseta",
"two-track vertices sum-eta",50, -2., 2.));
185 add(h,
new TH1F(
"2trkdphicurl",
"two-track vertices delta-phi (sum eta<0.1)",360, 0, 2*
M_PI));
186 add(h,
new TH1F(
"2trksetacurl",
"two-track vertices sum-eta (delta-phi<0.1)",50, -2., 2.));
187 add(h,
new TH1F(
"2trkdetaOS",
"two-track vertices delta-eta (same sign)",50, -0.5, 0.5));
188 add(h,
new TH1F(
"2trkdetaSS",
"two-track vertices delta-eta (opposite sign)",50, -0.5, 0.5));
190 add(h,
new TH1F(
"2trkmassSSPU",
"two-track vertices mass (same sign)",100, 0., 2.));
191 add(h,
new TH1F(
"2trkmassOSPU",
"two-track vertices mass (opposite sign)",100, 0., 2.));
192 add(h,
new TH1F(
"2trkdphiPU",
"two-track vertices delta-phi",360, 0, 2*
M_PI));
193 add(h,
new TH1F(
"2trksetaPU",
"two-track vertices sum-eta",50, -2., 2.));
194 add(h,
new TH1F(
"2trkdphicurlPU",
"two-track vertices delta-phi (sum eta<0.1)",360, 0, 2*
M_PI));
195 add(h,
new TH1F(
"2trksetacurlPU",
"two-track vertices sum-eta (delta-phi<0.1)",50, -2., 2.));
196 add(h,
new TH1F(
"2trkdetaOSPU",
"two-track vertices delta-eta (same sign)",50, -0.5, 0.5));
197 add(h,
new TH1F(
"2trkdetaSSPU",
"two-track vertices delta-eta (opposite sign)",50, -0.5, 0.5));
199 add(h,
new TH2F(
"2trkchi2vsndof",
"two-track vertices chi2 vs ndof",40, 0., 10., 20, 0., 20.));
200 add(h,
new TH2F(
"3trkchi2vsndof",
"three-track vertices chi2 vs ndof",40, 0., 10., 20, 0., 20.));
201 add(h,
new TH2F(
"4trkchi2vsndof",
"four-track vertices chi2 vs ndof",40, 0., 10., 20, 0., 20.));
202 add(h,
new TH2F(
"5trkchi2vsndof",
"five-track vertices chi2 vs ndof",40, 0., 10., 20, 0., 20.));
204 add(h,
new TH2F(
"fake2trkchi2vsndof",
"fake two-track vertices chi2 vs ndof",40, 0., 10., 20, 0., 20.));
205 add(h,
new TH2F(
"fake3trkchi2vsndof",
"fake three-track vertices chi2 vs ndof",40, 0., 10., 20, 0., 20.));
206 add(h,
new TH2F(
"fake4trkchi2vsndof",
"fake four-track vertices chi2 vs ndof",40, 0., 10., 20, 0., 20.));
207 add(h,
new TH2F(
"fake5trkchi2vsndof",
"fake five-track vertices chi2 vs ndof",40, 0., 10., 20, 0., 20.));
208 h[
"resxr"] =
new TH1F(
"resxr",
"relative residual x",100,-0.04,0.04);
209 h[
"resyr"] =
new TH1F(
"resyr",
"relative residual y",100,-0.04,0.04);
210 h[
"reszr"] =
new TH1F(
"reszr",
"relative residual z",100,-0.1,0.1);
211 h[
"pullxr"] =
new TH1F(
"pullxr",
"relative pull x",100,-25.,25.);
212 h[
"pullyr"] =
new TH1F(
"pullyr",
"relative pull y",100,-25.,25.);
213 h[
"pullzr"] =
new TH1F(
"pullzr",
"relative pull z",100,-25.,25.);
214 h[
"vtxprob"] =
new TH1F(
"vtxprob",
"chisquared probability",100,0.,1.);
215 h[
"eff"] =
new TH1F(
"eff",
"efficiency",2, -0.5, 1.5);
216 h[
"efftag"] =
new TH1F(
"efftag",
"efficiency tagged vertex",2, -0.5, 1.5);
217 h[
"zdistancetag"] =
new TH1F(
"zdistancetag",
"z-distance between tagged and generated",100, -0.1, 0.1);
218 h[
"abszdistancetag"] =
new TH1F(
"abszdistancetag",
"z-distance between tagged and generated",1000, 0., 1.0);
219 h[
"abszdistancetagcum"] =
new TH1F(
"abszdistancetagcum",
"z-distance between tagged and generated",1000, 0., 1.0);
220 h[
"puritytag"] =
new TH1F(
"puritytag",
"purity of primary vertex tags",2, -0.5, 1.5);
221 h[
"effvsptsq"] =
new TProfile(
"effvsptsq",
"efficiency vs ptsq",20, 0., 10000., 0, 1.);
222 h[
"effvsnsimtrk"] =
new TProfile(
"effvsnsimtrk",
"efficiency vs # simtracks",50, 0., 50., 0, 1.);
223 h[
"effvsnrectrk"] =
new TProfile(
"effvsnrectrk",
"efficiency vs # rectracks",50, 0., 50., 0, 1.);
224 h[
"effvsnseltrk"] =
new TProfile(
"effvsnseltrk",
"efficiency vs # selected tracks",50, 0., 50., 0, 1.);
225 h[
"effvsz"] =
new TProfile(
"effvsz",
"efficiency vs z",20, -20., 20., 0, 1.);
226 h[
"effvsz2"] =
new TProfile(
"effvsz2",
"efficiency vs z (2mm)",20, -20., 20., 0, 1.);
227 h[
"effvsr"] =
new TProfile(
"effvsr",
"efficiency vs r",20, 0., 1., 0, 1.);
228 h[
"xresvsntrk"] =
new TProfile(
"xresvsntrk",
"xresolution vs # vertex tracks",40, 0., 200., 0, 0.01);
229 h[
"yresvsntrk"] =
new TProfile(
"yresvsntrk",
"yresolution vs # vertex tracks",40, 0., 200., 0, 0.01);
230 h[
"zresvsntrk"] =
new TProfile(
"zresvsntrk",
"zresolution vs # vertex tracks",40, 0., 200., 0, 0.01);
231 h[
"cpuvsntrk"] =
new TProfile(
"cpuvsntrk",
"cpu time vs # of fitted tracks",40, 0., 200., 0, 200.);
232 h[
"cpucluvsntrk"] =
new TProfile(
"cpucluvsntrk",
"clustering cpu time # of tracks",40, 0., 200., 0, 10.);
233 h[
"cpufit"] =
new TH1F(
"cpufit",
"cpu time for fitting",100, 0., 200.);
234 h[
"cpuclu"] =
new TH1F(
"cpuclu",
"cpu time for clustering",100, 0., 200.);
235 h[
"nbtksinvtx2"] =
new TH1F(
"nbtksinvtx2",
"reconstructed tracks in vertex",40,0.,200.);
236 h[
"nbtksinvtxPU2"] =
new TH1F(
"nbtksinvtxPU2",
"reconstructed tracks in vertex",40,0.,200.);
237 h[
"nbtksinvtxTag2"] =
new TH1F(
"nbtksinvtxTag2",
"reconstructed tracks in vertex",40,0.,200.);
239 h[
"xrec"] =
new TH1F(
"xrec",
"reconstructed x",100,-0.1,0.1);
240 h[
"yrec"] =
new TH1F(
"yrec",
"reconstructed y",100,-0.1,0.1);
241 h[
"zrec"] =
new TH1F(
"zrec",
"reconstructed z",100,-20.,20.);
242 h[
"err1"] =
new TH1F(
"err1",
"error 1",100,0.,0.1);
243 h[
"err2"] =
new TH1F(
"err2",
"error 2",100,0.,0.1);
244 h[
"errx"] =
new TH1F(
"errx",
"error x",100,0.,0.1);
245 h[
"erry"] =
new TH1F(
"erry",
"error y",100,0.,0.1);
246 h[
"errz"] =
new TH1F(
"errz",
"error z",100,0.,2.0);
247 h[
"errz1"] =
new TH1F(
"errz1",
"error z",100,0.,0.2);
249 h[
"zrecNt100"] =
new TH1F(
"zrecNt100",
"reconstructed z for high multiplicity events",80,-40.,40.);
250 add(h,
new TH2F(
"zrecvsnt",
"reconstructed z vs number of tracks",100,-50., 50., 20, 0., 200.));
251 add(h,
new TH2F(
"xyrec",
"reconstructed xy",100, -4., 4., 100, -4., 4.));
252 h[
"xrecBeam"] =
new TH1F(
"xrecBeam",
"reconstructed x - beam x",100,-0.1,0.1);
253 h[
"yrecBeam"] =
new TH1F(
"yrecBeam",
"reconstructed y - beam y",100,-0.1,0.1);
254 h[
"zrecBeam"] =
new TH1F(
"zrecBeam",
"reconstructed z - beam z",100,-20.,20.);
255 h[
"xrecBeamvsz"] =
new TH2F(
"xrecBeamvsz",
"reconstructed x - beam x vs z", 20, -20., 20.,100,-0.1,0.1);
256 h[
"yrecBeamvsz"] =
new TH2F(
"yrecBeamvsz",
"reconstructed y - beam y vs z", 20, -20., 20.,100,-0.1,0.1);
257 h[
"xrecBeamvszprof"] =
new TProfile(
"xrecBeamvszprof",
"reconstructed x - beam x vs z-z0", 20, -20., 20.,-0.1,0.1);
258 h[
"yrecBeamvszprof"] =
new TProfile(
"yrecBeamvszprof",
"reconstructed y - beam y vs z-z0", 20, -20., 20.,-0.1,0.1);
259 add(h,
new TH2F(
"xrecBeamvsdxXBS",
"reconstructed x - beam x vs resolution",10,0., 0.02, 100, -0.1,0.1));
260 add(h,
new TH2F(
"yrecBeamvsdyXBS",
"reconstructed z - beam z vs resolution",10,0., 0.02, 100, -0.1,0.1));
261 add(h,
new TH2F(
"xrecBeamvsdx",
"reconstructed x - beam x vs resolution",10,0., 0.02, 100, -0.1,0.1));
262 add(h,
new TH2F(
"yrecBeamvsdy",
"reconstructed z - beam z vs resolution",10,0., 0.02, 100, -0.1,0.1));
263 add(h,
new TH2F(
"xrecBeamvsdxR2",
"reconstructed x - beam x vs resolution",20,0., 0.04, 100, -0.1,0.1));
264 add(h,
new TH2F(
"yrecBeamvsdyR2",
"reconstructed z - beam z vs resolution",20,0., 0.04, 100, -0.1,0.1));
267 h[
"xrecBeamvsdxprof"] =
new TProfile(
"xrecBeamvsdxprof",
"reconstructed x - beam x vs resolution",10, 0., 0.04,-0.1,0.1 );
268 h[
"yrecBeamvsdyprof"] =
new TProfile(
"yrecBeamvsdyprof",
"reconstructed y - beam y vs resolution",10, 0., 0.04,-0.1,0.1 );
269 add(h,
new TProfile(
"xrecBeam2vsdx2prof",
"reconstructed x - beam x vs resolution",10,0., 0.002, 0., 0.01));
270 add(h,
new TProfile(
"yrecBeam2vsdy2prof",
"reconstructed y - beam y vs resolution",10,0., 0.002, 0., 0.01));
271 add(h,
new TH2F(
"xrecBeamvsdx2",
"reconstructed x - beam x vs resolution",10,0., 0.002, 100, -0.01, 0.01));
272 add(h,
new TH2F(
"yrecBeamvsdy2",
"reconstructed y - beam y vs resolution",10,0., 0.002, 100, -0.01, 0.01));
273 h[
"xrecb"] =
new TH1F(
"xrecb",
"reconstructed x - beam x",100,-0.01,0.01);
274 h[
"yrecb"] =
new TH1F(
"yrecb",
"reconstructed y - beam y",100,-0.01,0.01);
275 h[
"zrecb"] =
new TH1F(
"zrecb",
"reconstructed z - beam z",100,-20.,20.);
276 h[
"xrec1"] =
new TH1F(
"xrec1",
"reconstructed x",100,-4,4);
277 h[
"yrec1"] =
new TH1F(
"yrec1",
"reconstructed y",100,-4,4);
278 h[
"zrec1"] =
new TH1F(
"zrec1",
"reconstructed z",100,-80.,80.);
279 h[
"xrec2"] =
new TH1F(
"xrec2",
"reconstructed x",100,-1,1);
280 h[
"yrec2"] =
new TH1F(
"yrec2",
"reconstructed y",100,-1,1);
281 h[
"zrec2"] =
new TH1F(
"zrec2",
"reconstructed z",100,-40.,40.);
282 h[
"xrec3"] =
new TH1F(
"xrec3",
"reconstructed x",100,-0.1,0.1);
283 h[
"yrec3"] =
new TH1F(
"yrec3",
"reconstructed y",100,-0.1,0.1);
284 h[
"zrec3"] =
new TH1F(
"zrec3",
"reconstructed z",100,-20.,20.);
285 add(h,
new TH1F(
"xrecBeamPull",
"normalized residuals reconstructed x - beam x",100,-20,20));
286 add(h,
new TH1F(
"yrecBeamPull",
"normalized residuals reconstructed y - beam y",100,-20,20));
287 add(h,
new TH1F(
"zdiffrec",
"z-distance between vertices",200,-20., 20.));
288 add(h,
new TH1F(
"zdiffrec2",
"z-distance between ndof>2 vertices",200,-20., 20.));
289 add(h,
new TH1F(
"zdiffrec4",
"z-distance between ndof>4 vertices",200,-20., 20.));
290 add(h,
new TH1F(
"zdiffrec8",
"z-distance between ndof>8 vertices",200,-20., 20.));
291 add(h,
new TH2F(
"zvszrec2",
"z positions of multiple vertices",200,-20., 20., 200,-20., 20.));
292 add(h,
new TH2F(
"pzvspz2",
"prob(z) of multiple vertices",100, 0.,1.,100,0., 1.));
293 add(h,
new TH2F(
"zvszrec4",
"z positions of multiple vertices",100,-20., 20., 100,-20., 20.));
294 add(h,
new TH2F(
"pzvspz4",
"prob(z) of multiple vertices",100, 0.,1.,100,0., 1.));
295 add(h,
new TH2F(
"zdiffvsz",
"z-distance vs z",100,-10.,10.,30,-15.,15.));
296 add(h,
new TH2F(
"zdiffvsz4",
"z-distance vs z (ndof>4)",100,-10.,10.,30,-15.,15.));
297 add(h,
new TProfile(
"eff0vsntrec",
"efficiency vs # reconstructed tracks",50, 0., 50., 0, 1.));
298 add(h,
new TProfile(
"eff0vsntsel",
"efficiency vs # selected tracks",50, 0., 50., 0, 1.));
299 add(h,
new TProfile(
"eff0ndof0vsntsel",
"efficiency (ndof>0) vs # selected tracks",50, 0., 50., 0, 1.));
300 add(h,
new TProfile(
"eff0ndof8vsntsel",
"efficiency (ndof>8) vs # selected tracks",50, 0., 50., 0, 1.));
301 add(h,
new TProfile(
"eff0ndof2vsntsel",
"efficiency (ndof>2) vs # selected tracks",50, 0., 50., 0, 1.));
302 add(h,
new TProfile(
"eff0ndof4vsntsel",
"efficiency (ndof>4) vs # selected tracks",50, 0., 50., 0, 1.));
303 add(h,
new TH1F(
"xbeamPUcand",
"x - beam of PU candidates (ndof>4)",100,-1., 1.));
304 add(h,
new TH1F(
"ybeamPUcand",
"y - beam of PU candidates (ndof>4)",100,-1., 1.));
305 add(h,
new TH1F(
"xbeamPullPUcand",
"x - beam pull of PU candidates (ndof>4)",100,-20., 20.));
306 add(h,
new TH1F(
"ybeamPullPUcand",
"y - beam pull of PU candidates (ndof>4)",100,-20., 20.));
307 add(h,
new TH1F(
"ndofOverNtk",
"ndof / ntk of ndidates (ndof>4)",100,0., 2.));
309 add(h,
new TH1F(
"ndofOverNtkPUcand",
"ndof / ntk of ndidates (ndof>4)",100,0., 2.));
311 add(h,
new TH1F(
"zPUcand",
"z positions of PU candidates (all)",100,-20., 20.));
312 add(h,
new TH1F(
"zPUcand2",
"z positions of PU candidates (ndof>2)",100,-20., 20.));
313 add(h,
new TH1F(
"zPUcand4",
"z positions of PU candidates (ndof>4)",100,-20., 20.));
314 add(h,
new TH1F(
"ndofPUcand",
"ndof of PU candidates (all)",50,0., 100.));
315 add(h,
new TH1F(
"ndofPUcand2",
"ndof of PU candidates (ndof>2)",50,0., 100.));
316 add(h,
new TH1F(
"ndofPUcand4",
"ndof of PU candidates (ndof>4)",50,0., 100.));
317 add(h,
new TH1F(
"ndofnr2",
"second highest ndof",500,0., 100.));
318 add(h,
new TH1F(
"ndofnr2d1cm",
"second highest ndof (dz>1cm)",500,0., 100.));
319 add(h,
new TH1F(
"ndofnr2d2cm",
"second highest ndof (dz>2cm)",500,0., 100.));
321 h[
"nrecvtx"] =
new TH1F(
"nrecvtx",
"# of reconstructed vertices", 50, -0.5, 49.5);
322 h[
"nrecvtx8"] =
new TH1F(
"nrecvtx8",
"# of reconstructed vertices with ndof>8", 50, -0.5, 49.5);
323 h[
"nrecvtx2"] =
new TH1F(
"nrecvtx2",
"# of reconstructed vertices with ndof>2", 50, -0.5, 49.5);
324 h[
"nrecvtx4"] =
new TH1F(
"nrecvtx4",
"# of reconstructed vertices with ndof>4", 50, -0.5, 49.5);
326 h[
"nrectrk"] =
new TH1F(
"nrectrk",
"# of reconstructed tracks", 100, -0.5, 99.5);
327 add(h,
new TH1F(
"nsimtrk",
"# of simulated tracks", 100, -0.5, 99.5));
328 add(h,
new TH1F(
"nsimtrkSignal",
"# of simulated tracks (Signal)", 100, -0.5, 99.5));
329 add(h,
new TH1F(
"nsimtrkPU",
"# of simulated tracks (PU)", 100, -0.5, 99.5));
330 h[
"nsimtrk"]->StatOverflows(kTRUE);
331 h[
"nsimtrkPU"]->StatOverflows(kTRUE);
332 h[
"nsimtrkSignal"]->StatOverflows(kTRUE);
333 h[
"xrectag"] =
new TH1F(
"xrectag",
"reconstructed x, signal vtx",100,-0.05,0.05);
334 h[
"yrectag"] =
new TH1F(
"yrectag",
"reconstructed y, signal vtx",100,-0.05,0.05);
335 h[
"zrectag"] =
new TH1F(
"zrectag",
"reconstructed z, signal vtx",100,-20.,20.);
336 h[
"nrectrk0vtx"] =
new TH1F(
"nrectrk0vtx",
"# rec tracks no vertex ",100,-0.5, 99.5);
337 h[
"nseltrk0vtx"] =
new TH1F(
"nseltrk0vtx",
"# rec tracks no vertex ",100,-0.5, 99.5);
338 h[
"nrecsimtrk"] =
new TH1F(
"nrecsimtrk",
"# rec tracks matched to sim tracks in vertex",100,-0.5, 99.5);
339 h[
"nrecnosimtrk"] =
new TH1F(
"nrecsimtrk",
"# rec tracks not matched to sim tracks in vertex",100,-0.5, 99.5);
340 h[
"trackAssEffvsPt"] =
new TProfile(
"trackAssEffvsPt",
"track association efficiency vs pt",20, 0., 100., 0, 1.);
343 h[
"nseltrk"] =
new TH1F(
"nseltrk",
"# of reconstructed tracks selected for PV", 100, -0.5, 99.5);
344 h[
"nclutrkall"] =
new TH1F(
"nclutrkall",
"# of reconstructed tracks in clusters", 100, -0.5, 99.5);
345 h[
"nclutrkvtx"] =
new TH1F(
"nclutrkvtx",
"# of reconstructed tracks in clusters of reconstructed vertices", 100, -0.5, 99.5);
346 h[
"nclu"] =
new TH1F(
"nclu",
"# of clusters", 100, -0.5, 99.5);
347 h[
"nclu0vtx"] =
new TH1F(
"nclu0vtx",
"# of clusters in events with no PV", 100, -0.5, 99.5);
348 h[
"zlost1"] =
new TH1F(
"zlost1",
"z of lost vertices (bad z)", 100, -20., 20.);
349 h[
"zlost2"] =
new TH1F(
"zlost2",
"z of lost vertices (no matching cluster)", 100, -20., 20.);
350 h[
"zlost3"] =
new TH1F(
"zlost3",
"z of lost vertices (vertex too far from beam)", 100, -20., 20.);
351 h[
"zlost4"] =
new TH1F(
"zlost4",
"z of lost vertices (invalid vertex)", 100, -20., 20.);
352 h[
"selstat"] =
new TH1F(
"selstat",
"selstat", 5, -2.5, 2.5);
356 add(h,
new TH1F(
"fakeVtxZNdofgt05",
"z of fake vertices with ndof>0.5", 100, -20., 20.));
357 add(h,
new TH1F(
"fakeVtxZNdofgt2",
"z of fake vertices with ndof>2", 100, -20., 20.));
358 add(h,
new TH1F(
"fakeVtxZ",
"z of fake vertices", 100, -20., 20.));
359 add(h,
new TH1F(
"fakeVtxNdof",
"ndof of fake vertices", 500,0., 100.));
360 add(h,
new TH1F(
"fakeVtxNtrk",
"number of tracks in fake vertex",20,-0.5, 19.5));
361 add(h,
new TH1F(
"matchedVtxNdof",
"ndof of matched vertices", 500,0., 100.));
365 string types[] = {
"all",
"sel",
"bachelor",
"sellost",
"wgt05",
"wlt05",
"M",
"tagged",
"untagged",
"ndof4",
"PUcand",
"PUfake"};
366 for(
int t=0;
t<12;
t++){
367 add(h,
new TH1F((
"rapidity_"+types[
t]).c_str(),
"rapidity ",100,-3., 3.));
368 h[
"z0_"+types[
t]] =
new TH1F((
"z0_"+types[t]).c_str(),
"z0 ",80,-40., 40.);
369 h[
"phi_"+types[
t]] =
new TH1F((
"phi_"+types[t]).c_str(),
"phi ",80,-3.14159, 3.14159);
370 h[
"eta_"+types[
t]] =
new TH1F((
"eta_"+types[t]).c_str(),
"eta ",80,-4., 4.);
371 h[
"pt_"+types[
t]] =
new TH1F((
"pt_"+types[t]).c_str(),
"pt ",100,0., 20.);
372 h[
"found_"+types[
t]] =
new TH1F((
"found_"+types[t]).c_str(),
"found hits",20, 0., 20.);
373 h[
"lost_"+types[
t]] =
new TH1F((
"lost_"+types[t]).c_str(),
"lost hits",20, 0., 20.);
374 h[
"nchi2_"+types[
t]] =
new TH1F((
"nchi2_"+types[t]).c_str(),
"normalized track chi2",100, 0., 20.);
375 h[
"rstart_"+types[
t]] =
new TH1F((
"rstart_"+types[t]).c_str(),
"start radius",100, 0., 20.);
376 h[
"tfom_"+types[
t]] =
new TH1F((
"tfom_"+types[t]).c_str(),
"track figure of merit",100, 0., 100.);
377 h[
"expectedInner_"+types[
t]] =
new TH1F((
"expectedInner_"+types[t]).c_str(),
"expected inner hits ",10, 0., 10.);
378 h[
"expectedOuter_"+types[
t]] =
new TH1F((
"expectedOuter_"+types[t]).c_str(),
"expected outer hits ",10, 0., 10.);
379 h[
"logtresxy_"+types[
t]] =
new TH1F((
"logtresxy_"+types[t]).c_str(),
"log10(track r-phi resolution/um)",100, 0., 5.);
380 h[
"logtresz_"+types[
t]] =
new TH1F((
"logtresz_"+types[t]).c_str(),
"log10(track z resolution/um)",100, 0., 5.);
381 h[
"tpullxy_"+types[
t]] =
new TH1F((
"tpullxy_"+types[t]).c_str(),
"track r-phi pull",100, -10., 10.);
382 add(h,
new TH2F( (
"lvseta_"+types[t]).c_str(),
"cluster length vs eta",60,-3., 3., 20, 0., 20));
383 add(h,
new TH2F( (
"lvstanlambda_"+types[t]).c_str(),
"cluster length vs tan lambda",60,-6., 6., 20, 0., 20));
384 add(h,
new TH1F( (
"restrkz_"+types[t]).c_str(),
"z-residuals (track vs vertex)", 200, -5., 5.));
385 add(h,
new TH2F( (
"restrkzvsphi_"+types[t]).c_str(),
"z-residuals (track - vertex)", 12,-3.14159,3.14159,100, -5., 5.));
386 add(h,
new TH2F( (
"restrkzvseta_"+types[t]).c_str(),
"z-residuals (track - vertex)", 12,-3.,3.,200, -5., 5.));
387 add(h,
new TH2F( (
"pulltrkzvsphi_"+types[t]).c_str(),
"normalized z-residuals (track - vertex)", 12,-3.14159,3.14159,100, -5., 5.));
388 add(h,
new TH2F( (
"pulltrkzvseta_"+types[t]).c_str(),
"normalized z-residuals (track - vertex)", 12,-3.,3.,100, -5., 5.));
389 add(h,
new TH1F( (
"pulltrkz_"+types[t]).c_str(),
"normalized z-residuals (track vs vertex)", 100, -5., 5.));
390 add(h,
new TH1F( (
"sigmatrkz0_"+types[t]).c_str(),
"z-resolution (excluding beam)", 100, 0., 5.));
391 add(h,
new TH1F( (
"sigmatrkz_"+types[t]).c_str(),
"z-resolution (including beam)", 100,0., 5.));
392 add(h,
new TH1F( (
"nbarrelhits_"+types[t]).c_str(),
"number of pixel barrel hits", 10, 0., 10.));
393 add(h,
new TH1F( (
"nbarrelLayers_"+types[t]).c_str(),
"number of pixel barrel layers", 10, 0., 10.));
394 add(h,
new TH1F( (
"nPxLayers_"+types[t]).c_str(),
"number of pixel layers (barrel+endcap)", 10, 0., 10.));
395 add(h,
new TH1F( (
"nSiLayers_"+types[t]).c_str(),
"number of Tracker layers ", 20, 0., 20.));
396 add(h,
new TH1F( (
"trackAlgo_"+types[t]).c_str(),
"track algorithm ", 30, 0., 30.));
397 add(h,
new TH1F( (
"trackQuality_"+types[t]).c_str(),
"track quality ", 7, -1., 6.));
399 add(h,
new TH1F(
"trackWt",
"track weight in vertex",100,0., 1.));
402 h[
"nrectrk"]->StatOverflows(kTRUE);
403 h[
"nrectrk"]->StatOverflows(kTRUE);
404 h[
"nrectrk0vtx"]->StatOverflows(kTRUE);
405 h[
"nseltrk0vtx"]->StatOverflows(kTRUE);
406 h[
"nrecsimtrk"]->StatOverflows(kTRUE);
407 h[
"nrecnosimtrk"]->StatOverflows(kTRUE);
408 h[
"nseltrk"]->StatOverflows(kTRUE);
409 h[
"nbtksinvtx"]->StatOverflows(kTRUE);
410 h[
"nbtksinvtxPU"]->StatOverflows(kTRUE);
411 h[
"nbtksinvtxTag"]->StatOverflows(kTRUE);
412 h[
"nbtksinvtx2"]->StatOverflows(kTRUE);
413 h[
"nbtksinvtxPU2"]->StatOverflows(kTRUE);
414 h[
"nbtksinvtxTag2"]->StatOverflows(kTRUE);
417 h[
"npu0"] =
new TH1F(
"npu0",
"Number of simulated vertices",40,0.,40.);
418 h[
"npu1"] =
new TH1F(
"npu1",
"Number of simulated vertices with >0 track",40,0.,40.);
419 h[
"npu2"] =
new TH1F(
"npu2",
"Number of simulated vertices with >1 track",40,0.,40.);
420 h[
"nrecv"] =
new TH1F(
"nrecv",
"# of reconstructed vertices", 40, 0, 40);
421 add(h,
new TH2F(
"nrecvsnpu",
"#rec vertices vs number of sim vertices with >0 tracks", 40, 0., 40, 40, 0, 40));
422 add(h,
new TH2F(
"nrecvsnpu2",
"#rec vertices vs number of sim vertices with >1 tracks", 40, 0., 40, 40, 0, 40));
423 add(h,
new TH1F(
"sumpt",
"sumpt of simulated tracks",100,0.,100.));
424 add(h,
new TH1F(
"sumptSignal",
"sumpt of simulated tracks in Signal events",100,0.,200.));
425 add(h,
new TH1F(
"sumptPU",
"sumpt of simulated tracks in PU events",100,0.,200.));
426 add(h,
new TH1F(
"sumpt2rec",
"sumpt2 of reconstructed and matched tracks",100,0.,100.));
427 add(h,
new TH1F(
"sumpt2",
"sumpt2 of simulated tracks",100,0.,100.));
428 add(h,
new TH1F(
"sumpt2Signal",
"sumpt2 of simulated tracks in Signal events",100,0.,200.));
429 add(h,
new TH1F(
"sumpt2PU",
"sumpt2 of simulated tracks in PU events",100,0.,200.));
430 add(h,
new TH1F(
"sumpt2rec",
"sumpt2 of reconstructed and matched tracks",100,0.,100.));
431 add(h,
new TH1F(
"sumpt2recSignal",
"sumpt2 of reconstructed and matched tracks in Signal events",100,0.,200.));
432 add(h,
new TH1F(
"sumpt2recPU",
"sumpt2 of reconstructed and matched tracks in PU events",100,0.,200.));
433 add(h,
new TH1F(
"nRecTrkInSimVtx",
"number of reco tracks matched to sim-vertex", 101, 0., 100));
434 add(h,
new TH1F(
"nRecTrkInSimVtxSignal",
"number of reco tracks matched to signal sim-vertex", 101, 0., 100));
435 add(h,
new TH1F(
"nRecTrkInSimVtxPU",
"number of reco tracks matched to PU-vertex", 101, 0., 100));
436 add(h,
new TH1F(
"nPrimRecTrkInSimVtx",
"number of reco primary tracks matched to sim-vertex", 101, 0., 100));
437 add(h,
new TH1F(
"nPrimRecTrkInSimVtxSignal",
"number of reco primary tracks matched to signal sim-vertex", 101, 0., 100));
438 add(h,
new TH1F(
"nPrimRecTrkInSimVtxPU",
"number of reco primary tracks matched to PU-vertex", 101, 0., 100));
440 add(h,
new TH1F(
"recPurity",
"track purity of reconstructed vertices", 101, 0., 1.01));
441 add(h,
new TH1F(
"recPuritySignal",
"track purity of reconstructed Signal vertices", 101, 0., 1.01));
442 add(h,
new TH1F(
"recPurityPU",
"track purity of reconstructed PU vertices", 101, 0., 1.01));
444 add(h,
new TH1F(
"recmatchPurity",
"track purity of all vertices", 101, 0., 1.01));
445 add(h,
new TH1F(
"recmatchPurityTag",
"track purity of tagged vertices", 101, 0., 1.01));
446 add(h,
new TH1F(
"recmatchPurityTagSignal",
"track purity of tagged Signal vertices", 101, 0., 1.01));
447 add(h,
new TH1F(
"recmatchPurityTagPU",
"track purity of tagged PU vertices", 101, 0., 1.01));
448 add(h,
new TH1F(
"recmatchPuritynoTag",
"track purity of untagged vertices", 101, 0., 1.01));
449 add(h,
new TH1F(
"recmatchPuritynoTagSignal",
"track purity of untagged Signal vertices", 101, 0., 1.01));
450 add(h,
new TH1F(
"recmatchPuritynoTagPU",
"track purity of untagged PU vertices", 101, 0., 1.01));
451 add(h,
new TH1F(
"recmatchvtxs",
"number of sim vertices contributing to recvtx", 10, 0., 10.));
452 add(h,
new TH1F(
"recmatchvtxsTag",
"number of sim vertices contributing to recvtx", 10, 0., 10.));
453 add(h,
new TH1F(
"recmatchvtxsnoTag",
"number of sim vertices contributing to recvtx", 10, 0., 10.));
455 add(h,
new TH1F(
"trkAssignmentEfficiency",
"track to vertex assignment efficiency", 101, 0., 1.01) );
456 add(h,
new TH1F(
"trkAssignmentEfficiencySignal",
"track to signal vertex assignment efficiency", 101, 0., 1.01) );
457 add(h,
new TH1F(
"trkAssignmentEfficiencyPU",
"track to PU vertex assignment efficiency", 101, 0., 1.01) );
458 add(h,
new TH1F(
"primtrkAssignmentEfficiency",
"track to vertex assignment efficiency", 101, 0., 1.01) );
459 add(h,
new TH1F(
"primtrkAssignmentEfficiencySignal",
"track to signal vertex assignment efficiency", 101, 0., 1.01) );
460 add(h,
new TH1F(
"primtrkAssignmentEfficiencyPU",
"track to PU vertex assignment efficiency", 101, 0., 1.01) );
461 add(h,
new TH1F(
"vtxMultiplicity",
"number of rec vertices containg tracks from one true vertex", 10, 0., 10.) );
462 add(h,
new TH1F(
"vtxMultiplicitySignal",
"number of rec vertices containg tracks from the Signal Vertex", 10, 0., 10.) );
463 add(h,
new TH1F(
"vtxMultiplicityPU",
"number of rec vertices containg tracks from a PU Vertex", 10, 0., 10.) );
465 add(h,
new TProfile(
"vtxFindingEfficiencyVsNtrk",
"finding efficiency vs number of associated rec tracks",100, 0., 100., 0., 1.) );
466 add(h,
new TProfile(
"vtxFindingEfficiencyVsNtrkSignal",
"Signal vertex finding efficiency vs number of associated rec tracks",100, 0., 100., 0., 1.) );
467 add(h,
new TProfile(
"vtxFindingEfficiencyVsNtrkPU",
"PU vertex finding efficiency vs number of associated rec tracks",100, 0., 100., 0., 1.) );
469 add(h,
new TH1F(
"TagVtxTrkPurity",
"TagVtxTrkPurity",100,0.,1.01));
470 add(h,
new TH1F(
"TagVtxTrkEfficiency",
"TagVtxTrkEfficiency",100,0.,1.01));
472 add(h,
new TH1F(
"matchVtxFraction",
"fraction of sim vertex tracks found in a recvertex",101,0,1.01));
473 add(h,
new TH1F(
"matchVtxFractionSignal",
"fraction of sim vertex tracks found in a recvertex",101,0,1.01));
474 add(h,
new TH1F(
"matchVtxFractionPU",
"fraction of sim vertex tracks found in a recvertex",101,0,1.01));
475 add(h,
new TH1F(
"matchVtxFractionCum",
"fraction of sim vertex tracks found in a recvertex",101,0,1.01));
476 add(h,
new TH1F(
"matchVtxFractionCumSignal",
"fraction of sim vertexs track found in a recvertex",101,0,1.01));
477 add(h,
new TH1F(
"matchVtxFractionCumPU",
"fraction of sim vertex tracks found in a recvertex",101,0,1.01));
478 add(h,
new TH1F(
"matchVtxEfficiency",
"efficiency for finding matching rec vertex",2,-0.5,1.5));
479 add(h,
new TH1F(
"matchVtxEfficiencySignal",
"efficiency for finding matching rec vertex",2,-0.5,1.5));
480 add(h,
new TH1F(
"matchVtxEfficiencyPU",
"efficiency for finding matching rec vertex",2,-0.5,1.5));
481 add(h,
new TH1F(
"matchVtxEfficiency2",
"efficiency for finding matching rec vertex (nt>1)",2,-0.5,1.5));
482 add(h,
new TH1F(
"matchVtxEfficiency2Signal",
"efficiency for finding matching rec vertex (nt>1)",2,-0.5,1.5));
483 add(h,
new TH1F(
"matchVtxEfficiency2PU",
"efficiency for finding matching rec vertex (nt>1)",2,-0.5,1.5));
484 add(h,
new TH1F(
"matchVtxEfficiency5",
"efficiency for finding matching rec vertex (purity>0.5)",2,-0.5,1.5));
485 add(h,
new TH1F(
"matchVtxEfficiency5Signal",
"efficiency for finding matching rec vertex (purity>0.5)",2,-0.5,1.5));
486 add(h,
new TH1F(
"matchVtxEfficiency5PU",
"efficiency for finding matching rec vertex (purity>0.5)",2,-0.5,1.5));
489 add(h,
new TH1F(
"matchVtxEfficiencyZ",
"efficiency for finding matching rec vertex within 1 mm",2,-0.5,1.5));
490 add(h,
new TH1F(
"matchVtxEfficiencyZSignal",
"efficiency for finding matching rec vertex within 1 mm",2,-0.5,1.5));
491 add(h,
new TH1F(
"matchVtxEfficiencyZPU",
"efficiency for finding matching rec vertex within 1 mm",2,-0.5,1.5));
493 add(h,
new TH1F(
"matchVtxEfficiencyZ1",
"efficiency for finding matching rec vertex within 1 mm (nt>0)",2,-0.5,1.5));
494 add(h,
new TH1F(
"matchVtxEfficiencyZ1Signal",
"efficiency for finding matching rec vertex within 1 mm (nt>0)",2,-0.5,1.5));
495 add(h,
new TH1F(
"matchVtxEfficiencyZ1PU",
"efficiency for finding matching rec vertex within 1 mm (nt>0)",2,-0.5,1.5));
497 add(h,
new TH1F(
"matchVtxEfficiencyZ2",
"efficiency for finding matching rec vertex within 1 mm (nt>1)",2,-0.5,1.5));
498 add(h,
new TH1F(
"matchVtxEfficiencyZ2Signal",
"efficiency for finding matching rec vertex within 1 mm (nt>1)",2,-0.5,1.5));
499 add(h,
new TH1F(
"matchVtxEfficiencyZ2PU",
"efficiency for finding matching rec vertex within 1 mm (nt>1)",2,-0.5,1.5));
501 add(h,
new TH1F(
"matchVtxZ",
"z distance to matched recvtx",100, -0.1, 0.1));
502 add(h,
new TH1F(
"matchVtxZPU",
"z distance to matched recvtx",100, -0.1, 0.1));
503 add(h,
new TH1F(
"matchVtxZSignal",
"z distance to matched recvtx",100, -0.1, 0.1));
505 add(h,
new TH1F(
"matchVtxZCum",
"z distance to matched recvtx",1001,0, 1.01));
506 add(h,
new TH1F(
"matchVtxZCumSignal",
"z distance to matched recvtx",1001,0, 1.01));
507 add(h,
new TH1F(
"matchVtxZCumPU",
"z distance to matched recvtx",1001,0, 1.01));
509 add(h,
new TH1F(
"unmatchedVtx",
"number of unmatched rec vertices (fakes)",10,0.,10.));
510 add(h,
new TH1F(
"unmatchedVtxFrac",
"fraction of unmatched rec vertices (fakes)",1000,0.,1.0));
511 add(h,
new TH1F(
"unmatchedVtxZ",
"z of unmached rec vertices (fakes)",100,-20., 20.));
512 add(h,
new TH1F(
"unmatchedVtxNdof",
"ndof of unmatched rec vertices (fakes)", 500,0., 100.));
513 add(h,
new TH2F(
"correctlyassigned",
"pt and eta of correctly assigned tracks", 60, -3., 3., 100, 0, 10.));
514 add(h,
new TH2F(
"misassigned",
"pt and eta of mis assigned tracks", 60, -3., 3., 100, 0, 10.));
517 add(h,
new TProfile(
"effvszsep",
"efficiency vs true z-separation",500, 0., 10., 0, 1.));
518 add(h,
new TProfile(
"effwodvszsep",
"efficiency w/o double-counting vs true z-separation",500, 0., 10., 0, 1.));
519 add(h,
new TProfile(
"mergedvszsep",
"merge rate vs true z-separation",500, 0., 10., 0, 1.));
520 add(h,
new TProfile(
"splitvszsep",
"split rate vs true z-separation",500, 0., 10., 0, 1.));
521 add(h,
new TProfile(
"tveffvszsep",
"efficiency vs true z-separation",500, 0., 10., 0, 1.));
522 add(h,
new TProfile(
"tveffwodvszsep",
"efficiency w/o double-counting vs true z-separation",500, 0., 10., 0, 1.));
523 add(h,
new TProfile(
"tvmergedvszsep",
"merge rate vs true z-separation",500, 0., 10., 0, 1.));
525 add(h,
new TH1F(
"ptcat",
"pt of correctly assigned tracks", 100, 0, 10.));
526 add(h,
new TH1F(
"etacat",
"eta of correctly assigned tracks", 60, -3., 3.));
527 add(h,
new TH1F(
"phicat",
"phi of correctly assigned tracks", 100, -3.14159, 3.14159));
528 add(h,
new TH1F(
"dzcat",
"dz of correctly assigned tracks", 100, 0., 1.));
530 add(h,
new TH1F(
"ptmis",
"pt of mis-assigned tracks", 100, 0, 10.));
531 add(h,
new TH1F(
"etamis",
"eta of mis-assigned tracks", 60, -3., 3.));
532 add(h,
new TH1F(
"phimis",
"phi of mis-assigned tracks",100, -3.14159, 3.14159));
533 add(h,
new TH1F(
"dzmis",
"dz of mis-assigned tracks", 100, 0., 1.));
536 add(h,
new TH1F(
"Tc",
"Tc computed with Truth matched Reco Tracks",100,0.,20.));
537 add(h,
new TH1F(
"TcSignal",
"Tc of signal vertices computed with Truth matched Reco Tracks",100,0.,20.));
538 add(h,
new TH1F(
"TcPU",
"Tc of PU vertices computed with Truth matched Reco Tracks",100,0.,20.));
540 add(h,
new TH1F(
"logTc",
"log Tc computed with Truth matched Reco Tracks",100,-2.,8.));
541 add(h,
new TH1F(
"logTcSignal",
"log Tc of signal vertices computed with Truth matched Reco Tracks",100,-2.,8.));
542 add(h,
new TH1F(
"logTcPU",
"log Tc of PU vertices computed with Truth matched Reco Tracks",100,-2.,8.));
544 add(h,
new TH1F(
"xTc",
"Tc of merged clusters",100,0.,20.));
545 add(h,
new TH1F(
"xTcSignal",
"Tc of signal vertices merged with PU",100,0.,20.));
546 add(h,
new TH1F(
"xTcPU",
"Tc of merged PU vertices",100,0.,20.));
548 add(h,
new TH1F(
"logxTc",
"log Tc merged vertices",100,-2.,8.));
549 add(h,
new TH1F(
"logxTcSignal",
"log Tc of signal vertices merged with PU",100,-2.,8.));
550 add(h,
new TH1F(
"logxTcPU",
"log Tc of merged PU vertices ",100,-2.,8.));
552 add(h,
new TH1F(
"logChisq",
"Chisq/ntrk computed with Truth matched Reco Tracks",100,-2.,8.));
553 add(h,
new TH1F(
"logChisqSignal",
"Chisq/ntrk of signal vertices computed with Truth matched Reco Tracks",100,-2.,8.));
554 add(h,
new TH1F(
"logChisqPU",
"Chisq/ntrk of PU vertices computed with Truth matched Reco Tracks",100,-2.,8.));
556 add(h,
new TH1F(
"logxChisq",
"Chisq/ntrk of merged clusters",100,-2.,8.));
557 add(h,
new TH1F(
"logxChisqSignal",
"Chisq/ntrk of signal vertices merged with PU",100,-2.,8.));
558 add(h,
new TH1F(
"logxChisqPU",
"Chisq/ntrk of merged PU vertices",100,-2.,8.));
560 add(h,
new TH1F(
"Chisq",
"Chisq/ntrk computed with Truth matched Reco Tracks",100,0.,20.));
561 add(h,
new TH1F(
"ChisqSignal",
"Chisq/ntrk of signal vertices computed with Truth matched Reco Tracks",100,0.,20.));
562 add(h,
new TH1F(
"ChisqPU",
"Chisq/ntrk of PU vertices computed with Truth matched Reco Tracks",100,0.,20.));
564 add(h,
new TH1F(
"xChisq",
"Chisq/ntrk of merged clusters",100,0.,20.));
565 add(h,
new TH1F(
"xChisqSignal",
"Chisq/ntrk of signal vertices merged with PU",100,0.,20.));
566 add(h,
new TH1F(
"xChisqPU",
"Chisq/ntrk of merged PU vertices",100,0.,20.));
568 add(h,
new TH1F(
"dzmax",
"dzmax computed with Truth matched Reco Tracks",100,0.,2.));
569 add(h,
new TH1F(
"dzmaxSignal",
"dzmax of signal vertices computed with Truth matched Reco Tracks",100,0.,2.));
570 add(h,
new TH1F(
"dzmaxPU",
"dzmax of PU vertices computed with Truth matched Reco Tracks",100,0.,2.));
572 add(h,
new TH1F(
"xdzmax",
"dzmax of merged clusters",100,0.,2.));
573 add(h,
new TH1F(
"xdzmaxSignal",
"dzmax of signal vertices merged with PU",100,0.,2.));
574 add(h,
new TH1F(
"xdzmaxPU",
"dzmax of merged PU vertices",100,0.,2.));
576 add(h,
new TH1F(
"dztrim",
"dzmax computed with Truth matched Reco Tracks",100,0.,2.));
577 add(h,
new TH1F(
"dztrimSignal",
"dzmax of signal vertices computed with Truth matched Reco Tracks",100,0.,2.));
578 add(h,
new TH1F(
"dztrimPU",
"dzmax of PU vertices computed with Truth matched Reco Tracks",100,0.,2.));
580 add(h,
new TH1F(
"xdztrim",
"dzmax of merged clusters",100,0.,2.));
581 add(h,
new TH1F(
"xdztrimSignal",
"dzmax of signal vertices merged with PU",100,0.,2.));
582 add(h,
new TH1F(
"xdztrimPU",
"dzmax of merged PU vertices",100,0.,2.));
584 add(h,
new TH1F(
"m4m2",
"m4m2 computed with Truth matched Reco Tracks",100,0.,100.));
585 add(h,
new TH1F(
"m4m2Signal",
"m4m2 of signal vertices computed with Truth matched Reco Tracks",100,0.,100.));
586 add(h,
new TH1F(
"m4m2PU",
"m4m2 of PU vertices computed with Truth matched Reco Tracks",100,0.,100.));
588 add(h,
new TH1F(
"xm4m2",
"m4m2 of merged clusters",100,0.,100.));
589 add(h,
new TH1F(
"xm4m2Signal",
"m4m2 of signal vertices merged with PU",100,0.,100.));
590 add(h,
new TH1F(
"xm4m2PU",
"m4m2 of merged PU vertices",100,0.,100.));
600 std::cout <<
" PrimaryVertexAnalyzer4PU::beginJob conversion from sim units to rec units is " <<
simUnit_ << std::endl;
605 TDirectory *noBS =
rootFile_->mkdir(
"noBS");
609 hist->second->SetDirectory(noBS);
612 TDirectory *withBS =
rootFile_->mkdir(
"BS");
615 for(std::map<std::string,TH1*>::const_iterator
hist=
hBS.begin();
hist!=
hBS.end();
hist++){
616 hist->second->SetDirectory(withBS);
622 for(std::map<std::string,TH1*>::const_iterator
hist=
hDA.begin();
hist!=
hDA.end();
hist++){
623 hist->second->SetDirectory(DA);
641 hsimPV[
"rapidity"] =
new TH1F(
"rapidity",
"rapidity ",100,-10., 10.);
642 hsimPV[
"chRapidity"] =
new TH1F(
"chRapidity",
"charged rapidity ",100,-10., 10.);
643 hsimPV[
"recRapidity"] =
new TH1F(
"recRapidity",
"reconstructed rapidity ",100,-10., 10.);
644 hsimPV[
"pt"] =
new TH1F(
"pt",
"pt ",100,0., 20.);
646 hsimPV[
"xsim"] =
new TH1F(
"xsim",
"simulated x",100,-0.01,0.01);
647 hsimPV[
"ysim"] =
new TH1F(
"ysim",
"simulated y",100,-0.01,0.01);
648 hsimPV[
"zsim"] =
new TH1F(
"zsim",
"simulated z",100,-20.,20.);
650 hsimPV[
"xsim1"] =
new TH1F(
"xsim1",
"simulated x",100,-4.,4.);
651 hsimPV[
"ysim1"] =
new TH1F(
"ysim1",
"simulated y",100,-4.,4.);
652 hsimPV[
"zsim1"] =
new TH1F(
"zsim1",
"simulated z",100,-40.,40.);
654 add(
hsimPV,
new TH1F(
"xsim2PU",
"simulated x (Pile-up)",100,-1.,1.));
655 add(
hsimPV,
new TH1F(
"ysim2PU",
"simulated y (Pile-up)",100,-1.,1.));
656 add(
hsimPV,
new TH1F(
"zsim2PU",
"simulated z (Pile-up)",100,-20.,20.));
657 add(
hsimPV,
new TH1F(
"xsim2Signal",
"simulated x (Signal)",100,-1.,1.));
658 add(
hsimPV,
new TH1F(
"ysim2Signal",
"simulated y (Signal)",100,-1.,1.));
659 add(
hsimPV,
new TH1F(
"zsim2Signal",
"simulated z (Signal)",100,-20.,20.));
661 hsimPV[
"xsim2"] =
new TH1F(
"xsim2",
"simulated x",100,-1,1);
662 hsimPV[
"ysim2"] =
new TH1F(
"ysim2",
"simulated y",100,-1,1);
663 hsimPV[
"zsim2"] =
new TH1F(
"zsim2",
"simulated z",100,-20.,20.);
664 hsimPV[
"xsim3"] =
new TH1F(
"xsim3",
"simulated x",100,-0.1,0.1);
665 hsimPV[
"ysim3"] =
new TH1F(
"ysim3",
"simulated y",100,-0.1,0.1);
666 hsimPV[
"zsim3"] =
new TH1F(
"zsim3",
"simulated z",100,-20.,20.);
667 hsimPV[
"xsimb"] =
new TH1F(
"xsimb",
"simulated x",100,-0.01,0.01);
668 hsimPV[
"ysimb"] =
new TH1F(
"ysimb",
"simulated y",100,-0.01,0.01);
669 hsimPV[
"zsimb"] =
new TH1F(
"zsimb",
"simulated z",100,-20.,20.);
670 hsimPV[
"xsimb1"] =
new TH1F(
"xsimb1",
"simulated x",100,-0.1,0.1);
671 hsimPV[
"ysimb1"] =
new TH1F(
"ysimb1",
"simulated y",100,-0.1,0.1);
672 hsimPV[
"zsimb1"] =
new TH1F(
"zsimb1",
"simulated z",100,-20.,20.);
673 add(
hsimPV,
new TH1F(
"xbeam",
"beamspot x",100,-1.,1.));
674 add(
hsimPV,
new TH1F(
"ybeam",
"beamspot y",100,-1.,1.));
675 add(
hsimPV,
new TH1F(
"zbeam",
"beamspot z",100,-1.,1.));
676 add(
hsimPV,
new TH1F(
"wxbeam",
"beamspot sigma x",100,-1.,1.));
677 add(
hsimPV,
new TH1F(
"wybeam",
"beamspot sigma y",100,-1.,1.));
678 add(
hsimPV,
new TH1F(
"wzbeam",
"beamspot sigma z",100,-1.,1.));
679 hsimPV[
"xsim2"]->StatOverflows(kTRUE);
680 hsimPV[
"ysim2"]->StatOverflows(kTRUE);
681 hsimPV[
"zsim2"]->StatOverflows(kTRUE);
682 hsimPV[
"xsimb"]->StatOverflows(kTRUE);
683 hsimPV[
"ysimb"]->StatOverflows(kTRUE);
684 hsimPV[
"zsimb"]->StatOverflows(kTRUE);
685 hsimPV[
"nsimvtx"] =
new TH1F(
"nsimvtx",
"# of simulated vertices", 50, -0.5, 49.5);
688 hsimPV[
"nbsimtksinvtx"]=
new TH1F(
"nbsimtksinvtx",
"simulated tracks in vertex",100,-0.5,99.5);
689 hsimPV[
"nbsimtksinvtx"]->StatOverflows(kTRUE);
695 std::cout <<
"this is void PrimaryVertexAnalyzer4PU::endJob() " << std::endl;
697 double sumDA=0,sumBS=0,sumnoBS=0;
699 for(
int i=101;
i>0;
i--){
700 sumDA+=
hDA[
"matchVtxFractionSignal"]->GetBinContent(
i)/
hDA[
"matchVtxFractionSignal"]->Integral();
701 hDA[
"matchVtxFractionCumSignal"]->SetBinContent(
i,sumDA);
702 sumBS+=
hBS[
"matchVtxFractionSignal"]->GetBinContent(
i)/
hBS[
"matchVtxFractionSignal"]->Integral();
703 hBS[
"matchVtxFractionCumSignal"]->SetBinContent(
i,sumBS);
704 sumnoBS+=
hnoBS[
"matchVtxFractionSignal"]->GetBinContent(
i)/
hnoBS[
"matchVtxFractionSignal"]->Integral();
705 hnoBS[
"matchVtxFractionCumSignal"]->SetBinContent(
i,sumnoBS);
711 sumDA=0,sumBS=0,sumnoBS=0;
713 for(
int i=1;
i<1001;
i++){
714 sumDA+=
hDA[
"abszdistancetag"]->GetBinContent(
i);
715 hDA[
"abszdistancetagcum"]->SetBinContent(
i,sumDA/
float(
hDA[
"abszdistancetag"]->GetEntries()));
716 sumBS+=
hBS[
"abszdistancetag"]->GetBinContent(
i);
717 hBS[
"abszdistancetagcum"]->SetBinContent(
i,sumBS/
float(
hBS[
"abszdistancetag"]->GetEntries()));
718 sumnoBS+=
hnoBS[
"abszdistancetag"]->GetBinContent(
i);
719 hnoBS[
"abszdistancetagcum"]->SetBinContent(
i,sumnoBS/
float(
hnoBS[
"abszdistancetag"]->GetEntries()));
740 for(
int i=1;
i<501;
i++){
741 if(
hDA[
"vtxndf"]->GetEntries()>0){
742 p=
hDA[
"vtxndf"]->Integral(
i,501)/
hDA[
"vtxndf"]->GetEntries();
hDA[
"vtxndfc"]->SetBinContent(
i,p*
hDA[
"vtxndf"]->GetBinContent(
i));
744 if(
hBS[
"vtxndf"]->GetEntries()>0){
745 p=
hBS[
"vtxndf"]->Integral(
i,501)/
hBS[
"vtxndf"]->GetEntries();
hBS[
"vtxndfc"]->SetBinContent(
i,p*
hBS[
"vtxndf"]->GetBinContent(
i));
747 if(
hnoBS[
"vtxndf"]->GetEntries()>0){
748 p=
hnoBS[
"vtxndf"]->Integral(
i,501)/
hnoBS[
"vtxndf"]->GetEntries();
hnoBS[
"vtxndfc"]->SetBinContent(
i,p*
hnoBS[
"vtxndf"]->GetBinContent(
i));
758 hist->second->Write();
761 std::cout <<
"PrimaryVertexAnalyzer4PU::endJob: done" << std::endl;
773 std::vector<SimPart > tsim;
774 if(simVtcs->begin()==simVtcs->end()){
776 cout <<
" PrimaryVertexAnalyzer4PU::getSimTrkParameters no simvtcs" << endl;
781 cout <<
" PrimaryVertexAnalyzer4PU::getSimTrkParameters simVtcs n=" << simVtcs->size() << endl;
782 cout <<
" PrimaryVertexAnalyzer4PU::getSimTrkParameters 1st position" << setw(8) << setprecision(4) << simVtcs->begin()->position() << endl;
784 double t0=simVtcs->begin()->position().e();
786 for(edm::SimTrackContainer::const_iterator
t=simTrks->begin();
787 t!=simTrks->end(); ++
t){
789 std::cout <<
"simtrk has no vertex" << std::endl;
794 (*simVtcs)[
t->vertIndex()].position().y(),
795 (*simVtcs)[
t->vertIndex()].position().z(),
796 (*simVtcs)[
t->vertIndex()].position().e());
797 int pdgCode=
t->type();
801 std::cout <<
"funny particle skipped , code=" << pdgCode << std::endl;
804 if ((pdgCode==11)||(pdgCode==13)||(pdgCode==15)||(pdgCode==-211)||(pdgCode==-2212)||(pdgCode==-321)||(pdgCode==-3222)){Q=-1;}
805 else if((pdgCode==-11)||(pdgCode==-13)||(pdgCode==-15)||(pdgCode==211)||(pdgCode==2212)||(pdgCode==321)||(pdgCode==3222)){Q=1;}
810 if ( (Q != 0) && (
p.pt()>0.1) && (fabs(
t->momentum().eta())<3.0)
811 && fabs(
v.z()*simUnit<20) && (
sqrt(
v.x()*
v.x()+
v.y()*
v.y())<10.)){
812 double x0=
v.x()*simUnit;
813 double y0=
v.y()*simUnit;
814 double z0=
v.z()*simUnit;
816 double D0=x0*
sin(
p.phi())-y0*
cos(
p.phi())-0.5*kappa*(x0*x0+y0*y0);
817 double q=
sqrt(1.-2.*kappa*D0);
818 double s0=(x0*
cos(
p.phi())+y0*
sin(
p.phi()))/
q;
820 if (fabs(kappa*s0)>0.001){
821 s1=asin(kappa*s0)/
kappa;
823 double ks02=(kappa*s0)*(kappa*s0);
824 s1=s0*(1.+ks02/6.+3./40.*ks02*ks02+5./112.*
pow(ks02,3));
841 double x1=x0-0.033;
double y1=y0-0.;
842 D0=x1*
sin(
p.phi())-y1*
cos(
p.phi())-0.5*kappa*(x1*x1+y1*y1);
843 q=
sqrt(1.-2.*kappa*D0);
845 if (fabs(kappa*s0)>0.001){
846 s1=asin(kappa*s0)/
kappa;
848 double ks02=(kappa*s0)*(kappa*s0);
849 s1=s0*(1.+ks02/6.+3./40.*ks02*ks02+5./112.*
pow(ks02,3));
867 Array2D(
size_t iN,
size_t iM):
868 m_step(iM),m_array(new double[iN*iM]) {}
870 double& operator()(
size_t iN,
size_t iM) {
871 return m_array[iN*m_step+iM];
874 double operator()(
size_t iN,
size_t iM)
const {
875 return m_array[iN*m_step+iM];
879 std::unique_ptr<double[]> m_array;
884 const unsigned int nsim=simtrks.size();
885 const unsigned int nrec=trks.size();
886 std::vector<int> rectosim(nrec);
887 Array2D pij(nrec,nsim);
891 for(reco::TrackCollection::const_iterator
t=trks.begin();
t!=trks.end(); ++
t){
897 for(
unsigned int j=0;
j<nsim;
j++){
901 for(
unsigned int k=0;
k<5;
k++){
902 for(
unsigned int l=0;
l<5;
l++){
906 pij(i,
j)=
exp(-0.5*c);
939 for(
unsigned int k=0;
k<nrec;
k++){
940 int imatch=-1;
int jmatch=-1;
942 for(
unsigned int j=0;
j<nsim;
j++){
943 if ((simtrks[
j].rec)<0){
944 double psum=
exp(-0.5*mu);
945 for(
unsigned int i=0; i<nrec; i++){
946 if (rectosim[i]<0){ psum+=pij(i,
j);}
948 for(
unsigned int i=0; i<nrec; i++){
949 if ((rectosim[i]<0)&&(pij(i,
j)/psum>pmatch)){
950 pmatch=pij(i,
j)/psum;
956 if((jmatch>=0)||(imatch>=0)){
960 rectosim[imatch]=jmatch;
961 simtrks[jmatch].rec=imatch;
963 }
else if (
match(simtrks[jmatch].par, trks.at(imatch).parameters())){
965 rectosim[imatch]=jmatch;
966 simtrks[jmatch].rec=imatch;
984 std::cout <<
"unmatched sim " << std::endl;
985 for(
unsigned int j=0;
j<nsim;
j++){
986 if(simtrks[
j].rec<0){
987 double pt= 1./simtrks[
j].par[0]/
tan(simtrks[
j].par[1]);
989 std::cout << setw(3) <<
j << setw(8) << simtrks[
j].pdg
990 << setw(8) << setprecision(4) <<
" (" << simtrks[
j].xvtx <<
"," << simtrks[
j].yvtx <<
"," << simtrks[
j].zvtx <<
")"
992 <<
" phi=" << simtrks[
j].par[2]
993 <<
" eta= " << -
log(
tan(0.5*(
M_PI/2-simtrks[
j].par[1])))
1012 double dqoverp =
a(0)-
b(0);
1013 double dlambda =
a(1)-
b(1);
1014 double dphi =
a(2)-
b(2);
1015 double dsz =
a(4)-
b(4);
1016 if (dphi>
M_PI){ dphi-=M_2_PI; }
else if(dphi<-
M_PI){dphi+=M_2_PI;}
1018 return ( (fabs(dqoverp)<0.2) && (fabs(dlambda)<0.02) && (fabs(dphi)<0.04) && (fabs(dsz)<1.0) );
1028 double ctau=(
pdt_->particle(
abs(p->pdg_id()) ))->lifetime();
1030 return ctau >0 && ctau <1
e-6;
1034 return ( !p->end_vertex() && p->status()==1 );
1041 return part->charge()!=0;
1044 return pdt_->particle( -p->pdg_id() )!=0;
1052 Fill(h,
"rapidity_"+ttype,t.
eta());
1053 Fill(h,
"z0_"+ttype,t.
vz());
1056 Fill(h,
"pt_"+ttype,t.
pt());
1065 Fill(h,
"logtresxy_"+ttype,
log(d0Error/0.0001)/
log(10.));
1066 Fill(h,
"tpullxy_"+ttype,d0/d0Error);
1071 Fill(h,
"logtresz_"+ttype,
log(dzError/0.0001)/
log(10.));
1079 if((! (v==
NULL)) && (v->
ndof()>10.)) {
1097 double D0=x1*
sin(t.
phi())-y1*
cos(t.
phi())-0.5*kappa*(x1*x1+y1*y1);
1098 double q=
sqrt(1.-2.*kappa*D0);
1101 if (fabs(kappa*s0)>0.001){
1119 Fill(h,
"trackAlgo_" + ttype, t.
algo());
1123 int longesthit=0, nbarrel=0;
1125 if ((**hit).isValid() && (**hit).geographicalId().det() ==
DetId::Tracker ){
1133 if (clust->sizeY()-longesthit>0) longesthit=clust->sizeY();
1134 if (clust->sizeY()>20.){
1135 Fill(h,
"lvseta_"+ttype,t.
eta(), 19.9);
1138 Fill(h,
"lvseta_"+ttype,t.
eta(), float(clust->sizeY()));
1139 Fill(h,
"lvstanlambda_"+ttype,
tan(t.
lambda()),
float(clust->sizeY()));
1145 Fill(h,
"nbarrelhits_"+ttype,
float(nbarrel));
1152 int longesthit=0, nbarrel=0;
1153 cout << Form(
"%5.2f %5.2f : ",t.
pt(),t.
eta());
1155 if ((**hit).isValid() && (**hit).geographicalId().det() ==
DetId::Tracker ){
1163 cout << Form(
"%4d",clust->sizeY());
1164 if (clust->sizeY()-longesthit>0) longesthit=clust->sizeY();
1174 std::cout << std::endl << title << std::endl;
1175 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
1176 v!=recVtxs->end(); ++
v){
1177 string vtype=
" recvtx ";
1180 }
else if (
v->ndof()==-5){
1182 }
else if(
v->ndof()==-3){
1185 std::cout <<
"vtx "<< std::setw(3) << std::setfill(
' ')<<ivtx++
1187 <<
" #trk " << std::fixed << std::setprecision(4) << std::setw(3) <<
v->tracksSize()
1188 <<
" chi2 " << std::fixed << std::setw(4) << std::setprecision(1) <<
v->chi2()
1189 <<
" ndof " << std::fixed << std::setw(5) << std::setprecision(2) <<
v->ndof()
1190 <<
" x " << std::setw(8) <<std::fixed << std::setprecision(4) <<
v->x()
1191 <<
" dx " << std::setw(8) <<
v->xError()
1192 <<
" y " << std::setw(8) <<
v->y()
1193 <<
" dy " << std::setw(8) <<
v->yError()
1194 <<
" z " << std::setw(8) <<
v->z()
1195 <<
" dz " << std::setw(8) <<
v->zError()
1203 for(SimVertexContainer::const_iterator vsim=simVtxs->begin();
1204 vsim!=simVtxs->end(); ++vsim){
1205 if ( vsim->position().x()*vsim->position().x()+vsim->position().y()*vsim->position().y() < 1.){
1206 std::cout << i++ <<
")" << std::scientific
1207 <<
" evtid=" << vsim->eventId().event() <<
"," << vsim->eventId().bunchCrossing()
1208 <<
" sim x=" << vsim->position().x()*
simUnit_
1209 <<
" sim y=" << vsim->position().y()*
simUnit_
1210 <<
" sim z=" << vsim->position().z()*
simUnit_
1211 <<
" sim t=" << vsim->position().t()
1212 <<
" parent=" << vsim->parentIndex()
1220 std::cout <<
" simTrks type, (momentum), vertIndex, genpartIndex" << std::endl;
1222 for(SimTrackContainer::const_iterator
t=simTrks->begin();
1223 t!=simTrks->end(); ++
t){
1226 <<
t->eventId().event() <<
"," <<
t->eventId().bunchCrossing()
1229 << (*t).genpartIndex();
1242 cout <<
"printRecTrks" << endl;
1244 for(reco::TrackCollection::const_iterator
t=recTrks->begin();
t!=recTrks->end(); ++
t){
1248 cout <<
"Track "<<i <<
" " ; i++;
1265 cout << Form(
"pt=%8.3f phi=%6.3f eta=%6.3f z=%8.4f dz=%6.4f, ipsig=%6.1f",
t->pt(),
t->phi(),
t->eta(),
t->vz(),
t->dzError(),ipsig) << endl;
1268 cout << Form(
" found=%6d lost=%6d chi2/ndof=%10.3f ",
t->found(),
t->lost(),
t->normalizedChi2())<<endl;
1271 cout <<
"subdet layers valid lost" << endl;
1272 cout << Form(
" barrel %2d %2d %2d",
1273 p.pixelBarrelLayersWithMeasurement(),
1274 p.numberOfValidPixelBarrelHits(),
1275 p.numberOfLostPixelBarrelHits(HitPattern::TRACK_HITS))
1278 cout << Form(
" fwd %2d %2d %2d",
1279 p.pixelEndcapLayersWithMeasurement(),
1280 p.numberOfValidPixelEndcapHits(),
1281 p.numberOfLostPixelEndcapHits(HitPattern::TRACK_HITS))
1283 cout << Form(
" pixel %2d %2d %2d",
1284 p.pixelLayersWithMeasurement(),
1285 p.numberOfValidPixelHits(),
1286 p.numberOfLostPixelHits(HitPattern::TRACK_HITS))
1288 cout << Form(
" tracker %2d %2d %2d",
1289 p.trackerLayersWithMeasurement(),
1290 p.numberOfValidTrackerHits(),
1291 p.numberOfLostTrackerHits(HitPattern::TRACK_HITS))
1300 if ((**hit).isValid() && (**hit).geographicalId().det() ==
DetId::Tracker ){
1307 cout << Form(
" barrel cluster size=%2d charge=%6.1f wx=%2d wy=%2d, expected=%3.1f",clust->size(),clust->charge(),clust->sizeX(),clust->sizeY(),1.+2./fabs(
tan(
t->theta()))) << endl;
1313 cout << Form(
" endcap cluster size=%2d charge=%6.1f wx=%2d wy=%2d",clust->size(),clust->charge(),clust->sizeX(),clust->sizeY()) << endl;
1319 cout <<
"hitpattern" << endl;
1320 for(
int i = 0; i < p.numberOfHits(HitPattern::TRACK_HITS); i++){
1321 p.printHitPattern(HitPattern::TRACK_HITS, i,
std::cout);
1324 cout <<
"expected inner " << p.numberOfHits(HitPattern::MISSING_INNER_HITS) << endl;
1325 for(
int i = 0; i < p.numberOfHits(HitPattern::MISSING_INNER_HITS); i++){
1326 p.printHitPattern(HitPattern::MISSING_INNER_HITS, i,
std::cout);
1329 cout <<
"expected outer " << p.numberOfHits(HitPattern::MISSING_OUTER_HITS) << endl;
1330 for(
int i = 0; i < p.numberOfHits(HitPattern::MISSING_OUTER_HITS); i++){
1331 p.printHitPattern(HitPattern::MISSING_OUTER_HITS, i,
std::cout);
1351 std::vector<SimPart>& tsim,
1352 std::vector<SimEvent>& simEvt,
1356 vector<TransientTrack> selTrks;
1357 for(reco::TrackCollection::const_iterator
t=recTrks->begin();
1358 t!=recTrks->end(); ++
t){
1360 if( (!selectedOnly) || (selectedOnly &&
theTrackFilter(tt))){ selTrks.push_back(tt); }
1362 if (selTrks.size()==0)
return;
1363 stable_sort(selTrks.begin(), selTrks.end(), recTrackLessZ);
1368 for(
unsigned int i=0;
i<selTrks.size();
i++){ selRecTrks.push_back(selTrks[
i].track());}
1369 std::vector<int> rectosim=
supf(tsim, selRecTrks);
1374 cout <<
"printPVTrks" << endl;
1375 cout <<
"---- z +/- dz 1bet-m ip +/-dip pt phi eta";
1376 if((tsim.size()>0)||(simEvt.size()>0)) {
cout <<
" type pdg zvtx zdca dca zvtx zdca dsz";}
1381 for(
unsigned int i=0;
i<selTrks.size();
i++){
1383 cout << setw (3)<< isel;
1393 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
1394 v!=recVtxs->end(); ++
v){
1395 if ( (
v->ndof()<-1) || (
v->chi2()<=0) )
continue;
1396 for(
trackit_t tv=
v->tracks_begin(); tv!=
v->tracks_end(); tv++){
1398 if(selTrks[i].track().vz()==RTv.
vz()) {vmatch=iv;}
1403 double tz=(selTrks[
i].stateAtBeamLine().trackStateAtPCA()).
position().z();
1404 double tantheta=
tan((selTrks[i].stateAtBeamLine().trackStateAtPCA()).momentum().
theta());
1405 double tdz0= selTrks[
i].track().dzError();
1409 cout <<
"["<<setw(2)<<vmatch<<
"]";
1416 if(status&0x1){
cout <<
"i";}
else{
cout <<
".";};
1417 if(status&0x2){
cout <<
"c";}
else{
cout <<
".";};
1418 if(status&0x4){
cout <<
"h";}
else{
cout <<
".";};
1419 if(status&0x8){
cout <<
"q";}
else{
cout <<
".";};
1422 cout << setw (8) << fixed << setprecision(4)<< tz <<
" +/-" << setw (6)<<
sqrt(tdz2);
1427 if(selTrks[i].track().hitPattern().hasValidHitInFirstPixelBarrel()){
cout <<
"+"; }
else {
cout <<
"-"; }
1428 cout << setw(1) << selTrks[
i].track().hitPattern().pixelBarrelLayersWithMeasurement();
1429 cout << setw(1) << selTrks[
i].track().hitPattern().pixelEndcapLayersWithMeasurement();
1430 cout << setw(1) << hex << selTrks[
i].track().hitPattern().trackerLayersWithMeasurement()
1431 - selTrks[
i].track().hitPattern().pixelLayersWithMeasurement() << dec;
1432 cout <<
"-" << setw(1) << hex << selTrks[
i].track().hitPattern().numberOfHits(HitPattern::MISSING_OUTER_HITS) << dec;
1436 cout << setw (8) << IP.
value() <<
"+/-" << setw (6) << IP.
error();
1437 if(selTrks[i].track().ptError()<1){
1438 cout <<
" " << setw(8) << setprecision(2) << selTrks[
i].track().pt()*selTrks[
i].track().charge();
1440 cout <<
" " << setw(7) << setprecision(1) << selTrks[
i].track().pt()*selTrks[
i].track().charge() <<
"*";
1443 cout <<
" " << setw(5) << setprecision(2) << selTrks[
i].track().phi()
1444 <<
" " << setw(5) << setprecision(2) << selTrks[
i].track().eta() ;
1449 if(simEvt.size()>0){
1456 double vz=parentVertex->
position().z();
1457 cout <<
" " << tpr->eventId().event();
1458 cout <<
" " << setw(5) << tpr->pdgId();
1459 cout <<
" " << setw(8) << setprecision(4) << vz;
1461 cout <<
" not matched";
1466 if(tsim[rectosim[i]].
type==0){
cout <<
" prim " ;}
else{
cout <<
" sec ";}
1467 cout <<
" " << setw(5) << tsim[rectosim[
i]].pdg;
1468 cout <<
" " << setw(8) << setprecision(4) << tsim[rectosim[
i]].zvtx;
1469 cout <<
" " << setw(8) << setprecision(4) << tsim[rectosim[
i]].zdcap;
1470 cout <<
" " << setw(8) << setprecision(4) << tsim[rectosim[
i]].ddcap;
1471 double zvtxpull=(tz-tsim[rectosim[
i]].zvtx)/
sqrt(tdz2);
1472 cout << setw(6) << setprecision(1) << zvtxpull;
1473 double zdcapull=(tz-tsim[rectosim[
i]].zdcap)/tdz0;
1474 cout << setw(6) << setprecision(1) << zdcapull;
1475 double dszpull=(selTrks[
i].track().dsz()-tsim[rectosim[
i]].par[4])/selTrks[i].track().dszError();
1476 cout << setw(6) << setprecision(1) << dszpull;
1485 const std::vector<SimPart > & tsim,
1491 std::cout <<
"dump rec tracks: " << std::endl;
1493 for(reco::TrackCollection::const_iterator
t=recTrks->begin();
1494 t!=recTrks->end(); ++
t){
1496 std::cout << irec++ <<
") " << p << std::endl;
1499 std::cout <<
"match sim tracks: " << std::endl;
1503 for(std::vector<SimPart>::const_iterator
s=tsim.begin();
1504 s!=tsim.end(); ++
s){
1508 for(reco::TrackCollection::const_iterator
t=recTrks->begin();
1509 t!=recTrks->end(); ++
t){
1511 if (
match(
s->par,p)){ imatch=irec; }
1517 std::cout <<
" matched to rec trk" << imatch << std::endl;
1519 std::cout <<
" not matched" << std::endl;
1531 double & Tc,
double & chsq,
double & dzmax,
double & dztrim,
double & m4m2){
1532 if (tracks.size()<2){ Tc=-1; chsq=-1; dzmax=-1; dztrim=-1; m4m2=-1;
return;}
1534 double sumw=0, sumwz=0, sumww=0,sumwwz=0,sumwwzz=0;
1535 double zmin=1e10, zmin1=1e10, zmax1=-1e10,
zmax=-1e10;
1536 double m4=0,m3=0,m2=0,m1=0,m0=0;
1537 for(vector<reco::TransientTrack>::const_iterator it=tracks.begin(); it!=tracks.end(); it++){
1538 double tantheta=
tan(((*it).stateAtBeamLine().trackStateAtPCA()).momentum().theta());
1540 double z=((*it).stateAtBeamLine().trackStateAtPCA()).
position().z();
1541 double dz2=
pow((*it).track().dzError(),2)+
pow(beamspot.BeamWidthX()/tantheta,2);
1555 if(z<zmin1){zmin1=
z;}
if(z<zmin){zmin1=
zmin; zmin=
z;}
1556 if(z>zmax1){zmax1=
z;}
if(z>zmax){zmax1=
zmax; zmax=
z;}
1559 double z=sumwz/sumw;
1560 double a=sumwwzz-2*z*sumwwz+z*z*sumww;
1562 if(tracks.size()>1){
1563 chsq=(m2-m0*z*
z)/(tracks.size()-1);
1565 m4m2=
sqrt((m4-4*m3*z+6*m2*z*z-3*m1*z*z*z+m0*z*z*z*z)/(m2-2*m1*z+z*z*m0));
1590 std::vector<std::pair<TrackingParticleRef, double> > tp =
r2s_[track];
1591 for (std::vector<std::pair<TrackingParticleRef, double> >::const_iterator it = tp.begin();
1592 it != tp.end(); ++it) {
1617 std::vector< edm::RefToBase<reco::Track> >
b;
1643 const View<Track> tC = *(trackCollectionH.product());
1646 vector<SimEvent> simEvt;
1647 map<EncodedEventId, unsigned int> eventIdToEventMap;
1648 map<EncodedEventId, unsigned int>::iterator id;
1650 for(TrackingParticleCollection::const_iterator it=simTracks->begin(); it!=simTracks->end(); it++){
1652 if( fabs(it->parentVertex().get()->position().z())>100.)
continue;
1654 unsigned int event=0;
1655 id=eventIdToEventMap.find(it->eventId());
1656 if (
id==eventIdToEventMap.end()){
1661 event=simEvt.size();
1664 cout <<
"getSimEvents: ";
1665 cout << it->eventId().bunchCrossing() <<
"," << it->eventId().event()
1666 <<
" z="<< it->vz() <<
" "
1668 <<
" z=" << parentVertex->
position().z() << endl;
1670 if (it->eventId()==parentVertex->
eventId()){
1679 e.
x=0; e.
y=0; e.
z=-88.;
1681 simEvt.push_back(e);
1688 simEvt[
event].tp.push_back(&(*it));
1689 if( (
abs(it->eta())<2.5) && (it->charge()!=0) ){
1690 simEvt[
event].sumpt2+=
pow(it->pt(),2);
1691 simEvt[
event].sumpt+=it->pt();
1696 for(TrackingParticleCollection::const_iterator it=simTracks->begin(); it!=simTracks->end(); it++){
1705 if( truthMatchedTrack(track,tpr)){
1707 if( eventIdToEventMap.find(tpr->eventId())==eventIdToEventMap.end() ){
cout <<
"Bug in getSimEvents" << endl;
break; }
1709 z2tp_[track.
get()->
vz()]=tpr;
1711 unsigned int event=eventIdToEventMap[tpr->eventId()];
1712 double ipsig=0,ipdist=0;
1714 double vx=parentVertex->
position().x();
1715 double vy=parentVertex->
position().y();
1716 double vz=parentVertex->
position().z();
1719 double dxy=track->
dxy(vertexBeamSpot_.position());
1725 if (theTrackFilter(t)){
1726 simEvt[
event].tk.push_back(t);
1727 if(ipdist<5){simEvt[
event].tkprim.push_back(t);}
1728 if(ipsig<5){simEvt[
event].tkprimsel.push_back(t);}
1737 cout <<
"SimEvents " << simEvt.size() << endl;
1738 for(
unsigned int i=0;
i<simEvt.size();
i++){
1740 if(simEvt[
i].tkprim.size()>0){
1742 getTc(simEvt[
i].tkprimsel, simEvt[
i].Tc, simEvt[
i].chisq, simEvt[
i].dzmax, simEvt[
i].dztrim, simEvt[
i].m4m2);
1754 cout <<
i <<
" ) nTP=" << simEvt[
i].tp.size()
1755 <<
" z=" << simEvt[
i].z
1756 <<
" recTrks=" << simEvt[
i].tk.size()
1757 <<
" recTrksPrim=" << simEvt[
i].tkprim.size()
1758 <<
" zfit=" << simEvt[
i].zfit
1772 std::vector<PrimaryVertexAnalyzer4PU::simPrimaryVertex> simpv;
1773 const HepMC::GenEvent* evt=evtMC->GetEvent();
1782 for(HepMC::GenEvent::vertex_const_iterator vitr= evt->vertices_begin();
1783 vitr != evt->vertices_end(); ++vitr )
1786 HepMC::FourVector pos = (*vitr)->position();
1789 if (fabs(pos.z())>1000)
continue;
1791 bool hasMotherVertex=
false;
1793 for ( HepMC::GenVertex::particle_iterator
1797 HepMC::GenVertex * mv=(*mother)->production_vertex();
1798 if (mv) {hasMotherVertex=
true;}
1801 if(hasMotherVertex) {
continue;}
1805 const double mm=0.1;
1808 for(std::vector<simPrimaryVertex>::iterator v0=simpv.begin();
1809 v0!=simpv.end(); v0++){
1810 if( (fabs(sv.x-v0->x)<1
e-5) && (fabs(sv.y-v0->y)<1
e-5) && (fabs(sv.z-v0->z)<1
e-5)){
1818 simpv.push_back(sv);
1826 vp->genVertex.push_back((*vitr)->barcode());
1830 for ( HepMC::GenVertex::particle_iterator
1831 daughter = (*vitr)->particles_begin(HepMC::descendants);
1832 daughter != (*vitr)->particles_end(HepMC::descendants);
1836 if (
find(vp->finalstateParticles.begin(), vp->finalstateParticles.end(),(*daughter)->barcode())
1837 == vp->finalstateParticles.end()){
1838 vp->finalstateParticles.push_back((*daughter)->barcode());
1839 HepMC::FourVector
m=(*daughter)->momentum();
1841 vp->ptot.setPx(vp->ptot.px()+m.px());
1842 vp->ptot.setPy(vp->ptot.py()+m.py());
1843 vp->ptot.setPz(vp->ptot.pz()+m.pz());
1844 vp->ptot.setE(vp->ptot.e()+m.e());
1845 vp->ptsq+=(m.perp())*(m.perp());
1847 if ( (m.perp()>0.2) && (fabs(m.pseudoRapidity())<2.5) &&
isCharged( *daughter ) ){
1851 hsimPV[
"rapidity"]->Fill(m.pseudoRapidity());
1852 if( (m.perp()>0.8) &&
isCharged( *daughter ) ){
1853 hsimPV[
"chRapidity"]->Fill(m.pseudoRapidity());
1855 hsimPV[
"pt"]->Fill(m.perp());
1865 cout <<
"------- PrimaryVertexAnalyzer4PU simPVs -------" << endl;
1866 for(std::vector<simPrimaryVertex>::iterator v0=simpv.begin();
1867 v0!=simpv.end(); v0++){
1868 cout <<
"z=" << v0->z
1869 <<
" px=" << v0->ptot.px()
1870 <<
" py=" << v0->ptot.py()
1871 <<
" pz=" << v0->ptot.pz()
1872 <<
" pt2="<< v0->ptsq
1875 cout <<
"-----------------------------------------------" << endl;
1885 double sepL_min = 50.;
1888 for(
unsigned sv_idx=0; sv_idx<simpv.size(); ++sv_idx){
1890 float comp_z = simpv[sv_idx];
1891 double dist_z = fabs(comp_z - in_z);
1893 if ( dist_z==0. )
continue;
1895 if ( dist_z<sepL_min ) sepL_min = dist_z;
1909 double in_z = inEv.
z;
1913 double sepL_min = 50.;
1916 for(
unsigned se_idx=0; se_idx<simEv.size(); ++se_idx){
1921 if ( comp_ev.
event()==lastEvent )
continue;
1922 lastEvent = comp_ev.
event();
1924 float comp_z = compEv.
z;
1928 double dist_z = fabs(comp_z - in_z);
1930 if ( dist_z<sepL_min ) sepL_min = dist_z;
1944 vector<int>* matchs =
new vector<int>();
1946 for(
unsigned vtx_idx=0; vtx_idx<vCH->size(); ++vtx_idx){
1950 double comp_z = comp_vtxref->z();
1951 double comp_z_err = comp_vtxref->zError();
1953 double z_dist = comp_z - in_z;
1954 double z_rel = z_dist / comp_z_err;
1956 if ( fabs(z_rel)<zmatch_ ) {
1957 matchs->push_back(vtx_idx);
1973 std::vector<PrimaryVertexAnalyzer4PU::simPrimaryVertex> simpv;
1976 if(
DEBUG_){
std::cout <<
"getSimPVs TrackingVertexCollection " << std::endl;}
1978 for (TrackingVertexCollection::const_iterator
v = tVC ->
begin();
v != tVC ->
end(); ++
v) {
1981 std::cout << (
v->eventId()).
event() <<
v ->
position() <<
v->g4Vertices().size() <<
" " <<
v->genVertices().size() <<
" t=" <<
v->position().t()*1.e12 <<
" ==0:" <<(
v->position().t()>0) << std::endl;
1989 if ((
unsigned int)
v->eventId().event()<simpv.size())
continue;
1991 if (fabs(
v->position().z())>1000)
continue;
1994 const double mm=1.0;
2002 sv.eventId=(**iTrack).eventId();
2006 for(std::vector<simPrimaryVertex>::iterator v0=simpv.begin();
2007 v0!=simpv.end(); v0++){
2008 if( (sv.eventId==v0->eventId) && (fabs(sv.x-v0->x)<1
e-5) && (fabs(sv.y-v0->y)<1
e-5) && (fabs(sv.z-v0->z)<1
e-5)){
2015 if(
DEBUG_){
std::cout <<
"this is a new vertex " << sv.eventId.event() <<
" " << sv.x <<
" " << sv.y <<
" " << sv.z <<std::endl;}
2016 simpv.push_back(sv);
2019 if(
DEBUG_){
std::cout <<
"this is not a new vertex" << sv.x <<
" " << sv.y <<
" " << sv.z <<std::endl;}
2026 std::cout <<
" Daughter momentum: " << (*(*iTP)).momentum();
2033 cout <<
"------- PrimaryVertexAnalyzer4PU simPVs from TrackingVertices -------" << endl;
2034 for(std::vector<simPrimaryVertex>::iterator v0=simpv.begin();
2035 v0!=simpv.end(); v0++){
2036 cout <<
"z=" << v0->z <<
" event=" << v0->eventId.event() << endl;
2038 cout <<
"-----------------------------------------------" << endl;
2053 std::vector<simPrimaryVertex> simpv;
2054 std::vector<float> pui_z;
2055 std::vector<SimPart> tsim;
2069 <<
"PrimaryVertexAnalyzer4PU::analyze event counter=" <<
eventcounter_
2080 std::cout <<
"Some problem occurred with the particle data table. This may not work !" <<std::endl;
2090 for (
unsigned int puinfo_ite=0;puinfo_ite<(*puinfoH).size();++puinfo_ite){
2091 if ((*puinfoH)[puinfo_ite].getBunchCrossing()==0){
2092 puinfo=(*puinfoH)[puinfo_ite];
2117 int nhighpurity=0, ntot=0;
2118 for(reco::TrackCollection::const_iterator
t=recTrks->begin();
t!=recTrks->end(); ++
t){
2122 if(ntot>10)
hnoBS[
"highpurityTrackFraction"]->Fill(
float(nhighpurity)/
float(ntot));
2124 if(
verbose_){
cout <<
"rejected, " << nhighpurity <<
" highpurity out of " << ntot <<
" total tracks "<< endl<< endl;}
2139 cout <<
" beamspot not found, using dummy " << endl;
2145 if((recVtxs->begin()->
isValid())&&(recVtxs->begin()->ndof()>1)&&(recVtxs->begin()->ndof()>(0.0*recVtxs->begin()->tracksSize()))){
2150 cout << Form(
"XBS %10d %5d %10d %4d %lu %5.2f %8f %8f %8f %8f %8f %8f",
2152 (
unsigned long)(recVtxs->begin()->tracksSize()), recVtxs->begin()->ndof(),
2153 recVtxs->begin()->x(), recVtxs->begin()->xError(),
2154 recVtxs->begin()->y(), recVtxs->begin()->yError(),
2155 recVtxs->begin()->z(), recVtxs->begin()->zError()
2187 vector<SimEvent> simEvt;
2188 if (gotTP && gotTV ){
2195 simEvt=
getSimEvents(TPCollectionH, TVCollectionH, trackCollectionH);
2197 if (simEvt.size()==0){
2198 cout <<
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
2199 cout <<
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
2200 cout <<
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
2201 cout <<
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
2202 cout <<
" !!!!!!!!!!!!!!!!!!!!!! got TrackingParticles but no simEvt !!!!!!!!!!!!!!!!!" << endl;
2203 cout <<
" dumping Tracking particles " << endl;
2205 for(TrackingParticleCollection::const_iterator it=simTracks->begin(); it!=simTracks->end(); it++){
2206 cout << *it << endl;
2208 cout <<
" dumping Tracking Vertices " << endl;
2210 for(TrackingVertexCollection::const_iterator iv=tpVtxs->begin(); iv!=tpVtxs->end(); iv++){
2211 cout << *iv << endl;
2214 cout <<
"dumping simTracks" << endl;
2215 for(SimTrackContainer::const_iterator
t=simTrks->begin();
t!=simTrks->end(); ++
t){
2218 cout <<
"dumping simVertexes" << endl;
2219 for(SimVertexContainer::const_iterator vv=simVtxs->begin();
2222 cout << *vv << endl;
2225 cout <<
"no hepMC" << endl;
2227 cout <<
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
2229 const HepMC::GenEvent* evt=evtMC->GetEvent();
2231 std::cout <<
"process id " <<evt->signal_process_id()<<std::endl;
2232 std::cout <<
"signal process vertex "<< ( evt->signal_process_vertex() ?
2233 evt->signal_process_vertex()->barcode() : 0 ) <<std::endl;
2234 std::cout <<
"number of vertices " << evt->vertices_size() << std::endl;
2237 cout <<
"no event in HepMC" << endl;
2239 cout <<
" !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
2250 cout <<
"Found Tracking Vertices " << endl;
2260 cout <<
"Using HepMCProduct " << endl;
2261 std::cout <<
"simtrks " << simTrks->size() << std::endl;
2273 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
2274 v!=recVtxs->end(); ++
v){
2275 if ((
v->ndof()==-3) && (
v->chi2()==0) ){
2283 hsimPV[
"nsimvtx"]->Fill(simpv.size());
2284 for(std::vector<simPrimaryVertex>::iterator vsim=simpv.begin();
2285 vsim!=simpv.end(); vsim++){
2290 hsimPV[
"nbsimtksinvtx"]->Fill(vsim->nGenTrk);
2338 cout << endl <<
"Event dump" << endl
2349 if (bnoBS) {
printRecVtxs(recVtxs,
"Offline without Beamspot");}
2350 if (bnoBS && (!bDA)){
printPVTrks(recTrks, recVtxs, tsim, simEvt,
false);}
2351 if (bBS)
printRecVtxs(recVtxsBS,
"Offline with Beamspot");
2354 printPVTrks(recTrks, recVtxsDA, tsim, simEvt,
false);
2365 bool lt(
const std::pair<double,unsigned int>&
a,
const std::pair<double,unsigned int>&
b ){
2366 return a.first<b.first;
2374 vector<SimEvent> & simEvt,
2377 if (simEvt.size()==0){
return;}
2382 vector< pair<double,unsigned int> > zrecv;
2383 for(
unsigned int idx=0;
idx<recVtxs->size();
idx++){
2384 if ( (recVtxs->at(
idx).ndof()<0) || (recVtxs->at(
idx).chi2()<=0) )
continue;
2385 zrecv.push_back( make_pair(recVtxs->at(
idx).z(),
idx) );
2387 stable_sort(zrecv.begin(),zrecv.end(),
lt);
2390 vector< pair<double,unsigned int> > zsimv;
2391 for(
unsigned int idx=0;
idx<simEvt.size();
idx++){
2392 zsimv.push_back(make_pair(simEvt[
idx].
z,
idx));
2394 stable_sort(zsimv.begin(), zsimv.end(),
lt);
2399 cout <<
"---------------------------" << endl;
2401 cout <<
"---------------------------" << endl;
2402 cout <<
" z[cm] rec --> ";
2404 for(vector< pair<double,unsigned int> >::iterator itrec=zrecv.begin(); itrec!=zrecv.end(); itrec++){
2405 cout << setw(7) << fixed << itrec->first;
2406 if (itrec->second==0){
cout <<
"*" ;}
else{
cout <<
" " ;}
2410 for(vector< pair<double,unsigned int> >::iterator itrec=zrecv.begin(); itrec!=zrecv.end(); itrec++){
2411 cout << setw(7) << fixed << recVtxs->at(itrec->second).tracksSize();
2412 if (itrec->second==0){
cout <<
"*" ;}
else{
cout <<
" " ;}
2414 cout <<
" rec tracks" << endl;
2416 map<unsigned int, int> truthMatchedVertexTracks;
2417 for(vector< pair<double,unsigned int> >::iterator itrec=zrecv.begin(); itrec!=zrecv.end(); itrec++){
2419 cout << setw(7) << fixed << truthMatchedVertexTracks[itrec->second];
2420 if (itrec->second==0){
cout <<
"*" ;}
else{
cout <<
" " ;}
2422 cout <<
" truth matched " << endl;
2424 cout <<
"sim ------- trk prim ----" << endl;
2428 map<unsigned int, unsigned int> rvmatch;
2429 map<unsigned int, double > nmatch;
2430 map<unsigned int, double > purity;
2431 map<unsigned int, double > wpurity;
2433 for(vector< pair<double,unsigned int> >::iterator itrec=zrecv.begin(); itrec!=zrecv.end(); itrec++){
2434 purity[itrec->second]=0.;
2435 wpurity[itrec->second]=0.;
2438 for(vector< pair<double,unsigned int> >::iterator itsim=zsimv.begin(); itsim!=zsimv.end(); itsim++){
2439 SimEvent* ev =&(simEvt[itsim->second]);
2443 if (itsim->second==0){
2444 cout << setw(8) << fixed << ev->
z <<
")*" << setw(5) << ev->
tk.size() << setw(5) << ev->
tkprim.size() <<
" | ";
2446 cout << setw(8) << fixed << ev->
z <<
") " << setw(5) << ev->
tk.size() << setw(5) << ev->
tkprim.size() <<
" | ";
2449 nmatch[itsim->second]=0;
2450 double matchpurity=0,matchwpurity=0;
2452 for(vector< pair<double,unsigned int> >::iterator itrec=zrecv.begin(); itrec!=zrecv.end(); itrec++){
2457 for(vector<TransientTrack>::iterator te=ev->
tk.begin(); te!=ev->
tk.end(); te++){
2464 cout << setw(7) << int(n)<<
" ";
2466 if (n > nmatch[itsim->second]){
2467 nmatch[itsim->second]=
n;
2468 rvmatch[itsim->second]=itrec->second;
2469 matchpurity=n/truthMatchedVertexTracks[itrec->second];
2470 matchwpurity=wt/truthMatchedVertexTracks[itrec->second];
2473 if(n > purity[itrec->second]){
2474 purity[itrec->second]=
n;
2477 if(wt > wpurity[itrec->second]){
2478 wpurity[itrec->second]=wt;
2484 if (nmatch[itsim->second]>0 ){
2485 if(matchpurity>0.5){
2490 cout <<
" max eff. = " << setw(8) << nmatch[itsim->second]/ev->
tk.size() <<
" p=" << matchpurity <<
" w=" << matchwpurity << endl;
2492 if(ev->
tk.size()==0){
2493 cout <<
" invisible" << endl;
2494 }
else if (ev->
tk.size()==1){
2495 cout <<
"single track " << endl;
2497 cout <<
"lost " << endl;
2501 cout <<
"---------------------------" << endl;
2505 for(vector< pair<double,unsigned int> >::iterator itrec=zrecv.begin(); itrec!=zrecv.end(); itrec++){
2506 cout << setw(7) << fixed << purity[itrec->second]/truthMatchedVertexTracks[itrec->second];
2507 if (itrec->second==0){
cout <<
"*" ;}
else{
cout <<
" " ;}
2518 cout <<
"---------------------------" << endl;
2524 for(vector< pair<double,unsigned int> >::iterator itsim=zsimv.begin(); itsim!=zsimv.end(); itsim++){
2525 SimEvent* ev =&(simEvt[itsim->second]);
2527 for(vector<TransientTrack>::iterator te=ev->
tk.begin(); te!=ev->
tk.end(); te++){
2532 for(vector< pair<double,unsigned int> >::iterator itrec=zrecv.begin(); itrec!=zrecv.end(); itrec++){
2537 if(RTe.
vz()==RTv.
vz()) {ivassign=itrec->second;}
2540 double tantheta=
tan((te->stateAtBeamLine().trackStateAtPCA()).momentum().theta());
2543 double dz2=
pow(RTe.
dzError(),2)+
pow(beamspot.BeamWidthX()/tantheta,2);
2545 if(ivassign==(
int)rvmatch[itsim->second]){
2546 Fill(h,
"correctlyassigned",RTe.
eta(),RTe.
pt());
2547 Fill(h,
"ptcat",RTe.
pt());
2552 Fill(h,
"misassigned",RTe.
eta(),RTe.
pt());
2553 Fill(h,
"ptmis",RTe.
pt());
2557 cout <<
"vertex " << setw(8) << fixed << ev->
z;
2560 cout <<
" track lost ";
2564 cout <<
" track misassigned " << setw(8) << fixed << recVtxs->at(ivassign).z();
2567 cout <<
" track z=" << setw(8) << fixed << RTe.
vz() <<
"+/-" << RTe.
dzError() <<
" pt=" << setw(8) << fixed<< RTe.
pt() <<
" eta=" << setw(8) << fixed << RTe.
eta()<<
" sel=" <<
theTrackFilter(*te);
2572 double zparent=tpr->parentVertex().
get()->position().z();
2573 if(zparent==ev->
z) {
2578 cout <<
" id=" << tpr->pdgId();
2587 cout <<
"---------------------------" << endl;
2599 vector<SimEvent> & simEvt,
2604 if(simEvt.size()==0)
return;
2610 Fill(h,
"npu0",simEvt.size());
2613 for(vector<SimEvent>::iterator ev=simEvt.begin(); ev!=simEvt.end(); ev++){
2614 Fill(h,
"Tc", ev->Tc, ev==simEvt.begin());
2615 Fill(h,
"Chisq", ev->chisq, ev==simEvt.begin());
2616 if(ev->chisq>0)
Fill(h,
"logChisq",
log(ev->chisq), ev==simEvt.begin());
2617 Fill(h,
"dzmax", ev->dzmax, ev==simEvt.begin());
2618 Fill(h,
"dztrim",ev->dztrim,ev==simEvt.begin());
2619 Fill(h,
"m4m2", ev->m4m2, ev==simEvt.begin());
2620 if(ev->Tc>0){
Fill(h,
"logTc",
log(ev->Tc)/
log(10.),ev==simEvt.begin());}
2623 for(vector<SimEvent>::iterator ev2=ev+1; ev2!=simEvt.end(); ev2++){
2624 vector<TransientTrack> xt;
2625 if((ev->tkprimsel.size()>0)&&(ev2->tkprimsel.size()>0)&&(ev->tkprimsel.size()+ev2->tkprimsel.size())>1){
2626 xt.insert (xt.end() ,ev->tkprimsel.begin(),ev->tkprimsel.end());
2627 xt.insert (xt.end() ,ev2->tkprimsel.begin(),ev2->tkprimsel.end());
2628 double xTc,xChsq,xDzmax,xDztrim,xm4m2;
2629 getTc(xt, xTc, xChsq, xDzmax, xDztrim,xm4m2);
2631 Fill(h,
"xTc",xTc,ev==simEvt.begin());
2632 Fill(h,
"logxTc",
log(xTc)/
log(10),ev==simEvt.begin());
2633 Fill(h,
"xChisq", xChsq,ev==simEvt.begin());
2634 if(xChsq>0){
Fill(h,
"logxChisq",
log(xChsq),ev==simEvt.begin());};
2635 Fill(h,
"xdzmax", xDzmax,ev==simEvt.begin());
2636 Fill(h,
"xdztrim", xDztrim,ev==simEvt.begin());
2637 Fill(h,
"xm4m2", xm4m2,ev==simEvt.begin());
2646 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
2647 v!=recVtxs->end(); ++
v){
2648 if ( (
v->isFake()) || (
v->ndof()<0) || (
v->chi2()<=0) )
continue;
2653 for(vector<SimEvent>::iterator ev=simEvt.begin(); ev!=simEvt.end(); ev++){
2654 ev->ntInRecVz.clear();
2657 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
2658 v!=recVtxs->end(); ++
v){
2660 for(vector<TransientTrack>::iterator te=ev->tk.begin(); te!=ev->tk.end(); te++){
2662 for(
trackit_t tv=
v->tracks_begin(); tv!=
v->tracks_end(); tv++){
2664 if(RTe.
vz()==RTv.
vz()) {n++; wt+=
v->trackWeight(*tv);}
2667 ev->ntInRecVz[
v->z()]=
n;
2668 if (n > ev->nmatch){ ev->nmatch=
n; ev->zmatch=
v->z(); ev->zmatch=
v->z(); }
2675 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
2676 v!=recVtxs->end(); ++
v){
2678 for(vector<SimEvent>::iterator ev=simEvt.begin(); ev!=simEvt.end(); ev++){
2679 if ((ev->nmatch>0)&&(ev->zmatch==
v->z())){
2683 if(!matched && !
v->isFake()) {
2685 cout <<
" fake rec vertex at z=" <<
v->z() << endl;
2687 Fill(h,
"unmatchedVtxZ",
v->z());
2688 Fill(h,
"unmatchedVtxNdof",
v->ndof());
2692 Fill(h,
"unmatchedVtx",nfake);
2693 Fill(h,
"unmatchedVtxFrac",nfake/nrecvtxs);
2697 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
2698 v!=recVtxs->end(); ++
v){
2700 if ( (
v->ndof()<0) || (
v->chi2()<=0) )
continue;
2703 bool matchFound=
false;
2706 for(vector<SimEvent>::iterator ev=simEvt.begin(); ev!=simEvt.end(); ev++){
2709 for(vector<TransientTrack>::iterator te=ev->tk.begin(); te!=ev->tk.end(); te++){
2712 for(
trackit_t tv=
v->tracks_begin(); tv!=
v->tracks_end(); tv++){
2714 if(RTe.
vz()==RTv.
vz()){ n++;}
2722 evmatch=ev->eventId;
2731 if (matchFound && (nmatchany>0)){
2735 double purity =nmatch/nmatchany;
2736 Fill(h,
"recmatchPurity",purity);
2737 if(
v==recVtxs->begin()){
2738 Fill(h,
"recmatchPurityTag",purity, (
bool)(evmatch==iSignal));
2740 Fill(h,
"recmatchPuritynoTag",purity,(
bool)(evmatch==iSignal));
2743 Fill(h,
"recmatchvtxs",nmatchvtx);
2744 if(
v==recVtxs->begin()){
2745 Fill(h,
"recmatchvtxsTag",nmatchvtx);
2747 Fill(h,
"recmatchvtxsnoTag",nmatchvtx);
2753 Fill(h,
"nrecv",nrecvtxs);
2760 vector<int> used_indizesV;
2761 int lastEvent = 999;
2763 for(vector<SimEvent>::iterator ev=simEvt.begin(); ev!=simEvt.end(); ev++){
2765 if(ev->tk.size()>0) npu1++;
2766 if(ev->tk.size()>1) npu2++;
2770 bool isSignal= ev->eventId==iSignal;
2772 Fill(h,
"nRecTrkInSimVtx",(
double) ev->tk.size(),isSignal);
2773 Fill(h,
"nPrimRecTrkInSimVtx",(
double) ev->tkprim.size(),isSignal);
2774 Fill(h,
"sumpt2rec",
sqrt(ev->sumpt2rec),isSignal);
2775 Fill(h,
"sumpt2",
sqrt(ev->sumpt2),isSignal);
2776 Fill(h,
"sumpt",
sqrt(ev->sumpt),isSignal);
2778 double nRecVWithTrk=0;
2779 double nmatch=0, ntmatch=0, zmatch=-99;
2781 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
2782 v!=recVtxs->end(); ++
v){
2783 if ( (
v->ndof()<-1) || (
v->chi2()<=0) )
continue;
2786 for(vector<TransientTrack>::iterator te=ev->tk.begin(); te!=ev->tk.end(); te++){
2788 for(
trackit_t tv=
v->tracks_begin(); tv!=
v->tracks_end(); tv++){
2790 if(RTe.
vz()==RTv.
vz()) {n++; wt+=
v->trackWeight(*tv);}
2794 if(n>0){ nRecVWithTrk++; }
2796 nmatch=
n; ntmatch=
v->tracksSize(); zmatch=
v->position().z();
2803 if(ev->tk.size()>0){
Fill(h,
"trkAssignmentEfficiency", nmatch/ev->tk.size(), isSignal); };
2804 if(ev->tkprim.size()>0){
Fill(h,
"primtrkAssignmentEfficiency", nmatch/ev->tkprim.size(), isSignal); };
2808 double ntsim=ev->tk.size();
2809 double matchpurity=nmatch/ntmatch;
2813 Fill(h,
"matchVtxFraction",nmatch/ntsim,isSignal);
2814 if(nmatch/ntsim>=0.5){
2815 Fill(h,
"matchVtxEfficiency",1.,isSignal);
2816 if(ntsim>1){
Fill(h,
"matchVtxEfficiency2",1.,isSignal);}
2817 if(matchpurity>0.5){
Fill(h,
"matchVtxEfficiency5",1.,isSignal);}
2819 Fill(h,
"matchVtxEfficiency",0.,isSignal);
2820 if(ntsim>1){
Fill(h,
"matchVtxEfficiency2",0.,isSignal);}
2821 Fill(h,
"matchVtxEfficiency5",0.,isSignal);
2823 cout <<
"Signal vertex not matched " << message <<
" event=" <<
eventcounter_ <<
" nmatch=" << nmatch <<
" ntsim=" << ntsim << endl;
2830 Fill(h,
"matchVtxZ",zmatch-ev->z);
2831 Fill(h,
"matchVtxZ",zmatch-ev->z,isSignal);
2832 Fill(h,
"matchVtxZCum",fabs(zmatch-ev->z));
2833 Fill(h,
"matchVtxZCum",fabs(zmatch-ev->z),isSignal);
2836 Fill(h,
"matchVtxZCum",1.0);
2837 Fill(h,
"matchVtxZCum",1.0,isSignal);
2840 if(fabs(zmatch-ev->z)<
zmatch_){
2841 Fill(h,
"matchVtxEfficiencyZ",1.,isSignal);
2843 Fill(h,
"matchVtxEfficiencyZ",0.,isSignal);
2846 if(ntsim>0)
Fill(h,
"matchVtxEfficiencyZ1", fabs(zmatch-ev->z)<
zmatch_ , isSignal);
2847 if(ntsim>1)
Fill(h,
"matchVtxEfficiencyZ2", fabs(zmatch-ev->z)<
zmatch_ , isSignal);
2850 Fill(h,
"vtxMultiplicity",nRecVWithTrk,isSignal);
2854 if(fabs(zmatch-ev->z)<
zmatch_){
2855 Fill(h,
"vtxFindingEfficiencyVsNtrk",(
double) ev->tk.size(),1.);
2857 Fill(h,
"vtxFindingEfficiencyVsNtrkSignal",ev->tk.size(),1.);
2859 Fill(h,
"vtxFindingEfficiencyVsNtrkPU",(
double) ev->tk.size(),1.);
2863 Fill(h,
"vtxFindingEfficiencyVsNtrk",(
double) ev->tk.size(),0.);
2865 Fill(h,
"vtxFindingEfficiencyVsNtrkSignal",(
double) ev->tk.size(),1.);
2867 Fill(h,
"vtxFindingEfficiencyVsNtrkPU",(
double) ev->tk.size(),1.);
2873 if ( ev->eventId.event()==lastEvent )
continue;
2874 lastEvent = ev->eventId.event();
2876 if ( ( fabs(ev->z)>24. ) || ( ev->eventId.bunchCrossing()!=0 ) )
continue;
2879 int best_match = 999;
2881 for (
unsigned rv_idx=0; rv_idx<recVtxs->size(); rv_idx++ ) {
2887 for ( vector<TrackBaseRef>::const_iterator rv_trk_ite=vtx_ref->tracks_begin(); rv_trk_ite!=vtx_ref->tracks_end(); rv_trk_ite++ ) {
2889 vector<pair<TrackingParticleRef, double> > tp;
2890 if ( rsC.
find(*rv_trk_ite)!=rsC.
end() ) tp = rsC[*rv_trk_ite];
2892 for (
unsigned matched_tp_idx=0; matched_tp_idx<tp.size(); matched_tp_idx++ ) {
2897 if ( ( tp_ev.
bunchCrossing()==ev->eventId.bunchCrossing() ) && ( tp_ev.
event()==ev->eventId.event() ) ) {
2907 if ( match > max_match ) {
2910 best_match = rv_idx;
2920 bool dsflag =
false;
2922 for (
unsigned i=0;
i<used_indizesV.size();
i++) {
2923 if ( used_indizesV.at(
i)==best_match ) {
2929 if ( best_match!=999 ) eff = 1.;
2930 if ( dsflag ) dsimed = 1.;
2931 if ( ( best_match!=999 ) && ( !dsflag ) ) effwod = 1.;
2933 if ( best_match!=999 ) {
2934 used_indizesV.push_back(best_match);
2937 Fill(h,
"tveffvszsep", sep, eff);
2938 Fill(h,
"tveffwodvszsep", sep, effwod);
2939 Fill(h,
"tvmergedvszsep", sep, dsimed);
2944 Fill(h,
"npu1",npu1);
2945 Fill(h,
"npu2",npu2);
2947 Fill(h,
"nrecvsnpu",npu1,
float(nrecvtxs));
2948 Fill(h,
"nrecvsnpu2",npu2,
float(nrecvtxs));
2955 for(vector<TransientTrack>::iterator te=ev->
tk.begin(); te!=ev->
tk.end(); te++){
2959 if(RTe.
vz()==RTv.
vz()) {n++;}
2963 cout <<
"Number of tracks in reco tagvtx " << v->
tracksSize() << endl;
2964 cout <<
"Number of selected tracks in sim event vtx " << ev->
tk.size() <<
" (prim=" << ev->
tkprim.size() <<
")"<<endl;
2965 cout <<
"Number of tracks in both " << n << endl;
2967 if (ntruthmatched>0){
2968 cout <<
"TrackPurity = "<< n/ntruthmatched <<endl;
2969 Fill(h,
"TagVtxTrkPurity",n/ntruthmatched);
2971 if (ev->
tk.size()>0){
2972 cout <<
"TrackEfficiency = "<< n/ev->
tk.size() <<endl;
2973 Fill(h,
"TagVtxTrkEfficiency",n/ev->
tk.size());
2989 std::vector<simPrimaryVertex> & simpv,
2990 const std::vector<float> & pui_z,
2994 int nrectrks=recTrks->size();
2995 int nrecvtxs=recVtxs->size();
3005 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
3006 v!=recVtxs->end(); ++
v){
3007 if ( (fabs(
v->ndof()+3.)<0.0001) && (
v->chi2()<=0) ){
3014 }
else if( (fabs(
v->ndof()+2.)<0.0001) && (
v->chi2()==0) ){
3016 clusters.push_back(*
v);
3017 Fill(h,
"cpuvsntrk",(
double)
v->tracksSize(),fabs(
v->y()));
3018 cpufit+=fabs(
v->y());
3019 Fill(h,
"nclutrkall",(
double)
v->tracksSize());
3020 Fill(h,
"selstat",
v->x());
3025 Fill(h,
"cpuclu",cpuclu);
3026 Fill(h,
"cpufit",cpufit);
3027 Fill(h,
"cpucluvsntrk",nrectrks, cpuclu);
3038 for(std::vector<simPrimaryVertex>::iterator vsim=simpv.begin();
3039 vsim!=simpv.end(); vsim++){
3041 nsimtrk+=vsim->nGenTrk;
3046 for(reco::VertexCollection::const_iterator vrec=recVtxs->begin(); vrec!=recVtxs->end(); ++vrec){
3048 if( vrec->isFake() ) {
3050 cout <<
"fake vertex" << endl;
3053 if( vrec->ndof()<0. )
continue;
3057 if( ((vsim->recVtx) && (fabs(vsim->recVtx->position().z()-vsim->z-dsimrecz)>fabs(vrec->z()-vsim->z-dsimrecz)))
3058 || (!vsim->recVtx) )
3060 vsim->recVtx=&(*vrec);
3063 for(
unsigned int iclu=0; iclu<clusters.size(); iclu++){
3064 if( fabs(clusters[iclu].
position().
z()-vrec->position().z()) < 0.001 ){
3066 vsim->nclutrk=clusters[iclu].position().y();
3072 if ((simpv.size()==1) && ( fabs(vsim->recVtx->position().z()-vsim->z-dsimrecz)>
zmatch_ )){
3076 Fill(h,
"fakeVtxZ",vrec->z());
3077 if (vrec->ndof()>=0.5)
Fill(h,
"fakeVtxZNdofgt05",vrec->z());
3078 if (vrec->ndof()>=2.0)
Fill(h,
"fakeVtxZNdofgt2",vrec->z());
3079 Fill(h,
"fakeVtxNdof",vrec->ndof());
3081 Fill(h,
"fakeVtxNtrk",vrec->tracksSize());
3082 if(vrec->tracksSize()==2){
Fill(h,
"fake2trkchi2vsndof",vrec->ndof(),vrec->chi2()); }
3083 if(vrec->tracksSize()==3){
Fill(h,
"fake3trkchi2vsndof",vrec->ndof(),vrec->chi2()); }
3084 if(vrec->tracksSize()==4){
Fill(h,
"fake4trkchi2vsndof",vrec->ndof(),vrec->chi2()); }
3085 if(vrec->tracksSize()==5){
Fill(h,
"fake5trkchi2vsndof",vrec->ndof(),vrec->chi2()); }
3090 Fill(h,
"nsimtrk",
float(nsimtrk));
3091 Fill(h,
"nsimtrk",
float(nsimtrk),vsim==simpv.begin());
3092 Fill(h,
"nrecsimtrk",
float(vsim->nMatchedTracks));
3093 Fill(h,
"nrecnosimtrk",
float(nsimtrk-vsim->nMatchedTracks));
3096 if (vsim->recVtx && ( fabs(vsim->recVtx->z()-vsim->z*
simUnit_)<
zmatch_ )){
3098 if(
verbose_){
std::cout <<
"primary matched " << message <<
" " << setw(8) << setprecision(4) << vsim->x <<
" " << vsim->y <<
" " << vsim->z << std:: endl;}
3099 Fill(h,
"matchedVtxNdof", vsim->recVtx->ndof());
3105 Fill(h,
"pullx", (vsim->recVtx->x()-vsim->x*
simUnit_)/vsim->recVtx->xError() );
3106 Fill(h,
"pully", (vsim->recVtx->y()-vsim->y*
simUnit_)/vsim->recVtx->yError() );
3107 Fill(h,
"pullz", (vsim->recVtx->z()-vsim->z*
simUnit_)/vsim->recVtx->zError() );
3108 Fill(h,
"resxr", vsim->recVtx->x()-vsim->x*
simUnit_-dsimrecx);
3109 Fill(h,
"resyr", vsim->recVtx->y()-vsim->y*
simUnit_-dsimrecy );
3110 Fill(h,
"reszr", vsim->recVtx->z()-vsim->z*
simUnit_-dsimrecz);
3111 Fill(h,
"pullxr", (vsim->recVtx->x()-vsim->x*
simUnit_-dsimrecx)/vsim->recVtx->xError() );
3112 Fill(h,
"pullyr", (vsim->recVtx->y()-vsim->y*
simUnit_-dsimrecy)/vsim->recVtx->yError() );
3113 Fill(h,
"pullzr", (vsim->recVtx->z()-vsim->z*
simUnit_-dsimrecz)/vsim->recVtx->zError() );
3118 if(simpv.size()==1){
3119 if (vsim->recVtx==&(*recVtxs->begin())){
3120 Fill(h,
"efftag", 1.);
3122 Fill(h,
"efftag", 0.);
3128 Fill(h,
"effvsptsq",vsim->ptsq,1.);
3129 Fill(h,
"effvsnsimtrk",vsim->nGenTrk,1.);
3130 Fill(h,
"effvsnrectrk",nrectrks,1.);
3131 Fill(h,
"effvsnseltrk",nseltrks,1.);
3138 bool plapper=
verbose_ && vsim->nGenTrk;
3146 std::cout <<
"nearest recvertex at " << vsim->recVtx->z() <<
" dz=" << vsim->recVtx->z()-vsim->z*
simUnit_ << std::endl;
3149 if (fabs(vsim->recVtx->z()-vsim->z*
simUnit_)<0.2 ){
3153 if (fabs(vsim->recVtx->z()-vsim->z*
simUnit_)<0.5 ){
3158 if(plapper){
std::cout <<
"type 2a no vertex anywhere near" << std::endl;}
3163 if(plapper){
std::cout <<
"type 2b, no vertex at all" << std::endl;}
3169 for(
unsigned int iclu=0; iclu<clusters.size(); iclu++){
3171 selstat=int(clusters[iclu].
position().
x()+0.1);
3172 if(
verbose_){
std::cout <<
"matching cluster found with selstat=" << clusters[iclu].position().x() << std::endl;}
3176 if(plapper){
std::cout <<
"vertex rejected (distance to beam)" << std::endl;}
3178 }
else if(selstat==-1){
3179 if(plapper) {
std::cout <<
"vertex invalid" << std::endl;}
3181 }
else if(selstat==1){
3182 if(plapper){
std::cout <<
"vertex accepted, this cannot be right!!!!!!!!!!" << std::endl;}
3183 }
else if(selstat==-2){
3184 if(plapper){
std::cout <<
"dont know what this means !!!!!!!!!!" << std::endl;}
3185 }
else if(selstat==-3){
3186 if(plapper){
std::cout <<
"no matching cluster found " << std::endl;}
3189 if(plapper){
std::cout <<
"dont know what this means either !!!!!!!!!!" << selstat << std::endl;}
3195 if(simpv.size()==1){
Fill(h,
"efftag", 0.); }
3197 Fill(h,
"effvsptsq",vsim->ptsq,0.);
3198 Fill(h,
"effvsnsimtrk",
float(vsim->nGenTrk),0.);
3199 Fill(h,
"effvsnrectrk",nrectrks,0.);
3200 Fill(h,
"effvsnseltrk",nseltrks,0.);
3213 if (recVtxs->size()>0){
3214 Double_t dz=(*recVtxs->begin()).
z() - (*simpv.begin()).
z*
simUnit_;
3215 Fill(h,
"zdistancetag",dz);
3216 Fill(h,
"abszdistancetag",fabs(dz));
3218 Fill(h,
"puritytag",1.);
3221 Fill(h,
"puritytag",0.);
3241 for(reco::TrackCollection::const_iterator
t=recTrks->begin();
3242 t!=recTrks->end(); ++
t){
3243 if((recVtxs->size()>0) && (recVtxs->begin()->
isValid())){
3254 selTrks.push_back(*
t);
3258 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
3259 v!=recVtxs->end(); ++
v){
3261 if((
v->isFake()) || (
v->ndof()<-2) )
break;
3262 for(
trackit_t tv=
v->tracks_begin(); tv!=
v->tracks_end(); tv++ ){
3263 if( ((**tv).vz()==
t->vz()&&((**tv).phi()==
t->phi())) ) {
3271 }
else if(foundinvtx>1){
3272 cout <<
"hmmmm " << foundinvtx << endl;
3280 nseltrks=selTrks.size();
3281 }
else if( ! (nseltrks==(
int)selTrks.size()) ){
3282 std::cout <<
"Warning: inconsistent track selection !" << std::endl;
3288 int nrec=0, nrec0=0, nrec8=0, nrec2=0, nrec4=0;
3289 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
3290 v!=recVtxs->end(); ++
v){
3292 if (! (
v->isFake()) &&
v->ndof()>0 &&
v->chi2()>0 ){
3294 if (
v->ndof()>0) nrec0++;
3295 if (
v->ndof()>8) nrec8++;
3296 if (
v->ndof()>2) nrec2++;
3297 if (
v->ndof()>4) nrec4++;
3299 if(
v==recVtxs->begin()){
3305 Float_t wt=
v->trackWeight(*
t);
3307 Fill(h,
"trackWt",wt);
3320 for(
unsigned int iclu=0; iclu<clusters.size(); iclu++){
3321 if (clusters[iclu].tracksSize()==1){
3322 for(
trackit_t t = clusters[iclu].tracks_begin();
3323 t!=clusters[iclu].tracks_end();
t++){
3333 Fill(h,
"szRecVtx",recVtxs->size());
3334 Fill(h,
"nclu",clusters.size());
3335 Fill(h,
"nseltrk",nseltrks);
3336 Fill(h,
"nrectrk",nrectrks);
3337 Fill(h,
"nrecvtx",nrec);
3338 Fill(h,
"nrecvtx2",nrec2);
3339 Fill(h,
"nrecvtx4",nrec4);
3340 Fill(h,
"nrecvtx8",nrec8);
3343 Fill(h,
"eff0vsntrec",nrectrks,1.);
3344 Fill(h,
"eff0vsntsel",nseltrks,1.);
3346 Fill(h,
"eff0vsntrec",nrectrks,0.);
3347 Fill(h,
"eff0vsntsel",nseltrks,0.);
3349 cout << Form(
"PrimaryVertexAnalyzer4PU: %s may have lost a vertex %10d %10d %4d / %4d ",message.c_str(),
run_,
event_, nrectrks,nseltrks) << endl;
3353 if(nrec0>0) {
Fill(h,
"eff0ndof0vsntsel",nseltrks,1.);}
else{
Fill(h,
"eff0ndof0vsntsel",nseltrks,0.);}
3354 if(nrec2>0) {
Fill(h,
"eff0ndof2vsntsel",nseltrks,1.);}
else{
Fill(h,
"eff0ndof2vsntsel",nseltrks,0.);}
3355 if(nrec4>0) {
Fill(h,
"eff0ndof4vsntsel",nseltrks,1.);}
else{
Fill(h,
"eff0ndof4vsntsel",nseltrks,0.);}
3356 if(nrec8>0) {
Fill(h,
"eff0ndof8vsntsel",nseltrks,1.);}
else{
Fill(h,
"eff0ndof8vsntsel",nseltrks,0.);}
3359 cout <<
"multivertex event" << endl;
3363 if((nrectrks>10)&&(nseltrks<3)){
3364 cout <<
"small fraction of selected tracks " << endl;
3369 if((nrec==0)||(recVtxs->begin()->isFake())){
3370 Fill(h,
"nrectrk0vtx",nrectrks);
3371 Fill(h,
"nseltrk0vtx",nseltrks);
3372 Fill(h,
"nclu0vtx",clusters.size());
3377 double ndof2=-10,ndof1=-10, zndof1=0, zndof2=0;
3378 for(reco::VertexCollection::const_iterator
v=recVtxs->begin();
3379 v!=recVtxs->end(); ++
v){
3380 if(
v->isFake()){
Fill(h,
"isFake",1.);}
else{
Fill(h,
"isFake",0.);}
3381 if(
v->isFake()||((
v->ndof()<0)&&(
v->ndof()>-3))){
Fill(h,
"isFake1",1.);}
else{
Fill(h,
"isFake1",0.);}
3383 if((
v->isFake())||(
v->ndof()<0))
continue;
3384 if(
v->ndof()>ndof1){ ndof2=ndof1; zndof2=zndof1; ndof1=
v->ndof(); zndof1=
v->position().z();}
3385 else if(
v->ndof()>ndof2){ ndof2=
v->ndof(); zndof2=
v->position().z();}
3389 if(
v->tracksSize()==2){
3393 double dphi=t1->
phi()-t2->
phi();
if (dphi<0) dphi+=2*
M_PI;
3401 Fill(h,
"2trkmassOS",m12);
3404 Fill(h,
"2trkmassSS",m12);
3406 Fill(h,
"2trkdphi",dphi);
3408 if(fabs(dphi-
M_PI)<0.1)
Fill(h,
"2trksetacurl",t1->
eta()+t2->
eta());
3409 if(fabs(t1->
eta()+t2->
eta())<0.1)
Fill(h,
"2trkdphicurl",dphi);
3411 if(
v!=recVtxs->begin()){
3414 Fill(h,
"2trkmassOSPU",m12);
3417 Fill(h,
"2trkmassSSPU",m12);
3419 Fill(h,
"2trkdphiPU",dphi);
3421 if(fabs(dphi-
M_PI)<0.1)
Fill(h,
"2trksetacurlPU",t1->
eta()+t2->
eta());
3422 if(fabs(t1->
eta()+t2->
eta())<0.1)
Fill(h,
"2trkdphicurlPU",dphi);
3427 Fill(h,
"trkchi2vsndof",
v->ndof(),
v->chi2());
3428 if(
v->ndof()>0){
Fill(h,
"trkchi2overndof",
v->chi2()/
v->ndof()); }
3429 if(
v->tracksSize()==2){
Fill(h,
"2trkchi2vsndof",
v->ndof(),
v->chi2()); }
3430 if(
v->tracksSize()==3){
Fill(h,
"3trkchi2vsndof",
v->ndof(),
v->chi2()); }
3431 if(
v->tracksSize()==4){
Fill(h,
"4trkchi2vsndof",
v->ndof(),
v->chi2()); }
3432 if(
v->tracksSize()==5){
Fill(h,
"5trkchi2vsndof",
v->ndof(),
v->chi2()); }
3434 Fill(h,
"nbtksinvtx",
v->tracksSize());
3435 Fill(h,
"nbtksinvtx2",
v->tracksSize());
3436 Fill(h,
"vtxchi2",
v->chi2());
3437 Fill(h,
"vtxndf",
v->ndof());
3439 Fill(h,
"vtxndfvsntk",
v->tracksSize(),
v->ndof());
3440 Fill(h,
"vtxndfoverntk",
v->ndof()/
v->tracksSize());
3441 Fill(h,
"vtxndf2overntk",(
v->ndof()+2)/
v->tracksSize());
3442 Fill(h,
"zrecvsnt",
v->position().z(),float(nrectrks));
3444 Fill(h,
"zrecNt100",
v->position().z());
3448 Fill(h,
"xrec",
v->position().x());
3449 Fill(h,
"yrec",
v->position().y());
3450 Fill(h,
"zrec",
v->position().z());
3451 Fill(h,
"xrec1",
v->position().x());
3452 Fill(h,
"yrec1",
v->position().y());
3453 Fill(h,
"zrec1",
v->position().z());
3454 Fill(h,
"xrec2",
v->position().x());
3455 Fill(h,
"yrec2",
v->position().y());
3456 Fill(h,
"zrec2",
v->position().z());
3457 Fill(h,
"xrec3",
v->position().x());
3458 Fill(h,
"yrec3",
v->position().y());
3459 Fill(h,
"zrec3",
v->position().z());
3485 Fill(h,
"errx",
v->xError());
3486 Fill(h,
"erry",
v->yError());
3487 Fill(h,
"errz",
v->zError());
3488 double vxx=
v->covariance(0,0);
3489 double vyy=
v->covariance(1,1);
3490 double vxy=
v->covariance(1,0);
3491 double dv=0.25*(vxx+vyy)*(vxx+vyy-(vxx*vyy-vxy*vxy));
3493 double l1=0.5*(vxx+vyy)+
sqrt(dv);
3495 double l2=
sqrt(0.5*(vxx+vyy)-
sqrt(dv));
3501 if (
v==recVtxs->begin()){
3502 Fill(h,
"nbtksinvtxTag",
v->tracksSize());
3503 Fill(h,
"nbtksinvtxTag2",
v->tracksSize());
3504 Fill(h,
"xrectag",
v->position().x());
3505 Fill(h,
"yrectag",
v->position().y());
3506 Fill(h,
"zrectag",
v->position().z());
3508 Fill(h,
"nbtksinvtxPU",
v->tracksSize());
3509 Fill(h,
"nbtksinvtxPU2",
v->tracksSize());
3513 Fill(h,
"xresvsntrk",
v->tracksSize(),
v->xError());
3514 Fill(h,
"yresvsntrk",
v->tracksSize(),
v->yError());
3515 Fill(h,
"zresvsntrk",
v->tracksSize(),
v->zError());
3520 for(
unsigned int iclu=0; iclu<clusters.size(); iclu++){
3521 if( fabs(clusters[iclu].
position().
z()-
v->position().z()) < 0.0001 ){
3522 Fill(h,
"nclutrkvtx",clusters[iclu].tracksSize());
3529 reco::VertexCollection::const_iterator v1=
v; v1++;
3530 for(; v1!=recVtxs->end(); ++v1){
3531 if((v1->isFake())||(v1->ndof()<0))
continue;
3532 Fill(h,
"zdiffrec",
v->position().z()-v1->position().z());
3540 Fill(h,
"zPUcand",z0);
Fill(h,
"zPUcand",z1);
3541 Fill(h,
"ndofPUcand",
v->ndof());
Fill(h,
"ndofPUcand",v1->ndof());
3543 Fill(h,
"zdiffvsz",z1-z0,0.5*(z1+z0));
3545 if ((
v->ndof()>2) && (v1->ndof()>2)){
3546 Fill(h,
"zdiffrec2",
v->position().z()-v1->position().z());
3547 Fill(h,
"zPUcand2",z0);
3548 Fill(h,
"zPUcand2",z1);
3549 Fill(h,
"ndofPUcand2",
v->ndof());
3550 Fill(h,
"ndofPUcand2",v1->ndof());
3551 Fill(h,
"zvszrec2",z0, z1);
3552 Fill(h,
"pzvspz2",TMath::Freq(z0/2.16),TMath::Freq(z1/2.16) );
3555 if ((
v->ndof()>4) && (v1->ndof()>4)){
3556 Fill(h,
"zdiffvsz4",z1-z0,0.5*(z1+z0));
3557 Fill(h,
"zdiffrec4",
v->position().z()-v1->position().z());
3558 Fill(h,
"zvszrec4",z0, z1);
3559 Fill(h,
"pzvspz4",TMath::Freq(z0/2.16),TMath::Freq(z1/2.16) );
3561 if(fabs(z0-z1)>1.0){
3568 Fill(h,
"ndofOverNtkPUcand",
v->ndof()/
v->tracksSize());
3569 Fill(h,
"ndofOverNtkPUcand",v1->ndof()/v1->tracksSize());
3574 Fill(h,
"zPUcand4",z0);
3575 Fill(h,
"zPUcand4",z1);
3576 Fill(h,
"ndofPUcand4",
v->ndof());
3577 Fill(h,
"ndofPUcand4",v1->ndof());
3583 if ((
v->ndof()>4) && (v1->ndof()>2) && (v1->ndof()<4)){
3587 if ((
v->ndof()>8) && (v1->ndof()>8)){
3588 Fill(h,
"zdiffrec8",
v->position().z()-v1->position().z());
3590 cout <<
"PU candidate " <<
run_ <<
" " <<
event_ <<
" " << message <<
" zdiff=" <<z0-z1 << endl;
3599 bool problem =
false;
3605 for (
int i = 0;
i != 3;
i++) {
3606 for (
int j =
i;
j != 3;
j++) {
3611 if (
j ==
i &&
v->covariance(
i,
j) < 0) {
3612 Fill(h,
"nans",index*1., 1.);
3620 t!=
v->tracks_end();
t++) {
3622 if ( (**t).charge() < -1 || (**t).charge() > 1 ) {
3623 Fill(h,
"tklinks",0.);
3626 Fill(h,
"tklinks",1.);
3631 Fill(h,
"tklinks",0.);
3640 t!=
v->tracks_end();
t++) {
3641 std::cout <<
"Track " << itk++ << std::endl;
3643 for (
int i = 0;
i != 5;
i++) {
3644 for (
int j = 0;
j != 5;
j++) {
3645 data[i2] = (**t).covariance(
i,
j);
3646 std::cout << std:: scientific << data[i2] <<
" ";
3652 = gsl_matrix_view_array (data, 5, 5);
3654 gsl_vector *eval = gsl_vector_alloc (5);
3655 gsl_matrix *evec = gsl_matrix_alloc (5, 5);
3657 gsl_eigen_symmv_workspace *
w =
3658 gsl_eigen_symmv_alloc (5);
3660 gsl_eigen_symmv (&m.matrix, eval, evec, w);
3662 gsl_eigen_symmv_free (w);
3664 gsl_eigen_symmv_sort (eval, evec,
3665 GSL_EIGEN_SORT_ABS_ASC);
3670 for (i = 0; i < 5; i++) {
3672 = gsl_vector_get (eval, i);
3676 printf (
"eigenvalue = %g\n", eval_i);
3697 Fill(h,
"ndofnr2",ndof2);
3698 if(fabs(zndof1-zndof2)>1)
Fill(h,
"ndofnr2d1cm",ndof2);
3699 if(fabs(zndof1-zndof2)>2)
Fill(h,
"ndofnr2d2cm",ndof2);
3704 if ( pui_z.size()>0 ) {
3706 vector<int> used_indizesV;
3708 for (
unsigned spv_idx=0; spv_idx<pui_z.size(); spv_idx++) {
3710 float sv = pui_z[spv_idx];
3712 if ( fabs(sv)>24. )
continue;
3720 unsigned numMatchs = matchedV->size();
3722 bool dsflag =
false;
3724 for (
unsigned i=0;
i<used_indizesV.size();
i++) {
3725 for (
unsigned j=0;
j<numMatchs;
j++) {
3726 if ( used_indizesV.at(
i)==matchedV->at(
j) ) {
3733 if ( numMatchs>0 ) eff = 1.;
3734 if ( numMatchs>1 ) dreco = 1.;
3735 if ( dsflag ) dsimed = 1.;
3736 if ( ( numMatchs>0 ) && ( !dsflag ) ) effwod = 1.;
3738 for (
unsigned i=0;
i<numMatchs;
i++) {
3739 used_indizesV.push_back(matchedV->at(
i));
3744 Fill(h,
"effvszsep", sep, eff);
3745 Fill(h,
"effwodvszsep", sep, effwod);
3746 Fill(h,
"mergedvszsep", sep, dsimed);
3747 Fill(h,
"splitvszsep", sep, dreco);
3752 std::cout <<
"Strange PileUpSummaryInfo in the event" << std::endl;
math::XYZPoint myBeamSpot
~PrimaryVertexAnalyzer4PU()
double qoverp() const
q / p
virtual char const * what() const
edm::EDGetTokenT< reco::TrackCollection > recoTrackCollectionToken_
double p() const
momentum vector magnitude
TrackFilterForPVFinding theTrackFilter
value_type const * get() const
EventNumber_t event() const
double z0() const
z coordinate
edm::EDGetTokenT< reco::BeamSpot > recoBeamSpotToken_
double d0Error() const
error on d0
edm::EDGetTokenT< edm::SimTrackContainer > edmSimTrackContainerToken_
bool matchVertex(const simPrimaryVertex &vsim, const reco::Vertex &vrec)
std::vector< SimPart > getSimTrkParameters(edm::Handle< edm::SimTrackContainer > &simTrks, edm::Handle< edm::SimVertexContainer > &simVtcs, double simUnit=1.0)
bool isNonnull() const
Checks for non-null.
int event() const
get the contents of the subdetector field (should be protected?)
unsigned short lost() const
Number of lost (=invalid) hits on track.
Measurement1D transverseImpactParameter() const
std::vector< PrimaryVertexAnalyzer4PU::SimEvent > getSimEvents(edm::Handle< TrackingParticleCollection >, edm::Handle< TrackingVertexCollection >, edm::Handle< edm::View< reco::Track > >)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
void fillTrackHistos(std::map< std::string, TH1 * > &h, const std::string &ttype, const reco::Track &t, const reco::Vertex *v=NULL)
std::vector< TrackingParticle > TrackingParticleCollection
trackRef_iterator tracks_end() const
last iterator over tracks
const_iterator end() const
last iterator over the map (read only)
void setBeamSpot(const reco::BeamSpot &beamSpot)
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
reco::TrackBase::ParameterVector ParameterVector
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::map< std::string, TH1 * > hsimPV
std::vector< SimVertex >::const_iterator g4v_iterator
edm::Handle< reco::BeamSpot > recoBeamSpotHandle_
std::vector< reco::TransientTrack > tk
double theta() const
polar angle
double dxyError() const
error on dxy
std::vector< int > supf(std::vector< SimPart > &simtrks, const reco::TrackCollection &trks)
Sin< T >::type sin(const T &t)
const_iterator find(const key_type &k) const
find element with specified reference key
edm::EDGetTokenT< reco::VertexCollection > recoVertexCollectionToken_
Global3DPoint GlobalPoint
std::vector< Track > TrackCollection
collection of Tracks
Geom::Theta< T > theta() const
int pixelLayersWithMeasurement() const
int bunchCrossing() const
edm::LuminosityBlockNumber_t luminosityBlock() const
static bool match(const ParameterVector &a, const ParameterVector &b)
edm::ESHandle< TransientTrackBuilder > theB_
edm::EDGetTokenT< TrackingParticleCollection > trackingParticleCollectionToken_
double phi() const
azimuthal angle of momentum vector
std::vector< Vertex > VertexCollection
collection of Vertex objects
math::Vector< dimension >::type ParameterVector
parameter vector
double px() const
x coordinate of momentum vector
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
edm::EDGetTokenT< TrackingVertexCollection > trackingVertexCollectionToken_
edm::EDGetTokenT< edm::HepMCProduct > edmHepMCProductToken_
void analyzeVertexCollection(std::map< std::string, TH1 * > &h, const edm::Handle< reco::VertexCollection > recVtxs, const edm::Handle< reco::TrackCollection > recTrks, std::vector< simPrimaryVertex > &simpv, const std::vector< float > &pui_z, const std::string message="")
void printRecVtxs(const edm::Handle< reco::VertexCollection > recVtxs, std::string title="Reconstructed Vertices")
reco::BeamSpot vertexBeamSpot_
const Point & position() const
position
bool alreadyPrinted() const
TrajectoryStateClosestToBeamLine stateAtBeamLine() const
void getData(T &iHolder) const
std::map< std::string, TH1 * > hnoBS
const math::XYZPoint & innerPosition() const
position of the innermost hit
TrackAlgorithm algo() const
void Fill(std::map< std::string, TH1 * > &h, std::string s, double x)
std::map< std::string, TH1 * > hDA
double getTrueSeparation(float, const std::vector< float > &)
bool isFinalstateParticle(const HepMC::GenParticle *p)
bool isCharged(const HepMC::GenParticle *p)
double eta() const
pseudorapidity of momentum vector
const std::vector< float > & getPU_zpositions() const
bool truthMatchedTrack(edm::RefToBase< reco::Track >, TrackingParticleRef &)
float trackWeight(const TrackBaseRef &r) const
returns the weight with which a Track has contributed to the vertex-fit.
int trackerLayersWithMeasurement() const
int bunchCrossing() const
get the detector field from this detid
GlobalPoint position() const
std::map< std::string, TH1 * > bookVertexHistograms()
double pt() const
track transverse momentum
void printPVTrks(const edm::Handle< reco::TrackCollection > &recTrks, const edm::Handle< reco::VertexCollection > &recVtxs, std::vector< SimPart > &tsim, std::vector< SimEvent > &simEvt, const bool selectedOnly=true)
Cos< T >::type cos(const T &t)
std::vector< int > matchedRecTrackIndex
virtual CachingVertex< 5 > vertex(const std::vector< reco::TransientTrack > &) const
Tan< T >::type tan(const T &t)
Abs< T >::type abs(const T &t)
double z() const
y coordinate
double lambda() const
Lambda angle.
std::vector< simPrimaryVertex > getSimPVs(const edm::Handle< edm::HepMCProduct > evtMC)
float ChiSquaredProbability(double chiSquared, double nrDOF)
double BeamWidthX() const
beam width X
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
std::vector< int > * vertex_match(float, const edm::Handle< reco::VertexCollection >)
void printSimVtxs(const edm::Handle< edm::SimVertexContainer > simVtxs)
T const * get() const
Returns C++ pointer to the item.
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
void printEventSummary(std::map< std::string, TH1 * > &h, const edm::Handle< reco::VertexCollection > recVtxs, const edm::Handle< reco::TrackCollection > recTrks, std::vector< SimEvent > &simEvt, const std::string message)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
HepPDT::ParticleData ParticleData
virtual reco::RecoToSimCollection associateRecoToSim(edm::Handle< edm::View< reco::Track > > &tCH, edm::Handle< TrackingParticleCollection > &tPCH, const edm::Event *event, const edm::EventSetup *setup) const
compare reco to sim the handle of reco::Track and TrackingParticle collections
edm::EDGetTokenT< edm::View< reco::Track > > edmView_recoTrack_Token_
edm::EDGetTokenT< edm::SimVertexContainer > edmSimVertexContainerToken_
FTS const & trackStateAtPCA() const
double pz() const
z coordinate of momentum vector
std::map< std::string, TH1 * > hBS
std::vector< reco::TransientTrack > tkprim
double dzError() const
error on dz
reco::Vertex::trackRef_iterator trackit_t
std::string getReleaseVersion()
double vz() const
z coordinate of the reference point on track
TrackAssociatorBase * associatorByHits_
GlobalPoint position() const
void matchRecTracksToVertex(simPrimaryVertex &pv, const std::vector< SimPart > &tsim, const edm::Handle< reco::TrackCollection > &recTrks)
double significance() const
bool isResonance(const HepMC::GenParticle *p)
T const * product() const
const Track & track() const
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
void printRecTrks(const edm::Handle< reco::TrackCollection > &recTrks)
void getTc(const std::vector< reco::TransientTrack > &, double &, double &, double &, double &, double &)
XYZPointD XYZPoint
point in space with cartesian internal representation
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
std::vector< TrackingVertex > TrackingVertexCollection
std::vector< SimVertex > SimVertexContainer
reco::RecoToSimCollection r2s_
int pixelBarrelLayersWithMeasurement() const
T const * product() const
double BeamWidthY() const
beam width Y
EncodedEventId eventId() const
Signal source, crossing number.
PrimaryVertexAnalyzer4PU(const edm::ParameterSet &)
const EncodedEventId & eventId() const
Pixel cluster – collection of neighboring pixels above threshold.
double vy() const
y coordinate of the reference point on track
void printSimTrks(const edm::Handle< edm::SimTrackContainer > simVtrks)
char data[epos_bytes_allocation]
void add(std::map< std::string, TH1 * > &h, TH1 *hist)
< trclass="colgroup">< tdclass="colgroup"colspan=5 > DT local reconstruction</td ></tr >< tr >< td >< ahref="classDTRecHit1DPair.html"> DTRecHit1DPair</a ></td >< td >< ahref="DataFormats_DTRecHit.html"> edm::RangeMap & lt
static int position[264][3]
unsigned short found() const
Number of valid hits on track.
std::string recoTrackProducer_
void analyzeVertexCollectionTP(std::map< std::string, TH1 * > &h, const edm::Handle< reco::VertexCollection > recVtxs, const edm::Handle< reco::TrackCollection > recTrks, std::vector< SimEvent > &simEvt, reco::RecoToSimCollection rsC, const std::string message="")
edm::EDGetTokenT< reco::VertexCollection > recoVertexCollection_DA_Token_
edm::EDGetTokenT< reco::VertexCollection > recoVertexCollection_BS_Token_
edm::EDGetTokenT< std::vector< PileupSummaryInfo > > vecPileupSummaryInfoToken_
std::vector< TrackBaseRef >::const_iterator trackRef_iterator
The iteratator for the vector<TrackRef>
double y0() const
y coordinate
Monte Carlo truth information used for tracking validation.
int charge() const
track electric charge
const Point & position() const
position
static const G4double kappa
volatile std::atomic< bool > shutdown_flag false
trackRef_iterator tracks_begin() const
first iterator over tracks
void dumpHitInfo(const reco::Track &t)
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
virtual void analyze(const edm::Event &, const edm::EventSetup &)
std::vector< SimTrack > SimTrackContainer
std::vector< edm::RefToBase< reco::Track > > getTruthMatchedVertexTracks(const reco::Vertex &)
edm::ESHandle< ParticleDataTable > pdt_
std::map< double, TrackingParticleRef > z2tp_
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)
size_t tracksSize() const
number of tracks
double py() const
y coordinate of momentum vector
double vx() const
x coordinate of the reference point on track
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
int numberOfHits(HitCategory category) const
const LorentzVector & position() const
double x0() const
x coordinate
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.