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