Thank you @eguiraud
-
hemitxxpsp
is a TH2F in which on x axis I plot the position (i.e. the branchPositionDirection.x
) and on y axis I plot the angle (i.e. the branchSecondaryParticleAng.x
). In my formula I need the mean value both ofPositionDirection.x
andSecondaryParticleAng.x
(i.e. < x > and < x’>). For erro I wrote GetRMS() but I need GetMean().
Given that I need both the means of x and y axis, here Mean from a 2d histogram found that I must use GetMean(1) for the x axis and GetMean(2) for the y one! Did I understand right? -
I wrote
float x;
float xp;
float xm;
float xpm;
float xxpmN;
float xxpm;
int jentry;
int nentries = ts->GetEntries();
xm= hemitxxpsp->GetMean(1);
xpm= hemitxxpsp->GetMean(2);
ts->SetBranchAdress("PositionDirection.x",PositionDirection.x,"x/I");
ts->SetBranchAdress("SecondaryParticleAng.x",SecondaryParticleAng.x,"xp/I");
for(jentry=0; jentry<nentries;jentry++) {
ts->GetEntry(jentry);
xxpmN+= (x-xm)*(xp-xpm);
}
xxpm=xxpmN/nentries;
but I get these errors
anyway, I wrote a very short macro (just 52 lines), please, can you check it? I think it’s easier for you to help me looking this very shor macro
simlemmared.cpp (1.6 KB)