93 float tTrigMean,tTrigSigma,kFactor;
95 if(status != 0)
throw cms::Exception(
"[DTTTrigResidualCorrection]") <<
"Could not find tTrig entry in DB for"
98 float vDrift,hitResolution;
100 if(status != 0)
throw cms::Exception(
"[DTTTrigResidualCorrection]") <<
"Could not find vDrift entry in DB for"
102 TH1F residualHisto = *(
getHisto(slId));
103 LogTrace(
"Calibration") <<
"[DTTTrigResidualCorrection]: \n"
104 <<
" Mean, RMS = " << residualHisto.GetMean() <<
", " << residualHisto.GetRMS();
106 double fitMean = -1.;
107 double fitSigma = -1.;
109 LogTrace(
"Calibration") <<
"[DTTTrigResidualCorrection]: Fitting histogram " << residualHisto.GetName();
110 const bool originalFit =
false;
112 RooRealVar
x(
"x",
"residual",-1.,1.);
113 RooRealVar
mean(
"mean",
"mean",residualHisto.GetMean(),-0.3,0.3);
114 RooRealVar sigma1(
"sigma1",
"sigma1",0.,0.5);
115 RooRealVar sigma2(
"sigma2",
"sigma2",0.,0.5);
117 RooRealVar
frac(
"frac",
"frac",0.,1.);
119 RooGaussian myg1(
"myg1",
"Gaussian distribution",
x,
mean,sigma1);
120 RooGaussian myg2(
"myg2",
"Gaussian distribution",
x,
mean,sigma2);
122 RooAddPdf myg(
"myg",
"myg",RooArgList(myg1,myg2),RooArgList(
frac));
124 RooDataHist hdata(
"hdata",
"Binned data",RooArgList(
x),&residualHisto);
127 fitMean =
mean.getVal();
128 fitSigma = sigma1.getVal();
135 LogTrace(
"Calibration") <<
"[DTTTrigResidualCorrection]: \n"
136 <<
" Fit Mean = " << fitMean <<
"\n"
137 <<
" Fit Sigma = " << fitSigma;
139 double resMean = (
useFit_) ? fitMean : residualHisto.GetMean();
141 int wheel = slId.
wheel();
142 int sector = slId.
sector();
147 double vdrift_eff =
vDriftEff_[wheel+2][sector-1][station-1][superLayer-1];
148 if(vdrift_eff == 0) vdrift_eff = vDrift;
150 if(vdrift_eff) resTime = resMean/vdrift_eff;
152 LogTrace(
"Calibration") <<
"[DTTTrigResidualCorrection]: Effective vDrift, correction to tTrig = "
153 << vdrift_eff <<
", " << resTime;
155 if(vDrift) resTime = resMean/vDrift;
157 LogTrace(
"Calibration") <<
"[DTTTrigResidualCorrection]: vDrift from DB, correction to tTrig = "
158 << vDrift <<
", " << resTime;
161 double corrMean = tTrigMean;
162 double corrSigma = (tTrigSigma != 0.) ? tTrigSigma : 1.;
163 double corrKFact = (tTrigSigma != 0.) ? (kFactor + resTime/tTrigSigma) : resTime;
const DTMtime * mTimeMap_
int superLayer() const
Return the superlayer number.
double vDriftEff_[5][14][4][3]
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)
const DTTtrig * tTrigMap_
int get(int wheelId, int stationId, int sectorId, int slId, float &mTime, float &mTrms, DTTimeUnits::type unit) const
const TH1F * getHisto(const DTSuperLayerId &)
DTResidualFitter * fitter_
int station() const
Return the station number.
int wheel() const
Return the wheel number.