2 // How to steer the basic TRD data containers from a macro.
4 // The loading and looping over events is performed by the
5 // AliEve mechanism. For a stand alone TRD loop control check
6 // the macro "trd_loader.C"
9 // .x trd_detectors.C(sector)
12 // Alex Bercuci (A.Bercuci@gsi.de)
18 #include <TEveManager.h>
19 #include <TEvePointSet.h>
20 #include <EveBase/AliEveEventManager.h>
22 #include "AliRunLoader.h"
23 #include "AliCluster.h"
24 #include "AliTRDcluster.h"
27 TEveElementList* trd_detectors(Int_t sector = -1, TEveElement *cont = 0)
29 // Link data containers
30 AliCDBManager *fCDBManager=AliCDBManager::Instance();
31 fCDBManager->SetDefaultStorage("local://$ALICE_ROOT");
32 fCDBManager->SetRun(0);
34 TGeoManager *gGeoManager = AliEveEventManager::AssertGeometry();
36 AliRunLoader *rl = AliEveEventManager::AssertRunLoader();
38 // define EVE containers
39 TEveElementList *list = new TEveElementList("TRD Detectors");
41 AliTRDgeometry *geo = new AliTRDgeometry();
42 //geo->CreateClusterMatrixArray();
44 AliEveTRDNode *sm = 0x0, *stk = 0x0;
45 AliEveTRDChamber *chm=0x0;
47 // Link TRD containers
48 TObjArray *clusters = 0x0;
49 rl->LoadRecPoints("TRD");
50 TTree *tR = rl->GetTreeR("TRD", kFALSE);
51 tR->SetBranchAddress("TRDcluster", &clusters);
53 rl->LoadDigits("TRD");
54 TTree *tD = rl->GetTreeD("TRD", kFALSE);
55 AliTRDdigitsManager dm; dm.ReadDigits(tD);
57 for(Int_t i=0; i<tR->GetEntries(); i++) {
58 if (!tR->GetEvent(i)) continue;
59 if(!clusters->GetEntries()) continue;
60 Int_t icl=0; AliTRDcluster *c = 0x0;
61 while(!(c = (AliTRDcluster*)clusters->UncheckedAt(icl++))) {;}
64 Int_t idet, ism, istk, ipla;
65 idet = c->GetDetector();
66 ism = geo->GetSector(idet);
67 istk = geo->GetStack(idet);
68 ipla = geo->GetLayer(idet);
69 if(sector>=0 && ism != sector) continue;
70 if(!(sm = list->FindChild(Form("SM%03d", ism)))){
71 list->AddElement(sm = new AliEveTRDNode("SM", ism));
72 sm->SetElementTitle(Form("Supermodule %2d", ism));
74 if(!(stk=sm->FindChild(Form("Stack%03d", istk)))){
75 sm->AddElement(stk = new AliEveTRDNode("Stack", istk));
76 stk->SetElementTitle(Form("SM %2d Stack %1d", ism, istk));
78 stk->AddElement(chm = new AliEveTRDChamber(idet));
79 chm->SetGeometry(geo);
80 chm->LoadClusters(clusters);
86 gEve->AddElement(list, cont);