19 const double& num_of_entries,
20 const double& sum_of_contents,
21 const double& sum_of_squares ) {
26 if ( num_of_entries ) {
27 mean = sum_of_contents / num_of_entries;
28 spread =
sqrt( sum_of_squares/ num_of_entries - mean * mean );
84 const double& num_of_entries,
86 const double& spread ) {
91 std::cerr <<
"[UpdateTProfile::setBinContents]"
92 <<
" NULL pointer to TProfile object!" << std::endl;
97 if ( bin == 0 || bin > static_cast<uint32_t>(prof->GetNbinsX()) ) {
98 std::cerr <<
"[UpdateTProfile::setBinContents]"
99 <<
" Unexpected bin number!" << std::endl;
104 if ( num_of_entries <= 0. ) {
return; }
105 double entries = num_of_entries;
108 const char* spread_option =
"s";
109 const char* default_option =
"";
116 const char* error_option = prof->GetErrorOption();
120 if ( error_option[0] == spread_option[0] ) {
121 weight =
sqrt( mean*mean*entries + spread*spread*entries );
122 }
else if (error_option[0] == default_option[0] ) {
123 weight =
sqrt( mean*mean*entries + spread*spread*entries*entries );
125 std::cerr <<
"[UpdateTProfile::setBinContents]"
126 <<
" Unexpected error option for TProfile!" << std::endl;
131 prof->SetBinEntries( bin, entries );
132 prof->SetBinContent( bin, mean * entries );
133 prof->SetBinError( bin, weight );
145 if ( bin == 1 ) { prof->SetEntries( entries ); }
146 else { prof->SetEntries( prof->GetEntries() +
entries ); }
static void setBinContent(TProfile *const profile, const uint32_t &bin, const double &entries, const double &mean, const double &spread)
static void setBinContents(TProfile *const profile, const uint32_t &bin, const double &num_of_entries, const double &sum_of_contents, const double &sum_of_squares)