AliAODEvent: corrected copy constructor and assignment operator. This do not work...
[u/mrichter/AliRoot.git] / STEER / AliAODEvent.cxx
CommitLineData
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"
33
34ClassImp(AliAODEvent)
35
08e4c457 36// definition of std AOD member names
37 const char* AliAODEvent::fAODListName[kAODListN] = {"header",
38 "tracks",
39 "vertices",
3dd9f9e3 40 "v0s",
9a244178 41 "cascades",
3dd9f9e3 42 "tracklets",
08e4c457 43 "jets",
37792174 44 "emcalCells",
45 "phosCells",
3dd9f9e3 46 "caloClusters",
47 "fmdClusters",
48 "pmdClusters"
9a244178 49
3dd9f9e3 50};
df9db588 51//______________________________________________________________________________
52AliAODEvent::AliAODEvent() :
08e4c457 53 AliVEvent(),
df9db588 54 fAODObjects(new TList()),
5c1dc41f 55 fAODFolder(0),
dd389a30 56 fConnected(kFALSE),
ec4af4c1 57 fHeader(0),
58 fTracks(0),
59 fVertices(0),
3dd9f9e3 60 fV0s(0),
9a244178 61 fCascades(0),
3dd9f9e3 62 fTracklets(0),
821f8f1d 63 fJets(0),
37792174 64 fEmcalCells(0),
65 fPhosCells(0),
3dd9f9e3 66 fCaloClusters(0),
67 fFmdClusters(0),
68 fPmdClusters(0)
df9db588 69{
70 // default constructor
71}
72
73//______________________________________________________________________________
5c1dc41f 74AliAODEvent::AliAODEvent(const AliAODEvent& aod):
75 AliVEvent(aod),
76 fAODObjects(new TList()),
77 fAODFolder(new TFolder()),
dd389a30 78 fConnected(kFALSE),
5c1dc41f 79 fHeader(new AliAODHeader(*aod.fHeader)),
80 fTracks(new TClonesArray(*aod.fTracks)),
81 fVertices(new TClonesArray(*aod.fVertices)),
82 fV0s(new TClonesArray(*aod.fV0s)),
9a244178 83 fCascades(new TClonesArray(*aod.fCascades)),
5c1dc41f 84 fTracklets(new AliAODTracklets(*aod.fTracklets)),
85 fJets(new TClonesArray(*aod.fJets)),
86 fEmcalCells(new AliAODCaloCells(*aod.fEmcalCells)),
87 fPhosCells(new AliAODCaloCells(*aod.fPhosCells)),
88 fCaloClusters(new TClonesArray(*aod.fCaloClusters)),
89 fFmdClusters(new TClonesArray(*aod.fFmdClusters)),
90 fPmdClusters(new TClonesArray(*aod.fPmdClusters))
91{
92 // Copy constructor
93 AddObject(fHeader);
94 AddObject(fTracks);
95 AddObject(fVertices);
96 AddObject(fV0s);
9a244178 97 AddObject(fCascades);
5c1dc41f 98 AddObject(fTracklets);
99 AddObject(fJets);
100 AddObject(fEmcalCells);
101 AddObject(fPhosCells);
102 AddObject(fCaloClusters);
103 AddObject(fFmdClusters);
104 AddObject(fPmdClusters);
dd389a30 105 fConnected = aod.fConnected;
5c1dc41f 106 GetStdContent();
48f1c230 107 CreateStdFolders();
5c1dc41f 108}
109
110//______________________________________________________________________________
111AliAODEvent & AliAODEvent::operator=(const AliAODEvent& aod) {
112
113 // Assignment operator
114
48f1c230 115 if(&aod == this) return *this;
116 AliVEvent::operator=(aod);
5c1dc41f 117
48f1c230 118 // This assumes that the list is already created
119 // and that the virtual void Copy(Tobject&) function
120 // is correctly implemented in the derived class
121 // otherwise only TObject::Copy() will be used
122
123 if((fAODObjects->GetSize()==0)&&(aod.fAODObjects->GetSize()>=kAODListN)){
124 // We cover the case that we do not yet have the
125 // standard content but the source has it
126 CreateStdContent();
127 }
128
129 // Here we have the standard content without user additions, but the content is
130 // not matching the aod source.
131
132 // Iterate the list of source objects
133 TIter next(aod.GetList());
134 TObject *its = 0;
135 TString name;
136 while ((its = next())) {
137 name = its->GetName();
138 // Check if we have this object type in out list
139 TObject *mine = fAODObjects->FindObject(name);
140 if(!mine) {
141 // We have to create the same type of object.
142 TClass* pClass=TClass::GetClass(its->ClassName());
143 if (!pClass) {
144 AliWarning(Form("Can not find class description for entry %s (%s)\n",
145 its->ClassName(), name.Data()));
146 continue;
147 }
148 mine=(TObject*)pClass->New();
149 if(!mine){
150 // not in this: can be added to list
151 AliWarning(Form("%s:%d Could not find %s for copying \n",
152 (char*)__FILE__,__LINE__,name.Data()));
153 continue;
154 }
155 if(mine->InheritsFrom("TNamed")) {
156 ((TNamed*)mine)->SetName(name);
157 } else if(mine->InheritsFrom("TCollection")){
158 if(mine->InheritsFrom("TClonesArray")) {
159 TClonesArray *itscl = dynamic_cast<TClonesArray*>(its);
160 if (!itscl) {
161 AliWarning(Form("Class description for entry %s (%s) not TClonesArray\n",
162 its->ClassName(), name.Data()));
163 continue;
164
165 }
166 dynamic_cast<TClonesArray*>(mine)->SetClass(itscl->GetClass(), itscl->GetSize());
167 }
168 dynamic_cast<TCollection*>(mine)->SetName(name);
169 }
170 AliDebug(1, Form("adding object %s of type %s", mine->GetName(), mine->ClassName()));
171 AddObject(mine);
172 }
173 // Now we have an object of the same type and name, but different content.
174 if(!its->InheritsFrom("TCollection")){
175 // simple objects (do they have a Copy method that calls operator= ?)
176 its->Copy(*mine);
177 } else if (its->InheritsFrom("TClonesArray")) {
178 // Create or expand the tclonesarray pointers
179 // so we can directly copy to the object
180 TClonesArray *its_tca = (TClonesArray*)its;
181 TClonesArray *mine_tca = (TClonesArray*)mine;
182 // this leaves the capacity of the TClonesArray the same
183 // except for a factor of 2 increase when size > capacity
184 // does not release any memory occupied by the tca
185 Int_t its_entries = its_tca->GetEntriesFast();
186 mine_tca->ExpandCreate(its_entries);
187 for(int i=0; i<its_entries; i++){
188 // copy
189 TObject *mine_tca_obj = mine_tca->At(i);
190 TObject *its_tca_obj = its_tca->At(i);
191 // no need to delete first
192 // pointers within the class should be handled by Copy()...
193 // Can there be Empty slots?
194 its_tca_obj->Copy(*mine_tca_obj);
195 }
196 } else {
197 AliWarning(Form("%s:%d cannot copy TCollection \n",
198 (char*)__FILE__,__LINE__));
199 }
200 }
201 fConnected = aod.fConnected;
202 return *this;
5c1dc41f 203}
204
205
206//______________________________________________________________________________
df9db588 207AliAODEvent::~AliAODEvent()
208{
ec4af4c1 209// destructor
dd389a30 210 if(fAODObjects&&!fConnected)
211 {
212 delete fAODObjects;
213 fAODObjects = 0;
214 }
215
5c1dc41f 216 delete fAODFolder;
df9db588 217}
218
219//______________________________________________________________________________
220void AliAODEvent::AddObject(TObject* obj)
221{
4b3de353 222 // Add an object to the list of objects.
df9db588 223 // Please be aware that in order to increase performance you should
224 // refrain from using TObjArrays (if possible). Use TClonesArrays, instead.
225
226 fAODObjects->AddLast(obj);
227}
228
229//______________________________________________________________________________
4b3de353 230void AliAODEvent::RemoveObject(TObject* obj)
231{
232 // Removes an object from the list of objects.
233
234 fAODObjects->Remove(obj);
235}
236
237//______________________________________________________________________________
08e4c457 238TObject *AliAODEvent::FindListObject(const char *objName)
df9db588 239{
240 // Return the pointer to the object with the given name.
241
242 return fAODObjects->FindObject(objName);
243}
244
245//______________________________________________________________________________
246void AliAODEvent::CreateStdContent()
247{
248 // create the standard AOD content and set pointers
249
250 // create standard objects and add them to the TList of objects
251 AddObject(new AliAODHeader());
252 AddObject(new TClonesArray("AliAODTrack", 0));
253 AddObject(new TClonesArray("AliAODVertex", 0));
3dd9f9e3 254 AddObject(new TClonesArray("AliAODv0", 0));
9a244178 255 AddObject(new TClonesArray("AliAODcascade", 0));
821f8f1d 256 AddObject(new AliAODTracklets());
3dd9f9e3 257 AddObject(new TClonesArray("AliAODJet", 0));
258 AddObject(new AliAODCaloCells());
37792174 259 AddObject(new AliAODCaloCells());
3dd9f9e3 260 AddObject(new TClonesArray("AliAODCaloCluster", 0));
261 AddObject(new TClonesArray("AliAODFmdCluster", 0));
262 AddObject(new TClonesArray("AliAODPmdCluster", 0));
08e4c457 263 // set names
264 SetStdNames();
265
df9db588 266 // read back pointers
267 GetStdContent();
5c1dc41f 268 CreateStdFolders();
08e4c457 269 return;
df9db588 270}
271
c8e4f399 272void AliAODEvent::MakeEntriesReferencable()
273{
274 // Make all entries referencable in a subsequent process
275 //
276 TIter next(fAODObjects);
277 TObject* obj;
8ac4fa64 278 while ((obj = next()))
c8e4f399 279 {
280 if(obj->InheritsFrom("TCollection"))
281 {
282 AssignIDtoCollection((TCollection*)obj);
283 }
284 }
285}
286
df9db588 287//______________________________________________________________________________
08e4c457 288void AliAODEvent::SetStdNames()
289{
290 // introduce the standard naming
291
292 if(fAODObjects->GetEntries()==kAODListN){
293 for(int i = 0;i < fAODObjects->GetEntries();i++){
294 TObject *fObj = fAODObjects->At(i);
295 if(fObj->InheritsFrom("TNamed")){
296 ((TNamed*)fObj)->SetName(fAODListName[i]);
297 }
298 else if(fObj->InheritsFrom("TClonesArray")){
299 ((TClonesArray*)fObj)->SetName(fAODListName[i]);
300 }
301 }
302 }
303 else{
304 printf("%s:%d SetStdNames() Wrong number of Std Entries \n",(char*)__FILE__,__LINE__);
305 }
306}
307
5c1dc41f 308void AliAODEvent::CreateStdFolders()
309{
310 // Create the standard folder structure
311 fAODFolder = gROOT->GetRootFolder()->AddFolder("AOD", "AOD");
312 if(fAODObjects->GetEntries()==kAODListN){
313 for(int i = 0;i < fAODObjects->GetEntries();i++){
314 TObject *fObj = fAODObjects->At(i);
315 if(fObj->InheritsFrom("TClonesArray")){
316 fAODFolder->AddFolder(fAODListName[i], fAODListName[i], (TCollection*) fObj);
317 } else {
318 fAODFolder->AddFolder(fAODListName[i], fAODListName[i], 0);
319 }
320 }
321 }
322 else{
323 printf("%s:%d CreateStdFolders() Wrong number of Std Entries \n",(char*)__FILE__,__LINE__);
324 }
325}
326
08e4c457 327//______________________________________________________________________________
ec4af4c1 328void AliAODEvent::GetStdContent()
df9db588 329{
330 // set pointers for standard content
331
3dd9f9e3 332 fHeader = (AliAODHeader*)fAODObjects->FindObject("header");
333 fTracks = (TClonesArray*)fAODObjects->FindObject("tracks");
334 fVertices = (TClonesArray*)fAODObjects->FindObject("vertices");
335 fV0s = (TClonesArray*)fAODObjects->FindObject("v0s");
9a244178 336 fCascades = (TClonesArray*)fAODObjects->FindObject("cascades");
3dd9f9e3 337 fTracklets = (AliAODTracklets*)fAODObjects->FindObject("tracklets");
338 fJets = (TClonesArray*)fAODObjects->FindObject("jets");
37792174 339 fEmcalCells = (AliAODCaloCells*)fAODObjects->FindObject("emcalCells");
340 fPhosCells = (AliAODCaloCells*)fAODObjects->FindObject("phosCells");
3dd9f9e3 341 fCaloClusters = (TClonesArray*)fAODObjects->FindObject("caloClusters");
342 fFmdClusters = (TClonesArray*)fAODObjects->FindObject("fmdClusters");
343 fPmdClusters = (TClonesArray*)fAODObjects->FindObject("pmdClusters");
df9db588 344}
345
346//______________________________________________________________________________
3dd9f9e3 347void AliAODEvent::ResetStd(Int_t trkArrSize,
348 Int_t vtxArrSize,
9a244178 349 Int_t v0ArrSize,
350 Int_t cascadeArrSize,
3dd9f9e3 351 Int_t jetSize,
352 Int_t caloClusSize,
353 Int_t fmdClusSize,
9a244178 354 Int_t pmdClusSize
355 )
df9db588 356{
3dd9f9e3 357 // deletes content of standard arrays and resets size
9a244178 358
df9db588 359 fTracks->Delete();
360 if (trkArrSize > fTracks->GetSize())
361 fTracks->Expand(trkArrSize);
362
363 fVertices->Delete();
364 if (vtxArrSize > fVertices->GetSize())
365 fVertices->Expand(vtxArrSize);
9a244178 366
3dd9f9e3 367 fV0s->Delete();
368 if (v0ArrSize > fV0s->GetSize())
369 fV0s->Expand(v0ArrSize);
9a244178 370
371 fCascades->Delete();
372 if (cascadeArrSize > fCascades->GetSize())
373 fCascades->Expand(cascadeArrSize);
374
3dd9f9e3 375 fJets->Delete();
9a244178 376 if (jetSize > fJets->GetSize())
3dd9f9e3 377 fJets->Expand(jetSize);
378
379 fCaloClusters->Delete();
380 if (caloClusSize > fCaloClusters->GetSize())
381 fCaloClusters->Expand(caloClusSize);
382
383 fFmdClusters->Delete();
384 if (fmdClusSize > fFmdClusters->GetSize())
385 fFmdClusters->Expand(fmdClusSize);
386
387 fPmdClusters->Delete();
388 if (pmdClusSize > fPmdClusters->GetSize())
389 fPmdClusters->Expand(pmdClusSize);
6989bff3 390
391 // Reset the tracklets
392 fTracklets->DeleteContainer();
393 fPhosCells->DeleteContainer();
394 fEmcalCells->DeleteContainer();
395
df9db588 396}
397
ec4af4c1 398void AliAODEvent::ClearStd()
399{
400 // clears the standard arrays
d8f5fda5 401 fHeader ->RemoveQTheta();
402 fTracks ->Delete();
403 fVertices ->Delete();
404 fV0s ->Delete();
9a244178 405 fCascades ->Delete();
3dd9f9e3 406 fTracklets ->DeleteContainer();
1c37410a 407 fJets ->Delete();
37792174 408 fEmcalCells ->DeleteContainer();
409 fPhosCells ->DeleteContainer();
d8f5fda5 410 fCaloClusters ->Delete();
37792174 411 fFmdClusters ->Clear();
412 fPmdClusters ->Clear();
ec4af4c1 413}
414
78902954 415//_________________________________________________________________
416Int_t AliAODEvent::GetPHOSClusters(TRefArray *clusters) const
417{
418 // fills the provided TRefArray with all found phos clusters
419
420 clusters->Clear();
421
422 AliAODCaloCluster *cl = 0;
a0df0b6a 423 Bool_t first = kTRUE;
78902954 424 for (Int_t i = 0; i < GetNCaloClusters() ; i++) {
78902954 425 if ( (cl = GetCaloCluster(i)) ) {
426 if (cl->IsPHOSCluster()){
a0df0b6a 427 if(first) {
428 new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl));
429 first=kFALSE;
430 }
78902954 431 clusters->Add(cl);
a0df0b6a 432 //printf("IsPHOS cluster %d, E %2.3f Size: %d \n",i,cl->E(),clusters->GetEntriesFast());
78902954 433 }
434 }
435 }
436 return clusters->GetEntriesFast();
437}
438
439//_________________________________________________________________
440Int_t AliAODEvent::GetEMCALClusters(TRefArray *clusters) const
441{
442 // fills the provided TRefArray with all found emcal clusters
443
444 clusters->Clear();
78902954 445 AliAODCaloCluster *cl = 0;
a0df0b6a 446 Bool_t first = kTRUE;
78902954 447 for (Int_t i = 0; i < GetNCaloClusters(); i++) {
78902954 448 if ( (cl = GetCaloCluster(i)) ) {
449 if (cl->IsEMCALCluster()){
a0df0b6a 450 if(first) {
451 new (clusters) TRefArray(TProcessID::GetProcessWithUID(cl));
452 first=kFALSE;
453 }
78902954 454 clusters->Add(cl);
a0df0b6a 455 //printf("IsEMCal cluster %d, E %2.3f Size: %d \n",i,cl->E(),clusters->GetEntriesFast());
78902954 456 }
457 }
458 }
459 return clusters->GetEntriesFast();
460}
461
462
fb41236c 463//______________________________________________________________________________
464Int_t AliAODEvent::GetMuonTracks(TRefArray *muonTracks) const
465{
466 // fills the provided TRefArray with all found muon tracks
df9db588 467
fb41236c 468 muonTracks->Clear();
df9db588 469
fb41236c 470 AliAODTrack *track = 0;
471 for (Int_t iTrack = 0; iTrack < GetNTracks(); iTrack++) {
08e4c457 472 if ((track = GetTrack(iTrack))->IsMuonTrack()) {
fb41236c 473 muonTracks->Add(track);
474 }
475 }
476
3dd9f9e3 477 return muonTracks->GetEntriesFast();
fb41236c 478}
ec4af4c1 479
480
3b93c32a 481void AliAODEvent::ReadFromTree(TTree *tree, Option_t* opt /*= ""*/)
8ff33247 482{
3b93c32a 483 // Connects aod event to tree
08e4c457 484
61cb38c7 485 if(!tree){
486 Printf("%s %d AliAODEvent::ReadFromTree() Zero Pointer to Tree \n",(char*)__FILE__,__LINE__);
487 return;
488 }
08e4c457 489 // load the TTree
61cb38c7 490 if(!tree->GetTree())tree->LoadTree(0);
491
492 // Try to find AliAODEvent
493 AliAODEvent *aodEvent = 0;
494 aodEvent = (AliAODEvent*)tree->GetTree()->GetUserInfo()->FindObject("AliAODEvent");
495 if(aodEvent){
496 // Check if already connected to tree
497 TList* connectedList = (TList*) (tree->GetUserInfo()->FindObject("AODObjectsConnectedToTree"));
3b93c32a 498 if (connectedList && (strcmp(opt, "reconnect"))) {
d8f5fda5 499 // If connected use the connected list of objects
3b93c32a 500 fAODObjects->Delete();
501 fAODObjects = connectedList;
502 GetStdContent();
dd389a30 503 fConnected = kTRUE;
3b93c32a 504 return;
d8f5fda5 505 }
61cb38c7 506 // Connect to tree
507 // prevent a memory leak when reading back the TList
383a295a 508 // if (!(strcmp(opt, "reconnect"))) fAODObjects->Delete();
316cf4cc 509
61cb38c7 510 // create a new TList from the UserInfo TList...
511 // copy constructor does not work...
512 fAODObjects = (TList*)(aodEvent->GetList()->Clone());
316cf4cc 513 fAODObjects->SetOwner(kTRUE);
61cb38c7 514 if(fAODObjects->GetEntries()<kAODListN){
515 printf("%s %d AliAODEvent::ReadFromTree() TList contains less than the standard contents %d < %d \n",
516 (char*)__FILE__,__LINE__,fAODObjects->GetEntries(),kAODListN);
517 }
298d3d58 518 //
519 // Let's find out whether we have friends
ced57103 520 TList* friendL = tree->GetTree()->GetListOfFriends();
298d3d58 521 if (friendL)
522 {
523 TIter next(friendL);
524 TFriendElement* fe;
525 while ((fe = (TFriendElement*)next())){
526 aodEvent = (AliAODEvent*)(fe->GetTree()->GetUserInfo()->FindObject("AliAODEvent"));
527 if (!aodEvent) {
528 printf("No UserInfo on tree \n");
529 } else {
530
531 TList* objL = (TList*)(aodEvent->GetList()->Clone());
532 printf("Get list of object from tree %d !!\n", objL->GetEntries());
533 TIter nextobject(objL);
534 TObject* obj = 0;
8ac4fa64 535 while((obj = nextobject()))
298d3d58 536 {
537 printf("Adding object from friend %s !\n", obj->GetName());
538 fAODObjects->Add(obj);
539 } // object "branch" loop
540 } // has userinfo
541 } // friend loop
542 } // has friends
543
544
545// set the branch addresses
61cb38c7 546 TIter next(fAODObjects);
547 TNamed *el;
548 while((el=(TNamed*)next())){
549 TString bname(el->GetName());
550 // check if branch exists under this Name
ced57103 551 TBranch *br = tree->GetTree()->GetBranch(bname.Data());
61cb38c7 552 if(br){
553 tree->SetBranchAddress(bname.Data(),fAODObjects->GetObjectRef(el));
ced57103 554 } else {
298d3d58 555 br = tree->GetBranch(Form("%s.",bname.Data()));
556 if(br){
557 tree->SetBranchAddress(Form("%s.",bname.Data()),fAODObjects->GetObjectRef(el));
558 }
559 else{
560 printf("%s %d AliAODEvent::ReadFromTree() No Branch found with Name %s. \n",
561 (char*)__FILE__,__LINE__,bname.Data());
562 }
61cb38c7 563 }
564 }
61cb38c7 565 GetStdContent();
566 // when reading back we are not owner of the list
567 // must not delete it
316cf4cc 568 fAODObjects->SetOwner(kTRUE);
61cb38c7 569 fAODObjects->SetName("AODObjectsConnectedToTree");
570 // we are not owner of the list objects
571 // must not delete it
572 tree->GetUserInfo()->Add(fAODObjects);
dd389a30 573 fConnected = kTRUE;
61cb38c7 574 }// no aodEvent
575 else {
576 // we can't get the list from the user data, create standard content
577 // and set it by hand
578 CreateStdContent();
579 TIter next(fAODObjects);
580 TNamed *el;
581 while((el=(TNamed*)next())){
582 TString bname(el->GetName());
583 tree->SetBranchAddress(bname.Data(),fAODObjects->GetObjectRef(el));
584 }
585 GetStdContent();
586 // when reading back we are not owner of the list
587 // must not delete it
316cf4cc 588 fAODObjects->SetOwner(kTRUE);
08e4c457 589 }
8ff33247 590}
591
08e4c457 592//______________________________________________________________________________
593void AliAODEvent::Print(Option_t *) const
594{
4922c144 595 // Print the names of the all branches
596 TIter next(fAODObjects);
597 TNamed *el;
598 Printf(">>>>> AOD Content <<<<<");
599 while((el=(TNamed*)next())){
600 Printf(">> %s ",el->GetName());
601 }
602 Printf(">>>>> <<<<<");
08e4c457 603
604 return;
605}
c8e4f399 606
607void AliAODEvent::AssignIDtoCollection(TCollection* col)
608{
609 // Static method which assigns a ID to each object in a collection
610 // In this way the objects are marked as referenced and written with
611 // an ID. This has the advantage that TRefs to this objects can be
612 // written by a subsequent process.
613 TIter next(col);
614 TObject* obj;
8ac4fa64 615 while ((obj = next()))
c8e4f399 616 TProcessID::AssignID(obj);
617}