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_) {
142 int bunchspacing = 450;
163 bunchspacing = *bunchSpacingH;
166 if (bunchspacing == 25) {
168 activeBX << -5,-4,-3,-2,-1,0,1,2,3,4;
190 const std::vector<float>& amplitudeBins,
191 const std::vector<float>& shiftBins) {
195 double theCorrection = 0;
198 if (amplitudeBins.size() == 0) {
200 <<
"timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
205 if (amplitudeBins.size() != shiftBins.size()) {
207 <<
"Size of timeCorrAmplitudeBins different from "
208 "timeCorrShiftBins. Forcing no time bias corrections. ";
214 for (
int bin = 0;
bin < (int) amplitudeBins.size();
bin++) {
215 if (ampli > amplitudeBins.at(
bin)) {
223 theCorrection = shiftBins.at(0);
224 }
else if (myBin == ((
int)(amplitudeBins.size() - 1))) {
225 theCorrection = shiftBins.at(myBin);
226 }
else if (-1 < myBin && myBin < ((
int) amplitudeBins.size() - 1)) {
228 theCorrection = (shiftBins.at(myBin + 1) - shiftBins.at(myBin));
229 theCorrection *= (((double) ampli) - amplitudeBins.at(myBin)) /
230 (amplitudeBins.at(myBin + 1) - amplitudeBins.at(myBin));
231 theCorrection += shiftBins.at(myBin);
234 <<
"Assigning time correction impossible. Setting it to 0 ";
239 return theCorrection / 25.;
263 aped = &
peds->endcap(hashedIndex);
264 aGain = &
gains->endcap(hashedIndex);
265 gid = &
grps->endcap(hashedIndex);
268 aped = &
peds->barrel(hashedIndex);
269 aGain = &
gains->barrel(hashedIndex);
270 gid = &
grps->barrel(hashedIndex);
285 int leadingSample = ((
EcalDataFrame)(*itdg)).lastUnsaturatedSample();
287 if ( leadingSample >= 0 ) {
288 if ( leadingSample != 4 ) {
343 if(
timealgo_.compare(
"RatioMethod")==0) {
345 float const clockToNsConstant = 25.;
354 uncalibRecHit.
setJitter( crh.timeMax - 5 + theTimeCorrectionEE);
367 uncalibRecHit.
setJitter( crh.timeMax - 5 + theTimeCorrectionEB);
371 }
else if(
timealgo_.compare(
"WeightsMethod")==0) {
373 std::vector<double> amplitudes;
378 EcalTBWeights::EcalTBWeightMap::const_iterator wit;
379 wit = wgtsMap.find( std::make_pair(*gid,tdcid) );
380 if( wit == wgtsMap.end() ) {
381 edm::LogError(
"EcalUncalibRecHitError") <<
"No weights found for EcalGroupId: "
382 << gid->
id() <<
" and EcalTDCId: " << tdcid
383 <<
"\n skipping digi with id: " <<
detid.rawId();
403 }
else if(
timealgo_.compare(
"None")==0) {
407 edm::LogError(
"EcalUncalibRecHitError") <<
"No time estimation algorithm called "
409 <<
"\n setting jitter to 0. and jitter uncertainty to 10000. ";
488 const std::vector<double> ebCorMatG12 = params.
getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG12");
489 const std::vector<double> eeCorMatG12 = params.
getParameter< std::vector<double> >(
"EECorrNoiseMatrixG12");
490 const std::vector<double> ebCorMatG06 = params.
getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG06");
491 const std::vector<double> eeCorMatG06 = params.
getParameter< std::vector<double> >(
"EECorrNoiseMatrixG06");
492 const std::vector<double> ebCorMatG01 = params.
getParameter< std::vector<double> >(
"EBCorrNoiseMatrixG01");
493 const std::vector<double> eeCorMatG01 = params.
getParameter< std::vector<double> >(
"EECorrNoiseMatrixG01");
495 int nnoise = ebCorMatG12.size();
498 for (
int i=0;
i<nnoise; ++
i) {
499 for (
int j=0;
j<nnoise; ++
j) {
511 const std::vector<double> ebPulse = params.
getParameter< std::vector<double> >(
"EBPulseShapeTemplate");
512 const std::vector<double> eePulse = params.
getParameter< std::vector<double> >(
"EEPulseShapeTemplate");
513 int nShapeSamples = ebPulse.size();
514 for (
int i=0;
i<nShapeSamples; ++
i) {
519 const std::vector<double> ebPulseCov = params.
getParameter< std::vector<double> >(
"EBPulseShapeCovariance");
520 const std::vector<double> eePulseCov = params.
getParameter< std::vector<double> >(
"EEPulseShapeCovariance");
522 int i =
k/nShapeSamples;
523 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
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_