Thanks!
It's second time for you to save my life!
On May 10, 2011, at 1:58 AM, Philippe Canal wrote:
> Hi Genie, > > The problem is that in pT_y.C when you do: > > TH2D *hist = new TH2D("hist", "p_{T}/m vs. y", selectXBins, selectMinX, selectMaxX, selectYBins, selectMinY, selectMaxY); > > TFile *openFile = new TFile(dataName[selectData].c_str()); > TTree *particleTree = (TTree *) openFile -> Get(particleName[selectParticle].c_str()); > > particleTree -> Project("hist", "pT/mass:rapidity", dataOption.c_str(), "", 10); > > hist -> GetXaxis() -> SetTitle("y"); > > The 'hist' that is filled by Project is different from the 'hist' that you manipulate > and later Draw (you end up draw an empty histogram) because the 'hist' you > created is not in the current directory when you executed Project. > > This code solves the problem: > > TDirectory *where = gDirectory; > TH2D *hist = new TH2D("hist", "p_{T}/m vs. y", selectXBins, selectMinX, selectMaxX, selectYBins, selectMinY, selectMaxY); > > TFile *openFile = new TFile(dataName[selectData].c_str()); > TTree *particleTree = (TTree *) openFile -> Get(particleName[selectParticle].c_str()); > > where->cd(); > particleTree -> Project("hist", "pT/mass:rapidity", dataOption.c_str(), "", 10); > > Cheers, > Philippe. > > On 5/6/11 7:57 PM, Genie Jhang wrote:
This archive was generated by hypermail 2.2.0 : Sun May 22 2011 - 17:50:02 CEST