]>
Commit | Line | Data |
---|---|---|
af885e0f | 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$ */ | |
17 | ||
18 | //----------------------------------------------------------------- | |
f56a9fa7 | 19 | // Implementation of the AliESDEvent class |
6989bff3 | 20 | // This is the class to deal with during the physics analysis of data. |
f56a9fa7 | 21 | // It also ensures the backward compatibility with the old ESD format. |
6989bff3 | 22 | /* |
23 | AliESDEvent *ev= new AliESDEvent(); | |
24 | ev->ReadFromTree(esdTree); | |
25 | ... | |
26 | for (Int_t i=0; i<nev; i++) { | |
27 | esdTree->GetEntry(i); | |
28 | if(ev->GetAliESDOld())ev->CopyFromOldESD(); | |
29 | */ | |
7d44c466 | 30 | // The AliESDInputHandler does this automatically for you |
f56a9fa7 | 31 | // |
32 | // Origin: Christian Klein-Boesing, CERN, Christian.Klein-Boesing@cern.ch | |
af885e0f | 33 | //----------------------------------------------------------------- |
34 | ||
35 | #include "TList.h" | |
cd1d4ee0 | 36 | #include "TRefArray.h" |
af885e0f | 37 | #include <TNamed.h> |
2a3dfb14 | 38 | #include <TROOT.h> |
39 | #include <TInterpreter.h> | |
af885e0f | 40 | |
41 | #include "AliESDEvent.h" | |
42 | #include "AliESDfriend.h" | |
43 | #include "AliESDVZERO.h" | |
af885e0f | 44 | #include "AliESDFMD.h" |
45 | #include "AliESD.h" | |
f0106218 | 46 | #include "AliESDMuonTrack.h" |
fe0324de | 47 | #include "AliESDMuonCluster.h" |
48 | #include "AliESDMuonPad.h" | |
f0106218 | 49 | #include "AliESDPmdTrack.h" |
50 | #include "AliESDTrdTrack.h" | |
51 | #include "AliESDVertex.h" | |
52 | #include "AliESDcascade.h" | |
53 | #include "AliESDPmdTrack.h" | |
6c8e0967 | 54 | #include "AliESDTrdTrigger.h" |
f0106218 | 55 | #include "AliESDTrdTrack.h" |
52cd0cc0 | 56 | #include "AliESDTrdTracklet.h" |
f0106218 | 57 | #include "AliESDVertex.h" |
518573d7 | 58 | #include "AliVertexerTracks.h" |
f0106218 | 59 | #include "AliESDcascade.h" |
60 | #include "AliESDkink.h" | |
61 | #include "AliESDtrack.h" | |
62 | #include "AliESDHLTtrack.h" | |
63 | #include "AliESDCaloCluster.h" | |
e649177a | 64 | #include "AliESDCaloCells.h" |
f0106218 | 65 | #include "AliESDv0.h" |
66 | #include "AliESDFMD.h" | |
67 | #include "AliESDVZERO.h" | |
68 | #include "AliMultiplicity.h" | |
69 | #include "AliRawDataErrorLog.h" | |
e649177a | 70 | #include "AliLog.h" |
bd95bae7 | 71 | #include "AliESDACORDE.h" |
8b12d288 | 72 | #include "AliESDHLTDecision.h" |
fba4b2e2 | 73 | #include "AliCentrality.h" |
8e1324ab | 74 | #include "AliESDCosmicTrack.h" |
766037f0 | 75 | #include "AliTriggerConfiguration.h" |
76 | #include "AliTriggerClass.h" | |
77 | #include "AliTriggerCluster.h" | |
820b4d9e | 78 | #ifdef MFT_UPGRADE |
79 | #include "AliESDMFT.h" | |
80 | #endif | |
ce7adfe9 | 81 | #include "AliEventplane.h" |
8b12d288 | 82 | |
820b4d9e | 83 | |
af885e0f | 84 | ClassImp(AliESDEvent) |
85 | ||
60e8f114 | 86 | |
87 | ||
88 | // here we define the names, some classes are no TNamed, therefore the classnames | |
89 | // are the Names | |
6989bff3 | 90 | const char* AliESDEvent::fgkESDListName[kESDListN] = {"AliESDRun", |
f858b00e | 91 | "AliESDHeader", |
92 | "AliESDZDC", | |
93 | "AliESDFMD", | |
94 | "AliESDVZERO", | |
95 | "AliESDTZERO", | |
96 | "TPCVertex", | |
97 | "SPDVertex", | |
98 | "PrimaryVertex", | |
99 | "AliMultiplicity", | |
100 | "PHOSTrigger", | |
101 | "EMCALTrigger", | |
102 | "SPDPileupVertices", | |
103 | "TrkPileupVertices", | |
104 | "Tracks", | |
105 | "MuonTracks", | |
fe0324de | 106 | "MuonClusters", |
107 | "MuonPads", | |
f858b00e | 108 | "PmdTracks", |
6c8e0967 | 109 | "AliESDTrdTrigger", |
f858b00e | 110 | "TrdTracks", |
52cd0cc0 | 111 | "TrdTracklets", |
f858b00e | 112 | "V0s", |
113 | "Cascades", | |
114 | "Kinks", | |
115 | "CaloClusters", | |
116 | "EMCALCells", | |
117 | "PHOSCells", | |
118 | "AliRawDataErrorLogs", | |
119 | "AliESDACORDE", | |
8e1324ab | 120 | "AliTOFHeader", |
121 | "CosmicTracks" | |
122 | #ifdef MFT_UPGRADE | |
820b4d9e | 123 | // , "AliESDMFT" |
124 | #endif | |
125 | }; | |
bd95bae7 | 126 | |
af885e0f | 127 | //______________________________________________________________________________ |
128 | AliESDEvent::AliESDEvent(): | |
024c7734 | 129 | AliVEvent(), |
af885e0f | 130 | fESDObjects(new TList()), |
131 | fESDRun(0), | |
132 | fHeader(0), | |
133 | fESDZDC(0), | |
134 | fESDFMD(0), | |
135 | fESDVZERO(0), | |
136 | fESDTZERO(0), | |
06cc9d95 | 137 | fTPCVertex(0), |
af885e0f | 138 | fSPDVertex(0), |
139 | fPrimaryVertex(0), | |
140 | fSPDMult(0), | |
141 | fPHOSTrigger(0), | |
142 | fEMCALTrigger(0), | |
bd95bae7 | 143 | fESDACORDE(0), |
6c8e0967 | 144 | fTrdTrigger(0), |
04d01397 | 145 | fSPDPileupVertices(0), |
146 | fTrkPileupVertices(0), | |
af885e0f | 147 | fTracks(0), |
148 | fMuonTracks(0), | |
fe0324de | 149 | fMuonClusters(0), |
150 | fMuonPads(0), | |
af885e0f | 151 | fPmdTracks(0), |
152 | fTrdTracks(0), | |
52cd0cc0 | 153 | fTrdTracklets(0), |
af885e0f | 154 | fV0s(0), |
155 | fCascades(0), | |
156 | fKinks(0), | |
157 | fCaloClusters(0), | |
e649177a | 158 | fEMCALCells(0), fPHOSCells(0), |
8e1324ab | 159 | fCosmicTracks(0), |
af885e0f | 160 | fErrorLogs(0), |
fe0324de | 161 | fOldMuonStructure(kFALSE), |
af885e0f | 162 | fESDOld(0), |
1bd10080 | 163 | fESDFriendOld(0), |
60e8f114 | 164 | fConnected(kFALSE), |
f858b00e | 165 | fUseOwnList(kFALSE), |
2eec2a33 | 166 | fTOFHeader(0), |
ce7adfe9 | 167 | fCentrality(0), |
a8f382ab | 168 | fEventplane(0), |
169 | fDetectorStatus(0xFFFFFFFF) | |
820b4d9e | 170 | #ifdef MFT_UPGRADE |
171 | // , fESDMFT(0) | |
172 | #endif | |
af885e0f | 173 | { |
174 | } | |
175 | //______________________________________________________________________________ | |
176 | AliESDEvent::AliESDEvent(const AliESDEvent& esd): | |
024c7734 | 177 | AliVEvent(esd), |
af885e0f | 178 | fESDObjects(new TList()), |
179 | fESDRun(new AliESDRun(*esd.fESDRun)), | |
180 | fHeader(new AliESDHeader(*esd.fHeader)), | |
181 | fESDZDC(new AliESDZDC(*esd.fESDZDC)), | |
182 | fESDFMD(new AliESDFMD(*esd.fESDFMD)), | |
183 | fESDVZERO(new AliESDVZERO(*esd.fESDVZERO)), | |
184 | fESDTZERO(new AliESDTZERO(*esd.fESDTZERO)), | |
06cc9d95 | 185 | fTPCVertex(new AliESDVertex(*esd.fTPCVertex)), |
af885e0f | 186 | fSPDVertex(new AliESDVertex(*esd.fSPDVertex)), |
187 | fPrimaryVertex(new AliESDVertex(*esd.fPrimaryVertex)), | |
188 | fSPDMult(new AliMultiplicity(*esd.fSPDMult)), | |
189 | fPHOSTrigger(new AliESDCaloTrigger(*esd.fPHOSTrigger)), | |
190 | fEMCALTrigger(new AliESDCaloTrigger(*esd.fEMCALTrigger)), | |
bd95bae7 | 191 | fESDACORDE(new AliESDACORDE(*esd.fESDACORDE)), |
6c8e0967 | 192 | fTrdTrigger(new AliESDTrdTrigger(*esd.fTrdTrigger)), |
04d01397 | 193 | fSPDPileupVertices(new TClonesArray(*esd.fSPDPileupVertices)), |
194 | fTrkPileupVertices(new TClonesArray(*esd.fTrkPileupVertices)), | |
af885e0f | 195 | fTracks(new TClonesArray(*esd.fTracks)), |
196 | fMuonTracks(new TClonesArray(*esd.fMuonTracks)), | |
fe0324de | 197 | fMuonClusters(new TClonesArray(*esd.fMuonClusters)), |
198 | fMuonPads(new TClonesArray(*esd.fMuonPads)), | |
af885e0f | 199 | fPmdTracks(new TClonesArray(*esd.fPmdTracks)), |
200 | fTrdTracks(new TClonesArray(*esd.fTrdTracks)), | |
52cd0cc0 | 201 | fTrdTracklets(new TClonesArray(*esd.fTrdTracklets)), |
af885e0f | 202 | fV0s(new TClonesArray(*esd.fV0s)), |
203 | fCascades(new TClonesArray(*esd.fCascades)), | |
204 | fKinks(new TClonesArray(*esd.fKinks)), | |
205 | fCaloClusters(new TClonesArray(*esd.fCaloClusters)), | |
e649177a | 206 | fEMCALCells(new AliESDCaloCells(*esd.fEMCALCells)), |
207 | fPHOSCells(new AliESDCaloCells(*esd.fPHOSCells)), | |
8e1324ab | 208 | fCosmicTracks(new TClonesArray(*esd.fCosmicTracks)), |
af885e0f | 209 | fErrorLogs(new TClonesArray(*esd.fErrorLogs)), |
fe0324de | 210 | fOldMuonStructure(esd.fOldMuonStructure), |
7251b311 | 211 | fESDOld(esd.fESDOld ? new AliESD(*esd.fESDOld) : 0), |
212 | fESDFriendOld(esd.fESDFriendOld ? new AliESDfriend(*esd.fESDFriendOld) : 0), | |
60e8f114 | 213 | fConnected(esd.fConnected), |
f858b00e | 214 | fUseOwnList(esd.fUseOwnList), |
2eec2a33 | 215 | fTOFHeader(new AliTOFHeader(*esd.fTOFHeader)), |
ce7adfe9 | 216 | fCentrality(new AliCentrality(*esd.fCentrality)), |
a8f382ab | 217 | fEventplane(new AliEventplane(*esd.fEventplane)), |
218 | fDetectorStatus(esd.fDetectorStatus) | |
820b4d9e | 219 | #ifdef MFT_UPGRADE |
220 | // , fESDMFT(new AliESDMFT(*esd.fESDMFT)) | |
221 | #endif | |
222 | ||
223 | ||
af885e0f | 224 | { |
820b4d9e | 225 | printf("copying ESD event...\n"); // AU |
af885e0f | 226 | // CKB init in the constructor list and only add here ... |
227 | AddObject(fESDRun); | |
228 | AddObject(fHeader); | |
229 | AddObject(fESDZDC); | |
230 | AddObject(fESDFMD); | |
231 | AddObject(fESDVZERO); | |
232 | AddObject(fESDTZERO); | |
06cc9d95 | 233 | AddObject(fTPCVertex); |
af885e0f | 234 | AddObject(fSPDVertex); |
235 | AddObject(fPrimaryVertex); | |
236 | AddObject(fSPDMult); | |
237 | AddObject(fPHOSTrigger); | |
238 | AddObject(fEMCALTrigger); | |
6c8e0967 | 239 | AddObject(fTrdTrigger); |
04d01397 | 240 | AddObject(fSPDPileupVertices); |
241 | AddObject(fTrkPileupVertices); | |
af885e0f | 242 | AddObject(fTracks); |
243 | AddObject(fMuonTracks); | |
244 | AddObject(fPmdTracks); | |
245 | AddObject(fTrdTracks); | |
52cd0cc0 | 246 | AddObject(fTrdTracklets); |
af885e0f | 247 | AddObject(fV0s); |
248 | AddObject(fCascades); | |
249 | AddObject(fKinks); | |
250 | AddObject(fCaloClusters); | |
e649177a | 251 | AddObject(fEMCALCells); |
252 | AddObject(fPHOSCells); | |
8e1324ab | 253 | AddObject(fCosmicTracks); |
af885e0f | 254 | AddObject(fErrorLogs); |
bd95bae7 | 255 | AddObject(fESDACORDE); |
f858b00e | 256 | AddObject(fTOFHeader); |
fe0324de | 257 | AddObject(fMuonClusters); |
258 | AddObject(fMuonPads); | |
820b4d9e | 259 | #ifdef MFT_UPGRADE |
260 | // AddObject(fESDMFT); | |
261 | #endif | |
af885e0f | 262 | GetStdContent(); |
263 | ||
264 | } | |
265 | ||
266 | //______________________________________________________________________________ | |
267 | AliESDEvent & AliESDEvent::operator=(const AliESDEvent& source) { | |
268 | ||
269 | // Assignment operator | |
270 | ||
271 | if(&source == this) return *this; | |
024c7734 | 272 | AliVEvent::operator=(source); |
af885e0f | 273 | |
732a24fe | 274 | // This assumes that the list is already created |
275 | // and that the virtual void Copy(Tobject&) function | |
276 | // is correctly implemented in the derived class | |
277 | // otherwise only TObject::Copy() will be used | |
278 | ||
279 | ||
102c56c8 | 280 | |
732a24fe | 281 | if((fESDObjects->GetSize()==0)&&(source.fESDObjects->GetSize()>=kESDListN)){ |
282 | // We cover the case that we do not yet have the | |
283 | // standard content but the source has it | |
284 | CreateStdContent(); | |
285 | } | |
286 | ||
287 | TIter next(source.GetList()); | |
288 | TObject *its = 0; | |
289 | TString name; | |
290 | while ((its = next())) { | |
291 | name.Form("%s", its->GetName()); | |
292 | TObject *mine = fESDObjects->FindObject(name.Data()); | |
293 | if(!mine){ | |
102c56c8 | 294 | TClass* pClass=TClass::GetClass(its->ClassName()); |
295 | if (!pClass) { | |
296 | AliWarning(Form("Can not find class description for entry %s (%s)\n", | |
297 | its->ClassName(), name.Data())); | |
298 | continue; | |
299 | } | |
732a24fe | 300 | |
102c56c8 | 301 | mine=(TObject*)pClass->New(); |
302 | if(!mine){ | |
303 | // not in this: can be added to list | |
304 | AliWarning(Form("%s:%d Could not find %s for copying \n", | |
305 | (char*)__FILE__,__LINE__,name.Data())); | |
306 | continue; | |
307 | } | |
308 | if(mine->InheritsFrom("TNamed")){ | |
309 | ((TNamed*)mine)->SetName(name); | |
310 | } | |
311 | else if(mine->InheritsFrom("TCollection")){ | |
11becff8 | 312 | if(mine->InheritsFrom("TClonesArray")) { |
313 | TClonesArray* tcits = dynamic_cast<TClonesArray*>(its); | |
314 | if (tcits) | |
315 | dynamic_cast<TClonesArray*>(mine)->SetClass(tcits->GetClass()); | |
316 | } | |
102c56c8 | 317 | dynamic_cast<TCollection*>(mine)->SetName(name); |
318 | } | |
319 | AliDebug(1, Form("adding object %s of type %s", mine->GetName(), mine->ClassName())); | |
320 | AddObject(mine); | |
321 | } | |
322 | ||
732a24fe | 323 | if(!its->InheritsFrom("TCollection")){ |
324 | // simple objects | |
325 | its->Copy(*mine); | |
326 | } | |
327 | else if(its->InheritsFrom("TClonesArray")){ | |
328 | // Create or expand the tclonesarray pointers | |
329 | // so we can directly copy to the object | |
5d8eaff6 | 330 | TClonesArray *itstca = (TClonesArray*)its; |
331 | TClonesArray *minetca = (TClonesArray*)mine; | |
732a24fe | 332 | |
333 | // this leaves the capacity of the TClonesArray the same | |
334 | // except for a factor of 2 increase when size > capacity | |
335 | // does not release any memory occupied by the tca | |
5d8eaff6 | 336 | minetca->ExpandCreate(itstca->GetEntriesFast()); |
337 | for(int i = 0;i < itstca->GetEntriesFast();++i){ | |
732a24fe | 338 | // copy |
5d8eaff6 | 339 | TObject *minetcaobj = minetca->At(i); |
340 | TObject *itstcaobj = itstca->At(i); | |
732a24fe | 341 | // no need to delete first |
342 | // pointers within the class should be handled by Copy()... | |
343 | // Can there be Empty slots? | |
5d8eaff6 | 344 | itstcaobj->Copy(*minetcaobj); |
732a24fe | 345 | } |
346 | } | |
347 | else{ | |
348 | AliWarning(Form("%s:%d cannot copy TCollection \n", | |
349 | (char*)__FILE__,__LINE__)); | |
350 | } | |
351 | } | |
af885e0f | 352 | |
fe0324de | 353 | fOldMuonStructure = source.fOldMuonStructure; |
354 | ||
2eec2a33 | 355 | fCentrality = source.fCentrality; |
ce7adfe9 | 356 | fEventplane = source.fEventplane; |
2eec2a33 | 357 | |
358 | fConnected = source.fConnected; | |
a2fbb067 | 359 | fUseOwnList = source.fUseOwnList; |
a8f382ab | 360 | |
361 | fDetectorStatus = source.fDetectorStatus; | |
af885e0f | 362 | |
af885e0f | 363 | return *this; |
af885e0f | 364 | } |
365 | ||
366 | ||
367 | //______________________________________________________________________________ | |
368 | AliESDEvent::~AliESDEvent() | |
369 | { | |
370 | // | |
371 | // Standard destructor | |
372 | // | |
373 | ||
001b9beb | 374 | // everthing on the list gets deleted automatically |
139f2194 | 375 | |
376 | ||
60e8f114 | 377 | if(fESDObjects&&!fConnected) |
378 | { | |
379 | delete fESDObjects; | |
380 | fESDObjects = 0; | |
381 | } | |
cb62947d | 382 | if (fCentrality) delete fCentrality; |
ce7adfe9 | 383 | if (fEventplane) delete fEventplane; |
60e8f114 | 384 | |
af885e0f | 385 | } |
386 | ||
732a24fe | 387 | void AliESDEvent::Copy(TObject &obj) const { |
388 | ||
389 | // interface to TOBject::Copy | |
390 | // Copies the content of this into obj! | |
391 | // bascially obj = *this | |
392 | ||
393 | if(this==&obj)return; | |
394 | AliESDEvent *robj = dynamic_cast<AliESDEvent*>(&obj); | |
395 | if(!robj)return; // not an AliESEvent | |
396 | *robj = *this; | |
397 | return; | |
398 | } | |
399 | ||
af885e0f | 400 | //______________________________________________________________________________ |
401 | void AliESDEvent::Reset() | |
402 | { | |
403 | ||
102c56c8 | 404 | // Handle the cases |
405 | // Std content + Non std content | |
406 | ||
af885e0f | 407 | // Reset the standard contents |
408 | ResetStdContent(); | |
102c56c8 | 409 | |
410 | // reset for the old data without AliESDEvent... | |
af885e0f | 411 | if(fESDOld)fESDOld->Reset(); |
d7749dec | 412 | if(fESDFriendOld){ |
413 | fESDFriendOld->~AliESDfriend(); | |
414 | new (fESDFriendOld) AliESDfriend(); | |
415 | } | |
102c56c8 | 416 | // |
417 | ||
418 | if(fESDObjects->GetSize()>kESDListN){ | |
419 | // we have non std content | |
420 | // this also covers esdfriends | |
421 | for(int i = kESDListN;i < fESDObjects->GetSize();++i){ | |
422 | TObject *pObject = fESDObjects->At(i); | |
423 | // TClonesArrays | |
424 | if(pObject->InheritsFrom(TClonesArray::Class())){ | |
425 | ((TClonesArray*)pObject)->Delete(); | |
426 | } | |
427 | else if(!pObject->InheritsFrom(TCollection::Class())){ | |
00b66af8 | 428 | TClass *pClass = TClass::GetClass(pObject->ClassName()); |
429 | if (pClass && pClass->GetListOfMethods()->FindObject("Clear")) { | |
430 | AliDebug(1, Form("Clear for object %s class %s", pObject->GetName(), pObject->ClassName())); | |
431 | pObject->Clear(); | |
432 | } | |
433 | else { | |
434 | AliDebug(1, Form("ResetWithPlacementNew for object %s class %s", pObject->GetName(), pObject->ClassName())); | |
435 | ResetWithPlacementNew(pObject); | |
436 | } | |
102c56c8 | 437 | } |
438 | else{ | |
65b25288 | 439 | AliWarning(Form("No reset for %s \n", |
102c56c8 | 440 | pObject->ClassName())); |
441 | } | |
442 | } | |
d7749dec | 443 | } |
444 | ||
102c56c8 | 445 | } |
446 | ||
447 | Bool_t AliESDEvent::ResetWithPlacementNew(TObject *pObject){ | |
5d8eaff6 | 448 | // |
449 | // funtion to reset using the already allocated space | |
450 | // | |
102c56c8 | 451 | Long_t dtoronly = TObject::GetDtorOnly(); |
452 | TClass *pClass = TClass::GetClass(pObject->ClassName()); | |
453 | TObject::SetDtorOnly(pObject); | |
454 | delete pObject; | |
455 | // Recreate with placement new | |
456 | pClass->New(pObject); | |
457 | // Restore the state. | |
458 | TObject::SetDtorOnly((void*)dtoronly); | |
459 | return kTRUE; | |
af885e0f | 460 | } |
461 | ||
462 | void AliESDEvent::ResetStdContent() | |
463 | { | |
464 | // Reset the standard contents | |
465 | if(fESDRun) fESDRun->Reset(); | |
466 | if(fHeader) fHeader->Reset(); | |
93d96ff5 | 467 | if(fCentrality) fCentrality->Reset(); |
468 | if(fEventplane) fEventplane->Reset(); | |
af885e0f | 469 | if(fESDZDC) fESDZDC->Reset(); |
0f0eb29c | 470 | if(fESDFMD) { |
a2fbb067 | 471 | fESDFMD->Clear(); |
0f0eb29c | 472 | } |
6989bff3 | 473 | if(fESDVZERO){ |
474 | // reset by callin d'to /c'tor keep the pointer | |
475 | fESDVZERO->~AliESDVZERO(); | |
476 | new (fESDVZERO) AliESDVZERO(); | |
477 | } | |
bd95bae7 | 478 | if(fESDACORDE){ |
479 | fESDACORDE->~AliESDACORDE(); | |
480 | new (fESDACORDE) AliESDACORDE(); | |
481 | } | |
af885e0f | 482 | if(fESDTZERO) fESDTZERO->Reset(); |
483 | // CKB no clear/reset implemented | |
06cc9d95 | 484 | if(fTPCVertex){ |
485 | fTPCVertex->~AliESDVertex(); | |
486 | new (fTPCVertex) AliESDVertex(); | |
487 | fTPCVertex->SetName(fgkESDListName[kTPCVertex]); | |
488 | } | |
af885e0f | 489 | if(fSPDVertex){ |
316c6cd9 | 490 | fSPDVertex->~AliESDVertex(); |
af885e0f | 491 | new (fSPDVertex) AliESDVertex(); |
6989bff3 | 492 | fSPDVertex->SetName(fgkESDListName[kSPDVertex]); |
af885e0f | 493 | } |
494 | if(fPrimaryVertex){ | |
316c6cd9 | 495 | fPrimaryVertex->~AliESDVertex(); |
af885e0f | 496 | new (fPrimaryVertex) AliESDVertex(); |
6989bff3 | 497 | fPrimaryVertex->SetName(fgkESDListName[kPrimaryVertex]); |
af885e0f | 498 | } |
316c6cd9 | 499 | if(fSPDMult){ |
500 | fSPDMult->~AliMultiplicity(); | |
501 | new (fSPDMult) AliMultiplicity(); | |
502 | } | |
f858b00e | 503 | if(fTOFHeader){ |
504 | fTOFHeader->~AliTOFHeader(); | |
505 | new (fTOFHeader) AliTOFHeader(); | |
506 | //fTOFHeader->SetName(fgkESDListName[kTOFHeader]); | |
507 | } | |
6c8e0967 | 508 | if (fTrdTrigger) { |
509 | fTrdTrigger->~AliESDTrdTrigger(); | |
510 | new (fTrdTrigger) AliESDTrdTrigger(); | |
511 | } | |
820b4d9e | 512 | #ifdef MFT_UPGRADE |
513 | //if(fESDMFT){ | |
514 | // fESDMFT->~AliESDMFT(); | |
515 | // new (fESDMFT) AliESDMFT(); | |
516 | // } | |
517 | #endif | |
518 | ||
042d5330 | 519 | if(fPHOSTrigger)fPHOSTrigger->DeAllocate(); |
520 | if(fEMCALTrigger)fEMCALTrigger->DeAllocate(); | |
04d01397 | 521 | if(fSPDPileupVertices)fSPDPileupVertices->Delete(); |
522 | if(fTrkPileupVertices)fTrkPileupVertices->Delete(); | |
91c074b4 | 523 | if(fTracks)fTracks->Delete(); |
fe0324de | 524 | if(fMuonTracks)fMuonTracks->Clear("C"); |
525 | if(fMuonClusters)fMuonClusters->Clear("C"); | |
526 | if(fMuonPads)fMuonPads->Clear("C"); | |
6989bff3 | 527 | if(fPmdTracks)fPmdTracks->Delete(); |
528 | if(fTrdTracks)fTrdTracks->Delete(); | |
52cd0cc0 | 529 | if(fTrdTracklets)fTrdTracklets->Delete(); |
ddfbc51a | 530 | if(fV0s)fV0s->Delete(); |
531 | if(fCascades)fCascades->Delete(); | |
532 | if(fKinks)fKinks->Delete(); | |
bc9a7b42 | 533 | if(fCaloClusters)fCaloClusters->Delete(); |
e649177a | 534 | if(fPHOSCells)fPHOSCells->DeleteContainer(); |
535 | if(fEMCALCells)fEMCALCells->DeleteContainer(); | |
8e1324ab | 536 | if(fCosmicTracks)fCosmicTracks->Delete(); |
16167d49 | 537 | if(fErrorLogs) fErrorLogs->Delete(); |
af885e0f | 538 | |
d7749dec | 539 | // don't reset fconnected fConnected and the list |
60e8f114 | 540 | |
af885e0f | 541 | } |
542 | ||
543 | ||
544 | Int_t AliESDEvent::AddV0(const AliESDv0 *v) { | |
545 | // | |
546 | // Add V0 | |
547 | // | |
548 | TClonesArray &fv = *fV0s; | |
549 | Int_t idx=fV0s->GetEntriesFast(); | |
550 | new(fv[idx]) AliESDv0(*v); | |
551 | return idx; | |
552 | } | |
553 | ||
766037f0 | 554 | //______________________________________________________________________________ |
555 | Bool_t AliESDEvent::IsDetectorInTriggerCluster(TString detector, AliTriggerConfiguration* trigConf) const { | |
556 | // Check if a given detector was read-out in the analyzed event | |
557 | const TObjArray& classesArray=trigConf->GetClasses(); | |
558 | ULong64_t trigMask=GetTriggerMask(); | |
559 | Int_t nclasses = classesArray.GetEntriesFast(); | |
560 | for(Int_t iclass=0; iclass < nclasses; iclass++ ) { | |
561 | AliTriggerClass* trclass = (AliTriggerClass*)classesArray.At(iclass); | |
562 | Int_t classMask=trclass->GetMask(); | |
563 | if(trigMask & classMask){ | |
564 | TString detList=trclass->GetCluster()->GetDetectorsInCluster(); | |
565 | if(detList.Contains(detector.Data())){ | |
566 | return kTRUE; | |
567 | } | |
568 | } | |
569 | } | |
570 | return kFALSE; | |
571 | } | |
af885e0f | 572 | //______________________________________________________________________________ |
573 | void AliESDEvent::Print(Option_t *) const | |
574 | { | |
575 | // | |
576 | // Print header information of the event | |
577 | // | |
578 | printf("ESD run information\n"); | |
579 | printf("Event # in file %d Bunch crossing # %d Orbit # %d Period # %d Run # %d Trigger %lld Magnetic field %f \n", | |
580 | GetEventNumberInFile(), | |
581 | GetBunchCrossNumber(), | |
582 | GetOrbitNumber(), | |
583 | GetPeriodNumber(), | |
584 | GetRunNumber(), | |
585 | GetTriggerMask(), | |
586 | GetMagneticField() ); | |
c017f53f | 587 | if (fPrimaryVertex) |
588 | printf("Vertex: (%.4f +- %.4f, %.4f +- %.4f, %.4f +- %.4f) cm\n", | |
af885e0f | 589 | fPrimaryVertex->GetXv(), fPrimaryVertex->GetXRes(), |
590 | fPrimaryVertex->GetYv(), fPrimaryVertex->GetYRes(), | |
591 | fPrimaryVertex->GetZv(), fPrimaryVertex->GetZRes()); | |
1c7554f9 | 592 | printf("Mean vertex in RUN: X=%.4f Y=%.4f Z=%.4f cm\n", |
593 | GetDiamondX(),GetDiamondY(),GetDiamondZ()); | |
c017f53f | 594 | if(fSPDMult) |
af885e0f | 595 | printf("SPD Multiplicity. Number of tracklets %d \n", |
596 | fSPDMult->GetNumberOfTracklets()); | |
04d01397 | 597 | printf("Number of pileup primary vertices reconstructed with SPD %d\n", |
c017f53f | 598 | GetNumberOfPileupVerticesSPD()); |
04d01397 | 599 | printf("Number of pileup primary vertices reconstructed using the tracks %d\n", |
c017f53f | 600 | GetNumberOfPileupVerticesTracks()); |
af885e0f | 601 | printf("Number of tracks: \n"); |
602 | printf(" charged %d\n", GetNumberOfTracks()); | |
603 | printf(" muon %d\n", GetNumberOfMuonTracks()); | |
604 | printf(" pmd %d\n", GetNumberOfPmdTracks()); | |
605 | printf(" trd %d\n", GetNumberOfTrdTracks()); | |
52cd0cc0 | 606 | printf(" trd trkl %d\n", GetNumberOfTrdTracklets()); |
af885e0f | 607 | printf(" v0 %d\n", GetNumberOfV0s()); |
608 | printf(" cascades %d\n", GetNumberOfCascades()); | |
609 | printf(" kinks %d\n", GetNumberOfKinks()); | |
38f940fb | 610 | if(fPHOSCells)printf(" PHOSCells %d\n", fPHOSCells->GetNumberOfCells()); |
611 | else printf(" PHOSCells not in the Event\n"); | |
612 | if(fEMCALCells)printf(" EMCALCells %d\n", fEMCALCells->GetNumberOfCells()); | |
613 | else printf(" EMCALCells not in the Event\n"); | |
af885e0f | 614 | printf(" CaloClusters %d\n", GetNumberOfCaloClusters()); |
af885e0f | 615 | printf(" FMD %s\n", (fESDFMD ? "yes" : "no")); |
616 | printf(" VZERO %s\n", (fESDVZERO ? "yes" : "no")); | |
fe0324de | 617 | printf(" muClusters %d\n", fMuonClusters ? fMuonClusters->GetEntriesFast() : 0); |
618 | printf(" muPad %d\n", fMuonPads ? fMuonPads->GetEntriesFast() : 0); | |
8e1324ab | 619 | if (fCosmicTracks) printf(" Cosmics %d\n", GetNumberOfCosmicTracks()); |
820b4d9e | 620 | #ifdef MFT_UPGRADE |
621 | //printf(" MFT %s\n", (fESDMFT ? "yes" : "no")); | |
622 | #endif | |
623 | ||
624 | ||
8b12d288 | 625 | TObject* pHLTDecision=GetHLTTriggerDecision(); |
626 | printf("HLT trigger decision: %s\n", pHLTDecision?pHLTDecision->GetOption():"not available"); | |
627 | if (pHLTDecision) pHLTDecision->Print("compact"); | |
024c7734 | 628 | |
629 | return; | |
af885e0f | 630 | } |
631 | ||
7d44c466 | 632 | void AliESDEvent::SetESDfriend(const AliESDfriend *ev) const { |
af885e0f | 633 | // |
634 | // Attaches the complementary info to the ESD | |
635 | // | |
636 | if (!ev) return; | |
637 | ||
5300bdab | 638 | // to be sure that we set the tracks also |
639 | // in case of old esds | |
60e8f114 | 640 | // if(fESDOld)CopyFromOldESD(); |
5300bdab | 641 | |
af885e0f | 642 | Int_t ntrk=ev->GetNumberOfTracks(); |
643 | ||
644 | for (Int_t i=0; i<ntrk; i++) { | |
645 | const AliESDfriendTrack *f=ev->GetTrack(i); | |
a6c3743e | 646 | if (!f) {AliFatal(Form("NULL pointer for ESD track %d",i));} |
af885e0f | 647 | GetTrack(i)->SetFriendTrack(f); |
648 | } | |
649 | } | |
650 | ||
7d44c466 | 651 | Bool_t AliESDEvent::RemoveKink(Int_t rm) const { |
a023d8d8 | 652 | // --------------------------------------------------------- |
653 | // Remove a kink candidate and references to it from ESD, | |
654 | // if this candidate does not come from a reconstructed decay | |
655 | // Not yet implemented... | |
656 | // --------------------------------------------------------- | |
657 | Int_t last=GetNumberOfKinks()-1; | |
658 | if ((rm<0)||(rm>last)) return kFALSE; | |
659 | ||
660 | return kTRUE; | |
661 | } | |
662 | ||
7d44c466 | 663 | Bool_t AliESDEvent::RemoveV0(Int_t rm) const { |
a023d8d8 | 664 | // --------------------------------------------------------- |
665 | // Remove a V0 candidate and references to it from ESD, | |
666 | // if this candidate does not come from a reconstructed decay | |
667 | // --------------------------------------------------------- | |
668 | Int_t last=GetNumberOfV0s()-1; | |
669 | if ((rm<0)||(rm>last)) return kFALSE; | |
670 | ||
671 | AliESDv0 *v0=GetV0(rm); | |
672 | Int_t idxP=v0->GetPindex(), idxN=v0->GetNindex(); | |
673 | ||
674 | v0=GetV0(last); | |
675 | Int_t lastIdxP=v0->GetPindex(), lastIdxN=v0->GetNindex(); | |
676 | ||
677 | Int_t used=0; | |
678 | ||
679 | // Check if this V0 comes from a reconstructed decay | |
680 | Int_t ncs=GetNumberOfCascades(); | |
681 | for (Int_t n=0; n<ncs; n++) { | |
682 | AliESDcascade *cs=GetCascade(n); | |
683 | ||
684 | Int_t csIdxP=cs->GetPindex(); | |
685 | Int_t csIdxN=cs->GetNindex(); | |
686 | ||
687 | if (idxP==csIdxP) | |
688 | if (idxN==csIdxN) return kFALSE; | |
689 | ||
690 | if (csIdxP==lastIdxP) | |
691 | if (csIdxN==lastIdxN) used++; | |
692 | } | |
693 | ||
694 | //Replace the removed V0 with the last V0 | |
695 | TClonesArray &a=*fV0s; | |
696 | delete a.RemoveAt(rm); | |
697 | ||
698 | if (rm==last) return kTRUE; | |
699 | ||
700 | //v0 is pointing to the last V0 candidate... | |
701 | new (a[rm]) AliESDv0(*v0); | |
702 | delete a.RemoveAt(last); | |
703 | ||
704 | if (!used) return kTRUE; | |
705 | ||
706 | ||
707 | // Remap the indices of the daughters of reconstructed decays | |
708 | for (Int_t n=0; n<ncs; n++) { | |
709 | AliESDcascade *cs=GetCascade(n); | |
710 | ||
711 | ||
712 | Int_t csIdxP=cs->GetPindex(); | |
713 | Int_t csIdxN=cs->GetNindex(); | |
714 | ||
715 | if (csIdxP==lastIdxP) | |
716 | if (csIdxN==lastIdxN) { | |
717 | cs->AliESDv0::SetIndex(1,idxP); | |
718 | cs->AliESDv0::SetIndex(0,idxN); | |
719 | used--; | |
720 | if (!used) return kTRUE; | |
721 | } | |
722 | } | |
723 | ||
724 | return kTRUE; | |
725 | } | |
726 | ||
7d44c466 | 727 | Bool_t AliESDEvent::RemoveTrack(Int_t rm) const { |
d64bd07d | 728 | // --------------------------------------------------------- |
7f68891d | 729 | // Remove a track and references to it from ESD, |
730 | // if this track does not come from a reconstructed decay | |
d64bd07d | 731 | // --------------------------------------------------------- |
7f68891d | 732 | Int_t last=GetNumberOfTracks()-1; |
733 | if ((rm<0)||(rm>last)) return kFALSE; | |
734 | ||
735 | Int_t used=0; | |
d64bd07d | 736 | |
6fca035d | 737 | // Check if this track comes from the reconstructed primary vertices |
738 | if (fTPCVertex && fTPCVertex->GetStatus()) { | |
739 | UShort_t *primIdx=fTPCVertex->GetIndices(); | |
740 | Int_t n=fTPCVertex->GetNIndices(); | |
741 | while (n--) { | |
742 | Int_t idx=Int_t(primIdx[n]); | |
743 | if (rm==idx) return kFALSE; | |
744 | if (idx==last) used++; | |
745 | } | |
746 | } | |
747 | if (fPrimaryVertex && fPrimaryVertex->GetStatus()) { | |
748 | UShort_t *primIdx=fPrimaryVertex->GetIndices(); | |
749 | Int_t n=fPrimaryVertex->GetNIndices(); | |
750 | while (n--) { | |
751 | Int_t idx=Int_t(primIdx[n]); | |
752 | if (rm==idx) return kFALSE; | |
753 | if (idx==last) used++; | |
754 | } | |
755 | } | |
756 | ||
d64bd07d | 757 | // Check if this track comes from a reconstructed decay |
7f68891d | 758 | Int_t nv0=GetNumberOfV0s(); |
759 | for (Int_t n=0; n<nv0; n++) { | |
760 | AliESDv0 *v0=GetV0(n); | |
761 | ||
762 | Int_t idx=v0->GetNindex(); | |
763 | if (rm==idx) return kFALSE; | |
764 | if (idx==last) used++; | |
765 | ||
766 | idx=v0->GetPindex(); | |
767 | if (rm==idx) return kFALSE; | |
768 | if (idx==last) used++; | |
769 | } | |
770 | ||
771 | Int_t ncs=GetNumberOfCascades(); | |
772 | for (Int_t n=0; n<ncs; n++) { | |
773 | AliESDcascade *cs=GetCascade(n); | |
d64bd07d | 774 | |
7f68891d | 775 | Int_t idx=cs->GetIndex(); |
776 | if (rm==idx) return kFALSE; | |
777 | if (idx==last) used++; | |
fdbe4208 | 778 | |
779 | AliESDv0 *v0=cs; | |
780 | idx=v0->GetNindex(); | |
781 | if (rm==idx) return kFALSE; | |
782 | if (idx==last) used++; | |
783 | ||
784 | idx=v0->GetPindex(); | |
785 | if (rm==idx) return kFALSE; | |
786 | if (idx==last) used++; | |
7f68891d | 787 | } |
788 | ||
789 | Int_t nkn=GetNumberOfKinks(); | |
790 | for (Int_t n=0; n<nkn; n++) { | |
791 | AliESDkink *kn=GetKink(n); | |
792 | ||
793 | Int_t idx=kn->GetIndex(0); | |
794 | if (rm==idx) return kFALSE; | |
795 | if (idx==last) used++; | |
796 | ||
797 | idx=kn->GetIndex(1); | |
798 | if (rm==idx) return kFALSE; | |
799 | if (idx==last) used++; | |
800 | } | |
d64bd07d | 801 | |
8303b114 | 802 | // Check if this track is associated with a CaloCluster |
803 | Int_t ncl=GetNumberOfCaloClusters(); | |
804 | for (Int_t n=0; n<ncl; n++) { | |
805 | AliESDCaloCluster *cluster=GetCaloCluster(n); | |
806 | TArrayI *arr=cluster->GetTracksMatched(); | |
807 | Int_t s=arr->GetSize(); | |
808 | while (s--) { | |
809 | Int_t idx=arr->At(s); | |
810 | if (rm==idx) return kFALSE; | |
811 | if (idx==last) used++; | |
812 | } | |
813 | } | |
814 | ||
ddfbc51a | 815 | |
816 | ||
817 | //Replace the removed track with the last track | |
7f68891d | 818 | TClonesArray &a=*fTracks; |
819 | delete a.RemoveAt(rm); | |
820 | ||
821 | if (rm==last) return kTRUE; | |
822 | ||
823 | AliESDtrack *t=GetTrack(last); | |
a6c3743e | 824 | if (!t) {AliFatal(Form("NULL pointer for ESD track %d",last));} |
7f68891d | 825 | t->SetID(rm); |
ddfbc51a | 826 | new (a[rm]) AliESDtrack(*t); |
7f68891d | 827 | delete a.RemoveAt(last); |
828 | ||
6fca035d | 829 | |
7f68891d | 830 | if (!used) return kTRUE; |
831 | ||
832 | ||
6fca035d | 833 | // Remap the indices of the tracks used for the primary vertex reconstruction |
834 | if (fTPCVertex && fTPCVertex->GetStatus()) { | |
835 | UShort_t *primIdx=fTPCVertex->GetIndices(); | |
836 | Int_t n=fTPCVertex->GetNIndices(); | |
837 | while (n--) { | |
838 | Int_t idx=Int_t(primIdx[n]); | |
839 | if (idx==last) { | |
840 | primIdx[n]=Short_t(rm); | |
841 | used--; | |
842 | if (!used) return kTRUE; | |
843 | } | |
844 | } | |
845 | } | |
846 | if (fPrimaryVertex && fPrimaryVertex->GetStatus()) { | |
847 | UShort_t *primIdx=fPrimaryVertex->GetIndices(); | |
848 | Int_t n=fPrimaryVertex->GetNIndices(); | |
849 | while (n--) { | |
850 | Int_t idx=Int_t(primIdx[n]); | |
851 | if (idx==last) { | |
852 | primIdx[n]=Short_t(rm); | |
853 | used--; | |
854 | if (!used) return kTRUE; | |
855 | } | |
856 | } | |
857 | } | |
858 | ||
7f68891d | 859 | // Remap the indices of the daughters of reconstructed decays |
860 | for (Int_t n=0; n<nv0; n++) { | |
861 | AliESDv0 *v0=GetV0(n); | |
862 | if (v0->GetIndex(0)==last) { | |
863 | v0->SetIndex(0,rm); | |
864 | used--; | |
865 | if (!used) return kTRUE; | |
866 | } | |
867 | if (v0->GetIndex(1)==last) { | |
868 | v0->SetIndex(1,rm); | |
869 | used--; | |
870 | if (!used) return kTRUE; | |
871 | } | |
872 | } | |
873 | ||
874 | for (Int_t n=0; n<ncs; n++) { | |
875 | AliESDcascade *cs=GetCascade(n); | |
876 | if (cs->GetIndex()==last) { | |
877 | cs->SetIndex(rm); | |
878 | used--; | |
879 | if (!used) return kTRUE; | |
880 | } | |
fdbe4208 | 881 | AliESDv0 *v0=cs; |
882 | if (v0->GetIndex(0)==last) { | |
883 | v0->SetIndex(0,rm); | |
884 | used--; | |
885 | if (!used) return kTRUE; | |
886 | } | |
887 | if (v0->GetIndex(1)==last) { | |
888 | v0->SetIndex(1,rm); | |
889 | used--; | |
890 | if (!used) return kTRUE; | |
891 | } | |
7f68891d | 892 | } |
893 | ||
894 | for (Int_t n=0; n<nkn; n++) { | |
895 | AliESDkink *kn=GetKink(n); | |
896 | if (kn->GetIndex(0)==last) { | |
897 | kn->SetIndex(rm,0); | |
898 | used--; | |
899 | if (!used) return kTRUE; | |
900 | } | |
901 | if (kn->GetIndex(1)==last) { | |
902 | kn->SetIndex(rm,1); | |
903 | used--; | |
904 | if (!used) return kTRUE; | |
905 | } | |
906 | } | |
d64bd07d | 907 | |
8303b114 | 908 | // Remap the indices of the tracks accosicated with CaloClusters |
909 | for (Int_t n=0; n<ncl; n++) { | |
910 | AliESDCaloCluster *cluster=GetCaloCluster(n); | |
911 | TArrayI *arr=cluster->GetTracksMatched(); | |
912 | Int_t s=arr->GetSize(); | |
913 | while (s--) { | |
914 | Int_t idx=arr->At(s); | |
915 | if (idx==last) { | |
916 | arr->AddAt(rm,s); | |
917 | used--; | |
918 | if (!used) return kTRUE; | |
919 | } | |
920 | } | |
921 | } | |
922 | ||
d64bd07d | 923 | return kTRUE; |
924 | } | |
925 | ||
926 | ||
7f68891d | 927 | Bool_t AliESDEvent::Clean(Float_t *cleanPars) { |
928 | // | |
929 | // Remove the data which are not needed for the physics analysis. | |
930 | // | |
a023d8d8 | 931 | // 1) Cleaning the V0 candidates |
932 | // --------------------------- | |
933 | // If the cosine of the V0 pointing angle "csp" and | |
934 | // the DCA between the daughter tracks "dca" does not satisfy | |
935 | // the conditions | |
936 | // | |
937 | // csp > cleanPars[1] + dca/cleanPars[0]*(1.- cleanPars[1]) | |
938 | // | |
939 | // an attempt to remove this V0 candidate from ESD is made. | |
940 | // | |
941 | // The V0 candidate gets removed if it does not belong to any | |
942 | // recosntructed cascade decay | |
943 | // | |
944 | // 12.11.2007, optimal values: cleanPars[0]=0.5, cleanPars[1]=0.999 | |
945 | // | |
946 | // 2) Cleaning the tracks | |
947 | // ---------------------- | |
948 | // If track's transverse parameter is larger than cleanPars[2] | |
7f68891d | 949 | // OR |
a023d8d8 | 950 | // track's longitudinal parameter is larger than cleanPars[3] |
951 | // an attempt to remove this track from ESD is made. | |
7f68891d | 952 | // |
a023d8d8 | 953 | // The track gets removed if it does not come |
954 | // from a reconstructed decay | |
7f68891d | 955 | // |
a023d8d8 | 956 | Bool_t rc=kFALSE; |
957 | ||
958 | Float_t dcaMax=cleanPars[0]; | |
959 | Float_t cspMin=cleanPars[1]; | |
960 | ||
961 | Int_t nV0s=GetNumberOfV0s(); | |
962 | for (Int_t i=nV0s-1; i>=0; i--) { | |
963 | AliESDv0 *v0=GetV0(i); | |
964 | ||
965 | Float_t dca=v0->GetDcaV0Daughters(); | |
966 | Float_t csp=v0->GetV0CosineOfPointingAngle(); | |
967 | Float_t cspcut=cspMin + dca/dcaMax*(1.-cspMin); | |
449e752b | 968 | if (csp > cspcut) continue; |
969 | if (RemoveV0(i)) rc=kTRUE; | |
a023d8d8 | 970 | } |
971 | ||
7f68891d | 972 | |
a023d8d8 | 973 | Float_t dmax=cleanPars[2], zmax=cleanPars[3]; |
7f68891d | 974 | |
06cc9d95 | 975 | const AliESDVertex *vertex=GetPrimaryVertexSPD(); |
a023d8d8 | 976 | Bool_t vtxOK=vertex->GetStatus(); |
7f68891d | 977 | |
978 | Int_t nTracks=GetNumberOfTracks(); | |
979 | for (Int_t i=nTracks-1; i>=0; i--) { | |
980 | AliESDtrack *track=GetTrack(i); | |
a6c3743e | 981 | if (!track) {AliFatal(Form("NULL pointer for ESD track %d",i));} |
7f68891d | 982 | Float_t xy,z; track->GetImpactParameters(xy,z); |
983 | if ((TMath::Abs(xy) > dmax) || (vtxOK && (TMath::Abs(z) > zmax))) { | |
984 | if (RemoveTrack(i)) rc=kTRUE; | |
985 | } | |
986 | } | |
987 | ||
988 | return rc; | |
989 | } | |
990 | ||
6dc21f57 | 991 | Char_t AliESDEvent::AddPileupVertexSPD(const AliESDVertex *vtx) |
04d01397 | 992 | { |
993 | // Add a pileup primary vertex reconstructed with SPD | |
994 | TClonesArray &ftr = *fSPDPileupVertices; | |
6dc21f57 | 995 | Char_t n=Char_t(ftr.GetEntriesFast()); |
996 | AliESDVertex *vertex = new(ftr[n]) AliESDVertex(*vtx); | |
997 | vertex->SetID(n); | |
998 | return n; | |
04d01397 | 999 | } |
1000 | ||
6dc21f57 | 1001 | Char_t AliESDEvent::AddPileupVertexTracks(const AliESDVertex *vtx) |
04d01397 | 1002 | { |
1003 | // Add a pileup primary vertex reconstructed with SPD | |
1004 | TClonesArray &ftr = *fTrkPileupVertices; | |
6dc21f57 | 1005 | Char_t n=Char_t(ftr.GetEntriesFast()); |
1006 | AliESDVertex *vertex = new(ftr[n]) AliESDVertex(*vtx); | |
1007 | vertex->SetID(n); | |
1008 | return n; | |
04d01397 | 1009 | } |
1010 | ||
6989bff3 | 1011 | Int_t AliESDEvent::AddTrack(const AliESDtrack *t) |
1012 | { | |
af885e0f | 1013 | // Add track |
1014 | TClonesArray &ftr = *fTracks; | |
1015 | AliESDtrack * track = new(ftr[fTracks->GetEntriesFast()])AliESDtrack(*t); | |
1016 | track->SetID(fTracks->GetEntriesFast()-1); | |
1017 | return track->GetID(); | |
1018 | } | |
1019 | ||
65a0cf79 | 1020 | AliESDtrack* AliESDEvent::NewTrack() |
1021 | { | |
1022 | // Add a new track | |
1023 | TClonesArray &ftr = *fTracks; | |
1024 | AliESDtrack * track = new(ftr[fTracks->GetEntriesFast()])AliESDtrack(); | |
1025 | track->SetID(fTracks->GetEntriesFast()-1); | |
1026 | return track; | |
1027 | } | |
1028 | ||
fe0324de | 1029 | //______________________________________________________________________________ |
1030 | Bool_t AliESDEvent::MoveMuonObjects() | |
1031 | { | |
1032 | // move MUON clusters and pads to the new ESD structure in needed. | |
1033 | // to ensure backward compatibility | |
1034 | ||
1035 | if (!fOldMuonStructure) return kTRUE; | |
1036 | ||
1037 | if (!fMuonTracks || !fMuonClusters || !fMuonPads) return kFALSE; | |
1038 | ||
1039 | Bool_t reset = kTRUE; | |
1040 | Bool_t containTrackerData = kFALSE; | |
1041 | for (Int_t i = 0; i < fMuonTracks->GetEntriesFast(); i++) { | |
1042 | ||
1043 | AliESDMuonTrack *track = (AliESDMuonTrack*) fMuonTracks->UncheckedAt(i); | |
1044 | ||
1045 | if (track->ContainTrackerData()) containTrackerData = kTRUE; | |
1046 | else continue; | |
1047 | ||
1048 | if (!track->IsOldTrack()) continue; | |
1049 | ||
1050 | // remove objects connected to previous event if needed | |
1051 | if (reset) { | |
1052 | if (fMuonClusters->GetEntriesFast() > 0) fMuonClusters->Clear("C"); | |
1053 | if (fMuonPads->GetEntriesFast() > 0) fMuonPads->Clear("C"); | |
1054 | reset = kFALSE; | |
1055 | } | |
1056 | ||
1057 | track->MoveClustersToESD(*this); | |
1058 | ||
1059 | } | |
1060 | ||
1061 | // remove objects connected to previous event if needed | |
1062 | if (!containTrackerData) { | |
1063 | if (fMuonClusters->GetEntriesFast() > 0) fMuonClusters->Clear("C"); | |
1064 | if (fMuonPads->GetEntriesFast() > 0) fMuonPads->Clear("C"); | |
1065 | } | |
1066 | ||
1067 | return kTRUE; | |
1068 | } | |
1069 | ||
1070 | //______________________________________________________________________________ | |
1071 | AliESDMuonTrack* AliESDEvent::GetMuonTrack(Int_t i) | |
1072 | { | |
1073 | // get the MUON track at the position i in the internal array of track | |
1074 | if (!fMuonTracks) return 0x0; | |
1075 | if (!MoveMuonObjects()) return 0x0; | |
1076 | AliESDMuonTrack *track = (AliESDMuonTrack*) fMuonTracks->UncheckedAt(i); | |
1077 | track->SetESDEvent(this); | |
1078 | return track; | |
1079 | } | |
1080 | ||
1081 | //______________________________________________________________________________ | |
1082 | void AliESDEvent::AddMuonTrack(const AliESDMuonTrack *t) | |
1083 | { | |
1084 | // add a MUON track | |
1085 | TClonesArray &fmu = *fMuonTracks; | |
1086 | AliESDMuonTrack *track = new(fmu[fMuonTracks->GetEntriesFast()]) AliESDMuonTrack(*t); | |
1087 | track->MoveClustersToESD(*this); | |
1088 | } | |
1089 | ||
1090 | //______________________________________________________________________________ | |
1091 | AliESDMuonTrack* AliESDEvent::NewMuonTrack() | |
1092 | { | |
1093 | // create a new MUON track at the end of the internal array of track | |
1094 | TClonesArray &fmu = *fMuonTracks; | |
1095 | return new(fmu[fMuonTracks->GetEntriesFast()]) AliESDMuonTrack(); | |
1096 | } | |
1097 | ||
1098 | //______________________________________________________________________________ | |
1099 | Int_t AliESDEvent::GetNumberOfMuonClusters() | |
1100 | { | |
1101 | // get the number of MUON clusters | |
1102 | if (!fMuonClusters) return 0; | |
1103 | if (!MoveMuonObjects()) return 0; | |
1104 | return fMuonClusters->GetEntriesFast(); | |
1105 | } | |
1106 | ||
1107 | //______________________________________________________________________________ | |
1108 | AliESDMuonCluster* AliESDEvent::GetMuonCluster(Int_t i) | |
1109 | { | |
1110 | // get the MUON cluster at the position i in the internal array of cluster | |
1111 | if (!fMuonClusters) return 0x0; | |
1112 | if (!MoveMuonObjects()) return 0x0; | |
1113 | return (AliESDMuonCluster*) fMuonClusters->UncheckedAt(i); | |
1114 | } | |
1115 | ||
1116 | //______________________________________________________________________________ | |
1117 | AliESDMuonCluster* AliESDEvent::FindMuonCluster(UInt_t clusterId) | |
1118 | { | |
1119 | // find the MUON cluster with this Id in the internal array of cluster | |
1120 | if (!fMuonClusters) return 0x0; | |
1121 | if (!MoveMuonObjects()) return 0x0; | |
1122 | for (Int_t i = 0; i < fMuonClusters->GetEntriesFast(); i++) { | |
1123 | AliESDMuonCluster *cluster = (AliESDMuonCluster*) fMuonClusters->UncheckedAt(i); | |
1124 | if (cluster->GetUniqueID() == clusterId) return cluster; | |
1125 | } | |
1126 | return 0x0; | |
1127 | } | |
1128 | ||
1129 | //______________________________________________________________________________ | |
1130 | AliESDMuonCluster* AliESDEvent::NewMuonCluster() | |
1131 | { | |
1132 | // create a new MUON cluster at the end of the internal array of cluster | |
1133 | TClonesArray &fmu = *fMuonClusters; | |
1134 | return new(fmu[fMuonClusters->GetEntriesFast()]) AliESDMuonCluster(); | |
1135 | } | |
1136 | ||
1137 | //______________________________________________________________________________ | |
1138 | Int_t AliESDEvent::GetNumberOfMuonPads() | |
1139 | { | |
1140 | // get the number of MUON pads | |
1141 | if (!fMuonPads) return 0; | |
1142 | if (!MoveMuonObjects()) return 0; | |
1143 | return fMuonPads->GetEntriesFast(); | |
1144 | } | |
1145 | ||
1146 | //______________________________________________________________________________ | |
1147 | AliESDMuonPad* AliESDEvent::GetMuonPad(Int_t i) | |
6989bff3 | 1148 | { |
fe0324de | 1149 | // get the MUON pad at the position i in the internal array of pad |
1150 | if (!fMuonPads) return 0x0; | |
1151 | if (!MoveMuonObjects()) return 0x0; | |
1152 | return (AliESDMuonPad*) fMuonPads->UncheckedAt(i); | |
1153 | } | |
1154 | ||
1155 | //______________________________________________________________________________ | |
1156 | AliESDMuonPad* AliESDEvent::FindMuonPad(UInt_t padId) | |
1157 | { | |
1158 | // find the MUON pad with this Id in the internal array of pad | |
1159 | if (!fMuonPads) return 0x0; | |
1160 | if (!MoveMuonObjects()) return 0x0; | |
1161 | for (Int_t i = 0; i < fMuonPads->GetEntriesFast(); i++) { | |
1162 | AliESDMuonPad *pad = (AliESDMuonPad*) fMuonPads->UncheckedAt(i); | |
1163 | if (pad->GetUniqueID() == padId) return pad; | |
1164 | } | |
1165 | return 0x0; | |
1166 | } | |
1167 | ||
1168 | //______________________________________________________________________________ | |
1169 | AliESDMuonPad* AliESDEvent::NewMuonPad() | |
1170 | { | |
1171 | // create a new MUON pad at the end of the internal array of pad | |
1172 | TClonesArray &fmu = *fMuonPads; | |
1173 | return new(fmu[fMuonPads->GetEntriesFast()]) AliESDMuonPad(); | |
f0106218 | 1174 | } |
1175 | ||
6989bff3 | 1176 | void AliESDEvent::AddPmdTrack(const AliESDPmdTrack *t) |
1177 | { | |
f0106218 | 1178 | TClonesArray &fpmd = *fPmdTracks; |
1179 | new(fpmd[fPmdTracks->GetEntriesFast()]) AliESDPmdTrack(*t); | |
1180 | } | |
1181 | ||
6c8e0967 | 1182 | void AliESDEvent::SetTrdTrigger(const AliESDTrdTrigger *t) |
1183 | { | |
1184 | *fTrdTrigger = *t; | |
1185 | } | |
1186 | ||
6989bff3 | 1187 | void AliESDEvent::AddTrdTrack(const AliESDTrdTrack *t) |
1188 | { | |
f0106218 | 1189 | TClonesArray &ftrd = *fTrdTracks; |
1190 | new(ftrd[fTrdTracks->GetEntriesFast()]) AliESDTrdTrack(*t); | |
1191 | } | |
1192 | ||
52cd0cc0 | 1193 | void AliESDEvent::AddTrdTracklet(const AliESDTrdTracklet *trkl) |
1194 | { | |
1195 | new ((*fTrdTracklets)[fTrdTracklets->GetEntriesFast()]) AliESDTrdTracklet(*trkl); | |
1196 | } | |
f0106218 | 1197 | |
6989bff3 | 1198 | Int_t AliESDEvent::AddKink(const AliESDkink *c) |
1199 | { | |
af885e0f | 1200 | // Add kink |
1201 | TClonesArray &fk = *fKinks; | |
1202 | AliESDkink * kink = new(fk[fKinks->GetEntriesFast()]) AliESDkink(*c); | |
1203 | kink->SetID(fKinks->GetEntriesFast()); // CKB different from the other imps.. | |
1204 | return fKinks->GetEntriesFast()-1; | |
1205 | } | |
1206 | ||
f0106218 | 1207 | |
6989bff3 | 1208 | void AliESDEvent::AddCascade(const AliESDcascade *c) |
1209 | { | |
f0106218 | 1210 | TClonesArray &fc = *fCascades; |
1211 | new(fc[fCascades->GetEntriesFast()]) AliESDcascade(*c); | |
1212 | } | |
1213 | ||
8e1324ab | 1214 | void AliESDEvent::AddCosmicTrack(const AliESDCosmicTrack *t) |
1215 | { | |
1216 | TClonesArray &ft = *fCosmicTracks; | |
1217 | new(ft[fCosmicTracks->GetEntriesFast()]) AliESDCosmicTrack(*t); | |
1218 | } | |
1219 | ||
f0106218 | 1220 | |
6989bff3 | 1221 | Int_t AliESDEvent::AddCaloCluster(const AliESDCaloCluster *c) |
1222 | { | |
af885e0f | 1223 | // Add calocluster |
1224 | TClonesArray &fc = *fCaloClusters; | |
1225 | AliESDCaloCluster *clus = new(fc[fCaloClusters->GetEntriesFast()]) AliESDCaloCluster(*c); | |
1226 | clus->SetID(fCaloClusters->GetEntriesFast()-1); | |
1227 | return fCaloClusters->GetEntriesFast()-1; | |
1228 | } | |
1229 | ||
1230 | ||
7d44c466 | 1231 | void AliESDEvent::AddRawDataErrorLog(const AliRawDataErrorLog *log) const { |
6989bff3 | 1232 | TClonesArray &errlogs = *fErrorLogs; |
1233 | new(errlogs[errlogs.GetEntriesFast()]) AliRawDataErrorLog(*log); | |
1234 | } | |
f0106218 | 1235 | |
5d8eaff6 | 1236 | void AliESDEvent::SetZDCData(const AliESDZDC * obj) |
af6f24c9 | 1237 | { |
1238 | // use already allocated space | |
1239 | if(fESDZDC) | |
1240 | *fESDZDC = *obj; | |
1241 | } | |
1242 | ||
06cc9d95 | 1243 | void AliESDEvent::SetPrimaryVertexTPC(const AliESDVertex *vertex) |
1244 | { | |
1245 | // Set the TPC vertex | |
1246 | // use already allocated space | |
1247 | if(fTPCVertex){ | |
1248 | *fTPCVertex = *vertex; | |
1249 | fTPCVertex->SetName(fgkESDListName[kTPCVertex]); | |
1250 | } | |
1251 | } | |
1252 | ||
1253 | void AliESDEvent::SetPrimaryVertexSPD(const AliESDVertex *vertex) | |
6989bff3 | 1254 | { |
1255 | // Set the SPD vertex | |
60e8f114 | 1256 | // use already allocated space |
1257 | if(fSPDVertex){ | |
316c6cd9 | 1258 | *fSPDVertex = *vertex; |
6989bff3 | 1259 | fSPDVertex->SetName(fgkESDListName[kSPDVertex]); |
60e8f114 | 1260 | } |
1261 | } | |
1262 | ||
c264b61b | 1263 | void AliESDEvent::SetPrimaryVertexTracks(const AliESDVertex *vertex) |
6989bff3 | 1264 | { |
c264b61b | 1265 | // Set the primary vertex reconstructed using he ESD tracks. |
6989bff3 | 1266 | // use already allocated space |
60e8f114 | 1267 | if(fPrimaryVertex){ |
316c6cd9 | 1268 | *fPrimaryVertex = *vertex; |
6989bff3 | 1269 | fPrimaryVertex->SetName(fgkESDListName[kPrimaryVertex]); |
60e8f114 | 1270 | } |
1271 | } | |
1272 | ||
c264b61b | 1273 | const AliESDVertex * AliESDEvent::GetPrimaryVertex() const |
1274 | { | |
1275 | // | |
1276 | // Get the "best" available reconstructed primary vertex. | |
1277 | // | |
1278 | if(fPrimaryVertex){ | |
1279 | if (fPrimaryVertex->GetStatus()) return fPrimaryVertex; | |
1280 | } | |
1281 | if(fSPDVertex){ | |
1282 | if (fSPDVertex->GetStatus()) return fSPDVertex; | |
1283 | } | |
1284 | if(fTPCVertex) return fTPCVertex; | |
1285 | ||
1286 | AliWarning("No primary vertex available. Returning the \"default\"..."); | |
1287 | return fSPDVertex; | |
1288 | } | |
1289 | ||
518573d7 | 1290 | AliESDVertex * AliESDEvent::PrimaryVertexTracksUnconstrained() const |
1291 | { | |
1292 | // | |
1293 | // Removes diamond constraint from fPrimaryVertex (reconstructed with tracks) | |
1294 | // Returns a AliESDVertex which has to be deleted by the user | |
1295 | // | |
1296 | if(!fPrimaryVertex) { | |
1297 | AliWarning("No primary vertex from tracks available."); | |
1298 | return 0; | |
1299 | } | |
1300 | if(!fPrimaryVertex->GetStatus()) { | |
1301 | AliWarning("No primary vertex from tracks available."); | |
1302 | return 0; | |
1303 | } | |
1304 | ||
1305 | AliVertexerTracks vertexer(GetMagneticField()); | |
1306 | Float_t diamondxyz[3]={(Float_t)GetDiamondX(),(Float_t)GetDiamondY(),0.}; | |
1307 | Float_t diamondcovxy[3]; GetDiamondCovXY(diamondcovxy); | |
1308 | Float_t diamondcov[6]={diamondcovxy[0],diamondcovxy[1],diamondcovxy[2],0.,0.,7.}; | |
1309 | AliESDVertex *vertex = | |
1310 | (AliESDVertex*)vertexer.RemoveConstraintFromVertex(fPrimaryVertex,diamondxyz,diamondcov); | |
1311 | ||
1312 | return vertex; | |
1313 | } | |
1314 | ||
6989bff3 | 1315 | void AliESDEvent::SetMultiplicity(const AliMultiplicity *mul) |
1316 | { | |
1317 | // Set the SPD Multiplicity | |
f0106218 | 1318 | if(fSPDMult){ |
316c6cd9 | 1319 | *fSPDMult = *mul; |
f0106218 | 1320 | } |
1321 | } | |
1322 | ||
1323 | ||
6989bff3 | 1324 | void AliESDEvent::SetFMDData(AliESDFMD * obj) |
1325 | { | |
af885e0f | 1326 | // use already allocated space |
1327 | if(fESDFMD){ | |
316c6cd9 | 1328 | *fESDFMD = *obj; |
af885e0f | 1329 | } |
1330 | } | |
1331 | ||
5d8eaff6 | 1332 | void AliESDEvent::SetVZEROData(const AliESDVZERO * obj) |
6989bff3 | 1333 | { |
af885e0f | 1334 | // use already allocated space |
1335 | if(fESDVZERO) | |
6989bff3 | 1336 | *fESDVZERO = *obj; |
af885e0f | 1337 | } |
1338 | ||
5d8eaff6 | 1339 | void AliESDEvent::SetTZEROData(const AliESDTZERO * obj) |
b0e13b29 | 1340 | { |
1341 | // use already allocated space | |
1342 | if(fESDTZERO) | |
1343 | *fESDTZERO = *obj; | |
1344 | } | |
1345 | ||
820b4d9e | 1346 | #ifdef MFT_UPGRADE |
1347 | //void AliESDEvent::SetMFTData(AliESDMFT * obj) | |
1348 | //{ | |
1349 | // if(fESDMFT) | |
1350 | // *fESDMFT = *obj; | |
1351 | //} | |
1352 | #endif | |
1353 | ||
bd95bae7 | 1354 | void AliESDEvent::SetACORDEData(AliESDACORDE * obj) |
1355 | { | |
1356 | if(fESDACORDE) | |
1357 | *fESDACORDE = *obj; | |
1358 | } | |
1359 | ||
1360 | ||
6989bff3 | 1361 | void AliESDEvent::GetESDfriend(AliESDfriend *ev) const |
1362 | { | |
af885e0f | 1363 | // |
1364 | // Extracts the complementary info from the ESD | |
1365 | // | |
1366 | if (!ev) return; | |
1367 | ||
1368 | Int_t ntrk=GetNumberOfTracks(); | |
1369 | ||
1370 | for (Int_t i=0; i<ntrk; i++) { | |
80799a5f | 1371 | AliESDtrack *t=GetTrack(i); |
a6c3743e | 1372 | if (!t) {AliFatal(Form("NULL pointer for ESD track %d",i));} |
ddfbc51a | 1373 | const AliESDfriendTrack *f=t->GetFriendTrack(); |
1374 | ev->AddTrack(f); | |
1375 | ||
1376 | t->ReleaseESDfriendTrack();// Not to have two copies of "friendTrack" | |
1377 | ||
af885e0f | 1378 | } |
af885e0f | 1379 | |
b090e6a3 | 1380 | AliESDfriend *fr = (AliESDfriend*)(const_cast<AliESDEvent*>(this)->FindListObject("AliESDfriend")); |
1381 | if (fr) ev->SetVZEROfriend(fr->GetVZEROfriend()); | |
1382 | } | |
af885e0f | 1383 | |
1384 | void AliESDEvent::AddObject(TObject* obj) | |
1385 | { | |
1386 | // Add an object to the list of object. | |
1387 | // Please be aware that in order to increase performance you should | |
1388 | // refrain from using TObjArrays (if possible). Use TClonesArrays, instead. | |
1389 | fESDObjects->SetOwner(kTRUE); | |
1390 | fESDObjects->AddLast(obj); | |
1391 | } | |
1392 | ||
1393 | ||
1394 | void AliESDEvent::GetStdContent() | |
1395 | { | |
1396 | // set pointers for standard content | |
60e8f114 | 1397 | // get by name much safer and not a big overhead since not called very often |
1398 | ||
6989bff3 | 1399 | fESDRun = (AliESDRun*)fESDObjects->FindObject(fgkESDListName[kESDRun]); |
1400 | fHeader = (AliESDHeader*)fESDObjects->FindObject(fgkESDListName[kHeader]); | |
1401 | fESDZDC = (AliESDZDC*)fESDObjects->FindObject(fgkESDListName[kESDZDC]); | |
1402 | fESDFMD = (AliESDFMD*)fESDObjects->FindObject(fgkESDListName[kESDFMD]); | |
1403 | fESDVZERO = (AliESDVZERO*)fESDObjects->FindObject(fgkESDListName[kESDVZERO]); | |
1404 | fESDTZERO = (AliESDTZERO*)fESDObjects->FindObject(fgkESDListName[kESDTZERO]); | |
06cc9d95 | 1405 | fTPCVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kTPCVertex]); |
6989bff3 | 1406 | fSPDVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kSPDVertex]); |
1407 | fPrimaryVertex = (AliESDVertex*)fESDObjects->FindObject(fgkESDListName[kPrimaryVertex]); | |
1408 | fSPDMult = (AliMultiplicity*)fESDObjects->FindObject(fgkESDListName[kSPDMult]); | |
1409 | fPHOSTrigger = (AliESDCaloTrigger*)fESDObjects->FindObject(fgkESDListName[kPHOSTrigger]); | |
1410 | fEMCALTrigger = (AliESDCaloTrigger*)fESDObjects->FindObject(fgkESDListName[kEMCALTrigger]); | |
04d01397 | 1411 | fSPDPileupVertices = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kSPDPileupVertices]); |
1412 | fTrkPileupVertices = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTrkPileupVertices]); | |
6989bff3 | 1413 | fTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTracks]); |
1414 | fMuonTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kMuonTracks]); | |
fe0324de | 1415 | fMuonClusters = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kMuonClusters]); |
1416 | fMuonPads = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kMuonPads]); | |
6989bff3 | 1417 | fPmdTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kPmdTracks]); |
6c8e0967 | 1418 | fTrdTrigger = (AliESDTrdTrigger*)fESDObjects->FindObject(fgkESDListName[kTrdTrigger]); |
6989bff3 | 1419 | fTrdTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTrdTracks]); |
52cd0cc0 | 1420 | fTrdTracklets = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kTrdTracklets]); |
6989bff3 | 1421 | fV0s = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kV0s]); |
1422 | fCascades = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kCascades]); | |
1423 | fKinks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kKinks]); | |
1424 | fCaloClusters = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kCaloClusters]); | |
e649177a | 1425 | fEMCALCells = (AliESDCaloCells*)fESDObjects->FindObject(fgkESDListName[kEMCALCells]); |
1426 | fPHOSCells = (AliESDCaloCells*)fESDObjects->FindObject(fgkESDListName[kPHOSCells]); | |
6989bff3 | 1427 | fErrorLogs = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kErrorLogs]); |
bd95bae7 | 1428 | fESDACORDE = (AliESDACORDE*)fESDObjects->FindObject(fgkESDListName[kESDACORDE]); |
f858b00e | 1429 | fTOFHeader = (AliTOFHeader*)fESDObjects->FindObject(fgkESDListName[kTOFHeader]); |
8e1324ab | 1430 | fCosmicTracks = (TClonesArray*)fESDObjects->FindObject(fgkESDListName[kCosmicTracks]); |
820b4d9e | 1431 | #ifdef MFT_UPGRADE |
1432 | // fESDMFT = (AliESDMFT*)fESDObjects->FindObject(fgkESDListName[kESDMFT]); | |
1433 | #endif | |
af885e0f | 1434 | } |
1435 | ||
1436 | void AliESDEvent::SetStdNames(){ | |
1437 | // Set the names of the standard contents | |
60e8f114 | 1438 | // |
102c56c8 | 1439 | if(fESDObjects->GetEntries()>=kESDListN){ |
1440 | for(int i = 0;i < fESDObjects->GetEntries() && i<kESDListN;i++){ | |
60e8f114 | 1441 | TObject *fObj = fESDObjects->At(i); |
1442 | if(fObj->InheritsFrom("TNamed")){ | |
6989bff3 | 1443 | ((TNamed*)fObj)->SetName(fgkESDListName[i]); |
60e8f114 | 1444 | } |
1445 | else if(fObj->InheritsFrom("TClonesArray")){ | |
6989bff3 | 1446 | ((TClonesArray*)fObj)->SetName(fgkESDListName[i]); |
60e8f114 | 1447 | } |
1448 | } | |
1449 | } | |
1450 | else{ | |
90e88950 | 1451 | AliWarning("Std Entries missing"); |
60e8f114 | 1452 | } |
af885e0f | 1453 | } |
1454 | ||
a2fbb067 | 1455 | |
1456 | void AliESDEvent::CreateStdContent(Bool_t bUseThisList){ | |
1457 | fUseOwnList = bUseThisList; | |
1458 | CreateStdContent(); | |
1459 | } | |
1460 | ||
af885e0f | 1461 | void AliESDEvent::CreateStdContent() |
1462 | { | |
1463 | // create the standard AOD content and set pointers | |
1464 | ||
1465 | // create standard objects and add them to the TList of objects | |
1466 | AddObject(new AliESDRun()); | |
1467 | AddObject(new AliESDHeader()); | |
1468 | AddObject(new AliESDZDC()); | |
1469 | AddObject(new AliESDFMD()); | |
1470 | AddObject(new AliESDVZERO()); | |
1471 | AddObject(new AliESDTZERO()); | |
1472 | AddObject(new AliESDVertex()); | |
1473 | AddObject(new AliESDVertex()); | |
06cc9d95 | 1474 | AddObject(new AliESDVertex()); |
af885e0f | 1475 | AddObject(new AliMultiplicity()); |
1476 | AddObject(new AliESDCaloTrigger()); | |
1477 | AddObject(new AliESDCaloTrigger()); | |
04d01397 | 1478 | AddObject(new TClonesArray("AliESDVertex",0)); |
1479 | AddObject(new TClonesArray("AliESDVertex",0)); | |
af885e0f | 1480 | AddObject(new TClonesArray("AliESDtrack",0)); |
1481 | AddObject(new TClonesArray("AliESDMuonTrack",0)); | |
fe0324de | 1482 | AddObject(new TClonesArray("AliESDMuonCluster",0)); |
1483 | AddObject(new TClonesArray("AliESDMuonPad",0)); | |
af885e0f | 1484 | AddObject(new TClonesArray("AliESDPmdTrack",0)); |
6c8e0967 | 1485 | AddObject(new AliESDTrdTrigger()); |
af885e0f | 1486 | AddObject(new TClonesArray("AliESDTrdTrack",0)); |
52cd0cc0 | 1487 | AddObject(new TClonesArray("AliESDTrdTracklet",0)); |
af885e0f | 1488 | AddObject(new TClonesArray("AliESDv0",0)); |
1489 | AddObject(new TClonesArray("AliESDcascade",0)); | |
1490 | AddObject(new TClonesArray("AliESDkink",0)); | |
1491 | AddObject(new TClonesArray("AliESDCaloCluster",0)); | |
e649177a | 1492 | AddObject(new AliESDCaloCells()); |
1493 | AddObject(new AliESDCaloCells()); | |
af885e0f | 1494 | AddObject(new TClonesArray("AliRawDataErrorLog",0)); |
bd95bae7 | 1495 | AddObject(new AliESDACORDE()); |
f858b00e | 1496 | AddObject(new AliTOFHeader()); |
8e1324ab | 1497 | AddObject(new TClonesArray("AliESDCosmicTrack",0)); |
820b4d9e | 1498 | #ifdef MFT_UPGRADE |
1499 | //AddObject(new AliESDMFT()); | |
1500 | #endif | |
1501 | ||
af885e0f | 1502 | // check the order of the indices against enum... |
1503 | ||
af885e0f | 1504 | // set names |
1505 | SetStdNames(); | |
60e8f114 | 1506 | // read back pointers |
1507 | GetStdContent(); | |
af885e0f | 1508 | } |
1509 | ||
fe0324de | 1510 | void AliESDEvent::CompleteStdContent() |
1511 | { | |
75b7f8b6 | 1512 | // Create missing standard objects and add them to the TList of objects |
1513 | // | |
1514 | // Add cosmic tracks for cases where esd files were created | |
1515 | // before adding them to the std content | |
1516 | if (!fESDObjects->FindObject(fgkESDListName[kCosmicTracks])) { | |
1517 | TClonesArray* cosmics = new TClonesArray("AliESDCosmicTrack",0); | |
1518 | fESDObjects->AddAt(cosmics, kCosmicTracks); | |
1519 | fESDObjects->SetOwner(kTRUE); | |
1520 | } | |
1521 | // Add new MUON containers if missing (for backward compatibility) | |
fe0324de | 1522 | if (!fESDObjects->FindObject(fgkESDListName[kMuonClusters])) { |
1523 | TClonesArray* muonClusters = new TClonesArray("AliESDMuonCluster",0); | |
1524 | muonClusters->SetName(fgkESDListName[kMuonClusters]); | |
1525 | fESDObjects->AddAt(muonClusters, kMuonClusters); | |
1526 | fESDObjects->SetOwner(kTRUE); | |
1527 | } | |
1528 | if (!fESDObjects->FindObject(fgkESDListName[kMuonPads])) { | |
1529 | TClonesArray* muonPads = new TClonesArray("AliESDMuonPad",0); | |
1530 | muonPads->SetName(fgkESDListName[kMuonPads]); | |
1531 | fESDObjects->AddAt(muonPads, kMuonPads); | |
1532 | fESDObjects->SetOwner(kTRUE); | |
1533 | } | |
1534 | } | |
1535 | ||
2811495d | 1536 | TObject* AliESDEvent::FindListObject(const char *name) const { |
7d44c466 | 1537 | // |
1538 | // Find object with name "name" in the list of branches | |
1539 | // | |
d7749dec | 1540 | if(fESDObjects){ |
1541 | return fESDObjects->FindObject(name); | |
1542 | } | |
001b9beb | 1543 | return 0; |
1544 | } | |
1545 | ||
cd1d4ee0 | 1546 | Int_t AliESDEvent::GetPHOSClusters(TRefArray *clusters) const |
1547 | { | |
1548 | // fills the provided TRefArray with all found phos clusters | |
e649177a | 1549 | |
cd1d4ee0 | 1550 | clusters->Clear(); |
e649177a | 1551 | |
cd1d4ee0 | 1552 | AliESDCaloCluster *cl = 0; |
1553 | for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) { | |
e649177a | 1554 | |
1555 | if ( (cl = GetCaloCluster(i)) ) { | |
cd1d4ee0 | 1556 | if (cl->IsPHOS()){ |
1557 | clusters->Add(cl); | |
e649177a | 1558 | AliDebug(1,Form("IsPHOS cluster %d Size: %d \n",i,clusters->GetEntriesFast())); |
cd1d4ee0 | 1559 | } |
1560 | } | |
1561 | } | |
1562 | return clusters->GetEntriesFast(); | |
1563 | } | |
1564 | ||
1565 | Int_t AliESDEvent::GetEMCALClusters(TRefArray *clusters) const | |
1566 | { | |
e649177a | 1567 | // fills the provided TRefArray with all found emcal clusters |
cd1d4ee0 | 1568 | |
1569 | clusters->Clear(); | |
1570 | ||
1571 | AliESDCaloCluster *cl = 0; | |
1572 | for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) { | |
1573 | ||
e649177a | 1574 | if ( (cl = GetCaloCluster(i)) ) { |
cd1d4ee0 | 1575 | if (cl->IsEMCAL()){ |
1576 | clusters->Add(cl); | |
e649177a | 1577 | AliDebug(1,Form("IsEMCAL cluster %d Size: %d \n",i,clusters->GetEntriesFast())); |
cd1d4ee0 | 1578 | } |
1579 | } | |
1580 | } | |
1581 | return clusters->GetEntriesFast(); | |
1582 | } | |
1583 | ||
f12d42ce | 1584 | void AliESDEvent::WriteToTree(TTree* tree) const { |
38f940fb | 1585 | // Book the branches as in TTree::Branch(TCollection*) |
1586 | // but add a "." at the end of top level branches which are | |
1587 | // not a TClonesArray | |
1588 | ||
1589 | ||
1590 | TString branchname; | |
1591 | TIter next(fESDObjects); | |
7d44c466 | 1592 | const Int_t kSplitlevel = 99; // default value in TTree::Branch() |
ddfbc51a | 1593 | const Int_t kBufsize = 32000; // default value in TTree::Branch() |
38f940fb | 1594 | TObject *obj = 0; |
1595 | ||
1596 | while ((obj = next())) { | |
1597 | branchname.Form("%s", obj->GetName()); | |
32ba9c61 | 1598 | if(branchname.CompareTo("AliESDfriend")==0)branchname = "ESDfriend."; |
7d44c466 | 1599 | if ((kSplitlevel > 1) && !obj->InheritsFrom(TClonesArray::Class())) { |
732a24fe | 1600 | if(!branchname.EndsWith("."))branchname += "."; |
38f940fb | 1601 | } |
102c56c8 | 1602 | if (!tree->FindBranch(branchname)) { |
771c4f86 | 1603 | // For the custom streamer to be called splitlevel |
1604 | // has to be negative, only needed for HLT | |
1605 | Int_t splitLevel = (TString(obj->ClassName()) == "AliHLTGlobalTriggerDecision") ? -1 : kSplitlevel - 1; | |
1606 | tree->Bronch(branchname, obj->ClassName(), fESDObjects->GetObjectRef(obj),kBufsize, splitLevel); | |
102c56c8 | 1607 | } |
38f940fb | 1608 | } |
38f940fb | 1609 | } |
1610 | ||
cd1d4ee0 | 1611 | |
f7ec3414 | 1612 | void AliESDEvent::ReadFromTree(TTree *tree, Option_t* opt){ |
7d44c466 | 1613 | // |
1614 | // Connect the ESDEvent to a tree | |
1615 | // | |
6989bff3 | 1616 | if(!tree){ |
90e88950 | 1617 | AliWarning("AliESDEvent::ReadFromTree() Zero Pointer to Tree \n"); |
6989bff3 | 1618 | return; |
1619 | } | |
024c7734 | 1620 | // load the TTree |
6989bff3 | 1621 | if(!tree->GetTree())tree->LoadTree(0); |
024c7734 | 1622 | |
001b9beb | 1623 | // if we find the "ESD" branch on the tree we do have the old structure |
1bd10080 | 1624 | if(tree->GetBranch("ESD")) { |
fe0324de | 1625 | fOldMuonStructure = kFALSE; |
1bd10080 | 1626 | char ** address = (char **)(tree->GetBranch("ESD")->GetAddress()); |
0eb6eb59 | 1627 | // do we have the friend branch |
1628 | TBranch * esdFB = tree->GetBranch("ESDfriend."); | |
1629 | char ** addressF = 0; | |
1630 | if(esdFB)addressF = (char **)(esdFB->GetAddress()); | |
6989bff3 | 1631 | if (!address) { |
90e88950 | 1632 | AliInfo("AliESDEvent::ReadFromTree() Reading old Tree"); |
1bd10080 | 1633 | tree->SetBranchAddress("ESD", &fESDOld); |
0eb6eb59 | 1634 | if(esdFB){ |
1635 | tree->SetBranchAddress("ESDfriend.",&fESDFriendOld); | |
1636 | } | |
6989bff3 | 1637 | } else { |
90e88950 | 1638 | AliInfo("AliESDEvent::ReadFromTree() Reading old Tree"); |
1639 | AliInfo("Branch already connected. Using existing branch address."); | |
1bd10080 | 1640 | fESDOld = (AliESD*) (*address); |
0eb6eb59 | 1641 | // addressF can still be 0, since branch needs to switched on |
1642 | if(addressF)fESDFriendOld = (AliESDfriend*) (*addressF); | |
6989bff3 | 1643 | } |
0eb6eb59 | 1644 | |
6989bff3 | 1645 | // have already connected the old ESD structure... ? |
1646 | // reuse also the pointer of the AlliESDEvent | |
1647 | // otherwise create new ones | |
6989bff3 | 1648 | TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree")); |
1649 | ||
1650 | if(connectedList){ | |
1651 | // If connected use the connected list of objects | |
0eb6eb59 | 1652 | if(fESDObjects!= connectedList){ |
1653 | // protect when called twice | |
1654 | fESDObjects->Delete(); | |
1655 | fESDObjects = connectedList; | |
1656 | } | |
6989bff3 | 1657 | GetStdContent(); |
0eb6eb59 | 1658 | |
0eb6eb59 | 1659 | |
d7749dec | 1660 | // The pointer to the friend changes when called twice via InitIO |
1661 | // since AliESDEvent is deleted | |
0eb6eb59 | 1662 | TObject* oldf = FindListObject("AliESDfriend"); |
1663 | TObject* newf = 0; | |
1664 | if(addressF){ | |
1665 | newf = (TObject*)*addressF; | |
1666 | } | |
1667 | if(newf!=0&&oldf!=newf){ | |
1668 | // remove the old reference | |
1669 | // Should we also delete it? Or is this handled in TTree I/O | |
1670 | // since it is created by the first SetBranchAddress | |
1671 | fESDObjects->Remove(oldf); | |
1672 | // add the new one | |
1673 | fESDObjects->Add(newf); | |
1674 | } | |
1675 | ||
6989bff3 | 1676 | fConnected = true; |
b93c2026 | 1677 | return; |
6989bff3 | 1678 | } |
1679 | // else... | |
1680 | CreateStdContent(); // create for copy | |
0eb6eb59 | 1681 | // if we have the esdfriend add it, so we always can access it via the userinfo |
1682 | if(fESDFriendOld)AddObject(fESDFriendOld); | |
6989bff3 | 1683 | // we are not owner of the list objects |
1684 | // must not delete it | |
efea3f54 | 1685 | fESDObjects->SetOwner(kTRUE); |
6989bff3 | 1686 | fESDObjects->SetName("ESDObjectsConnectedToTree"); |
1687 | tree->GetUserInfo()->Add(fESDObjects); | |
1688 | fConnected = true; | |
1689 | return; | |
af885e0f | 1690 | } |
0eb6eb59 | 1691 | |
732a24fe | 1692 | |
1693 | delete fESDOld; | |
1694 | fESDOld = 0; | |
af885e0f | 1695 | // Try to find AliESDEvent |
1696 | AliESDEvent *esdEvent = 0; | |
1697 | esdEvent = (AliESDEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliESDEvent"); | |
001b9beb | 1698 | if(esdEvent){ |
941603c0 | 1699 | // Check if already connected to tree |
efea3f54 | 1700 | esdEvent->Reset(); |
139f2194 | 1701 | TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree")); |
f7ec3414 | 1702 | |
1703 | ||
1704 | if (connectedList && (strcmp(opt, "reconnect"))) { | |
139f2194 | 1705 | // If connected use the connected list if objects |
1706 | fESDObjects->Delete(); | |
b5bc83df | 1707 | fESDObjects = connectedList; |
1708 | GetStdContent(); | |
fe0324de | 1709 | fOldMuonStructure = fESDObjects->TestBit(BIT(23)); |
60e8f114 | 1710 | fConnected = true; |
139f2194 | 1711 | return; |
1712 | } | |
732a24fe | 1713 | |
139f2194 | 1714 | // Connect to tree |
001b9beb | 1715 | // prevent a memory leak when reading back the TList |
28a79204 | 1716 | // if (!(strcmp(opt, "reconnect"))) fESDObjects->Delete(); |
f7ec3414 | 1717 | |
a2fbb067 | 1718 | if(!fUseOwnList){ |
a2fbb067 | 1719 | // create a new TList from the UserInfo TList... |
1720 | // copy constructor does not work... | |
1721 | fESDObjects = (TList*)(esdEvent->GetList()->Clone()); | |
efea3f54 | 1722 | fESDObjects->SetOwner(kTRUE); |
a2fbb067 | 1723 | } |
1724 | else if ( fESDObjects->GetEntries()==0){ | |
1725 | // at least create the std content if we want to read to our list | |
1726 | CreateStdContent(); | |
1727 | } | |
732a24fe | 1728 | |
1729 | // in principle | |
1730 | // we only need new things in the list if we do no already have it.. | |
1731 | // TODO just add new entries | |
fe0324de | 1732 | CompleteStdContent(); |
732a24fe | 1733 | |
af885e0f | 1734 | if(fESDObjects->GetEntries()<kESDListN){ |
90e88950 | 1735 | AliWarning(Form("AliESDEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n", |
1736 | fESDObjects->GetEntries(),kESDListN)); | |
af885e0f | 1737 | } |
1738 | // set the branch addresses | |
fe0324de | 1739 | fOldMuonStructure = kFALSE; |
af885e0f | 1740 | TIter next(fESDObjects); |
1741 | TNamed *el; | |
1742 | while((el=(TNamed*)next())){ | |
1743 | TString bname(el->GetName()); | |
af885e0f | 1744 | if(bname.CompareTo("AliESDfriend")==0) |
1745 | { | |
1746 | // AliESDfriend does not have a name ... | |
4453d900 | 1747 | TBranch *br = tree->GetBranch("ESDfriend."); |
588195ca | 1748 | if (br) tree->SetBranchAddress("ESDfriend.",fESDObjects->GetObjectRef(el)); |
af885e0f | 1749 | } |
1750 | else{ | |
38f940fb | 1751 | // check if branch exists under this Name |
1752 | TBranch *br = tree->GetBranch(bname.Data()); | |
1753 | if(br){ | |
1754 | tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el)); | |
1755 | } | |
1756 | else{ | |
1757 | br = tree->GetBranch(Form("%s.",bname.Data())); | |
1758 | if(br){ | |
1759 | tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el)); | |
1760 | } | |
1761 | else{ | |
90e88950 | 1762 | AliWarning(Form("AliESDEvent::ReadFromTree() No Branch found with Name %s or %s.",bname.Data(),bname.Data())); |
fe0324de | 1763 | if (bname == fgkESDListName[kMuonClusters]) { |
1764 | fOldMuonStructure = kTRUE; | |
1765 | } | |
38f940fb | 1766 | } |
1767 | ||
1768 | } | |
af885e0f | 1769 | } |
1770 | } | |
1771 | GetStdContent(); | |
1772 | // when reading back we are not owner of the list | |
1773 | // must not delete it | |
efea3f54 | 1774 | fESDObjects->SetOwner(kTRUE); |
60e8f114 | 1775 | fESDObjects->SetName("ESDObjectsConnectedToTree"); |
fe0324de | 1776 | fESDObjects->SetBit(BIT(23), fOldMuonStructure); |
139f2194 | 1777 | // we are not owner of the list objects |
1778 | // must not delete it | |
60e8f114 | 1779 | tree->GetUserInfo()->Add(fESDObjects); |
efea3f54 | 1780 | tree->GetUserInfo()->SetOwner(kFALSE); |
60e8f114 | 1781 | fConnected = true; |
efea3f54 | 1782 | }// no esdEvent --> |
af885e0f | 1783 | else { |
001b9beb | 1784 | // we can't get the list from the user data, create standard content |
1785 | // and set it by hand (no ESDfriend at the moment | |
af885e0f | 1786 | CreateStdContent(); |
fe0324de | 1787 | fOldMuonStructure = kFALSE; |
af885e0f | 1788 | TIter next(fESDObjects); |
1789 | TNamed *el; | |
1790 | while((el=(TNamed*)next())){ | |
1791 | TString bname(el->GetName()); | |
732a24fe | 1792 | TBranch *br = tree->GetBranch(bname.Data()); |
1793 | if(br){ | |
1794 | tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el)); | |
1795 | } | |
1796 | else{ | |
1797 | br = tree->GetBranch(Form("%s.",bname.Data())); | |
1798 | if(br){ | |
1799 | tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el)); | |
1800 | } | |
fe0324de | 1801 | else if (bname == fgkESDListName[kMuonClusters]) { |
1802 | fOldMuonStructure = kTRUE; | |
1803 | } | |
732a24fe | 1804 | } |
af885e0f | 1805 | } |
1806 | GetStdContent(); | |
1807 | // when reading back we are not owner of the list | |
1808 | // must not delete it | |
316cf4cc | 1809 | fESDObjects->SetOwner(kTRUE); |
af885e0f | 1810 | } |
af885e0f | 1811 | } |
1812 | ||
1813 | ||
1814 | void AliESDEvent::CopyFromOldESD() | |
1815 | { | |
1816 | // Method which copies over everthing from the old esd structure to the | |
1817 | // new | |
af885e0f | 1818 | if(fESDOld){ |
1819 | ResetStdContent(); | |
1820 | // Run | |
1821 | SetRunNumber(fESDOld->GetRunNumber()); | |
1822 | SetPeriodNumber(fESDOld->GetPeriodNumber()); | |
6ca8842a | 1823 | SetMagneticField(fESDOld->GetMagneticField()); |
af885e0f | 1824 | |
1825 | // leave out diamond ... | |
1826 | // SetDiamond(const AliESDVertex *vertex) { fESDRun->SetDiamond(vertex);} | |
1827 | ||
1828 | // header | |
1829 | SetTriggerMask(fESDOld->GetTriggerMask()); | |
1830 | SetOrbitNumber(fESDOld->GetOrbitNumber()); | |
1831 | SetTimeStamp(fESDOld->GetTimeStamp()); | |
1832 | SetEventType(fESDOld->GetEventType()); | |
1833 | SetEventNumberInFile(fESDOld->GetEventNumberInFile()); | |
1834 | SetBunchCrossNumber(fESDOld->GetBunchCrossNumber()); | |
1835 | SetTriggerCluster(fESDOld->GetTriggerCluster()); | |
1836 | ||
1837 | // ZDC | |
1838 | ||
1839 | SetZDC(fESDOld->GetZDCN1Energy(), | |
a85132e7 | 1840 | fESDOld->GetZDCP1Energy(), |
1841 | fESDOld->GetZDCEMEnergy(), | |
1842 | 0, | |
1843 | fESDOld->GetZDCN2Energy(), | |
1844 | fESDOld->GetZDCP2Energy(), | |
2b6cdc43 | 1845 | fESDOld->GetZDCParticipants(), |
5f0ec064 | 1846 | 0, |
1847 | 0, | |
1848 | 0, | |
1849 | 0, | |
1850 | 0, | |
2b6cdc43 | 1851 | 0); |
af885e0f | 1852 | |
1853 | // FMD | |
1854 | ||
cb6aa27f | 1855 | if(fESDOld->GetFMDData())SetFMDData(fESDOld->GetFMDData()); |
af885e0f | 1856 | |
1857 | // T0 | |
1858 | ||
1859 | SetT0zVertex(fESDOld->GetT0zVertex()); | |
1860 | SetT0(fESDOld->GetT0()); | |
1861 | // leave amps out | |
1862 | ||
1863 | // VZERO | |
c06eaba2 | 1864 | if (fESDOld->GetVZEROData()) SetVZEROData(fESDOld->GetVZEROData()); |
af885e0f | 1865 | |
06cc9d95 | 1866 | if(fESDOld->GetVertex())SetPrimaryVertexSPD(fESDOld->GetVertex()); |
af885e0f | 1867 | |
c264b61b | 1868 | if(fESDOld->GetPrimaryVertex())SetPrimaryVertexTracks(fESDOld->GetPrimaryVertex()); |
af885e0f | 1869 | |
cb6aa27f | 1870 | if(fESDOld->GetMultiplicity())SetMultiplicity(fESDOld->GetMultiplicity()); |
1bd10080 | 1871 | |
af885e0f | 1872 | for(int i = 0;i<fESDOld->GetNumberOfTracks();i++){ |
1873 | AddTrack(fESDOld->GetTrack(i)); | |
1874 | } | |
1875 | ||
1876 | for(int i = 0;i<fESDOld->GetNumberOfMuonTracks();i++){ | |
1877 | AddMuonTrack(fESDOld->GetMuonTrack(i)); | |
1878 | } | |
1879 | ||
1880 | for(int i = 0;i<fESDOld->GetNumberOfPmdTracks();i++){ | |
1881 | AddPmdTrack(fESDOld->GetPmdTrack(i)); | |
1882 | } | |
1883 | ||
1884 | for(int i = 0;i<fESDOld->GetNumberOfTrdTracks();i++){ | |
1885 | AddTrdTrack(fESDOld->GetTrdTrack(i)); | |
1886 | } | |
1887 | ||
1888 | for(int i = 0;i<fESDOld->GetNumberOfV0s();i++){ | |
1889 | AddV0(fESDOld->GetV0(i)); | |
1890 | } | |
1891 | ||
1892 | for(int i = 0;i<fESDOld->GetNumberOfCascades();i++){ | |
1893 | AddCascade(fESDOld->GetCascade(i)); | |
1894 | } | |
1895 | ||
1896 | for(int i = 0;i<fESDOld->GetNumberOfKinks();i++){ | |
1897 | AddKink(fESDOld->GetKink(i)); | |
1898 | } | |
1899 | ||
1900 | ||
1901 | for(int i = 0;i<fESDOld->GetNumberOfCaloClusters();i++){ | |
1902 | AddCaloCluster(fESDOld->GetCaloCluster(i)); | |
1903 | } | |
820b4d9e | 1904 | |
1905 | #ifdef MFT_UPGRADE | |
1906 | // MFT | |
1907 | // if (fESDOld->GetMFTData()) SetMFTData(fESDOld->GetMFTData()); | |
1908 | #endif | |
1bd10080 | 1909 | |
af885e0f | 1910 | }// if fesdold |
1911 | } | |
1912 | ||
2a3dfb14 | 1913 | Bool_t AliESDEvent::IsEventSelected(const char *trigExpr) const |
1914 | { | |
1915 | // Check if the event satisfies the trigger | |
1916 | // selection expression trigExpr. | |
1917 | // trigExpr can be any logical expression | |
1918 | // of the trigger classes defined in AliESDRun | |
1919 | // In case of wrong syntax return kTRUE. | |
1920 | ||
1921 | TString expr(trigExpr); | |
1922 | if (expr.IsNull()) return kTRUE; | |
1923 | ||
1924 | ULong64_t mask = GetTriggerMask(); | |
1925 | for(Int_t itrig = 0; itrig < AliESDRun::kNTriggerClasses; itrig++) { | |
1926 | if (mask & (1ull << itrig)) { | |
1927 | expr.ReplaceAll(GetESDRun()->GetTriggerClass(itrig),"1"); | |
1928 | } | |
1929 | else { | |
1930 | expr.ReplaceAll(GetESDRun()->GetTriggerClass(itrig),"0"); | |
1931 | } | |
1932 | } | |
1933 | ||
1934 | Int_t error; | |
1935 | if ((gROOT->ProcessLineFast(expr.Data(),&error) == 0) && | |
1936 | (error == TInterpreter::kNoError)) { | |
1937 | return kFALSE; | |
1938 | } | |
1939 | ||
1940 | return kTRUE; | |
1941 | ||
1942 | } | |
1943 | ||
3b286f80 | 1944 | TObject* AliESDEvent::GetHLTTriggerDecision() const |
1945 | { | |
1946 | // get the HLT trigger decission object | |
1947 | ||
1948 | // cast away const'nes because the FindListObject method | |
1949 | // is not const | |
1950 | AliESDEvent* pNonConst=const_cast<AliESDEvent*>(this); | |
1951 | return pNonConst->FindListObject("HLTGlobalTrigger"); | |
1952 | } | |
1953 | ||
1954 | TString AliESDEvent::GetHLTTriggerDescription() const | |
1955 | { | |
1956 | // get the HLT trigger decission description | |
1957 | TString description; | |
1958 | TObject* pDecision=GetHLTTriggerDecision(); | |
1959 | if (pDecision) { | |
1960 | description=pDecision->GetTitle(); | |
1961 | } | |
1962 | ||
1963 | return description; | |
1964 | } | |
1965 | ||
1966 | Bool_t AliESDEvent::IsHLTTriggerFired(const char* name) const | |
1967 | { | |
1968 | // get the HLT trigger decission description | |
1969 | TObject* pDecision=GetHLTTriggerDecision(); | |
1970 | if (!pDecision) return kFALSE; | |
1971 | ||
1972 | Option_t* option=pDecision->GetOption(); | |
1973 | if (option==NULL || *option!='1') return kFALSE; | |
1974 | ||
1975 | if (name) { | |
1976 | TString description=GetHLTTriggerDescription(); | |
1977 | Int_t index=description.Index(name); | |
1978 | if (index<0) return kFALSE; | |
1979 | index+=strlen(name); | |
1980 | if (index>=description.Length()) return kFALSE; | |
1981 | if (description[index]!=0 && description[index]!=' ') return kFALSE; | |
1982 | } | |
1983 | return kTRUE; | |
1984 | } | |
af885e0f | 1985 | |
a98c78e5 | 1986 | //______________________________________________________________________________ |
1987 | Bool_t AliESDEvent::IsPileupFromSPD(Int_t minContributors, | |
1988 | Double_t minZdist, | |
1989 | Double_t nSigmaZdist, | |
1990 | Double_t nSigmaDiamXY, | |
1991 | Double_t nSigmaDiamZ) const{ | |
e741cb7c | 1992 | // |
1993 | // This function checks if there was a pile up | |
1994 | // reconstructed with SPD | |
1995 | // | |
e741cb7c | 1996 | Int_t nc1=fSPDVertex->GetNContributors(); |
1997 | if(nc1<1) return kFALSE; | |
1998 | Int_t nPileVert=GetNumberOfPileupVerticesSPD(); | |
1999 | if(nPileVert==0) return kFALSE; | |
a98c78e5 | 2000 | |
e741cb7c | 2001 | for(Int_t i=0; i<nPileVert;i++){ |
2002 | const AliESDVertex* pv=GetPileupVertexSPD(i); | |
e741cb7c | 2003 | Int_t nc2=pv->GetNContributors(); |
a98c78e5 | 2004 | if(nc2>=minContributors){ |
2005 | Double_t z1=fSPDVertex->GetZ(); | |
2006 | Double_t z2=pv->GetZ(); | |
2007 | Double_t distZ=TMath::Abs(z2-z1); | |
2008 | Double_t distZdiam=TMath::Abs(z2-GetDiamondZ()); | |
569d954c | 2009 | Double_t cutZdiam=nSigmaDiamZ*TMath::Sqrt(GetSigma2DiamondZ()); |
a98c78e5 | 2010 | if(GetSigma2DiamondZ()<0.0001)cutZdiam=99999.; //protection for missing z diamond information |
2011 | if(distZ>minZdist && distZdiam<cutZdiam){ | |
2012 | Double_t x2=pv->GetX(); | |
2013 | Double_t y2=pv->GetY(); | |
2014 | Double_t distXdiam=TMath::Abs(x2-GetDiamondX()); | |
2015 | Double_t distYdiam=TMath::Abs(y2-GetDiamondY()); | |
2016 | Double_t cov1[6],cov2[6]; | |
2017 | fSPDVertex->GetCovarianceMatrix(cov1); | |
2018 | pv->GetCovarianceMatrix(cov2); | |
2019 | Double_t errxDist=TMath::Sqrt(cov2[0]+GetSigma2DiamondX()); | |
2020 | Double_t erryDist=TMath::Sqrt(cov2[2]+GetSigma2DiamondY()); | |
2021 | Double_t errzDist=TMath::Sqrt(cov1[5]+cov2[5]); | |
2022 | Double_t cutXdiam=nSigmaDiamXY*errxDist; | |
2023 | if(GetSigma2DiamondX()<0.0001)cutXdiam=99999.; //protection for missing diamond information | |
2024 | Double_t cutYdiam=nSigmaDiamXY*erryDist; | |
2025 | if(GetSigma2DiamondY()<0.0001)cutYdiam=99999.; //protection for missing diamond information | |
2026 | if( (distXdiam<cutXdiam) && (distYdiam<cutYdiam) && (distZ>nSigmaZdist*errzDist) ){ | |
2027 | return kTRUE; | |
2028 | } | |
2029 | } | |
e741cb7c | 2030 | } |
e741cb7c | 2031 | } |
a98c78e5 | 2032 | return kFALSE; |
2033 | } | |
e741cb7c | 2034 | |
4ace6760 | 2035 | //______________________________________________________________________________ |
2036 | void AliESDEvent::EstimateMultiplicity(Int_t &tracklets, Int_t &trITSTPC, Int_t &trITSSApure, Double_t eta, Bool_t useDCAFlag,Bool_t useV0Flag) const | |
2037 | { | |
2038 | // | |
2039 | // calculates 3 estimators for the multiplicity in the -eta:eta range | |
2040 | // tracklets : using SPD tracklets only | |
2041 | // trITSTPC : using TPC/ITS + complementary ITS SA tracks + tracklets from clusters not used by tracks | |
2042 | // trITSSApure : using ITS standalone tracks + tracklets from clusters not used by tracks | |
2043 | // if useDCAFlag is true: account for the ESDtrack flag marking the tracks with large DCA | |
2044 | // if useV0Flag is true: account for the ESDtrack flag marking conversion and K0's V0s | |
70e79f33 | 2045 | |
2046 | AliWarning("This obsolete method will be eliminated soon. Use AliESDtrackCuts::GetReferenceMultiplicity"); | |
2047 | ||
4ace6760 | 2048 | tracklets = trITSSApure = trITSTPC = 0; |
2049 | int ntr = fSPDMult ? fSPDMult->GetNumberOfTracklets() : 0; | |
2050 | // | |
2051 | // count tracklets | |
2052 | for (int itr=ntr;itr--;) { | |
2053 | if (TMath::Abs(fSPDMult->GetEta(itr))>eta) continue; | |
2054 | tracklets++; | |
2055 | if (fSPDMult->FreeClustersTracklet(itr,0)) trITSTPC++; // not used in ITS/TPC or ITS_SA track | |
2056 | if (fSPDMult->FreeClustersTracklet(itr,1)) trITSSApure++; // not used in ITS_SA_Pure track | |
2057 | } | |
2058 | // | |
2059 | // count real tracks | |
2060 | ntr = GetNumberOfTracks(); | |
2061 | for (int itr=ntr;itr--;) { | |
2062 | AliESDtrack *t = GetTrack(itr); | |
a6c3743e | 2063 | if (!t) {AliFatal(Form("NULL pointer for ESD track %d",itr));} |
4ace6760 | 2064 | if (TMath::Abs(t->Eta())>eta) continue; |
2065 | if (!t->IsOn(AliESDtrack::kITSin)) continue; | |
2066 | if (useDCAFlag && t->IsOn(AliESDtrack::kMultSec)) continue; | |
2067 | if (useV0Flag && t->IsOn(AliESDtrack::kMultInV0)) continue; | |
2068 | if (t->IsOn(AliESDtrack::kITSpureSA)) trITSSApure++; | |
2069 | else trITSTPC++; | |
2070 | } | |
2071 | // | |
2072 | } | |
b46ff4b0 | 2073 | |
2074 | Bool_t AliESDEvent::IsPileupFromSPDInMultBins() const { | |
2075 | Int_t nTracklets=GetMultiplicity()->GetNumberOfTracklets(); | |
2076 | if(nTracklets<20) return IsPileupFromSPD(3,0.8); | |
2077 | else if(nTracklets<50) return IsPileupFromSPD(4,0.8); | |
2078 | else return IsPileupFromSPD(5,0.8); | |
2079 | } | |
2080 | ||
f858b00e | 2081 | void AliESDEvent::SetTOFHeader(const AliTOFHeader *header) |
2082 | { | |
2083 | // | |
2084 | // Set the TOF event_time | |
2085 | // | |
2086 | ||
2087 | if (fTOFHeader) { | |
2088 | *fTOFHeader=*header; | |
2089 | //fTOFHeader->SetName(fgkESDListName[kTOFHeader]); | |
2090 | } | |
2091 | else { | |
2092 | // for analysis of reconstructed events | |
2093 | // when this information is not avaliable | |
2094 | fTOFHeader = new AliTOFHeader(*header); | |
2095 | //AddObject(fTOFHeader); | |
2096 | } | |
2097 | ||
2098 | } | |
cb62947d | 2099 | |
fba4b2e2 | 2100 | AliCentrality* AliESDEvent::GetCentrality() |
cb62947d | 2101 | { |
fba4b2e2 | 2102 | if (!fCentrality) fCentrality = new AliCentrality(); |
cb62947d | 2103 | return fCentrality; |
2104 | } | |
ce7adfe9 | 2105 | |
2106 | AliEventplane* AliESDEvent::GetEventplane() | |
2107 | { | |
2108 | if (!fEventplane) fEventplane = new AliEventplane(); | |
2109 | return fEventplane; | |
2110 | } | |
1dc767cf | 2111 | |
2112 | Float_t AliESDEvent::GetVZEROEqMultiplicity(Int_t i) const | |
2113 | { | |
2114 | // Get VZERO Multiplicity for channel i | |
2115 | // Themethod uses the equalization factors | |
2116 | // stored in the ESD-run object in order to | |
2117 | // get equal multiplicities within a VZERO rins (1/8 of VZERO) | |
2118 | if (!fESDVZERO || !fESDRun) return -1; | |
2119 | ||
2120 | Int_t ring = i/8; | |
2121 | Float_t factorSum = 0; | |
2122 | for(Int_t j = 8*ring; j < (8*ring+8); ++j) { | |
2123 | factorSum += fESDRun->GetVZEROEqFactors(j); | |
2124 | } | |
2125 | Float_t factor = fESDRun->GetVZEROEqFactors(i)*8./factorSum; | |
2126 | ||
2127 | return (fESDVZERO->GetMultiplicity(i)/factor); | |
2128 | } |