183 {
184
185
190
191
192 int nProfileBins = (
m_binnage[binnumber] ).size() - 1;
193 float*
xbins =
new float[nProfileBins+1];
194 std::string Xvar_name =
m_binnames[binnumber];
195 std::string Xvar_name_s = Xvar_name;
196 size_t found0 = Xvar_name_s.find('#');
197 if(found0 != std::string::npos) Xvar_name_s.erase(Xvar_name_s.begin(), Xvar_name_s.begin()+found0+1);
198 size_t found1 = Xvar_name_s.find('_');
199 if(found1 != std::string::npos) Xvar_name_s.erase(Xvar_name_s.begin()+found1,Xvar_name_s.end());
200 for(
int i = 0 ;
i < nProfileBins+1 ;
i++)
204 std::string RMSname =
name + std::string(
"_RMS_vs_") + Xvar_name_s;
205 std::string RMStitle = std::string("Resolution of ") +
206 title + std::string(
" vs ") + Xvar_name;
207 name =
name + std::string(
"_Mean_vs_") + Xvar_name_s;
208 title = std::string(
"Mean of ") +
title + std::string(
" vs ") + Xvar_name;
209
211 nProfileBins, xbins);
213 nProfileBins, xbins);
214
215 theMeanProfile->GetXaxis()->SetTitle( Xvar_name.c_str() );
216 theRMSProfile->GetXaxis()->SetTitle( Xvar_name.c_str() );
217 theMeanProfile->GetYaxis()->SetTitle( (std::string(
"Mean of ") +
m_axisName).c_str() );
218 theRMSProfile->GetYaxis()->SetTitle( (std::string(
"RMS of ") +
m_axisName).c_str() );
219
220
221 std::vector<int> indexes;
222 for(int ibin = 0; ibin < nProfileBins; ibin++){
223
225 std::ostringstream binname;
228 double limits =
swap->GetXaxis()->GetXmax();
230 TH1D *
bin =
new TH1D(binname.str().c_str(), bintitle.c_str(),
231 nbins,-limits,limits);
234 if(indexes[binnumber] == ibin){
237 }
238 }
239
242 double mean_error = 0.;
244 double rms_error = 0.;
245
246 if(
bin->GetEntries() > 50){
248 }
249
255 }
256
257 theMeanProfile->SetBinContent(ibin+1,
mean*
entries);
258 theMeanProfile->SetBinError(ibin+1,mean_error);
259 theMeanProfile->SetBinEntries(ibin+1,
entries);
260 theRMSProfile->SetBinContent(ibin+1,rms*
entries);
261 theRMSProfile->SetBinError(ibin+1,rms_error);
262 theRMSProfile->SetBinEntries(ibin+1,
entries);
263
264
265
266
271
272 }
273
274
275 (*m_MeanProfilesVector)[binnumber] = theMeanProfile;
276 (*m_RMSProfilesVector)[binnumber] = theRMSProfile;
277 if(RMS) return theRMSProfile;
278 else return theMeanProfile;
279
280}
void GetCoreParameters(const TH1 *hist, double &mean, double &mean_error, double &rms, double &rms_error, double &nentries)
void mean(std::vector< double > &bins, std::vector< double > &values, const std::vector< std::string > &files, const std::string &histname, const std::string &tplotname, const std::string &label="")