RE: [ROOT] tree and streams

From: Philippe Canal (pcanal@fnal.gov)
Date: Mon Aug 18 2003 - 17:48:14 MEST


Hi,

> etree->Draw(tower); <--------------------This also works, 
> but when I want to put a cut like before root is complaining.

What kind of complain?  This should have worked with or without a cut.

>                rtree->GetBranch("info")->SetAddress(&info);

It would be better to use:
	
	rtree->SetBranchAddress("info",&info);

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of taylan yetkin
Sent: Monday, August 18, 2003 8:36 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] tree and streams


Hi Rooters,
I have a problem with my stream definitions in trees. Below you can see 
a part from my code.


while(!input_file.eof()){
                char run_no[20];
                int tower_no;
                input_file >> run_no >> tower_no;
                if (input_file.fail()) { break; }
                int elmfiber = tower_no - 1;
                int hadfiber = tower_no + 12;
                char s[256];
                char tower[256];
                strstream sstream(s, 256, ios::in | ios::out);
                sstream << "/reco/data/TB2003_JUL/" << run_no << ends;
                strstream sstream(tower,256,ios::in |ios::out);
                sstream << "towers[" << elmfiber << "].e+towers[" << 
hadfiber<< "].e" << ends;
         
                TFile f(s);
                TTree *rtree = (TTree *)f.Get("Run");
                RecoInfo    *info    = new RecoInfo();
                RecoRun     *run     = new RecoRun();
                RecoEvent   *event   = new RecoEvent();
                RecoTrigger *trigger = new RecoTrigger();
                RecoPhase   *phase   = new RecoPhase();
                RecoHCAL    *hcal    = new RecoHCAL();
                RecoCluster *cluster = new RecoCluster();

                rtree->GetBranch("info")->SetAddress(&info);
                rtree->GetBranch("run")->SetAddress(&run);

                TTree *etree = (TTree *)f.Get("Event");
                etree->GetBranch("event")->SetAddress(&event);
                etree->GetBranch("trigger")->SetAddress(&trigger);
                etree->GetBranch("phase")->SetAddress(&phase);
                etree->GetBranch("hcal")->SetAddress(&hcal);
   
              TCanvas *c1 = new TCanvas("c1","c1",20,10,900,600);

               c1->Divide(2,1);
               c1->cd(1);
               etree->Draw("c3x3.e","c3x3.e<5000");       
<---------------This works without any problem.

              c1->cd(2);
              etree->Draw(tower); <--------------------This also works, 
but when I want to put a cut like before root is complaining.



How can I use Draw() method with all options for this tower stream.



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:14 MET