]>
Commit | Line | Data |
---|---|---|
df9db588 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | //------------------------------------------------------------------------- | |
19 | // AOD base class | |
20 | // Author: Markus Oldenburg, CERN | |
21 | //------------------------------------------------------------------------- | |
22 | ||
5c1dc41f | 23 | #include <TROOT.h> |
ec4af4c1 | 24 | #include <TTree.h> |
5c1dc41f | 25 | #include <TFolder.h> |
298d3d58 | 26 | #include <TFriendElement.h> |
c8e4f399 | 27 | #include <TProcessID.h> |
28 | #include <TCollection.h> | |
a0df0b6a | 29 | #include "Riostream.h" |
df9db588 | 30 | #include "AliAODEvent.h" |
31 | #include "AliAODHeader.h" | |
32 | #include "AliAODTrack.h" | |
866d8d78 | 33 | #include "AliAODDimuon.h" |
9aa7ebff | 34 | #include "AliAODTrdTrack.h" |
df9db588 | 35 | |
36 | ClassImp(AliAODEvent) | |
37 | ||
08e4c457 | 38 | // definition of std AOD member names |
39 | const char* AliAODEvent::fAODListName[kAODListN] = {"header", | |
40 | "tracks", | |
41 | "vertices", | |
3dd9f9e3 | 42 | "v0s", |
9a244178 | 43 | "cascades", |
3dd9f9e3 | 44 | "tracklets", |
08e4c457 | 45 | "jets", |
37792174 | 46 | "emcalCells", |
47 | "phosCells", | |
720f7306 | 48 | "caloClusters", |
49 | "emcalTrigger", | |
50 | "phosTrigger", | |
3dd9f9e3 | 51 | "fmdClusters", |
866d8d78 | 52 | "pmdClusters", |
08b38f3f | 53 | "hmpidRings", |
ae2bccf1 | 54 | "dimuons", |
a1f96974 | 55 | "AliAODTZERO", |
16d867eb | 56 | "AliAODVZERO", |
68919bd9 | 57 | "AliAODZDC", |
9aa7ebff | 58 | "AliTOFHeader", |
59 | "trdTracks" | |
38e7ce48 | 60 | |
3dd9f9e3 | 61 | }; |
df9db588 | 62 | //______________________________________________________________________________ |
63 | AliAODEvent::AliAODEvent() : | |
08e4c457 | 64 | AliVEvent(), |
9f5023ac | 65 | fAODObjects(0), |
5c1dc41f | 66 | fAODFolder(0), |
dd389a30 | 67 | fConnected(kFALSE), |
d38034b8 | 68 | fTracksConnected(kFALSE), |
ec4af4c1 | 69 | fHeader(0), |
70 | fTracks(0), | |
71 | fVertices(0), | |
3dd9f9e3 | 72 | fV0s(0), |
9a244178 | 73 | fCascades(0), |
3dd9f9e3 | 74 | fTracklets(0), |
821f8f1d | 75 | fJets(0), |
37792174 | 76 | fEmcalCells(0), |
77 | fPhosCells(0), | |
3dd9f9e3 | 78 | fCaloClusters(0), |
720f7306 | 79 | fEMCALTrigger(0), |
80 | fPHOSTrigger(0), | |
3dd9f9e3 | 81 | fFmdClusters(0), |
866d8d78 | 82 | fPmdClusters(0), |
08b38f3f | 83 | fHMPIDrings(0), |
ae2bccf1 | 84 | fDimuons(0), |
a1f96974 | 85 | fAODTZERO(0), |
16d867eb | 86 | fAODVZERO(0), |
68919bd9 | 87 | fAODZDC(0), |
9aa7ebff | 88 | fTOFHeader(0), |
89 | fTrdTracks(0) | |
df9db588 | 90 | { |
91 | // default constructor | |
0c050978 | 92 | if (TClass::IsCallingNew() != TClass::kDummyNew) fAODObjects = new TList(); |
df9db588 | 93 | } |
94 | ||
5c1dc41f | 95 | //______________________________________________________________________________ |
96 | AliAODEvent::AliAODEvent(const AliAODEvent& aod): | |
97 | AliVEvent(aod), | |
98 | fAODObjects(new TList()), | |
b752604b | 99 | fAODFolder(0), |
dd389a30 | 100 | fConnected(kFALSE), |
d38034b8 | 101 | fTracksConnected(kFALSE), |
f8faa5ab | 102 | // fHeader(new AliAODHeader(*aod.fHeader)), |
103 | fHeader(0), | |
5c1dc41f | 104 | fTracks(new TClonesArray(*aod.fTracks)), |
105 | fVertices(new TClonesArray(*aod.fVertices)), | |
106 | fV0s(new TClonesArray(*aod.fV0s)), | |
9a244178 | 107 | fCascades(new TClonesArray(*aod.fCascades)), |
5c1dc41f | 108 | fTracklets(new AliAODTracklets(*aod.fTracklets)), |
109 | fJets(new TClonesArray(*aod.fJets)), | |
110 | fEmcalCells(new AliAODCaloCells(*aod.fEmcalCells)), | |
111 | fPhosCells(new AliAODCaloCells(*aod.fPhosCells)), | |
112 | fCaloClusters(new TClonesArray(*aod.fCaloClusters)), | |
720f7306 | 113 | fEMCALTrigger(new AliAODCaloTrigger(*aod.fEMCALTrigger)), |
114 | fPHOSTrigger(new AliAODCaloTrigger(*aod.fPHOSTrigger)), | |
5c1dc41f | 115 | fFmdClusters(new TClonesArray(*aod.fFmdClusters)), |
866d8d78 | 116 | fPmdClusters(new TClonesArray(*aod.fPmdClusters)), |
08b38f3f | 117 | fHMPIDrings(new TClonesArray(*aod.fHMPIDrings)), |
ae2bccf1 | 118 | fDimuons(new TClonesArray(*aod.fDimuons)), |
a1f96974 | 119 | fAODTZERO(new AliAODTZERO(*aod.fAODTZERO)), |
16d867eb | 120 | fAODVZERO(new AliAODVZERO(*aod.fAODVZERO)), |
68919bd9 | 121 | fAODZDC(new AliAODZDC(*aod.fAODZDC)), |
9aa7ebff | 122 | fTOFHeader(new AliTOFHeader(*aod.fTOFHeader)), |
123 | fTrdTracks(new TClonesArray(*aod.fTrdTracks)) | |
5c1dc41f | 124 | { |
125 | // Copy constructor | |
f8faa5ab | 126 | AddHeader(fHeader); |
5c1dc41f | 127 | AddObject(fHeader); |
128 | AddObject(fTracks); | |
129 | AddObject(fVertices); | |
130 | AddObject(fV0s); | |
9a244178 | 131 | AddObject(fCascades); |
5c1dc41f | 132 | AddObject(fTracklets); |
133 | AddObject(fJets); | |
134 | AddObject(fEmcalCells); | |
135 | AddObject(fPhosCells); | |
136 | AddObject(fCaloClusters); | |
720f7306 | 137 | AddObject(fEMCALTrigger); |
138 | AddObject(fPHOSTrigger); | |
5c1dc41f | 139 | AddObject(fFmdClusters); |
140 | AddObject(fPmdClusters); | |
08b38f3f | 141 | AddObject(fHMPIDrings); |
866d8d78 | 142 | AddObject(fDimuons); |
a1f96974 | 143 | AddObject(fAODTZERO); |
ae2bccf1 | 144 | AddObject(fAODVZERO); |
16d867eb | 145 | AddObject(fAODZDC); |
68919bd9 | 146 | AddObject(fTOFHeader); |
9aa7ebff | 147 | AddObject(fTrdTracks); |
dd389a30 | 148 | fConnected = aod.fConnected; |
d38034b8 | 149 | ConnectTracks(); |
5c1dc41f | 150 | GetStdContent(); |
48f1c230 | 151 | CreateStdFolders(); |
5c1dc41f | 152 | } |
153 | ||
154 | //______________________________________________________________________________ | |
155 | AliAODEvent & AliAODEvent::operator=(const AliAODEvent& aod) { | |
156 | ||
157 | // Assignment operator | |
158 | ||
48f1c230 | 159 | if(&aod == this) return *this; |
160 | AliVEvent::operator=(aod); | |
5c1dc41f | 161 | |
48f1c230 | 162 | // This assumes that the list is already created |
163 | // and that the virtual void Copy(Tobject&) function | |
164 | // is correctly implemented in the derived class | |
165 | // otherwise only TObject::Copy() will be used | |
166 | ||
167 | if((fAODObjects->GetSize()==0)&&(aod.fAODObjects->GetSize()>=kAODListN)){ | |
168 | // We cover the case that we do not yet have the | |
169 | // standard content but the source has it | |
170 | CreateStdContent(); | |
171 | } | |
172 | ||
173 | // Here we have the standard content without user additions, but the content is | |
174 | // not matching the aod source. | |
175 | ||
176 | // Iterate the list of source objects | |
177 | TIter next(aod.GetList()); | |
178 | TObject *its = 0; | |
179 | TString name; | |
180 | while ((its = next())) { | |
181 | name = its->GetName(); | |
182 | // Check if we have this object type in out list | |
183 | TObject *mine = fAODObjects->FindObject(name); | |
184 | if(!mine) { | |
185 | // We have to create the same type of object. | |
186 | TClass* pClass=TClass::GetClass(its->ClassName()); | |
187 | if (!pClass) { | |
188 | AliWarning(Form("Can not find class description for entry %s (%s)\n", | |
189 | its->ClassName(), name.Data())); | |
190 | continue; | |
191 | } | |
192 | mine=(TObject*)pClass->New(); | |
193 | if(!mine){ | |
194 | // not in this: can be added to list | |
195 | AliWarning(Form("%s:%d Could not find %s for copying \n", | |
196 | (char*)__FILE__,__LINE__,name.Data())); | |
197 | continue; | |
198 | } | |
199 | if(mine->InheritsFrom("TNamed")) { | |
200 | ((TNamed*)mine)->SetName(name); | |
201 | } else if(mine->InheritsFrom("TCollection")){ | |
202 | if(mine->InheritsFrom("TClonesArray")) { | |
203 | TClonesArray *itscl = dynamic_cast<TClonesArray*>(its); | |
204 | if (!itscl) { | |
205 | AliWarning(Form("Class description for entry %s (%s) not TClonesArray\n", | |
206 | its->ClassName(), name.Data())); | |
207 | continue; | |
208 | ||
209 | } | |
210 | dynamic_cast<TClonesArray*>(mine)->SetClass(itscl->GetClass(), itscl->GetSize()); | |
211 | } | |
212 | dynamic_cast<TCollection*>(mine)->SetName(name); | |
213 | } | |
214 | AliDebug(1, Form("adding object %s of type %s", mine->GetName(), mine->ClassName())); | |
215 | AddObject(mine); | |
216 | } | |
217 | // Now we have an object of the same type and name, but different content. | |
218 | if(!its->InheritsFrom("TCollection")){ | |
219 | // simple objects (do they have a Copy method that calls operator= ?) | |
220 | its->Copy(*mine); | |
221 | } else if (its->InheritsFrom("TClonesArray")) { | |
222 | // Create or expand the tclonesarray pointers | |
223 | // so we can directly copy to the object | |
224 | TClonesArray *its_tca = (TClonesArray*)its; | |
225 | TClonesArray *mine_tca = (TClonesArray*)mine; | |
226 | // this leaves the capacity of the TClonesArray the same | |
227 | // except for a factor of 2 increase when size > capacity | |
228 | // does not release any memory occupied by the tca | |
229 | Int_t its_entries = its_tca->GetEntriesFast(); | |
230 | mine_tca->ExpandCreate(its_entries); | |
231 | for(int i=0; i<its_entries; i++){ | |
232 | // copy | |
233 | TObject *mine_tca_obj = mine_tca->At(i); | |
234 | TObject *its_tca_obj = its_tca->At(i); | |
235 | // no need to delete first | |
236 | // pointers within the class should be handled by Copy()... | |
237 | // Can there be Empty slots? | |
238 | its_tca_obj->Copy(*mine_tca_obj); | |
239 | } | |
240 | } else { | |
241 | AliWarning(Form("%s:%d cannot copy TCollection \n", | |
242 | (char*)__FILE__,__LINE__)); | |
243 | } | |
244 | } | |
245 | fConnected = aod.fConnected; | |
d38034b8 | 246 | fTracksConnected = kFALSE; |
247 | ConnectTracks(); | |
48f1c230 | 248 | return *this; |
5c1dc41f | 249 | } |
250 | ||
251 | ||
df9db588 | 252 | //______________________________________________________________________________ |
253 | AliAODEvent::~AliAODEvent() | |
254 | { | |
ec4af4c1 | 255 | // destructor |
fc65507e | 256 | delete fAODFolder; |
257 | fAODFolder = 0; | |
483ad248 | 258 | if(!fConnected) { |
d51e155a | 259 | // fAODObjects->Delete("slow"); |
483ad248 | 260 | delete fAODObjects; |
261 | } | |
df9db588 | 262 | } |
263 | ||
264 | //______________________________________________________________________________ | |
265 | void AliAODEvent::AddObject(TObject* obj) | |
266 | { | |
4b3de353 | 267 | // Add an object to the list of objects. |
df9db588 | 268 | // Please be aware that in order to increase performance you should |
269 | // refrain from using TObjArrays (if possible). Use TClonesArrays, instead. | |
270 | ||
d51e155a | 271 | // if ( !fAODObjects ) { |
272 | // fAODObjects = new TList(); | |
273 | // fAODObjects->SetOwner(); | |
274 | // } | |
14d6fad5 | 275 | if ( !fAODObjects->FindObject(obj) ) |
276 | { | |
277 | fAODObjects->AddLast(obj); | |
278 | } | |
df9db588 | 279 | } |
280 | ||
d38034b8 | 281 | //______________________________________________________________________________ |
282 | Int_t AliAODEvent::AddTrack(const AliAODTrack* trk) | |
283 | { | |
284 | // Add new AOD track. Make sure to set the event if needed. | |
285 | AliAODTrack *track = new((*fTracks)[fTracks->GetEntriesFast()]) AliAODTrack(*trk); | |
286 | track->SetAODEvent(this); | |
287 | return fTracks->GetEntriesFast()-1; | |
288 | } | |
289 | ||
4b3de353 | 290 | //______________________________________________________________________________ |
291 | void AliAODEvent::RemoveObject(TObject* obj) | |
292 | { | |
293 | // Removes an object from the list of objects. | |
294 | ||
295 | fAODObjects->Remove(obj); | |
296 | } | |
297 | ||
df9db588 | 298 | //______________________________________________________________________________ |
2811495d | 299 | TObject *AliAODEvent::FindListObject(const char *objName) const |
df9db588 | 300 | { |
301 | // Return the pointer to the object with the given name. | |
302 | ||
303 | return fAODObjects->FindObject(objName); | |
304 | } | |
305 | ||
306 | //______________________________________________________________________________ | |
307 | void AliAODEvent::CreateStdContent() | |
308 | { | |
309 | // create the standard AOD content and set pointers | |
310 | ||
311 | // create standard objects and add them to the TList of objects | |
312 | AddObject(new AliAODHeader()); | |
313 | AddObject(new TClonesArray("AliAODTrack", 0)); | |
314 | AddObject(new TClonesArray("AliAODVertex", 0)); | |
3dd9f9e3 | 315 | AddObject(new TClonesArray("AliAODv0", 0)); |
9a244178 | 316 | AddObject(new TClonesArray("AliAODcascade", 0)); |
821f8f1d | 317 | AddObject(new AliAODTracklets()); |
3dd9f9e3 | 318 | AddObject(new TClonesArray("AliAODJet", 0)); |
319 | AddObject(new AliAODCaloCells()); | |
37792174 | 320 | AddObject(new AliAODCaloCells()); |
3dd9f9e3 | 321 | AddObject(new TClonesArray("AliAODCaloCluster", 0)); |
720f7306 | 322 | AddObject(new AliAODCaloTrigger()); // EMCAL |
323 | AddObject(new AliAODCaloTrigger()); // PHOS | |
3dd9f9e3 | 324 | AddObject(new TClonesArray("AliAODFmdCluster", 0)); |
325 | AddObject(new TClonesArray("AliAODPmdCluster", 0)); | |
08b38f3f | 326 | AddObject(new TClonesArray("AliAODHMPIDrings", 0)); |
866d8d78 | 327 | AddObject(new TClonesArray("AliAODDimuon", 0)); |
a1f96974 | 328 | AddObject(new AliAODTZERO()); |
ae2bccf1 | 329 | AddObject(new AliAODVZERO()); |
16d867eb | 330 | AddObject(new AliAODZDC()); |
68919bd9 | 331 | AddObject(new AliTOFHeader()); |
9aa7ebff | 332 | AddObject(new TClonesArray("AliAODTrdTrack", 0)); |
08e4c457 | 333 | // set names |
334 | SetStdNames(); | |
335 | ||
df9db588 | 336 | // read back pointers |
337 | GetStdContent(); | |
5c1dc41f | 338 | CreateStdFolders(); |
08e4c457 | 339 | return; |
df9db588 | 340 | } |
341 | ||
c8e4f399 | 342 | void AliAODEvent::MakeEntriesReferencable() |
343 | { | |
344 | // Make all entries referencable in a subsequent process | |
345 | // | |
346 | TIter next(fAODObjects); | |
347 | TObject* obj; | |
8ac4fa64 | 348 | while ((obj = next())) |
c8e4f399 | 349 | { |
350 | if(obj->InheritsFrom("TCollection")) | |
351 | { | |
352 | AssignIDtoCollection((TCollection*)obj); | |
353 | } | |
354 | } | |
355 | } | |
356 | ||
08e4c457 | 357 | //______________________________________________________________________________ |
358 | void AliAODEvent::SetStdNames() | |
359 | { | |
360 | // introduce the standard naming | |
361 | ||
362 | if(fAODObjects->GetEntries()==kAODListN){ | |
363 | for(int i = 0;i < fAODObjects->GetEntries();i++){ | |
364 | TObject *fObj = fAODObjects->At(i); | |
365 | if(fObj->InheritsFrom("TNamed")){ | |
366 | ((TNamed*)fObj)->SetName(fAODListName[i]); | |
367 | } | |
368 | else if(fObj->InheritsFrom("TClonesArray")){ | |
369 | ((TClonesArray*)fObj)->SetName(fAODListName[i]); | |
370 | } | |
371 | } | |
372 | } | |
373 | else{ | |
374 | printf("%s:%d SetStdNames() Wrong number of Std Entries \n",(char*)__FILE__,__LINE__); | |
375 | } | |
376 | } | |
377 | ||
d38034b8 | 378 | //______________________________________________________________________________ |
5c1dc41f | 379 | void AliAODEvent::CreateStdFolders() |
380 | { | |
381 | // Create the standard folder structure | |
b752604b | 382 | if(fAODFolder)delete fAODFolder; |
5c1dc41f | 383 | fAODFolder = gROOT->GetRootFolder()->AddFolder("AOD", "AOD"); |
384 | if(fAODObjects->GetEntries()==kAODListN){ | |
385 | for(int i = 0;i < fAODObjects->GetEntries();i++){ | |
386 | TObject *fObj = fAODObjects->At(i); | |
387 | if(fObj->InheritsFrom("TClonesArray")){ | |
388 | fAODFolder->AddFolder(fAODListName[i], fAODListName[i], (TCollection*) fObj); | |
389 | } else { | |
390 | fAODFolder->AddFolder(fAODListName[i], fAODListName[i], 0); | |
391 | } | |
392 | } | |
393 | } | |
394 | else{ | |
395 | printf("%s:%d CreateStdFolders() Wrong number of Std Entries \n",(char*)__FILE__,__LINE__); | |
396 | } | |
397 | } | |
398 | ||
df9db588 | 399 | //______________________________________________________________________________ |
ec4af4c1 | 400 | void AliAODEvent::GetStdContent() |
df9db588 | 401 | { |
402 | // set pointers for standard content | |
403 | ||
f8faa5ab | 404 | fHeader = (AliVAODHeader*)fAODObjects->FindObject("header"); |
3dd9f9e3 | 405 | fTracks = (TClonesArray*)fAODObjects->FindObject("tracks"); |
406 | fVertices = (TClonesArray*)fAODObjects->FindObject("vertices"); | |
407 | fV0s = (TClonesArray*)fAODObjects->FindObject("v0s"); | |
9a244178 | 408 | fCascades = (TClonesArray*)fAODObjects->FindObject("cascades"); |
3dd9f9e3 | 409 | fTracklets = (AliAODTracklets*)fAODObjects->FindObject("tracklets"); |
410 | fJets = (TClonesArray*)fAODObjects->FindObject("jets"); | |
37792174 | 411 | fEmcalCells = (AliAODCaloCells*)fAODObjects->FindObject("emcalCells"); |
412 | fPhosCells = (AliAODCaloCells*)fAODObjects->FindObject("phosCells"); | |
3dd9f9e3 | 413 | fCaloClusters = (TClonesArray*)fAODObjects->FindObject("caloClusters"); |
08b38f3f | 414 | fEMCALTrigger = (AliAODCaloTrigger*)fAODObjects->FindObject("emcalTrigger"); |
415 | fPHOSTrigger = (AliAODCaloTrigger*)fAODObjects->FindObject("phosTrigger"); | |
3dd9f9e3 | 416 | fFmdClusters = (TClonesArray*)fAODObjects->FindObject("fmdClusters"); |
417 | fPmdClusters = (TClonesArray*)fAODObjects->FindObject("pmdClusters"); | |
fc05a533 | 418 | fHMPIDrings = (TClonesArray*)fAODObjects->FindObject("hmpidRings"); |
866d8d78 | 419 | fDimuons = (TClonesArray*)fAODObjects->FindObject("dimuons"); |
a1f96974 | 420 | fAODTZERO = (AliAODTZERO*)fAODObjects->FindObject("AliAODTZERO"); |
ae2bccf1 | 421 | fAODVZERO = (AliAODVZERO*)fAODObjects->FindObject("AliAODVZERO"); |
16d867eb | 422 | fAODZDC = (AliAODZDC*)fAODObjects->FindObject("AliAODZDC"); |
68919bd9 | 423 | fTOFHeader = (AliTOFHeader*)fAODObjects->FindObject("AliTOFHeader"); |
9aa7ebff | 424 | fTrdTracks = (TClonesArray*)fAODObjects->FindObject("trdTracks"); |
df9db588 | 425 | } |
426 | ||
427 | //______________________________________________________________________________ | |
3dd9f9e3 | 428 | void AliAODEvent::ResetStd(Int_t trkArrSize, |
d38034b8 | 429 | Int_t vtxArrSize, |
430 | Int_t v0ArrSize, | |
431 | Int_t cascadeArrSize, | |
432 | Int_t jetSize, | |
433 | Int_t caloClusSize, | |
434 | Int_t fmdClusSize, | |
435 | Int_t pmdClusSize, | |
436 | Int_t hmpidRingsSize, | |
437 | Int_t dimuonArrSize, | |
438 | Int_t nTrdTracks | |
9a244178 | 439 | ) |
df9db588 | 440 | { |
3dd9f9e3 | 441 | // deletes content of standard arrays and resets size |
d38034b8 | 442 | fTracksConnected = kFALSE; |
f8e407b9 | 443 | if (fTracks) { |
444 | fTracks->Delete(); | |
445 | if (trkArrSize > fTracks->GetSize()) | |
446 | fTracks->Expand(trkArrSize); | |
447 | } | |
448 | if (fVertices) { | |
449 | fVertices->Delete(); | |
450 | if (vtxArrSize > fVertices->GetSize()) | |
451 | fVertices->Expand(vtxArrSize); | |
452 | } | |
453 | if (fV0s) { | |
454 | fV0s->Delete(); | |
455 | if (v0ArrSize > fV0s->GetSize()) | |
456 | fV0s->Expand(v0ArrSize); | |
457 | } | |
458 | if (fCascades) { | |
459 | fCascades->Delete(); | |
460 | if (cascadeArrSize > fCascades->GetSize()) | |
461 | fCascades->Expand(cascadeArrSize); | |
462 | } | |
463 | if (fJets) { | |
464 | fJets->Delete(); | |
465 | if (jetSize > fJets->GetSize()) | |
466 | fJets->Expand(jetSize); | |
467 | } | |
468 | if (fCaloClusters) { | |
469 | fCaloClusters->Delete(); | |
470 | if (caloClusSize > fCaloClusters->GetSize()) | |
471 | fCaloClusters->Expand(caloClusSize); | |
472 | } | |
473 | if (fFmdClusters) { | |
474 | fFmdClusters->Delete(); | |
475 | if (fmdClusSize > fFmdClusters->GetSize()) | |
476 | fFmdClusters->Expand(fmdClusSize); | |
477 | } | |
478 | if (fPmdClusters) { | |
479 | fPmdClusters->Delete(); | |
480 | if (pmdClusSize > fPmdClusters->GetSize()) | |
481 | fPmdClusters->Expand(pmdClusSize); | |
482 | } | |
08b38f3f | 483 | if (fHMPIDrings) { |
fc05a533 | 484 | fHMPIDrings->Delete(); |
08b38f3f | 485 | if (hmpidRingsSize > fHMPIDrings->GetSize()) |
486 | fHMPIDrings->Expand(hmpidRingsSize); | |
487 | } | |
f8e407b9 | 488 | if (fDimuons) { |
489 | fDimuons->Delete(); | |
490 | if (dimuonArrSize > fDimuons->GetSize()) | |
491 | fDimuons->Expand(dimuonArrSize); | |
492 | } | |
9aa7ebff | 493 | if (fTrdTracks) { |
494 | // no pointers in there, so cheaper Clear suffices | |
4a481714 | 495 | // fTrdTracks->Clear("C"); |
496 | // Not quite: AliAODTrdTrack has a clones array of tracklets inside | |
497 | fTrdTracks->Delete(); | |
9aa7ebff | 498 | if (nTrdTracks > fTrdTracks->GetSize()) |
499 | fTrdTracks->Expand(nTrdTracks); | |
500 | } | |
501 | ||
f8e407b9 | 502 | if (fTracklets) |
503 | fTracklets->DeleteContainer(); | |
504 | if (fPhosCells) | |
505 | fPhosCells->DeleteContainer(); | |
506 | if (fEmcalCells) | |
507 | fEmcalCells->DeleteContainer(); | |
720f7306 | 508 | |
509 | if (fEMCALTrigger) | |
510 | fEMCALTrigger->DeAllocate(); | |
511 | if (fPHOSTrigger) | |
512 | fPHOSTrigger->DeAllocate(); | |
6d710f57 | 513 | |
df9db588 | 514 | } |
515 | ||
d38034b8 | 516 | //______________________________________________________________________________ |
ec4af4c1 | 517 | void AliAODEvent::ClearStd() |
518 | { | |
519 | // clears the standard arrays | |
468c076d | 520 | if (fHeader){ |
521 | // FIXME: this if-else patch was introduced by Michele Floris on 17/03/14 to test nano AOD. To be removed. | |
522 | if(fHeader->InheritsFrom("AliAODHeader")){ | |
523 | fHeader ->Clear(); | |
524 | } | |
525 | else { | |
526 | AliVHeader * head = 0; | |
da867ad1 | 527 | head = dynamic_cast<AliVHeader*>((TObject*)fHeader); |
468c076d | 528 | if(head) head->Clear(); |
529 | } | |
530 | } | |
d38034b8 | 531 | fTracksConnected = kFALSE; |
f8e407b9 | 532 | if (fTracks) |
533 | fTracks ->Delete(); | |
534 | if (fVertices) | |
535 | fVertices ->Delete(); | |
536 | if (fV0s) | |
537 | fV0s ->Delete(); | |
538 | if (fCascades) | |
539 | fCascades ->Delete(); | |
540 | if (fTracklets) | |
541 | fTracklets ->DeleteContainer(); | |
542 | if (fJets) | |
543 | fJets ->Delete(); | |
544 | if (fEmcalCells) | |
545 | fEmcalCells ->DeleteContainer(); | |
546 | if (fPhosCells) | |
547 | fPhosCells ->DeleteContainer(); | |
548 | if (fCaloClusters) | |
549 | fCaloClusters ->Delete(); | |
550 | if (fFmdClusters) | |
551 | fFmdClusters ->Clear(); | |
552 | if (fPmdClusters) | |
fc05a533 | 553 | fPmdClusters ->Clear(); |
554 | if (fHMPIDrings) | |
555 | fHMPIDrings ->Clear(); | |
f8e407b9 | 556 | if (fDimuons) |
557 | fDimuons ->Clear(); | |
9aa7ebff | 558 | if (fTrdTracks) |
559 | fTrdTracks ->Clear(); | |
720f7306 | 560 | |
561 | if (fEMCALTrigger) | |
562 | fEMCALTrigger->DeAllocate(); | |
563 | if (fPHOSTrigger) | |
564 | fPHOSTrigger->DeAllocate(); | |
ec4af4c1 | 565 | } |
566 | ||
78902954 | 567 | //_________________________________________________________________ |
568 | Int_t AliAODEvent::GetPHOSClusters(TRefArray *clusters) const | |
569 | { | |
570 | // fills the provided TRefArray with all found phos clusters | |
571 | ||
572 | clusters->Clear(); | |
573 | ||
574 | AliAODCaloCluster *cl = 0; | |
a0df0b6a | 575 | Bool_t first = kTRUE; |
c8fe2783 | 576 | for (Int_t i = 0; i < GetNumberOfCaloClusters() ; i++) { |
78902954 | 577 | if ( (cl = GetCaloCluster(i)) ) { |
c8fe2783 | 578 | if (cl->IsPHOS()){ |
a0df0b6a | 579 | if(first) { |
580 | new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl)); | |
581 | first=kFALSE; | |
582 | } | |
78902954 | 583 | clusters->Add(cl); |
a0df0b6a | 584 | //printf("IsPHOS cluster %d, E %2.3f Size: %d \n",i,cl->E(),clusters->GetEntriesFast()); |
78902954 | 585 | } |
586 | } | |
587 | } | |
588 | return clusters->GetEntriesFast(); | |
589 | } | |
590 | ||
591 | //_________________________________________________________________ | |
592 | Int_t AliAODEvent::GetEMCALClusters(TRefArray *clusters) const | |
593 | { | |
594 | // fills the provided TRefArray with all found emcal clusters | |
595 | ||
596 | clusters->Clear(); | |
78902954 | 597 | AliAODCaloCluster *cl = 0; |
a0df0b6a | 598 | Bool_t first = kTRUE; |
c8fe2783 | 599 | for (Int_t i = 0; i < GetNumberOfCaloClusters(); i++) { |
78902954 | 600 | if ( (cl = GetCaloCluster(i)) ) { |
c8fe2783 | 601 | if (cl->IsEMCAL()){ |
a0df0b6a | 602 | if(first) { |
603 | new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl)); | |
604 | first=kFALSE; | |
605 | } | |
78902954 | 606 | clusters->Add(cl); |
a0df0b6a | 607 | //printf("IsEMCal cluster %d, E %2.3f Size: %d \n",i,cl->E(),clusters->GetEntriesFast()); |
78902954 | 608 | } |
609 | } | |
610 | } | |
611 | return clusters->GetEntriesFast(); | |
612 | } | |
613 | ||
614 | ||
fb41236c | 615 | //______________________________________________________________________________ |
616 | Int_t AliAODEvent::GetMuonTracks(TRefArray *muonTracks) const | |
617 | { | |
618 | // fills the provided TRefArray with all found muon tracks | |
df9db588 | 619 | |
fb41236c | 620 | muonTracks->Clear(); |
df9db588 | 621 | |
fb41236c | 622 | AliAODTrack *track = 0; |
4640c275 | 623 | for (Int_t iTrack = 0; iTrack < GetNumberOfTracks(); iTrack++) { |
4cd87297 | 624 | track = dynamic_cast<AliAODTrack*>(GetTrack(iTrack)); |
625 | if(!track) AliFatal("Not a standard AOD"); | |
11becff8 | 626 | if (track->IsMuonTrack()) { |
fb41236c | 627 | muonTracks->Add(track); |
628 | } | |
629 | } | |
630 | ||
3dd9f9e3 | 631 | return muonTracks->GetEntriesFast(); |
fb41236c | 632 | } |
ec4af4c1 | 633 | |
634 | ||
fa8b0e56 | 635 | //______________________________________________________________________________ |
636 | Int_t AliAODEvent::GetNumberOfMuonTracks() const | |
637 | { | |
638 | // get number of muon tracks | |
639 | Int_t nMuonTracks=0; | |
4cd87297 | 640 | |
641 | if(!dynamic_cast<AliAODTrack*>(GetTrack(0))) { | |
642 | AliError("Not a standard AOD"); | |
643 | return 0; | |
644 | } | |
645 | ||
4640c275 | 646 | for (Int_t iTrack = 0; iTrack < GetNumberOfTracks(); iTrack++) { |
4cd87297 | 647 | if (((AliAODTrack*)GetTrack(iTrack))->IsMuonTrack()) { |
fa8b0e56 | 648 | nMuonTracks++; |
649 | } | |
650 | } | |
651 | ||
652 | return nMuonTracks; | |
653 | } | |
654 | ||
f7cc8591 | 655 | //______________________________________________________________________________ |
656 | Int_t AliAODEvent::GetMuonGlobalTracks(TRefArray *muonGlobalTracks) const // AU | |
657 | { | |
658 | // fills the provided TRefArray with all found muon global tracks | |
659 | ||
660 | muonGlobalTracks->Clear(); | |
661 | ||
662 | AliAODTrack *track = 0; | |
4640c275 | 663 | for (Int_t iTrack = 0; iTrack < GetNumberOfTracks(); iTrack++) { |
4cd87297 | 664 | track = dynamic_cast<AliAODTrack*>(GetTrack(iTrack)); |
665 | if(!track) AliFatal("Not a standard AOD"); | |
f7cc8591 | 666 | if (track->IsMuonGlobalTrack()) { |
667 | muonGlobalTracks->Add(track); | |
668 | } | |
669 | } | |
670 | ||
671 | return muonGlobalTracks->GetEntriesFast(); | |
672 | } | |
673 | ||
674 | ||
675 | //______________________________________________________________________________ | |
676 | Int_t AliAODEvent::GetNumberOfMuonGlobalTracks() const // AU | |
677 | { | |
678 | // get number of muon global tracks | |
679 | Int_t nMuonGlobalTracks=0; | |
4cd87297 | 680 | if(!dynamic_cast<AliAODTrack*>(GetTrack(0))) { |
681 | AliError("Not a standard AOD"); | |
682 | return 0; | |
683 | } | |
4640c275 | 684 | for (Int_t iTrack = 0; iTrack < GetNumberOfTracks(); iTrack++) { |
4cd87297 | 685 | if (((AliAODTrack*)GetTrack(iTrack))->IsMuonGlobalTrack()) { |
f7cc8591 | 686 | nMuonGlobalTracks++; |
687 | } | |
688 | } | |
689 | ||
690 | return nMuonGlobalTracks; | |
691 | } | |
692 | ||
788578f5 | 693 | //______________________________________________________________________________ |
3b93c32a | 694 | void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/) |
8ff33247 | 695 | { |
c8fe2783 | 696 | // Connects aod event to tree |
08e4c457 | 697 | |
61cb38c7 | 698 | if(!tree){ |
788578f5 | 699 | AliWarning("Zero Pointer to Tree \n"); |
61cb38c7 | 700 | return; |
701 | } | |
c8fe2783 | 702 | // load the TTree |
61cb38c7 | 703 | if(!tree->GetTree())tree->LoadTree(0); |
c8fe2783 | 704 | |
705 | // Try to find AliAODEvent | |
61cb38c7 | 706 | AliAODEvent *aodEvent = 0; |
707 | aodEvent = (AliAODEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliAODEvent"); | |
708 | if(aodEvent){ | |
788578f5 | 709 | // This event is connected to the tree by definition, just say so |
710 | aodEvent->SetConnected(); | |
c8fe2783 | 711 | // Check if already connected to tree |
61cb38c7 | 712 | TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("AODObjectsConnectedToTree")); |
5fdc7d49 | 713 | if (connectedList && (!strcmp(opt, "reconnect"))) { |
c8fe2783 | 714 | // If connected use the connected list of objects |
5fdc7d49 | 715 | if (fAODObjects != connectedList) { |
716 | delete fAODObjects; | |
717 | fAODObjects = connectedList; | |
718 | } | |
719 | GetStdContent(); | |
720 | fConnected = kTRUE; | |
721 | return; | |
d8f5fda5 | 722 | } |
c8fe2783 | 723 | // Connect to tree |
724 | // prevent a memory leak when reading back the TList | |
28a79204 | 725 | // if (!(strcmp(opt, "reconnect"))) fAODObjects->Delete(); |
c8fe2783 | 726 | |
727 | // create a new TList from the UserInfo TList... | |
728 | // copy constructor does not work... | |
1ee5d9a3 | 729 | // fAODObjects = (TList*)(aodEvent->GetList()->Clone()); |
730 | fAODObjects = (TList*)aodEvent->GetList(); | |
316cf4cc | 731 | fAODObjects->SetOwner(kTRUE); |
14d6fad5 | 732 | if(fAODObjects->GetEntries()<kAODListN) |
733 | { | |
734 | AliWarning(Form("AliAODEvent::ReadFromTree() TList contains less than the standard contents %d < %d" | |
735 | " That might be fine though (at least for filtered AODs)",fAODObjects->GetEntries(),kAODListN)); | |
61cb38c7 | 736 | } |
c8fe2783 | 737 | // |
738 | // Let's find out whether we have friends | |
ced57103 | 739 | TList* friendL = tree->GetTree()->GetListOfFriends(); |
298d3d58 | 740 | if (friendL) |
741 | { | |
c8fe2783 | 742 | TIter next(friendL); |
743 | TFriendElement* fe; | |
744 | while ((fe = (TFriendElement*)next())){ | |
745 | aodEvent = (AliAODEvent*)(fe->GetTree()->GetUserInfo()->FindObject("AliAODEvent")); | |
746 | if (!aodEvent) { | |
747 | printf("No UserInfo on tree \n"); | |
748 | } else { | |
749 | ||
1ee5d9a3 | 750 | // TList* objL = (TList*)(aodEvent->GetList()->Clone()); |
08b38f3f | 751 | TList* objL = (TList*)aodEvent->GetList(); |
752 | printf("Get list of object from tree %d !!\n", objL->GetEntries()); | |
753 | TIter nextobject(objL); | |
754 | TObject* obj = 0; | |
755 | while((obj = nextobject())) | |
c8fe2783 | 756 | { |
08b38f3f | 757 | printf("Adding object from friend %s !\n", obj->GetName()); |
758 | fAODObjects->Add(obj); | |
c8fe2783 | 759 | } // object "branch" loop |
08b38f3f | 760 | } // has userinfo |
c8fe2783 | 761 | } // friend loop |
298d3d58 | 762 | } // has friends |
c8fe2783 | 763 | // set the branch addresses |
61cb38c7 | 764 | TIter next(fAODObjects); |
765 | TNamed *el; | |
766 | while((el=(TNamed*)next())){ | |
767 | TString bname(el->GetName()); | |
c8fe2783 | 768 | // check if branch exists under this Name |
ced57103 | 769 | TBranch *br = tree->GetTree()->GetBranch(bname.Data()); |
61cb38c7 | 770 | if(br){ |
c8fe2783 | 771 | tree->SetBranchAddress(bname.Data(),fAODObjects->GetObjectRef(el)); |
ced57103 | 772 | } else { |
c8fe2783 | 773 | br = tree->GetBranch(Form("%s.",bname.Data())); |
774 | if(br){ | |
775 | tree->SetBranchAddress(Form("%s.",bname.Data()),fAODObjects->GetObjectRef(el)); | |
776 | } | |
777 | else{ | |
778 | printf("%s %d AliAODEvent::ReadFromTree() No Branch found with Name %s. \n", | |
779 | (char*)__FILE__,__LINE__,bname.Data()); | |
780 | } | |
61cb38c7 | 781 | } |
782 | } | |
61cb38c7 | 783 | GetStdContent(); |
c8fe2783 | 784 | // when reading back we are not owner of the list |
785 | // must not delete it | |
316cf4cc | 786 | fAODObjects->SetOwner(kTRUE); |
61cb38c7 | 787 | fAODObjects->SetName("AODObjectsConnectedToTree"); |
c8fe2783 | 788 | // we are not owner of the list objects |
789 | // must not delete it | |
61cb38c7 | 790 | tree->GetUserInfo()->Add(fAODObjects); |
dd389a30 | 791 | fConnected = kTRUE; |
61cb38c7 | 792 | }// no aodEvent |
793 | else { | |
c8fe2783 | 794 | // we can't get the list from the user data, create standard content |
795 | // and set it by hand | |
61cb38c7 | 796 | CreateStdContent(); |
797 | TIter next(fAODObjects); | |
798 | TNamed *el; | |
799 | while((el=(TNamed*)next())){ | |
800 | TString bname(el->GetName()); | |
801 | tree->SetBranchAddress(bname.Data(),fAODObjects->GetObjectRef(el)); | |
802 | } | |
803 | GetStdContent(); | |
c8fe2783 | 804 | // when reading back we are not owner of the list |
805 | // must not delete it | |
316cf4cc | 806 | fAODObjects->SetOwner(kTRUE); |
08e4c457 | 807 | } |
8ff33247 | 808 | } |
c8fe2783 | 809 | //______________________________________________________________________________ |
a98c78e5 | 810 | Int_t AliAODEvent::GetNumberOfPileupVerticesSPD() const{ |
811 | // count number of SPD pileup vertices | |
812 | Int_t nVertices=GetNumberOfVertices(); | |
813 | Int_t nPileupVertices=0; | |
814 | for(Int_t iVert=0; iVert<nVertices; iVert++){ | |
815 | AliAODVertex *v=GetVertex(iVert); | |
816 | if(v->GetType()==AliAODVertex::kPileupSPD) nPileupVertices++; | |
817 | } | |
818 | return nPileupVertices; | |
819 | } | |
820 | //______________________________________________________________________________ | |
821 | Int_t AliAODEvent::GetNumberOfPileupVerticesTracks() const{ | |
822 | // count number of track pileup vertices | |
823 | Int_t nVertices=GetNumberOfVertices(); | |
824 | Int_t nPileupVertices=0; | |
825 | for(Int_t iVert=0; iVert<nVertices; iVert++){ | |
826 | AliAODVertex *v=GetVertex(iVert); | |
827 | if(v->GetType()==AliAODVertex::kPileupTracks) nPileupVertices++; | |
828 | } | |
829 | return nPileupVertices; | |
830 | } | |
831 | //______________________________________________________________________________ | |
832 | AliAODVertex* AliAODEvent::GetPrimaryVertexSPD() const{ | |
5e6a3170 | 833 | // Get SPD primary vertex |
a98c78e5 | 834 | Int_t nVertices=GetNumberOfVertices(); |
835 | for(Int_t iVert=0; iVert<nVertices; iVert++){ | |
836 | AliAODVertex *v=GetVertex(iVert); | |
837 | if(v->GetType()==AliAODVertex::kMainSPD) return v; | |
838 | } | |
839 | return 0; | |
840 | } | |
841 | //______________________________________________________________________________ | |
c4d9b22d | 842 | AliAODVertex* AliAODEvent::GetPrimaryVertexTPC() const{ |
843 | // Get SPD primary vertex | |
844 | Int_t nVertices=GetNumberOfVertices(); | |
845 | for(Int_t iVert=0; iVert<nVertices; iVert++){ | |
846 | AliAODVertex *v=GetVertex(iVert); | |
847 | if(v->GetType()==AliAODVertex::kMainTPC) return v; | |
848 | } | |
849 | return 0; | |
850 | } | |
851 | //______________________________________________________________________________ | |
a98c78e5 | 852 | AliAODVertex* AliAODEvent::GetPileupVertexSPD(Int_t iV) const{ |
5e6a3170 | 853 | // Get pile-up vertex iV |
a98c78e5 | 854 | Int_t nVertices=GetNumberOfVertices(); |
855 | Int_t counter=0; | |
856 | for(Int_t iVert=0; iVert<nVertices; iVert++){ | |
857 | AliAODVertex *v=GetVertex(iVert); | |
858 | if(v->GetType()==AliAODVertex::kPileupSPD){ | |
859 | if(counter==iV) return v; | |
860 | ++counter; | |
861 | } | |
862 | } | |
863 | return 0; | |
864 | } | |
865 | //______________________________________________________________________________ | |
866 | AliAODVertex* AliAODEvent::GetPileupVertexTracks(Int_t iV) const{ | |
5e6a3170 | 867 | // Get pile-up vertex iV |
a98c78e5 | 868 | Int_t nVertices=GetNumberOfVertices(); |
869 | Int_t counter=0; | |
870 | for(Int_t iVert=0; iVert<nVertices; iVert++){ | |
871 | AliAODVertex *v=GetVertex(iVert); | |
872 | if(v->GetType()==AliAODVertex::kPileupTracks){ | |
873 | if(counter==iV) return v; | |
874 | ++counter; | |
875 | } | |
876 | } | |
877 | return 0; | |
878 | } | |
879 | //______________________________________________________________________________ | |
880 | Bool_t AliAODEvent::IsPileupFromSPD(Int_t minContributors, | |
881 | Double_t minZdist, | |
882 | Double_t nSigmaZdist, | |
883 | Double_t nSigmaDiamXY, | |
884 | Double_t nSigmaDiamZ) const{ | |
885 | // | |
886 | // This function checks if there was a pile up | |
887 | // reconstructed with SPD | |
888 | // | |
889 | AliAODVertex *mainV=GetPrimaryVertexSPD(); | |
890 | if(!mainV) return kFALSE; | |
891 | Int_t nc1=mainV->GetNContributors(); | |
892 | if(nc1<1) return kFALSE; | |
893 | Int_t nPileVert=GetNumberOfPileupVerticesSPD(); | |
894 | if(nPileVert==0) return kFALSE; | |
895 | Int_t nVertices=GetNumberOfVertices(); | |
896 | ||
897 | for(Int_t iVert=0; iVert<nVertices; iVert++){ | |
898 | AliAODVertex *pv=GetVertex(iVert); | |
899 | if(pv->GetType()!=AliAODVertex::kPileupSPD) continue; | |
900 | Int_t nc2=pv->GetNContributors(); | |
901 | if(nc2>=minContributors){ | |
902 | Double_t z1=mainV->GetZ(); | |
903 | Double_t z2=pv->GetZ(); | |
904 | Double_t distZ=TMath::Abs(z2-z1); | |
905 | Double_t distZdiam=TMath::Abs(z2-GetDiamondZ()); | |
569d954c | 906 | Double_t cutZdiam=nSigmaDiamZ*TMath::Sqrt(GetSigma2DiamondZ()); |
a98c78e5 | 907 | if(GetSigma2DiamondZ()<0.0001)cutZdiam=99999.; //protection for missing z diamond information |
908 | if(distZ>minZdist && distZdiam<cutZdiam){ | |
909 | Double_t x2=pv->GetX(); | |
910 | Double_t y2=pv->GetY(); | |
911 | Double_t distXdiam=TMath::Abs(x2-GetDiamondX()); | |
912 | Double_t distYdiam=TMath::Abs(y2-GetDiamondY()); | |
913 | Double_t cov1[6],cov2[6]; | |
914 | mainV->GetCovarianceMatrix(cov1); | |
915 | pv->GetCovarianceMatrix(cov2); | |
916 | Double_t errxDist=TMath::Sqrt(cov2[0]+GetSigma2DiamondX()); | |
917 | Double_t erryDist=TMath::Sqrt(cov2[2]+GetSigma2DiamondY()); | |
918 | Double_t errzDist=TMath::Sqrt(cov1[5]+cov2[5]); | |
919 | Double_t cutXdiam=nSigmaDiamXY*errxDist; | |
920 | if(GetSigma2DiamondX()<0.0001)cutXdiam=99999.; //protection for missing diamond information | |
921 | Double_t cutYdiam=nSigmaDiamXY*erryDist; | |
922 | if(GetSigma2DiamondY()<0.0001)cutYdiam=99999.; //protection for missing diamond information | |
923 | if( (distXdiam<cutXdiam) && (distYdiam<cutYdiam) && (distZ>nSigmaZdist*errzDist) ){ | |
924 | return kTRUE; | |
925 | } | |
926 | } | |
927 | } | |
928 | } | |
929 | return kFALSE; | |
930 | } | |
8ff33247 | 931 | |
08e4c457 | 932 | //______________________________________________________________________________ |
933 | void AliAODEvent::Print(Option_t *) const | |
934 | { | |
4922c144 | 935 | // Print the names of the all branches |
936 | TIter next(fAODObjects); | |
937 | TNamed *el; | |
938 | Printf(">>>>> AOD Content <<<<<"); | |
939 | while((el=(TNamed*)next())){ | |
940 | Printf(">> %s ",el->GetName()); | |
941 | } | |
942 | Printf(">>>>> <<<<<"); | |
08e4c457 | 943 | |
944 | return; | |
945 | } | |
c8e4f399 | 946 | |
d38034b8 | 947 | //______________________________________________________________________________ |
5e6a3170 | 948 | void AliAODEvent::AssignIDtoCollection(const TCollection* col) |
c8e4f399 | 949 | { |
950 | // Static method which assigns a ID to each object in a collection | |
951 | // In this way the objects are marked as referenced and written with | |
952 | // an ID. This has the advantage that TRefs to this objects can be | |
953 | // written by a subsequent process. | |
954 | TIter next(col); | |
955 | TObject* obj; | |
8ac4fa64 | 956 | while ((obj = next())) |
c8e4f399 | 957 | TProcessID::AssignID(obj); |
958 | } | |
b46ff4b0 | 959 | |
d38034b8 | 960 | //______________________________________________________________________________ |
b46ff4b0 | 961 | Bool_t AliAODEvent::IsPileupFromSPDInMultBins() const { |
962 | Int_t nTracklets=GetTracklets()->GetNumberOfTracklets(); | |
963 | if(nTracklets<20) return IsPileupFromSPD(3,0.8); | |
964 | else if(nTracklets<50) return IsPileupFromSPD(4,0.8); | |
965 | else return IsPileupFromSPD(5,0.8); | |
966 | } | |
967 | ||
d38034b8 | 968 | //______________________________________________________________________________ |
1da0e888 | 969 | void AliAODEvent::Reset() |
970 | { | |
971 | // Handle the cases | |
972 | // Std content + Non std content | |
973 | ||
974 | ClearStd(); | |
1da0e888 | 975 | if(fAODObjects->GetSize()>kAODListN){ |
976 | // we have non std content | |
977 | // this also covers aodfriends | |
978 | for(int i = kAODListN;i < fAODObjects->GetSize();++i){ | |
979 | TObject *pObject = fAODObjects->At(i); | |
980 | // TClonesArrays | |
981 | if(pObject->InheritsFrom(TClonesArray::Class())){ | |
982 | ((TClonesArray*)pObject)->Delete(); | |
983 | } | |
984 | else if(!pObject->InheritsFrom(TCollection::Class())){ | |
985 | TClass *pClass = TClass::GetClass(pObject->ClassName()); | |
986 | if (pClass && pClass->GetListOfMethods()->FindObject("Clear")) { | |
987 | AliDebug(1, Form("Clear for object %s class %s", pObject->GetName(), pObject->ClassName())); | |
988 | pObject->Clear(); | |
989 | } | |
990 | else { | |
991 | AliDebug(1, Form("ResetWithPlacementNew for object %s class %s", pObject->GetName(), pObject->ClassName())); | |
992 | Long_t dtoronly = TObject::GetDtorOnly(); | |
993 | TObject::SetDtorOnly(pObject); | |
994 | delete pObject; | |
995 | pClass->New(pObject); | |
996 | TObject::SetDtorOnly((void*)dtoronly); | |
997 | } | |
998 | } | |
999 | else{ | |
1000 | AliWarning(Form("No reset for %s \n", | |
1001 | pObject->ClassName())); | |
1002 | } | |
1003 | } | |
1004 | } | |
1005 | } | |
1006 | ||
f8faa5ab | 1007 | // FIXME: Why is this in event and not in header? |
5e14e698 | 1008 | Float_t AliAODEvent::GetVZEROEqMultiplicity(Int_t i) const |
1009 | { | |
1010 | // Get VZERO Multiplicity for channel i | |
1011 | // Themethod uses the equalization factors | |
1012 | // stored in the ESD-run object in order to | |
1013 | // get equal multiplicities within a VZERO rins (1/8 of VZERO) | |
1014 | if (!fAODVZERO || !fHeader) return -1; | |
1015 | ||
1016 | Int_t ring = i/8; | |
1017 | Float_t factorSum = 0; | |
1018 | for(Int_t j = 8*ring; j < (8*ring+8); ++j) { | |
1019 | factorSum += fHeader->GetVZEROEqFactors(j); | |
1020 | } | |
1021 | Float_t factor = fHeader->GetVZEROEqFactors(i)*8./factorSum; | |
1022 | ||
1023 | return (fAODVZERO->GetMultiplicity(i)/factor); | |
1024 | } | |
68919bd9 | 1025 | |
1026 | //------------------------------------------------------------ | |
1027 | void AliAODEvent::SetTOFHeader(const AliTOFHeader *header) | |
1028 | { | |
1029 | // | |
1030 | // Set the TOF event_time | |
1031 | // | |
1032 | ||
1033 | if (fTOFHeader) { | |
1034 | *fTOFHeader=*header; | |
1035 | //fTOFHeader->SetName(fgkESDListName[kTOFHeader]); | |
1036 | } | |
1037 | else { | |
1038 | // for analysis of reconstructed events | |
1039 | // when this information is not avaliable | |
1040 | fTOFHeader = new AliTOFHeader(*header); | |
1041 | //AddObject(fTOFHeader); | |
1042 | } | |
1043 | ||
1044 | } | |
08b38f3f | 1045 | //------------------------------------------------------------ |
567624b5 | 1046 | AliAODHMPIDrings *AliAODEvent::GetHMPIDringForTrackID(Int_t trackID) const |
08b38f3f | 1047 | { |
1048 | // | |
1049 | // Returns the HMPID object if any for a given track ID | |
1050 | // | |
1051 | if(GetHMPIDrings()) | |
1052 | { | |
1053 | for(Int_t ien = 0 ; ien < GetNHMPIDrings(); ien++) | |
1054 | { | |
824d3e1f | 1055 | if( GetHMPIDring(ien)->GetHmpTrkID() == trackID ) return GetHMPIDring(ien); |
08b38f3f | 1056 | }//rings loop |
1057 | } | |
1058 | return 0; | |
1059 | } | |
1060 | //------------------------------------------------------------ | |
567624b5 | 1061 | Int_t AliAODEvent::GetNHMPIDrings() const |
08b38f3f | 1062 | { |
1063 | // | |
1064 | // If there is a list of HMPID rings in the given AOD event, return their number | |
1065 | // | |
1066 | if ( fHMPIDrings) return fHMPIDrings->GetEntriesFast(); | |
1067 | else return -1; | |
1068 | } | |
1069 | //------------------------------------------------------------ | |
567624b5 | 1070 | AliAODHMPIDrings *AliAODEvent::GetHMPIDring(Int_t nRings) const |
08b38f3f | 1071 | { |
1072 | // | |
1073 | // If there is a list of HMPID rings in the given AOD event, return corresponding ring | |
1074 | // | |
1075 | if(fHMPIDrings) { | |
1076 | if( (AliAODHMPIDrings*)fHMPIDrings->UncheckedAt(nRings) ) { | |
1077 | return (AliAODHMPIDrings*)fHMPIDrings->UncheckedAt(nRings); | |
1078 | } | |
1079 | else return 0x0; | |
1080 | } | |
1081 | else return 0x0; | |
1082 | } | |
1083 | //------------------------------------------------------------ | |
9aa7ebff | 1084 | AliAODTrdTrack& AliAODEvent::AddTrdTrack(const AliVTrdTrack *track) { |
1085 | return *(new ((*fTrdTracks)[fTrdTracks->GetEntriesFast()]) AliAODTrdTrack(*track)); | |
1086 | } | |
d38034b8 | 1087 | |
1088 | //______________________________________________________________________________ | |
1089 | void AliAODEvent::ConnectTracks() { | |
1090 | // Connect tracks to this event | |
1091 | if (fTracksConnected || !fTracks || !fTracks->GetEntriesFast()) return; | |
4cd87297 | 1092 | AliAODTrack *track = 0; |
1093 | track = dynamic_cast<AliAODTrack*>(GetTrack(0)); | |
1094 | if(!track) { | |
541cfe93 | 1095 | AliWarning("Not an AliAODTrack, this is not a standard AOD"); |
1096 | return; | |
1097 | } | |
4cd87297 | 1098 | |
d38034b8 | 1099 | TIter next(fTracks); |
1100 | while ((track=(AliAODTrack*)next())) track->SetAODEvent(this); | |
1101 | fTracksConnected = kTRUE; | |
1102 | } | |
1103 | ||
15da855d | 1104 | AliVEvent::EDataLayoutType AliAODEvent::GetDataLayoutType() const {return AliVEvent::kAOD;} |
1105 |