**************************************************************************/
#include "AliEveKineTools.h"
-
-#include <TObject.h>
-#include <TTree.h>
-#include <TBranchElement.h>
-#include <TClonesArray.h>
+#include "AliEveTrack.h"
#include <AliStack.h>
#include <AliTrackReference.h>
-#include <TEveTrack.h>
-#include <TEveElement.h>
+#include <TTree.h>
+#include <TBranchElement.h>
+#include <TClonesArray.h>
+#include <TParticle.h>
#include <map>
namespace {
- typedef std::map<Int_t, TEveTrack*> TrackMap_t;
+ // Map to store label-to-track association.
+ //
+ // multimap is used as there are cases when initial particles (in
+ // particular resonances) are not assigned proper status-codes
+ // and can thus be found several times in the eve-track-list.
+
+ typedef std::multimap<Int_t, AliEveTrack*> TrackMap_t;
+ typedef std::multimap<Int_t, AliEveTrack*>::const_iterator TrackMap_ci;
void MapTracks(TrackMap_t& map, TEveElement* cont, Bool_t recurse)
{
TEveElement::List_i i = cont->BeginChildren();
while (i != cont->EndChildren()) {
- TEveTrack* track = dynamic_cast<TEveTrack*>(*i);
- map[track->GetLabel()] = track;
+ AliEveTrack* track = dynamic_cast<AliEveTrack*>(*i);
+ map.insert(std::make_pair(track->GetLabel(), track));
if (recurse)
MapTracks(map, track, recurse);
++i;
TEveElement::List_i iter = cont->BeginChildren();
while(iter != cont->EndChildren())
{
- TEveTrack* track = dynamic_cast<TEveTrack*>(*iter);
+ AliEveTrack* track = dynamic_cast<AliEveTrack*>(*iter);
TParticle* p = stack->Particle(track->GetLabel());
if (p->GetNDaughters())
{
// printf("Daughter path-mark for %d, %d, t=%e, r=%f,%f,%f\n",
// track->GetLabel(), d, dp->T(), dp->Vx(), dp->Vy(), dp->Vz());
}
+
+ // Check last process, set decay if needed.
+ Int_t lp = stack->Particle(d1)->GetUniqueID();
+ if (lp != kPBrem && lp != kPDeltaRay && lp < kPCerenkov)
+ {
+ TParticle* dp = stack->Particle(d1);
+ track->AddPathMark(TEvePathMark(TEvePathMark::kDecay,
+ TEveVector(dp->Vx(), dp->Vy(), dp->Vz()),
+ TEveVector(0, 0,0), dp->T()));
+ }
+
if (recurse)
SetDaughterPathMarks(track, stack, recurse);
}
treeTR->GetEntry(te);
Int_t last_label = -1;
- TrackMap_t::iterator iter = map.end();
+ std::pair<TrackMap_ci, TrackMap_ci> range;
Int_t nArrEntries = arr->GetEntriesFast();
// printf("tree-entry %d, n-arr-entries %d\n", te, nArrEntries);
if (label != last_label)
{
- iter = map.find(label);
+ range = map.equal_range(label);
last_label = label;
}
- if (iter != map.end())
+ for (TrackMap_ci i = range.first; i != range.second; ++i)
{
- iter->second->AddPathMark
+ i->second->AddPathMark
(TEvePathMark(isRef ? TEvePathMark::kReference : TEvePathMark::kDecay,
TEveVector(atr->X(), atr->Y(), atr->Z()),
TEveVector(atr->Px(), atr->Py(), atr->Pz()),
// Sort path-marks for track by time.
// If recurse is true, descends down all track children.
- TEveTrack* track = dynamic_cast<TEveTrack*>(el);
+ AliEveTrack* track = dynamic_cast<AliEveTrack*>(el);
if (track)
track->SortPathMarksByTime();