RE: Filling a calibrated histogram

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Wed, 19 Jul 2006 12:01:57 -0500


Hi,

You could use TTree::SetBranchStatus to disable each of the branches that you not reading. Alternatively, if you have a proper prointer to the needed branch (See for example the result TTree::MakeSelector or TTree::MakeClass).
You just read those branches.
Cheers,
Philippe

-----Original Message-----
From: owner-roottalk_at_pcroot.cern.ch [mailto:owner-roottalk_at_pcroot.cern.ch] On Behalf Of Boris Skorodumov
Sent: Wednesday, July 19, 2006 2:38 AM
To: RootTalk
Subject: [ROOT] Filling a calibrated histogram

Hello !

I am always using the same technique when i would like to get events(channels) from the tree and project them into calibrated histogram (energy).

This is just an short example:

......

 f1 = new TFile(fp,"READ");

 t = (TTree*)f1->Get("t");
 t -> SetBranchAddress("var1", &var1);
 t -> SetBranchAddress("var2", &var2);
 

 TH2D *energy = new TH2D("energy","",bin1,0,emax1,bin2,0,emax2);  Int_t nevent = t -> GetEntries();  

  for (Int_t i = 0; i < nevent; i++) {  

    t -> GetEvent(i);

    dE = some_number1*(de-0.5+gRandom->Rndm()) + some_number2;
    E  = some_number3*(e-0.5+gRandom->Rndm()) + some_number4; 
    Et = dE + E;            

    energy -> Fill(Et,dE);
  }
......

I am wondering, what other methods might be in use to make it even more easy to carry out ? Or maybe method to make it more efficient ?

Thank you,
Boris.

-- 
____________________________________________________________________

Boris   Skorodumov              Office: (574) 631-3148
Physics Department              Lab:    (574) 631-7716
University of Notre Dame        Fax:    (574) 631-5952
Notre Dame, In, 46556           Web:    http://www.nd.edu/~bskorodo
____________________________________________________________________
Received on Wed Jul 19 2006 - 19:17:16 MEST

This archive was generated by hypermail 2.2.0 : Mon Jan 01 2007 - 16:32:00 MET