]>
Commit | Line | Data |
---|---|---|
7a4cf423 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
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 | /* $Id: AliAnalysisTaskCaloFilter.cxx $ */ | |
17 | ||
18 | ////////////////////////////////////////////////////////// | |
19 | // Filter the ESDCaloClusters and ESDCaloCells of EMCAL, | |
20 | // PHOS or both, creating the corresponing AODCaloClusters | |
21 | // and AODCaloCells. | |
22 | // Keep also the AODHeader information and the vertex. | |
23 | // Needed for calorimeter calibration. | |
24 | // Copy of AliAnalysisTaskESDfilter. | |
25 | // Author: Gustavo Conesa Balbastre (INFN - Frascati) | |
26 | ////////////////////////////////////////////////////////// | |
27 | ||
28 | #include "AliAnalysisTaskCaloFilter.h" | |
29 | #include "AliESDEvent.h" | |
30 | #include "AliAODEvent.h" | |
7a4cf423 | 31 | #include "AliLog.h" |
247abff4 | 32 | #include "AliVCluster.h" |
33 | #include "AliVCaloCells.h" | |
34 | #include "AliEMCALRecoUtils.h" | |
35 | #include "AliEMCALGeometry.h" | |
36 | #include "AliVEventHandler.h" | |
37 | #include "AliAnalysisManager.h" | |
38 | #include "AliInputEventHandler.h" | |
3a58eee6 | 39 | #include "AliESDtrackCuts.h" |
3b13c34c | 40 | #include "TGeoManager.h" |
7a4cf423 | 41 | |
42 | ClassImp(AliAnalysisTaskCaloFilter) | |
43 | ||
44 | //////////////////////////////////////////////////////////////////////// | |
45 | ||
46 | AliAnalysisTaskCaloFilter::AliAnalysisTaskCaloFilter(): | |
247abff4 | 47 | AliAnalysisTaskSE(), //fCuts(0x0), |
48 | fCaloFilter(0), fCorrect(kFALSE), | |
3b13c34c | 49 | fEMCALGeo(0x0),fEMCALGeoName("EMCAL_FIRSTYEARV1"), |
3a58eee6 | 50 | fEMCALRecoUtils(new AliEMCALRecoUtils), |
3b13c34c | 51 | fESDtrackCuts(0), fTrackMultEtaCut(0.8), |
52 | fLoadEMCALMatrices(kFALSE), //fLoadPHOSMatrices(kFALSE), | |
53 | fGeoMatrixSet(kFALSE) | |
7a4cf423 | 54 | { |
55 | // Default constructor | |
3a58eee6 | 56 | fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); |
3b13c34c | 57 | for(Int_t i = 0; i < 10; i++) fEMCALMatrix[i] = 0 ; |
58 | //for(Int_t i = 0; i < 5 ; i++) fPHOSMatrix[i] = 0 ; | |
3a58eee6 | 59 | |
7a4cf423 | 60 | } |
61 | ||
62 | //__________________________________________________ | |
63 | AliAnalysisTaskCaloFilter::AliAnalysisTaskCaloFilter(const char* name): | |
247abff4 | 64 | AliAnalysisTaskSE(name), //fCuts(0x0), |
65 | fCaloFilter(0), fCorrect(kFALSE), | |
3b13c34c | 66 | fEMCALGeo(0x0),fEMCALGeoName("EMCAL_FIRSTYEARV1"), |
3a58eee6 | 67 | fEMCALRecoUtils(new AliEMCALRecoUtils), |
3b13c34c | 68 | fESDtrackCuts(0), fTrackMultEtaCut(0.8), |
69 | fLoadEMCALMatrices(kFALSE), //fLoadPHOSMatrices(kFALSE), | |
70 | fGeoMatrixSet(kFALSE) | |
7a4cf423 | 71 | { |
72 | // Constructor | |
3a58eee6 | 73 | fESDtrackCuts = AliESDtrackCuts::GetStandardITSTPCTrackCuts2010(); |
3b13c34c | 74 | for(Int_t i = 0; i < 10; i++) fEMCALMatrix[i] = 0 ; |
75 | //for(Int_t i = 0; i < 5 ; i++) fPHOSMatrix[i] = 0 ; | |
3a58eee6 | 76 | |
7a4cf423 | 77 | } |
78 | ||
79 | //__________________________________________________ | |
247abff4 | 80 | AliAnalysisTaskCaloFilter::~AliAnalysisTaskCaloFilter() |
7a4cf423 | 81 | { |
247abff4 | 82 | //Destructor. |
83 | ||
84 | if(fEMCALGeo) delete fEMCALGeo; | |
3a58eee6 | 85 | if(fEMCALRecoUtils) delete fEMCALRecoUtils; |
86 | if(fESDtrackCuts) delete fESDtrackCuts; | |
3b13c34c | 87 | |
247abff4 | 88 | } |
89 | ||
90 | //__________________________________________________ | |
91 | void AliAnalysisTaskCaloFilter::UserCreateOutputObjects() | |
92 | { | |
93 | // Init geometry | |
94 | ||
95 | fEMCALGeo = AliEMCALGeometry::GetInstance(fEMCALGeoName) ; | |
7a4cf423 | 96 | |
247abff4 | 97 | } |
98 | ||
99 | //__________________________________________________ | |
100 | void AliAnalysisTaskCaloFilter::UserExec(Option_t */*option*/) | |
101 | { | |
102 | // Execute analysis for current event | |
7a4cf423 | 103 | // |
7a4cf423 | 104 | |
247abff4 | 105 | if (fDebug > 0) |
106 | printf("CaloFilter: Analysing event # %d\n", (Int_t)Entry()); | |
7a4cf423 | 107 | |
247abff4 | 108 | // Copy input ESD or AOD header, vertex, CaloClusters and CaloCells to output AOD |
7a4cf423 | 109 | |
247abff4 | 110 | AliVEvent* event = InputEvent(); |
247abff4 | 111 | if(!event) { |
112 | printf("AliAnalysisTaskCaloFilter::CreateAODFromESD() - This event does not contain Input?"); | |
2dfb1428 | 113 | return; |
114 | } | |
fbad5435 | 115 | |
116 | //Magic line to write events to file | |
117 | AliAnalysisManager::GetAnalysisManager()->GetOutputEventHandler()->SetFillAOD(kTRUE); | |
118 | ||
fbad5435 | 119 | Bool_t bAOD = kFALSE; |
120 | if(!strcmp(event->GetName(),"AliAODEvent")) bAOD=kTRUE; | |
121 | Bool_t bESD = kFALSE; | |
122 | if(!strcmp(event->GetName(),"AliESDEvent")) bESD=kTRUE; | |
3a58eee6 | 123 | |
124 | //Get track multiplicity | |
125 | Int_t trackMult = 0; | |
126 | if(bESD){ | |
127 | Int_t nTracks = InputEvent()->GetNumberOfTracks() ; | |
128 | for (Int_t itrack = 0; itrack < nTracks; itrack++) {////////////// track loop | |
129 | AliVTrack * track = (AliVTrack*)InputEvent()->GetTrack(itrack) ; // retrieve track from esd | |
130 | if(!fESDtrackCuts->AcceptTrack((AliESDtrack*)track)) continue; | |
3b13c34c | 131 | //Count the tracks in eta < 0.8 |
3a58eee6 | 132 | if(TMath::Abs(track->Eta())< fTrackMultEtaCut) trackMult++; |
133 | } | |
134 | } | |
135 | ||
7a4cf423 | 136 | // set arrays and pointers |
137 | Float_t posF[3]; | |
138 | Double_t pos[3]; | |
139 | ||
140 | Double_t covVtx[6]; | |
141 | ||
142 | for (Int_t i = 0; i < 6; i++) covVtx[i] = 0.; | |
247abff4 | 143 | |
7a4cf423 | 144 | AliAODHeader* header = AODEvent()->GetHeader(); |
247abff4 | 145 | |
146 | header->SetRunNumber(event->GetRunNumber()); | |
147 | header->SetOfflineTrigger(fInputHandler->IsEventSelected()); // propagate the decision of the physics selection | |
148 | if(bESD) | |
149 | header->SetFiredTriggerClasses(((AliESDEvent*)event)->GetFiredTriggerClasses()); | |
150 | header->SetTriggerMask(event->GetTriggerMask()); | |
151 | header->SetTriggerCluster(event->GetTriggerCluster()); | |
152 | ||
153 | header->SetBunchCrossNumber(event->GetBunchCrossNumber()); | |
154 | header->SetOrbitNumber(event->GetOrbitNumber()); | |
155 | header->SetPeriodNumber(event->GetPeriodNumber()); | |
156 | header->SetEventType(event->GetEventType()); | |
7a4cf423 | 157 | header->SetMuonMagFieldScale(-999.); // FIXME |
3a58eee6 | 158 | //printf("Track Multiplicity for eta < %f: %d \n",fTrackMultEtaCut,trackMult); |
159 | header->SetCentrality((Double_t)trackMult); // FIXME | |
160 | //printf("Centrality %f\n",header->GetCentrality()); | |
7a4cf423 | 161 | |
247abff4 | 162 | header->SetTriggerMask(event->GetTriggerMask()); |
163 | header->SetTriggerCluster(event->GetTriggerCluster()); | |
164 | header->SetMagneticField(event->GetMagneticField()); | |
165 | header->SetZDCN1Energy(event->GetZDCN1Energy()); | |
166 | header->SetZDCP1Energy(event->GetZDCP1Energy()); | |
167 | header->SetZDCN2Energy(event->GetZDCN2Energy()); | |
168 | header->SetZDCP2Energy(event->GetZDCP2Energy()); | |
169 | header->SetZDCEMEnergy(event->GetZDCEMEnergy(0),event->GetZDCEMEnergy(1)); | |
170 | Float_t diamxy[2]={event->GetDiamondX(),event->GetDiamondY()}; | |
171 | Float_t diamcov[3]; event->GetDiamondCovXY(diamcov); | |
7a4cf423 | 172 | header->SetDiamond(diamxy,diamcov); |
247abff4 | 173 | if(bESD){ |
174 | header->SetDiamondZ(((AliESDEvent*)event)->GetDiamondZ(),((AliESDEvent*)event)->GetSigma2DiamondZ()); | |
175 | } | |
7a4cf423 | 176 | // |
177 | // | |
178 | Int_t nVertices = 1 ;/* = prim. vtx*/; | |
247abff4 | 179 | Int_t nCaloClus = event->GetNumberOfCaloClusters(); |
7a4cf423 | 180 | |
181 | AODEvent()->ResetStd(0, nVertices, 0, 0, 0, nCaloClus, 0, 0); | |
182 | ||
183 | // Access to the AOD container of vertices | |
184 | TClonesArray &vertices = *(AODEvent()->GetVertices()); | |
185 | Int_t jVertices=0; | |
186 | ||
187 | // Add primary vertex. The primary tracks will be defined | |
188 | // after the loops on the composite objects (V0, cascades, kinks) | |
247abff4 | 189 | event->GetPrimaryVertex()->GetXYZ(pos); |
190 | Float_t chi = 0; | |
191 | if (bESD){ | |
192 | ((AliESDEvent*)event)->GetPrimaryVertex()->GetCovMatrix(covVtx); | |
193 | chi = ((AliESDEvent*)event)->GetPrimaryVertex()->GetChi2toNDF(); | |
194 | } | |
195 | else if (bAOD){ | |
196 | ((AliAODEvent*)event)->GetPrimaryVertex()->GetCovMatrix(covVtx); | |
197 | chi = ((AliAODEvent*)event)->GetPrimaryVertex()->GetChi2perNDF();//Different from ESD? | |
198 | } | |
7a4cf423 | 199 | |
200 | AliAODVertex * primary = new(vertices[jVertices++]) | |
247abff4 | 201 | AliAODVertex(pos, covVtx, chi, NULL, -1, AliAODVertex::kPrimary); |
202 | primary->SetName(event->GetPrimaryVertex()->GetName()); | |
203 | primary->SetTitle(event->GetPrimaryVertex()->GetTitle()); | |
7a4cf423 | 204 | |
205 | // Access to the AOD container of clusters | |
206 | TClonesArray &caloClusters = *(AODEvent()->GetCaloClusters()); | |
207 | Int_t jClusters=0; | |
208 | ||
f2ccb5b8 | 209 | //Do Corrections in EMCAL |
210 | //If EMCAL, and requested, correct energy, position ... | |
211 | //Need to do this in a separate loop before filling the ESDs because of the track matching recalculations | |
212 | if(fCorrect && (fCaloFilter==kEMCAL || fCaloFilter==kBoth) ) { | |
3b13c34c | 213 | |
214 | if(!fGeoMatrixSet){ | |
215 | if(fLoadEMCALMatrices){ | |
c0b85449 | 216 | printf("AliAnalysisTaskCaloFilter::UserExec() - Load user defined EMCAL geometry matrices\n"); |
3b13c34c | 217 | for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ |
218 | if(fEMCALMatrix[mod]){ | |
219 | if(DebugLevel() > 1) | |
220 | fEMCALMatrix[mod]->Print(); | |
221 | fEMCALGeo->SetMisalMatrix(fEMCALMatrix[mod],mod) ; | |
222 | } | |
223 | fGeoMatrixSet=kTRUE; | |
224 | }//SM loop | |
225 | }//Load matrices | |
226 | else if(!gGeoManager){ | |
227 | printf("AliAnalysisTaskCaloFilter::UserExec() - Get geo matrices from data\n"); | |
228 | //Still not implemented in AOD, just a workaround to be able to work at least with ESDs | |
229 | if(!strcmp(event->GetName(),"AliAODEvent")) { | |
230 | if(DebugLevel() > 1) | |
231 | printf("AliAnalysisTaskCaloFilter Use ideal geometry, values geometry matrix not kept in AODs.\n"); | |
232 | }//AOD | |
233 | else { | |
234 | if(DebugLevel() > 1) printf("AliAnalysisTaskCaloFilter Load Misaligned matrices. \n"); | |
235 | AliESDEvent* esd = dynamic_cast<AliESDEvent*>(event) ; | |
236 | if(!esd) { | |
237 | printf("AliAnalysisTaskCaloFilter::UserExec() - This event does not contain ESDs?"); | |
238 | return; | |
239 | } | |
240 | for(Int_t mod=0; mod < (fEMCALGeo->GetEMCGeometry())->GetNumberOfSuperModules(); mod++){ | |
241 | //if(DebugLevel() > 1) | |
242 | esd->GetEMCALMatrix(mod)->Print(); | |
243 | if(esd->GetEMCALMatrix(mod)) fEMCALGeo->SetMisalMatrix(esd->GetEMCALMatrix(mod),mod) ; | |
244 | } | |
245 | fGeoMatrixSet=kTRUE; | |
246 | }//ESD | |
247 | }//Load matrices from Data | |
248 | }//first event | |
249 | ||
250 | ||
f2ccb5b8 | 251 | //Cluster Loop |
252 | for (Int_t iClust=0; iClust<nCaloClus; ++iClust) { | |
253 | ||
254 | AliVCluster * cluster = event->GetCaloCluster(iClust); | |
255 | if(cluster->IsPHOS()) continue ; | |
256 | ||
247abff4 | 257 | Float_t position[]={0,0,0}; |
258 | if(DebugLevel() > 2) | |
259 | printf("Check cluster %d for bad channels and close to border\n",cluster->GetID()); | |
260 | if(fEMCALRecoUtils->ClusterContainsBadChannel(fEMCALGeo,cluster->GetCellsAbsId(), cluster->GetNCells())) continue; | |
f2ccb5b8 | 261 | // if(!fEMCALRecoUtils->CheckCellFiducialRegion(fEMCALGeo, cluster, event->GetEMCALCells())) { |
262 | // printf("Finally reject\n"); | |
263 | // continue; | |
264 | // } | |
247abff4 | 265 | if(DebugLevel() > 2) |
266 | { | |
3b13c34c | 267 | printf("Filter, before : i %d, E %f, dispersion %f, m02 %f, m20 %f, distToBad %f\n",iClust,cluster->E(), |
268 | cluster->GetDispersion(),cluster->GetM02(),cluster->GetM20(), cluster->GetDistanceToBadChannel()); | |
247abff4 | 269 | cluster->GetPosition(position); |
270 | printf("Filter, before : i %d, x %f, y %f, z %f\n",cluster->GetID(), position[0], position[1], position[2]); | |
271 | } | |
f2ccb5b8 | 272 | |
3b13c34c | 273 | //Recalculate distance to bad channels, if new list of bad channels provided |
274 | fEMCALRecoUtils->RecalculateClusterDistanceToBadChannel(fEMCALGeo, event->GetEMCALCells(), cluster); | |
275 | ||
5ef94e1b | 276 | if(fEMCALRecoUtils->IsRecalibrationOn()) { |
277 | fEMCALRecoUtils->RecalibrateClusterEnergy(fEMCALGeo, cluster, event->GetEMCALCells()); | |
278 | fEMCALRecoUtils->RecalculateClusterShowerShapeParameters(fEMCALGeo, event->GetEMCALCells(),cluster); | |
279 | fEMCALRecoUtils->RecalculateClusterPID(cluster); | |
5ef94e1b | 280 | } |
3b13c34c | 281 | |
247abff4 | 282 | cluster->SetE(fEMCALRecoUtils->CorrectClusterEnergyLinearity(cluster)); |
247abff4 | 283 | |
5ef94e1b | 284 | fEMCALRecoUtils->RecalculateClusterPosition(fEMCALGeo, event->GetEMCALCells(),cluster); |
f2ccb5b8 | 285 | |
247abff4 | 286 | if(DebugLevel() > 2) |
287 | { | |
3b13c34c | 288 | printf("Filter, after : i %d, E %f, dispersion %f, m02 %f, m20 %f, distToBad %f\n",cluster->GetID(),cluster->E(), |
289 | cluster->GetDispersion(),cluster->GetM02(),cluster->GetM20(), cluster->GetDistanceToBadChannel()); | |
247abff4 | 290 | cluster->GetPosition(position); |
291 | printf("Filter, after : i %d, x %f, y %f, z %f\n",cluster->GetID(), position[0], position[1], position[2]); | |
292 | } | |
293 | ||
f2ccb5b8 | 294 | } |
295 | //Recalculate track-matching | |
296 | fEMCALRecoUtils->FindMatches(event); | |
297 | ||
298 | } // corrections in EMCAL | |
299 | ||
300 | //Now loop on clusters to fill AODs | |
301 | for (Int_t iClust=0; iClust<nCaloClus; ++iClust) { | |
302 | ||
303 | AliVCluster * cluster = event->GetCaloCluster(iClust); | |
304 | ||
305 | //Check which calorimeter information we want to keep. | |
306 | ||
307 | if(fCaloFilter!=kBoth){ | |
308 | if (fCaloFilter==kPHOS && cluster->IsEMCAL()) continue ; | |
309 | else if(fCaloFilter==kEMCAL && cluster->IsPHOS()) continue ; | |
310 | } | |
311 | ||
312 | //Temporary trick, FIXME | |
313 | Float_t dR = cluster->GetTrackDx(); | |
314 | Float_t dZ = cluster->GetTrackDz(); | |
315 | if(DebugLevel() > 2) | |
316 | printf("Original residuals : dZ %f, dR %f\n ",dZ, dR); | |
317 | //-------------------------------------------------------------- | |
318 | //If EMCAL and corrections done, get the new matching parameters, do not copy noisy clusters | |
319 | if(cluster->IsEMCAL() && fCorrect){ | |
320 | if(DebugLevel() > 2) | |
321 | printf("Check cluster %d for bad channels and close to border\n",cluster->GetID()); | |
322 | if(fEMCALRecoUtils->ClusterContainsBadChannel(fEMCALGeo,cluster->GetCellsAbsId(), cluster->GetNCells())) continue; | |
323 | // if(!fEMCALRecoUtils->CheckCellFiducialRegion(fEMCALGeo, cluster, event->GetEMCALCells())) { | |
324 | // printf("Finally reject\n"); | |
325 | // continue; | |
326 | // } | |
327 | ||
328 | fEMCALRecoUtils->GetMatchedResiduals(cluster->GetID(),dR,dZ); | |
329 | if(DebugLevel() > 2) | |
330 | printf("Corrected Residuals : dZ %f, dR %f\n ",dZ, dR); | |
331 | ||
247abff4 | 332 | } |
333 | //-------------------------------------------------------------- | |
334 | ||
335 | //Now fill AODs | |
f2ccb5b8 | 336 | |
7a4cf423 | 337 | Int_t id = cluster->GetID(); |
338 | Float_t energy = cluster->E(); | |
339 | cluster->GetPosition(posF); | |
7a4cf423 | 340 | |
341 | AliAODCaloCluster *caloCluster = new(caloClusters[jClusters++]) | |
342 | AliAODCaloCluster(id, | |
343 | 0, | |
344 | 0x0, | |
345 | energy, | |
346 | posF, | |
347 | NULL, | |
c8fe2783 | 348 | cluster->GetType()); |
7a4cf423 | 349 | |
f2ccb5b8 | 350 | caloCluster->SetChi2(dZ);//Temporary trick, FIXME |
7a4cf423 | 351 | caloCluster->SetCaloCluster(cluster->GetDistanceToBadChannel(), |
c8fe2783 | 352 | cluster->GetDispersion(), |
7a4cf423 | 353 | cluster->GetM20(), cluster->GetM02(), |
f2ccb5b8 | 354 | dR, //Temporary trick, FIXME |
7a4cf423 | 355 | cluster->GetNExMax(),cluster->GetTOF()) ; |
356 | ||
c8fe2783 | 357 | caloCluster->SetPIDFromESD(cluster->GetPID()); |
7a4cf423 | 358 | caloCluster->SetNCells(cluster->GetNCells()); |
359 | caloCluster->SetCellsAbsId(cluster->GetCellsAbsId()); | |
360 | caloCluster->SetCellsAmplitudeFraction(cluster->GetCellsAmplitudeFraction()); | |
361 | ||
247abff4 | 362 | if(DebugLevel() > 2) |
363 | { | |
f2ccb5b8 | 364 | printf("Filter, aod : i %d, E %f, dispersion %f, m02 %f, m20 %f\n",caloCluster->GetID(),caloCluster->E(), |
247abff4 | 365 | caloCluster->GetDispersion(),caloCluster->GetM02(),caloCluster->GetM20()); |
366 | caloCluster->GetPosition(posF); | |
f2ccb5b8 | 367 | printf("Filter, aod : i %d, x %f, y %f, z %f\n",caloCluster->GetID(), posF[0], posF[1], posF[2]); |
247abff4 | 368 | } |
369 | ||
3a58eee6 | 370 | //Matched tracks, just to know if there was any match, the track pointer is useless. |
f2ccb5b8 | 371 | //Temporary trick, FIXME |
3a58eee6 | 372 | if(bESD){ |
f2ccb5b8 | 373 | if(TMath::Abs(dR) < 990 && TMath::Abs(dZ) < 990) { //Default value in PHOS 999, in EMCAL 1024, why? |
374 | if(DebugLevel() > 2) | |
375 | printf("*** Cluster Track-Matched *** dR %f, dZ %f\n",caloCluster->GetEmcCpvDistance(),caloCluster->Chi2()); | |
376 | caloCluster->AddTrackMatched(0x0); | |
377 | }// fill the array with one entry to signal a possible match | |
378 | //TArrayI* matchedT = ((AliESDCaloCluster*)cluster)->GetTracksMatched(); | |
379 | //if (InputEvent()->GetNumberOfTracks() > 0 && matchedT && cluster->GetTrackMatchedIndex() >= 0) { | |
380 | // for (Int_t im = 0; im < matchedT->GetSize(); im++) { | |
381 | // Int_t iESDtrack = matchedT->At(im);; | |
382 | // if ((AliVTrack*)InputEvent()->GetTrack(iESDtrack) != 0) { | |
383 | // caloCluster->AddTrackMatched((AliVTrack*)InputEvent()->GetTrack(iESDtrack)); | |
384 | // } | |
385 | // } | |
386 | //}// There is at least a match with a track | |
3a58eee6 | 387 | } |
7a4cf423 | 388 | } |
389 | caloClusters.Expand(jClusters); // resize TObjArray to 'remove' slots for pseudo clusters | |
390 | // end of loop on calo clusters | |
391 | ||
392 | // fill EMCAL cell info | |
247abff4 | 393 | if ((fCaloFilter==kBoth || fCaloFilter==kEMCAL) && event->GetEMCALCells()) { // protection against missing ESD information |
394 | AliVCaloCells &eventEMcells = *(event->GetEMCALCells()); | |
395 | Int_t nEMcell = eventEMcells.GetNumberOfCells() ; | |
7a4cf423 | 396 | |
397 | AliAODCaloCells &aodEMcells = *(AODEvent()->GetEMCALCells()); | |
398 | aodEMcells.CreateContainer(nEMcell); | |
c8fe2783 | 399 | aodEMcells.SetType(AliVCaloCells::kEMCALCell); |
247abff4 | 400 | Double_t calibFactor = 1.; |
401 | for (Int_t iCell = 0; iCell < nEMcell; iCell++) { | |
5ef94e1b | 402 | Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1; |
403 | fEMCALGeo->GetCellIndex(eventEMcells.GetCellNumber(iCell),imod,iTower,iIphi,iIeta); | |
404 | fEMCALGeo->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi, iIeta,iphi,ieta); | |
405 | ||
247abff4 | 406 | if(fCorrect && fEMCALRecoUtils->IsRecalibrationOn()){ |
247abff4 | 407 | calibFactor = fEMCALRecoUtils->GetEMCALChannelRecalibrationFactor(imod,ieta,iphi); |
408 | } | |
5ef94e1b | 409 | |
410 | if(!fEMCALRecoUtils->GetEMCALChannelStatus(imod, ieta, iphi)){ //Channel is not declared as bad | |
411 | aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),eventEMcells.GetAmplitude(iCell)*calibFactor); | |
412 | //printf("GOOD channel\n"); | |
413 | } | |
414 | else { | |
415 | aodEMcells.SetCell(iCell,eventEMcells.GetCellNumber(iCell),0); | |
416 | //printf("BAD channel\n"); | |
417 | ||
418 | } | |
7a4cf423 | 419 | } |
420 | aodEMcells.Sort(); | |
421 | } | |
422 | ||
423 | // fill PHOS cell info | |
247abff4 | 424 | if ((fCaloFilter==kBoth || fCaloFilter==kPHOS) && event->GetPHOSCells()) { // protection against missing ESD information |
425 | AliVCaloCells &eventPHcells = *(event->GetPHOSCells()); | |
426 | Int_t nPHcell = eventPHcells.GetNumberOfCells() ; | |
7a4cf423 | 427 | |
428 | AliAODCaloCells &aodPHcells = *(AODEvent()->GetPHOSCells()); | |
429 | aodPHcells.CreateContainer(nPHcell); | |
c8fe2783 | 430 | aodPHcells.SetType(AliVCaloCells::kPHOSCell); |
7a4cf423 | 431 | for (Int_t iCell = 0; iCell < nPHcell; iCell++) { |
247abff4 | 432 | aodPHcells.SetCell(iCell,eventPHcells.GetCellNumber(iCell),eventPHcells.GetAmplitude(iCell)); |
7a4cf423 | 433 | } |
434 | aodPHcells.Sort(); | |
435 | } | |
436 | ||
437 | ||
438 | return; | |
439 | } | |
440 | ||
5ef94e1b | 441 | //_____________________________________________________ |
442 | void AliAnalysisTaskCaloFilter::PrintInfo(){ | |
443 | ||
444 | //Print settings | |
445 | ||
446 | printf("TASK: AnalysisCaloFilter \n"); | |
447 | printf("\t Not only filter, correct Clusters? %d\n",fCorrect); | |
448 | printf("\t Calorimeter Filtering Option ? %d\n",fCaloFilter); | |
3b13c34c | 449 | //printf("\t Use handmade geo matrices? EMCAL %d, PHOS %d\n",fLoadEMCALMatrices, fLoadPHOSMatrices); |
450 | printf("\t Use handmade geo matrices? EMCAL %d, PHOS 0\n",fLoadEMCALMatrices); | |
5ef94e1b | 451 | |
452 | } | |
453 | ||
247abff4 | 454 | //_____________________________________________________ |
455 | //void AliAnalysisTaskCaloFilter::LocalInit() | |
456 | //{ | |
457 | // // Local Initialization | |
458 | // | |
459 | // // Create cuts/param objects and publish to slot | |
460 | // const Int_t buffersize = 255; | |
461 | // char onePar[buffersize] ; | |
462 | // fCuts = new TList(); | |
463 | // | |
464 | // snprintf(onePar,buffersize, "Calorimeter Filtering Option %d", fCaloFilter) ; | |
465 | // fCuts->Add(new TObjString(onePar)); | |
466 | // snprintf(onePar,buffersize, "Not only filter but correct? %d cells;", fCorrect) ; | |
467 | // fCuts->Add(new TObjString(onePar)); | |
468 | // | |
469 | // // Post Data | |
470 | // PostData(2, fCuts); | |
471 | // | |
472 | //} | |
7a4cf423 | 473 | |
7a4cf423 | 474 | |
475 | //__________________________________________________ | |
476 | void AliAnalysisTaskCaloFilter::Terminate(Option_t */*option*/) | |
477 | { | |
478 | // Terminate analysis | |
479 | // | |
480 | if (fDebug > 1) printf("AnalysisCaloFilter: Terminate() \n"); | |
481 | } | |
482 |