]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/emcal_all.C
Error codes for histogram booking taken with getters, no longer hard coded (D. Elia)
[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{
35 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
36 if (rl == 0x0)
37 cout<<"Can not instatiate the Run Loader"<<endl;
38 AliESDEvent* esd = AliEveEventManager::AssertESD();
39 AliEMCALLoader *emcl = dynamic_cast<AliEMCALLoader*> (rl->GetDetectorLoader("EMCAL"));
4d62585e 40 Int_t evtID = AliEveEventManager::GetMaster()->GetEventId();
41 if(evtID != evtNum) AliEveEventManager::GetMaster()->GotoEvent(evtNum);
c3e34498 42
43 //Load Hits
44 rl->LoadHits("EMCAL");
45 //Load Digits
46 rl->LoadDigits("EMCAL");
47 //Load RecPoints
48 rl->LoadRecPoints("EMCAL");
49
50 TTree* ht = rl->GetTreeH("EMCAL",false);
51 TTree* dt = rl->GetTreeD("EMCAL",false);
52 TTree *rt = rl->GetTreeR("EMCAL",false);
53
81515106 54 gGeoManager = gEve->GetDefaultGeometry();
c3e34498 55 TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
56 TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
57 emcal_data = new AliEveEMCALData(rl,node,m);
58 emcal_data->SetESD(esd);
59 // RunLoader information
a312477b 60// emcal_data->LoadHits(ht); // Does not work with my aliroot version ?
61// emcal_data->LoadDigits(dt);
62// emcal_data->LoadRecPoints(rt);
c3e34498 63
64 // To be uncommented if use of emcalLoader
a312477b 65 rl->GetEvent(evtNum);
66 emcal_data->LoadHitsFromEMCALLoader(emcl);
67// emcal_data->LoadDigitsFromEMCALLoader(emcl);
68// emcal_data->LoadRecPointsFromEMCALLoader(emcl);
c3e34498 69
70 // To be uncommented to read esds
a312477b 71 emcal_data->LoadDigitsFromESD();
72 emcal_data->LoadRecPointsFromESD();
c3e34498 73
74 gStyle->SetPalette(1, 0);
75
76 gEve->DisableRedraw();
77
78 TEveElementList* l = new TEveElementList("EMCAL");
79 l->SetTitle("Tooltip");
80 l->SetMainColor(Color_t(2));
81 gEve->AddElement(l);
82
83 for (Int_t sm=0; sm<12; sm++)
84 {
85 cout << "\n Form: " << Form("SM %d", sm) << endl;
86 AliEveEMCALSModule* esm = new AliEveEMCALSModule(sm,Form("SM %d Element \n", sm),"test");
87 // esm->SetSModuleID(sm);
88 esm->SetDataSource(emcal_data);
89 esm->ComputeBBox();
90 esm->UpdateQuads();
91 l->AddElement(esm);
92 }
93
94 gEve->Redraw3D(kTRUE);
95
96 gEve->EnableRedraw();
a312477b 97
98
c3e34498 99}