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