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