Hello,
1/ I want to use a function in a TTree->Draw() method.
But when I execute the command, I got the following error message:
root [1] .L edepTot_C.so
root [2] .L lib/ntuple.so
root [3] TFile t(“files/g3.root”)
root [4] TTree *mt = AMSRoot
root [5] mt->Draw(“edepTot(pEcalhit(0),nEcalHit())”,“nEcalHit()>0”)
AMSEventR::ctor-I-SingletonInitialized 0x8eb07e0
AMSEventR::dtor-I-Destroying 1
AMSEventR::dtor-I-ResettingHead 0
*ERROR 30 :
Bad numerical expression : “edepTot(pEcalhit(0),nEcalHit())”
The function signature is: Float_t edepTot(EcalHitR *ptEcalHit,Int_t num)
EcalHitR is a Object which inherit from TObjet.
2/
When I do the same thing with a simple function like:
Int_t sum(Int_t n1,Int_t index)
{
Int_t fEdepTotal = 0;
for (Int_t i = 0 ; i < index ; i++ )
{
fEdepTotal = fEdepTotal + n1;
}
return fEdepTotal;
}
the root [5] mt->Draw(“sum(nEcalHit(),nEcalHit())”,“nEcalHit()>0”)
is working
any idea ?
Thank you for your help.
Jean.