1 // Test Macro, shows how to load Digits and Geometry, and how can we get
2 // some of the parameters and variables.
3 // Author: Gustavo Conesa
8 // Getting EMCAL Detector and Geometry.
10 AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
13 cout<<"Can not instatiate the Run Loader"<<endl;
15 rl->LoadgAlice();//Needed to get geometry
17 AliEMCALLoader *emcalLoader = dynamic_cast<AliEMCALLoader*>
18 (rl->GetDetectorLoader("EMCAL"));
20 TGeoManager::Import("geometry.root");
22 AliRun * alirun = rl->GetAliRun(); // Needed to get Geometry
23 AliEMCALGeometry * geom ;
25 AliEMCAL * emcal = (AliEMCAL*)alirun->GetDetector("EMCAL");
26 geom = emcal->GetGeometry();
29 if (geom == 0) cout<<"Did not get geometry from EMCALLoader"<<endl;
30 else geom->PrintGeometry();
33 rl->LoadDigits("EMCAL");
35 //Get maximum number of events
36 Int_t maxevent = rl->GetNumberOfEvents();
37 cout<<"Number of events "<<maxevent<<endl;
53 for ( iEvent=0; iEvent<maxevent; iEvent++)
55 cout << " ======> Event " << iEvent << endl ;
59 //Fill array of digits
60 TClonesArray *digits = emcalLoader->Digits();
62 //Get digits from the list
63 for(Int_t idig = 0; idig< digits->GetEntries();idig++){
64 //cout<<">> idig "<<idig<<endl;
65 dig = static_cast<AliEMCALDigit *>(digits->At(idig)) ;
68 id = dig->GetId() ; //cell (digit) label
69 amp = dig->GetAmplitude(); //amplitude in cell (digit)
70 time = dig->GetTime();//time of creation of digit after collision
72 cout<<"Cell ID "<<id<<" Amp "<<amp<<endl;//" time "<<time<<endl;
76 geom->GetCellIndex(id,iSupMod,iTower,iIphi,iIeta);
77 //Gives SuperModule and Tower numbers
78 geom->GetCellPhiEtaIndexInSModule(iSupMod,iTower,
79 iIphi, iIeta,iphi,ieta);
80 //Gives label of cell in eta-phi position per each supermodule
81 cout<< "SModule "<<iSupMod<<"; Tower "<<iTower <<"; Eta "<<iIeta
82 <<"; Phi "<<iIphi<<"; Cell Eta "<<ieta<<"; Cell Phi "<<iphi<<endl;
86 cout<<"Digit pointer 0x0"<<endl;