]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EVE/alice-macros/emcal_all.C
doxy: code cleanup: comments and clarifications
[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//************************************************************************
c757605d 23
ba978640 24#if !defined(__CINT__) || defined(__MAKECINT__)
c3e34498 25#include <Riostream.h>
ba978640 26#include <TGeoManager.h>
27#include <TGeoNode.h>
28#include <TGeoMatrix.h>
c3e34498 29#include <TMath.h>
ba978640 30#include <TString.h>
31#include <TTree.h>
32#include <TStyle.h>
33#include <TEveManager.h>
34#include <TEveElement.h>
35#include <TEvePointSet.h>
c3e34498 36
6c49a8e1 37#include <AliEMCAL.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>
ba978640 47#else
c3e34498 48class AliEveEMCALData;
ba978640 49#endif
50
c3e34498 51AliEveEMCALData *emcal_data = 0;
52
6c49a8e1 53void emcal_all(const UInt_t evtNum = 0)/*, Bool_t digFile = 0,
c3e34498 54 const UInt_t eventsToProcess = 5, TString dirName = "./",
6c49a8e1 55 const TString esdTreeName = "esdTree", const char * pattern = ".")*/
c3e34498 56{
864cb96e 57
58 Int_t iLoader = 1;
59 Int_t iESD = 1;
864cb96e 60 Int_t iHits = 1;
61 Int_t iDigits = 1;
62 Int_t iClusters = 1;
63
c3e34498 64 AliRunLoader* rl = AliEveEventManager::AssertRunLoader();
864cb96e 65 // runloader check already in AssertRunLoader function
66 AliESDEvent* esd = 0x0;
67 if(iESD) esd = AliEveEventManager::AssertESD();
68 // esd check already in AssertESD function
c3e34498 69 AliEMCALLoader *emcl = dynamic_cast<AliEMCALLoader*> (rl->GetDetectorLoader("EMCAL"));
4d62585e 70 Int_t evtID = AliEveEventManager::GetMaster()->GetEventId();
6c49a8e1 71 if(evtID != (Int_t)evtNum) AliEveEventManager::GetMaster()->GotoEvent(evtNum);
c3e34498 72
864cb96e 73 TTree* ht = 0x0;
74 TTree* dt = 0x0;
75 TTree* rt = 0x0;
76 if(iLoader)
77 {
78 //Load Hits
79 if(iHits) {
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;}
83 }
84 //Load Digits
85 if(iDigits) {
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;}
89 }
90 //Load RecPoints
91 if(iClusters) {
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;}
95 }
96 }
c3e34498 97
b556ee7d 98 // gGeoManager = gEve->GetDefaultGeometry();
99 AliEveEventManager::AssertGeometry();
c3e34498 100 TGeoNode* node = gGeoManager->GetTopVolume()->FindNode("XEN1_1");
101 TGeoHMatrix* m = gGeoManager->GetCurrentMatrix();
102 emcal_data = new AliEveEMCALData(rl,node,m);
864cb96e 103 if(iESD) emcal_data->SetESD(esd);
104
105 // Get information from RunLoader
106 if(iLoader)
107 {
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);
111
112 rl->GetEvent(evtNum);
113
114 if(iHits) emcal_data->LoadHitsFromEMCALLoader(emcl);
115 if(iDigits) emcal_data->LoadDigitsFromEMCALLoader(emcl);
116 if(iClusters) emcal_data->LoadRecPointsFromEMCALLoader(emcl);
117 }
118
119 // Get information from ESDs
120 if(iESD)
121 {
122 rl->GetEvent(evtNum);
123 if(iDigits) emcal_data->LoadDigitsFromESD();
124 if(iClusters) emcal_data->LoadRecPointsFromESD();
125 }
c3e34498 126
127 gStyle->SetPalette(1, 0);
128
129 gEve->DisableRedraw();
130
131 TEveElementList* l = new TEveElementList("EMCAL");
132 l->SetTitle("Tooltip");
133 l->SetMainColor(Color_t(2));
134 gEve->AddElement(l);
135
136 for (Int_t sm=0; sm<12; sm++)
137 {
c3e34498 138 AliEveEMCALSModule* esm = new AliEveEMCALSModule(sm,Form("SM %d Element \n", sm),"test");
139 // esm->SetSModuleID(sm);
140 esm->SetDataSource(emcal_data);
c3e34498 141 esm->UpdateQuads();
142 l->AddElement(esm);
143 }
144
145 gEve->Redraw3D(kTRUE);
146
147 gEve->EnableRedraw();
a312477b 148
149
c3e34498 150}