7 #include <TBranchElement.h>
8 #include <TClonesArray.h>
11 #include <AliTrackReference.h>
13 #include "Reve/Track.h"
14 #include "Reve/RenderElement.h"
19 //______________________________________________________________________
24 using namespace Alieve;
29 KineTools::KineTools()
32 /**************************************************************************/
34 void KineTools::SetDaughterPathMarks(TrackList* cont, AliStack* stack)
36 // Import daughters birth points.
38 RenderElement::List_i iter = cont->BeginChildren();
40 while(iter != cont->EndChildren())
42 Track* track = dynamic_cast<Track*>(*iter);
43 TParticle* p = stack->Particle(track->GetLabel());
44 if(p->GetNDaughters()) {
45 Int_t d0 = p->GetDaughter(0), d1 = p->GetDaughter(1);
46 for(int d=d0; d>0 && d<=d1;++d)
48 TParticle* dp = stack->Particle(d);
49 Reve::PathMark* pm = new PathMark(PathMark::Daughter);
50 pm->V.Set(dp->Vx(),dp->Vy(), dp->Vz());
51 pm->P.Set(dp->Px(),dp->Py(), dp->Pz());
53 track->AddPathMark(pm);
60 /**************************************************************************/
64 bool operator()(PathMark* const & a, PathMark* const & b)
65 { return a->time < b->time; }
69 void KineTools::SetTrackReferences(TrackList* cont, TTree* treeTR)
71 // set decay and reference points
73 static const Exc_t eH("KineTools::ImportPathMarks");
76 map<Int_t, Track* > tracks;
77 RenderElement::List_i citer = cont->BeginChildren();
78 while(citer != cont->EndChildren())
80 Track* track = dynamic_cast<Track*>(*citer);
81 tracks[track->GetLabel()] = track;
85 Int_t nPrimaries = (Int_t) treeTR->GetEntries();
86 TIter next(treeTR->GetListOfBranches());
90 while ((el = (TBranchElement*) next()))
92 if (strcmp("AliRun",el->GetName()) == 0)
95 TClonesArray* arr = 0;
97 for (Int_t iPrimPart = 0; iPrimPart<nPrimaries; iPrimPart++)
99 el->GetEntry(iPrimPart);
101 Int_t last_label = -1;
102 map<Int_t, Track*>::iterator iter = tracks.end();
103 Int_t Nent = arr->GetEntriesFast();
104 for (Int_t iTrackRef = 0; iTrackRef < Nent; iTrackRef++)
106 AliTrackReference* atr = (AliTrackReference*)arr->UncheckedAt(iTrackRef);
108 Int_t label = atr->GetTrack();
110 throw(eH + Form("negative label for entry %d in branch %s.",
111 iTrackRef, el->GetName()));
113 if(label != last_label) {
114 iter = tracks.find(label);
118 if (iter != tracks.end()) {
119 PathMark* pm = new PathMark(isRef ? PathMark::Reference : PathMark::Decay);
120 pm->V.Set(atr->X(),atr->Y(), atr->Z());
121 pm->P.Set(atr->Px(),atr->Py(), atr->Pz());
122 pm->time = atr->GetTime();
123 Track* track = iter->second;
124 track->AddPathMark(pm);
127 } // loop primaries, clones arrays
129 } // end loop through top branches
132 for(map<Int_t, Track*>::iterator j=tracks.begin(); j!=tracks.end(); ++j) {
133 (j->second)->SortPathMarksByTime();