|
|
Go to the documentation of this file.
133 for (
int j = 0;
j < C::MAXSAMPLES - 5; ++
j) {
135 for (
int i =
j;
i < (
j + 5) &&
i < C::MAXSAMPLES; ++
i) {
136 if (dataFrame.sample(
i).gainId() == 0)
155 const std::vector<float>& amplitudeBins,
156 const std::vector<float>& shiftBins) {
159 double theCorrection = 0;
162 if (amplitudeBins.empty()) {
163 edm::LogError(
"EcalRecHitError") <<
"timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
168 if (amplitudeBins.size() != shiftBins.size()) {
169 edm::LogError(
"EcalRecHitError") <<
"Size of timeCorrAmplitudeBins different from "
170 "timeCorrShiftBins. Forcing no time bias corrections. ";
176 for (
int bin = 0;
bin < (
int)amplitudeBins.size();
bin++) {
177 if (ampli > amplitudeBins.at(
bin)) {
185 theCorrection = shiftBins.at(0);
186 }
else if (myBin == ((
int)(amplitudeBins.size() - 1))) {
187 theCorrection = shiftBins.at(myBin);
188 }
else if (-1 < myBin && myBin < ((
int)amplitudeBins.size() - 1)) {
190 theCorrection = (shiftBins.at(myBin + 1) - shiftBins.at(myBin));
192 (((double)ampli) - amplitudeBins.at(myBin)) / (amplitudeBins.at(myBin + 1) - amplitudeBins.at(myBin));
193 theCorrection += shiftBins.at(myBin);
195 edm::LogError(
"EcalRecHitError") <<
"Assigning time correction impossible. Setting it to 0 ";
200 return theCorrection / 25.;
206 DetId detid(itdg->id());
216 float offsetTime = 0;
232 pedVec[0] = aped->mean_x12;
233 pedVec[1] = aped->mean_x6;
234 pedVec[2] = aped->mean_x1;
245 if (it !=
itime->end()) {
248 edm::LogError(
"EcalRecHitError") <<
"No time intercalib const found for xtal " << detid.rawId()
249 <<
"! something wrong with EcalTimeCalibConstants in your DB? ";
253 int leadingSample = -1;
255 leadingSample = ((
EcalDataFrame)(*itdg)).lastUnsaturatedSample();
257 leadingSample = ((
EcalDataFrame)(*itdg)).lastUnsaturatedSample();
260 if (leadingSample == 4) {
265 }
else if (leadingSample >= 0) {
267 double gainratio = 1.;
289 EcalTBWeights::EcalTBWeightMap::const_iterator wit;
290 wit = wgtsMap.find(std::make_pair(*gid, tdcid));
291 if (wit == wgtsMap.end()) {
293 <<
"No weights found for EcalGroupId: " << gid->
id() <<
" and EcalTDCId: " << tdcid
294 <<
"\n skipping digi with id: " << detid.rawId();
315 float const clockToNsConstant = 25.;
324 uncalibRecHit.
setJitter(crh.timeMax - 5 + theTimeCorrectionEE);
344 float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
348 float sigmat =
std::sqrt(nterm * nterm + cterm * cterm);
349 if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < (-1. * sigmat * outOfTimeThreshM))) {
364 uncalibRecHit.
setJitter(crh.timeMax - 5 + theTimeCorrectionEB);
385 float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
389 float sigmat =
std::sqrt(nterm * nterm + cterm * cterm);
390 if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < (-1. * sigmat * outOfTimeThreshM))) {
399 double amplitudeOutOfTime = 0.;
400 double jitter = uncalibRecHit.
jitter();
404 (itimeconst + offsetTime),
412 double chi2 = chi2expressEE_.
chi2();
418 bool samplesok =
true;
420 if (!sampleMask_->useSampleEE(
sample)) {
432 double amplitudeOutOfTime = 0.;
433 double jitter = uncalibRecHit.
jitter();
437 (itimeconst + offsetTime),
445 double chi2 = chi2expressEB_.
chi2();
451 bool samplesok =
true;
453 if (!sampleMask_->useSampleEB(
sample)) {
473 result.push_back(uncalibRecHit);
475 result.push_back(uncalibRecHit);
485 "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
487 "EBtimeFitParameters",
488 {-2.015452, 3.130702, -12.3473, 41.88921, -82.83944, 91.01147, -50.35761, 11.05621},
498 "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
503 "EEtimeFitParameters",
504 {-2.390548, 3.553628, -17.62341, 67.67538, -133.213, 140.7432, -75.41106, 16.20277},
533 "EcalUncalibRecHitWorkerGlobal");
static constexpr int MAXSAMPLES
int isSaturated(const C &digi)
void computeAmplitude(std::vector< double > &litudeFitParameters)
int hashedIndex() const
get a compact index for arrays
T const * product() const
const EcalTBWeightMap & getMap() const
void setEventSetup(const edm::EventSetup &evtSetup)
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
edm::ESHandle< EcalTimeOffsetConstant > offtime
double outOfTimeThreshG61pEE_
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
edm::ESHandle< EcalTimeBiasCorrections > timeCorrBias_
void set(const edm::EventSetup &es) override
std::vector< double > eePulseShape_
double timeCorrection(float ampli, const std::vector< float > &litudeBins, const std::vector< float > &shiftBins)
EcalUncalibRecHitRecWeightsAlgo< EBDataFrame > weightsMethod_barrel_
std::vector< double > EEchi2Parameters_
CalculatedRecHit getCalculatedRecHit()
void computeTime(std::vector< double > &timeFitParameters, std::pair< double, double > &timeFitLimits, std::vector< double > &litudeFitParameters)
double outOfTimeThreshG61mEB_
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > ratioMethod_endcap_
std::vector< float > EETimeCorrAmplitudeBins
std::vector< float > EETimeCorrShiftBins
void setFlagBit(Flags flag)
double EEtimeConstantTerm_
math::Matrix< 3, 10 >::type EcalWeightMatrix
double outOfTimeThreshG12pEE_
std::vector< double > EBtimeFitParameters_
double EBtimeConstantTerm_
edm::ESHandle< EcalGainRatios > gains
edm::ESHandle< EcalWeightXtalGroups > grps
std::vector< float > EBTimeCorrAmplitudeBins
edm::ESHandle< EcalPedestals > peds
double outOfTimeThreshG12mEE_
double outOfTimeThreshG61pEB_
std::vector< double > ebPulseShape_
EcalWeightMatrix & getWeightsAfterGainSwitch()
#define DEFINE_EDM_PLUGIN(factory, type, name)
void setJitter(float jitter)
edm::ESHandle< EcalTBWeights > wgts
float gain12Over6() const
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result) override
EcalWeightMatrix & getWeightsBeforeGainSwitch()
double amplitudeThreshEB_
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > ratioMethod_barrel_
std::vector< double > EBamplitudeFitParameters_
std::vector< double > EBchi2Parameters_
EcalUncalibRecHitWorkerGlobal()
const EcalWeightSet::EcalWeightMatrix * weights[2]
double outOfTimeThreshG61mEE_
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
Log< level::Error, false > LogError
std::map< std::pair< EcalXtalGroupId, EcalTDCId >, EcalWeightSet > EcalTBWeightMap
void init(const C &dataFrame, const EcalSampleMask &sampleMask, const double *pedestals, const double *pedestalRMSes, const double *gainRatios)
std::pair< double, double > EBtimeFitLimits_
void setJitterError(float jitterErr)
double outOfTimeThreshG12mEB_
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *pedestalsRMS, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalShapeBase &testbeamPulseShape)
Compute parameters.
edm::ParameterSetDescription getAlgoDescription() override
T getParameter(std::string const &) const
edm::ESHandle< EcalSampleMask > sampleMaskHand_
edm::ESHandle< EcalTimeCalibConstants > itime
bool fixMGPAslew(const C &dataFrame)
Power< A, B >::type pow(const A &a, const B &b)
std::vector< Item >::const_iterator const_iterator
double amplitudeThreshEE_
std::vector< double > EEtimeFitParameters_
double outOfTimeThreshG12pEB_
std::vector< float > EBTimeCorrShiftBins
std::vector< double > EEamplitudeFitParameters_
int hashedIndex(int ieta, int iphi)
std::pair< double, double > EEtimeFitLimits_
float EcalTimeCalibConstant
EcalUncalibRecHitRecWeightsAlgo< EEDataFrame > weightsMethod_endcap_