Dear Rene, I create the object pointed by fndhdt in the loop. This is the code: cout << "create HDT" << endl; fndhdt = new TFndHdt(ec); cout << "header " << endl; fndrdt->HdrTree(fndhdt,fndfeemap); cout << "Trigger " << endl; if(eflg[0]) fndrdt->GtsTree(fndhdt,fndfeemap); cout << "TOF " << endl; if(eflg[1]) fndrdt->TofTree(fndhdt,fndfeemap); cout << "ISM " << endl; if(eflg[2]) fndrdt->IsmTree(fndhdt,fndfeemap); cout << "OSM " << endl; if(eflg[3]) fndrdt->OsmTree(fndhdt,fndfeemap); cout << "LMD " << endl; if(eflg[4]) fndrdt->LmdTree(fndhdt,fndfeemap); cout << "STB " << endl; if(eflg[5]) fndrdt->StbTree(fndhdt,fndfeemap); Int_t nhtof = fndhdt->GetNHTof(); Int_t nhsil = fndhdt->GetNHSil(); Int_t nhlmd = fndhdt->GetNHLmd(); Int_t nhstb = fndhdt->GetNHStb(); Int_t nhtot = fndhdt->GetNHTot(); cout << nhtot << " hits in event " << ec << ": "; cout << nhsil << " sil_hits, " << nhtof << " tof_hits, " << nhlmd << " lmd_hits, " << nhstb << " stb_hits" << endl; fndhdt->PrintHits(); if(nhtot > 0) cout << "fill HDT tree" << endl; hdtt->Fill(); delete fndrdt; delete fndhdt; if(!(ec%(TFndConst::kCHECK/kSCALE))) { cout << "store on output file at event " << ec << endl; hdtt->Print(); hdtt->Write(); rdtt->Write(); of->cd(); of->Purge(); } fndrdt is a pointer to the RAW event, fndfeemap to the Database tables. the *Tree functions elaborate the RAW event and build a piece of the fndhdt each. I already looked at the example you mention; it looks the same thing I do. The output diagnostic is the following: store on output file at event 250 ****************************************************************************** *Tree :F : FINUDA HDT tree * *Entries : 249 : Total Size = 125848 bytes File Size = 17372 * * : : Tree compression factor = 7.24 * ****************************************************************************** *Branch :fndhdt : fndhdt * *Entries : 249 : BranchObject (see below) * *............................................................................... ...* *Branch :fNevt : fNevt * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fHSil : fHSil * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fHTof : fHTof * *Entries : 249 : Total Size = 63201 bytes File Size = 7635 * *Baskets : 1 : Basket Size = 64000 bytes Compression= 8.28 * *............................................................................* *Branch :fHLmd : fHLmd * *Entries : 249 : Total Size = 62647 bytes File Size = 9737 * *Baskets : 1 : Basket Size = 64000 bytes Compression= 6.43 * *............................................................................* *Branch :fHStb : fHStb * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fHHdr : fHHdr * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fcrb : fcrb * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fTrig : fTrig * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fNHTot : fNHTot * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fNHSil : fNHSil * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fNHTof : fNHTof * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fNHLmd : fNHLmd * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fNHStb : fNHStb * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fUniqueID : fUniqueID * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* *Branch :fBits : fBits * *Entries : 249 : Total Size = 0 bytes File Size = 0 * *Baskets : 0 : Basket Size = 64000 bytes Compression= 1.00 * *............................................................................* and the object pointed by fndhdt is described by the class: #ifndef FIN_FndHdt #define FIN_FndHdt //____________________________________________________________________ // // TFndHdt // // This class gives the Description of the Hit Data Tape event: // it contains a set of pointers to Arrays of hit objects for // different detectors, a pointer to a Header object, a pointer // to the Corbo equipment object and a set of integers giving // the number of hits for each detector and the total number of hits // #include "TObject.h" #include "TObjArray.h" #include "TFndCorbo.h" #include "TFndTrig.h" #include "TFndHHdr.h" #include "TFndHSil.h" #include "TFndHTof.h" #include "TFndHLmd.h" #include "TFndHStb.h" class TFndHdt : public TObject { private: Int_t fNevt; // Event Number TObjArray *fHSil; // Pointer to the array of Silicon Hits TObjArray *fHTof; // Pointer to the array of Time of Flight Hits TObjArray *fHLmd; // Pointer to the array of Drift Chamber Hits TObjArray *fHStb; // Pointer to the array of Straw Tubes Hits TFndHHdr *fHHdr; // Pointer to the Event Header TFndCorbo *fcrb; // Pointer to GTS Corbo TFndTrig *fTrig; // Pointer to Finuda Trigger Int_t fNHTot; // Total Number of Hits in the Event Int_t fNHSil; // Number of Hits on the Silicon Detector Int_t fNHTof; // Number of Hits on the Time of Flight Detector Int_t fNHLmd; // Number of Hits on the Drift Chambers Int_t fNHStb; // Number of Hits on the Straw Tubes public: TFndHdt(Int_t nevt=0); ~TFndHdt(); Int_t GetNHTof() const { return fNHTof; } // Get Number of Tof Hits Int_t GetNHSil() const { return fNHSil; } // Get Number of Sil Hits Int_t GetNHLmd() const { return fNHLmd; } // Get Number of Lmd Hits Int_t GetNHStb() const { return fNHStb; } // Get Number of Stb Hits Int_t GetNHTot() const { return fNHTot; } // Get Total Number of Hits void AddHdr(TFndHHdr *hdr) { fHHdr = hdr; } // Append Header to HDT TFndHHdr *GetHdr() { return fHHdr; } // Get Header from HDT void AddHit(TFndHSil *hit) { fHSil->Add(hit); fNHSil++; fNHTot++;} // Append Sil Hit to HDT TFndHSil *GetHSil(Int_t n) { return ((TFndHSil*) fHSil->At(n)); } // Get n-th Sil Hit from HDT void AddHit(TFndHTof *hit) { fHTof->Add(hit); fNHTof++; fNHTot++;} // Append Tof Hit to HDT TFndHTof *GetHTof(Int_t n) { return ((TFndHTof*) fHTof->At(n)); } // Get n-th Tof Hit from HDT void AddHit(TFndHLmd *hit) { fHLmd->Add(hit); fNHLmd++; fNHTot++;} // Append Lmd Hit to HDT TFndHLmd *GetHLmd(Int_t n) { return ((TFndHLmd*) fHLmd->At(n)); } // Get n-th Lmd Hit from HDT void AddHit(TFndHStb *hit) { fHStb->Add(hit); fNHStb++; fNHTot++;} // Append Stb Hit to HDT TFndHStb *GetHStb(Int_t n) { return ((TFndHStb*) fHStb->At(n)); } // Get n-th Stb Hit from HDT void AddCrb(TFndCorbo *fcorbo) { fcrb = fcorbo;} // Append Corbo to HDT TFndCorbo *GetCorbo() { return fcrb;} // Get Corbo from HDT void AddTrg(TFndTrig *ftrg) { fTrig = ftrg;} // Append Trigger to HDT TFndTrig *GetTrig() { return fTrig; } // Get Trigger pointer void PrintHits(); // Print Hits void DrawHits(); // Draw Hits ClassDef(TFndHdt,2) // The "Hit Data Tape" }; #endif Thanks, Piergiorgio On Thu, 2 Jul 1998, Rene Brun wrote: > Piergiorgio Cerello wrote: > > > > Dear Rooters, > > > > I'm trying to automatically split a Tree with the option Splitlevel. > > The code runs, but I get an empty file as output... so, I'm wrong > > somewhere. Please help me to understand where! Here is the code: > > > > TTree *hdtt = new TTree("F","FINUDA HDT tree"); > > hdtt->SetAutoSave(10000000); // autosave when 10 Mbytes written > > > > .... > > > > TFndHdt *fndhdt; > > TBranch *b=0; > > Int_t bsize = 64000; > > Int_t split = 1; > > if (b) > > b->SetAddress(fndhdt); > > else > > b = hdtt->Branch("fndhdt","TFndHdt",&fndhdt,bsize,split); > > > > ........ (the fndhdt object is built) > > > > hdtt->Fill(); // within a loop on events > > > > ........ > > > > hdtt->Write(); // every 250 events and at end of run > > > > Thanks in advance, > > > > Piergiorgio, > To answer your mail, I need a bit more info. Where do you create > the object pointed by fndhdt? > > Look at $ROOTSYS/test/Event for an example. > > Rene Brun >
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:34 MET