]>
Commit | Line | Data |
---|---|---|
e8614603 | 1 | // |
2 | // Reading macro for the track reference tree | |
3 | // minimum stuff | |
4 | // | |
5 | void AliPMDTrackRefRead() | |
6 | { | |
7 | ||
8 | AliRunLoader* runLoader = AliRunLoader::Open("galice.root"); | |
9 | ||
10 | if (!runLoader) | |
11 | { | |
12 | printf("Could not open galice.root"); | |
13 | } | |
14 | ||
15 | runLoader->LoadTrackRefs("READ"); | |
16 | ||
17 | Int_t nEvents = runLoader->GetNumberOfEvents(); | |
18 | ||
19 | printf("Total number of Events = %d\n",nEvents); | |
20 | ||
21 | ||
22 | FILE *fpw = fopen("trackref.dat","w"); | |
23 | ||
24 | ||
25 | ||
26 | TClonesArray *arrayTR = 0x0; | |
27 | arrayTR = new TClonesArray("AliTrackReference"); | |
28 | ||
29 | TTree *treeTR; | |
30 | ||
31 | ||
32 | AliStack *stack = runLoader->Stack(); | |
33 | ||
34 | ||
35 | // Starts the event loop | |
36 | ||
37 | for (Int_t iev = 0; iev < nEvents; iev++) | |
38 | { | |
39 | runLoader->GetEvent(iev); | |
40 | treeTR = runLoader->TreeTR(); | |
41 | treeTR->SetBranchAddress("TrackReferences", &arrayTR); | |
42 | ||
43 | Int_t nEntries = treeTR->GetEntries(); | |
44 | ||
45 | printf("Total number of Entries = %d \n",nEntries); | |
46 | ||
47 | for (Int_t i = 0; i < nEntries; i++) | |
48 | { | |
49 | Int_t trRead = treeTR->GetEntry(i); | |
50 | if (trRead <= 0) continue; | |
51 | Int_t nTrackRefs = arrayTR->GetEntries(); | |
52 | ||
53 | for (Int_t j = 0; j < nTrackRefs; j++) | |
54 | { | |
55 | AliTrackReference* trackRef = static_cast<AliTrackReference*>(arrayTR->At(j)); | |
56 | if (!trackRef) continue; | |
57 | ||
58 | ||
59 | if (trackRef->DetectorId() != AliTrackReference::kPMD) continue; | |
60 | ||
61 | //TParticle* mpart = 0; | |
62 | ||
63 | //Int_t trackno = trackRef->GetTrack(); | |
64 | Int_t trackno = trackRef->Label(); | |
65 | ||
66 | //printf("Track number = %d \n",trackno); | |
67 | if (iev == 0) fprintf(fpw,"Track number = %d \n",trackno); | |
68 | ||
69 | ||
70 | //mpart = stack->Particle(trackno); | |
71 | ||
72 | //Int_t MPID = mpart->GetFirstMother(); | |
73 | //Int_t M2PID = mpart->GetSecondMother(); | |
74 | ||
75 | } | |
76 | ||
77 | } | |
78 | } | |
79 | ||
80 | ||
81 | ||
82 | ||
83 | ||
84 | } |