94 float tTrigMean,tTrigSigma,kFactor;
96 if(status != 0)
throw cms::Exception(
"[DTTTrigResidualCorrection]") <<
"Could not find tTrig entry in DB for"
99 float vDrift,hitResolution;
101 if(status != 0)
throw cms::Exception(
"[DTTTrigResidualCorrection]") <<
"Could not find vDrift entry in DB for"
103 TH1F residualHisto = *(
getHisto(slId));
104 LogTrace(
"Calibration") <<
"[DTTTrigResidualCorrection]: \n"
105 <<
" Mean, RMS = " << residualHisto.GetMean() <<
", " << residualHisto.GetRMS();
107 double fitMean = -1.;
108 double fitSigma = -1.;
110 LogTrace(
"Calibration") <<
"[DTTTrigResidualCorrection]: Fitting histogram " << residualHisto.GetName();
111 const bool originalFit =
false;
113 RooRealVar
x(
"x",
"residual",-1.,1.);
114 RooRealVar
mean(
"mean",
"mean",residualHisto.GetMean(),-0.3,0.3);
115 RooRealVar sigma1(
"sigma1",
"sigma1",0.,0.5);
116 RooRealVar sigma2(
"sigma2",
"sigma2",0.,0.5);
118 RooRealVar
frac(
"frac",
"frac",0.,1.);
120 RooGaussian myg1(
"myg1",
"Gaussian distribution",
x,
mean,sigma1);
121 RooGaussian myg2(
"myg2",
"Gaussian distribution",
x,
mean,sigma2);
123 RooAddPdf myg(
"myg",
"myg",RooArgList(myg1,myg2),RooArgList(
frac));
125 RooDataHist hdata(
"hdata",
"Binned data",RooArgList(
x),&residualHisto);
128 fitMean =
mean.getVal();
129 fitSigma = sigma1.getVal();
136 LogTrace(
"Calibration") <<
"[DTTTrigResidualCorrection]: \n"
137 <<
" Fit Mean = " << fitMean <<
"\n"
138 <<
" Fit Sigma = " << fitSigma;
140 double resMean = (
useFit_) ? fitMean : residualHisto.GetMean();
142 int wheel = slId.
wheel();
143 int sector = slId.
sector();
148 double vdrift_eff =
vDriftEff_[wheel+2][sector-1][station-1][superLayer-1];
149 if(vdrift_eff == 0) vdrift_eff = vDrift;
151 if(vdrift_eff) resTime = resMean/vdrift_eff;
153 LogTrace(
"Calibration") <<
"[DTTTrigResidualCorrection]: Effective vDrift, correction to tTrig = "
154 << vdrift_eff <<
", " << resTime;
156 if(vDrift) resTime = resMean/vDrift;
158 LogTrace(
"Calibration") <<
"[DTTTrigResidualCorrection]: vDrift from DB, correction to tTrig = "
159 << vDrift <<
", " << resTime;
162 double corrMean = tTrigMean;
163 double corrSigma = (tTrigSigma != 0.) ? tTrigSigma : 1.;
164 double corrKFact = (tTrigSigma != 0.) ? (kFactor + resTime/tTrigSigma) : resTime;
166 return DTTTrigData(corrMean,corrSigma,corrKFact);
double vDriftEff_[5][14][4][3]
const TH1F * getHisto(const DTSuperLayerId &)
int superLayer() const
Return the superlayer number.
PixelRecoRange< float > Range
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
DTResidualFitResult fitResiduals(TH1F &histo, int nSigmas=1)
DTResidualFitter * fitter_
const DTTtrig * tTrigMap_
int get(int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
int station() const
Return the station number.
int wheel() const
Return the wheel number.
const DTMtime * mTimeMap_