From 33924cbde38e12aa340d8324cdd3349a0828bc8b Mon Sep 17 00:00:00 2001 From: dainese Date: Mon, 4 Jan 2010 14:35:50 +0000 Subject: [PATCH] Read histos from common output file (Chiara B) --- PWG3/vertexingHF/macros/fitD0InvMass.C | 37 +++++++++++++++----------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/PWG3/vertexingHF/macros/fitD0InvMass.C b/PWG3/vertexingHF/macros/fitD0InvMass.C index 8b118d2c646..7d964557a25 100644 --- a/PWG3/vertexingHF/macros/fitD0InvMass.C +++ b/PWG3/vertexingHF/macros/fitD0InvMass.C @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include @@ -12,31 +13,32 @@ #include //root[0] .x fitD0InvMass.C+ +//root[1] fitD0(...) -//input: nsigma os the number of sigma in which the significance (, signal ancg background) is calculated +//input: nsigma is the number of sigma in which significance, signal and background are calculated -//fit of histograms in InvMassD0.root. Must specify the list name where the histo are stored. Produce a root file with the fitted histos and a text file with signal, background and significance +//fit of histograms in the directory PWG3_D2H_D0InvMass of AnalysisResults.root . Must specify the list name where the histo are stored. Produce a root file with the fitted histos and a text file with signal, background and significance -void fitD0InvMass(Int_t rebin=0,TString listname="coutputmassD02",Int_t nsigma=3, TString pathin="./",TString pathout="./",Int_t btype=2){ +void fitD0(Int_t rebin=0,TString listname="coutputmassD0mycuts",Int_t nsigma=3, TString pathin="./",TString pathout="./",Int_t btype=2){ + + TString file="AnalysisResults.root"; //"D0InvMass.root"; - gStyle->SetOptFit(0111); - gStyle->SetOptStat("nemrou"); - TString file = "D0InvMass.root"; - const Int_t npt=5; file.Prepend(pathin); cout<<"Opening "<IsOpen()){ - cout<<"File "<>file; - fin=new TFile(file.Data()); - if(!fin->IsOpen()){ - cout<<"File "<Get(listname.Data()); + gStyle->SetOptFit(0111); + gStyle->SetOptStat("nemrou"); + + const Int_t npt=5; + TString dirname="PWG3_D2H_D0InvMass"; + TDirectoryFile *dir=(TDirectoryFile*)fin->GetDirectory(dirname); + + TList *lista = (TList*) dir->Get(listname.Data()); if(!lista) { cout<