Hi all,
Apologies in advance, it’s probably a simple question but I don’t know much C++ and found the documentation hard to understand. I have a TH1F made like this:
TH1F *b = new TH1F(“b”, “NTrack”, 120, 0, 120);
For a given bin number i, I want to check whether the x-axis value is >k or <k and I’m not sure how. I’ve tried this:
for (int k=0;k<randomBigNumber;k++){
for (int i=0; i<b->GetNbinsX(); i++){
double_t a = static_cast<double>(i);
if(b->GetXaxis()->GetCenter(a)>k){gluons+=b->GetBinContent(i);}
}
for (int i=0;i<g->GetNbinsX();i++){
double_t a = static_cast<double>(i);
double_t *ptr = &a;
if(g->GetXaxis()->GetCenter(*ptr)<k){quarks+=g->GetBinContent(i);}
}
But it tells me **cannot initialize a parameter of type 'Double_t ’ (aka 'double ') with an lvalue of type ‘double_t’ (aka ‘double’)
The same error for both for loops. Once I’ve done this I need to plot the resulting values of gluons vs quarks, and I don’t know how to do this either! I should fill an array and use that to plot a TGraph somehow but I’m not sure what the syntax should look like.
Thanks in advance for any help!