]>
Commit | Line | Data |
---|---|---|
e727d2f7 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: Boris Polishchuk * | |
7a4cf423 | 5 | * Adapted to AOD reading by Gustavo Conesa * |
e727d2f7 | 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 anywhere in PHOS.// | |
22 | // // | |
23 | //---------------------------------------------------------------------------// | |
24 | ||
25 | #include <cstdlib> | |
26 | ||
27 | // Root | |
28 | #include "TLorentzVector.h" | |
29 | #include "TVector3.h" | |
e727d2f7 | 30 | #include "TRefArray.h" |
31 | #include "TList.h" | |
32 | ||
33 | // AliRoot | |
34 | #include "AliAnalysisTaskPHOSPi0CalibSelection.h" | |
e727d2f7 | 35 | #include "AliAODEvent.h" |
4b4efabc | 36 | #include "AliESDEvent.h" |
7a4cf423 | 37 | #include "AliESDCaloCluster.h" |
38 | #include "AliESDCaloCells.h" | |
e727d2f7 | 39 | #include "AliPHOSAodCluster.h" |
e727d2f7 | 40 | #include "AliPHOSPIDv1.h" |
41 | ||
e727d2f7 | 42 | ClassImp(AliAnalysisTaskPHOSPi0CalibSelection) |
43 | ||
7a4cf423 | 44 | //__________________________________________________ |
e727d2f7 | 45 | AliAnalysisTaskPHOSPi0CalibSelection::AliAnalysisTaskPHOSPi0CalibSelection() : |
4b4efabc | 46 | AliAnalysisTaskSE(),fOutputContainer(0x0),fPhosGeo(0x0),fCalibData(0x0),fHmgg(0x0), |
7a4cf423 | 47 | fEmin(0.), fLogWeight(4.5), fCopyAOD(kFALSE) |
e727d2f7 | 48 | { |
49 | //Default constructor. | |
50 | ||
51 | for(Int_t iMod=0; iMod<5; iMod++) { | |
52 | for(Int_t iX=0; iX<64; iX++) { | |
53 | for(Int_t iZ=0; iZ<56; iZ++) { | |
54 | fHmpi0[iMod][iX][iZ]=0; | |
55 | } | |
56 | } | |
57 | } | |
58 | ||
59 | } | |
60 | ||
7a4cf423 | 61 | //__________________________________________________ |
e727d2f7 | 62 | AliAnalysisTaskPHOSPi0CalibSelection::AliAnalysisTaskPHOSPi0CalibSelection(const char* name) : |
4b4efabc | 63 | AliAnalysisTaskSE(name),fOutputContainer(0x0),fPhosGeo(0x0),fCalibData(0x0),fHmgg(0x0), |
7a4cf423 | 64 | fEmin(0.), fLogWeight(4.5), fCopyAOD(kFALSE) |
e727d2f7 | 65 | { |
66 | //Named constructor which should be used. | |
67 | ||
68 | DefineOutput(1,TList::Class()); | |
69 | ||
70 | for(Int_t iMod=0; iMod<5; iMod++) { | |
71 | for(Int_t iX=0; iX<64; iX++) { | |
72 | for(Int_t iZ=0; iZ<56; iZ++) { | |
73 | fHmpi0[iMod][iX][iZ]=0; | |
74 | } | |
75 | } | |
76 | } | |
77 | ||
78 | } | |
79 | ||
7a4cf423 | 80 | //__________________________________________________ |
e727d2f7 | 81 | AliAnalysisTaskPHOSPi0CalibSelection::~AliAnalysisTaskPHOSPi0CalibSelection() |
82 | { | |
83 | //Destructor. | |
84 | ||
85 | if(fOutputContainer){ | |
86 | fOutputContainer->Delete() ; | |
87 | delete fOutputContainer ; | |
88 | } | |
4b4efabc | 89 | |
90 | if(fCalibData) delete fCalibData; | |
91 | if(fPhosGeo) delete fPhosGeo; | |
92 | ||
e727d2f7 | 93 | } |
94 | ||
7a4cf423 | 95 | //__________________________________________________ |
96 | void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromAOD() | |
97 | { | |
98 | // Copy AOD header, vertex, CaloClusters and CaloCells to output AOD | |
99 | ||
100 | AliAODEvent* aod = dynamic_cast<AliAODEvent*>(InputEvent()); | |
101 | ||
2dfb1428 | 102 | if(!aod) { |
103 | printf("AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromAOD() - This event does not contain AODs?"); | |
104 | return; | |
105 | } | |
106 | ||
7a4cf423 | 107 | // set arrays and pointers |
108 | Float_t posF[3]; | |
109 | Double_t pos[3]; | |
110 | ||
111 | Double_t covVtx[6]; | |
112 | ||
113 | for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.; | |
114 | ||
115 | // Update the header | |
29a41d05 | 116 | AliAODHeader*headerin = aod->GetHeader(); |
7a4cf423 | 117 | AliAODHeader* header = AODEvent()->GetHeader(); |
118 | header->SetRunNumber(headerin->GetRunNumber()); | |
119 | header->SetBunchCrossNumber(headerin->GetBunchCrossNumber()); | |
120 | header->SetOrbitNumber(headerin->GetOrbitNumber()); | |
121 | header->SetPeriodNumber(headerin->GetPeriodNumber()); | |
122 | header->SetEventType(headerin->GetEventType()); | |
29a41d05 | 123 | header->SetMuonMagFieldScale(headerin->GetMuonMagFieldScale()); |
124 | header->SetCentrality(headerin->GetCentrality()); | |
7a4cf423 | 125 | |
126 | header->SetTriggerMask(headerin->GetTriggerMask()); | |
127 | header->SetTriggerCluster(headerin->GetTriggerCluster()); | |
128 | header->SetMagneticField(headerin->GetMagneticField()); | |
129 | header->SetZDCN1Energy(headerin->GetZDCN1Energy()); | |
130 | header->SetZDCP1Energy(headerin->GetZDCP1Energy()); | |
131 | header->SetZDCN2Energy(headerin->GetZDCN2Energy()); | |
132 | header->SetZDCP2Energy(headerin->GetZDCP2Energy()); | |
133 | header->SetZDCEMEnergy(headerin->GetZDCEMEnergy(0),headerin->GetZDCEMEnergy(1)); | |
134 | Float_t diamxy[2]={aod->GetDiamondX(),aod->GetDiamondY()}; | |
135 | Float_t diamcov[3]; aod->GetDiamondCovXY(diamcov); | |
136 | header->SetDiamond(diamxy,diamcov); | |
137 | // | |
138 | // | |
139 | Int_t nVertices = 1 ;/* = prim. vtx*/; | |
c8fe2783 | 140 | Int_t nCaloClus = aod->GetNumberOfCaloClusters(); |
7a4cf423 | 141 | |
142 | AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0); | |
143 | ||
144 | // Access to the AOD container of vertices | |
145 | TClonesArray &vertices = *(AODEvent()->GetVertices()); | |
146 | Int_t jVertices=0; | |
147 | ||
148 | // Add primary vertex. The primary tracks will be defined | |
149 | // after the loops on the composite objects (V0, cascades, kinks) | |
150 | const AliAODVertex *vtx = aod->GetPrimaryVertex(); | |
151 | ||
152 | vtx->GetXYZ(pos); // position | |
153 | vtx->GetCovMatrix(covVtx); //covariance matrix | |
154 | ||
155 | AliAODVertex * primary = new(vertices[jVertices++]) | |
156 | AliAODVertex(pos, covVtx, vtx->GetChi2perNDF(), NULL, -1, AliAODVertex::kPrimary); | |
157 | primary->SetName(vtx->GetName()); | |
158 | primary->SetTitle(vtx->GetTitle()); | |
159 | ||
160 | // Access to the AOD container of clusters | |
161 | TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters()); | |
162 | Int_t jClusters=0; | |
163 | ||
164 | for (Int_t iClust=0; iClust<nCaloClus; ++iClust) { | |
165 | ||
166 | AliAODCaloCluster * cluster = aod->GetCaloCluster(iClust); | |
167 | ||
168 | //Check if it is a PHOS cluster | |
c8fe2783 | 169 | if(!cluster->IsPHOS()) continue ; |
7a4cf423 | 170 | |
171 | Int_t id = cluster->GetID(); | |
172 | Float_t energy = cluster->E(); | |
173 | cluster->GetPosition(posF); | |
174 | Char_t ttype = cluster->GetType(); | |
175 | ||
176 | AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) | |
177 | AliAODCaloCluster(id, | |
178 | 0, | |
179 | 0x0, | |
180 | energy, | |
181 | posF, | |
182 | NULL, | |
183 | ttype); | |
184 | ||
c8fe2783 | 185 | caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), |
7a4cf423 | 186 | cluster->GetDispersion(), |
187 | cluster->GetM20(), cluster->GetM02(), | |
188 | cluster->GetEmcCpvDistance(), | |
189 | cluster->GetNExMax(),cluster->GetTOF()) ; | |
190 | ||
c8fe2783 | 191 | caloCluster->SetPIDFromESD(cluster->GetPID()); |
7a4cf423 | 192 | caloCluster->SetNCells(cluster->GetNCells()); |
193 | caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); | |
194 | caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); | |
195 | ||
196 | } | |
197 | ||
198 | caloClusters.Expand(jClusters); // resize TObjArray to 'remove' slots for pseudo clusters | |
199 | // end of loop on calo clusters | |
200 | ||
201 | // fill PHOS cell info | |
202 | if (aod->GetPHOSCells()) { // protection against missing AOD information | |
203 | AliAODCaloCells &aodinPHcells = *(aod->GetPHOSCells()); | |
204 | Int_t nPHcell = aodinPHcells.GetNumberOfCells() ; | |
205 | ||
206 | AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells()); | |
207 | aodPHcells.CreateContainer(nPHcell); | |
c8fe2783 | 208 | aodPHcells.SetType(AliVCaloCells::kPHOSCell); |
7a4cf423 | 209 | for (Int_t iCell = 0; iCell < nPHcell; iCell++) { |
210 | aodPHcells.SetCell(iCell,aodinPHcells.GetCellNumber(iCell),aodinPHcells.GetAmplitude(iCell)); | |
211 | } | |
212 | aodPHcells.Sort(); | |
213 | } | |
214 | ||
215 | return; | |
216 | } | |
217 | ||
218 | //__________________________________________________ | |
219 | void AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromESD() | |
220 | { | |
221 | ||
222 | // Copy Header, Vertex, CaloClusters and CaloCells from ESDs to AODs | |
223 | ||
224 | AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent()); | |
225 | ||
2dfb1428 | 226 | if(!esd) { |
227 | printf("AliAnalysisTaskPHOSPi0CalibSelection::CreateAODFromESD() - This event does not contain AODs?"); | |
228 | return; | |
229 | } | |
230 | ||
7a4cf423 | 231 | // set arrays and pointers |
232 | Float_t posF[3]; | |
233 | Double_t pos[3]; | |
234 | ||
235 | Double_t covVtx[6]; | |
236 | ||
237 | for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.; | |
238 | ||
239 | // Update the header | |
240 | ||
241 | AliAODHeader* header = AODEvent()->GetHeader(); | |
242 | header->SetRunNumber(esd->GetRunNumber()); | |
243 | header->SetBunchCrossNumber(esd->GetBunchCrossNumber()); | |
244 | header->SetOrbitNumber(esd->GetOrbitNumber()); | |
245 | header->SetPeriodNumber(esd->GetPeriodNumber()); | |
246 | header->SetEventType(esd->GetEventType()); | |
247 | header->SetMuonMagFieldScale(-999.); // FIXME | |
248 | header->SetCentrality(-999.); // FIXME | |
249 | ||
250 | ||
251 | header->SetTriggerMask(esd->GetTriggerMask()); | |
252 | header->SetTriggerCluster(esd->GetTriggerCluster()); | |
253 | header->SetMagneticField(esd->GetMagneticField()); | |
254 | header->SetZDCN1Energy(esd->GetZDCN1Energy()); | |
255 | header->SetZDCP1Energy(esd->GetZDCP1Energy()); | |
256 | header->SetZDCN2Energy(esd->GetZDCN2Energy()); | |
257 | header->SetZDCP2Energy(esd->GetZDCP2Energy()); | |
258 | header->SetZDCEMEnergy(esd->GetZDCEMEnergy(0),esd->GetZDCEMEnergy(1)); | |
259 | Float_t diamxy[2]={esd->GetDiamondX(),esd->GetDiamondY()}; | |
260 | Float_t diamcov[3]; esd->GetDiamondCovXY(diamcov); | |
261 | header->SetDiamond(diamxy,diamcov); | |
262 | // | |
263 | // | |
264 | Int_t nVertices = 1 ;/* = prim. vtx*/; | |
265 | Int_t nCaloClus = esd->GetNumberOfCaloClusters(); | |
266 | ||
267 | AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0); | |
268 | ||
269 | // Access to the AOD container of vertices | |
270 | TClonesArray &vertices = *(AODEvent()->GetVertices()); | |
271 | Int_t jVertices=0; | |
272 | ||
273 | // Add primary vertex. The primary tracks will be defined | |
274 | // after the loops on the composite objects (V0, cascades, kinks) | |
275 | const AliESDVertex *vtx = esd->GetPrimaryVertex(); | |
276 | ||
277 | vtx->GetXYZ(pos); // position | |
278 | vtx->GetCovMatrix(covVtx); //covariance matrix | |
279 | ||
280 | AliAODVertex * primary = new(vertices[jVertices++]) | |
281 | AliAODVertex(pos, covVtx, vtx->GetChi2toNDF(), NULL, -1, AliAODVertex::kPrimary); | |
282 | primary->SetName(vtx->GetName()); | |
283 | primary->SetTitle(vtx->GetTitle()); | |
284 | ||
285 | // Access to the AOD container of clusters | |
286 | TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters()); | |
287 | Int_t jClusters=0; | |
288 | ||
289 | for (Int_t iClust=0; iClust<nCaloClus; ++iClust) { | |
290 | ||
291 | AliESDCaloCluster * cluster = esd->GetCaloCluster(iClust); | |
292 | ||
293 | //Check which calorimeter information we want to keep. | |
294 | if(!cluster->IsPHOS()) continue ; | |
295 | ||
296 | Int_t id = cluster->GetID(); | |
297 | Float_t energy = cluster->E(); | |
298 | cluster->GetPosition(posF); | |
299 | ||
300 | AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) | |
301 | AliAODCaloCluster(id, | |
302 | 0, | |
303 | 0x0, | |
304 | energy, | |
305 | posF, | |
306 | NULL, | |
307 | AliAODCluster::kPHOSNeutral); | |
308 | ||
309 | caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), | |
c8fe2783 | 310 | cluster->GetDispersion(), |
7a4cf423 | 311 | cluster->GetM20(), cluster->GetM02(), |
312 | cluster->GetEmcCpvDistance(), | |
313 | cluster->GetNExMax(),cluster->GetTOF()) ; | |
314 | ||
c8fe2783 | 315 | caloCluster->SetPIDFromESD(cluster->GetPID()); |
7a4cf423 | 316 | caloCluster->SetNCells(cluster->GetNCells()); |
317 | caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); | |
318 | caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); | |
319 | ||
320 | } | |
321 | caloClusters.Expand(jClusters); // resize TObjArray to 'remove' slots for pseudo clusters | |
322 | // end of loop on calo clusters | |
323 | ||
324 | // fill PHOS cell info | |
325 | if( esd->GetPHOSCells()) { // protection against missing ESD information | |
326 | AliESDCaloCells &esdPHcells = *(esd->GetPHOSCells()); | |
327 | Int_t nPHcell = esdPHcells.GetNumberOfCells() ; | |
328 | ||
329 | AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells()); | |
330 | aodPHcells.CreateContainer(nPHcell); | |
c8fe2783 | 331 | aodPHcells.SetType(AliVCaloCells::kPHOSCell); |
7a4cf423 | 332 | for (Int_t iCell = 0; iCell < nPHcell; iCell++) { |
333 | aodPHcells.SetCell(iCell,esdPHcells.GetCellNumber(iCell),esdPHcells.GetAmplitude(iCell)); | |
334 | } | |
335 | aodPHcells.Sort(); | |
336 | } | |
337 | ||
338 | } | |
339 | ||
340 | //__________________________________________________ | |
e727d2f7 | 341 | void AliAnalysisTaskPHOSPi0CalibSelection::UserCreateOutputObjects() |
342 | { | |
343 | //Create output container | |
344 | fOutputContainer = new TList(); | |
2dfb1428 | 345 | const Int_t buffersize = 255; |
346 | char hname[buffersize], htitl[buffersize]; | |
e727d2f7 | 347 | |
348 | for(Int_t iMod=0; iMod<5; iMod++) { | |
349 | for(Int_t iX=0; iX<64; iX++) { | |
350 | for(Int_t iZ=0; iZ<56; iZ++) { | |
2dfb1428 | 351 | snprintf(hname,buffersize,"%d_%d_%d",iMod,iX,iZ); |
352 | snprintf(htitl,buffersize,"Two-gamma inv. mass for mod %d, cell (%d,%d)",iMod,iX,iZ); | |
353 | fHmpi0[iMod][iX][iZ] = new TH1F(hname,htitl,100,0.,300.); | |
354 | fOutputContainer->Add(fHmpi0[iMod][iX][iZ]); | |
e727d2f7 | 355 | } |
356 | } | |
357 | } | |
358 | ||
359 | fHmgg = new TH1F("hmgg","2-cluster invariant mass",100,0.,300.); | |
360 | fOutputContainer->Add(fHmgg); | |
361 | ||
f6b9f90c | 362 | fCalibData = new AliPHOSCalibData(); |
363 | fPhosGeo = AliPHOSGeometry::GetInstance("IHEP") ; | |
364 | ||
e727d2f7 | 365 | } |
366 | ||
7a4cf423 | 367 | //__________________________________________________ |
e727d2f7 | 368 | void AliAnalysisTaskPHOSPi0CalibSelection::UserExec(Option_t* /* option */) |
369 | { | |
370 | //Analysis per event. | |
29a41d05 | 371 | if(DebugLevel() > 1) printf("AliAnalysisTaskPHOSPi0CalibSelection <<< Event %d >>>\n",(Int_t)Entry()); |
7a4cf423 | 372 | |
e727d2f7 | 373 | AliAODEvent* aod = 0x0; |
7a4cf423 | 374 | if(!strcmp(InputEvent()->GetName(),"AliAODEvent")) { |
375 | //Input are ESDs | |
376 | aod = dynamic_cast<AliAODEvent*>(InputEvent()); | |
2dfb1428 | 377 | if(!aod) { |
378 | printf("AliAnalysisTaskEMCALPi0CalibSelection::UserExec() - This event does not contain AODs?"); | |
379 | return; | |
380 | } | |
381 | ||
7a4cf423 | 382 | // Create new AOD with only CaloClusters and CaloCells |
383 | if(fCopyAOD) CreateAODFromAOD(); | |
384 | } | |
385 | else if(!strcmp(InputEvent()->GetName(),"AliESDEvent")) { | |
386 | //Input are ESDs | |
387 | aod = AODEvent(); | |
2dfb1428 | 388 | if(!aod) { |
389 | printf("AliAnalysisTaskPHOSPi0CalibSelection::UserExec() - This event does not contain AODs?"); | |
390 | return; | |
391 | } | |
392 | ||
7a4cf423 | 393 | // Create AOD with CaloClusters and use it as input. |
394 | // If filtering task is already executed, this is not needed. | |
395 | if(fCopyAOD) CreateAODFromESD(); | |
396 | } | |
e727d2f7 | 397 | else { |
7a4cf423 | 398 | printf("AliAnalysisTaskPHOSPi0CalibSelection: Unknown event type, STOP!\n"); |
399 | abort(); | |
e727d2f7 | 400 | } |
401 | ||
402 | Double_t v[] = {aod->GetVertex(0)->GetX(),aod->GetVertex(0)->GetY(),aod->GetVertex(0)->GetZ()}; //to check!! | |
403 | //aod->GetVertex()->GetXYZ(v) ; | |
404 | TVector3 vtx(v); //Check | |
405 | ||
f6b9f90c | 406 | if(DebugLevel() > 1) printf("AliAnalysisTaskPHOSPi0CalibSelection Vertex: (%.3f,%.3f,%.3f)\n",vtx.X(),vtx.Y(),vtx.Z()); |
e727d2f7 | 407 | |
408 | Int_t runNum = aod->GetRunNumber(); | |
f6b9f90c | 409 | if(DebugLevel() > 1) printf("Run number: %d\n",runNum); |
4b4efabc | 410 | |
411 | //Get the matrix with geometry information | |
412 | //Still not implemented in AOD, just a workaround to be able to work at least with ESDs | |
f6b9f90c | 413 | if(!strcmp(InputEvent()->GetName(),"AliAODEvent")) { |
414 | if(DebugLevel() > 1) | |
415 | printf("AliAnalysisTaskPHOSPi0CalibSelection Use ideal geometry, values geometry matrix not kept in AODs.\n"); | |
416 | } | |
4b4efabc | 417 | else{ |
f6b9f90c | 418 | if(DebugLevel() > 1) printf("AliAnalysisTaskPHOSPi0CalibSelection Load Misaligned matrices. \n"); |
4b4efabc | 419 | AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent()) ; |
2dfb1428 | 420 | if(!esd) { |
421 | printf("AliAnalysisTaskPHOSPi0CalibSelection::UserExec() - This event does not contain ESDs?"); | |
422 | return; | |
423 | } | |
f6b9f90c | 424 | for(Int_t mod=0; mod<5; mod++){ |
425 | if(esd->GetPHOSMatrix(mod)) | |
426 | fPhosGeo->SetMisalMatrix(esd->GetPHOSMatrix(mod),mod) ; | |
427 | } | |
e727d2f7 | 428 | } |
4b4efabc | 429 | |
f6b9f90c | 430 | if(DebugLevel() > 1) printf("AliAnalysisTaskPHOSPi0CalibSelection Will use fLogWeight %.3f .\n",fLogWeight); |
e727d2f7 | 431 | |
e727d2f7 | 432 | Int_t mod1 = -1; |
433 | TLorentzVector p1; | |
434 | TLorentzVector p2; | |
435 | TLorentzVector p12; | |
436 | Int_t relid[4] ; | |
437 | Int_t maxId; | |
438 | ||
439 | TRefArray * caloClustersArr = new TRefArray(); | |
440 | aod->GetPHOSClusters(caloClustersArr); | |
441 | ||
442 | const Int_t kNumberOfPhosClusters = caloClustersArr->GetEntries() ; | |
f6b9f90c | 443 | if(DebugLevel() > 1) printf("AliAnalysisTaskPHOSPi0CalibSelection CaloClusters: %d\n", kNumberOfPhosClusters); |
e727d2f7 | 444 | |
445 | // PHOS cells | |
446 | AliAODCaloCells *phsCells = aod->GetPHOSCells(); | |
447 | ||
448 | // loop over PHOS clusters | |
449 | for(Int_t iClu=0; iClu<kNumberOfPhosClusters; iClu++) { | |
450 | ||
451 | AliAODCaloCluster *c1 = (AliAODCaloCluster *) caloClustersArr->At(iClu); | |
c8fe2783 | 452 | if(!c1->IsPHOS()) continue; // EMCAL cluster! |
e727d2f7 | 453 | |
454 | Float_t e1i = c1->E(); // cluster energy before correction | |
455 | if(e1i<fEmin) continue; | |
456 | ||
457 | AliPHOSAodCluster clu1(*c1); | |
4b4efabc | 458 | clu1.Recalibrate(fCalibData, phsCells); |
459 | clu1.EvalAll(fLogWeight,vtx); | |
f6948be4 | 460 | clu1.EnergyCorrection() ; |
e727d2f7 | 461 | |
462 | clu1.GetMomentum(p1,v); | |
463 | ||
464 | MaxEnergyCellPos(phsCells,&clu1,maxId); | |
465 | fPhosGeo->AbsToRelNumbering(maxId, relid); | |
466 | ||
467 | mod1 = relid[0]-1; // module | |
468 | Int_t iX = relid[2]-1; // cluster X-coord | |
469 | Int_t iZ = relid[3]-1; // cluster Z-coord | |
470 | Float_t e1ii = clu1.E(); // cluster energy after correction | |
471 | ||
472 | for (Int_t jClu=iClu; jClu<kNumberOfPhosClusters; jClu++) { | |
473 | AliAODCaloCluster *c2 = (AliAODCaloCluster *) caloClustersArr->At(jClu); | |
c8fe2783 | 474 | if(!c2->IsPHOS()) continue; // EMCAL cluster! |
e727d2f7 | 475 | if(c2->IsEqual(c1)) continue; |
476 | ||
477 | Float_t e2i = c2->E(); | |
478 | if(e2i<fEmin) continue; | |
479 | ||
480 | AliPHOSAodCluster clu2(*c2); | |
4b4efabc | 481 | clu2.Recalibrate(fCalibData, phsCells); |
482 | clu2.EvalAll(fLogWeight,vtx); | |
f6948be4 | 483 | clu2.EnergyCorrection() ; |
e727d2f7 | 484 | |
485 | clu2.GetMomentum(p2,v); | |
486 | Float_t e2ii = clu2.E(); | |
487 | ||
488 | p12 = p1+p2; | |
489 | ||
490 | fHmgg->Fill(p12.M()*1000); | |
491 | fHmpi0[mod1][iX][iZ]->Fill(p12.M()*1000); | |
492 | ||
f6b9f90c | 493 | if(DebugLevel() > 1) printf("AliAnalysisTaskPHOSPi0CalibSelection Mass in (mod%d,%d,%d): %.3f GeV E1_i=%f E1_ii=%f E2_i=%f E2_ii=%f\n", |
e727d2f7 | 494 | mod1,iX,iZ,p12.M(),e1i,e1ii,e2i,e2ii); |
495 | } | |
496 | ||
497 | } // end of loop over PHOS clusters | |
498 | ||
499 | delete caloClustersArr; | |
500 | PostData(1,fOutputContainer); | |
501 | } | |
502 | ||
7a4cf423 | 503 | //__________________________________________________ |
e727d2f7 | 504 | void AliAnalysisTaskPHOSPi0CalibSelection::MaxEnergyCellPos(AliAODCaloCells *cells, AliAODCaloCluster* clu, Int_t& maxId) |
505 | { | |
506 | //For a given CaloCluster calculates the absId of the cell | |
507 | //with maximum energy deposit. | |
508 | ||
509 | Double_t eMax = -111; | |
510 | ||
511 | for (Int_t iDig=0; iDig< clu->GetNCells(); iDig++) { | |
512 | Int_t cellAbsId = clu->GetCellAbsId(iDig); | |
513 | Double_t eCell = cells->GetCellAmplitude(cellAbsId)*clu->GetCellAmplitudeFraction(iDig); | |
514 | if(eCell>eMax) { | |
515 | eMax = eCell; | |
516 | maxId = cellAbsId; | |
517 | } | |
518 | } | |
519 | ||
520 | } | |
4b4efabc | 521 | |
7a4cf423 | 522 | //__________________________________________________ |
4b4efabc | 523 | void AliAnalysisTaskPHOSPi0CalibSelection::SetCalibCorrections(AliPHOSCalibData* cdata) |
524 | { | |
525 | //Set new correction factors (~1) to calibration coefficients, delete previous. | |
526 | ||
527 | if(fCalibData) delete fCalibData; | |
528 | fCalibData = cdata; | |
529 | ||
530 | } | |
531 |