4 #include "boost/foreach.hpp"
8 TH1* fake = (TH1*)(candidates[0]->Clone(basename.c_str()));
13 BOOST_FOREACH(
const TH1* candidate, candidates) {
20 if(status) {
delete combined.
chi2_; combined.
chi2_=0;}
21 return combined.
chi2_;
36 minmaxUsable_(findUsableMinMax()),
51 chi2_ =
new TH1F(XXname.c_str(),
"",
Nbins, low, up);
56 unsigned NEAR(0), FAR(0);
58 for(
unsigned L=0;
L<cont.size();
L++) {
if( cont[
L].
first >
range_.first)
continue;
59 for(
unsigned R=
L;
R<cont.size();
R++) {
if( cont[
R].
second <
range_.second)
continue;
62 cont[
R].second -
range_.second );
63 const unsigned near =
std::max(
range_.second<cont[L].second ? 0 :
range_.second - cont[L].second,
66 if ( (far>near) && (far-near)>(FAR-NEAR) ) { FAR = far; NEAR = near;}
69 return std::make_pair(NEAR,FAR);
74 std::vector<std::pair<unsigned,unsigned> >
ranges;
79 std::pair<unsigned,unsigned> range(i,i+1);
80 while(++i<=Nbins && symm_candidate_->GetBinError(i)) range.second++;
81 ranges.push_back(range);
92 for(
int i=1;
i<=
chi2_->GetNbinsX() ; ++
i) {
94 chi2_->SetBinContent(
i,
chi2( std::make_pair(
L,R)) );
120 return pow(y0-y1, 2)/(e0*e0+e1*e1);
127 p[0] <
chi2_->GetBinCenter(1) ||
128 p[0] >
chi2_->GetBinCenter(
chi2_->GetNbinsX()))
132 f->SetParameter(0, p[0]); f->SetParLimits(0, p[0], p[0]);
133 f->SetParameter(1, p[1]); f->SetParLimits(1, p[1], p[1]);
134 f->SetParameter(2, p[2]); f->SetParLimits(2, p[2], p[2]);
135 f->SetParameter(3,
ndf_); f->SetParLimits(3,
ndf_,
ndf_);
142 TF1*
f =
new TF1(
"SymmetryFit",
"((x-[0])/[1])**2+[2]+0*[3]");
143 f->SetParName(0,
"middle");
144 f->SetParName(1,
"uncertainty");
145 f->SetParName(2,
"chi2");
146 f->SetParName(3,
"NDF");
152 std::vector<double>
v;
154 int status = hist->Fit(
"pol2",
"WQ");
156 std::vector<double>
p;
157 p.push_back(hist->GetFunction(
"pol2")->GetParameter(0));
158 p.push_back(hist->GetFunction(
"pol2")->GetParameter(1));
159 p.push_back(hist->GetFunction(
"pol2")->GetParameter(2));
161 v.push_back( -0.5*p[1]/p[2] );
162 v.push_back( 1./
sqrt(p[2]) );
163 v.push_back( p[0]-0.25*p[1]*p[1]/p[2] );
170 std::vector<double>
v;
172 int status = hist->Fit(
"pol3",
"WQ");
174 std::vector<double>
p;
175 p.push_back(hist->GetFunction(
"pol3")->GetParameter(0));
176 p.push_back(hist->GetFunction(
"pol3")->GetParameter(1));
177 p.push_back(hist->GetFunction(
"pol3")->GetParameter(2));
178 p.push_back(hist->GetFunction(
"pol3")->GetParameter(3));
179 double radical = p[2]*p[2] - 3*p[1]*p[3] ;
181 double x0 = ( -p[2] +
sqrt(radical) ) / ( 3*p[3] ) ;
183 v.push_back(
pow( radical, -0.25) );
184 v.push_back( p[0] + p[1]*x0 + p[2]*x0*x0 + p[3]*x0*x0*x0 );
const std::pair< unsigned, unsigned > minmaxUsable_
SymmetryFit(const TH1 *, const std::pair< unsigned, unsigned >)
static std::string name(std::string base)
std::pair< unsigned, unsigned > findUsableMinMax() const
const std::pair< unsigned, unsigned > range_
static TH1 * symmetryChi2(std::string, const std::vector< TH1 * > &, const std::pair< unsigned, unsigned >)
static std::vector< double > pol2_from_pol2(TH1 *hist)
float chi2_element(std::pair< unsigned, unsigned >)
U second(std::pair< T, U > const &p)
static std::vector< double > pol2_from_pol3(TH1 *hist)
float chi2(std::pair< unsigned, unsigned >)
static TF1 * fitfunction()
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
const TH1 * symm_candidate_
std::vector< std::pair< unsigned, unsigned > > continuousRanges() const
Power< A, B >::type pow(const A &a, const B &b)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point