2 /**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
17 //-------------------------------------------------------------
18 // Fill Unit Array with EMCal information
19 // Called by ESD reader for jet analysis
20 // Author: Magali Estienne (magali.estienne@ires.in2p3.fr)
21 //-------------------------------------------------------------
23 // --- Standard library ---
24 #include <Riostream.h>
26 // --- ROOT system ---
28 #include <TLorentzVector.h>
29 #include <TRefArray.h>
31 #include <TGeoManager.h>
33 #include <TClonesArray.h>
36 // --- AliRoot header files ---
37 #include "AliJetFinder.h"
38 #include "AliJetReaderHeader.h"
39 #include "AliJetReader.h"
40 #include "AliJetESDReader.h"
41 #include "AliJetESDReaderHeader.h"
43 #include "AliESDEvent.h"
44 #include "AliJetDummyGeo.h"
45 #include "AliESDCaloCluster.h"
46 #include "AliJetUnitArray.h"
47 #include "AliJetFillUnitArrayEMCalDigits.h"
48 #include "AliCDBManager.h"
49 #include "AliCDBStorage.h"
50 #include "AliCDBEntry.h"
52 ClassImp(AliJetFillUnitArrayEMCalDigits)
54 //_____________________________________________________________________________
55 AliJetFillUnitArrayEMCalDigits::AliJetFillUnitArrayEMCalDigits()
56 : TTask("AliJetFillUnitArrayEMCalDigits","Fill Unit Array with tpc/its and emcal information"),
83 //_____________________________________________________________________________
84 AliJetFillUnitArrayEMCalDigits::AliJetFillUnitArrayEMCalDigits(AliESDEvent */*esd*/)
85 : TTask("AliJetFillUnitArrayEMCalDigits","Fill Unit Array with tpc/its and emcal information"),
113 //____________________________________________________________________________
114 void AliJetFillUnitArrayEMCalDigits::InitParameters()
116 fNumUnits = fGeom->GetNCells(); // Number of towers in EMCAL
118 fEtaMinCal = fGeom->GetArm1EtaMin();
119 fEtaMaxCal = fGeom->GetArm1EtaMax();
120 fPhiMinCal = fGeom->GetArm1PhiMin();
121 fPhiMaxCal = fGeom->GetArm1PhiMax();
124 if(fDebug>1) printf("\n EMCAL parameters initiated ! \n");
128 //_____________________________________________________________________________
129 AliJetFillUnitArrayEMCalDigits::~AliJetFillUnitArrayEMCalDigits()
134 //_____________________________________________________________________________
135 void AliJetFillUnitArrayEMCalDigits::Exec(Option_t* /*option*/)
141 fDebug = fReaderHeader->GetDebug();
142 fOpt = fReaderHeader->GetDetector();
147 // Get number of clusters from EMCAL
153 Float_t ptMin = fReaderHeader->GetPtCut();
155 // Loop over calo clusters
156 //------------------------------------------------------------------
160 // Total number of EMCAL cluster
161 end = fESD->GetNumberOfCaloClusters();
163 for(Int_t j = beg; j < end; j++) {
164 fClus = fESD->GetCaloCluster(j);
165 if(!fClus->IsEMCAL()) continue;
167 type = fClus->GetClusterType();
168 index = fClus->GetID();
169 nDigitTot = fClus->GetNumberOfDigits();
171 // Keep clusters or pseudo clusters
172 if (type != AliESDCaloCluster::kClusterv1) continue;
173 // if (type != AliESDCaloCluster::kPseudoCluster) continue;
175 // Get the digit index and the digit information
176 //============================================================
178 // Get number of digits in a cluster
179 Int_t nD = fClus->GetNumberOfDigits();
181 TArrayS *digID = fClus->GetDigitIndex();
182 TArrayS *digEnergy = fClus->GetDigitAmplitude();
183 Float_t *digitEnergy = new Float_t[nD];
184 // Float_t digitEn = 0.;
187 for(Int_t k=0; k<nD; k++) {
189 // Convert energy in GeV
190 Int_t idF = (Int_t)digID->At(k);
191 // Calibration for an energy in GeV
192 digitEnergy[k] = (Float_t)digEnergy->At(k)/500.;
194 // Second method to extract eta, phi positions of a digit
195 //=================================================================
197 Float_t etaD=-10., phiD=-10.;
198 fGeom->EtaPhiFromIndex(idF,etaD,phiD);
199 // fEMCalGrid->GetEtaPhiFromIndex2(idF,phiD,etaD);
200 phiD = ((phiD < 0) ? phiD + 2.* TMath::Pi() : phiD);
202 Float_t etDigit = digitEnergy[k]*TMath::Abs(TMath::Sin(EtaToTheta(etaD)));
204 AliJetUnitArray *uArray = (AliJetUnitArray*)fUnitArray->At(idF);
205 if(uArray->GetUnitEnergy() == 0.) goodDigit++;
207 Float_t unitEnergy = 0.;
209 unitEnergy = uArray->GetUnitEnergy();
211 fRefArray->Add(uArray);
215 uArray->SetUnitEnergy(unitEnergy+etDigit);
217 if(uArray->GetUnitEnergy()<ptMin)
218 uArray->SetUnitCutFlag(kPtSmaller);
220 uArray->SetUnitCutFlag(kPtHigher);
221 if(ok) fNDigitEmcalCut++;
225 uArray->SetUnitDetectorFlag(kAll);
226 else uArray->SetUnitDetectorFlag(kEmcal);
228 // This is for jet multiplicity
229 uArray->SetUnitClusterID(index);
231 if(fDebug > 12) printf("goodDigit : %d\n", goodDigit);
233 } // End loop over digits
235 } // End loop over clusters
241 //_____________________________________________________________________________
242 Float_t AliJetFillUnitArrayEMCalDigits::EtaToTheta(Float_t arg)
244 // return (180./TMath::Pi())*2.*atan(exp(-arg));
245 return 2.*atan(exp(-arg));