1 //************************************************************************
2 // A macro to read and visualize EMCAL data
4 // - can read hits, digits and clusters information from AliRunLoader:
5 // emcal_data->LoadHits(ht);
6 // emcal_data->LoadDigits(dt);
7 // emcal_data->LoadRecPoints(rt);
8 // - can read hits, digits and clusters information from AliEMCALLoader:
9 // rl->GetEvent(evtNum);
10 // emcal_data->LoadHitsFromEMCALLoader(emcl); // Does not work
11 // emcal_data->LoadDigitsFromEMCALLoader(emcl);
12 // emcal_data->LoadRecPointsFromEMCALLoader(emcl);
13 // - can read hits, digits and clusters information from ESDs
14 // emcal_data->LoadDigitsFromESD();
15 // emcal_data->LoadClustersFromESD();
16 // - will read hits, digits and clusters information from raw
17 // => To be implemented
19 //************************************************************************
20 // Author: Magali Estienne (magali.estienne@cern.ch)
22 //************************************************************************
24 #if !defined(__CINT__) || defined(__MAKECINT__)
25 #include <Riostream.h>
26 #include <TGeoManager.h>
28 #include <TGeoMatrix.h>
33 #include <TEveManager.h>
34 #include <TEveElement.h>
35 #include <TEvePointSet.h>
38 #include <AliEMCALLoader.h>
39 #include <AliESDEvent.h>
40 #include <AliESDtrack.h>
41 #include <AliTrackPointArray.h>
42 #include <AliRunLoader.h>
43 #include <AliEveEventManager.h>
44 #include <AliEveMultiView.h>
45 #include <AliEveEMCALData.h>
46 #include <AliEveEMCALSModule.h>
48 class AliEveEMCALData;
51 AliEveEMCALData *emcal_data = 0;
53 void emcal_all(const UInt_t evtNum = 0)/*, Bool_t digFile = 0,
54 const UInt_t eventsToProcess = 5, TString dirName = "./",
55 const TString esdTreeName = "esdTree", const char * pattern = ".")*/
64 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
65 // runloader check already in AssertRunLoader function
66 AliESDEvent* esd = 0x0;
67 if(iESD) esd = AliEveEventManager::AssertESD();
68 // esd check already in AssertESD function
69 AliEMCALLoader *emcl = dynamic_cast<AliEMCALLoader*> (rl->GetDetectorLoader("EMCAL"));
70 Int_t evtID = AliEveEventManager::GetMaster()->GetEventId();
71 if(evtID != (Int_t)evtNum) AliEveEventManager::GetMaster()->GotoEvent(evtNum);
80 if(!rl->LoadHits("EMCAL"))
81 ht = rl->GetTreeH("EMCAL",false);
82 else {printf("Please make sure a have a EMCal.Hits.root file \n"); return;}
86 if(!rl->LoadDigits("EMCAL"))
87 dt = rl->GetTreeD("EMCAL",false);
88 else {printf("Please make sure a have a EMCal.Digits.root file \n"); return;}
92 if(!rl->LoadRecPoints("EMCAL"))
93 rt = rl->GetTreeR("EMCAL",false);
94 else {printf("Please make sure a have a EMCal.RecPoints.root file \n"); return;}
98 // gGeoManager = gEve->GetDefaultGeometry();
99 AliEveEventManager::AssertGeometry();
100 TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
101 TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
102 emcal_data = new AliEveEMCALData(rl,node,m);
103 if(iESD) emcal_data->SetESD(esd);
105 // Get information from RunLoader
108 if(iHits) emcal_data->LoadHits(ht); // Does not work with my aliroot version
109 if(iDigits) emcal_data->LoadDigits(dt);
110 if(iClusters) emcal_data->LoadRecPoints(rt);
112 rl->GetEvent(evtNum);
114 if(iHits) emcal_data->LoadHitsFromEMCALLoader(emcl);
115 if(iDigits) emcal_data->LoadDigitsFromEMCALLoader(emcl);
116 if(iClusters) emcal_data->LoadRecPointsFromEMCALLoader(emcl);
119 // Get information from ESDs
122 rl->GetEvent(evtNum);
123 if(iDigits) emcal_data->LoadDigitsFromESD();
124 if(iClusters) emcal_data->LoadRecPointsFromESD();
127 gStyle->SetPalette(1, 0);
129 gEve->DisableRedraw();
131 TEveElementList* l = new TEveElementList("EMCAL");
132 l->SetTitle("Tooltip");
133 l->SetMainColor(Color_t(2));
136 for (Int_t sm=0; sm<12; sm++)
138 AliEveEMCALSModule* esm = new AliEveEMCALSModule(sm,Form("SM %d Element \n", sm),"test");
139 // esm->SetSModuleID(sm);
140 esm->SetDataSource(emcal_data);
145 gEve->Redraw3D(kTRUE);
147 gEve->EnableRedraw();