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 #include <Riostream.h>
28 class AliEveEMCALData;
29 AliEveEMCALData *emcal_data = 0;
31 void emcal_all(const UInt_t evtNum = 0, Bool_t digFile = 0,
32 const UInt_t eventsToProcess = 5, TString dirName = "./",
33 const TString esdTreeName = "esdTree", const char * pattern = ".")
43 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
44 // runloader check already in AssertRunLoader function
45 AliESDEvent* esd = 0x0;
46 if(iESD) esd = AliEveEventManager::AssertESD();
47 // esd check already in AssertESD function
48 AliEMCALLoader *emcl = dynamic_cast<AliEMCALLoader*> (rl->GetDetectorLoader("EMCAL"));
49 Int_t evtID = AliEveEventManager::GetMaster()->GetEventId();
50 if(evtID != evtNum) AliEveEventManager::GetMaster()->GotoEvent(evtNum);
59 if(!rl->LoadHits("EMCAL"))
60 ht = rl->GetTreeH("EMCAL",false);
61 else {printf("Please make sure a have a EMCal.Hits.root file \n"); return;}
65 if(!rl->LoadDigits("EMCAL"))
66 dt = rl->GetTreeD("EMCAL",false);
67 else {printf("Please make sure a have a EMCal.Digits.root file \n"); return;}
71 if(!rl->LoadRecPoints("EMCAL"))
72 rt = rl->GetTreeR("EMCAL",false);
73 else {printf("Please make sure a have a EMCal.RecPoints.root file \n"); return;}
77 gGeoManager = gEve->GetDefaultGeometry();
78 TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
79 TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
80 emcal_data = new AliEveEMCALData(rl,node,m);
81 if(iESD) emcal_data->SetESD(esd);
83 // Get information from RunLoader
86 if(iHits) emcal_data->LoadHits(ht); // Does not work with my aliroot version
87 if(iDigits) emcal_data->LoadDigits(dt);
88 if(iClusters) emcal_data->LoadRecPoints(rt);
92 if(iHits) emcal_data->LoadHitsFromEMCALLoader(emcl);
93 if(iDigits) emcal_data->LoadDigitsFromEMCALLoader(emcl);
94 if(iClusters) emcal_data->LoadRecPointsFromEMCALLoader(emcl);
97 // Get information from ESDs
100 rl->GetEvent(evtNum);
101 if(iDigits) emcal_data->LoadDigitsFromESD();
102 if(iClusters) emcal_data->LoadRecPointsFromESD();
105 gStyle->SetPalette(1, 0);
107 gEve->DisableRedraw();
109 TEveElementList* l = new TEveElementList("EMCAL");
110 l->SetTitle("Tooltip");
111 l->SetMainColor(Color_t(2));
114 for (Int_t sm=0; sm<12; sm++)
116 AliEveEMCALSModule* esm = new AliEveEMCALSModule(sm,Form("SM %d Element \n", sm),"test");
117 // esm->SetSModuleID(sm);
118 esm->SetDataSource(emcal_data);
123 gEve->Redraw3D(kTRUE);
125 gEve->EnableRedraw();