Hello,
I have a problem with Project function of TTree.
I am trying to project something into a histogram but it does not work: window which is open is empty.
This is my code
[code]#include <TFile.h>
#include <TTree.h>
#include <TH1F.h>
#include <TGraph.h>
#include
#include
using namespace std;
TH1F *hspider;
int check_normalisation(int Brhoref)
{
int i=0;
char text[50];
char varexp[20];
char selection[100];
int RunNb=0;
int Nspider=0, Nvamos=0;
TTree *Analysed_Data;
sprintf(text,"/space/Brho%i.root",Brhoref);
TFile f = new TFile(text);
cout << text << " is open" << endl;
Analysed_Data = (TTree)f->Get(“Analysed_Data”);
hspider = new TH1F(“hspider”,“hspider”,500,0.,140.);
Analysed_Data->Project(“hspider”,“SEc”,"(1/norm_transfer)*(GATCONF==1 && RUN_NUMBER==338)","");
hspider->Draw();
}[/code]
Canvas is empty. However, if I write
instead of
Analysed_Data->Project("hspider","SEc","(1/norm_transfer)*(GATCONF==1 && RUN_NUMBER==338)","");
hspider->Draw();
Could you explain me why it does not work?
Thanks.