FairRoot/PandaRoot
drawTracksWithoutEve.C
Go to the documentation of this file.
1 
2 int drawTracks(int eventNr, TTree* t, int track = -1)
3 {
4  TClonesArray* tracks = new TClonesArray("TGeoTrack");
5  TClonesArray* hits = new TClonesArray("PndSdsMCPoint");
6  t->SetBranchAddress("MVDPoint",&hits);
7  t->SetBranchAddress("GeoTracks", &tracks);
8 
9  t->GetEntry(eventNr);
10  map<int,int> trackIDCount;
11 
12  for (int i = 0; i < hits->GetEntriesFast(); i++){
13  PndSdsMCPoint* myPoint = (PndSdsMCPoint*)(hits->At(i));
14  trackIDCount[myPoint->GetTrackID()]++;
15  //std::cout << "Point: " << << " " << myPoint->GetTrackID() << std::endl;
16  myPoint->Print();
17  }
18  if (track == -1){
19  for (map<int,int>::const_iterator ci = trackIDCount.begin(); ci!= trackIDCount.end(); ci++){
20  TGeoTrack* myTrack = (TGeoTrack*)(tracks->At(ci->first));
21  std::cout << "Track " << ci->first << " : " << ci->second << std::endl;
22  myTrack->Draw("");
23  }
24  }
25  else{
26  map<int,int>::const_iterator c2 = trackIDCount.begin();
27  for (int j = 0; j < track; j++){
28  c2++;
29  }
30  TGeoTrack* myTrack = (TGeoTrack*)(tracks->At(c2->first));
31  std::cout << "Track " << c2->first << " : " << c2->second << std::endl;
32  myTrack->Draw("");
33  }
34  return 0;
35 }
Int_t i
Definition: run_full.C:25
PndRiemannTrack track
Definition: RiemannTest.C:33
c2
Definition: plot_dirc.C:39
int drawTracks(int eventNr, TTree *t, int track=-1)
TTree * t
Definition: bump_analys.C:13
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
virtual void Print(const Option_t *opt=0) const