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 //************************************************************************
23 #if !defined(__CINT__) || defined(__MAKECINT__)
24 #include <Riostream.h>
25 #include <TGeoManager.h>
27 #include <TGeoMatrix.h>
32 #include <TEveManager.h>
33 #include <TEveElement.h>
34 #include <TEvePointSet.h>
36 #include <EMCAL/AliEMCAL.h>
37 #include <EMCAL/AliEMCALLoader.h>
38 #include <STEER/ESD/AliESDEvent.h>
39 #include <STEER/ESD/AliESDtrack.h>
40 #include <STEER/ESD/AliTrackPointArray.h>
41 #include <STEER/STEER/AliRunLoader.h>
42 #include <EVE/EveBase/AliEveEventManager.h>
43 #include <EVE/EveBase/AliEveMultiView.h>
44 #include <EVE/EveDet/AliEveEMCALData.h>
45 #include <EVE/EveDet/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 = ".")
65 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
66 // runloader check already in AssertRunLoader function
67 AliESDEvent* esd = 0x0;
68 if(iESD) esd = AliEveEventManager::AssertESD();
69 // esd check already in AssertESD function
70 AliEMCALLoader *emcl = dynamic_cast<AliEMCALLoader*> (rl->GetDetectorLoader("EMCAL"));
71 Int_t evtID = AliEveEventManager::GetMaster()->GetEventId();
72 if(evtID != evtNum) AliEveEventManager::GetMaster()->GotoEvent(evtNum);
81 if(!rl->LoadHits("EMCAL"))
82 ht = rl->GetTreeH("EMCAL",false);
83 else {printf("Please make sure a have a EMCal.Hits.root file \n"); return;}
87 if(!rl->LoadDigits("EMCAL"))
88 dt = rl->GetTreeD("EMCAL",false);
89 else {printf("Please make sure a have a EMCal.Digits.root file \n"); return;}
93 if(!rl->LoadRecPoints("EMCAL"))
94 rt = rl->GetTreeR("EMCAL",false);
95 else {printf("Please make sure a have a EMCal.RecPoints.root file \n"); return;}
99 // gGeoManager = gEve->GetDefaultGeometry();
100 AliEveEventManager::AssertGeometry();
101 TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
102 TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
103 emcal_data = new AliEveEMCALData(rl,node,m);
104 if(iESD) emcal_data->SetESD(esd);
106 // Get information from RunLoader
109 if(iHits) emcal_data->LoadHits(ht); // Does not work with my aliroot version
110 if(iDigits) emcal_data->LoadDigits(dt);
111 if(iClusters) emcal_data->LoadRecPoints(rt);
113 rl->GetEvent(evtNum);
115 if(iHits) emcal_data->LoadHitsFromEMCALLoader(emcl);
116 if(iDigits) emcal_data->LoadDigitsFromEMCALLoader(emcl);
117 if(iClusters) emcal_data->LoadRecPointsFromEMCALLoader(emcl);
120 // Get information from ESDs
123 rl->GetEvent(evtNum);
124 if(iDigits) emcal_data->LoadDigitsFromESD();
125 if(iClusters) emcal_data->LoadRecPointsFromESD();
128 gStyle->SetPalette(1, 0);
130 gEve->DisableRedraw();
132 TEveElementList* l = new TEveElementList("EMCAL");
133 l->SetTitle("Tooltip");
134 l->SetMainColor(Color_t(2));
137 for (Int_t sm=0; sm<12; sm++)
139 AliEveEMCALSModule* esm = new AliEveEMCALSModule(sm,Form("SM %d Element \n", sm),"test");
140 // esm->SetSModuleID(sm);
141 esm->SetDataSource(emcal_data);
146 gEve->Redraw3D(kTRUE);
148 gEve->EnableRedraw();