49 if(EBtimeCorrAmplitudeBins_.size() != EBtimeCorrShiftBins_.size()) {
50 doEBtimeCorrection_ =
false;
51 edm::LogError(
"EcalRecHitError") <<
"Size of EBtimeCorrAmplitudeBins different from EBtimeCorrShiftBins. Forcing no time corrections for EB. ";
53 if(EEtimeCorrAmplitudeBins_.size() != EEtimeCorrShiftBins_.size()) {
54 doEEtimeCorrection_ =
false;
55 edm::LogError(
"EcalRecHitError") <<
"Size of EEtimeCorrAmplitudeBins different from EEtimeCorrShiftBins. Forcing no time corrections for EE. ";
107 if(EBtimeCorrAmplitudeBins_.size() != EBtimeCorrShiftBins_.size()) {
108 doEBtimeCorrection_ =
false;
109 edm::LogError(
"EcalRecHitError") <<
"Size of EBtimeCorrAmplitudeBins different from EBtimeCorrShiftBins. Forcing no time corrections for EB. ";
111 if(EEtimeCorrAmplitudeBins_.size() != EEtimeCorrShiftBins_.size()) {
112 doEEtimeCorrection_ =
false;
113 edm::LogError(
"EcalRecHitError") <<
"Size of EEtimeCorrAmplitudeBins different from EEtimeCorrShiftBins. Forcing no time corrections for EE. ";
170 for (
int j = 0;
j < C::MAXSAMPLES - 5; ++
j) {
172 for (
int i =
j;
i < (
j + 5) &&
i < C::MAXSAMPLES; ++
i) {
173 if ( dataFrame.sample(
i).gainId() == 0 ) ++cnt;
175 if ( cnt == 5 )
return j-1 ;
183 double theCorrection=0;
210 edm::LogError(
"EcalRecHitError") <<
"Assigning time correction impossible. Setting it to 0 ";
215 return theCorrection/25.;
221 double theCorrection=0;
247 edm::LogError(
"EcalRecHitError") <<
"Assigning time correction impossible. Setting it to 0 ";
252 return theCorrection/25.;
274 float offsetTime = 0;
278 aped = &
peds->endcap(hashedIndex);
279 aGain = &
gains->endcap(hashedIndex);
280 gid = &
grps->endcap(hashedIndex);
281 offsetTime =
offtime->getEEValue();
284 aped = &
peds->barrel(hashedIndex);
285 aGain = &
gains->barrel(hashedIndex);
286 gid = &
grps->barrel(hashedIndex);
287 offsetTime =
offtime->getEBValue();
303 if( it !=
itime->end() ) {
306 edm::LogError(
"EcalRecHitError") <<
"No time intercalib const found for xtal "
308 <<
"! something wrong with EcalTimeCalibConstants in your DB? ";
313 int leadingSample = -1;
315 leadingSample = ((
EcalDataFrame)(*itdg)).lastUnsaturatedSample();
317 leadingSample = ((
EcalDataFrame)(*itdg)).lastUnsaturatedSample();
320 if ( leadingSample >= 0 ) {
321 if ( leadingSample != 4 ) {
364 EcalTBWeights::EcalTBWeightMap::const_iterator wit;
365 wit = wgtsMap.find( std::make_pair(*gid,tdcid) );
366 if( wit == wgtsMap.end() ) {
367 edm::LogError(
"EcalUncalibRecHitError") <<
"No weights found for EcalGroupId: "
368 << gid->
id() <<
" and EcalTDCId: " << tdcid
369 <<
"\n skipping digi with id: " <<
detid.rawId();
390 float const clockToNsConstant = 25.;
396 double theTimeCorrectionEE=0;
398 uncalibRecHit.
setJitter( crh.timeMax - 5 + theTimeCorrectionEE);
417 float correctedTime = (crh.timeMax-5) * clockToNsConstant + itimeconst + offsetTime;
421 float sigmat =
std::sqrt( nterm*nterm + cterm*cterm );
422 if ( ( correctedTime > sigmat*outOfTimeThreshP ) ||
423 ( correctedTime < (-1.*sigmat*outOfTimeThreshM) ))
433 double theTimeCorrectionEB=0;
436 uncalibRecHit.
setJitter( crh.timeMax - 5 + theTimeCorrectionEB);
455 float correctedTime = (crh.timeMax-5) * clockToNsConstant + itimeconst + offsetTime;
459 float sigmat =
std::sqrt( nterm*nterm + cterm*cterm );
460 if ( ( correctedTime > sigmat*outOfTimeThreshP ) ||
461 ( correctedTime < (-1.*sigmat*outOfTimeThreshM) ))
469 double amplitude = uncalibRecHit.
amplitude();
471 double jitter= uncalibRecHit.
jitter();
478 (itimeconst + offsetTime),
487 double chi2 = chi2expressEE_.
chi2();
498 bool samplesok =
true;
500 if (!sampleMask_->useSampleEE(
sample)) {
512 double amplitude = uncalibRecHit.
amplitude();
514 double jitter= uncalibRecHit.
jitter();
519 (itimeconst + offsetTime),
528 double chi2 = chi2expressEB_.
chi2();
538 bool samplesok =
true;
540 if (!sampleMask_->useSampleEB(
sample)) {
edm::ESHandle< EcalTimeOffsetConstant > offtime
std::map< std::pair< EcalXtalGroupId, EcalTDCId >, EcalWeightSet > EcalTBWeightMap
T getParameter(std::string const &) const
double amplitudeThreshEE_
double outOfTimeThreshG12pEB_
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result)
int hashedIndex() const
get a compact index for arrays
double outOfTimeThreshG61pEE_
void computeAmplitude(std::vector< double > &litudeFitParameters)
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
void setJitter(float jitter)
const EEShape testbeamEEShape
int isSaturated(const C &digi)
std::pair< double, double > EBtimeFitLimits_
CalculatedRecHit getCalculatedRecHit()
void computeTime(std::vector< double > &timeFitParameters, std::pair< double, double > &timeFitLimits, std::vector< double > &litudeFitParameters)
std::vector< double > EBtimeCorrShiftBins_
void push_back(T const &t)
EcalUncalibRecHitRecWeightsAlgo< EBDataFrame > weightsMethod_barrel_
std::vector< double > EBtimeFitParameters_
double outOfTimeThreshG12mEE_
void setJitterError(float jitterErr)
std::vector< double > EEchi2Parameters_
std::vector< double > eePulseShape_
std::vector< double > ebPulseShape_
std::pair< double, double > EEtimeFitLimits_
void setPulseShape(std::vector< double > &shape)
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > ratioMethod_endcap_
const unsigned int id() const
const EBShape testbeamEBShape
EcalUncalibRecHitLeadingEdgeAlgo< EBDataFrame > leadingEdgeMethod_barrel_
void setOutOfTimeChi2(float chi2)
int hashedIndex(int ieta, int iphi)
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > ratioMethod_barrel_
double outOfTimeThreshG61mEB_
edm::ESHandle< EcalGainRatios > gains
EcalUncalibRecHitLeadingEdgeAlgo< EEDataFrame > leadingEdgeMethod_endcap_
edm::ESHandle< EcalPedestals > peds
double EEtimeConstantTerm_
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_
edm::ESHandle< EcalTBWeights > wgts
std::vector< double > EEtimeCorrShiftBins_
edm::ESHandle< EcalWeightXtalGroups > grps
double outOfTimeThreshG61mEE_
EcalUncalibRecHitWorkerGlobal(const edm::ParameterSet &, edm::ConsumesCollector &c)
double outOfTimeThreshG12mEB_
EcalWeightMatrix & getWeightsAfterGainSwitch()
double outOfTimeThreshG61pEB_
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalWeightSet::EcalChi2WeightMatrix **chi2Matrix)
Compute parameters.
std::vector< double > EBamplitudeFitParameters_
std::vector< double > EBchi2Parameters_
virtual double chi2OutOfTime()
EcalWeightMatrix & getWeightsBeforeGainSwitch()
bool fixMGPAslew(const C &dataFrame)
std::vector< Item >::const_iterator const_iterator
T const * product() const
float gain12Over6() const
std::vector< double > EBtimeCorrAmplitudeBins_
double timeCorrectionEE(float ampliEE)
std::vector< double > EEamplitudeFitParameters_
const EcalWeightSet::EcalWeightMatrix * weights[2]
float EcalTimeCalibConstant
float outOfTimeEnergy() const
void set(const edm::EventSetup &es)
edm::ESHandle< EcalTimeCalibConstants > itime
double timeCorrectionEB(float ampliEB)
void setLeadingEdgeSample(int isample)
EcalUncalibRecHitRecWeightsAlgo< EEDataFrame > weightsMethod_endcap_
math::Matrix< 3, 10 >::type EcalWeightMatrix
void setFlagBit(Flags flag)
#define DEFINE_EDM_PLUGIN(factory, type, name)
void setOutOfTimeEnergy(float energy)
std::vector< double > EEtimeCorrAmplitudeBins_
edm::ESHandle< EcalSampleMask > sampleMaskHand_
void init(const C &dataFrame, const EcalSampleMask &sampleMask, const double *pedestals, const double *pedestalRMSes, const double *gainRatios)
std::vector< double > EEtimeFitParameters_
static const int MAXSAMPLES
Power< A, B >::type pow(const A &a, const B &b)