10 #include "TVirtualFitter.h"
16 using namespace sistrip;
49 <<
"[CalibrationAlgorithm::" << __func__ <<
"]"
50 <<
" NULL pointer to base Analysis object!";
58 <<
"[CalibrationAlgorithm::" << __func__ <<
"]"
59 <<
" NULL pointer to derived Analysis object!";
64 if ( histos.size() != 32 && histos.size() !=2 ) {
72 std::vector<TH1*>::const_iterator ihis = histos.begin();
74 for ( ; ihis != histos.end(); ihis++,cnt++ ) {
77 if ( !(*ihis) ) {
continue; }
94 histo_[cnt].second = (*ihis)->GetTitle();
105 <<
"[CalibrationAlgorithm::" << __func__ <<
"]"
106 <<
" NULL pointer to derived Analysis object!";
110 float Amean[2] = {0.,0.};
111 float Amin[2] = {2000.,2000.};
112 float Amax[2] = {0.,0.};
113 float Aspread[2] = {0.,0.};
114 float Tmean[2] = {0.,0.};
115 float Tmin[2] = {2000.,2000.};
116 float Tmax[2] = {0.,0.};
117 float Tspread[2] = {0.,0.};
118 float Rmean[2] = {0.,0.};
119 float Rmin[2] = {2000.,2000.};
120 float Rmax[2] = {0.,0.};
121 float Rspread[2] = {0.,0.};
122 float Cmean[2] = {0.,0.};
123 float Cmin[2] = {2000.,2000.};
124 float Cmax[2] = {0.,0.};
125 float Cspread[2] = {0.,0.};
126 float Smean[2] = {0.,0.};
127 float Smin[2] = {2000.,2000.};
128 float Smax[2] = {0.,0.};
129 float Sspread[2] = {0.,0.};
130 float Kmean[2] = {0.,0.};
131 float Kmin[2] = {2000000.,2000000.};
132 float Kmax[2] = {0.,0.};
133 float Kspread[2] = {0.,0.};
137 for(
unsigned int i=0;
i<upperLimit;++
i) {
140 <<
" NULL pointer to histogram " <<
i <<
"!";
148 if(title.find(
"STRIP")!=std::string::npos && title.find(
"Apv")!=std::string::npos) {
149 strip = atoi(title.c_str()+title.find(
"STRIP")+6);
150 apv = (atoi(title.c_str()+title.find(
"Apv")+3))%2;
152 strip = (atoi(title.c_str()+title.find_last_of(
"_")+1))%16;
153 apv = (atoi(title.c_str()+title.find_last_of(
"_")+1))/16;
154 if(title.find(
"Apv")!=std::string::npos) {
155 apv = (atoi(title.c_str()+title.find(
"Apv")+3))%2;
159 <<
" Malformed histogram title! Strip/APV not retreived: "
174 int lastBin =
histo_[
i].first->FindBin(
histo_[
i].first->GetBinCenter(
histo_[
i].first->GetMaximumBin())+125);
175 if(lastBin>
histo_[
i].first->GetNbinsX()-4) lastBin =
histo_[
i].first->GetNbinsX()-4;
176 if(
histo_[
i].first->GetMaximum()!=0)
191 cal_->
chi2_[apv][strip] = fit->GetChisquare();
198 Tmean[apv] +=
cal_->
tail_[apv][strip]/nStrips;
214 Kmean[apv] +=
cal_->
chi2_[apv][strip]/nStrips;
221 for(
int i=0;
i<2;++
i) {
267 float N = round(histo->GetMaximum()/125.);
270 for(
int i=1;
i<=histo->GetNbinsX();++
i) {
271 histo->SetBinError(
i,error);
274 if(rangeLow>rangeHigh)
280 if(rangeLow>rangeHigh)
291 int bin = h->GetMaximumBin();
293 TF1* fit =
fitPulse(h,h->GetBinCenter(bin)-25,h->GetBinCenter(bin)+25);
294 return fit->GetMaximumX();
302 float amplitude = h->GetMaximum();
303 for(; bin<= h->GetNbinsX() && h->GetBinContent(bin)<0.4*amplitude; ++
bin) {}
304 float end = h->GetBinLowEdge(bin);
306 TF1* sigmoid =
new TF1(
"sigmoid",
"[0]/(1+exp(-[1]*(x-[2])))+[3]",0,end);
307 sigmoid->SetParLimits(0,amplitude/10.,amplitude);
308 sigmoid->SetParLimits(1,0.05,0.5);
309 sigmoid->SetParLimits(2,end-10,end+10);
310 sigmoid->SetParLimits(3,-amplitude/10.,amplitude/10.);
311 sigmoid->SetParameters(amplitude/2.,0.1,end,0.);
312 h->Fit(sigmoid,
"0QR");
315 float base = sigmoid->GetMinimum(0,end);
316 for(;time<end && (sigmoid->Eval(time)-
base)<0.03*(amplitude-base);time += 0.1) {}
TF1 * fitPulse(TH1 *, float rangeLow=0, float rangeHigh=-1)
static const char unexpectedTask_[]
double fdeconv_convoluted(double *x, double *par)
const uint32_t & fedKey() const
Utility class that holds histogram title.
static const char numberOfHistos_[]
CalibrationAnalysis * cal_
double fpeak_convoluted(double *x, double *par)
Analysis for calibration runs.
static const char mlCommissioning_[]
uint32_t extractFedKey(const TH1 *const )
virtual void addErrorCode(const std::string &error)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
void correctDistribution(TH1 *) const
std::vector< std::vector< double > > tmp
VFloat spread_timeConstant_
const double Rmax[kNumberCalorimeter]
virtual void extract(const std::vector< TH1 * > &)
Abstract base for derived classes that provide analysis of commissioning histograms.
const double Rmin[kNumberCalorimeter]
VFloat mean_timeConstant_
CommissioningAnalysis *const anal() const