I want to create a histogram of a variable. I want to collect in this histogram all of the values of this variable that are in events that have a certain flag existing. This flag is “e MET jets”, as shown in the following image:
Given that the variables tree is “nominal”, I have in mind something like the following, using the method TTree::Project():
h1 = new TH1D("h1", "h1", 10, 0, 200000)
nominal->Project("h1", "e MET jets")
h1->Draw()
When I try to specify the flag name with whitespace, I get the following error:
Error in <TTreeFormula::Compile>: Bad numerical expression : "eMETjets"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {e MET jets,}
(Long64_t) -1
When I try to specify the flag name with escaped whitespace (“e\ MET\ jets”), I get the following error:
ROOT_prompt_30:1:31: warning: unknown escape sequence '\ '
[-Wunknown-escape-sequence]
nominal->Project("h1", "e\ MET\ jets")
^~
Error in <TTreeFormula::Compile>: Bad numerical expression : "eMETjets"
Info in <TSelectorDraw::AbortProcess>: Variable compilation failed: {e MET jets,}
(Long64_t) -1
So,
[ul]
Is there some good documentation on the use of the method TTree::Project()?
How should I specify as a condition of the projection the existence of a variable for the event?
How should I specify the name of the variable, given that it contains whitespace?
[/ul]