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