Re: How to get an Histogram ?

From: Jordi Nadal <jnadal_at_ifae.es>
Date: Wed, 7 Sep 2011 18:02:34 +0200


Hi Suvayu,

Is this done correctly?

[jnadal_at_at305 JetFitter]$ root PSE/JO_muon_PSE_RbFree/sumRootFile.root Welcome to the ATLAS rootlogon.C
root [0]
Attaching file PSE/JO_muon_PSE_RbFree/sumRootFile.root as _file0... root [1] gROOT->FindObject("Wjets_HFC_4ex") (const class TObject*)0x0
root [2] .ls

TFile**		PSE/JO_muon_PSE_RbFree/sumRootFile.root	
 TFile*		PSE/JO_muon_PSE_RbFree/sumRootFile.root	
  KEY: TTree	HangingTree;1	no lemons at that tree
root [3]   TH1F *Wjets_HFC = (TH1F*) gROOT->FindObject("Wjets_HFC_4ex")          
root [4] Wjets_HFC->GetMean
GetMean
GetMeanError
root [4] Wjets_HFC->GetMean()
Error: illegal pointer to class object Wjets_HFC 0x0 550 (tmpfile):1: *** Interpreter error recovered ***
root [5]

Thanks!

Jordi
On Sep 7, 2011, at 5:49 PM, suvayu ali wrote:

> On Wed, Sep 7, 2011 at 5:01 PM, Jordi Nadal <jnadal_at_ifae.es> wrote:

>> Hello experts,
>>
>> Basically what I want to do is:
>>
>> TFile *file = TFile::Open("PSE/JO_muon_PSE_RbFree/sumRootFile.root");
>> TTree* HangingTree = (TTree*) file->Get("HangingTree");
>> HangingTree->Draw(raw+">>histo");
>>
>> is there a better way to "get " this histo?
>>
>> I would like to do is histo->GetMean() and doing it like above I get wrong numbers…
>>
> 
> This should work:
> 
> TH1D *histo = (TH1D*) gROOT->FindObject("histo");
> histo->GetMean();
> 
> 
> -- 
> Suvayu
> 
> Open source is the future. It sets us free.
Received on Wed Sep 07 2011 - 18:02:46 CEST

This archive was generated by hypermail 2.2.0 : Thu Sep 08 2011 - 05:50:02 CEST