]>
Commit | Line | Data |
---|---|---|
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 | ||
7 | void 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(); | |
1210e23f | 25 | TGeoManager::Import("geometry.root"); |
79107cce | 26 | |
27 | AliRun * alirun = rl->GetAliRun(); // Needed to get Geometry | |
28 | AliEMCAL * emcal = (AliEMCAL*)alirun->GetDetector("EMCAL"); | |
29 | AliEMCALGeometry * geom = emcal->GetGeometry(); | |
30 | ||
31 | if (geom==0) | |
32 | cout<<"Did not get geometry from EMCALLoader"<<endl; | |
33 | ||
1210e23f | 34 | // geom->PrintGeometry(); |
35 | ||
79107cce | 36 | //Load Digits |
37 | rl->LoadDigits("EMCAL"); | |
38 | ||
39 | //Get maximum number of events | |
40 | Int_t maxevent = rl->GetNumberOfEvents(); | |
41 | cout<<"Number of events "<<maxevent<<endl; | |
42 | //maxevent = 1 ; | |
43 | ||
44 | Int_t iEvent = -1 ; | |
45 | Float_t amp = -1 ; | |
46 | Float_t time = -1 ; | |
47 | Int_t id = -1 ; | |
48 | Int_t iSupMod = 0 ; | |
49 | Int_t iTower = 0 ; | |
50 | Int_t iIphi = 0 ; | |
51 | Int_t iIeta = 0 ; | |
52 | Int_t iphi = 0 ; | |
53 | Int_t ieta = 0 ; | |
54 | ||
55 | ||
56 | AliEMCALDigit * dig; | |
57 | ||
58 | for ( iEvent=0; iEvent<maxevent; iEvent++) | |
59 | { | |
60 | cout << " ======> Event " << iEvent << endl ; | |
61 | //Load Event | |
62 | rl->GetEvent(iEvent); | |
63 | ||
64 | //Fill array of digits | |
65 | TClonesArray *digits = emcalLoader->Digits(); | |
66 | ||
67 | //Get digits from the list | |
68 | for(Int_t idig = 0; idig< digits->GetEntries();idig++){ | |
69 | //cout<<">> idig "<<idig<<endl; | |
70 | dig = static_cast<AliEMCALDigit *>(digits->At(idig)) ; | |
71 | ||
72 | if(dig != 0){ | |
73 | id = dig->GetId() ; //cell (digit) label | |
74 | amp = dig->GetAmp(); //amplitude in cell (digit) | |
75 | time = dig->GetTime();//time of creation of digit after collision | |
76 | ||
77 | cout<<"Cell ID "<<id<<" Amp "<<amp<<endl;//" time "<<time<<endl; | |
78 | ||
79 | //Geometry methods | |
80 | geom->GetCellIndex(id,iSupMod,iTower,iIphi,iIeta); | |
81 | //Gives SuperModule and Tower numbers | |
82 | geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower, | |
83 | iIphi, iIeta,iphi,ieta); | |
84 | //Gives label of cell in eta-phi position per each supermodule | |
85 | ||
86 | cout<< "SModule "<<iSupMod<<"; Tower "<<iTower | |
87 | <<"; Eta "<<iIeta<<"; Phi "<<iIphi | |
88 | <<"; Cell Eta "<<ieta<<"; Cell Phi "<<iphi<<endl; | |
89 | } | |
90 | else | |
91 | cout<<"Digit pointer 0x0"<<endl; | |
92 | } | |
93 | ||
94 | } | |
1210e23f | 95 | |
96 | ||
79107cce | 97 | } |
98 |