]>
Commit | Line | Data |
---|---|---|
375cec9b | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: Boris Polishchuk * | |
5 | * Adapted to AOD reading by Gustavo Conesa * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | //---------------------------------------------------------------------------// | |
17 | // // | |
18 | // Fill histograms (one per cell) with two-cluster invariant mass // | |
19 | // using calibration coefficients of the previous iteration. // | |
20 | // Histogram for a given cell is filled if the most energy of one cluster // | |
21 | // is deposited in this cell and the other cluster could be anywherein EMCAL.// | |
22 | // // | |
23 | //---------------------------------------------------------------------------// | |
24 | ||
25 | //#include <cstdlib> | |
26 | //#include <Riostream.h> | |
27 | // Root | |
28 | #include "TLorentzVector.h" | |
375cec9b | 29 | #include "TRefArray.h" |
30 | #include "TList.h" | |
31 | #include "TH1F.h" | |
247abff4 | 32 | #include <TGeoManager.h> |
375cec9b | 33 | |
34 | // AliRoot | |
35 | #include "AliAnalysisTaskEMCALPi0CalibSelection.h" | |
36 | #include "AliAODEvent.h" | |
37 | #include "AliESDEvent.h" | |
375cec9b | 38 | #include "AliEMCALGeometry.h" |
c8fe2783 | 39 | #include "AliVCluster.h" |
40 | #include "AliVCaloCells.h" | |
9584c261 | 41 | #include "AliEMCALRecoUtils.h" |
6eb2a715 | 42 | //#include "AliEMCALAodCluster.h" |
43 | //#include "AliEMCALCalibData.h" | |
375cec9b | 44 | |
45 | ClassImp(AliAnalysisTaskEMCALPi0CalibSelection) | |
46 | ||
375cec9b | 47 | |
48 | //__________________________________________________ | |
49 | AliAnalysisTaskEMCALPi0CalibSelection::AliAnalysisTaskEMCALPi0CalibSelection(const char* name) : | |
6eb2a715 | 50 | AliAnalysisTaskSE(name),fEMCALGeo(0x0),//fCalibData(0x0), |
9fdaff9a | 51 | fEmin(0.5), fEmax(15.), fAsyCut(1.),fMinNCells(2), fGroupNCells(0), |
247abff4 | 52 | fLogWeight(4.5), fSameSM(kFALSE), fOldAOD(kFALSE), fFilteredInput(kFALSE), |
53 | fCorrectClusters(kFALSE), fEMCALGeoName("EMCAL_FIRSTYEAR"), | |
9584c261 | 54 | fRecoUtils(new AliEMCALRecoUtils), |
55 | fNbins(300), fMinBin(0.), fMaxBin(300.),fOutputContainer(0x0), | |
56 | fHmgg(0x0), fHmggDifferentSM(0x0), | |
57 | fHOpeningAngle(0x0), fHOpeningAngleDifferentSM(0x0), | |
58 | fHIncidentAngle(0x0), fHIncidentAngleDifferentSM(0x0), | |
59 | fHAsymmetry(0x0), fHAsymmetryDifferentSM(0x0), | |
9584c261 | 60 | fhNEvents(0x0),fCuts(0x0) |
375cec9b | 61 | { |
62 | //Named constructor which should be used. | |
63 | ||
bdd2a262 | 64 | for(Int_t iMod=0; iMod < 12; iMod++) { |
65 | for(Int_t iX=0; iX<24; iX++) { | |
66 | for(Int_t iZ=0; iZ<48; iZ++) { | |
2dfb1428 | 67 | fHmpi0[iMod][iZ][iX]=0; |
375cec9b | 68 | } |
69 | } | |
70 | } | |
6eb2a715 | 71 | |
2dfb1428 | 72 | for(Int_t iSM=0; iSM<4; iSM++) { |
9584c261 | 73 | fHmggSM[iSM] =0; |
74 | fHmggPairSM[iSM] =0; | |
75 | fHOpeningAngleSM[iSM] =0; | |
76 | fHOpeningAnglePairSM[iSM] =0; | |
77 | fHAsymmetrySM[iSM] =0; | |
78 | fHAsymmetryPairSM[iSM] =0; | |
79 | fHIncidentAngleSM[iSM] =0; | |
80 | fHIncidentAnglePairSM[iSM]=0; | |
81 | fhTowerDecayPhotonHit[iSM] =0; | |
82 | fhTowerDecayPhotonEnergy[iSM]=0; | |
83 | fhTowerDecayPhotonAsymmetry[iSM]=0; | |
2dfb1428 | 84 | } |
85 | ||
cf028690 | 86 | DefineOutput(1, TList::Class()); |
6eb2a715 | 87 | DefineOutput(2, TList::Class()); // will contain cuts or local params |
375cec9b | 88 | |
89 | } | |
90 | ||
91 | //__________________________________________________ | |
92 | AliAnalysisTaskEMCALPi0CalibSelection::~AliAnalysisTaskEMCALPi0CalibSelection() | |
93 | { | |
94 | //Destructor. | |
95 | ||
96 | if(fOutputContainer){ | |
97 | fOutputContainer->Delete() ; | |
98 | delete fOutputContainer ; | |
99 | } | |
100 | ||
6eb2a715 | 101 | //if(fCalibData) delete fCalibData; |
375cec9b | 102 | if(fEMCALGeo) delete fEMCALGeo; |
103 | ||
9584c261 | 104 | if(fRecoUtils) delete fRecoUtils ; |
105 | ||
375cec9b | 106 | } |
107 | ||
6eb2a715 | 108 | //_____________________________________________________ |
109 | void AliAnalysisTaskEMCALPi0CalibSelection::LocalInit() | |
110 | { | |
111 | // Local Initialization | |
112 | ||
113 | // Create cuts/param objects and publish to slot | |
2dfb1428 | 114 | const Int_t buffersize = 255; |
115 | char onePar[buffersize] ; | |
6eb2a715 | 116 | fCuts = new TList(); |
117 | ||
9fdaff9a | 118 | snprintf(onePar,buffersize, "Custer cuts: %2.2f < E < %2.2f GeV; min number of cells %d; Assymetry cut %1.2f", fEmin,fEmax, fMinNCells, fAsyCut) ; |
6eb2a715 | 119 | fCuts->Add(new TObjString(onePar)); |
2dfb1428 | 120 | snprintf(onePar,buffersize, "Group %d cells;", fGroupNCells) ; |
6eb2a715 | 121 | fCuts->Add(new TObjString(onePar)); |
247abff4 | 122 | snprintf(onePar,buffersize, "Cluster maximal cell away from border at least %d cells;", fRecoUtils->GetNumberOfCellsFromEMCALBorder()) ; |
cfce8d44 | 123 | fCuts->Add(new TObjString(onePar)); |
2dfb1428 | 124 | snprintf(onePar,buffersize, "Histograms: bins %d; energy range: %2.2f < E < %2.2f GeV;",fNbins,fMinBin,fMaxBin) ; |
6eb2a715 | 125 | fCuts->Add(new TObjString(onePar)); |
247abff4 | 126 | snprintf(onePar,buffersize, "Switchs: Remove Bad Channels? %d; Use filtered input? %d; Correct Clusters? %d, Analyze Old AODs? %d, Mass per channel same SM clusters? %d ", |
127 | fRecoUtils->IsBadChannelsRemovalSwitchedOn(),fFilteredInput,fCorrectClusters, fOldAOD, fSameSM) ; | |
6eb2a715 | 128 | fCuts->Add(new TObjString(onePar)); |
2dfb1428 | 129 | snprintf(onePar,buffersize, "EMCAL Geometry name: < %s >",fEMCALGeoName.Data()) ; |
6eb2a715 | 130 | fCuts->Add(new TObjString(onePar)); |
131 | ||
132 | // Post Data | |
133 | PostData(2, fCuts); | |
134 | ||
135 | } | |
375cec9b | 136 | |
2dfb1428 | 137 | //_________________________________________________________________ |
138 | Int_t AliAnalysisTaskEMCALPi0CalibSelection::GetEMCALClusters(AliVEvent * event, TRefArray *clusters) const | |
139 | { | |
140 | // fills the provided TRefArray with all found emcal clusters | |
141 | ||
142 | clusters->Clear(); | |
143 | AliVCluster *cl = 0; | |
144 | Bool_t first = kTRUE; | |
145 | for (Int_t i = 0; i < event->GetNumberOfCaloClusters(); i++) { | |
146 | if ( (cl = event->GetCaloCluster(i)) ) { | |
147 | if (IsEMCALCluster(cl)){ | |
148 | if(first) { | |
149 | new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl)); | |
150 | first=kFALSE; | |
151 | } | |
152 | clusters->Add(cl); | |
153 | //printf("IsEMCal cluster %d, E %2.3f Size: %d \n",i,cl->E(),clusters->GetEntriesFast()); | |
154 | } | |
155 | } | |
156 | } | |
157 | return clusters->GetEntriesFast(); | |
158 | } | |
159 | ||
160 | ||
161 | //____________________________________________________________________________ | |
162 | Bool_t AliAnalysisTaskEMCALPi0CalibSelection::IsEMCALCluster(AliVCluster* cluster) const { | |
163 | // Check if it is a cluster from EMCAL. For old AODs cluster type has | |
164 | // different number and need to patch here | |
165 | ||
166 | if(fOldAOD) | |
167 | { | |
168 | if (cluster->GetType() == 2) return kTRUE; | |
169 | else return kFALSE; | |
170 | } | |
171 | else | |
172 | { | |
173 | return cluster->IsEMCAL(); | |
174 | } | |
175 | ||
176 | } | |
177 | ||
178 | ||
375cec9b | 179 | //__________________________________________________ |
180 | void AliAnalysisTaskEMCALPi0CalibSelection::UserCreateOutputObjects() | |
181 | { | |
247abff4 | 182 | //Create output container, init geometry |
cf028690 | 183 | |
cf028690 | 184 | fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName) ; |
9584c261 | 185 | |
375cec9b | 186 | fOutputContainer = new TList(); |
2dfb1428 | 187 | const Int_t buffersize = 255; |
188 | char hname[buffersize], htitl[buffersize]; | |
375cec9b | 189 | |
6eb2a715 | 190 | for(Int_t iMod=0; iMod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); iMod++) { |
cf028690 | 191 | for(Int_t iRow=0; iRow<AliEMCALGeoParams::fgkEMCALRows; iRow++) { |
192 | for(Int_t iCol=0; iCol<AliEMCALGeoParams::fgkEMCALCols; iCol++) { | |
2dfb1428 | 193 | snprintf(hname,buffersize, "%d_%d_%d",iMod,iCol,iRow); |
194 | snprintf(htitl,buffersize, "Two-gamma inv. mass for super mod %d, cell(col,row)=(%d,%d)",iMod,iCol,iRow); | |
70ae4900 | 195 | fHmpi0[iMod][iCol][iRow] = new TH1F(hname,htitl,fNbins,fMinBin,fMaxBin); |
196 | fOutputContainer->Add(fHmpi0[iMod][iCol][iRow]); | |
375cec9b | 197 | } |
198 | } | |
199 | } | |
200 | ||
70ae4900 | 201 | fHmgg = new TH2F("hmgg","2-cluster invariant mass",fNbins,fMinBin,fMaxBin,100,0,10); |
202 | fHmgg->SetXTitle("m_{#gamma #gamma} (MeV/c^{2})"); | |
203 | fHmgg->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
375cec9b | 204 | fOutputContainer->Add(fHmgg); |
2dfb1428 | 205 | |
206 | fHmggDifferentSM = new TH2F("hmggDifferentSM","2-cluster invariant mass, different SM",fNbins,fMinBin,fMaxBin,100,0,10); | |
207 | fHmggDifferentSM->SetXTitle("m_{#gamma #gamma} (MeV/c^{2})"); | |
208 | fHmggDifferentSM->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
209 | fOutputContainer->Add(fHmggDifferentSM); | |
9584c261 | 210 | |
211 | fHOpeningAngle = new TH2F("hopang","2-cluster opening angle",100,0.,50.,100,0,10); | |
212 | fHOpeningAngle->SetXTitle("#alpha_{#gamma #gamma}"); | |
213 | fHOpeningAngle->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
214 | fOutputContainer->Add(fHOpeningAngle); | |
215 | ||
216 | fHOpeningAngleDifferentSM = new TH2F("hopangDifferentSM","2-cluster opening angle, different SM",100,0,50.,100,0,10); | |
217 | fHOpeningAngleDifferentSM->SetXTitle("#alpha_{#gamma #gamma}"); | |
218 | fHOpeningAngleDifferentSM->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
219 | fOutputContainer->Add(fHOpeningAngleDifferentSM); | |
220 | ||
221 | fHIncidentAngle = new TH2F("hinang","#gamma incident angle in SM",100,0.,20.,100,0,10); | |
222 | fHIncidentAngle->SetXTitle("#alpha_{#gamma SM center}"); | |
223 | fHIncidentAngle->SetYTitle("p_{T #gamma} (GeV/c)"); | |
224 | fOutputContainer->Add(fHIncidentAngle); | |
225 | ||
226 | fHIncidentAngleDifferentSM = new TH2F("hinangDifferentSM","#gamma incident angle in SM, different SM pair",100,0,20.,100,0,10); | |
227 | fHIncidentAngleDifferentSM->SetXTitle("#alpha_{#gamma - SM center}"); | |
228 | fHIncidentAngleDifferentSM->SetYTitle("p_{T #gamma} (GeV/c)"); | |
229 | fOutputContainer->Add(fHIncidentAngleDifferentSM); | |
230 | ||
231 | fHAsymmetry = new TH2F("hasym","2-cluster opening angle",100,0.,1.,100,0,10); | |
232 | fHAsymmetry->SetXTitle("a"); | |
233 | fHAsymmetry->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
234 | fOutputContainer->Add(fHAsymmetry); | |
235 | ||
236 | fHAsymmetryDifferentSM = new TH2F("hasymDifferentSM","2-cluster opening angle, different SM",100,0,1.,100,0,10); | |
237 | fHAsymmetryDifferentSM->SetXTitle("a"); | |
238 | fHAsymmetryDifferentSM->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
239 | fOutputContainer->Add(fHAsymmetryDifferentSM); | |
240 | ||
2dfb1428 | 241 | |
242 | TString pairname[] = {"A side (0-2)", "C side (1-3)","Row 0 (0-1)", "Row 1 (2-3)"}; | |
243 | ||
244 | for(Int_t iSM=0; iSM<4; iSM++) { | |
245 | ||
246 | snprintf(hname, buffersize, "hmgg_SM%d",iSM); | |
247 | snprintf(htitl, buffersize, "Two-gamma inv. mass for super mod %d",iSM); | |
248 | fHmggSM[iSM] = new TH2F(hname,htitl,fNbins,fMinBin,fMaxBin,100,0,10); | |
249 | fHmggSM[iSM]->SetXTitle("m_{#gamma #gamma} (MeV/c^{2})"); | |
250 | fHmggSM[iSM]->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
2dfb1428 | 251 | fOutputContainer->Add(fHmggSM[iSM]); |
252 | ||
2dfb1428 | 253 | snprintf(hname,buffersize, "hmgg_PairSM%d",iSM); |
254 | snprintf(htitl,buffersize, "Two-gamma inv. mass for SM pair: %s",pairname[iSM].Data()); | |
255 | fHmggPairSM[iSM] = new TH2F(hname,htitl,fNbins,fMinBin,fMaxBin,100,0,10); | |
256 | fHmggPairSM[iSM]->SetXTitle("m_{#gamma #gamma} (MeV/c^{2})"); | |
257 | fHmggPairSM[iSM]->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
2dfb1428 | 258 | fOutputContainer->Add(fHmggPairSM[iSM]); |
9584c261 | 259 | |
260 | ||
261 | snprintf(hname, buffersize, "hopang_SM%d",iSM); | |
262 | snprintf(htitl, buffersize, "Opening angle for super mod %d",iSM); | |
263 | fHOpeningAngleSM[iSM] = new TH2F(hname,htitl,100,0.,50.,100,0,10); | |
264 | fHOpeningAngleSM[iSM]->SetXTitle("#alpha_{#gamma #gamma} (deg)"); | |
265 | fHOpeningAngleSM[iSM]->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
266 | fOutputContainer->Add(fHOpeningAngleSM[iSM]); | |
267 | ||
268 | snprintf(hname,buffersize, "hopang_PairSM%d",iSM); | |
269 | snprintf(htitl,buffersize, "Opening angle for SM pair: %s",pairname[iSM].Data()); | |
270 | fHOpeningAnglePairSM[iSM] = new TH2F(hname,htitl,100,0.,50.,100,0,10); | |
271 | fHOpeningAnglePairSM[iSM]->SetXTitle("#alpha_{#gamma #gamma} (deg)"); | |
272 | fHOpeningAnglePairSM[iSM]->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
273 | fOutputContainer->Add(fHOpeningAnglePairSM[iSM]); | |
274 | ||
275 | snprintf(hname, buffersize, "hinang_SM%d",iSM); | |
276 | snprintf(htitl, buffersize, "Incident angle for super mod %d",iSM); | |
277 | fHIncidentAngleSM[iSM] = new TH2F(hname,htitl,100,0.,20.,100,0,10); | |
278 | fHIncidentAngleSM[iSM]->SetXTitle("#alpha_{#gamma - SM center} (deg)"); | |
279 | fHIncidentAngleSM[iSM]->SetYTitle("p_{T #gamma} (GeV/c)"); | |
280 | fOutputContainer->Add(fHIncidentAngleSM[iSM]); | |
281 | ||
282 | snprintf(hname,buffersize, "hinang_PairSM%d",iSM); | |
283 | snprintf(htitl,buffersize, "Incident angle for SM pair: %s",pairname[iSM].Data()); | |
284 | fHIncidentAnglePairSM[iSM] = new TH2F(hname,htitl,100,0.,20.,100,0,10); | |
285 | fHIncidentAnglePairSM[iSM]->SetXTitle("#alpha_{#gamma - SM center} (deg)"); | |
286 | fHIncidentAnglePairSM[iSM]->SetYTitle("p_{T #gamma} (GeV/c)"); | |
287 | fOutputContainer->Add(fHIncidentAnglePairSM[iSM]); | |
288 | ||
289 | snprintf(hname, buffersize, "hasym_SM%d",iSM); | |
290 | snprintf(htitl, buffersize, "asymmetry for super mod %d",iSM); | |
291 | fHAsymmetrySM[iSM] = new TH2F(hname,htitl,100,0.,1.,100,0,10); | |
292 | fHAsymmetrySM[iSM]->SetXTitle("a"); | |
293 | fHAsymmetrySM[iSM]->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
294 | fOutputContainer->Add(fHAsymmetrySM[iSM]); | |
295 | ||
296 | snprintf(hname,buffersize, "hasym_PairSM%d",iSM); | |
297 | snprintf(htitl,buffersize, "Asymmetry for SM pair: %s",pairname[iSM].Data()); | |
298 | fHAsymmetryPairSM[iSM] = new TH2F(hname,htitl,100,0.,1.,100,0,10); | |
299 | fHAsymmetryPairSM[iSM]->SetXTitle("a"); | |
300 | fHAsymmetryPairSM[iSM]->SetYTitle("p_{T #gamma #gamma} (GeV/c)"); | |
301 | fOutputContainer->Add(fHAsymmetryPairSM[iSM]); | |
302 | ||
303 | ||
304 | Int_t colmax = 48; | |
305 | Int_t rowmax = 24; | |
306 | ||
307 | fhTowerDecayPhotonHit[iSM] = new TH2F (Form("hTowerDecPhotonHit_Mod%d",iSM),Form("Entries in grid of cells in Module %d",iSM), | |
308 | colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); | |
309 | fhTowerDecayPhotonHit[iSM]->SetYTitle("row (phi direction)"); | |
310 | fhTowerDecayPhotonHit[iSM]->SetXTitle("column (eta direction)"); | |
311 | fOutputContainer->Add(fhTowerDecayPhotonHit[iSM]); | |
312 | ||
313 | fhTowerDecayPhotonEnergy[iSM] = new TH2F (Form("hTowerDecPhotonEnergy_Mod%d",iSM),Form("Accumulated energy in grid of cells in Module %d",iSM), | |
314 | colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); | |
315 | fhTowerDecayPhotonEnergy[iSM]->SetYTitle("row (phi direction)"); | |
316 | fhTowerDecayPhotonEnergy[iSM]->SetXTitle("column (eta direction)"); | |
317 | fOutputContainer->Add(fhTowerDecayPhotonEnergy[iSM]); | |
318 | ||
319 | fhTowerDecayPhotonAsymmetry[iSM] = new TH2F (Form("hTowerDecPhotonAsymmetry_Mod%d",iSM),Form("Accumulated asymmetry in grid of cells in Module %d",iSM), | |
320 | colmax+2,-1.5,colmax+0.5, rowmax+2,-1.5,rowmax+0.5); | |
321 | fhTowerDecayPhotonAsymmetry[iSM]->SetYTitle("row (phi direction)"); | |
322 | fhTowerDecayPhotonAsymmetry[iSM]->SetXTitle("column (eta direction)"); | |
323 | fOutputContainer->Add(fhTowerDecayPhotonAsymmetry[iSM]); | |
324 | ||
2dfb1428 | 325 | } |
6eb2a715 | 326 | |
327 | fhNEvents = new TH1I("hNEvents", "Number of analyzed events" , 1 , 0 , 1 ) ; | |
328 | fOutputContainer->Add(fhNEvents); | |
247abff4 | 329 | |
330 | fOutputContainer->SetOwner(kTRUE); | |
331 | ||
6eb2a715 | 332 | // fCalibData = new AliEMCALCalibData(); |
333 | ||
cf028690 | 334 | PostData(1,fOutputContainer); |
375cec9b | 335 | |
336 | } | |
337 | ||
338 | //__________________________________________________ | |
339 | void AliAnalysisTaskEMCALPi0CalibSelection::UserExec(Option_t* /* option */) | |
340 | { | |
341 | //Analysis per event. | |
375cec9b | 342 | |
19db8f8c | 343 | if(fRecoUtils->GetParticleType()!=AliEMCALRecoUtils::kPhoton){ |
344 | printf("Wrong particle type for cluster position recalculation! = %d\n", fRecoUtils->GetParticleType()); | |
345 | abort(); | |
346 | } | |
247abff4 | 347 | |
6eb2a715 | 348 | fhNEvents->Fill(0); //Event analyzed |
349 | ||
247abff4 | 350 | //Get the input event |
351 | AliVEvent* event = 0; | |
352 | if(fFilteredInput) event = AODEvent(); | |
353 | else event = InputEvent(); | |
70ae4900 | 354 | |
247abff4 | 355 | |
356 | ||
357 | if(!event) { | |
358 | printf("Input event not available!\n"); | |
359 | return; | |
375cec9b | 360 | } |
375cec9b | 361 | |
247abff4 | 362 | if(DebugLevel() > 1) |
363 | printf("AliAnalysisTaskEMCALPi0CalibSelection <<< %s: Event %d >>>\n",event->GetName(), (Int_t)Entry()); | |
364 | ||
365 | ||
366 | //Get the primary vertex | |
367 | Double_t v[3]; | |
368 | event->GetPrimaryVertex()->GetXYZ(v) ; | |
375cec9b | 369 | |
375cec9b | 370 | if(DebugLevel() > 1) printf("AliAnalysisTaskEMCALPi0CalibSelection Vertex: (%.3f,%.3f,%.3f)\n",v[0],v[1],v[2]); |
371 | ||
247abff4 | 372 | //Int_t runNum = aod->GetRunNumber(); |
373 | //if(DebugLevel() > 1) printf("Run number: %d\n",runNum); | |
375cec9b | 374 | |
2dfb1428 | 375 | //FIXME Not need the matrices for the moment MEFIX |
375cec9b | 376 | //Get the matrix with geometry information |
377 | //Still not implemented in AOD, just a workaround to be able to work at least with ESDs | |
70ae4900 | 378 | // if(!strcmp(InputEvent()->GetName(),"AliAODEvent")) { |
379 | // if(DebugLevel() > 1) | |
380 | // printf("AliAnalysisTaskEMCALPi0CalibSelection Use ideal geometry, values geometry matrix not kept in AODs.\n"); | |
381 | // } | |
382 | // else{ | |
383 | // if(DebugLevel() > 1) printf("AliAnalysisTaskEMCALPi0CalibSelection Load Misaligned matrices. \n"); | |
384 | // AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent()) ; | |
2dfb1428 | 385 | // if(!esd) { |
386 | // printf("AliAnalysisTaskEMCALPi0CalibSelection::UserExec() - This event does not contain ESDs?"); | |
387 | // return; | |
388 | // } | |
70ae4900 | 389 | // for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ |
390 | // if(esd->GetEMCALMatrix(mod)) fEMCALGeo->SetMisalMatrix(esd->GetEMCALMatrix(mod),mod) ; | |
391 | // } | |
392 | // } | |
375cec9b | 393 | |
394 | if(DebugLevel() > 1) printf("AliAnalysisTaskEMCALPi0CalibSelection Will use fLogWeight %.3f .\n",fLogWeight); | |
19db8f8c | 395 | Int_t absId1 = -1; |
6eb2a715 | 396 | Int_t iSupMod1 = -1; |
397 | Int_t iphi1 = -1; | |
398 | Int_t ieta1 = -1; | |
19db8f8c | 399 | Int_t absId2 = -1; |
6eb2a715 | 400 | Int_t iSupMod2 = -1; |
401 | Int_t iphi2 = -1; | |
402 | Int_t ieta2 = -1; | |
403 | ||
375cec9b | 404 | TLorentzVector p1; |
405 | TLorentzVector p2; | |
406 | TLorentzVector p12; | |
407 | ||
247abff4 | 408 | //Get the list of clusters |
375cec9b | 409 | TRefArray * caloClustersArr = new TRefArray(); |
247abff4 | 410 | if(!fOldAOD) event->GetEMCALClusters(caloClustersArr); |
411 | else GetEMCALClusters(event,caloClustersArr); | |
375cec9b | 412 | const Int_t kNumberOfEMCALClusters = caloClustersArr->GetEntries() ; |
cf028690 | 413 | if(DebugLevel() > 1) printf("AliAnalysisTaskEMCALPi0CalibSelection - N CaloClusters: %d \n", kNumberOfEMCALClusters); |
375cec9b | 414 | |
247abff4 | 415 | // Get EMCAL cells |
416 | AliVCaloCells *emCells = event->GetEMCALCells(); | |
417 | ||
375cec9b | 418 | // loop over EMCAL clusters |
247abff4 | 419 | //---------------------------------------------------------- |
420 | // First recalibrate and recalculate energy and position | |
421 | Float_t pos[]={0,0,0}; | |
422 | if(fCorrectClusters){ | |
423 | for(Int_t iClu=0; iClu<kNumberOfEMCALClusters-1; iClu++) { | |
424 | ||
425 | AliVCluster *c1 = (AliVCluster *) caloClustersArr->At(iClu); | |
426 | ||
427 | if(fRecoUtils->ClusterContainsBadChannel(fEMCALGeo, c1->GetCellsAbsId(), c1->GetNCells())) continue; | |
428 | ||
429 | if(DebugLevel() > 2) | |
430 | { | |
431 | printf("Std : i %d, E %f, dispersion %f, m02 %f, m20 %f\n",c1->GetID(),c1->E(),c1->GetDispersion(),c1->GetM02(),c1->GetM20()); | |
432 | c1->GetPosition(pos); | |
433 | printf("Std : i %d, x %f, y %f, z %f\n",c1->GetID(), pos[0], pos[1], pos[2]); | |
434 | } | |
435 | ||
436 | //Correct cluster energy and position if requested, and not corrected previously, by default Off | |
437 | if(fRecoUtils->IsRecalibrationOn()) fRecoUtils->RecalibrateClusterEnergy(fEMCALGeo, c1, emCells); | |
438 | if(DebugLevel() > 2) | |
439 | printf("Energy: after recalibration %f; ",c1->E()); | |
440 | ||
441 | // Correct Non-Linearity | |
442 | c1->SetE(fRecoUtils->CorrectClusterEnergyLinearity(c1)); | |
443 | if(DebugLevel() > 2) | |
444 | printf("after linearity correction %f\n",c1->E()); | |
445 | // Recalculate cluster position | |
446 | fRecoUtils->RecalculateClusterPosition(fEMCALGeo, emCells,c1); | |
447 | if(DebugLevel() > 2) | |
448 | { | |
449 | printf("Cor : i %d, E %f, dispersion %f, m02 %f, m20 %f\n",c1->GetID(),c1->E(),c1->GetDispersion(),c1->GetM02(),c1->GetM20()); | |
450 | c1->GetPosition(pos); | |
451 | printf("Cor : i %d, x %f, y %f, z %f\n",c1->GetID(), pos[0], pos[1], pos[2]); | |
452 | } | |
453 | } | |
454 | } | |
455 | //---------------------------------------------------------- | |
456 | //Now the invariant mass analysis with the corrected clusters | |
457 | for(Int_t iClu=0; iClu<kNumberOfEMCALClusters-1; iClu++) { | |
375cec9b | 458 | |
247abff4 | 459 | AliVCluster *c1 = (AliVCluster *) caloClustersArr->At(iClu); |
460 | if(fRecoUtils->ClusterContainsBadChannel(fEMCALGeo, c1->GetCellsAbsId(), c1->GetNCells())) continue; | |
6eb2a715 | 461 | |
462 | Float_t e1i = c1->E(); // cluster energy before correction | |
463 | if(e1i < fEmin) continue; | |
464 | else if(e1i > fEmax) continue; | |
465 | else if (c1->GetNCells() < fMinNCells) continue; | |
466 | ||
467 | if(DebugLevel() > 2) | |
70ae4900 | 468 | { |
247abff4 | 469 | printf("IMA : i %d, E %f, dispersion %f, m02 %f, m20 %f\n",c1->GetID(),e1i,c1->GetDispersion(),c1->GetM02(),c1->GetM20()); |
70ae4900 | 470 | c1->GetPosition(pos); |
247abff4 | 471 | printf("IMA : i %d, x %f, y %f, z %f\n",c1->GetID(), pos[0], pos[1], pos[2]); |
70ae4900 | 472 | } |
6eb2a715 | 473 | |
247abff4 | 474 | //AliEMCALAodCluster newc1(*((AliAODCaloCluster*)c1)); |
475 | //newc1.EvalAllFromRecoUtils(fEMCALGeo,fRecoUtils,emCells); | |
476 | //printf("i %d, recal? %d\n",iClu,newc1.IsRecalibrated()); | |
6eb2a715 | 477 | //clu1.Recalibrate(fCalibData, emCells, fEMCALGeoName); |
478 | //clu1.EvalEnergy(); | |
cf028690 | 479 | //clu1.EvalAll(fLogWeight, fEMCALGeoName); |
375cec9b | 480 | |
247abff4 | 481 | fRecoUtils->GetMaxEnergyCell(fEMCALGeo, emCells,c1,absId1,iSupMod1,ieta1,iphi1); |
9584c261 | 482 | c1->GetMomentum(p1,v); |
247abff4 | 483 | //newc1.GetMomentum(p1,v); |
484 | ||
485 | // Combine cluster with other clusters and get the invariant mass | |
486 | for (Int_t jClu=iClu+1; jClu<kNumberOfEMCALClusters; jClu++) { | |
375cec9b | 487 | AliAODCaloCluster *c2 = (AliAODCaloCluster *) caloClustersArr->At(jClu); |
247abff4 | 488 | //if(c2->IsEqual(c1)) continue; |
489 | if(fRecoUtils->ClusterContainsBadChannel(fEMCALGeo, c2->GetCellsAbsId(), c2->GetNCells())) continue; | |
375cec9b | 490 | |
491 | Float_t e2i = c2->E(); | |
6eb2a715 | 492 | if(e2i < fEmin) continue; |
493 | else if (e2i > fEmax) continue; | |
494 | else if (c2->GetNCells() < fMinNCells) continue; | |
495 | ||
247abff4 | 496 | //AliEMCALAodCluster newc2(*((AliAODCaloCluster*)c2)); |
497 | //newc2.EvalAllFromRecoUtils(fEMCALGeo,fRecoUtils,emCells); | |
498 | //printf("\t j %d, recal? %d\n",jClu,newc2.IsRecalibrated()); | |
6eb2a715 | 499 | //clu2.Recalibrate(fCalibData, emCells,fEMCALGeoName); |
500 | //clu2.EvalEnergy(); | |
cf028690 | 501 | //clu2.EvalAll(fLogWeight,fEMCALGeoName); |
19db8f8c | 502 | |
247abff4 | 503 | fRecoUtils->GetMaxEnergyCell(fEMCALGeo, emCells,c2,absId2,iSupMod2,ieta2,iphi2); |
6eb2a715 | 504 | c2->GetMomentum(p2,v); |
247abff4 | 505 | //newc2.GetMomentum(p2,v); |
375cec9b | 506 | p12 = p1+p2; |
507 | Float_t invmass = p12.M()*1000; | |
9584c261 | 508 | //printf("*** mass %f\n",invmass); |
509 | Float_t asym = TMath::Abs(p1.E()-p2.E())/(p1.E()+p2.E()); | |
510 | //printf("asymmetry %f\n",asym); | |
9fdaff9a | 511 | |
512 | if(asym > fAsyCut) continue; | |
513 | ||
6eb2a715 | 514 | if(invmass < fMaxBin && invmass > fMinBin){ |
70ae4900 | 515 | |
cfce8d44 | 516 | //Check if cluster is in fidutial region, not too close to borders |
247abff4 | 517 | Bool_t in1 = fRecoUtils->CheckCellFiducialRegion(fEMCALGeo, c1, emCells); |
518 | Bool_t in2 = fRecoUtils->CheckCellFiducialRegion(fEMCALGeo, c2, emCells); | |
519 | ||
cfce8d44 | 520 | if(in1 && in2){ |
521 | ||
522 | fHmgg->Fill(invmass,p12.Pt()); | |
247abff4 | 523 | |
cfce8d44 | 524 | if(iSupMod1==iSupMod2) fHmggSM[iSupMod1]->Fill(invmass,p12.Pt()); |
525 | else fHmggDifferentSM ->Fill(invmass,p12.Pt()); | |
247abff4 | 526 | |
cfce8d44 | 527 | if((iSupMod1==0 && iSupMod2==2) || (iSupMod1==2 && iSupMod2==0)) fHmggPairSM[0]->Fill(invmass,p12.Pt()); |
528 | if((iSupMod1==1 && iSupMod2==3) || (iSupMod1==3 && iSupMod2==1)) fHmggPairSM[1]->Fill(invmass,p12.Pt()); | |
529 | if((iSupMod1==0 && iSupMod2==1) || (iSupMod1==1 && iSupMod2==0)) fHmggPairSM[2]->Fill(invmass,p12.Pt()); | |
530 | if((iSupMod1==2 && iSupMod2==3) || (iSupMod1==3 && iSupMod2==2)) fHmggPairSM[3]->Fill(invmass,p12.Pt()); | |
9584c261 | 531 | |
532 | if(invmass > 100. && invmass < 160.){//restrict to clusters really close to pi0 peak | |
533 | ||
534 | //Opening angle of 2 photons | |
535 | Float_t opangle = p1.Angle(p2.Vect())*TMath::RadToDeg(); | |
536 | //printf("*******>>>>>>>> In PEAK pt %f, angle %f \n",p12.Pt(),opangle); | |
247abff4 | 537 | |
9584c261 | 538 | //Inciden angle of each photon |
9584c261 | 539 | Float_t posSM1cen[3]={0.,0.,0.}; |
19db8f8c | 540 | Float_t depth = fRecoUtils->GetDepth(p1.Energy(),fRecoUtils->GetParticleType(),iSupMod1); |
541 | fEMCALGeo->RecalculateTowerPosition(11.5, 23.5, iSupMod1, depth, fRecoUtils->GetMisalTransShiftArray(),fRecoUtils->GetMisalRotShiftArray(),posSM1cen); | |
9584c261 | 542 | Float_t posSM2cen[3]={0.,0.,0.}; |
19db8f8c | 543 | depth = fRecoUtils->GetDepth(p2.Energy(),fRecoUtils->GetParticleType(),iSupMod2); |
544 | fEMCALGeo->RecalculateTowerPosition(11.5, 23.5, iSupMod2, depth, fRecoUtils->GetMisalTransShiftArray(),fRecoUtils->GetMisalRotShiftArray(),posSM2cen); | |
9584c261 | 545 | //printf("SM1 %d pos (%2.3f,%2.3f,%2.3f) \n",iSupMod1,posSM1cen[0],posSM1cen[1],posSM1cen[2]); |
546 | //printf("SM2 %d pos (%2.3f,%2.3f,%2.3f) \n",iSupMod2,posSM2cen[0],posSM2cen[1],posSM2cen[2]); | |
547 | ||
548 | TVector3 vecSM1cen(posSM1cen[0]-v[0],posSM1cen[1]-v[1],posSM1cen[2]-v[2]); | |
549 | TVector3 vecSM2cen(posSM2cen[0]-v[0],posSM2cen[1]-v[1],posSM2cen[2]-v[2]); | |
550 | Float_t inangle1 = p1.Angle(vecSM1cen)*TMath::RadToDeg(); | |
551 | Float_t inangle2 = p2.Angle(vecSM2cen)*TMath::RadToDeg(); | |
552 | //printf("Incident angle: cluster 1 %2.3f; cluster 2 %2.3f\n",inangle1,inangle2); | |
553 | ||
554 | fHOpeningAngle ->Fill(opangle,p12.Pt()); | |
555 | fHIncidentAngle->Fill(inangle1,p1.Pt()); | |
556 | fHIncidentAngle->Fill(inangle2,p2.Pt()); | |
557 | fHAsymmetry ->Fill(asym,p12.Pt()); | |
247abff4 | 558 | |
9584c261 | 559 | if(iSupMod1==iSupMod2) { |
560 | fHOpeningAngleSM[iSupMod1] ->Fill(opangle,p12.Pt()); | |
561 | fHIncidentAngleSM[iSupMod1]->Fill(inangle1,p1.Pt()); | |
562 | fHIncidentAngleSM[iSupMod1]->Fill(inangle2,p2.Pt()); | |
563 | fHAsymmetrySM[iSupMod1] ->Fill(asym,p12.Pt()); | |
564 | } | |
565 | else{ | |
566 | fHOpeningAngleDifferentSM ->Fill(opangle,p12.Pt()); | |
567 | fHIncidentAngleDifferentSM ->Fill(inangle1,p1.Pt()); | |
568 | fHIncidentAngleDifferentSM ->Fill(inangle2,p2.Pt()); | |
569 | fHAsymmetryDifferentSM ->Fill(asym,p12.Pt()); | |
570 | } | |
571 | ||
572 | if((iSupMod1==0 && iSupMod2==2) || (iSupMod1==2 && iSupMod2==0)) { | |
573 | fHOpeningAnglePairSM[0] ->Fill(opangle,p12.Pt()); | |
574 | fHIncidentAnglePairSM[0]->Fill(inangle1,p1.Pt()); | |
575 | fHIncidentAnglePairSM[0]->Fill(inangle2,p2.Pt()); | |
576 | fHAsymmetryPairSM[0] ->Fill(asym,p12.Pt()); | |
247abff4 | 577 | |
9584c261 | 578 | } |
579 | if((iSupMod1==1 && iSupMod2==3) || (iSupMod1==3 && iSupMod2==1)) { | |
580 | fHOpeningAnglePairSM[1] ->Fill(opangle,p12.Pt()); | |
581 | fHIncidentAnglePairSM[1]->Fill(inangle1,p1.Pt()); | |
582 | fHIncidentAnglePairSM[1]->Fill(inangle2,p2.Pt()); | |
583 | fHAsymmetryPairSM[1] ->Fill(asym,p12.Pt()); | |
247abff4 | 584 | |
9584c261 | 585 | } |
586 | ||
587 | if((iSupMod1==0 && iSupMod2==1) || (iSupMod1==1 && iSupMod2==0)) { | |
588 | fHOpeningAnglePairSM[2] ->Fill(opangle,p12.Pt()); | |
589 | fHIncidentAnglePairSM[2]->Fill(inangle1,p1.Pt()); | |
590 | fHIncidentAnglePairSM[2]->Fill(inangle2,p2.Pt()); | |
591 | fHAsymmetryPairSM[2] ->Fill(asym,p12.Pt()); | |
247abff4 | 592 | |
593 | ||
9584c261 | 594 | } |
595 | if((iSupMod1==2 && iSupMod2==3) || (iSupMod1==3 && iSupMod2==2)) { | |
596 | fHOpeningAnglePairSM[3] ->Fill(opangle,p12.Pt()); | |
597 | fHIncidentAnglePairSM[3]->Fill(inangle1,p1.Pt()); | |
598 | fHIncidentAnglePairSM[3]->Fill(inangle2,p2.Pt()); | |
599 | fHAsymmetryPairSM[3] ->Fill(asym,p12.Pt()); | |
600 | } | |
247abff4 | 601 | |
9584c261 | 602 | }// pair in 100 < mass < 160 |
247abff4 | 603 | |
9584c261 | 604 | }//in acceptance cuts |
2dfb1428 | 605 | |
606 | //In case of filling only channels with second cluster in same SM | |
607 | if(fSameSM && iSupMod1!=iSupMod2) continue; | |
608 | ||
70ae4900 | 609 | if (fGroupNCells == 0){ |
247abff4 | 610 | fHmpi0[iSupMod1][ieta1][iphi1]->Fill(invmass); |
611 | fHmpi0[iSupMod2][ieta2][iphi2]->Fill(invmass); | |
9584c261 | 612 | |
247abff4 | 613 | if(invmass > 100. && invmass < 160.){//restrict to clusters really close to pi0 peak |
614 | fhTowerDecayPhotonHit [iSupMod1]->Fill(ieta1,iphi1); | |
615 | fhTowerDecayPhotonEnergy [iSupMod1]->Fill(ieta1,iphi1,p1.E()); | |
616 | fhTowerDecayPhotonAsymmetry[iSupMod1]->Fill(ieta1,iphi1,asym); | |
617 | ||
618 | fhTowerDecayPhotonHit [iSupMod2]->Fill(ieta2,iphi2); | |
619 | fhTowerDecayPhotonEnergy [iSupMod2]->Fill(ieta2,iphi2,p2.E()); | |
620 | fhTowerDecayPhotonAsymmetry[iSupMod2]->Fill(ieta2,iphi2,asym); | |
621 | ||
622 | }// pair in mass of pi0 | |
70ae4900 | 623 | } |
624 | else { | |
625 | //printf("Regroup N %d, eta1 %d, phi1 %d, eta2 %d, phi2 %d \n",fGroupNCells, ieta1, iphi1, ieta2, iphi2); | |
626 | for (Int_t i = -fGroupNCells; i < fGroupNCells+1; i++) { | |
627 | for (Int_t j = -fGroupNCells; j < fGroupNCells+1; j++) { | |
628 | //printf("\t i %d, j %d\n",i,j); | |
629 | if((ieta1+i >= 0) && (iphi1+j >= 0) && (ieta1+i < 48) && (iphi1+j < 24)){ | |
630 | //printf("\t \t eta1+i %d, phi1+j %d\n", ieta1+i, iphi1+j); | |
631 | fHmpi0[iSupMod1][ieta1+i][iphi1+j]->Fill(invmass); | |
632 | } | |
633 | if((ieta2+i >= 0) && (iphi2+j >= 0) && (ieta2+i < 48) && (iphi2+j < 24)){ | |
634 | //printf("\t \t eta2+i %d, phi2+j %d\n", ieta2+i, iphi2+j); | |
635 | fHmpi0[iSupMod2][ieta2+i][iphi2+j]->Fill(invmass); | |
636 | } | |
637 | }// j loop | |
638 | }//i loop | |
639 | }//group cells | |
640 | ||
641 | if(DebugLevel() > 1) printf("AliAnalysisTaskEMCALPi0CalibSelection Mass in (SM%d,%d,%d) and (SM%d,%d,%d): %.3f GeV E1_i=%f E1_ii=%f E2_i=%f E2_ii=%f\n", | |
247abff4 | 642 | iSupMod1,iphi1,ieta1,iSupMod2,iphi2,ieta2,p12.M(),e1i,c1->E(),e2i,c2->E()); |
6eb2a715 | 643 | } |
644 | ||
375cec9b | 645 | } |
646 | ||
647 | } // end of loop over EMCAL clusters | |
648 | ||
649 | delete caloClustersArr; | |
6eb2a715 | 650 | |
375cec9b | 651 | PostData(1,fOutputContainer); |
6eb2a715 | 652 | |
375cec9b | 653 | } |
cfce8d44 | 654 | |
375cec9b | 655 | //__________________________________________________ |
6eb2a715 | 656 | //void AliAnalysisTaskEMCALPi0CalibSelection::SetCalibCorrections(AliEMCALCalibData* const cdata) |
657 | //{ | |
658 | // //Set new correction factors (~1) to calibration coefficients, delete previous. | |
659 | // | |
660 | // if(fCalibData) delete fCalibData; | |
661 | // fCalibData = cdata; | |
662 | // | |
663 | //} |