Hi Jordi,
I am not sure about your issue as I don't know what exactly you are trying to achieve. However after simplifying your example macro I found two errors:
{
int N = 2;
TString parnames[N] = { "QCDnorm_corr_mu", "QCDnorm_corr_mu_btag"};
TFile *file = TFile::Open("PSE/JO_muon_PSE_RbFree/sumRootFile.root"); TTree* HangingTree = (TTree*) file->Get("HangingTree");
for(int i=0; i<N;i++){
TString raw = parnames[i];
// here the histograms get overwritten by subsequent calls to Draw()
HangingTree->Draw(raw+">>histo");
// this line does multiple declaration of h as the loop proceeds
// this is not correct C++ but might be forgivable in CINT, not sure
TH1D *h = (TH1D*) gROOT->FindObject("histo");
std::cout << raw << " " << h->GetMean() << std::endl;
}
}
I hope this helps.
-- Suvayu Open source is the future. It sets us free.Received on Thu Sep 08 2011 - 14:47:09 CEST
This archive was generated by hypermail 2.2.0 : Thu Sep 08 2011 - 17:50:01 CEST