Hi,
Sorry in advance if this is duplicated theme. I couldn’t find any similar threads.
The following two simple codes return different result and I can’t understand why such thing happens.
Can somebody teach me?
Best,
============ This one works fine ====================
void MultipleTreeProjection()
{
TFile* fInput = new TFile(“set1.root”, “READ”);
TH1F* hTemp = new TH1F(“hTemp”, “Histogram”, 1000, -20, 20);
TTree* fTree = (TTree*)fInput->Get(“Tree”);
fTree->Project(“hTemp”, “trkRigidityInner”, “”, “”, 1000, 1);
hTemp->Draw();
}
============ This one gives empty histogram ====================
void MultipleTreeProjection()
{
TH1F* hTemp = new TH1F(“hTemp”, “Histogram”, 1000, -20, 20);
TFile* fInput = new TFile(“set1.root”, “READ”);
TTree* fTree = (TTree*)fInput->Get(“Tree”);
fTree->Project(“hTemp”, “trkRigidityInner”, “”, “”, 1000, 1);
hTemp->Draw();
}