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