I’ve just recently discovered, that there is an object called TEfficiency.
Until now, I have been using histogram pairs and converted them into a single TGraphAsymmerrorrs object to depict efficiencies, so thank you for this feature!
My question is: is it possible to easily calculate mean efficiency using this object?
Is this the most compact code to achieve this functionality?
Note that getting the mean among the “value-axis” seems broken.
dummy -> Multiply(eff -> GetTotalHistogram(), eff -> GetPassedHistogram());
double mean = dummy -> GetMean(1);
What about 2D efficiencies?
Also, calling Multiply on TH2D objects results weird behaviour. This code:
std::cout << detectorPartROCHits -> GetNcells() << " " << detectorPartROCEfficiencies -> GetNcells() << std::endl;
dummy -> Multiply(detectorPartROCHits, detectorPartROCEfficiencies);
double mean = dummy -> ProjectionX() -> GetMean(2);
std::cout << "mean: " << mean << std::endl;
Error in TH2D::Multiply: Attempt to multiply histograms with different number of bins
I have not understood your problem. Which Mean do you want, the mean computed by weighting by the efficiency value in each bin or the mean of the efficiency value ?
I am looking for the mean of the efficiencies, so I would like to add weights to every bin depending on the number of entries in that particular bin.
TEfficiency returns the efficiency value in every bin. You can then compute their weighted mean by for example by filling an additional histogram given as input values the efficiency in each bin and their weight.
Yes, but it’s quite complicated (in terms of both code length and efficiency), especially the error calculation. There “should” be a default function to calculate them while filling the efficiency histograms, shouldn’t it?
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.