Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackClusterEvaluator.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackClusterEvaluator.cc
1 
3 
6 #include <g4main/PHG4Hit.h>
7 #include <g4main/PHG4Particle.h>
9 #include <g4main/PHG4VtxPoint.h>
10 #include <phool/PHCompositeNode.h>
11 #include <phool/getClass.h>
12 
15 #include <trackbase/TrkrCluster.h>
18 #include <trackbase/TrkrHit.h>
19 #include <trackbase/TrkrHitSet.h>
21 
25 #include <trackbase_historic/SvtxVertex.h>
26 #include <trackbase_historic/SvtxVertexMap.h>
27 
28 #include <g4eval/SvtxEvalStack.h>
29 #include <g4eval/SvtxTrackEval.h>
30 #include <g4eval/SvtxTruthEval.h>
31 
32 #include <phool/PHCompositeNode.h>
33 
34 #include <TFile.h>
35 #include <TTree.h>
36 #include <TVector3.h>
37 
38 //____________________________________________________________________________..
40  : SubsysReco(name)
41 {
42 
43 }
44 
45 //____________________________________________________________________________..
47 {
48 
49 }
50 
51 //____________________________________________________________________________..
53 {
54 
56 }
57 
58 //____________________________________________________________________________..
60 {
61  int returnval = getNodes(topNode);
62  event = m_proc * m_nevent;
63  m_outfile = new TFile(m_outfilename.c_str(), "RECREATE");
64  setupTrees();
65 
66  return returnval;
67 }
68 
69 //____________________________________________________________________________..
71 {
72  if (!m_svtxevalstack)
73  {
74  m_svtxevalstack = new SvtxEvalStack(topNode);
79  m_svtxevalstack->next_event(topNode);
80  }
81  else
82  {
83  m_svtxevalstack->next_event(topNode);
84  }
85 
86  if (Verbosity() > 0)
87  {
88  std::cout << "Analyzing truth " << std::endl;
89  }
90  if (m_truthContainer)
91  {
92  processTruthTracks(topNode);
93  }
94  if (Verbosity() > 0)
95  {
96  std::cout << "Analyzing reco " << std::endl;
97  }
98  if (m_trackMap)
99  {
100  processRecoTracks(topNode);
101  }
102 
103  event++;
104 
106 }
107 
109 {
113  auto surfmaps = findNode::getClass<ActsSurfaceMaps>(topNode, "ActsSurfaceMaps");
114  auto tgeometry = findNode::getClass<ActsTrackingGeometry>(topNode, "ActsTrackingGeometry");
115 
117 
118  if (m_scanForPrimaries)
119  {
121  }
122 
124 
125  ActsTransformations actsTransformer;
126 
127  for (PHG4TruthInfoContainer::ConstIterator iter = range.first;
128  iter != range.second; ++iter)
129  {
130  PHG4Particle *g4particle = iter->second;
131  resetTreeValues();
132 
133  if (m_scanForEmbedded)
134  {
135  if (trutheval->get_embed(g4particle) <= 0)
136  {
137  continue;
138  }
139  }
140 
141  gtrackID = g4particle->get_track_id();
142 
143  gflavor = g4particle->get_pid();
144 
145  std::set<TrkrDefs::cluskey> g4clusters = clustereval->all_clusters_from(g4particle);
146  gnmaps = 0;
147  gnintt = 0;
148  gntpc = 0;
149  gnmms = 0;
150 
151  for (const auto &g4cluster : g4clusters)
152  {
153  auto cluster = m_clusterContainer->findCluster(g4cluster);
154  std::shared_ptr<TrkrCluster> truthCluster = clustereval->max_truth_cluster_by_energy(g4cluster);
155 
156  gclusterkeys.push_back(g4cluster);
157  auto global = actsTransformer.getGlobalPosition(cluster, surfmaps, tgeometry);
158  if (truthCluster)
159  {
160  tgclusterx.push_back(truthCluster->getX());
161  tgclustery.push_back(truthCluster->getY());
162  tgclusterz.push_back(truthCluster->getZ());
163  }
164  else
165  {
166  tgclusterx.push_back(NAN);
167  tgclustery.push_back(NAN);
168  tgclusterz.push_back(NAN);
169  }
170 
171  gclusterx.push_back(global(0));
172  gclustery.push_back(global(1));
173  gclusterz.push_back(global(2));
174  gclusterrphierr.push_back(cluster->getActsLocalError(0, 0));
175  gclusterzerr.push_back(cluster->getActsLocalError(1, 1));
176 
177  unsigned int layer = TrkrDefs::getLayer(g4cluster);
178  if (layer < 3)
179  {
180  gnmaps++;
181  }
182  else if (layer < 7)
183  {
184  gnintt++;
185  }
186  else if (layer < 55)
187  {
188  gntpc++;
189  }
190  else
191  {
192  gnmms++;
193  }
194  }
195 
196  gpx = g4particle->get_px();
197  gpy = g4particle->get_py();
198  gpz = g4particle->get_pz();
199  gpt = sqrt(gpx * gpx + gpy * gpy);
200  TVector3 gv(gpx, gpy, gpz);
201  geta = gv.Eta();
202  gphi = gv.Phi();
203 
204  PHG4VtxPoint *vtx = trutheval->get_vertex(g4particle);
205  gvx = vtx->get_x();
206  gvy = vtx->get_y();
207  gvz = vtx->get_z();
208  gvt = vtx->get_t();
209 
210  gembed = trutheval->get_embed(g4particle);
211  gprimary = trutheval->is_primary(g4particle);
212 
213  auto track = trackeval->best_track_from(g4particle);
214  if (track)
215  {
216  trackID = track->get_id();
217 
218  px = track->get_px();
219  py = track->get_py();
220  pz = track->get_pz();
221  quality = track->get_quality();
222  TVector3 v(px, py, pz);
223  pt = v.Pt();
224  phi = v.Phi();
225  eta = v.Eta();
226  charge = track->get_charge();
227  dca3dxy = track->get_dca3d_xy();
228  dca3dz = track->get_dca3d_z();
229  nmaps = 0;
230  nintt = 0;
231  ntpc = 0;
232  nmms = 0;
233 
234  for (SvtxTrack::ConstClusterKeyIter iter = track->begin_cluster_keys();
235  iter != track->end_cluster_keys();
236  ++iter)
237  {
238  TrkrDefs::cluskey ckey = *iter;
239  auto tcluster = m_clusterContainer->findCluster(ckey);
240  std::shared_ptr<TrkrCluster> truthCluster = clustereval->max_truth_cluster_by_energy(ckey);
241  unsigned int layer = TrkrDefs::getLayer(ckey);
242  if (layer < 3)
243  {
244  nmaps++;
245  }
246  else if (layer < 7)
247  {
248  nintt++;
249  }
250  else if (layer < 55)
251  {
252  ntpc++;
253  }
254  else
255  {
256  nmms++;
257  }
258 
259  clusterkeys.push_back(ckey);
260  auto glob = actsTransformer.getGlobalPosition(tcluster, surfmaps, tgeometry);
261 
262  if (truthCluster)
263  {
264  tclusterx.push_back(truthCluster->getX());
265  tclustery.push_back(truthCluster->getY());
266  tclusterz.push_back(truthCluster->getZ());
267  }
268  else
269  {
270  tclusterx.push_back(NAN);
271  tclustery.push_back(NAN);
272  tclusterz.push_back(NAN);
273  }
274  clusterx.push_back(glob(0));
275  clustery.push_back(glob(1));
276  clusterz.push_back(glob(2));
277  clusterrphierr.push_back(tcluster->getActsLocalError(0, 0));
278  clusterzerr.push_back(tcluster->getActsLocalError(1, 1));
279  }
280 
281  pcax = track->get_x();
282  pcay = track->get_y();
283  pcaz = track->get_z();
284  }
285 
286  auto matchedTracks = trackeval->all_tracks_from(g4particle);
287 
288  for(const auto& track : matchedTracks)
289  {
290  dtrackID = track->get_id();
291 
292  dpx = track->get_px();
293  dpy = track->get_py();
294  dpz = track->get_pz();
295  dpt = track->get_pt();
296  dpcax = track->get_x();
297  dpcay = track->get_y();
298  dpcaz = track->get_z();
299  ddca3dxy = track->get_dca3d_xy();
300  ddca3dz = track->get_dca3d_z();
301  TVector3 vec;
302  vec.SetXYZ(dpx,dpy,dpz);
303  deta = vec.Eta();
304  dphi = vec.Phi();
305  dcharge = track->get_charge();
306  dquality = track->get_quality();
307 
308  int nmmaps = 0, nmintt=0, nmtpc=0, nmmms=0;
309  for (SvtxTrack::ConstClusterKeyIter iter = track->begin_cluster_keys();
310  iter != track->end_cluster_keys();
311  ++iter)
312  {
313  TrkrDefs::cluskey ckey = *iter;
314 
315  auto tcluster = m_clusterContainer->findCluster(ckey);
316  unsigned int layer = TrkrDefs::getLayer(ckey);
317  dclusterkeys.push_back(ckey);
318  auto glob = actsTransformer.getGlobalPosition(tcluster, surfmaps, tgeometry);
319  dclusterx.push_back(glob(0));
320  dclustery.push_back(glob(1));
321  dclusterz.push_back(glob(2));
322  if (layer < 3)
323  { nmmaps++; }
324  else if (layer < 7)
325  { nmintt++; }
326  else if (layer < 55)
327  { nmtpc++; }
328  else
329  { nmmms++; }
330 
331  }
332 
333  dnmaps = nmmaps;
334  dnintt = nmintt;
335  dntpc = nmtpc;
336  dnmms = nmmms;
337  m_duplicatetree->Fill();
338 
340  dclusterrphierr.clear();
341  dclusterzerr.clear();
342  dclusterkeys.clear();
343  dclusterx.clear();
344  dclustery.clear();
345  dclusterz.clear();
346  }
347 
348  m_truthtree->Fill();
349 
350  }
351 }
352 
354 {
358  auto surfmaps = findNode::getClass<ActsSurfaceMaps>(topNode, "ActsSurfaceMaps");
359  auto tgeometry = findNode::getClass<ActsTrackingGeometry>(topNode, "ActsTrackingGeometry");
360 
361  ActsTransformations actsTransformer;
362 
363  for (const auto &[key, track] : *m_trackMap)
364  {
365  resetTreeValues();
366  if(Verbosity() > 0)
367  track->identify();
368 
369  trackID = track->get_id();
370 
371  px = track->get_px();
372  py = track->get_py();
373  pz = track->get_pz();
374  quality = track->get_quality();
375  TVector3 v(px, py, pz);
376  pt = v.Pt();
377  phi = v.Phi();
378  eta = v.Eta();
379  charge = track->get_charge();
380  dca3dxy = track->get_dca3d_xy();
381  dca3dz = track->get_dca3d_z();
382  nmaps = 0;
383  nintt = 0;
384  ntpc = 0;
385  nmms = 0;
386 
387  for (SvtxTrack::ConstClusterKeyIter iter = track->begin_cluster_keys();
388  iter != track->end_cluster_keys();
389  ++iter)
390  {
391  TrkrDefs::cluskey ckey = *iter;
392  auto tcluster = m_clusterContainer->findCluster(ckey);
393  auto truthCluster = clustereval->max_truth_cluster_by_energy(ckey);
394  unsigned int layer = TrkrDefs::getLayer(ckey);
395  if (layer < 3)
396  {
397  nmaps++;
398  }
399  else if (layer < 7)
400  {
401  nintt++;
402  }
403  else if (layer < 55)
404  {
405  ntpc++;
406  }
407  else
408  {
409  nmms++;
410  }
411 
412  clusterkeys.push_back(ckey);
413  auto glob = actsTransformer.getGlobalPosition(tcluster, surfmaps, tgeometry);
414  clusterx.push_back(glob(0));
415  clustery.push_back(glob(1));
416  clusterz.push_back(glob(2));
417  if (truthCluster)
418  {
419  tclusterx.push_back(truthCluster->getX());
420  tclustery.push_back(truthCluster->getY());
421  tclusterz.push_back(truthCluster->getZ());
422  }
423  else
424  {
425  tclusterx.push_back(NAN);
426  tclustery.push_back(NAN);
427  tclusterz.push_back(NAN);
428  }
429  clusterrphierr.push_back(tcluster->getActsLocalError(0, 0));
430  clusterzerr.push_back(tcluster->getActsLocalError(1, 1));
431  }
432 
433  pcax = track->get_x();
434  pcay = track->get_y();
435  pcaz = track->get_z();
436 
437  if (m_trackMatch)
438  {
439  auto allpart = trackeval->all_truth_particles(track);
440 
441  PHG4Particle *g4particle = trackeval->max_truth_particle_by_nclusters(track);
442 
443  if(g4particle) {
444  auto matched_track = trackeval->best_track_from(g4particle);
445 
446  if(matched_track)
447  {
448  matchedTrackID = matched_track->get_id();
449 
450  }
451 
452  auto matchedtracks = trackeval->all_tracks_from(g4particle);
453  for(const auto ttrack : matchedtracks)
454  {
455  matchedRecoTracksID.push_back(ttrack->get_id());
456  }
457  if(matchedtracks.size() > 1)
458  { isDuplicate = 1; }
459  }
460  if (m_scanForEmbedded)
461  {
462  if (trutheval->get_embed(g4particle) <= 0) continue;
463  }
464 
465  gtrackID = g4particle->get_track_id();
466  gflavor = g4particle->get_pid();
467 
468  std::set<TrkrDefs::cluskey> g4clusters = clustereval->all_clusters_from(g4particle);
469 
470  gnmaps = 0;
471  gnintt = 0;
472  gntpc = 0;
473  gnmms = 0;
474  for (const auto &g4cluster : g4clusters)
475  {
476  auto cluster = m_clusterContainer->findCluster(g4cluster);
477  gclusterkeys.push_back(g4cluster);
478  auto truthCluster = clustereval->max_truth_cluster_by_energy(g4cluster);
479  auto global = actsTransformer.getGlobalPosition(cluster, surfmaps, tgeometry);
480  gclusterx.push_back(global(0));
481  gclustery.push_back(global(1));
482  gclusterz.push_back(global(2));
483  if (truthCluster)
484  {
485  tgclusterx.push_back(truthCluster->getX());
486  tgclustery.push_back(truthCluster->getY());
487  tgclusterz.push_back(truthCluster->getZ());
488  }
489  else
490  {
491  tgclusterx.push_back(NAN);
492  tgclustery.push_back(NAN);
493  tgclusterz.push_back(NAN);
494  }
495  gclusterrphierr.push_back(cluster->getActsLocalError(0, 0));
496  gclusterzerr.push_back(cluster->getActsLocalError(1, 1));
497 
498  unsigned int layer = TrkrDefs::getLayer(g4cluster);
499  if (layer < 3)
500  {
501  gnmaps++;
502  }
503  else if (layer < 7)
504  {
505  gnintt++;
506  }
507  else if (layer < 55)
508  {
509  gntpc++;
510  }
511  else
512  {
513  gnmms++;
514  }
515  }
516 
517  gpx = g4particle->get_px();
518  gpy = g4particle->get_py();
519  gpz = g4particle->get_pz();
520 
521  TVector3 tpart(gpx, gpy, gpz);
522  gpt = tpart.Pt();
523  geta = tpart.Eta();
524  gphi = tpart.Phi();
525 
526  PHG4VtxPoint *vtx = trutheval->get_vertex(g4particle);
527  gvx = vtx->get_x();
528  gvy = vtx->get_y();
529  gvz = vtx->get_z();
530  gvt = vtx->get_t();
531 
532  gembed = trutheval->get_embed(g4particle);
533  gprimary = trutheval->is_primary(g4particle);
534  }
535  m_recotree->Fill();
536  }
537 }
538 
540 {
541  matchedRecoTracksID.clear();
542  dclusterkeys.clear();
543  dclusterx.clear();
544  dclustery.clear();
545  dclusterz.clear();
546  dclusterrphierr.clear();
547  dclusterzerr.clear();
548  tgclusterx.clear();
549  tgclustery.clear();
550  tgclusterz.clear();
551  tclusterx.clear();
552  tclustery.clear();
553  tclusterz.clear();
554  gclusterkeys.clear();
555  gclusterx.clear();
556  gclustery.clear();
557  gclusterz.clear();
558  gclusterrphierr.clear();
559  gclusterzerr.clear();
560  clusterkeys.clear();
561  clusterx.clear();
562  clustery.clear();
563  clusterz.clear();
564  clusterrphierr.clear();
565  clusterzerr.clear();
566 }
567 
568 //____________________________________________________________________________..
570 {
572 }
573 
574 //____________________________________________________________________________..
576 {
578 }
579 
580 //____________________________________________________________________________..
582 {
583  m_outfile->cd();
584  m_truthtree->Write();
585  m_recotree->Write();
586  m_outfile->Write();
587  m_outfile->Close();
588 
590 }
591 
592 //____________________________________________________________________________..
594 {
596 }
597 
599 {
600  m_truthContainer = findNode::getClass<PHG4TruthInfoContainer>(topNode, "G4TruthInfo");
601  if (!m_truthContainer)
602  {
603  std::cout << "No truth info available, can't continue." << std::endl;
605  }
606 
607  m_trackMap = findNode::getClass<SvtxTrackMap>(topNode, m_trackMapName);
608  std::cout << "Accessing map name " << m_trackMapName << std::endl;
609  if (!m_trackMap)
610  {
611  std::cout << "No track map available, can't continue. " << std::endl;
613  }
614 
615  m_clusterContainer = findNode::getClass<TrkrClusterContainer>(topNode, "TRKR_CLUSTER");
616  if (!m_clusterContainer)
617  {
618  std::cout << "No cluster container available, can't continue." << std::endl;
620  }
621 
623 }
624 
625 //____________________________________________________________________________..
627 {
628  std::cout << "TrackClusterEvaluator::Print(const std::string &what) const Printing info for " << what << std::endl;
629 }
630 
632 {
633  m_recotree = new TTree("recotracks", "a tree with reconstructed tracks");
634  m_truthtree = new TTree("truthtracks", "a tree with truth tracks");
635  m_duplicatetree = new TTree("duplicatetracks","a tree with truth->reco-duplicates");
636 
637  m_duplicatetree->Branch("event", &event, "event/I");
638  m_duplicatetree->Branch("gntracks", &gntracks, "gntracks/I");
639  m_duplicatetree->Branch("gtrackID", &gtrackID, "gtrackID/I");
640  m_duplicatetree->Branch("gflavor", &gflavor, "gflavor/I");
641  m_duplicatetree->Branch("gnmaps", &gnmaps, "gnmaps/I");
642  m_duplicatetree->Branch("gnintt", &gnintt, "gnintt/I");
643  m_duplicatetree->Branch("gntpc", &gntpc, "gntpc/I");
644  m_duplicatetree->Branch("gnmms", &gnmms, "gnmms/I");
645  m_duplicatetree->Branch("gpx", &gpx, "gpx/F");
646  m_duplicatetree->Branch("gpy", &gpy, "gpy/F");
647  m_duplicatetree->Branch("gpz", &gpz, "gpz/F");
648  m_duplicatetree->Branch("gpt", &gpt, "gpt/F");
649  m_duplicatetree->Branch("geta", &geta, "geta/F");
650  m_duplicatetree->Branch("gphi", &gphi, "gphi/F");
651  m_duplicatetree->Branch("gvx", &gvx, "gvx/F");
652  m_duplicatetree->Branch("gvy", &gvy, "gvy/F");
653  m_duplicatetree->Branch("gvz", &gvz, "gvz/F");
654  m_duplicatetree->Branch("gvt", &gvt, "gvt/F");
655  m_duplicatetree->Branch("gembed", &gembed, "gembed/I");
656  m_duplicatetree->Branch("gprimary", &gprimary, "gprimary/I");
657  m_duplicatetree->Branch("gclusterkeys", &gclusterkeys);
658  m_duplicatetree->Branch("gclusterx", &gclusterx);
659  m_duplicatetree->Branch("gclustery", &gclustery);
660  m_duplicatetree->Branch("gclusterz", &gclusterz);
661  m_duplicatetree->Branch("tgclusterx", &tgclusterx);
662  m_duplicatetree->Branch("tgclustery", &tgclustery);
663  m_duplicatetree->Branch("tgclusterz", &tgclusterz);
664  m_duplicatetree->Branch("gclusterrphierr", &gclusterrphierr);
665  m_duplicatetree->Branch("gclusterzerr", &gclusterzerr);
666  m_duplicatetree->Branch("dtrackID", &dtrackID, "dtrackID/I");
667  m_duplicatetree->Branch("dpx", &dpx, "dpx/F");
668  m_duplicatetree->Branch("dpy", &dpy, "dpy/F");
669  m_duplicatetree->Branch("dpz", &dpz, "dpz/F");
670  m_duplicatetree->Branch("dpt", &dpt, "dpt/F");
671  m_duplicatetree->Branch("deta", &deta, "deta/F");
672  m_duplicatetree->Branch("dphi", &dphi, "dphi/F");
673  m_duplicatetree->Branch("dcharge", &dcharge, "dcharge/I");
674  m_duplicatetree->Branch("dquality", &dquality, "dquality/F");
675  m_duplicatetree->Branch("dnmaps", &dnmaps, "dnmaps/I");
676  m_duplicatetree->Branch("dnintt", &dnintt, "dnintt/I");
677  m_duplicatetree->Branch("dntpc", &dntpc, "dntpc/I");
678  m_duplicatetree->Branch("dnmms", &dnmms, "dnmms/I");
679  m_duplicatetree->Branch("ddca3dxy", &ddca3dxy, "ddca3dxy/F");
680  m_duplicatetree->Branch("ddca3dz", &ddca3dz, "ddca3dz/F");
681  m_duplicatetree->Branch("dpcax", &dpcax, "dpcax/F");
682  m_duplicatetree->Branch("dpcay", &dpcay, "dpcay/F");
683  m_duplicatetree->Branch("dpcaz", &dpcaz, "dpcaz/F");
684  m_duplicatetree->Branch("dclusterkeys", &dclusterkeys);
685  m_duplicatetree->Branch("dclusterx", &dclusterx);
686  m_duplicatetree->Branch("dclustery", &dclustery);
687  m_duplicatetree->Branch("dclusterz", &dclusterz);
688  m_duplicatetree->Branch("dclusterrphierr", &dclusterrphierr);
689  m_duplicatetree->Branch("dclusterzerr", &dclusterzerr);
690 
691 
692  m_truthtree->Branch("event", &event, "event/I");
693  m_truthtree->Branch("gntracks", &gntracks, "gntracks/I");
694  m_truthtree->Branch("gtrackID", &gtrackID, "gtrackID/I");
695  m_truthtree->Branch("gflavor", &gflavor, "gflavor/I");
696  m_truthtree->Branch("gnmaps", &gnmaps, "gnmaps/I");
697  m_truthtree->Branch("gnintt", &gnintt, "gnintt/I");
698  m_truthtree->Branch("gntpc", &gntpc, "gntpc/I");
699  m_truthtree->Branch("gnmms", &gnmms, "gnmms/I");
700  m_truthtree->Branch("gpx", &gpx, "gpx/F");
701  m_truthtree->Branch("gpy", &gpy, "gpy/F");
702  m_truthtree->Branch("gpz", &gpz, "gpz/F");
703  m_truthtree->Branch("gpt", &gpt, "gpt/F");
704  m_truthtree->Branch("geta", &geta, "geta/F");
705  m_truthtree->Branch("gphi", &gphi, "gphi/F");
706  m_truthtree->Branch("gvx", &gvx, "gvx/F");
707  m_truthtree->Branch("gvy", &gvy, "gvy/F");
708  m_truthtree->Branch("gvz", &gvz, "gvz/F");
709  m_truthtree->Branch("gvt", &gvt, "gvt/F");
710  m_truthtree->Branch("gembed", &gembed, "gembed/I");
711  m_truthtree->Branch("gprimary", &gprimary, "gprimary/I");
712  m_truthtree->Branch("gclusterkeys", &gclusterkeys);
713  m_truthtree->Branch("gclusterx", &gclusterx);
714  m_truthtree->Branch("gclustery", &gclustery);
715  m_truthtree->Branch("gclusterz", &gclusterz);
716  m_truthtree->Branch("tgclusterx", &tgclusterx);
717  m_truthtree->Branch("tgclustery", &tgclustery);
718  m_truthtree->Branch("tgclusterz", &tgclusterz);
719  m_truthtree->Branch("gclusterrphierr", &gclusterrphierr);
720  m_truthtree->Branch("gclusterzerr", &gclusterzerr);
721  m_truthtree->Branch("trackID", &trackID, "trackID/I");
722  m_truthtree->Branch("px", &px, "px/F");
723  m_truthtree->Branch("py", &py, "py/F");
724  m_truthtree->Branch("pz", &pz, "pz/F");
725  m_truthtree->Branch("pt", &pt, "pt/F");
726  m_truthtree->Branch("eta", &eta, "eta/F");
727  m_truthtree->Branch("phi", &phi, "phi/F");
728  m_truthtree->Branch("charge", &charge, "charge/I");
729  m_truthtree->Branch("quality", &quality, "quality/F");
730  m_truthtree->Branch("nmaps", &nmaps, "nmaps/I");
731  m_truthtree->Branch("nintt", &nintt, "nintt/I");
732  m_truthtree->Branch("ntpc", &ntpc, "ntpc/I");
733  m_truthtree->Branch("nmms", &nmms, "nmms/I");
734  m_truthtree->Branch("dca3dxy", &dca3dxy, "dca3dxy/F");
735  m_truthtree->Branch("dca3dz", &dca3dz, "dca3dz/F");
736  m_truthtree->Branch("pcax", &pcax, "pcax/F");
737  m_truthtree->Branch("pcay", &pcay, "pcay/F");
738  m_truthtree->Branch("pcaz", &pcaz, "pcaz/F");
739  m_truthtree->Branch("clusterkeys", &clusterkeys);
740  m_truthtree->Branch("clusterx", &clusterx);
741  m_truthtree->Branch("clustery", &clustery);
742  m_truthtree->Branch("clusterz", &clusterz);
743  m_truthtree->Branch("tclusterx", &tclusterx);
744  m_truthtree->Branch("tclustery", &tclustery);
745  m_truthtree->Branch("tclusterz", &tclusterz);
746  m_truthtree->Branch("clusterrphierr", &clusterrphierr);
747  m_truthtree->Branch("clusterzerr", &clusterzerr);
748 
749  m_recotree->Branch("event", &event, "event/I");
750  m_recotree->Branch("trackID", &trackID, "trackID/I");
751  m_recotree->Branch("isDuplicate",&isDuplicate, "isDuplicate/I");
752  m_recotree->Branch("matchedRecoTracksID", &matchedRecoTracksID);
753  m_recotree->Branch("px", &px, "px/F");
754  m_recotree->Branch("py", &py, "py/F");
755  m_recotree->Branch("pz", &pz, "pz/F");
756  m_recotree->Branch("pt", &pt, "pt/F");
757  m_recotree->Branch("eta", &eta, "eta/F");
758  m_recotree->Branch("phi", &phi, "phi/F");
759  m_recotree->Branch("charge", &charge, "charge/I");
760  m_recotree->Branch("quality", &quality, "quality/F");
761  m_recotree->Branch("nmaps", &nmaps, "nmaps/I");
762  m_recotree->Branch("nintt", &nintt, "nintt/I");
763  m_recotree->Branch("ntpc", &ntpc, "ntpc/I");
764  m_recotree->Branch("nmms", &nmms, "nmms/I");
765  m_recotree->Branch("dca3dxy", &dca3dxy, "dca3dxy/F");
766  m_recotree->Branch("dca3dz", &dca3dz, "dca3dz/F");
767  m_recotree->Branch("pcax", &pcax, "pcax/F");
768  m_recotree->Branch("pcay", &pcay, "pcay/F");
769  m_recotree->Branch("pcaz", &pcaz, "pcaz/F");
770  m_recotree->Branch("clusterkeys", &clusterkeys);
771  m_recotree->Branch("clusterx", &clusterx);
772  m_recotree->Branch("clustery", &clustery);
773  m_recotree->Branch("clusterz", &clusterz);
774  m_recotree->Branch("tclusterx", &tclusterx);
775  m_recotree->Branch("tclustery", &tclustery);
776  m_recotree->Branch("tclusterz", &tclusterz);
777  m_recotree->Branch("clusterrphierr", &clusterrphierr);
778  m_recotree->Branch("clusterzerr", &clusterzerr);
779  m_recotree->Branch("matchedTrackID",&matchedTrackID, "matchedTrackID/I");
780  m_recotree->Branch("gntracks", &gntracks, "gntracks/I");
781  m_recotree->Branch("gtrackID", &gtrackID, "gtrackID/I");
782  m_recotree->Branch("gnmaps", &gnmaps, "gnmaps/I");
783  m_recotree->Branch("gnintt", &gnintt, "gnintt/I");
784  m_recotree->Branch("gntpc", &gntpc, "gntpc/I");
785  m_recotree->Branch("gnmms", &gnmms, "gnmms/I");
786  m_recotree->Branch("gpx", &gpx, "gpx/F");
787  m_recotree->Branch("gpy", &gpy, "gpy/F");
788  m_recotree->Branch("gpz", &gpz, "gpz/F");
789  m_recotree->Branch("gpt", &gpt, "gpt/F");
790  m_recotree->Branch("geta", &geta, "geta/F");
791  m_recotree->Branch("gphi", &gphi, "gphi/F");
792  m_recotree->Branch("gvx", &gvx, "gvx/F");
793  m_recotree->Branch("gvy", &gvy, "gvy/F");
794  m_recotree->Branch("gvz", &gvz, "gvz/F");
795  m_recotree->Branch("gvt", &gvt, "gvt/F");
796  m_recotree->Branch("gembed", &gembed, "gembed/I");
797  m_recotree->Branch("gprimary", &gprimary, "gprimary/I");
798  m_recotree->Branch("gclusterkeys", &gclusterkeys);
799  m_recotree->Branch("gclusterx", &gclusterx);
800  m_recotree->Branch("gclustery", &gclustery);
801  m_recotree->Branch("gclusterz", &gclusterz);
802  m_recotree->Branch("tgclusterx", &tgclusterx);
803  m_recotree->Branch("tgclustery", &tgclustery);
804  m_recotree->Branch("tgclusterz", &tgclusterz);
805  m_recotree->Branch("gclusterrphierr", &gclusterrphierr);
806  m_recotree->Branch("gclusterzerr", &gclusterzerr);
807 }
808 
810 {
811  clearVectors();
812  matchedTrackID = -9999;
813  isDuplicate = -9999;
814  gflavor = -9999;
815  gntracks = -9999;
816  gtrackID = -9999;
817  gnmaps = -9999;
818  gnintt = -9999;
819  gntpc = -9999;
820  gnmms = -9999;
821  gpx = -9999;
822  gpy = -9999;
823  gpz = -9999;
824  gpt = -9999;
825  geta = -9999;
826  gphi = -9999;
827  gvx = -9999;
828  gvy = -9999;
829  gvz = -9999;
830  gvt = -9999;
831  gembed = -9999;
832  gprimary = -9999;
833  trackID = -9999;
834  px = -9999;
835  py = -9999;
836  pz = -9999;
837  pt = -9999;
838  eta = -9999;
839  phi = -9999;
840  charge = -9999;
841  quality = -9999;
842  nmaps = -9999;
843  nintt = -9999;
844  ntpc = -9999;
845  nmms = -9999;
846  dca3dxy = -9999;
847  dca3dz = -9999;
848  pcax = -9999;
849  pcay = -9999;
850  pcaz = -9999;
851  dtrackID = -9999;
852  dpx = -9999;
853  dpy = -9999;
854  dpz = -9999;
855  dpt = -9999;
856  deta = -9999;
857  dphi = -9999;
858  dcharge = -9999;
859  dquality = -9999;
860  dnmaps = -9999;
861  dnintt = -9999;
862  dntpc = -9999;
863  dnmms = -9999;
864  ddca3dxy = -9999;
865  ddca3dz = -9999;
866  dpcax = -9999;
867  dpcay = -9999;
868  dpcaz = -9999;
869 }