]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/macros/TestEMCALDigit.C
Changed dynamic range to 250 GeV
[u/mrichter/AliRoot.git] / EMCAL / macros / TestEMCALDigit.C
CommitLineData
79107cce 1
2
3// Test Macro, shows how to load Digits and Geometry, and how can we get
4// some of the parameters and variables.
5// Author: Gustavo Conesa
6
7void TestEMCALDigit()
8{
9
10 // Getting EMCAL Detector and Geometry.
11
12 AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),
13 "read");
14
15 if (rl == 0x0)
16 cout<<"Can not instatiate the Run Loader"<<endl;
17
18 rl->LoadgAlice();//Needed to get geometry
19
20 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>
21 (rl->GetDetectorLoader("EMCAL"));
22
23 //AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
24 //AliEMCALGeometry *geom = dynamic_cast<AliEMCAL*>(rl->GetAliRun()->GetDetector("EMCAL"))->GetGeometry();
25
26 AliRun * alirun = rl->GetAliRun(); // Needed to get Geometry
27 AliEMCAL * emcal = (AliEMCAL*)alirun->GetDetector("EMCAL");
28 AliEMCALGeometry * geom = emcal->GetGeometry();
29
30 if (geom==0)
31 cout<<"Did not get geometry from EMCALLoader"<<endl;
32
33 //Load Digits
34 rl->LoadDigits("EMCAL");
35
36 //Get maximum number of events
37 Int_t maxevent = rl->GetNumberOfEvents();
38 cout<<"Number of events "<<maxevent<<endl;
39 //maxevent = 1 ;
40
41 Int_t iEvent = -1 ;
42 Float_t amp = -1 ;
43 Float_t time = -1 ;
44 Int_t id = -1 ;
45 Int_t iSupMod = 0 ;
46 Int_t iTower = 0 ;
47 Int_t iIphi = 0 ;
48 Int_t iIeta = 0 ;
49 Int_t iphi = 0 ;
50 Int_t ieta = 0 ;
51
52
53 AliEMCALDigit * dig;
54
55 for ( iEvent=0; iEvent<maxevent; iEvent++)
56 {
57 cout << " ======> Event " << iEvent << endl ;
58 //Load Event
59 rl->GetEvent(iEvent);
60
61 //Fill array of digits
62 TClonesArray *digits = emcalLoader->Digits();
63
64 //Get digits from the list
65 for(Int_t idig = 0; idig< digits->GetEntries();idig++){
66 //cout<<">> idig "<<idig<<endl;
67 dig = static_cast<AliEMCALDigit *>(digits->At(idig)) ;
68
69 if(dig != 0){
70 id = dig->GetId() ; //cell (digit) label
71 amp = dig->GetAmp(); //amplitude in cell (digit)
72 time = dig->GetTime();//time of creation of digit after collision
73
74 cout<<"Cell ID "<<id<<" Amp "<<amp<<endl;//" time "<<time<<endl;
75
76 //Geometry methods
77 geom->GetCellIndex(id,iSupMod,iTower,iIphi,iIeta);
78 //Gives SuperModule and Tower numbers
79 geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,
80 iIphi, iIeta,iphi,ieta);
81 //Gives label of cell in eta-phi position per each supermodule
82
83 cout<< "SModule "<<iSupMod<<"; Tower "<<iTower
84 <<"; Eta "<<iIeta<<"; Phi "<<iIphi
85 <<"; Cell Eta "<<ieta<<"; Cell Phi "<<iphi<<endl;
86 }
87 else
88 cout<<"Digit pointer 0x0"<<endl;
89 }
90
91 }
92}
93