1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //_________________________________________________________________________
19 // A singleton. This class should be used in the analysis stage to get
20 // reconstructed objects: Digits, RecPoints, TrackSegments and RecParticles,
21 // instead of directly reading them from galice.root file.
24 // The AliEMCALLoader now holds the TClonesArray and TObjArray for reading
25 // Hits, Dgits, SDigits and RecPoints. Filling is managed in the GetEvent()
28 // Creation/writing of files is managed by the relevant parts of the
29 // reconstruction software (AliEMCALDigitiser etx)
31 //*-- Author: Yves Schutz (SUBATECH) & Dmitri Peressounko (RRC KI & SUBATECH)
32 //*-- Completely redesigned by Dmitri Peressounko March 2001
34 //*-- YS June 2001 : renamed the original AliEMCALIndexToObject and make
35 //*-- systematic usage of TFolders without changing the interface
37 //*-- Marco van Leeuwen, Jan 2006: complete revision to simplify reading
38 //*-- and fit better in general ALICE scheme
40 //////////////////////////////////////////////////////////////////////////////
42 // --- ROOT system ---
45 // --- Standard library ---
47 // --- AliRoot header files ---
48 #include "AliEMCALLoader.h"
50 #include "AliCDBLocal.h"
51 #include "AliCDBStorage.h"
52 #include "AliCDBManager.h"
53 #include "AliEMCALHit.h"
55 ClassImp(AliEMCALLoader)
57 const TString AliEMCALLoader::fgkECARecPointsBranchName("EMCALECARP");//Name for branch with ECA Reconstructed Points
58 AliEMCALCalibData* AliEMCALLoader::fgCalibData = 0; //calibation data
60 //____________________________________________________________________________
61 AliEMCALLoader::AliEMCALLoader()
68 //Default constructor for EMCAL Loader Class
71 fHits = new TClonesArray("AliEMCALHit");
72 fDigits = new TClonesArray("AliEMCALDigit");
73 fSDigits = new TClonesArray("AliEMCALDigit");
74 fRecPoints = new TObjArray();
77 //____________________________________________________________________________
78 AliEMCALLoader::AliEMCALLoader(const Char_t *detname,const Char_t *eventfoldername)
79 : AliLoader(detname,eventfoldername),
86 //Specific constructor for EMCAL Loader class
89 fHits = new TClonesArray("AliEMCALHit");
90 fDigits = new TClonesArray("AliEMCALDigit");
91 fSDigits = new TClonesArray("AliEMCALDigit");
92 fRecPoints = new TObjArray();
95 //____________________________________________________________________________
96 AliEMCALLoader::AliEMCALLoader(const AliEMCALLoader & obj)
100 fDigits(obj.fDigits),
101 fSDigits(obj.fSDigits),
102 fRecPoints(obj.fRecPoints)
107 //____________________________________________________________________________
108 AliEMCALLoader::~AliEMCALLoader()
110 // Disconnect trees and remove arrays
112 TreeH()->SetBranchAddress(fDetectorName,0);
114 TreeD()->SetBranchAddress(fDetectorName,0);
116 TreeS()->SetBranchAddress(fDetectorName,0);
118 TreeR()->SetBranchAddress(fgkECARecPointsBranchName,0);
125 //____________________________________________________________________________
126 AliEMCALCalibData* AliEMCALLoader::CalibData()
128 // Check if the instance of AliEMCALCalibData exists, and return it
130 if( !(AliCDBManager::Instance()->IsDefaultStorageSet()) )
137 //____________________________________________________________________________
138 Int_t AliEMCALLoader::CalibrateRaw(Double_t energy, Int_t module,
139 Int_t column, Int_t row)
141 // Convert energy into digitized amplitude for a cell relId
142 // It is a user responsilibity to open CDB and set
143 // AliEMCALCalibData object by the following operators:
145 // AliCDBLocal *loc = new AliCDBLocal("deCalibDB");
146 // AliEMCALCalibData* clb = (AliEMCALCalibData*)AliCDBStorage::Instance()
147 // ->Get(path_to_calibdata,run_number);
148 // AliEMCALGetter* gime = AliEMCALGetter::Instance("galice.root");
149 // gime->SetCalibData(clb);
151 if (CalibData() == 0)
152 Warning("CalibrateRaw","Calibration DB is not initiated!");
154 Float_t gainFactor = 0.00305;//0.0015; // width of one ADC channel in GeV
155 Float_t pedestal = 0.009;//0.005; // pedestals
158 gainFactor = CalibData()->GetADCchannel (module,column,row);
159 pedestal = CalibData()->GetADCpedestal(module,column,row);
162 Int_t amp = static_cast<Int_t>( (energy - pedestal) / gainFactor + 0.5 ) ;
166 //____________________________________________________________________________
167 Int_t AliEMCALLoader::GetEvent()
169 //Method to load all of the data
170 //members of the EMCAL for a given
171 //event from the Trees
173 AliLoader::GetEvent(); // First call AliLoader to do all the groundwork
175 // Now connect and fill TClonesArray
178 TTree *treeH = TreeH();
181 Int_t nEnt = treeH->GetEntries(); // TreeH has array of hits for every primary
184 TClonesArray *temp_arr = new TClonesArray("AliEMCALHit");
185 treeH->SetBranchAddress(fDetectorName,&temp_arr);
186 for (Int_t iEnt = 0; iEnt < nEnt; iEnt++) {
187 treeH->GetEntry(iEnt);
188 Int_t nHit = temp_arr->GetEntriesFast();
189 for (Int_t iHit = 0; iHit < nHit; iHit++) {
190 new ((*fHits)[index]) AliEMCALHit(*((AliEMCALHit*)temp_arr->At(iHit)));
197 TTree *treeS = TreeS();
199 treeS->SetBranchAddress(fDetectorName,&fSDigits);
204 TTree *treeD = TreeD();
206 treeD->SetBranchAddress(fDetectorName,&fDigits);
211 TTree *treeR = TreeR();
213 treeR->SetBranchAddress(fgkECARecPointsBranchName,&fRecPoints);