Make calculations with Chain of root files

Hello Rooters,
I have a few root files, which containe trees with some values. I need to open the tree, apply for value inside formula and plot the result of this formula. I use th following code for it

ccxzoom = new TCanvas (canvas11_name[detector],canvas11_name[detector],1000,1000);
TChain ch1(tree1_name[detector]);
TH1F h1 = new TH1F(“h1”,“TYPE-2 Center”,nbbin,es,ef);
n1 = ch1->GetEntries();
h1->SetXTitle(“Log(En, eV)”);

parameters t0 and t1 contained in root files, but pl is the variable discribed in code as float and has some value. G0&&G1&&A01&&PCT2 - are the cuts discribed before in code.
But in this case if I start code message hapens “unknown pl”.
Do you know how is it possible to make calculations (using external in respect to trees variable) with values in trees using Chain and plot result of it after?

If pl is a variable in your script (not in the tree), you can do

double pl = …;

char mycut[1000];


Thank you Rene,
now it works. But could you discribe how is it possible to apply logical condition
if (mycut>…){}
for result of calculation (mycut in your script). The purpose is

  1. calculate formula (mycut)
  2. apply condition if() for result of calculations (mycut)
  3. make another calculations for value in tree and discribed in script.

I was showing an example with the variable(s) to be histogrammed.
You can use the same technique for the cuts.