]>
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 | { | |
1491 | // create missing standard objects and add them to the TList of objects | |
1492 | ||
1493 | // add new MUON containers if missing (for backward compatibility) | |
1494 | if (!fESDObjects->FindObject(fgkESDListName[kMuonClusters])) { | |
1495 | TClonesArray* muonClusters = new TClonesArray("AliESDMuonCluster",0); | |
1496 | muonClusters->SetName(fgkESDListName[kMuonClusters]); | |
1497 | fESDObjects->AddAt(muonClusters, kMuonClusters); | |
1498 | fESDObjects->SetOwner(kTRUE); | |
1499 | } | |
1500 | if (!fESDObjects->FindObject(fgkESDListName[kMuonPads])) { | |
1501 | TClonesArray* muonPads = new TClonesArray("AliESDMuonPad",0); | |
1502 | muonPads->SetName(fgkESDListName[kMuonPads]); | |
1503 | fESDObjects->AddAt(muonPads, kMuonPads); | |
1504 | fESDObjects->SetOwner(kTRUE); | |
1505 | } | |
1506 | } | |
1507 | ||
2811495d | 1508 | TObject* AliESDEvent::FindListObject(const char *name) const { |
7d44c466 | 1509 | // |
1510 | // Find object with name "name" in the list of branches | |
1511 | // | |
d7749dec | 1512 | if(fESDObjects){ |
1513 | return fESDObjects->FindObject(name); | |
1514 | } | |
001b9beb | 1515 | return 0; |
1516 | } | |
1517 | ||
cd1d4ee0 | 1518 | Int_t AliESDEvent::GetPHOSClusters(TRefArray *clusters) const |
1519 | { | |
1520 | // fills the provided TRefArray with all found phos clusters | |
e649177a | 1521 | |
cd1d4ee0 | 1522 | clusters->Clear(); |
e649177a | 1523 | |
cd1d4ee0 | 1524 | AliESDCaloCluster *cl = 0; |
1525 | for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) { | |
e649177a | 1526 | |
1527 | if ( (cl = GetCaloCluster(i)) ) { | |
cd1d4ee0 | 1528 | if (cl->IsPHOS()){ |
1529 | clusters->Add(cl); | |
e649177a | 1530 | AliDebug(1,Form("IsPHOS cluster %d Size: %d \n",i,clusters->GetEntriesFast())); |
cd1d4ee0 | 1531 | } |
1532 | } | |
1533 | } | |
1534 | return clusters->GetEntriesFast(); | |
1535 | } | |
1536 | ||
1537 | Int_t AliESDEvent::GetEMCALClusters(TRefArray *clusters) const | |
1538 | { | |
e649177a | 1539 | // fills the provided TRefArray with all found emcal clusters |
cd1d4ee0 | 1540 | |
1541 | clusters->Clear(); | |
1542 | ||
1543 | AliESDCaloCluster *cl = 0; | |
1544 | for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) { | |
1545 | ||
e649177a | 1546 | if ( (cl = GetCaloCluster(i)) ) { |
cd1d4ee0 | 1547 | if (cl->IsEMCAL()){ |
1548 | clusters->Add(cl); | |
e649177a | 1549 | AliDebug(1,Form("IsEMCAL cluster %d Size: %d \n",i,clusters->GetEntriesFast())); |
cd1d4ee0 | 1550 | } |
1551 | } | |
1552 | } | |
1553 | return clusters->GetEntriesFast(); | |
1554 | } | |
1555 | ||
f12d42ce | 1556 | void AliESDEvent::WriteToTree(TTree* tree) const { |
38f940fb | 1557 | // Book the branches as in TTree::Branch(TCollection*) |
1558 | // but add a "." at the end of top level branches which are | |
1559 | // not a TClonesArray | |
1560 | ||
1561 | ||
1562 | TString branchname; | |
1563 | TIter next(fESDObjects); | |
7d44c466 | 1564 | const Int_t kSplitlevel = 99; // default value in TTree::Branch() |
ddfbc51a | 1565 | const Int_t kBufsize = 32000; // default value in TTree::Branch() |
38f940fb | 1566 | TObject *obj = 0; |
1567 | ||
1568 | while ((obj = next())) { | |
1569 | branchname.Form("%s", obj->GetName()); | |
32ba9c61 | 1570 | if(branchname.CompareTo("AliESDfriend")==0)branchname = "ESDfriend."; |
7d44c466 | 1571 | if ((kSplitlevel > 1) && !obj->InheritsFrom(TClonesArray::Class())) { |
732a24fe | 1572 | if(!branchname.EndsWith("."))branchname += "."; |
38f940fb | 1573 | } |
102c56c8 | 1574 | if (!tree->FindBranch(branchname)) { |
771c4f86 | 1575 | // For the custom streamer to be called splitlevel |
1576 | // has to be negative, only needed for HLT | |
1577 | Int_t splitLevel = (TString(obj->ClassName()) == "AliHLTGlobalTriggerDecision") ? -1 : kSplitlevel - 1; | |
1578 | tree->Bronch(branchname, obj->ClassName(), fESDObjects->GetObjectRef(obj),kBufsize, splitLevel); | |
102c56c8 | 1579 | } |
38f940fb | 1580 | } |
38f940fb | 1581 | } |
1582 | ||
cd1d4ee0 | 1583 | |
f7ec3414 | 1584 | void AliESDEvent::ReadFromTree(TTree *tree, Option_t* opt){ |
7d44c466 | 1585 | // |
1586 | // Connect the ESDEvent to a tree | |
1587 | // | |
6989bff3 | 1588 | if(!tree){ |
90e88950 | 1589 | AliWarning("AliESDEvent::ReadFromTree() Zero Pointer to Tree \n"); |
6989bff3 | 1590 | return; |
1591 | } | |
024c7734 | 1592 | // load the TTree |
6989bff3 | 1593 | if(!tree->GetTree())tree->LoadTree(0); |
024c7734 | 1594 | |
001b9beb | 1595 | // if we find the "ESD" branch on the tree we do have the old structure |
1bd10080 | 1596 | if(tree->GetBranch("ESD")) { |
fe0324de | 1597 | fOldMuonStructure = kFALSE; |
1bd10080 | 1598 | char ** address = (char **)(tree->GetBranch("ESD")->GetAddress()); |
0eb6eb59 | 1599 | // do we have the friend branch |
1600 | TBranch * esdFB = tree->GetBranch("ESDfriend."); | |
1601 | char ** addressF = 0; | |
1602 | if(esdFB)addressF = (char **)(esdFB->GetAddress()); | |
6989bff3 | 1603 | if (!address) { |
90e88950 | 1604 | AliInfo("AliESDEvent::ReadFromTree() Reading old Tree"); |
1bd10080 | 1605 | tree->SetBranchAddress("ESD", &fESDOld); |
0eb6eb59 | 1606 | if(esdFB){ |
1607 | tree->SetBranchAddress("ESDfriend.",&fESDFriendOld); | |
1608 | } | |
6989bff3 | 1609 | } else { |
90e88950 | 1610 | AliInfo("AliESDEvent::ReadFromTree() Reading old Tree"); |
1611 | AliInfo("Branch already connected. Using existing branch address."); | |
1bd10080 | 1612 | fESDOld = (AliESD*) (*address); |
0eb6eb59 | 1613 | // addressF can still be 0, since branch needs to switched on |
1614 | if(addressF)fESDFriendOld = (AliESDfriend*) (*addressF); | |
6989bff3 | 1615 | } |
0eb6eb59 | 1616 | |
6989bff3 | 1617 | // have already connected the old ESD structure... ? |
1618 | // reuse also the pointer of the AlliESDEvent | |
1619 | // otherwise create new ones | |
6989bff3 | 1620 | TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree")); |
1621 | ||
1622 | if(connectedList){ | |
1623 | // If connected use the connected list of objects | |
0eb6eb59 | 1624 | if(fESDObjects!= connectedList){ |
1625 | // protect when called twice | |
1626 | fESDObjects->Delete(); | |
1627 | fESDObjects = connectedList; | |
1628 | } | |
6989bff3 | 1629 | GetStdContent(); |
0eb6eb59 | 1630 | |
0eb6eb59 | 1631 | |
d7749dec | 1632 | // The pointer to the friend changes when called twice via InitIO |
1633 | // since AliESDEvent is deleted | |
0eb6eb59 | 1634 | TObject* oldf = FindListObject("AliESDfriend"); |
1635 | TObject* newf = 0; | |
1636 | if(addressF){ | |
1637 | newf = (TObject*)*addressF; | |
1638 | } | |
1639 | if(newf!=0&&oldf!=newf){ | |
1640 | // remove the old reference | |
1641 | // Should we also delete it? Or is this handled in TTree I/O | |
1642 | // since it is created by the first SetBranchAddress | |
1643 | fESDObjects->Remove(oldf); | |
1644 | // add the new one | |
1645 | fESDObjects->Add(newf); | |
1646 | } | |
1647 | ||
6989bff3 | 1648 | fConnected = true; |
b93c2026 | 1649 | return; |
6989bff3 | 1650 | } |
1651 | // else... | |
1652 | CreateStdContent(); // create for copy | |
0eb6eb59 | 1653 | // if we have the esdfriend add it, so we always can access it via the userinfo |
1654 | if(fESDFriendOld)AddObject(fESDFriendOld); | |
6989bff3 | 1655 | // we are not owner of the list objects |
1656 | // must not delete it | |
efea3f54 | 1657 | fESDObjects->SetOwner(kTRUE); |
6989bff3 | 1658 | fESDObjects->SetName("ESDObjectsConnectedToTree"); |
1659 | tree->GetUserInfo()->Add(fESDObjects); | |
1660 | fConnected = true; | |
1661 | return; | |
af885e0f | 1662 | } |
0eb6eb59 | 1663 | |
732a24fe | 1664 | |
1665 | delete fESDOld; | |
1666 | fESDOld = 0; | |
af885e0f | 1667 | // Try to find AliESDEvent |
1668 | AliESDEvent *esdEvent = 0; | |
1669 | esdEvent = (AliESDEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliESDEvent"); | |
001b9beb | 1670 | if(esdEvent){ |
941603c0 | 1671 | // Check if already connected to tree |
efea3f54 | 1672 | esdEvent->Reset(); |
139f2194 | 1673 | TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("ESDObjectsConnectedToTree")); |
f7ec3414 | 1674 | |
1675 | ||
1676 | if (connectedList && (strcmp(opt, "reconnect"))) { | |
139f2194 | 1677 | // If connected use the connected list if objects |
1678 | fESDObjects->Delete(); | |
b5bc83df | 1679 | fESDObjects = connectedList; |
1680 | GetStdContent(); | |
fe0324de | 1681 | fOldMuonStructure = fESDObjects->TestBit(BIT(23)); |
60e8f114 | 1682 | fConnected = true; |
139f2194 | 1683 | return; |
1684 | } | |
732a24fe | 1685 | |
139f2194 | 1686 | // Connect to tree |
001b9beb | 1687 | // prevent a memory leak when reading back the TList |
28a79204 | 1688 | // if (!(strcmp(opt, "reconnect"))) fESDObjects->Delete(); |
f7ec3414 | 1689 | |
a2fbb067 | 1690 | if(!fUseOwnList){ |
a2fbb067 | 1691 | // create a new TList from the UserInfo TList... |
1692 | // copy constructor does not work... | |
1693 | fESDObjects = (TList*)(esdEvent->GetList()->Clone()); | |
efea3f54 | 1694 | fESDObjects->SetOwner(kTRUE); |
a2fbb067 | 1695 | } |
1696 | else if ( fESDObjects->GetEntries()==0){ | |
1697 | // at least create the std content if we want to read to our list | |
1698 | CreateStdContent(); | |
1699 | } | |
732a24fe | 1700 | |
1701 | // in principle | |
1702 | // we only need new things in the list if we do no already have it.. | |
1703 | // TODO just add new entries | |
fe0324de | 1704 | CompleteStdContent(); |
732a24fe | 1705 | |
af885e0f | 1706 | if(fESDObjects->GetEntries()<kESDListN){ |
90e88950 | 1707 | AliWarning(Form("AliESDEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n", |
1708 | fESDObjects->GetEntries(),kESDListN)); | |
af885e0f | 1709 | } |
1710 | // set the branch addresses | |
fe0324de | 1711 | fOldMuonStructure = kFALSE; |
af885e0f | 1712 | TIter next(fESDObjects); |
1713 | TNamed *el; | |
1714 | while((el=(TNamed*)next())){ | |
1715 | TString bname(el->GetName()); | |
af885e0f | 1716 | if(bname.CompareTo("AliESDfriend")==0) |
1717 | { | |
1718 | // AliESDfriend does not have a name ... | |
4453d900 | 1719 | TBranch *br = tree->GetBranch("ESDfriend."); |
588195ca | 1720 | if (br) tree->SetBranchAddress("ESDfriend.",fESDObjects->GetObjectRef(el)); |
af885e0f | 1721 | } |
1722 | else{ | |
38f940fb | 1723 | // check if branch exists under this Name |
1724 | TBranch *br = tree->GetBranch(bname.Data()); | |
1725 | if(br){ | |
1726 | tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el)); | |
1727 | } | |
1728 | else{ | |
1729 | br = tree->GetBranch(Form("%s.",bname.Data())); | |
1730 | if(br){ | |
1731 | tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el)); | |
1732 | } | |
1733 | else{ | |
90e88950 | 1734 | AliWarning(Form("AliESDEvent::ReadFromTree() No Branch found with Name %s or %s.",bname.Data(),bname.Data())); |
fe0324de | 1735 | if (bname == fgkESDListName[kMuonClusters]) { |
1736 | fOldMuonStructure = kTRUE; | |
1737 | } | |
38f940fb | 1738 | } |
1739 | ||
1740 | } | |
af885e0f | 1741 | } |
1742 | } | |
1743 | GetStdContent(); | |
1744 | // when reading back we are not owner of the list | |
1745 | // must not delete it | |
efea3f54 | 1746 | fESDObjects->SetOwner(kTRUE); |
60e8f114 | 1747 | fESDObjects->SetName("ESDObjectsConnectedToTree"); |
fe0324de | 1748 | fESDObjects->SetBit(BIT(23), fOldMuonStructure); |
139f2194 | 1749 | // we are not owner of the list objects |
1750 | // must not delete it | |
60e8f114 | 1751 | tree->GetUserInfo()->Add(fESDObjects); |
efea3f54 | 1752 | tree->GetUserInfo()->SetOwner(kFALSE); |
60e8f114 | 1753 | fConnected = true; |
efea3f54 | 1754 | }// no esdEvent --> |
af885e0f | 1755 | else { |
001b9beb | 1756 | // we can't get the list from the user data, create standard content |
1757 | // and set it by hand (no ESDfriend at the moment | |
af885e0f | 1758 | CreateStdContent(); |
fe0324de | 1759 | fOldMuonStructure = kFALSE; |
af885e0f | 1760 | TIter next(fESDObjects); |
1761 | TNamed *el; | |
1762 | while((el=(TNamed*)next())){ | |
1763 | TString bname(el->GetName()); | |
732a24fe | 1764 | TBranch *br = tree->GetBranch(bname.Data()); |
1765 | if(br){ | |
1766 | tree->SetBranchAddress(bname.Data(),fESDObjects->GetObjectRef(el)); | |
1767 | } | |
1768 | else{ | |
1769 | br = tree->GetBranch(Form("%s.",bname.Data())); | |
1770 | if(br){ | |
1771 | tree->SetBranchAddress(Form("%s.",bname.Data()),fESDObjects->GetObjectRef(el)); | |
1772 | } | |
fe0324de | 1773 | else if (bname == fgkESDListName[kMuonClusters]) { |
1774 | fOldMuonStructure = kTRUE; | |
1775 | } | |
732a24fe | 1776 | } |
af885e0f | 1777 | } |
1778 | GetStdContent(); | |
1779 | // when reading back we are not owner of the list | |
1780 | // must not delete it | |
316cf4cc | 1781 | fESDObjects->SetOwner(kTRUE); |
af885e0f | 1782 | } |
af885e0f | 1783 | } |
1784 | ||
1785 | ||
1786 | void AliESDEvent::CopyFromOldESD() | |
1787 | { | |
1788 | // Method which copies over everthing from the old esd structure to the | |
1789 | // new | |
af885e0f | 1790 | if(fESDOld){ |
1791 | ResetStdContent(); | |
1792 | // Run | |
1793 | SetRunNumber(fESDOld->GetRunNumber()); | |
1794 | SetPeriodNumber(fESDOld->GetPeriodNumber()); | |
6ca8842a | 1795 | SetMagneticField(fESDOld->GetMagneticField()); |
af885e0f | 1796 | |
1797 | // leave out diamond ... | |
1798 | // SetDiamond(const AliESDVertex *vertex) { fESDRun->SetDiamond(vertex);} | |
1799 | ||
1800 | // header | |
1801 | SetTriggerMask(fESDOld->GetTriggerMask()); | |
1802 | SetOrbitNumber(fESDOld->GetOrbitNumber()); | |
1803 | SetTimeStamp(fESDOld->GetTimeStamp()); | |
1804 | SetEventType(fESDOld->GetEventType()); | |
1805 | SetEventNumberInFile(fESDOld->GetEventNumberInFile()); | |
1806 | SetBunchCrossNumber(fESDOld->GetBunchCrossNumber()); | |
1807 | SetTriggerCluster(fESDOld->GetTriggerCluster()); | |
1808 | ||
1809 | // ZDC | |
1810 | ||
1811 | SetZDC(fESDOld->GetZDCN1Energy(), | |
a85132e7 | 1812 | fESDOld->GetZDCP1Energy(), |
1813 | fESDOld->GetZDCEMEnergy(), | |
1814 | 0, | |
1815 | fESDOld->GetZDCN2Energy(), | |
1816 | fESDOld->GetZDCP2Energy(), | |
2b6cdc43 | 1817 | fESDOld->GetZDCParticipants(), |
5f0ec064 | 1818 | 0, |
1819 | 0, | |
1820 | 0, | |
1821 | 0, | |
1822 | 0, | |
2b6cdc43 | 1823 | 0); |
af885e0f | 1824 | |
1825 | // FMD | |
1826 | ||
cb6aa27f | 1827 | if(fESDOld->GetFMDData())SetFMDData(fESDOld->GetFMDData()); |
af885e0f | 1828 | |
1829 | // T0 | |
1830 | ||
1831 | SetT0zVertex(fESDOld->GetT0zVertex()); | |
1832 | SetT0(fESDOld->GetT0()); | |
1833 | // leave amps out | |
1834 | ||
1835 | // VZERO | |
c06eaba2 | 1836 | if (fESDOld->GetVZEROData()) SetVZEROData(fESDOld->GetVZEROData()); |
af885e0f | 1837 | |
06cc9d95 | 1838 | if(fESDOld->GetVertex())SetPrimaryVertexSPD(fESDOld->GetVertex()); |
af885e0f | 1839 | |
c264b61b | 1840 | if(fESDOld->GetPrimaryVertex())SetPrimaryVertexTracks(fESDOld->GetPrimaryVertex()); |
af885e0f | 1841 | |
cb6aa27f | 1842 | if(fESDOld->GetMultiplicity())SetMultiplicity(fESDOld->GetMultiplicity()); |
1bd10080 | 1843 | |
af885e0f | 1844 | for(int i = 0;i<fESDOld->GetNumberOfTracks();i++){ |
1845 | AddTrack(fESDOld->GetTrack(i)); | |
1846 | } | |
1847 | ||
1848 | for(int i = 0;i<fESDOld->GetNumberOfMuonTracks();i++){ | |
1849 | AddMuonTrack(fESDOld->GetMuonTrack(i)); | |
1850 | } | |
1851 | ||
1852 | for(int i = 0;i<fESDOld->GetNumberOfPmdTracks();i++){ | |
1853 | AddPmdTrack(fESDOld->GetPmdTrack(i)); | |
1854 | } | |
1855 | ||
1856 | for(int i = 0;i<fESDOld->GetNumberOfTrdTracks();i++){ | |
1857 | AddTrdTrack(fESDOld->GetTrdTrack(i)); | |
1858 | } | |
1859 | ||
1860 | for(int i = 0;i<fESDOld->GetNumberOfV0s();i++){ | |
1861 | AddV0(fESDOld->GetV0(i)); | |
1862 | } | |
1863 | ||
1864 | for(int i = 0;i<fESDOld->GetNumberOfCascades();i++){ | |
1865 | AddCascade(fESDOld->GetCascade(i)); | |
1866 | } | |
1867 | ||
1868 | for(int i = 0;i<fESDOld->GetNumberOfKinks();i++){ | |
1869 | AddKink(fESDOld->GetKink(i)); | |
1870 | } | |
1871 | ||
1872 | ||
1873 | for(int i = 0;i<fESDOld->GetNumberOfCaloClusters();i++){ | |
1874 | AddCaloCluster(fESDOld->GetCaloCluster(i)); | |
1875 | } | |
820b4d9e | 1876 | |
1877 | #ifdef MFT_UPGRADE | |
1878 | // MFT | |
1879 | // if (fESDOld->GetMFTData()) SetMFTData(fESDOld->GetMFTData()); | |
1880 | #endif | |
1bd10080 | 1881 | |
af885e0f | 1882 | }// if fesdold |
1883 | } | |
1884 | ||
2a3dfb14 | 1885 | Bool_t AliESDEvent::IsEventSelected(const char *trigExpr) const |
1886 | { | |
1887 | // Check if the event satisfies the trigger | |
1888 | // selection expression trigExpr. | |
1889 | // trigExpr can be any logical expression | |
1890 | // of the trigger classes defined in AliESDRun | |
1891 | // In case of wrong syntax return kTRUE. | |
1892 | ||
1893 | TString expr(trigExpr); | |
1894 | if (expr.IsNull()) return kTRUE; | |
1895 | ||
1896 | ULong64_t mask = GetTriggerMask(); | |
1897 | for(Int_t itrig = 0; itrig < AliESDRun::kNTriggerClasses; itrig++) { | |
1898 | if (mask & (1ull << itrig)) { | |
1899 | expr.ReplaceAll(GetESDRun()->GetTriggerClass(itrig),"1"); | |
1900 | } | |
1901 | else { | |
1902 | expr.ReplaceAll(GetESDRun()->GetTriggerClass(itrig),"0"); | |
1903 | } | |
1904 | } | |
1905 | ||
1906 | Int_t error; | |
1907 | if ((gROOT->ProcessLineFast(expr.Data(),&error) == 0) && | |
1908 | (error == TInterpreter::kNoError)) { | |
1909 | return kFALSE; | |
1910 | } | |
1911 | ||
1912 | return kTRUE; | |
1913 | ||
1914 | } | |
1915 | ||
3b286f80 | 1916 | TObject* AliESDEvent::GetHLTTriggerDecision() const |
1917 | { | |
1918 | // get the HLT trigger decission object | |
1919 | ||
1920 | // cast away const'nes because the FindListObject method | |
1921 | // is not const | |
1922 | AliESDEvent* pNonConst=const_cast<AliESDEvent*>(this); | |
1923 | return pNonConst->FindListObject("HLTGlobalTrigger"); | |
1924 | } | |
1925 | ||
1926 | TString AliESDEvent::GetHLTTriggerDescription() const | |
1927 | { | |
1928 | // get the HLT trigger decission description | |
1929 | TString description; | |
1930 | TObject* pDecision=GetHLTTriggerDecision(); | |
1931 | if (pDecision) { | |
1932 | description=pDecision->GetTitle(); | |
1933 | } | |
1934 | ||
1935 | return description; | |
1936 | } | |
1937 | ||
1938 | Bool_t AliESDEvent::IsHLTTriggerFired(const char* name) const | |
1939 | { | |
1940 | // get the HLT trigger decission description | |
1941 | TObject* pDecision=GetHLTTriggerDecision(); | |
1942 | if (!pDecision) return kFALSE; | |
1943 | ||
1944 | Option_t* option=pDecision->GetOption(); | |
1945 | if (option==NULL || *option!='1') return kFALSE; | |
1946 | ||
1947 | if (name) { | |
1948 | TString description=GetHLTTriggerDescription(); | |
1949 | Int_t index=description.Index(name); | |
1950 | if (index<0) return kFALSE; | |
1951 | index+=strlen(name); | |
1952 | if (index>=description.Length()) return kFALSE; | |
1953 | if (description[index]!=0 && description[index]!=' ') return kFALSE; | |
1954 | } | |
1955 | return kTRUE; | |
1956 | } | |
af885e0f | 1957 | |
a98c78e5 | 1958 | //______________________________________________________________________________ |
1959 | Bool_t AliESDEvent::IsPileupFromSPD(Int_t minContributors, | |
1960 | Double_t minZdist, | |
1961 | Double_t nSigmaZdist, | |
1962 | Double_t nSigmaDiamXY, | |
1963 | Double_t nSigmaDiamZ) const{ | |
e741cb7c | 1964 | // |
1965 | // This function checks if there was a pile up | |
1966 | // reconstructed with SPD | |
1967 | // | |
e741cb7c | 1968 | Int_t nc1=fSPDVertex->GetNContributors(); |
1969 | if(nc1<1) return kFALSE; | |
1970 | Int_t nPileVert=GetNumberOfPileupVerticesSPD(); | |
1971 | if(nPileVert==0) return kFALSE; | |
a98c78e5 | 1972 | |
e741cb7c | 1973 | for(Int_t i=0; i<nPileVert;i++){ |
1974 | const AliESDVertex* pv=GetPileupVertexSPD(i); | |
e741cb7c | 1975 | Int_t nc2=pv->GetNContributors(); |
a98c78e5 | 1976 | if(nc2>=minContributors){ |
1977 | Double_t z1=fSPDVertex->GetZ(); | |
1978 | Double_t z2=pv->GetZ(); | |
1979 | Double_t distZ=TMath::Abs(z2-z1); | |
1980 | Double_t distZdiam=TMath::Abs(z2-GetDiamondZ()); | |
569d954c | 1981 | Double_t cutZdiam=nSigmaDiamZ*TMath::Sqrt(GetSigma2DiamondZ()); |
a98c78e5 | 1982 | if(GetSigma2DiamondZ()<0.0001)cutZdiam=99999.; //protection for missing z diamond information |
1983 | if(distZ>minZdist && distZdiam<cutZdiam){ | |
1984 | Double_t x2=pv->GetX(); | |
1985 | Double_t y2=pv->GetY(); | |
1986 | Double_t distXdiam=TMath::Abs(x2-GetDiamondX()); | |
1987 | Double_t distYdiam=TMath::Abs(y2-GetDiamondY()); | |
1988 | Double_t cov1[6],cov2[6]; | |
1989 | fSPDVertex->GetCovarianceMatrix(cov1); | |
1990 | pv->GetCovarianceMatrix(cov2); | |
1991 | Double_t errxDist=TMath::Sqrt(cov2[0]+GetSigma2DiamondX()); | |
1992 | Double_t erryDist=TMath::Sqrt(cov2[2]+GetSigma2DiamondY()); | |
1993 | Double_t errzDist=TMath::Sqrt(cov1[5]+cov2[5]); | |
1994 | Double_t cutXdiam=nSigmaDiamXY*errxDist; | |
1995 | if(GetSigma2DiamondX()<0.0001)cutXdiam=99999.; //protection for missing diamond information | |
1996 | Double_t cutYdiam=nSigmaDiamXY*erryDist; | |
1997 | if(GetSigma2DiamondY()<0.0001)cutYdiam=99999.; //protection for missing diamond information | |
1998 | if( (distXdiam<cutXdiam) && (distYdiam<cutYdiam) && (distZ>nSigmaZdist*errzDist) ){ | |
1999 | return kTRUE; | |
2000 | } | |
2001 | } | |
e741cb7c | 2002 | } |
e741cb7c | 2003 | } |
a98c78e5 | 2004 | return kFALSE; |
2005 | } | |
e741cb7c | 2006 | |
4ace6760 | 2007 | //______________________________________________________________________________ |
2008 | void AliESDEvent::EstimateMultiplicity(Int_t &tracklets, Int_t &trITSTPC, Int_t &trITSSApure, Double_t eta, Bool_t useDCAFlag,Bool_t useV0Flag) const | |
2009 | { | |
2010 | // | |
2011 | // calculates 3 estimators for the multiplicity in the -eta:eta range | |
2012 | // tracklets : using SPD tracklets only | |
2013 | // trITSTPC : using TPC/ITS + complementary ITS SA tracks + tracklets from clusters not used by tracks | |
2014 | // trITSSApure : using ITS standalone tracks + tracklets from clusters not used by tracks | |
2015 | // if useDCAFlag is true: account for the ESDtrack flag marking the tracks with large DCA | |
2016 | // if useV0Flag is true: account for the ESDtrack flag marking conversion and K0's V0s | |
70e79f33 | 2017 | |
2018 | AliWarning("This obsolete method will be eliminated soon. Use AliESDtrackCuts::GetReferenceMultiplicity"); | |
2019 | ||
4ace6760 | 2020 | tracklets = trITSSApure = trITSTPC = 0; |
2021 | int ntr = fSPDMult ? fSPDMult->GetNumberOfTracklets() : 0; | |
2022 | // | |
2023 | // count tracklets | |
2024 | for (int itr=ntr;itr--;) { | |
2025 | if (TMath::Abs(fSPDMult->GetEta(itr))>eta) continue; | |
2026 | tracklets++; | |
2027 | if (fSPDMult->FreeClustersTracklet(itr,0)) trITSTPC++; // not used in ITS/TPC or ITS_SA track | |
2028 | if (fSPDMult->FreeClustersTracklet(itr,1)) trITSSApure++; // not used in ITS_SA_Pure track | |
2029 | } | |
2030 | // | |
2031 | // count real tracks | |
2032 | ntr = GetNumberOfTracks(); | |
2033 | for (int itr=ntr;itr--;) { | |
2034 | AliESDtrack *t = GetTrack(itr); | |
a6c3743e | 2035 | if (!t) {AliFatal(Form("NULL pointer for ESD track %d",itr));} |
4ace6760 | 2036 | if (TMath::Abs(t->Eta())>eta) continue; |
2037 | if (!t->IsOn(AliESDtrack::kITSin)) continue; | |
2038 | if (useDCAFlag && t->IsOn(AliESDtrack::kMultSec)) continue; | |
2039 | if (useV0Flag && t->IsOn(AliESDtrack::kMultInV0)) continue; | |
2040 | if (t->IsOn(AliESDtrack::kITSpureSA)) trITSSApure++; | |
2041 | else trITSTPC++; | |
2042 | } | |
2043 | // | |
2044 | } | |
b46ff4b0 | 2045 | |
2046 | Bool_t AliESDEvent::IsPileupFromSPDInMultBins() const { | |
2047 | Int_t nTracklets=GetMultiplicity()->GetNumberOfTracklets(); | |
2048 | if(nTracklets<20) return IsPileupFromSPD(3,0.8); | |
2049 | else if(nTracklets<50) return IsPileupFromSPD(4,0.8); | |
2050 | else return IsPileupFromSPD(5,0.8); | |
2051 | } | |
2052 | ||
f858b00e | 2053 | void AliESDEvent::SetTOFHeader(const AliTOFHeader *header) |
2054 | { | |
2055 | // | |
2056 | // Set the TOF event_time | |
2057 | // | |
2058 | ||
2059 | if (fTOFHeader) { | |
2060 | *fTOFHeader=*header; | |
2061 | //fTOFHeader->SetName(fgkESDListName[kTOFHeader]); | |
2062 | } | |
2063 | else { | |
2064 | // for analysis of reconstructed events | |
2065 | // when this information is not avaliable | |
2066 | fTOFHeader = new AliTOFHeader(*header); | |
2067 | //AddObject(fTOFHeader); | |
2068 | } | |
2069 | ||
2070 | } | |
cb62947d | 2071 | |
fba4b2e2 | 2072 | AliCentrality* AliESDEvent::GetCentrality() |
cb62947d | 2073 | { |
fba4b2e2 | 2074 | if (!fCentrality) fCentrality = new AliCentrality(); |
cb62947d | 2075 | return fCentrality; |
2076 | } | |
ce7adfe9 | 2077 | |
2078 | AliEventplane* AliESDEvent::GetEventplane() | |
2079 | { | |
2080 | if (!fEventplane) fEventplane = new AliEventplane(); | |
2081 | return fEventplane; | |
2082 | } | |
1dc767cf | 2083 | |
2084 | Float_t AliESDEvent::GetVZEROEqMultiplicity(Int_t i) const | |
2085 | { | |
2086 | // Get VZERO Multiplicity for channel i | |
2087 | // Themethod uses the equalization factors | |
2088 | // stored in the ESD-run object in order to | |
2089 | // get equal multiplicities within a VZERO rins (1/8 of VZERO) | |
2090 | if (!fESDVZERO || !fESDRun) return -1; | |
2091 | ||
2092 | Int_t ring = i/8; | |
2093 | Float_t factorSum = 0; | |
2094 | for(Int_t j = 8*ring; j < (8*ring+8); ++j) { | |
2095 | factorSum += fESDRun->GetVZEROEqFactors(j); | |
2096 | } | |
2097 | Float_t factor = fESDRun->GetVZEROEqFactors(i)*8./factorSum; | |
2098 | ||
2099 | return (fESDVZERO->GetMultiplicity(i)/factor); | |
2100 | } |