]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/emcal_all.C
Coverity
[u/mrichter/AliRoot.git] / EVE / alice-macros / emcal_all.C
CommitLineData
c3e34498 1//************************************************************************
2// A macro to read and visualize EMCAL data
3// The macro:
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
18//
19//************************************************************************
20// Author: Magali Estienne (magali.estienne@cern.ch)
21// June 30 2008
22//************************************************************************
23
24#include <Riostream.h>
25#include <TMath.h>
26
27
28class AliEveEMCALData;
29AliEveEMCALData *emcal_data = 0;
30
31void 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 = ".")
34{
864cb96e 35
36 Int_t iLoader = 1;
37 Int_t iESD = 1;
38 Int_t iAOD = 0;
39 Int_t iHits = 1;
40 Int_t iDigits = 1;
41 Int_t iClusters = 1;
42
c3e34498 43 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
864cb96e 44 // runloader check already in AssertRunLoader function
45 AliESDEvent* esd = 0x0;
46 if(iESD) esd = AliEveEventManager::AssertESD();
47 // esd check already in AssertESD function
c3e34498 48 AliEMCALLoader *emcl = dynamic_cast<AliEMCALLoader*> (rl->GetDetectorLoader("EMCAL"));
4d62585e 49 Int_t evtID = AliEveEventManager::GetMaster()->GetEventId();
50 if(evtID != evtNum) AliEveEventManager::GetMaster()->GotoEvent(evtNum);
c3e34498 51
864cb96e 52 TTree* ht = 0x0;
53 TTree* dt = 0x0;
54 TTree* rt = 0x0;
55 if(iLoader)
56 {
57 //Load Hits
58 if(iHits) {
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;}
62 }
63 //Load Digits
64 if(iDigits) {
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;}
68 }
69 //Load RecPoints
70 if(iClusters) {
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;}
74 }
75 }
c3e34498 76
b556ee7d 77 // gGeoManager = gEve->GetDefaultGeometry();
78 AliEveEventManager::AssertGeometry();
c3e34498 79 TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
80 TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
81 emcal_data = new AliEveEMCALData(rl,node,m);
864cb96e 82 if(iESD) emcal_data->SetESD(esd);
83
84 // Get information from RunLoader
85 if(iLoader)
86 {
87 if(iHits) emcal_data->LoadHits(ht); // Does not work with my aliroot version
88 if(iDigits) emcal_data->LoadDigits(dt);
89 if(iClusters) emcal_data->LoadRecPoints(rt);
90
91 rl->GetEvent(evtNum);
92
93 if(iHits) emcal_data->LoadHitsFromEMCALLoader(emcl);
94 if(iDigits) emcal_data->LoadDigitsFromEMCALLoader(emcl);
95 if(iClusters) emcal_data->LoadRecPointsFromEMCALLoader(emcl);
96 }
97
98 // Get information from ESDs
99 if(iESD)
100 {
101 rl->GetEvent(evtNum);
102 if(iDigits) emcal_data->LoadDigitsFromESD();
103 if(iClusters) emcal_data->LoadRecPointsFromESD();
104 }
c3e34498 105
106 gStyle->SetPalette(1, 0);
107
108 gEve->DisableRedraw();
109
110 TEveElementList* l = new TEveElementList("EMCAL");
111 l->SetTitle("Tooltip");
112 l->SetMainColor(Color_t(2));
113 gEve->AddElement(l);
114
115 for (Int_t sm=0; sm<12; sm++)
116 {
c3e34498 117 AliEveEMCALSModule* esm = new AliEveEMCALSModule(sm,Form("SM %d Element \n", sm),"test");
118 // esm->SetSModuleID(sm);
119 esm->SetDataSource(emcal_data);
c3e34498 120 esm->UpdateQuads();
121 l->AddElement(esm);
122 }
123
124 gEve->Redraw3D(kTRUE);
125
126 gEve->EnableRedraw();
a312477b 127
128
c3e34498 129}