65 double timeCorrection(
float ampli,
const std::vector<float>& amplitudeBins,
const std::vector<float>& shiftBins);
211 for (
int j = 0;
j < C::MAXSAMPLES - 5; ++
j) {
213 for (
int i =
j;
i < (
j + 5) &&
i < C::MAXSAMPLES; ++
i) {
214 if (dataFrame.sample(
i).gainId() == 0)
233 const std::vector<float>& amplitudeBins,
234 const std::vector<float>& shiftBins) {
237 double theCorrection = 0;
240 if (amplitudeBins.empty()) {
241 edm::LogError(
"EcalRecHitError") <<
"timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
246 if (amplitudeBins.size() != shiftBins.size()) {
247 edm::LogError(
"EcalRecHitError") <<
"Size of timeCorrAmplitudeBins different from " 248 "timeCorrShiftBins. Forcing no time bias corrections. ";
254 for (
int bin = 0;
bin < (
int)amplitudeBins.size();
bin++) {
255 if (ampli > amplitudeBins.at(
bin)) {
263 theCorrection = shiftBins.at(0);
264 }
else if (myBin == ((
int)(amplitudeBins.size() - 1))) {
265 theCorrection = shiftBins.at(myBin);
266 }
else if (-1 < myBin && myBin < ((
int)amplitudeBins.size() - 1)) {
268 theCorrection = (shiftBins.at(myBin + 1) - shiftBins.at(myBin));
270 (((double)ampli) - amplitudeBins.at(myBin)) / (amplitudeBins.at(myBin + 1) - amplitudeBins.at(myBin));
271 theCorrection += shiftBins.at(myBin);
273 edm::LogError(
"EcalRecHitError") <<
"Assigning time correction impossible. Setting it to 0 ";
278 return theCorrection / 25.;
284 DetId detid(itdg->id());
294 float offsetTime = 0;
310 pedVec[0] = aped->mean_x12;
311 pedVec[1] = aped->mean_x6;
312 pedVec[2] = aped->mean_x1;
323 if (it !=
itime_->end()) {
326 edm::LogError(
"EcalRecHitError") <<
"No time intercalib const found for xtal " << detid.rawId()
327 <<
"! something wrong with EcalTimeCalibConstants in your DB? ";
331 int leadingSample = -1;
333 leadingSample = ((
EcalDataFrame)(*itdg)).lastUnsaturatedSample();
335 leadingSample = ((
EcalDataFrame)(*itdg)).lastUnsaturatedSample();
338 if (leadingSample == 4) {
343 }
else if (leadingSample >= 0) {
345 double gainratio = 1.;
367 EcalTBWeights::EcalTBWeightMap::const_iterator wit;
368 wit = wgtsMap.find(std::make_pair(*gid, tdcid));
369 if (wit == wgtsMap.end()) {
371 <<
"No weights found for EcalGroupId: " << gid->
id() <<
" and EcalTDCId: " << tdcid
372 <<
"\n skipping digi with id: " << detid.rawId();
393 float const clockToNsConstant = 25.;
402 uncalibRecHit.
setJitter(crh.timeMax - 5 + theTimeCorrectionEE);
422 float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
426 float sigmat =
std::sqrt(nterm * nterm + cterm * cterm);
427 if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < (-1. * sigmat * outOfTimeThreshM))) {
442 uncalibRecHit.
setJitter(crh.timeMax - 5 + theTimeCorrectionEB);
463 float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
467 float sigmat =
std::sqrt(nterm * nterm + cterm * cterm);
468 if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < (-1. * sigmat * outOfTimeThreshM))) {
477 double amplitudeOutOfTime = 0.;
478 double jitter = uncalibRecHit.
jitter();
482 (itimeconst + offsetTime),
490 double chi2 = chi2expressEE_.
chi2();
496 bool samplesok =
true;
498 if (!sampleMask_->useSampleEE(
sample)) {
510 double amplitudeOutOfTime = 0.;
511 double jitter = uncalibRecHit.
jitter();
515 (itimeconst + offsetTime),
523 double chi2 = chi2expressEB_.
chi2();
529 bool samplesok =
true;
531 if (!sampleMask_->useSampleEB(
sample)) {
551 result.push_back(uncalibRecHit);
553 result.push_back(uncalibRecHit);
563 "eePulseShape", {5.2e-05, -5.26e-05, 6.66e-05, 0.1168, 0.7575, 1.0, 0.8876, 0.6732, 0.4741, 0.3194},
true) and
565 "EBtimeFitParameters",
566 {-2.015452, 3.130702, -12.3473, 41.88921, -82.83944, 91.01147, -50.35761, 11.05621},
576 "ebPulseShape", {5.2e-05, -5.26e-05, 6.66e-05, 0.1168, 0.7575, 1.0, 0.8876, 0.6732, 0.4741, 0.3194},
true) and
581 "EEtimeFitParameters",
582 {-2.390548, 3.553628, -17.62341, 67.67538, -133.213, 140.7432, -75.41106, 16.20277},
611 "EcalUncalibRecHitWorkerGlobal");
std::pair< double, double > EEtimeFitLimits_
edm::ESHandle< EcalTimeOffsetConstant > offtime_
double amplitudeThreshEE_
double outOfTimeThreshG12pEB_
edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcd > tokenWgts_
edm::ESHandle< EcalTimeBiasCorrections > timeCorrBias_
edm::ESGetToken< EcalTimeCalibConstants, EcalTimeCalibConstantsRcd > tokenItime_
T getParameter(std::string const &) const
double outOfTimeThreshG61pEE_
void computeAmplitude(std::vector< double > &litudeFitParameters)
edm::ESHandle< EcalWeightXtalGroups > grps_
std::vector< float > EBTimeCorrShiftBins
const EcalTBWeightMap & getMap() const
double timeCorrection(float ampli, const std::vector< float > &litudeBins, const std::vector< float > &shiftBins)
void setJitter(float jitter)
int isSaturated(const C &digi)
CalculatedRecHit getCalculatedRecHit()
std::map< std::pair< EcalXtalGroupId, EcalTDCId >, EcalWeightSet > EcalTBWeightMap
void computeTime(std::vector< double > &timeFitParameters, std::pair< double, double > &timeFitLimits, std::vector< double > &litudeFitParameters)
EcalUncalibRecHitRecWeightsAlgo< EBDataFrame > weightsMethod_barrel_
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
std::vector< double > EBtimeFitParameters_
math::Matrix< 10, 10 >::type EcalChi2WeightMatrix
math::Matrix< 3, 10 >::type EcalWeightMatrix
double outOfTimeThreshG12mEE_
Log< level::Error, false > LogError
void set(const edm::EventSetup &es) override
void setJitterError(float jitterErr)
std::vector< double > EEchi2Parameters_
std::vector< double > eePulseShape_
edm::ESGetToken< EcalSampleMask, EcalSampleMaskRcd > tokenSampleMask_
std::vector< double > ebPulseShape_
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > ratioMethod_endcap_
std::vector< float > EBTimeCorrAmplitudeBins
std::vector< float > EETimeCorrShiftBins
int hashedIndex(int ieta, int iphi)
T const * product() const
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > tokenGains_
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > ratioMethod_barrel_
double outOfTimeThreshG61mEB_
std::vector< float > EETimeCorrAmplitudeBins
double EEtimeConstantTerm_
edm::ESGetToken< EcalTimeBiasCorrections, EcalTimeBiasCorrectionsRcd > tokenTimeCorrBias_
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *pedestalsRMS, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalShapeBase &testbeamPulseShape)
Compute parameters.
double outOfTimeThreshG12pEE_
double amplitudeThreshEB_
double EBtimeConstantTerm_
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result) override
double outOfTimeThreshG61mEE_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
double outOfTimeThreshG12mEB_
EcalWeightMatrix & getWeightsAfterGainSwitch()
double outOfTimeThreshG61pEB_
edm::ESHandle< EcalGainRatios > gains_
edm::ESHandle< EcalPedestals > peds_
std::vector< double > EBamplitudeFitParameters_
float gain12Over6() const
std::vector< double > EBchi2Parameters_
edm::ESHandle< EcalTBWeights > wgts_
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
std::pair< double, double > EBtimeFitLimits_
EcalWeightMatrix & getWeightsBeforeGainSwitch()
const EcalWeightSet::EcalChi2WeightMatrix * chi2mat[2]
bool fixMGPAslew(const C &dataFrame)
std::vector< Item >::const_iterator const_iterator
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
std::vector< double > EEamplitudeFitParameters_
const EcalWeightSet::EcalWeightMatrix * weights[2]
float EcalTimeCalibConstant
void setEventSetup(const edm::EventSetup &evtSetup)
EcalUncalibRecHitRecWeightsAlgo< EEDataFrame > weightsMethod_endcap_
int hashedIndex() const
get a compact index for arrays
void setFlagBit(Flags flag)
#define DEFINE_EDM_PLUGIN(factory, type, name)
static constexpr int MAXSAMPLES
edm::ParameterSetDescription getAlgoDescription() override
edm::ESHandle< EcalSampleMask > sampleMaskHand_
void init(const C &dataFrame, const EcalSampleMask &sampleMask, const double *pedestals, const double *pedestalRMSes, const double *gainRatios)
edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcd > tokenGrps_
edm::ESGetToken< EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd > tokenOfftime_
std::vector< double > EEtimeFitParameters_
EcalUncalibRecHitWorkerGlobal()=default
edm::ESHandle< EcalTimeCalibConstants > itime_
Power< A, B >::type pow(const A &a, const B &b)
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > tokenPeds_