EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stvector.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file stvector.C
1 
2 void stvector()
3 {
4  // Load basic libraries;
5  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
6 
7  // Input simulated & reconstructed files;
8  TFile *ff = new TFile("simulation.root");
9  TTree *cbmsim = ff->Get("cbmsim");
10  cbmsim->AddFriend("cbmsim", "reconstruction.root");
11 
12  // Branches of interest;
13  TClonesArray *mcTrackArray = new TClonesArray("PndMCTrack");
14  cbmsim->SetBranchAddress("MCTrack", &mcTrackArray);
15  TClonesArray *rcTrackArray = new TClonesArray("PndPidCandidate");
16  cbmsim->SetBranchAddress("PidChargedCand", &rcTrackArray);
17 
18  // Loop through all events; NB: for box-generated events without secondaries
19  // could simply use cbmsim->Project() as well; in general EicEventAssembler
20  // should be used for "true" physics events;
21  int nEvents = cbmsim->GetEntries();
22  for(unsigned ev=0; ev<nEvents; ev++) {
23  cbmsim->GetEntry(ev);
24 
25  // Loop through all reconstructed tracks;
26  for(unsigned rc=0; rc<rcTrackArray->GetEntriesFast(); rc++) {
27  PndPidCandidate *rctrack = rcTrackArray->At(rc);
28 
29  for(unsigned ih=0; ih<rctrack->GetParameterizationCount(); ih++) {
31 
32  TVector3 mcpos = par->GetMoCaPosition(), mcmom = par->GetMoCaMomentum();
33  TVector3 rcpos = par->GetRecoPosition(), rcmom = par->GetRecoMomentum();
34  printf("%2d (REC) -> V: %7.3f %7.3f %7.3f [cm] & P: %7.3f %7.3f %7.3f [GeV/c]\n",
35  ih, rcpos.X(), rcpos.Y(), rcpos.Z(), rcmom.X(), rcmom.Y(), rcmom.Z());
36  printf(" ( MC) %7.3f %7.3f %7.3f & %7.3f %7.3f %7.3f\n\n",
37  mcpos.X(), mcpos.Y(), mcpos.Z(), mcmom.X(), mcmom.Y(), mcmom.Z());
38  } //for ih
39 
40  {
41  TVector3 plxx(0.0, 0.0, 150.0), plnx(0.0, 0.0, 1.0);
42  NaiveTrackParameterization *par = rctrack->GetNearestParameterization(plxx, plnx);
43 
44  if (par) {
45  TVector3 mcpos = par->GetMoCaPosition(), mcmom = par->GetMoCaMomentum();
46  TVector3 rcpos = par->GetRecoPosition(), rcmom = par->GetRecoMomentum();
47  printf("Hit-to-plane distance: %7.2f [cm]\n", par->DistanceToPlane(plxx, plnx));
48  printf(" (REC) -> V: %7.3f %7.3f %7.3f [cm] & P: %7.3f %7.3f %7.3f [GeV/c]\n",
49  rcpos.X(), rcpos.Y(), rcpos.Z(), rcmom.X(), rcmom.Y(), rcmom.Z());
50  printf(" ( MC) %7.3f %7.3f %7.3f & %7.3f %7.3f %7.3f\n\n",
51  mcpos.X(), mcpos.Y(), mcpos.Z(), mcmom.X(), mcmom.Y(), mcmom.Z());
52  }
53  else
54  // Can hardly happen (fitter would not be started on such a track);
55  printf(" ---> No hits!\n");
56  }
57  } //for rc
58  } //for ev
59 } // stvector()