32 std::vector<int32_t> activeBXs = ps.
getParameter< std::vector<int32_t> >(
"activeBXs");
34 for (
unsigned int ibx=0; ibx<activeBXs.size(); ++ibx) {
35 activeBX.coeffRef(ibx) = activeBXs[ibx];
42 if (useLumiInfoRunHeader_) {
148 int bunchspacing = 450;
169 bunchspacing = *bunchSpacingH;
172 if (bunchspacing == 25) {
174 activeBX << -5,-4,-3,-2,-1,0,1,2,3,4;
196 const std::vector<float>& amplitudeBins,
197 const std::vector<float>& shiftBins) {
201 double theCorrection = 0;
204 if (amplitudeBins.size() == 0) {
206 <<
"timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
211 if (amplitudeBins.size() != shiftBins.size()) {
213 <<
"Size of timeCorrAmplitudeBins different from "
214 "timeCorrShiftBins. Forcing no time bias corrections. ";
220 for (
int bin = 0;
bin < (int) amplitudeBins.size();
bin++) {
221 if (ampli > amplitudeBins.at(
bin)) {
229 theCorrection = shiftBins.at(0);
230 }
else if (myBin == ((
int)(amplitudeBins.size() - 1))) {
231 theCorrection = shiftBins.at(myBin);
232 }
else if (-1 < myBin && myBin < ((
int) amplitudeBins.size() - 1)) {
234 theCorrection = (shiftBins.at(myBin + 1) - shiftBins.at(myBin));
235 theCorrection *= (((double) ampli) - amplitudeBins.at(myBin)) /
236 (amplitudeBins.at(myBin + 1) - amplitudeBins.at(myBin));
237 theCorrection += shiftBins.at(myBin);
240 <<
"Assigning time correction impossible. Setting it to 0 ";
245 return theCorrection / 25.;
269 aped = &
peds->endcap(hashedIndex);
270 aGain = &
gains->endcap(hashedIndex);
271 gid = &
grps->endcap(hashedIndex);
276 aped = &
peds->barrel(hashedIndex);
277 aGain = &
gains->barrel(hashedIndex);
278 gid = &
grps->barrel(hashedIndex);
295 int leadingSample = ((
EcalDataFrame)(*itdg)).lastUnsaturatedSample();
297 if ( leadingSample >= 0 ) {
298 if ( leadingSample != 4 ) {
353 if(
timealgo_.compare(
"RatioMethod")==0) {
355 float const clockToNsConstant = 25.;
364 uncalibRecHit.
setJitter( crh.timeMax - 5 + theTimeCorrectionEE);
377 uncalibRecHit.
setJitter( crh.timeMax - 5 + theTimeCorrectionEB);
381 }
else if(
timealgo_.compare(
"WeightsMethod")==0) {
383 std::vector<double> amplitudes;
388 EcalTBWeights::EcalTBWeightMap::const_iterator wit;
389 wit = wgtsMap.find( std::make_pair(*gid,tdcid) );
390 if( wit == wgtsMap.end() ) {
391 edm::LogError(
"EcalUncalibRecHitError") <<
"No weights found for EcalGroupId: "
392 << gid->
id() <<
" and EcalTDCId: " << tdcid
393 <<
"\n skipping digi with id: " <<
detid.rawId();
413 }
else if(
timealgo_.compare(
"None")==0) {
417 edm::LogError(
"EcalUncalibRecHitError") <<
"No time estimation algorithm called "
419 <<
"\n setting jitter to 0. and jitter uncertainty to 10000. ";
498 const std::vector<double> ebCorMatG12 = params.
getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG12");
499 const std::vector<double> eeCorMatG12 = params.
getParameter< std::vector<double> >(
"EECorrNoiseMatrixG12");
500 const std::vector<double> ebCorMatG06 = params.
getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG06");
501 const std::vector<double> eeCorMatG06 = params.
getParameter< std::vector<double> >(
"EECorrNoiseMatrixG06");
502 const std::vector<double> ebCorMatG01 = params.
getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG01");
503 const std::vector<double> eeCorMatG01 = params.
getParameter< std::vector<double> >(
"EECorrNoiseMatrixG01");
505 int nnoise = ebCorMatG12.size();
508 for (
int i=0;
i<nnoise; ++
i) {
509 for (
int j=0;
j<nnoise; ++
j) {
521 const std::vector<double> ebPulse = params.
getParameter< std::vector<double> >(
"EBPulseShapeTemplate");
522 const std::vector<double> eePulse = params.
getParameter< std::vector<double> >(
"EEPulseShapeTemplate");
523 int nShapeSamples = ebPulse.size();
524 for (
int i=0;
i<nShapeSamples; ++
i) {
529 const std::vector<double> ebPulseCov = params.
getParameter< std::vector<double> >(
"EBPulseShapeCovariance");
530 const std::vector<double> eePulseCov = params.
getParameter< std::vector<double> >(
"EEPulseShapeCovariance");
532 int i =
k/nShapeSamples;
533 int j =
k%nShapeSamples;
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
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_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool useLumiInfoRunHeader_
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()
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
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result) override
FullSampleMatrix fullpulsecovEE
SampleMatrix noisecorEEg12
edm::ESHandle< EcalPedestals > peds
SampleMatrix noisecorEBg1
int hashedIndex(int ieta, int iphi)
edm::EDGetTokenT< int > bunchSpacing_
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_
void set(const edm::EventSetup &es) override
void setPrefitMaxChiSq(double x)
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
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_