FairRoot/PandaRoot
QAmacro_mdt_2.C
Go to the documentation of this file.
2 {
3 
4  Bool_t Test=kTRUE;
5 
6  TFile* f = new TFile("pygen_sim_01_test04_test2.root");
7  TTree *tree=(TTree *) f->Get("pndsim") ;
8  TGeoManager *geoMan = (TGeoManager*) f->Get("FAIRGeom");
9 
10 
11  TClonesArray* fMdt=new TClonesArray("PndMdtPoint");
12  tree->SetBranchAddress("MdtPoint",&fMdt);
13 
14  TClonesArray* fMC=new TClonesArray("PndMCTrack");
15  tree->SetBranchAddress("MCTrack",&fMC);
16 
17  Int_t NEvents = (Int_t) tree->GetEntriesFast();
18  cout<<"N. of events: "<<NEvents<<endl;
19 
20  Int_t Pid1, Pid2;
21  // Loop on events
22  for (Int_t js=0; js<NEvents; js++){
23  cout<<"Event "<<js<<endl;
24  tree->GetEntry(js);
25  // Dimension of arrays
26  cout<<"fMC->GetEntriesFast() "<<fMC->GetEntriesFast()<<endl;
27  Int_t NPoints = (Int_t) fMdt->GetEntriesFast();
28  cout<<"fMdt->GetEntriesFast() "<<fMdt->GetEntriesFast()<<endl;
29  Int_t pmp_tid = fMC->GetEntriesFast();
30  cout<<"N. of hits: "<<NPoints<<endl;
31 
32  // Loop on the tracks
33  /* for (Int_t trk_loop=0; trk_loop<pmp_tid; trk_loop++){
34  PndMCTrack* track = (PndMCTrack*)fMC->At(trk_loop);
35  cout<<trk_loop<<" Pid "<<track->GetPdgCode()<<endl;
36  // 1) position in the array
37  // 2) PID of the track
38 
39  } // end loop trk
40  */
41 
42  for (Int_t i=0; i<NPoints ; i++){
43  PndMdtPoint* point = (PndMdtPoint*)fMdt->At(i);
44  PndMCTrack* track = (PndMCTrack*)fMC->At(point->GetTrackID());
45  Pid1=point->GetPDG();
46  Pid2= track->GetPdgCode();
47  if((Pid1-Pid2)!=0) {cout<< " - "<< i <<" (Point ) Pid "<< Pid1 << " track Pid "<< Pid2 << endl;
48  Test=kFALSE;
49  }
50  } // end loop trk
51 
52 
53  fMC->Delete();
54 
55  } // end loop on events
56 
57  if (Test){
58  cout << " Test passed" << endl;
59  cout << " All ok " << endl;
60  }else{
61  cout << " Test Failed" << endl;
62  cout << " Not Ok " << endl;
63  }
64  return 0;
65 
66 
67 }
Int_t i
Definition: run_full.C:25
TTree * tree
Definition: plot_dirc.C:12
PndRiemannTrack track
Definition: RiemannTest.C:33
Int_t GetPdgCode() const
Definition: PndMCTrack.h:73
TGeoManager * geoMan
int QAmacro_mdt_2()
Definition: QAmacro_mdt_2.C:1
TClonesArray * point
Definition: anaLmdDigi.C:29
TFile * f
Definition: bump_analys.C:12