31 std::vector<int32_t> activeBXs = ps.
getParameter< std::vector<int32_t> >(
"activeBXs");
33 for (
unsigned int ibx=0; ibx<activeBXs.size(); ++ibx) {
34 activeBX.coeffRef(ibx) = activeBXs[ibx];
141 const std::vector<float>& amplitudeBins,
142 const std::vector<float>& shiftBins) {
146 double theCorrection = 0;
149 if (amplitudeBins.size() == 0) {
151 <<
"timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
156 if (amplitudeBins.size() != shiftBins.size()) {
158 <<
"Size of timeCorrAmplitudeBins different from "
159 "timeCorrShiftBins. Forcing no time bias corrections. ";
165 for (
int bin = 0;
bin < (int) amplitudeBins.size();
bin++) {
166 if (ampli > amplitudeBins.at(
bin)) {
174 theCorrection = shiftBins.at(0);
175 }
else if (myBin == ((
int)(amplitudeBins.size() - 1))) {
176 theCorrection = shiftBins.at(myBin);
177 }
else if (-1 < myBin && myBin < ((
int) amplitudeBins.size() - 1)) {
179 theCorrection = (shiftBins.at(myBin + 1) - shiftBins.at(myBin));
180 theCorrection *= (((double) ampli) - amplitudeBins.at(myBin)) /
181 (amplitudeBins.at(myBin + 1) - amplitudeBins.at(myBin));
182 theCorrection += shiftBins.at(myBin);
185 <<
"Assigning time correction impossible. Setting it to 0 ";
190 return theCorrection / 25.;
214 aped = &
peds->endcap(hashedIndex);
215 aGain = &
gains->endcap(hashedIndex);
216 gid = &
grps->endcap(hashedIndex);
219 aped = &
peds->barrel(hashedIndex);
220 aGain = &
gains->barrel(hashedIndex);
221 gid = &
grps->barrel(hashedIndex);
236 int leadingSample = ((
EcalDataFrame)(*itdg)).lastUnsaturatedSample();
238 if ( leadingSample >= 0 ) {
239 if ( leadingSample != 4 ) {
294 if(
timealgo_.compare(
"RatioMethod")==0) {
296 float const clockToNsConstant = 25.;
305 uncalibRecHit.
setJitter( crh.timeMax - 5 + theTimeCorrectionEE);
318 uncalibRecHit.
setJitter( crh.timeMax - 5 + theTimeCorrectionEB);
322 }
else if(
timealgo_.compare(
"WeightsMethod")==0) {
324 std::vector<double> amplitudes;
329 EcalTBWeights::EcalTBWeightMap::const_iterator wit;
330 wit = wgtsMap.find( std::make_pair(*gid,tdcid) );
331 if( wit == wgtsMap.end() ) {
332 edm::LogError(
"EcalUncalibRecHitError") <<
"No weights found for EcalGroupId: "
333 << gid->
id() <<
" and EcalTDCId: " << tdcid
334 <<
"\n skipping digi with id: " <<
detid.rawId();
354 }
else if(
timealgo_.compare(
"None")==0) {
358 edm::LogError(
"EcalUncalibRecHitError") <<
"No time estimation algorithm called "
360 <<
"\n setting jitter to 0. and jitter uncertainty to 10000. ";
439 const std::vector<double> ebCorMatG12 = params.
getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG12");
440 const std::vector<double> eeCorMatG12 = params.
getParameter< std::vector<double> >(
"EECorrNoiseMatrixG12");
441 const std::vector<double> ebCorMatG06 = params.
getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG06");
442 const std::vector<double> eeCorMatG06 = params.
getParameter< std::vector<double> >(
"EECorrNoiseMatrixG06");
443 const std::vector<double> ebCorMatG01 = params.
getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG01");
444 const std::vector<double> eeCorMatG01 = params.
getParameter< std::vector<double> >(
"EECorrNoiseMatrixG01");
446 int nnoise = ebCorMatG12.size();
449 for (
int i=0;
i<nnoise; ++
i) {
450 for (
int j=0;
j<nnoise; ++
j) {
462 const std::vector<double> ebPulse = params.
getParameter< std::vector<double> >(
"EBPulseShapeTemplate");
463 const std::vector<double> eePulse = params.
getParameter< std::vector<double> >(
"EEPulseShapeTemplate");
464 int nShapeSamples = ebPulse.size();
465 for (
int i=0;
i<nShapeSamples; ++
i) {
470 const std::vector<double> ebPulseCov = params.
getParameter< std::vector<double> >(
"EBPulseShapeCovariance");
471 const std::vector<double> eePulseCov = params.
getParameter< std::vector<double> >(
"EEPulseShapeCovariance");
473 int i =
k/nShapeSamples;
474 int j =
k%nShapeSamples;
std::map< std::pair< EcalXtalGroupId, EcalTDCId >, EcalWeightSet > EcalTBWeightMap
T getParameter(std::string const &) const
int hashedIndex() const
get a compact index for arrays
void computeAmplitude(std::vector< double > &litudeFitParameters)
edm::ParameterSet EcalPulseShapeParameters_
EcalUncalibRecHitWorkerMultiFit(const edm::ParameterSet &, edm::ConsumesCollector &c)
unsigned size(int bx) const
EcalUncalibRecHitMultiFitAlgo multiFitMethod_
SampleMatrix noisecorEEg6
FullSampleVector fullpulseEE
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
const SampleMatrix & noisecor(bool barrel, int gain) const
void setJitter(float jitter)
EcalUncalibRecHitTimeWeightsAlgo< EEDataFrame > weightsMethod_endcap_
double EEtimeConstantTerm_
EcalUncalibRecHitLeadingEdgeAlgo< EBDataFrame > leadingEdgeMethod_barrel_
double time(const C &dataFrame, const std::vector< double > &litudes, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const FullSampleVector &fullpulse, const EcalWeightSet::EcalWeightMatrix **weights)
Compute time.
CalculatedRecHit getCalculatedRecHit()
void set(const edm::EventSetup &es)
EcalUncalibratedRecHit makeRecHit(const EcalDataFrame &dataFrame, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const SampleMatrix &noisecor, const FullSampleVector &fullpulse, const FullSampleMatrix &fullpulsecov, const BXVector &activeBX)
compute rechits
void computeTime(std::vector< double > &timeFitParameters, std::pair< double, double > &timeFitLimits, std::vector< double > &litudeFitParameters)
edm::ESHandle< EcalWeightXtalGroups > grps
void push_back(T const &t)
std::pair< double, double > EEtimeFitLimits_
void setJitterError(float jitterErr)
Eigen::Matrix< double, 19, 19 > FullSampleMatrix
edm::ESHandle< EcalGainRatios > gains
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > ratioMethod_barrel_
void setPulseShape(std::vector< double > &shape)
const unsigned int id() const
FullSampleMatrix fullpulsecovEE
SampleMatrix noisecorEEg12
edm::ESHandle< EcalPedestals > peds
SampleMatrix noisecorEBg1
int hashedIndex(int ieta, int iphi)
std::vector< double > EBtimeFitParameters_
std::vector< double > ebPulseShape_
float outOfTimeAmplitude(int bx) const
std::vector< double > EBamplitudeFitParameters_
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > ratioMethod_endcap_
Abs< T >::type abs(const T &t)
FullSampleMatrix fullpulsecovEB
edm::ESHandle< EcalTimeCalibConstants > itime
double timeCorrection(float ampli, const std::vector< float > &litudeBins, const std::vector< float > &shiftBins)
void disableErrorCalculation()
Eigen::Matrix< double, 19, 1 > FullSampleVector
EcalWeightMatrix & getWeightsAfterGainSwitch()
SampleMatrix noisecorEBg6
std::vector< double > eePulseShape_
virtual EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const double *pedestals, const double *gainRatios, const EcalWeightSet::EcalWeightMatrix **weights, const EcalWeightSet::EcalChi2WeightMatrix **chi2Matrix)
Compute parameters.
edm::ESHandle< EcalTimeBiasCorrections > timeCorrBias_
SampleMatrix noisecorEEg1
EcalUncalibRecHitLeadingEdgeAlgo< EEDataFrame > leadingEdgeMethod_endcap_
bool ampErrorCalculation_
EcalWeightMatrix & getWeightsBeforeGainSwitch()
bool fixMGPAslew(const C &dataFrame)
FullSampleVector fullpulseEB
void resize(int bx, unsigned size)
T const * product() const
float gain12Over6() const
std::pair< double, double > EBtimeFitLimits_
EcalUncalibRecHitTimeWeightsAlgo< EBDataFrame > weightsMethod_barrel_
SampleMatrix noisecorEBg12
edm::ESHandle< EcalTimeOffsetConstant > offtime
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result)
void setLeadingEdgeSample(int isample)
math::Matrix< 3, 10 >::type EcalWeightMatrix
void setFlagBit(Flags flag)
#define DEFINE_EDM_PLUGIN(factory, type, name)
edm::ESHandle< EcalSampleMask > sampleMaskHand_
const EcalWeightSet::EcalWeightMatrix * weights[2]
Eigen::Matrix< double, 10, 10 > SampleMatrix
void init(const C &dataFrame, const EcalSampleMask &sampleMask, const double *pedestals, const double *pedestalRMSes, const double *gainRatios)
edm::ESHandle< EcalTBWeights > wgts
std::vector< double > EEamplitudeFitParameters_
Power< A, B >::type pow(const A &a, const B &b)
void fillInputs(const edm::ParameterSet ¶ms)
std::vector< double > EEtimeFitParameters_
double EBtimeConstantTerm_