Hi all, As I've outlined earlier http://www.rhic.bnl.gov/brahms/WWW/private/list_hyper/brahms-dev-l/1224.html http://root.cern.ch/root/roottalk/roottalk01/2567.html there was a problem in ROOT when using a TClonesArray object member (rather than a pointer to a TClonesArray object), as is done in BrMultRdo and BrTofRdo. This is now fixed in ROOT (head of CVS) thanks to Philippe Canal, and the fix is in the ROOT installed in /afs/rhic/opt/brahms/new. However, there is another problem that Erik discovered a week ago. If you try to read a file containing BrEvents, as written by BrEventIO using the BrFileTag::kTreeFile mode, and then want to extract the BrMultRdo or BrTofRdo objects and put them on a branch of a new TTree, then you'll read back something that is now right. In particular, members of the nested class of the same type will be mixed up. So for example the multiplicity and energy members of BrMultRdo::BrSingle and BrMultRdo::BrRing will be mixed up (within the each class though). Please note that this has no baring under the normal "modus operandi". To give you an explict example of how it fails, here's a short(uh?) script: 1 int tctest(const Char_t* inf="run002481.root", 2 const Char_t* outf="tree.root", 3 Int_t start=0, Int_t max=-1) 4 { 5 // Make an input module, set the file to read, and initialise 6 BrIOModule* io = new BrEventIO("io"); 7 io->SetIOMode(BrIOModule::kBrJobFile|BrIOModule::kBrReadFile); 8 io->SetVerbose(5); 9 io->AddFile(inf); 10 io->Init(); 11 io->Begin(); 12 13 // Check the input module 14 if (io->GetStatus() != BrModule::kOk) 15 return 1; 16 17 // Open file to store TTree on 18 TFile* file = new TFile(outf, "RECREATE"); 19 if (!file) { 20 cout << "Failed to open file: " << outf << endl; 21 return 1; 22 } 23 24 // Make the new tree 25 BrMultRdo* tmaRdo = 0; 26 TTree* tree = new TTree("T", "T"); 27 tree->Branch("TMA", "BrMultRdo", &tmaRdo); 28 29 // Loop over the events in the input file 30 Int_t i = -1; 31 while(kTRUE) { 32 i++; 33 if (i < start) 34 continue; 35 if (max >= 0 && i > start + max) 36 break; 37 if (i % 100 == 0) 38 cout << "Event # " << i << endl; 39 40 // Make two event object (d is a dummy and not used - 41 // waste of space) 42 BrEvent* e = new BrEvent("ev", 0, 0); 43 BrEvent* d = new BrEvent("ev", 0, 0); 44 45 // Read the event 46 io->Event((BrEventNode*)e, (BrEventNode*)d); 47 48 // Check for failures and so on 49 if (io->GetStatus() != BrModule::kOk) { 50 cout << "At end of read" << endl; 51 break; 52 } 53 54 // Get the TMA data from the event read 55 tmaRdo = (BrMultRdo*)e->GetObject("RdoMultTile"); 56 if (i == start || i == start + 1) 57 tmaRdo->Print("AIR"); 58 59 // Fill the new tree 60 tree->Fill(); 61 62 // Clean up 63 delete e; 64 delete d; 65 } 66 67 io->End(); 68 io->Finish(); 69 70 // Write the new file 71 file->Write(); 72 file->Close(); 73 74 return 0; 75 } What you'll see, is that the numbers printed out in line 57 are all wrong. Now the "funny" thing, is if you uncomment line 27, the numbers printed in line 57 are correct! You can also get a small example, not using BRAT classes, from http://cholm.home.cern.ch/cholm/root/foo-1.0.0.tar.gz I've send this example to the ROOT team, so I hope they will come up with some solution soon. The moral of all this: Don't try to do something like the above, until ROOT has fixed this problem. Yours, Christian ----------------------------------------------------------- Holm Christensen Phone: (+45) 35 35 96 91 Sankt Hansgade 23, 1. th. Office: (+45) 353 25 305 DK-2200 Copenhagen N Web: www.nbi.dk/~cholm Denmark Email: cholm@nbi.dk
This archive was generated by hypermail 2b30 : Thu Aug 09 2001 - 05:07:01 EDT