Changes from Reve::RenderElement.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Mar 2007 15:23:20 +0000 (15:23 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 5 Mar 2007 15:23:20 +0000 (15:23 +0000)
17 files changed:
EVE/Alieve/MUONChamber.cxx
EVE/Alieve/TPCLoader.cxx
EVE/Alieve/TPCSector2D.cxx
EVE/Alieve/TPCSector3D.cxx
EVE/Alieve/TRDLoader.cxx
EVE/Alieve/TRDLoader.h
EVE/Alieve/TRDModuleImp.cxx
EVE/Alieve/TRDModuleImp.h
EVE/alice-macros/clusters_from_index.C
EVE/alice-macros/clusters_from_label.C
EVE/alice-macros/geom_rich.C
EVE/alice-macros/hits_from_label.C
EVE/alice-macros/its_hits.C
EVE/alice-macros/kine_tracks.C
EVE/alice-macros/tof_hits.C
EVE/alice-macros/tpc_hits.C
EVE/alice-macros/trd_hits.C

index 553c819..95754f1 100644 (file)
@@ -87,7 +87,7 @@ void MUONChamber::Paint(Option_t*)
   // draw...
   //
 
-  if(fRnrElement == kFALSE)
+  if(fRnrSelf == kFALSE)
     return;
 
   TBuffer3D buffer(TBuffer3DTypes::kGeneric);
index c66bbf5..c5fd6f7 100644 (file)
@@ -53,7 +53,7 @@ void TPCLoader::RemoveElementLocal(RenderElement* el)
     if(fSec3Ds[i] == el) fSec3Ds[i] = 0;
   }
 
-  RenderElementList::RemoveElementLocal(el);
+  RenderElement::RemoveElementLocal(el);
 }
 
 void TPCLoader::RemoveElements()
@@ -63,7 +63,7 @@ void TPCLoader::RemoveElements()
     fSec3Ds[i] = 0;
   }
 
-  RenderElementList::RemoveElements();
+  RenderElement::RemoveElements();
 }
 
 /**************************************************************************/
index fcae004..e8fffd7 100644 (file)
@@ -138,7 +138,7 @@ void TPCSector2D::PadSelected(Int_t row, Int_t pad)
 
 void TPCSector2D::Paint(Option_t* )
 {
-  if(fRnrElement == kFALSE)
+  if(fRnrSelf == kFALSE)
     return;
 
   TBuffer3D buffer(TBuffer3DTypes::kGeneric);
index 7835eb9..e5f71d7 100644 (file)
@@ -77,7 +77,7 @@ void TPCSector3D::ComputeBBox()
 
 void TPCSector3D::Paint(Option_t* /*option*/)
 {
-  if(fRnrElement == kFALSE)
+  if(fRnrSelf == kFALSE)
     return;
 
   TBuffer3D buffer(TBuffer3DTypes::kGeneric);
index 8373b9b..3043180 100644 (file)
@@ -41,7 +41,7 @@ ClassImp(Alieve::TRDLoaderEditor)
 
 
 //________________________________________________________
-TRDLoader::TRDLoader(const Text_t* n, const Text_t* t) : Reve::RenderElementListBase(), TNamed(n,t), fSM(-1), fStack(-1), fLy(-1), fEvent(0)
+TRDLoader::TRDLoader(const Text_t* n, const Text_t* t) : Reve::RenderElement(), TNamed(n,t), fSM(-1), fStack(-1), fLy(-1), fEvent(0)
 {      
        kLoadHits = kFALSE;
        kLoadDigits = kFALSE;
@@ -88,7 +88,7 @@ void  TRDLoader::AddChambers(int sm, int stk, int ly)
        List_i ichmb;
        ichmb = fChildren.begin();
        while(ichmb != fChildren.end()){
-               (*ichmb)->SetRnrElement(kFALSE);
+               (*ichmb)->SetRnrSelf(kFALSE);
                ichmb++;
        }
 
@@ -99,7 +99,7 @@ void  TRDLoader::AddChambers(int sm, int stk, int ly)
                ichmb = find_if(fChildren.begin(), fChildren.end(), ID<RenderElement*>(ism));
                if(ichmb != fChildren.end()){
                        SM = (TRDNode*)(*ichmb);
-                       SM->SetRnrElement(kTRUE);
+                       SM->SetRnrSelf(kTRUE);
                }else{
                        gReve->AddRenderElement(this, SM = new TRDNode("SM", ism));
                        SM->FindListTreeItem(gReve->GetListTree())->SetTipText(Form("Supermodule %2d", ism));
@@ -108,7 +108,7 @@ void        TRDLoader::AddChambers(int sm, int stk, int ly)
                        ichmb = find_if(SM->begin(), SM->end(), ID<RenderElement*>(istk));
                        if(ichmb != SM->end()){
                                STK = (TRDNode*)(*ichmb);
-                               STK->SetRnrElement(kTRUE);
+                               STK->SetRnrSelf(kTRUE);
                        }else{
                                gReve->AddRenderElement(SM, STK = new TRDNode("Stack", istk));
                                STK->FindListTreeItem(gReve->GetListTree())->SetTipText(Form("SM %2d Stack %1d", ism, istk));
@@ -116,7 +116,7 @@ void        TRDLoader::AddChambers(int sm, int stk, int ly)
                        for(int ily=ily_start; ily<ily_stop; ily++){
                                det = fGeo->GetDetector(ily, istk, ism);
                                ichmb = find_if(STK->begin(), STK->end(), ID<RenderElement*>(det));
-                               if(ichmb != STK->end()) (*ichmb)->SetRnrElement(kTRUE);
+                               if(ichmb != STK->end()) (*ichmb)->SetRnrSelf(kTRUE);
                                else{
                                        gReve->AddRenderElement(STK, CHMB = new TRDChamber(det));
                                        CHMB->SetGeometry(fGeo);
@@ -306,16 +306,6 @@ Bool_t     TRDLoader::Open(const char *filename, const char *dir)
 }
 
 //________________________________________________________
-void TRDLoader::Paint(Option_t *option)
-{
-       List_i ichmb = fChildren.begin();
-       while(ichmb != fChildren.end()){
-               (dynamic_cast<TRDModule*>(*ichmb))->Paint(option);
-               ichmb++;
-       }
-}
-
-//________________________________________________________
 void TRDLoader::Unload()
 {
        List_i ichmb = fChildren.begin();
index 8aecf1c..5229180 100644 (file)
@@ -46,7 +46,7 @@ namespace Alieve {
                kClusters = 2,
                kESDs = 3 
        };
-       class TRDLoader : public Reve::RenderElementListBase, public TNamed
+       class TRDLoader : public Reve::RenderElement, public TNamed
        {
        friend class TRDLoaderEditor;
        public:
@@ -62,7 +62,6 @@ namespace Alieve {
                virtual Bool_t  LoadHits(TTree *tH);
                virtual Bool_t  LoadTracklets(TTree *tT);
                virtual Bool_t  Open(const char *file, const char *dir = ".");
-               virtual void            Paint(Option_t *option="");
                virtual void            Unload();
                
        protected:
index d2c8789..ff18e43 100644 (file)
@@ -30,7 +30,7 @@ ClassImp(TRDNode)
 
 //________________________________________________________
 TRDNode::TRDNode(const char *typ, Int_t det) :
-  Reve::RenderElementListBase(), TRDModule(typ, det)
+  Reve::RenderElement(), TRDModule(typ, det)
 {
 }
 
@@ -83,16 +83,16 @@ void TRDNode::Expand()
 //________________________________________________________
 void TRDNode::EnableListElements()
 {
-       SetRnrElement(kTRUE);
+       SetRnrSelf(kTRUE);
        TRDNode *node = 0x0;
        TRDChamber *chmb = 0x0; 
        List_i iter = fChildren.begin();
        while(iter != fChildren.end()){
                if((node = dynamic_cast<TRDNode*>(*iter))){
-                       node->SetRnrElement(kTRUE);
+                       node->SetRnrSelf(kTRUE);
                        node->EnableListElements();
                }
-               if((chmb = dynamic_cast<TRDChamber*>(*iter))) chmb->SetRnrElement(kTRUE);
+               if((chmb = dynamic_cast<TRDChamber*>(*iter))) chmb->SetRnrSelf(kTRUE);
                iter++;
        }
        gReve->Redraw3D();
@@ -101,16 +101,16 @@ void TRDNode::EnableListElements()
 //________________________________________________________
 void TRDNode::DisableListElements()
 {
-       SetRnrElement(kFALSE);
+       SetRnrSelf(kFALSE);
        TRDNode *node = 0x0;
        TRDChamber *chmb = 0x0; 
        List_i iter = fChildren.begin();
        while(iter != fChildren.end()){
                if((node = dynamic_cast<TRDNode*>(*iter))){
-                       node->SetRnrElement(kFALSE);
+                       node->SetRnrSelf(kFALSE);
                        node->DisableListElements();
                }
-               if((chmb = dynamic_cast<TRDChamber*>(*iter))) chmb->SetRnrElement(kFALSE);
+               if((chmb = dynamic_cast<TRDChamber*>(*iter))) chmb->SetRnrSelf(kFALSE);
                iter++;
        }
        gReve->Redraw3D();
@@ -370,7 +370,7 @@ void TRDChamber::LoadTracklets(TObjArray *tracks)
 void   TRDChamber::Paint(Option_t* option)
 {
 /*     Info("Paint()", Form("%s", GetName()));*/
-       if(!fRnrElement) return;
+       if(!fRnrSelf) return;
        if(fDigits && fRnrDigits){
                if(kDigitsNeedRecompute){
                        fDigits->ComputeRepresentation();
index 5e98d83..63a2ce5 100644 (file)
@@ -73,7 +73,7 @@ namespace Alieve {
        };
 
        
-       class TRDNode : public Reve::RenderElementListBase, public TRDModule
+       class TRDNode : public Reve::RenderElement, public TRDModule
        {
        public:
                TRDNode(const char *typ, Int_t det=0);
index 8905dc0..22fcbb3 100644 (file)
@@ -1,6 +1,6 @@
 // $Id$
 
-Reve::PointSet* clusters_from_index(Int_t index=0)
+Reve::PointSet* clusters_from_index(Int_t index=0, RenderElement* cont=0)
 {
   AliESD* esd = Alieve::Event::AssertESD();
 
@@ -18,20 +18,27 @@ Reve::PointSet* clusters_from_index(Int_t index=0)
   clusters->SetOwnIds(kTRUE);
 
   AliESDtrack* at = esd->GetTrack(index);
-    const AliTrackPointArray* pArr = at->GetTrackPointArray();
-    if (pArr == 0) {
-      Warning("clusters_from_index", "TrackPointArray not stored with ESD track.");
-      continue;
-    }
-    Int_t np =  pArr->GetNPoints();
-    const Float_t* x = pArr->GetX();
-    const Float_t* y = pArr->GetY();
-    const Float_t* z = pArr->GetZ();
-    for (Int_t i=0; i<np; ++i) {
-      clusters->SetNextPoint(x[i], y[i], z[i]);
-      AliTrackPoint *atp = new AliTrackPoint;
-      pArr->GetPoint(*atp, i);
-      clusters->SetPointId(atp);    }
+  const AliTrackPointArray* pArr = at->GetTrackPointArray();
+  if (pArr == 0) {
+    Warning("clusters_from_index", "TrackPointArray not stored with ESD track.");
+    continue;
+  }
+  Int_t np =  pArr->GetNPoints();
+  const Float_t* x = pArr->GetX();
+  const Float_t* y = pArr->GetY();
+  const Float_t* z = pArr->GetZ();
+  for (Int_t i=0; i<np; ++i) {
+    clusters->SetNextPoint(x[i], y[i], z[i]);
+    AliTrackPoint *atp = new AliTrackPoint;
+    pArr->GetPoint(*atp, i);
+    clusters->SetPointId(atp);    }
+
+  
+  if(clusters->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
+    Warning("clusters_from_index", Form("No clusters for index '%d'", index));
+    delete clusters;
+    return 0;
+  }
 
   clusters->SetMarkerStyle(2);
   clusters->SetMarkerSize(0.5);
@@ -45,6 +52,10 @@ Reve::PointSet* clusters_from_index(Int_t index=0)
   sprintf(form,"Clusters idx=%d", index);
   clusters->SetName(form);
 
+  char tip[1000];
+  sprintf(tip,"N=%d", clusters->Size());
+  clusters->SetTitle(tip);
+
   using namespace Reve;
   gReve->AddRenderElement(clusters);
   gReve->Redraw3D();
index 8b621dc..12d075a 100644 (file)
@@ -1,6 +1,6 @@
 // $Id$
 
-Reve::PointSet* clusters_from_label(Int_t label=0)
+Reve::PointSet* clusters_from_label(Int_t label=0, RenderElement* cont=0)
 {
   AliESD* esd = Alieve::Event::AssertESD();
   Reve::PointSet* clusters = new Reve::PointSet(64);
@@ -27,6 +27,13 @@ Reve::PointSet* clusters_from_label(Int_t label=0)
       }
     }
   }
+
+  if(clusters->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
+    Warning("clusters_from_label", Form("No clusters match label '%d'", label));
+    delete clusters;
+    return 0;
+  }
+
   clusters->SetMarkerStyle(2);
   clusters->SetMarkerSize(0.5);
   clusters->SetMarkerColor(4);
@@ -38,8 +45,15 @@ Reve::PointSet* clusters_from_label(Int_t label=0)
   sprintf(form,"Clusters lab=%d", label);
   clusters->SetName(form);
 
+  char tip[1000];
+  sprintf(tip,"N=%d", clusters->Size());
+  clusters->SetTitle(tip);
+
   using namespace Reve;
-  gReve->AddRenderElement(clusters);
+  if(cont)
+    gReve->AddRenderElement(cont, clusters);
+  else
+    gReve->AddRenderElement(clusters);
   gReve->Redraw3D();
 
   return clusters;
index 6e91f0d..0526d1f 100644 (file)
@@ -6,7 +6,7 @@ void geom_rich()
 
   gGeoManager = gReve->GetGeometry("$REVESYS/alice-data/alice_fullgeo.root");
 
-  Reve::RenderElementList* list = new Reve::RenderElementList("HMPID");
+  Reve::RenderElementList* list = new Reve::RenderElementList("RICH");
   gReve->AddGlobalRenderElement(list);
 
   for(Int_t i=1; i<=7; ++i) {
@@ -15,7 +15,7 @@ void geom_rich()
     //PH on some platforms (alphalinuxgcc, solariscc5, etc.)
     //PH TGeoNode* node = gGeoManager->GetTopVolume()->FindNode(Form("HMPID_%d", i));
     char form[1000];
-    sprintf(form,"HMPID_%d", i);
+    sprintf(form,"RICH_%d", i);
     TGeoNode* node = gGeoManager->GetTopVolume()->FindNode(form);
 
     Reve::GeoTopNodeRnrEl* re = new Reve::GeoTopNodeRnrEl(gGeoManager, node);
index 420c13c..29c242e 100644 (file)
@@ -1,6 +1,6 @@
 // $Id$
 
-void hits_from_label(Int_t label=0)
+void hits_from_label(Int_t label=0, RenderElement* cont)
 {
   Reve::PointSet* h;
   Reve::LoadMacro("its_hits.C");
@@ -10,24 +10,24 @@ void hits_from_label(Int_t label=0)
   //PH  h = its_hits("fX:fY:fZ", Form("ITS.fTrack==%d", label));
   char form[1000];
   sprintf(form,"ITS.fTrack==%d", label);
-  h = its_hits("fX:fY:fZ", form);
+  h = its_hits("fX:fY:fZ", form, cont);
   if(h) h->SetMarkerSize(1);
 
   Reve::LoadMacro("tpc_hits.C");
   sprintf(form,"TPC2.fArray.fTrackID==%d", label);
-  h = tpc_hits("TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ",form);
+  h = tpc_hits("TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ",form, cont);
   //PH  h = tpc_hits("TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ",
   //PH        Form("TPC2.fArray.fTrackID==%d", label));
   if(h) h->SetMarkerSize(1);
 
   Reve::LoadMacro("trd_hits.C");
   sprintf(form,"TRD.fTrack==%d", label);
-  h = trd_hits("fX:fY:fZ", form);
+  h = trd_hits("fX:fY:fZ", form, cont);
   if(h) h->SetMarkerSize(1);
 
   Reve::LoadMacro("tof_hits.C");
   sprintf(form,"TOF.fTrack==%d", label);
-  h = tof_hits("fX:fY:fZ", form);
+  h = tof_hits("fX:fY:fZ", form, cont);
   if(h) h->SetMarkerSize(1);
 
   gReve->Redraw3D();
index 1741b14..1f57d39 100644 (file)
@@ -2,7 +2,8 @@
 
 Reve::PointSet*
 its_hits(const char *varexp    = "fX:fY:fZ",
-        const char *selection = "")
+        const char *selection = "",
+         Reve::RenderElement* cont = 0)
 {
   AliRunLoader* rl =  Alieve::Event::AssertRunLoader();
   rl->LoadHits("ITS");
@@ -20,7 +21,7 @@ its_hits(const char *varexp    = "fX:fY:fZ",
   TPointSelector ps(ht, points, varexp, selection);
   ps.Select();
 
-  if( points->Size() == 0) {
+  if(points->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
     Warning("its_hits", Form("No hits match '%s'", selection));
     delete points;
     return 0;
@@ -32,7 +33,10 @@ its_hits(const char *varexp    = "fX:fY:fZ",
   points->SetMarkerSize(.5);
   points->SetMarkerColor((Color_t)2);
 
-  gReve->AddRenderElement(points);
+  if(cont)
+    gReve->AddRenderElement(cont, points);
+  else 
+    gReve->AddRenderElement(points);
   gReve->Redraw3D();
 
   return points;
index b33cd36..01170a7 100644 (file)
@@ -118,11 +118,12 @@ Color_t get_pdg_color(Int_t pdg){
 
 // Create mother and daughters tracks with given label.
 
-Reve::TrackList*
+Reve::RenderElement*
 kine_track(Int_t  label,
           Bool_t import_mother    = kTRUE,
-          Bool_t import_daughters = kTRUE,
-          Reve::TrackList*   cont = 0)
+           Bool_t import_daughters = kTRUE,
+           Reve::RenderElement*    cont = 0)
+
 {
   if (label < 0) {
     Warning("kine_track", "label not set.");
@@ -136,6 +137,10 @@ kine_track(Int_t  label,
 
   if (import_mother || (import_daughters && p->GetNDaughters()))
   {
+    Track* toptrack = 0;
+    TrackList* tracklist = 0;  
+    TrackRnrStyle* rs = 0;
+
     if (cont == 0)
     {
       cont = new TrackList(Form("Kinematics of %d", label, p->GetNDaughters()));
@@ -145,21 +150,41 @@ kine_track(Int_t  label,
       rnrStyle->SetMagField( - gAlice->Field()->SolenoidField() );
       char tooltip[1000];
       sprintf(tooltip,"Ndaughters=%d", p->GetNDaughters());
-      cont->SetTitle(tooltip);  
+      cont->SetTitle(tooltip);
       cont->SelectByPt(0.2, 100);
-      rnrStyle->fColor   = 8;  
-      rnrStyle->fMaxOrbs = 8;  
+      rnrStyle->fColor   = 8;
+      rnrStyle->fMaxOrbs = 8;
       cont->SetEditPathMarks(kTRUE);
       gReve->AddRenderElement(cont);
+      rs = cont->GetRnrStyle();
+    }
+    else {
+      // check if argument is TrackList
+      Reve::Track* t = dynamic_cast<Reve::Track*>(cont);
+      if(t) 
+      {
+       rs = t->GetRnrStyle();
+      }
+      else {
+        Reve::TrackList* l = dynamic_cast<Reve::TrackList*>(cont);
+        if(l)
+       {
+         rs = l->GetRnrStyle();
+       }
+        else {
+         Error("kine_tracks.C", "TrackRenderStyle not set.");
+       }
+      }
     }
-   
+
     if (import_mother)
     {
-      Track* track = new Reve::Track(p, label, cont->GetRnrStyle());  
+      Track* track = new Reve::Track(p, label, rs);  
       char form[1000];
       sprintf(form,"%s [%d]", p->GetName(), label);
       track->SetName(form);
       gReve->AddRenderElement(cont, track);
+
     }
 
     if (import_daughters && p->GetNDaughters()) 
@@ -167,30 +192,18 @@ kine_track(Int_t  label,
       for (int d=p->GetFirstDaughter(); d>0 && d<=p->GetLastDaughter(); ++d) 
       {        
        TParticle* dp = stack->Particle(d);
-       Track* track = new Reve::Track(dp, d, cont->GetRnrStyle());  
+       Track* track = new Reve::Track(dp, d, rs);  
        char form[1000];
        sprintf(form,"%s [%d]", dp->GetName(), d);
        track->SetName(form);
+        track->MakeTrack();
        gReve->AddRenderElement(cont, track);
       }
     }
   }
 
-  if (cont)
-  {
-    // set path marks
-    if(cont->GetEditPathMarks())
-    {
-      Alieve::KineTools kt; 
-      rl->LoadTrackRefs();
-      kt.SetPathMarks(cont, stack, rl->TreeTR());
-    }
-    // update list tree
-    cont->UpdateItems();
-    cont->MakeTracks();
-    cont->MakeMarkers();
-  }
-
+  cont->UpdateItems();
   gReve->Redraw3D();
   return cont;
 }
+
index aa51741..b8ee2a2 100644 (file)
@@ -2,7 +2,8 @@
 
 Reve::PointSet*
 tof_hits(const char *varexp    = "fX:fY:fZ",
-        const char *selection = "")
+        const char *selection = "",
+        Reve::RenderElement* cont)
 {
   AliRunLoader* rl =  Alieve::Event::AssertRunLoader();
   rl->LoadHits("TOF");
@@ -20,7 +21,7 @@ tof_hits(const char *varexp    = "fX:fY:fZ",
   TPointSelector ps(ht, points, varexp, selection);
   ps.Select();
 
-  if( points->Size() == 0) {
+  if( points->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
     Warning("tof_hits", Form("No hits match '%s'", selection));
     delete points;
     return 0;
@@ -32,7 +33,11 @@ tof_hits(const char *varexp    = "fX:fY:fZ",
   points->SetMarkerSize(.5);
   points->SetMarkerColor((Color_t)2);
 
-  gReve->AddRenderElement(points);
+ if(cont)
+    gReve->AddRenderElement(cont, points);
+  else 
+    gReve->AddRenderElement(points);
+
   gReve->Redraw3D();
 
   return points;
index 8e9f1f4..8282e73 100644 (file)
@@ -2,7 +2,8 @@
 
 Reve::PointSet*
 tpc_hits(const char *varexp    = "TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ",
-        const char *selection = "TPC2.fArray.fR>80")
+        const char *selection = "TPC2.fArray.fR>80",
+         RenderElement* cont = 0)
 {
   // Extracts 'major' TPC hits (not the compressed ones).
   // This gives ~2.5% of all hits.
@@ -24,7 +25,7 @@ tpc_hits(const char *varexp    = "TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ"
   TPointSelector ps(ht, points, varexp, selection);
   ps.Select();
 
-  if (points->Size() == 0) {
+  if (points->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
     Warning("tpc_hits", Form("No hits match '%s'", selection));
     delete points;
     return 0;
@@ -36,7 +37,11 @@ tpc_hits(const char *varexp    = "TPC2.fArray.fR:TPC2.fArray.fFi:TPC2.fArray.fZ"
   points->SetMarkerSize(.5);
   points->SetMarkerColor((Color_t)3);
 
-  gReve->AddRenderElement(points);
+  if(cont)
+    gReve->AddRenderElement(cont, points);
+  else 
+    gReve->AddRenderElement(points);
+
   gReve->Redraw3D();
 
   return points;
index 26f1179..dd20664 100644 (file)
@@ -2,7 +2,8 @@
 
 Reve::PointSet*
 trd_hits(const char *varexp    = "fX:fY:fZ",
-        const char *selection = "")
+        const char *selection = "",
+        RenderElement* cont = 0)
 {
   AliRunLoader* rl =  Alieve::Event::AssertRunLoader();
   rl->LoadHits("TRD");
@@ -20,7 +21,7 @@ trd_hits(const char *varexp    = "fX:fY:fZ",
   TPointSelector ps(ht, points, varexp, selection);
   ps.Select();
 
-  if (points->Size() == 0) {
+  if (points->Size() == 0 && gReve->GetKeepEmptyCont() == kFALSE) {
     Warning("trd_hits", Form("No hits match '%s'", selection));
     delete points;
     return 0;
@@ -32,7 +33,11 @@ trd_hits(const char *varexp    = "fX:fY:fZ",
   points->SetMarkerSize(.5);
   points->SetMarkerColor((Color_t)7);
 
-  gReve->AddRenderElement(points);
+  if(cont)
+    gReve->AddRenderElement(cont, points);
+  else 
+    gReve->AddRenderElement(points);
+
   gReve->Redraw3D();
 
   return points;