Hi Jens,
SetBranchStyle(0) forces the old ROOT style branches prior to 3.01.
SetBranchStyle(non zero value) sets the current default.
There is ABSOLUTLY NO REASON to select branch style 0 when
using ROOT versions 3.02 or 3.03
Rene Brun
On Mon, 14 Oct 2002, Jens Berger wrote:
> fixed the problem, when changing from splittlevel=1 to 99 and
> SetBranchStyle(0) to SetBranchStyle(99)... But Why?
>
> Jens
>
> On Mon, 14 Oct 2002, Jens Berger wrote:
>
> > Hi Roottalk,
> >
> > I have problems to read Trees w/ events (similar to the Event.cxx example)
> > using this code running linux ROOT 3.02.07:
> > ----------------------------------------------------------------------------
> > TROOT root("Analysis","Rich Analysis");
> >
> >
> > int main(int argc, char **argv)
> > {
> > root.Reset();
> >
> > TString inFileList;
> > TString outHistofile;
> > int nEvents=0;
> > int nFiles=0;
> >
> > if(argc > 1)
> > {
> > inFileList=argv[1];
> > outHistofile=argv[2];
> >
> > cout <<"dir:"<<inFileList<<" root:"<<outHistofile<<endl;
> > for (int k = 1; k < argc; k++)
> > {
> > int c = *++argv[k];
> >
> > switch(c)
> > {
> > case 'n':
> > k++;
> > nEvents = atoi(argv[k]);
> > printf("nr of events: %i\n",nEvents);
> > break;
> >
> > } // switch
> > } // for
> > }
> > else
> > {
> > printf ("usage: L3RICHTriggerEfficiency filelist.txt histo.root \n\n");
> > printf (" -n [Number of events(default:all)]\n");
> >
> > return 0;
> > }
> >
> >
> >
> > // Histograms
> > TH1F *hVz = new TH1F("hVz","Vertex z Pos",1000,-500,500);
> > TH2F *hVyVx = new TH2F("hVyVx","Vertex y vs. Vertex x
> > Pos",20,-10,10,20,-10,10);
> > TH1F *hVx = new TH1F("hVx","Vertex x Pos",50,-25,25);
> > TH1F *hVy = new TH1F("hVy","Vertex y Pos",50,-25,25);
> >
> >
> > TStopwatch timer;
> > timer.Start();
> >
> >
> > TChain *chain = new TChain("Tree");
> >
> > // Open the filelist and chain them
> > FILE *fp = fopen(inFileList.Data(),"r");
> > char* dataFile=new char[512] ;
> > Int_t nlines = 0;
> > Int_t ncols;
> > while(1)
> > {
> > if(nFiles){ if(nlines>nFiles) break; }
> > if( fscanf (fp, "%s", dataFile ) == EOF ) break ;
> > if (nlines<10 || nlines%10==0) printf("add %d: %s\n",nlines,dataFile);
> > chain->Add(dataFile);
> > nlines++;
> > }
> > printf(" found %d datafiles\n",nlines);
> > fclose(fp);
> >
> >
> > Event *event = new Event();
> >
> > chain->SetBranchAddress("Event",&event);
> > TClonesArray *primaries = event->GetfPrimaries();
> > TClonesArray *globals = event->GetfGlobals();
> > TClonesArray *l3globals = event->GetfL3Globals();
> >
> > Int_t nevent = chain->GetEntries();
> > cout<<"Tree has:"<<nevent<<endl;
> >
> > Int_t nb = 0;
> > for (Int_t eventCnt=0;eventCnt<nevent;eventCnt++)
> > {
> > printf("Tree -> Event:%d\n",eventCnt);
> >
> > chain->GetEntry(eventCnt); //read complete event in
> > memory
> > cout<<"primaries:" << primaries->GetEntries() << endl;
> > float VertexZ=event->GetVertexZ();
> > cout<<"Vertex z:"<<VertexZ<<endl;
> >
> > for(int glcnt=0;glcnt<primaries->GetEntries();glcnt++)
> > {
> > cout<<"pt "<<((RTrack*)primaries->At(glcnt))->GetPt()<<endl;
> > }
> > hVz->Fill(VertexZ);
> >
> > event->ClearTracks();
> > }
> >
> > cout << "llop finished!"<<endl;
> >
> > ----------------------------------------------------------------------------
> >
> >
> > The application crashes after the first event:
> >
> > ----------------------------------------------------------------------------
> > [play10] ~/<3>RICHAna/root/bin/L3RICHTriggerEfficiency/>
> > ./L3RICHTriggerEfficiency testfiles.txt histo.root
> > dir:testfiles.txt root:histo.root
> > add 0: ./testfiles/st_physics_2318025_raw_0001.tree.root
> > add 1: ./testfiles/st_physics_2318025_raw_0002.tree.root
> > add 2: ./testfiles/st_physics_2318025_raw_0003.tree.root
> > add 3: ./testfiles/st_physics_2318025_raw_0004.tree.root
> > add 4: ./testfiles/st_physics_2318025_raw_0005.tree.root
> > add 5: ./testfiles/st_physics_2318025_raw_0006.tree.root
> > add 6: ./testfiles/st_physics_2318025_raw_0007.tree.root
> > add 7: ./testfiles/st_physics_2318025_raw_0008.tree.root
> > add 8: ./testfiles/st_physics_2318025_raw_0009.tree.root
> > found 9 datafiles
> > Tree has:619
> > Tree -> Event:0
> > primaries:6
> > Vertex z:-19.1568
> > pt 0.668843
> > pt 0.546642
> > pt 1.2964
> > pt 0.682589
> > pt 2.09051
> > pt 0.755654
> > Tree -> Event:1
> > primaries:5
> > Vertex z:6.6122
> > pt 1.30538
> > pt 0.619923
> > pt 0.658819
> > pt 0.937802
> > pt 0.784645
> > Tree -> Event:2
> >
> > ......
> > Tree -> Event:71
> >
> > *** Break *** segmentation violation
> > Abort
> > [play10] ~/<3>RICHAna/root/bin/L3RICHTriggerEfficiency/>
> > ----------------------------------------------------------------------------
> >
> > You can find the main.C at:
> > http://www.star.bnl.gov/~jberger/tmp/RICHAna/root/bin/L3RICHTriggerEfficiency/
> >
> > and the libs at:
> > http://www.star.bnl.gov/~jberger/tmp/RICHAna/root/lib/RICHAnaTree/
> >
> > the events:
> > http://www.star.bnl.gov/~jberger/tmp/RICHAna/root/bin/L3RICHTriggerEfficiency/testfiles/*.root
> >
> > The events have been created with:
> > http://www.star.bnl.gov/~jberger/tmp/RICHAna/v2P02gc/RICHAna/StRoot/StRichSpectraTupMaker/StRichSpectraTupMaker.cxx,
> > StRichSpectraTupMaker.h
> >
> >
> > Thanks, Jens.
> >
> >
> > ----------------------------------------------------------------------
> > Jens Berger email IKF : jberger@ikf.uni-frankfurt.de
> > email BNL : jberger@bnl.gov
> > ----------------------------------------------------------------------
> > Institut Kernphysik Frankfurt (IKF):
> > August-Euler-Str. 06 office phone: +49-(0)69-798-24254
> > 60486 Frankfurt/Main FRG office fax : +49-(0)69-798-24212
> > ----------------------------------------------------------------------
> > Brookhaven National Laboratory (BNL):
> > Physics Department
> > c/o STAR Group
> > Building 510A office phone: +1-(1)631-344-8336
> > Upton, New York 11973 office fax : +1-(1)631-344-4206
> > ----------------------------------------------------------------------
> >
> >
>
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:14 MET