10 #include "TVirtualFitter.h" 11 #include "TFitResultPtr.h" 46 <<
"[CalibrationAlgorithm::" << __func__ <<
"]" 47 <<
" NULL pointer to base Analysis object!";
55 <<
"[CalibrationAlgorithm::" << __func__ <<
"]" 56 <<
" NULL pointer to derived Analysis object!";
61 if ( histos.size() != 32 && histos.size() !=2 ) {
69 std::vector<TH1*>::const_iterator ihis = histos.begin();
71 for ( ; ihis != histos.end(); ihis++,cnt++ ) {
74 if ( !(*ihis) ) {
continue; }
91 histo_[cnt].second = (*ihis)->GetTitle();
102 <<
"[CalibrationAlgorithm::" << __func__ <<
"]" 103 <<
" NULL pointer to derived Analysis object!";
107 float Amean[2] = {0.,0.};
108 float Amin[2] = {2000.,2000.};
109 float Amax[2] = {0.,0.};
110 float Aspread[2] = {0.,0.};
111 float Tmean[2] = {0.,0.};
112 float Tmin[2] = {2000.,2000.};
113 float Tmax[2] = {0.,0.};
114 float Tspread[2] = {0.,0.};
115 float Rmean[2] = {0.,0.};
116 float Rmin[2] = {2000.,2000.};
117 float Rmax[2] = {0.,0.};
118 float Rspread[2] = {0.,0.};
119 float Cmean[2] = {0.,0.};
120 float Cmin[2] = {2000.,2000.};
121 float Cmax[2] = {0.,0.};
122 float Cspread[2] = {0.,0.};
123 float Smean[2] = {0.,0.};
124 float Smin[2] = {2000.,2000.};
125 float Smax[2] = {0.,0.};
126 float Sspread[2] = {0.,0.};
127 float Kmean[2] = {0.,0.};
128 float Kmin[2] = {2000000.,2000000.};
129 float Kmax[2] = {0.,0.};
130 float Kspread[2] = {0.,0.};
132 float Omean[2] = {0.,0.};
133 float Omin[2] = {2000.,2000.};
134 float Omax[2] = {0.,0.};
135 float Ospread[2] = {0.,0.};
137 float Mmean[2] = {0.,0.};
138 float Mmin[2] = {2000.,2000.};
139 float Mmax[2] = {0.,0.};
140 float Mspread[2] = {0.,0.};
142 float Umean[2] = {0.,0.};
143 float Umin[2] = {2000.,2000.};
144 float Umax[2] = {0.,0.};
145 float Uspread[2] = {0.,0.};
147 float Bmean[2] = {0.,0.};
148 float Bmin[2] = {2000.,2000.};
149 float Bmax[2] = {0.,0.};
150 float Bspread[2] = {0.,0.};
154 for(
unsigned int i=0;
i<upperLimit;++
i) {
157 <<
" NULL pointer to histogram " <<
i <<
"!";
165 if(title.find(
"STRIP")!=std::string::npos && title.find(
"Apv")!=std::string::npos) {
166 strip = atoi(title.c_str()+title.find(
"STRIP")+6);
167 apv = (atoi(title.c_str()+title.find(
"Apv")+3))%2;
169 strip = (atoi(title.c_str()+title.find_last_of(
"_")+1))%16;
170 apv = (atoi(title.c_str()+title.find_last_of(
"_")+1))/16;
171 if(title.find(
"Apv")!=std::string::npos) {
172 apv = (atoi(title.c_str()+title.find(
"Apv")+3))%2;
176 <<
" Malformed histogram title! Strip/APV not retreived: " 186 float maximum_ampl = fit->GetMaximum();
187 float baseline = fit->Eval(10);
191 float peak_time = fit->GetMaximumX();
192 float turn_on_time =
turnOn(fit);
193 float rise_time = peak_time - turn_on_time;
213 int lastBin =
histo_[
i].first->FindBin(peak_time + 125);
214 if(lastBin>
histo_[
i].first->GetNbinsX()-4) lastBin =
histo_[
i].first->GetNbinsX()-4;
215 if(
histo_[
i].first->GetMaximum()!=0)
216 cal_->
tail_[apv][strip] = 100*(
histo_[
i].first->GetBinContent(lastBin)-baseline) / (maximum_ampl - baseline);
278 for(
int i=0;
i<2;++
i) {
332 <<
"CalibrationAlgorithm::correctDistribution: isScan_ == true!!! ";
343 if(!
cal_)
return nullptr;
344 if(!histo)
return nullptr;
346 float N = round(histo->GetMaximum()/125.);
349 for(
int i=1;
i<=histo->GetNbinsX();++
i) {
350 histo->SetBinError(
i,error);
354 float maximum = histo->GetMaximum();
355 float turn_on = histo->GetBinCenter((histo->FindFirstBinAbove(0.1 * maximum) - 2));
361 if(rangeLow>rangeHigh)
371 if(rangeLow>rangeHigh)
382 int bin = h->GetMaximumBin();
384 TF1*
fit =
fitPulse(h,h->GetBinCenter(bin)-25,h->GetBinCenter(bin)+25);
385 return fit->GetMaximumX();
391 float max_amplitude = f->GetMaximum();
393 float base = f->GetMinimum(0,50);
394 for( ; time < 50 && (f->Eval(time) -
base) < 0.01 * (max_amplitude - base); time += 0.1) {}
TF1 * fitPulse(TH1 *, float rangeLow=0, float rangeHigh=-1)
static const char unexpectedTask_[]
const uint32_t & fedKey() const
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
const Histo & histo(int i) const
Utility class that holds histogram title.
static const char numberOfHistos_[]
void extract(const std::vector< TH1 * > &) override
CalibrationAnalysis * cal_
Analysis for calibration runs.
static const char mlCommissioning_[]
uint32_t extractFedKey(const TH1 *const )
virtual void addErrorCode(const std::string &error)
base
Make Sure CMSSW is Setup ##.
bin
set the eta bin as selection string.
VFloat spread_undershoot_
double fdeconv(double *x, double *par)
void correctDistribution(TH1 *) const
std::vector< std::vector< double > > tmp
double fpeak(double *x, double *par)
VFloat spread_timeConstant_
const double Rmax[kNumberCalorimeter]
Abstract base for derived classes that provide analysis of commissioning histograms.
const double Rmin[kNumberCalorimeter]
VFloat mean_timeConstant_
CommissioningAnalysis *const anal() const