CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
EcalUncalibRecHitWorkerMultiFit Class Referencefinal

#include <EcalUncalibRecHitWorkerMultiFit.h>

Inheritance diagram for EcalUncalibRecHitWorkerMultiFit:
EcalUncalibRecHitWorkerBaseClass

Public Member Functions

 EcalUncalibRecHitWorkerMultiFit (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerMultiFit ()
 
edm::ParameterSetDescription getAlgoDescription () override
 
 ~EcalUncalibRecHitWorkerMultiFit () override
 
- Public Member Functions inherited from EcalUncalibRecHitWorkerBaseClass
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &)
 
 EcalUncalibRecHitWorkerBaseClass ()
 
virtual ~EcalUncalibRecHitWorkerBaseClass ()
 

Private Types

enum  TimeAlgo { noMethod, ratioMethod, weightsMethod, crossCorrelationMethod }
 

Private Member Functions

const SampleMatrixnoisecor (bool barrel, int gain) const
 
const SampleMatrixGainArraynoisecor (bool barrel) const
 
void run (const edm::Event &evt, const EcalDigiCollection &digis, EcalUncalibratedRecHitCollection &result) override
 
void set (const edm::EventSetup &es) override
 
void set (const edm::Event &evt) override
 
double timeCorrection (float ampli, const std::vector< float > &amplitudeBins, const std::vector< float > &shiftBins)
 

Private Attributes

BXVector activeBX
 
double addPedestalUncertaintyEB_
 
double addPedestalUncertaintyEE_
 
bool ampErrorCalculation_
 
double amplitudeThreshEB_
 
double amplitudeThreshEE_
 
edm::EDGetTokenT< unsigned int > bunchSpacing_
 
int bunchSpacingManual_
 
double chi2ThreshEB_
 
double chi2ThreshEE_
 
std::unique_ptr
< EcalUncalibRecHitTimingCCAlgo
computeCC_
 
bool doPrefitEB_
 
bool doPrefitEE_
 
bool dynamicPedestalsEB_
 
bool dynamicPedestalsEE_
 
std::vector< double > EBamplitudeFitParameters_
 
std::vector< double > ebPulseShape_
 
double ebSpikeThresh_
 
double EBtimeConstantTerm_
 
std::pair< double, double > EBtimeFitLimits_
 
std::vector< double > EBtimeFitParameters_
 
double EBtimeNconst_
 
std::vector< double > EEamplitudeFitParameters_
 
std::vector< double > eePulseShape_
 
double EEtimeConstantTerm_
 
std::pair< double, double > EEtimeFitLimits_
 
std::vector< double > EEtimeFitParameters_
 
double EEtimeNconst_
 
edm::ESHandle< EcalGainRatiosgains
 
edm::ESGetToken
< EcalGainRatios,
EcalGainRatiosRcd
gainsToken_
 
bool gainSwitchUseMaxSampleEB_
 
bool gainSwitchUseMaxSampleEE_
 
edm::ESHandle
< EcalWeightXtalGroups
grps
 
edm::ESGetToken
< EcalWeightXtalGroups,
EcalWeightXtalGroupsRcd
grpsToken_
 
edm::ESHandle
< EcalTimeCalibConstants
itime
 
edm::ESGetToken
< EcalTimeCalibConstants,
EcalTimeCalibConstantsRcd
itimeToken_
 
bool kPoorRecoFlagEB_
 
bool kPoorRecoFlagEE_
 
bool mitigateBadSamplesEB_
 
bool mitigateBadSamplesEE_
 
EcalUncalibRecHitMultiFitAlgo multiFitMethod_
 
edm::ESGetToken
< EcalSamplesCorrelation,
EcalSamplesCorrelationRcd
noiseConvariancesToken_
 
std::array
< SampleMatrixGainArray, 2 > 
noisecors_
 
edm::ESHandle
< EcalSamplesCorrelation
noisecovariances
 
edm::ESHandle
< EcalTimeOffsetConstant
offtime
 
edm::ESGetToken
< EcalTimeOffsetConstant,
EcalTimeOffsetConstantRcd
offtimeToken_
 
double outOfTimeThreshG12mEB_
 
double outOfTimeThreshG12mEE_
 
double outOfTimeThreshG12pEB_
 
double outOfTimeThreshG12pEE_
 
double outOfTimeThreshG61mEB_
 
double outOfTimeThreshG61mEE_
 
double outOfTimeThreshG61pEB_
 
double outOfTimeThreshG61pEE_
 
edm::ESHandle< EcalPedestalspeds
 
edm::ESGetToken< EcalPedestals,
EcalPedestalsRcd
pedsToken_
 
double prefitMaxChiSqEB_
 
double prefitMaxChiSqEE_
 
edm::ESGetToken
< EcalPulseCovariances,
EcalPulseCovariancesRcd
pulseConvariancesToken_
 
edm::ESHandle
< EcalPulseCovariances
pulsecovariances
 
edm::ESHandle< EcalPulseShapespulseshapes
 
edm::ESGetToken
< EcalPulseShapes,
EcalPulseShapesRcd
pulseShapesToken_
 
EcalUncalibRecHitRatioMethodAlgo
< EBDataFrame
ratioMethod_barrel_
 
EcalUncalibRecHitRatioMethodAlgo
< EEDataFrame
ratioMethod_endcap_
 
edm::ESHandle< EcalSampleMasksampleMaskHand_
 
edm::ESGetToken
< EcalSampleMask,
EcalSampleMaskRcd
sampleMaskToken_
 
bool selectiveBadSampleCriteriaEB_
 
bool selectiveBadSampleCriteriaEE_
 
bool simplifiedNoiseModelForGainSwitch_
 
TimeAlgo timealgo_ = noMethod
 
edm::ESHandle
< EcalTimeBiasCorrections
timeCorrBias_
 
edm::ESGetToken
< EcalTimeBiasCorrections,
EcalTimeBiasCorrectionsRcd
timeCorrBiasToken_
 
bool useLumiInfoRunHeader_
 
const
EcalWeightSet::EcalWeightMatrix
weights [2]
 
EcalUncalibRecHitTimeWeightsAlgo
< EBDataFrame
weightsMethod_barrel_
 
EcalUncalibRecHitTimeWeightsAlgo
< EEDataFrame
weightsMethod_endcap_
 
edm::ESHandle< EcalTBWeightswgts
 
edm::ESGetToken< EcalTBWeights,
EcalTBWeightsRcd
wgtsToken_
 

Detailed Description

Definition at line 52 of file EcalUncalibRecHitWorkerMultiFit.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

EcalUncalibRecHitWorkerMultiFit::EcalUncalibRecHitWorkerMultiFit ( const edm::ParameterSet ps,
edm::ConsumesCollector c 
)

Definition at line 13 of file EcalUncalibRecHitWorkerMultiFit.cc.

References activeBX, addPedestalUncertaintyEB_, addPedestalUncertaintyEE_, ampErrorCalculation_, amplitudeThreshEB_, amplitudeThreshEE_, bunchSpacing_, bunchSpacingManual_, computeCC_, edm::ConsumesCollector::consumes(), crossCorrelationMethod, doPrefitEB_, doPrefitEE_, dynamicPedestalsEB_, dynamicPedestalsEE_, EBamplitudeFitParameters_, EBtimeConstantTerm_, EBtimeFitLimits_, EBtimeFitParameters_, EBtimeNconst_, EEamplitudeFitParameters_, EEtimeConstantTerm_, EEtimeFitLimits_, EEtimeFitParameters_, EEtimeNconst_, edm::ConsumesCollector::esConsumes(), gainsToken_, gainSwitchUseMaxSampleEB_, gainSwitchUseMaxSampleEE_, edm::ParameterSet::getParameter(), grpsToken_, HLT_FULL_cff::InputTag, itimeToken_, mitigateBadSamplesEB_, mitigateBadSamplesEE_, noiseConvariancesToken_, offtimeToken_, outOfTimeThreshG12mEB_, outOfTimeThreshG12mEE_, outOfTimeThreshG12pEB_, outOfTimeThreshG12pEE_, outOfTimeThreshG61mEB_, outOfTimeThreshG61mEE_, outOfTimeThreshG61pEB_, outOfTimeThreshG61pEE_, pedsToken_, prefitMaxChiSqEB_, prefitMaxChiSqEE_, pulseConvariancesToken_, pulseShapesToken_, ratioMethod, BXVector< T >::resize(), sampleMaskToken_, selectiveBadSampleCriteriaEB_, selectiveBadSampleCriteriaEE_, simplifiedNoiseModelForGainSwitch_, dcs_trend_monitor_cfg::startTime, AlCaHLTBitMon_QueryRunRegistry::string, timealgo_, timeCorrBiasToken_, useLumiInfoRunHeader_, weightsMethod, and wgtsToken_.

15  // get the BX for the pulses to be activated
16  std::vector<int32_t> activeBXs = ps.getParameter<std::vector<int32_t>>("activeBXs");
17  activeBX.resize(activeBXs.size());
18  for (unsigned int ibx = 0; ibx < activeBXs.size(); ++ibx) {
19  activeBX.coeffRef(ibx) = activeBXs[ibx];
20  }
21 
22  // uncertainty calculation (CPU intensive)
23  ampErrorCalculation_ = ps.getParameter<bool>("ampErrorCalculation");
24  useLumiInfoRunHeader_ = ps.getParameter<bool>("useLumiInfoRunHeader");
25 
26  if (useLumiInfoRunHeader_) {
27  bunchSpacing_ = c.consumes<unsigned int>(edm::InputTag("bunchSpacingProducer"));
29  } else {
30  bunchSpacingManual_ = ps.getParameter<int>("bunchSpacing");
31  }
32 
33  doPrefitEB_ = ps.getParameter<bool>("doPrefitEB");
34  doPrefitEE_ = ps.getParameter<bool>("doPrefitEE");
35 
36  prefitMaxChiSqEB_ = ps.getParameter<double>("prefitMaxChiSqEB");
37  prefitMaxChiSqEE_ = ps.getParameter<double>("prefitMaxChiSqEE");
38 
39  dynamicPedestalsEB_ = ps.getParameter<bool>("dynamicPedestalsEB");
40  dynamicPedestalsEE_ = ps.getParameter<bool>("dynamicPedestalsEE");
41  mitigateBadSamplesEB_ = ps.getParameter<bool>("mitigateBadSamplesEB");
42  mitigateBadSamplesEE_ = ps.getParameter<bool>("mitigateBadSamplesEE");
43  gainSwitchUseMaxSampleEB_ = ps.getParameter<bool>("gainSwitchUseMaxSampleEB");
44  gainSwitchUseMaxSampleEE_ = ps.getParameter<bool>("gainSwitchUseMaxSampleEE");
45  selectiveBadSampleCriteriaEB_ = ps.getParameter<bool>("selectiveBadSampleCriteriaEB");
46  selectiveBadSampleCriteriaEE_ = ps.getParameter<bool>("selectiveBadSampleCriteriaEE");
47  addPedestalUncertaintyEB_ = ps.getParameter<double>("addPedestalUncertaintyEB");
48  addPedestalUncertaintyEE_ = ps.getParameter<double>("addPedestalUncertaintyEE");
49  simplifiedNoiseModelForGainSwitch_ = ps.getParameter<bool>("simplifiedNoiseModelForGainSwitch");
61 
62  // algorithm to be used for timing
63  auto const& timeAlgoName = ps.getParameter<std::string>("timealgo");
64  if (timeAlgoName == "RatioMethod")
66  else if (timeAlgoName == "WeightsMethod")
68  else if (timeAlgoName == "crossCorrelationMethod") {
70  double startTime = ps.getParameter<double>("crossCorrelationStartTime");
71  double stopTime = ps.getParameter<double>("crossCorrelationStopTime");
72  double targetTimePrecision = ps.getParameter<double>("crossCorrelationTargetTimePrecision");
73  computeCC_ = std::make_unique<EcalUncalibRecHitTimingCCAlgo>(startTime, stopTime, targetTimePrecision);
74  } else if (timeAlgoName != "None")
75  edm::LogError("EcalUncalibRecHitError") << "No time estimation algorithm defined";
76 
77  // ratio method parameters
78  EBtimeFitParameters_ = ps.getParameter<std::vector<double>>("EBtimeFitParameters");
79  EEtimeFitParameters_ = ps.getParameter<std::vector<double>>("EEtimeFitParameters");
80  EBamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EBamplitudeFitParameters");
81  EEamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EEamplitudeFitParameters");
82  EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
83  EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
84  EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
85  EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
86  EBtimeConstantTerm_ = ps.getParameter<double>("EBtimeConstantTerm");
87  EEtimeConstantTerm_ = ps.getParameter<double>("EEtimeConstantTerm");
88  EBtimeNconst_ = ps.getParameter<double>("EBtimeNconst");
89  EEtimeNconst_ = ps.getParameter<double>("EEtimeNconst");
90  outOfTimeThreshG12pEB_ = ps.getParameter<double>("outOfTimeThresholdGain12pEB");
91  outOfTimeThreshG12mEB_ = ps.getParameter<double>("outOfTimeThresholdGain12mEB");
92  outOfTimeThreshG61pEB_ = ps.getParameter<double>("outOfTimeThresholdGain61pEB");
93  outOfTimeThreshG61mEB_ = ps.getParameter<double>("outOfTimeThresholdGain61mEB");
94  outOfTimeThreshG12pEE_ = ps.getParameter<double>("outOfTimeThresholdGain12pEE");
95  outOfTimeThreshG12mEE_ = ps.getParameter<double>("outOfTimeThresholdGain12mEE");
96  outOfTimeThreshG61pEE_ = ps.getParameter<double>("outOfTimeThresholdGain61pEE");
97  outOfTimeThreshG61mEE_ = ps.getParameter<double>("outOfTimeThresholdGain61mEE");
98  amplitudeThreshEB_ = ps.getParameter<double>("amplitudeThresholdEB");
99  amplitudeThreshEE_ = ps.getParameter<double>("amplitudeThresholdEE");
100 }
edm::ESGetToken< EcalPulseCovariances, EcalPulseCovariancesRcd > pulseConvariancesToken_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
EcalPulseShapesMap EcalPulseShapes
edm::ESGetToken< EcalPulseShapes, EcalPulseShapesRcd > pulseShapesToken_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > gainsToken_
EcalCondObjectContainer< EcalXtalGroupId > EcalWeightXtalGroups
Log< level::Error, false > LogError
edm::ESGetToken< EcalSamplesCorrelation, EcalSamplesCorrelationRcd > noiseConvariancesToken_
edm::EDGetTokenT< unsigned int > bunchSpacing_
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedsToken_
edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcd > wgtsToken_
EcalGainRatioMap EcalGainRatios
EcalPulseCovariancesMap EcalPulseCovariances
std::unique_ptr< EcalUncalibRecHitTimingCCAlgo > computeCC_
EcalPedestalsMap EcalPedestals
Definition: EcalPedestals.h:50
edm::ESGetToken< EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd > offtimeToken_
EcalTimeCalibConstantMap EcalTimeCalibConstants
void resize(int bx, unsigned size)
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< EcalTimeBiasCorrections, EcalTimeBiasCorrectionsRcd > timeCorrBiasToken_
edm::ESGetToken< EcalSampleMask, EcalSampleMaskRcd > sampleMaskToken_
edm::ESGetToken< EcalTimeCalibConstants, EcalTimeCalibConstantsRcd > itimeToken_
edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcd > grpsToken_
EcalUncalibRecHitWorkerMultiFit::EcalUncalibRecHitWorkerMultiFit ( )
inline

Definition at line 55 of file EcalUncalibRecHitWorkerMultiFit.h.

55 {};
EcalUncalibRecHitWorkerMultiFit::~EcalUncalibRecHitWorkerMultiFit ( )
inlineoverride

Definition at line 56 of file EcalUncalibRecHitWorkerMultiFit.h.

56 {};

Member Function Documentation

edm::ParameterSetDescription EcalUncalibRecHitWorkerMultiFit::getAlgoDescription ( )
overridevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 496 of file EcalUncalibRecHitWorkerMultiFit.cc.

References edm::ParameterSetDescription::addNode().

496  {
498  psd.addNode(edm::ParameterDescription<std::vector<int>>("activeBXs", {-5, -4, -3, -2, -1, 0, 1, 2, 3, 4}, true) and
499  edm::ParameterDescription<bool>("ampErrorCalculation", true, true) and
500  edm::ParameterDescription<bool>("useLumiInfoRunHeader", true, true) and
501  edm::ParameterDescription<int>("bunchSpacing", 0, true) and
502  edm::ParameterDescription<bool>("doPrefitEB", false, true) and
503  edm::ParameterDescription<bool>("doPrefitEE", false, true) and
504  edm::ParameterDescription<double>("prefitMaxChiSqEB", 25., true) and
505  edm::ParameterDescription<double>("prefitMaxChiSqEE", 10., true) and
506  edm::ParameterDescription<bool>("dynamicPedestalsEB", false, true) and
507  edm::ParameterDescription<bool>("dynamicPedestalsEE", false, true) and
508  edm::ParameterDescription<bool>("mitigateBadSamplesEB", false, true) and
509  edm::ParameterDescription<bool>("mitigateBadSamplesEE", false, true) and
510  edm::ParameterDescription<bool>("gainSwitchUseMaxSampleEB", false, true) and
511  edm::ParameterDescription<bool>("gainSwitchUseMaxSampleEE", false, true) and
512  edm::ParameterDescription<bool>("selectiveBadSampleCriteriaEB", false, true) and
513  edm::ParameterDescription<bool>("selectiveBadSampleCriteriaEE", false, true) and
514  edm::ParameterDescription<double>("addPedestalUncertaintyEB", 0., true) and
515  edm::ParameterDescription<double>("addPedestalUncertaintyEE", 0., true) and
516  edm::ParameterDescription<bool>("simplifiedNoiseModelForGainSwitch", true, true) and
517  edm::ParameterDescription<std::string>("timealgo", "RatioMethod", true) and
518  edm::ParameterDescription<std::vector<double>>("EBtimeFitParameters",
519  {-2.015452e+00,
520  3.130702e+00,
521  -1.234730e+01,
522  4.188921e+01,
523  -8.283944e+01,
524  9.101147e+01,
525  -5.035761e+01,
526  1.105621e+01},
527  true) and
528  edm::ParameterDescription<std::vector<double>>("EEtimeFitParameters",
529  {-2.390548e+00,
530  3.553628e+00,
531  -1.762341e+01,
532  6.767538e+01,
533  -1.332130e+02,
534  1.407432e+02,
535  -7.541106e+01,
536  1.620277e+01},
537  true) and
538  edm::ParameterDescription<std::vector<double>>("EBamplitudeFitParameters", {1.138, 1.652}, true) and
539  edm::ParameterDescription<std::vector<double>>("EEamplitudeFitParameters", {1.890, 1.400}, true) and
540  edm::ParameterDescription<double>("EBtimeFitLimits_Lower", 0.2, true) and
541  edm::ParameterDescription<double>("EBtimeFitLimits_Upper", 1.4, true) and
542  edm::ParameterDescription<double>("EEtimeFitLimits_Lower", 0.2, true) and
543  edm::ParameterDescription<double>("EEtimeFitLimits_Upper", 1.4, true) and
544  edm::ParameterDescription<double>("EBtimeConstantTerm", .6, true) and
545  edm::ParameterDescription<double>("EEtimeConstantTerm", 1.0, true) and
546  edm::ParameterDescription<double>("EBtimeNconst", 28.5, true) and
547  edm::ParameterDescription<double>("EEtimeNconst", 31.8, true) and
548  edm::ParameterDescription<double>("outOfTimeThresholdGain12pEB", 5, true) and
549  edm::ParameterDescription<double>("outOfTimeThresholdGain12mEB", 5, true) and
550  edm::ParameterDescription<double>("outOfTimeThresholdGain61pEB", 5, true) and
551  edm::ParameterDescription<double>("outOfTimeThresholdGain61mEB", 5, true) and
552  edm::ParameterDescription<double>("outOfTimeThresholdGain12pEE", 1000, true) and
553  edm::ParameterDescription<double>("outOfTimeThresholdGain12mEE", 1000, true) and
554  edm::ParameterDescription<double>("outOfTimeThresholdGain61pEE", 1000, true) and
555  edm::ParameterDescription<double>("outOfTimeThresholdGain61mEE", 1000, true) and
556  edm::ParameterDescription<double>("amplitudeThresholdEB", 10, true) and
557  edm::ParameterDescription<double>("amplitudeThresholdEE", 10, true) and
558  edm::ParameterDescription<double>("crossCorrelationStartTime", -25.0, true) and
559  edm::ParameterDescription<double>("crossCorrelationStopTime", 25.0, true) and
560  edm::ParameterDescription<double>("crossCorrelationTargetTimePrecision", 0.01, true));
561 
562  return psd;
563 }
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
const SampleMatrix& EcalUncalibRecHitWorkerMultiFit::noisecor ( bool  barrel,
int  gain 
) const
inlineprivate

Definition at line 80 of file EcalUncalibRecHitWorkerMultiFit.h.

References noisecors_.

Referenced by run().

80 { return noisecors_[barrel ? 1 : 0][gain]; }
std::array< SampleMatrixGainArray, 2 > noisecors_
const SampleMatrixGainArray& EcalUncalibRecHitWorkerMultiFit::noisecor ( bool  barrel) const
inlineprivate

Definition at line 81 of file EcalUncalibRecHitWorkerMultiFit.h.

References noisecors_.

81 { return noisecors_[barrel ? 1 : 0]; }
std::array< SampleMatrixGainArray, 2 > noisecors_
void EcalUncalibRecHitWorkerMultiFit::run ( const edm::Event evt,
const EcalDigiCollection digis,
EcalUncalibratedRecHitCollection result 
)
overrideprivatevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 228 of file EcalUncalibRecHitWorkerMultiFit.cc.

References activeBX, addPedestalUncertaintyEB_, addPedestalUncertaintyEE_, amplitudeThreshEB_, amplitudeThreshEE_, edm::SortedCollection< T, SORT >::back(), Reference_intrackfit_cff::barrel, edm::DataFrameContainer::begin(), EcalUncalibRecHitRatioMethodAlgo< C >::computeAmplitude(), computeCC_, EcalUncalibRecHitRatioMethodAlgo< C >::computeTime(), crossCorrelationMethod, doPrefitEB_, doPrefitEE_, dynamicPedestalsEB_, dynamicPedestalsEE_, EBamplitudeFitParameters_, EBtimeConstantTerm_, EBtimeFitLimits_, EBtimeFitParameters_, EBtimeNconst_, EcalBarrel, EcalEndcap, EEamplitudeFitParameters_, EEtimeConstantTerm_, EEtimeFitLimits_, EEtimeFitParameters_, EEtimeNconst_, edm::DataFrameContainer::empty(), edm::DataFrameContainer::end(), EcalUncalibRecHitRatioMethodAlgo< C >::fixMGPAslew(), EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), ecalLiteDTU::gainId(), gains, gainSwitchUseMaxSampleEB_, gainSwitchUseMaxSampleEE_, EcalUncalibRecHitRatioMethodAlgo< C >::getCalculatedRecHit(), EcalWeightSet::getWeightsAfterGainSwitch(), EcalWeightSet::getWeightsBeforeGainSwitch(), grps, ecalpyutils::hashedIndex(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), mps_fire::i, EcalXtalGroupId::id(), EcalUncalibRecHitRatioMethodAlgo< C >::init(), itime, dqmiolumiharvest::j, EcalUncalibratedRecHit::kHasSwitchToGain1, EcalUncalibratedRecHit::kHasSwitchToGain6, EcalUncalibratedRecHit::kOutOfTime, EcalUncalibratedRecHit::kSaturated, EcalUncalibRecHitMultiFitAlgo::makeRecHit(), EcalDataFrame::MAXSAMPLES, mitigateBadSamplesEB_, mitigateBadSamplesEE_, multiFitMethod_, noisecor(), offtime, outOfTimeThreshG12mEB_, outOfTimeThreshG12mEE_, outOfTimeThreshG12pEB_, outOfTimeThreshG12pEE_, outOfTimeThreshG61mEB_, outOfTimeThreshG61mEE_, outOfTimeThreshG61pEB_, outOfTimeThreshG61pEE_, EcalCondDBWriter_cfi::pedestal, peds, edm::SortedCollection< T, SORT >::pop_back(), funct::pow(), prefitMaxChiSqEB_, prefitMaxChiSqEE_, edm::ESHandle< class >::product(), pulsecovariances, pulseshapes, edm::SortedCollection< T, SORT >::push_back(), ratioMethod, ratioMethod_barrel_, ratioMethod_endcap_, edm::SortedCollection< T, SORT >::reserve(), makeMEIFBenchmarkPlots::sample, sampleMaskHand_, selectiveBadSampleCriteriaEB_, selectiveBadSampleCriteriaEE_, EcalUncalibRecHitMultiFitAlgo::setAddPedestalUncertainty(), EcalUncalibRecHitMultiFitAlgo::setDoPrefit(), EcalUncalibRecHitMultiFitAlgo::setDynamicPedestals(), EcalUncalibRecHitMultiFitAlgo::setGainSwitchUseMaxSample(), EcalUncalibRecHitMultiFitAlgo::setMitigateBadSamples(), EcalUncalibRecHitMultiFitAlgo::setPrefitMaxChiSq(), EcalUncalibRecHitMultiFitAlgo::setSelectiveBadSampleCriteria(), EcalUncalibRecHitMultiFitAlgo::setSimplifiedNoiseModelForGainSwitch(), simplifiedNoiseModelForGainSwitch_, BXVector< T >::size(), edm::SortedCollection< T, SORT >::size(), edm::DataFrameContainer::size(), mathSSE::sqrt(), EcalPulseShape::TEMPLATESAMPLES, EcalUncalibRecHitTimeWeightsAlgo< C >::time(), timealgo_, timeCorrBias_, timeCorrection(), weights, weightsMethod, weightsMethod_barrel_, weightsMethod_endcap_, and wgts.

230  {
231  if (digis.empty())
232  return;
233 
234  // assume all digis come from the same subdetector (either barrel or endcap)
235  DetId detid(digis.begin()->id());
236  bool barrel = (detid.subdetId() == EcalBarrel);
237 
239  if (barrel) {
247  } else {
255  }
256 
257  FullSampleVector fullpulse(FullSampleVector::Zero());
258  FullSampleMatrix fullpulsecov(FullSampleMatrix::Zero());
259 
260  result.reserve(result.size() + digis.size());
261  for (auto itdg = digis.begin(); itdg != digis.end(); ++itdg) {
262  DetId detid(itdg->id());
263 
264  const EcalSampleMask* sampleMask_ = sampleMaskHand_.product();
265 
266  // intelligence for recHit computation
267  float offsetTime = 0;
268 
269  const EcalPedestals::Item* aped = nullptr;
270  const EcalMGPAGainRatio* aGain = nullptr;
271  const EcalXtalGroupId* gid = nullptr;
272  const EcalPulseShapes::Item* aPulse = nullptr;
273  const EcalPulseCovariances::Item* aPulseCov = nullptr;
274 
275  if (barrel) {
276  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
277  aped = &peds->barrel(hashedIndex);
278  aGain = &gains->barrel(hashedIndex);
279  gid = &grps->barrel(hashedIndex);
280  aPulse = &pulseshapes->barrel(hashedIndex);
281  aPulseCov = &pulsecovariances->barrel(hashedIndex);
282  offsetTime = offtime->getEBValue();
283  } else {
284  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
285  aped = &peds->endcap(hashedIndex);
286  aGain = &gains->endcap(hashedIndex);
287  gid = &grps->endcap(hashedIndex);
288  aPulse = &pulseshapes->endcap(hashedIndex);
289  aPulseCov = &pulsecovariances->endcap(hashedIndex);
290  offsetTime = offtime->getEEValue();
291  }
292 
293  double pedVec[3] = {aped->mean_x12, aped->mean_x6, aped->mean_x1};
294  double pedRMSVec[3] = {aped->rms_x12, aped->rms_x6, aped->rms_x1};
295  double gainRatios[3] = {1., aGain->gain12Over6(), aGain->gain6Over1() * aGain->gain12Over6()};
296 
297  for (int i = 0; i < EcalPulseShape::TEMPLATESAMPLES; ++i)
298  fullpulse(i + 7) = aPulse->pdfval[i];
299 
300  for (int i = 0; i < EcalPulseShape::TEMPLATESAMPLES; i++)
301  for (int j = 0; j < EcalPulseShape::TEMPLATESAMPLES; j++)
302  fullpulsecov(i + 7, j + 7) = aPulseCov->covval[i][j];
303 
304  // compute the right bin of the pulse shape using time calibration constants
306  EcalTimeCalibConstant itimeconst = 0;
307  if (it != itime->end()) {
308  itimeconst = (*it);
309  } else {
310  edm::LogError("EcalRecHitError") << "No time intercalib const found for xtal " << detid.rawId()
311  << "! something wrong with EcalTimeCalibConstants in your DB? ";
312  }
313 
314  int lastSampleBeforeSaturation = -2;
315  for (unsigned int iSample = 0; iSample < EcalDataFrame::MAXSAMPLES; iSample++) {
316  if (((EcalDataFrame)(*itdg)).sample(iSample).gainId() == 0) {
317  lastSampleBeforeSaturation = iSample - 1;
318  break;
319  }
320  }
321 
322  // === amplitude computation ===
323 
324  if (lastSampleBeforeSaturation == 4) { // saturation on the expected max sample
325  result.emplace_back((*itdg).id(), 4095 * 12, 0, 0, 0);
326  auto& uncalibRecHit = result.back();
327  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kSaturated);
328  // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
329  uncalibRecHit.setChi2(0);
330  } else if (lastSampleBeforeSaturation >=
331  -1) { // saturation on other samples: cannot extrapolate from the fourth one
332  int gainId = ((EcalDataFrame)(*itdg)).sample(5).gainId();
333  if (gainId == 0)
334  gainId = 3;
335  auto pedestal = pedVec[gainId - 1];
336  auto gainratio = gainRatios[gainId - 1];
337  double amplitude = ((double)(((EcalDataFrame)(*itdg)).sample(5).adc()) - pedestal) * gainratio;
338  result.emplace_back((*itdg).id(), amplitude, 0, 0, 0);
339  auto& uncalibRecHit = result.back();
340  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kSaturated);
341  // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
342  uncalibRecHit.setChi2(0);
343  } else {
344  // multifit
345  const SampleMatrixGainArray& noisecors = noisecor(barrel);
346 
347  result.push_back(multiFitMethod_.makeRecHit(*itdg, aped, aGain, noisecors, fullpulse, fullpulsecov, activeBX));
348  auto& uncalibRecHit = result.back();
349 
350  // === time computation ===
351  if (timealgo_ == ratioMethod) {
352  // ratio method
353  constexpr float clockToNsConstant = 25.;
354  constexpr float invClockToNs = 1. / clockToNsConstant;
355  if (not barrel) {
356  ratioMethod_endcap_.init(*itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios);
361  double theTimeCorrectionEE = timeCorrection(
362  uncalibRecHit.amplitude(), timeCorrBias_->EETimeCorrAmplitudeBins, timeCorrBias_->EETimeCorrShiftBins);
363 
364  uncalibRecHit.setJitter(crh.timeMax - 5 + theTimeCorrectionEE);
365  uncalibRecHit.setJitterError(
366  std::sqrt(std::pow(crh.timeError, 2) + std::pow(EEtimeConstantTerm_ * invClockToNs, 2)));
367 
368  // consider flagging as kOutOfTime only if above noise
369  if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEE_) {
370  float outOfTimeThreshP = outOfTimeThreshG12pEE_;
371  float outOfTimeThreshM = outOfTimeThreshG12mEE_;
372  // determine if gain has switched away from gainId==1 (x12 gain)
373  // and determine cuts (number of 'sigmas') to ose for kOutOfTime
374  // >3k ADC is necessasry condition for gain switch to occur
375  if (uncalibRecHit.amplitude() > 3000.) {
376  for (int iSample = 0; iSample < EEDataFrame::MAXSAMPLES; iSample++) {
377  int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
378  if (GainId != 1) {
379  outOfTimeThreshP = outOfTimeThreshG61pEE_;
380  outOfTimeThreshM = outOfTimeThreshG61mEE_;
381  break;
382  }
383  }
384  }
385  float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
386  float cterm = EEtimeConstantTerm_;
387  float sigmaped = pedRMSVec[0]; // approx for lower gains
388  float nterm = EEtimeNconst_ * sigmaped / uncalibRecHit.amplitude();
389  float sigmat = std::sqrt(nterm * nterm + cterm * cterm);
390  if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < -sigmat * outOfTimeThreshM)) {
391  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kOutOfTime);
392  }
393  }
394 
395  } else {
396  ratioMethod_barrel_.init(*itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios);
402 
403  double theTimeCorrectionEB = timeCorrection(
404  uncalibRecHit.amplitude(), timeCorrBias_->EBTimeCorrAmplitudeBins, timeCorrBias_->EBTimeCorrShiftBins);
405 
406  uncalibRecHit.setJitter(crh.timeMax - 5 + theTimeCorrectionEB);
407  uncalibRecHit.setJitterError(std::hypot(crh.timeError, EBtimeConstantTerm_ / clockToNsConstant));
408 
409  // consider flagging as kOutOfTime only if above noise
410  if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEB_) {
411  float outOfTimeThreshP = outOfTimeThreshG12pEB_;
412  float outOfTimeThreshM = outOfTimeThreshG12mEB_;
413  // determine if gain has switched away from gainId==1 (x12 gain)
414  // and determine cuts (number of 'sigmas') to ose for kOutOfTime
415  // >3k ADC is necessasry condition for gain switch to occur
416  if (uncalibRecHit.amplitude() > 3000.) {
417  for (int iSample = 0; iSample < EBDataFrame::MAXSAMPLES; iSample++) {
418  int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
419  if (GainId != 1) {
420  outOfTimeThreshP = outOfTimeThreshG61pEB_;
421  outOfTimeThreshM = outOfTimeThreshG61mEB_;
422  break;
423  }
424  }
425  }
426  float correctedTime = (crh.timeMax - 5) * clockToNsConstant + itimeconst + offsetTime;
427  float cterm = EBtimeConstantTerm_;
428  float sigmaped = pedRMSVec[0]; // approx for lower gains
429  float nterm = EBtimeNconst_ * sigmaped / uncalibRecHit.amplitude();
430  float sigmat = std::sqrt(nterm * nterm + cterm * cterm);
431  if ((correctedTime > sigmat * outOfTimeThreshP) || (correctedTime < -sigmat * outOfTimeThreshM)) {
432  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kOutOfTime);
433  }
434  }
435  }
436  } else if (timealgo_ == weightsMethod) {
437  // weights method on the PU subtracted pulse shape
438  std::vector<double> amplitudes;
439  for (unsigned int ibx = 0; ibx < activeBX.size(); ++ibx)
440  amplitudes.push_back(uncalibRecHit.outOfTimeAmplitude(ibx));
441 
442  EcalTBWeights::EcalTDCId tdcid(1);
443  EcalTBWeights::EcalTBWeightMap const& wgtsMap = wgts->getMap();
444  EcalTBWeights::EcalTBWeightMap::const_iterator wit;
445  wit = wgtsMap.find(std::make_pair(*gid, tdcid));
446  if (wit == wgtsMap.end()) {
447  edm::LogError("EcalUncalibRecHitError")
448  << "No weights found for EcalGroupId: " << gid->id() << " and EcalTDCId: " << tdcid
449  << "\n skipping digi with id: " << detid.rawId();
450  result.pop_back();
451  continue;
452  }
453  const EcalWeightSet& wset = wit->second; // this is the EcalWeightSet
454 
457 
458  weights[0] = &mat1;
459  weights[1] = &mat2;
460 
461  double timerh;
462  if (detid.subdetId() == EcalEndcap) {
463  timerh = weightsMethod_endcap_.time(*itdg, amplitudes, aped, aGain, fullpulse, weights);
464  } else {
465  timerh = weightsMethod_barrel_.time(*itdg, amplitudes, aped, aGain, fullpulse, weights);
466  }
467  uncalibRecHit.setJitter(timerh);
468  uncalibRecHit.setJitterError(0.); // not computed with weights
469 
470  } else if (timealgo_ == crossCorrelationMethod) {
471  std::vector<double> amplitudes(activeBX.size());
472  for (unsigned int ibx = 0; ibx < activeBX.size(); ++ibx)
473  amplitudes[ibx] = uncalibRecHit.outOfTimeAmplitude(ibx);
474 
475  float jitterError = 0.;
476  float jitter = computeCC_->computeTimeCC(*itdg, amplitudes, aped, aGain, fullpulse, uncalibRecHit, jitterError);
477 
478  uncalibRecHit.setJitter(jitter);
479  uncalibRecHit.setJitterError(jitterError);
480 
481  } else { // no time method;
482  uncalibRecHit.setJitter(0.);
483  uncalibRecHit.setJitterError(0.);
484  }
485  }
486 
487  // set flags if gain switch has occurred
488  auto& uncalibRecHit = result.back();
489  if (((EcalDataFrame)(*itdg)).hasSwitchToGain6())
490  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kHasSwitchToGain6);
491  if (((EcalDataFrame)(*itdg)).hasSwitchToGain1())
492  uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kHasSwitchToGain1);
493  }
494 }
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
void computeAmplitude(std::vector< double > &amplitudeFitParameters)
unsigned size(int bx) const
EcalUncalibRecHitMultiFitAlgo multiFitMethod_
std::array< SampleMatrix, NGains > SampleMatrixGainArray
EcalUncalibRecHitTimeWeightsAlgo< EEDataFrame > weightsMethod_endcap_
Eigen::Matrix< double, FullSampleVectorSize, FullSampleVectorSize > FullSampleMatrix
double time(const C &dataFrame, const std::vector< double > &amplitudes, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const FullSampleVector &fullpulse, const EcalWeightSet::EcalWeightMatrix **weights)
Compute time.
Eigen::Matrix< double, FullSampleVectorSize, 1 > FullSampleVector
std::map< std::pair< EcalXtalGroupId, EcalTDCId >, EcalWeightSet > EcalTBWeightMap
Definition: EcalTBWeights.h:18
void computeTime(std::vector< double > &timeFitParameters, std::pair< double, double > &timeFitLimits, std::vector< double > &amplitudeFitParameters)
static const int TEMPLATESAMPLES
edm::ESHandle< EcalWeightXtalGroups > grps
void push_back(T const &t)
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:19
const_iterator begin() const
The iterator returned can not safely be used across threads.
Log< level::Error, false > LogError
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > ratioMethod_barrel_
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:36
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > ratioMethod_endcap_
T sqrt(T t)
Definition: SSEVec.h:19
edm::ESHandle< EcalPulseShapes > pulseshapes
edm::ESHandle< EcalTimeCalibConstants > itime
double timeCorrection(float ampli, const std::vector< float > &amplitudeBins, const std::vector< float > &shiftBins)
float gain6Over1() const
std::unique_ptr< EcalUncalibRecHitTimingCCAlgo > computeCC_
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:27
EcalUncalibratedRecHit makeRecHit(const EcalDataFrame &dataFrame, const EcalPedestals::Item *aped, const EcalMGPAGainRatio *aGain, const SampleMatrixGainArray &noisecors, const FullSampleVector &fullpulse, const FullSampleMatrix &fullpulsecov, const BXVector &activeBX)
compute rechits
edm::ESHandle< EcalTimeBiasCorrections > timeCorrBias_
Definition: DetId.h:17
edm::ESHandle< EcalPulseCovariances > pulsecovariances
constexpr int gainId(sample_type sample)
get the gainId (2 bits)
int hashedIndex() const
Definition: EEDetId.h:183
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:26
std::vector< Item >::const_iterator const_iterator
T const * product() const
Definition: ESHandle.h:86
unsigned int id() const
float gain12Over6() const
EcalUncalibRecHitTimeWeightsAlgo< EBDataFrame > weightsMethod_barrel_
edm::ESHandle< EcalTimeOffsetConstant > offtime
const_iterator end() const
float EcalTimeCalibConstant
size_type size() const
void reserve(size_type n)
const SampleMatrix & noisecor(bool barrel, int gain) const
static constexpr int MAXSAMPLES
Definition: EcalDataFrame.h:48
edm::ESHandle< EcalSampleMask > sampleMaskHand_
const EcalWeightSet::EcalWeightMatrix * weights[2]
void init(const C &dataFrame, const EcalSampleMask &sampleMask, const double *pedestals, const double *pedestalRMSes, const double *gainRatios)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
const_reference back() const
void EcalUncalibRecHitWorkerMultiFit::set ( const edm::EventSetup es)
overrideprivatevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 102 of file EcalUncalibRecHitWorkerMultiFit.cc.

References funct::abs(), ampErrorCalculation_, EcalUncalibRecHitMultiFitAlgo::disableErrorCalculation(), gains, gainsToken_, edm::EventSetup::getHandle(), grps, grpsToken_, mps_fire::i, itime, itimeToken_, dqmiolumiharvest::j, multiFitMethod_, noiseConvariancesToken_, noisecors_, noisecovariances, offtime, offtimeToken_, peds, pedsToken_, pulseConvariancesToken_, pulsecovariances, pulseshapes, pulseShapesToken_, sampleMaskHand_, sampleMaskToken_, timeCorrBias_, timeCorrBiasToken_, wgts, and wgtsToken_.

102  {
103  // common setup
105  peds = es.getHandle(pedsToken_);
106 
107  // for the multifit method
113 
114  // weights parameters for the time
115  grps = es.getHandle(grpsToken_);
116  wgts = es.getHandle(wgtsToken_);
117 
118  // which of the samples need be used
120 
121  // for the ratio method
124 
125  // for the time correction methods
127 
128  int nnoise = SampleVector::RowsAtCompileTime;
129  SampleMatrix& noisecorEBg12 = noisecors_[1][0];
130  SampleMatrix& noisecorEBg6 = noisecors_[1][1];
131  SampleMatrix& noisecorEBg1 = noisecors_[1][2];
132  SampleMatrix& noisecorEEg12 = noisecors_[0][0];
133  SampleMatrix& noisecorEEg6 = noisecors_[0][1];
134  SampleMatrix& noisecorEEg1 = noisecors_[0][2];
135 
136  for (int i = 0; i < nnoise; ++i) {
137  for (int j = 0; j < nnoise; ++j) {
138  int vidx = std::abs(j - i);
139  noisecorEBg12(i, j) = noisecovariances->EBG12SamplesCorrelation[vidx];
140  noisecorEEg12(i, j) = noisecovariances->EEG12SamplesCorrelation[vidx];
141  noisecorEBg6(i, j) = noisecovariances->EBG6SamplesCorrelation[vidx];
142  noisecorEEg6(i, j) = noisecovariances->EEG6SamplesCorrelation[vidx];
143  noisecorEBg1(i, j) = noisecovariances->EBG1SamplesCorrelation[vidx];
144  noisecorEEg1(i, j) = noisecovariances->EEG1SamplesCorrelation[vidx];
145  }
146  }
147 }
edm::ESGetToken< EcalPulseCovariances, EcalPulseCovariancesRcd > pulseConvariancesToken_
std::array< SampleMatrixGainArray, 2 > noisecors_
EcalUncalibRecHitMultiFitAlgo multiFitMethod_
edm::ESGetToken< EcalPulseShapes, EcalPulseShapesRcd > pulseShapesToken_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > gainsToken_
edm::ESHandle< EcalWeightXtalGroups > grps
edm::ESGetToken< EcalSamplesCorrelation, EcalSamplesCorrelationRcd > noiseConvariancesToken_
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedsToken_
edm::ESGetToken< EcalTBWeights, EcalTBWeightsRcd > wgtsToken_
edm::ESHandle< EcalPulseShapes > pulseshapes
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::ESHandle< EcalTimeCalibConstants > itime
edm::ESHandle< EcalTimeBiasCorrections > timeCorrBias_
edm::ESGetToken< EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd > offtimeToken_
edm::ESHandle< EcalPulseCovariances > pulsecovariances
edm::ESGetToken< EcalTimeBiasCorrections, EcalTimeBiasCorrectionsRcd > timeCorrBiasToken_
Eigen::Matrix< double, SampleVectorSize, SampleVectorSize > SampleMatrix
edm::ESHandle< EcalTimeOffsetConstant > offtime
edm::ESGetToken< EcalSampleMask, EcalSampleMaskRcd > sampleMaskToken_
edm::ESGetToken< EcalTimeCalibConstants, EcalTimeCalibConstantsRcd > itimeToken_
edm::ESHandle< EcalSampleMask > sampleMaskHand_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
edm::ESHandle< EcalSamplesCorrelation > noisecovariances
edm::ESGetToken< EcalWeightXtalGroups, EcalWeightXtalGroupsRcd > grpsToken_
void EcalUncalibRecHitWorkerMultiFit::set ( const edm::Event evt)
overrideprivatevirtual

Reimplemented from EcalUncalibRecHitWorkerBaseClass.

Definition at line 149 of file EcalUncalibRecHitWorkerMultiFit.cc.

References activeBX, bunchSpacing_, bunchSpacingManual_, edm::Event::getByToken(), BXVector< T >::resize(), and useLumiInfoRunHeader_.

149  {
150  unsigned int bunchspacing = 450;
151 
152  if (useLumiInfoRunHeader_) {
153  edm::Handle<unsigned int> bunchSpacingH;
154  evt.getByToken(bunchSpacing_, bunchSpacingH);
155  bunchspacing = *bunchSpacingH;
156  } else {
157  bunchspacing = bunchSpacingManual_;
158  }
159 
161  if (bunchspacing == 25) {
162  activeBX.resize(10);
163  activeBX << -5, -4, -3, -2, -1, 0, 1, 2, 3, 4;
164  } else {
165  //50ns configuration otherwise (also for no pileup)
166  activeBX.resize(5);
167  activeBX << -4, -2, 0, 2, 4;
168  }
169  }
170 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
edm::EDGetTokenT< unsigned int > bunchSpacing_
void resize(int bx, unsigned size)
double EcalUncalibRecHitWorkerMultiFit::timeCorrection ( float  ampli,
const std::vector< float > &  amplitudeBins,
const std::vector< float > &  shiftBins 
)
private

Amplitude-dependent time corrections; EE and EB have separate corrections: EXtimeCorrAmplitudes (ADC) and EXtimeCorrShifts (ns) need to have the same number of elements Bins must be ordered in amplitude. First-last bins take care of under-overflows.

The algorithm is the same for EE and EB, only the correction vectors are different.

Returns
Jitter (in clock cycles) which will be added to UncalibRechit.setJitter(), 0 if no correction is applied.

Definition at line 181 of file EcalUncalibRecHitWorkerMultiFit.cc.

References newFWLiteAna::bin.

Referenced by run().

183  {
184  // computed initially in ns. Than turned in the BX's, as
185  // EcalUncalibratedRecHit need be.
186  double theCorrection = 0;
187 
188  // sanity check for arrays
189  if (amplitudeBins.empty()) {
190  edm::LogError("EcalRecHitError") << "timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
191 
192  return 0;
193  }
194 
195  if (amplitudeBins.size() != shiftBins.size()) {
196  edm::LogError("EcalRecHitError") << "Size of timeCorrAmplitudeBins different from "
197  "timeCorrShiftBins. Forcing no time bias corrections. ";
198 
199  return 0;
200  }
201 
202  // FIXME? what about a binary search?
203  int myBin = -1;
204  for (int bin = 0; bin < (int)amplitudeBins.size(); bin++) {
205  if (ampli > amplitudeBins[bin]) {
206  myBin = bin;
207  } else {
208  break;
209  }
210  }
211 
212  if (myBin == -1) {
213  theCorrection = shiftBins[0];
214  } else if (myBin == ((int)(amplitudeBins.size() - 1))) {
215  theCorrection = shiftBins[myBin];
216  } else {
217  // interpolate linearly between two assingned points
218  theCorrection = (shiftBins[myBin + 1] - shiftBins[myBin]);
219  theCorrection *= (((double)ampli) - amplitudeBins[myBin]) / (amplitudeBins[myBin + 1] - amplitudeBins[myBin]);
220  theCorrection += shiftBins[myBin];
221  }
222 
223  // convert ns into clocks
224  constexpr double inv25 = 1. / 25.;
225  return theCorrection * inv25;
226 }
Log< level::Error, false > LogError

Member Data Documentation

BXVector EcalUncalibRecHitWorkerMultiFit::activeBX
private

Definition at line 85 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), run(), and set().

double EcalUncalibRecHitWorkerMultiFit::addPedestalUncertaintyEB_
private

Definition at line 121 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::addPedestalUncertaintyEE_
private

Definition at line 122 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

bool EcalUncalibRecHitWorkerMultiFit::ampErrorCalculation_
private

Definition at line 86 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

double EcalUncalibRecHitWorkerMultiFit::amplitudeThreshEB_
private

Definition at line 148 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::amplitudeThreshEE_
private

Definition at line 149 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

edm::EDGetTokenT<unsigned int> EcalUncalibRecHitWorkerMultiFit::bunchSpacing_
private

Definition at line 91 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

int EcalUncalibRecHitWorkerMultiFit::bunchSpacingManual_
private

Definition at line 90 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

double EcalUncalibRecHitWorkerMultiFit::chi2ThreshEB_
private

Definition at line 165 of file EcalUncalibRecHitWorkerMultiFit.h.

double EcalUncalibRecHitWorkerMultiFit::chi2ThreshEE_
private

Definition at line 166 of file EcalUncalibRecHitWorkerMultiFit.h.

std::unique_ptr<EcalUncalibRecHitTimingCCAlgo> EcalUncalibRecHitWorkerMultiFit::computeCC_
private

Definition at line 169 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

bool EcalUncalibRecHitWorkerMultiFit::doPrefitEB_
private

Definition at line 109 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

bool EcalUncalibRecHitWorkerMultiFit::doPrefitEE_
private

Definition at line 110 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

bool EcalUncalibRecHitWorkerMultiFit::dynamicPedestalsEB_
private

Definition at line 113 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

bool EcalUncalibRecHitWorkerMultiFit::dynamicPedestalsEE_
private

Definition at line 114 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

std::vector<double> EcalUncalibRecHitWorkerMultiFit::EBamplitudeFitParameters_
private

Definition at line 128 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

std::vector<double> EcalUncalibRecHitWorkerMultiFit::ebPulseShape_
private

Definition at line 159 of file EcalUncalibRecHitWorkerMultiFit.h.

double EcalUncalibRecHitWorkerMultiFit::ebSpikeThresh_
private

Definition at line 150 of file EcalUncalibRecHitWorkerMultiFit.h.

double EcalUncalibRecHitWorkerMultiFit::EBtimeConstantTerm_
private

Definition at line 136 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

std::pair<double, double> EcalUncalibRecHitWorkerMultiFit::EBtimeFitLimits_
private

Definition at line 130 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

std::vector<double> EcalUncalibRecHitWorkerMultiFit::EBtimeFitParameters_
private

Definition at line 126 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::EBtimeNconst_
private

Definition at line 138 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

std::vector<double> EcalUncalibRecHitWorkerMultiFit::EEamplitudeFitParameters_
private

Definition at line 129 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

std::vector<double> EcalUncalibRecHitWorkerMultiFit::eePulseShape_
private

Definition at line 160 of file EcalUncalibRecHitWorkerMultiFit.h.

double EcalUncalibRecHitWorkerMultiFit::EEtimeConstantTerm_
private

Definition at line 137 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

std::pair<double, double> EcalUncalibRecHitWorkerMultiFit::EEtimeFitLimits_
private

Definition at line 131 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

std::vector<double> EcalUncalibRecHitWorkerMultiFit::EEtimeFitParameters_
private

Definition at line 127 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::EEtimeNconst_
private

Definition at line 139 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

edm::ESHandle<EcalGainRatios> EcalUncalibRecHitWorkerMultiFit::gains
private

Definition at line 69 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESGetToken<EcalGainRatios, EcalGainRatiosRcd> EcalUncalibRecHitWorkerMultiFit::gainsToken_
private

Definition at line 70 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

bool EcalUncalibRecHitWorkerMultiFit::gainSwitchUseMaxSampleEB_
private

Definition at line 117 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

bool EcalUncalibRecHitWorkerMultiFit::gainSwitchUseMaxSampleEE_
private

Definition at line 118 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

edm::ESHandle<EcalWeightXtalGroups> EcalUncalibRecHitWorkerMultiFit::grps
private

Definition at line 102 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESGetToken<EcalWeightXtalGroups, EcalWeightXtalGroupsRcd> EcalUncalibRecHitWorkerMultiFit::grpsToken_
private

Definition at line 103 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

edm::ESHandle<EcalTimeCalibConstants> EcalUncalibRecHitWorkerMultiFit::itime
private

Definition at line 155 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESGetToken<EcalTimeCalibConstants, EcalTimeCalibConstantsRcd> EcalUncalibRecHitWorkerMultiFit::itimeToken_
private

Definition at line 156 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

bool EcalUncalibRecHitWorkerMultiFit::kPoorRecoFlagEB_
private

Definition at line 163 of file EcalUncalibRecHitWorkerMultiFit.h.

bool EcalUncalibRecHitWorkerMultiFit::kPoorRecoFlagEE_
private

Definition at line 164 of file EcalUncalibRecHitWorkerMultiFit.h.

bool EcalUncalibRecHitWorkerMultiFit::mitigateBadSamplesEB_
private

Definition at line 115 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

bool EcalUncalibRecHitWorkerMultiFit::mitigateBadSamplesEE_
private

Definition at line 116 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

EcalUncalibRecHitMultiFitAlgo EcalUncalibRecHitWorkerMultiFit::multiFitMethod_
private

Definition at line 88 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESGetToken<EcalSamplesCorrelation, EcalSamplesCorrelationRcd> EcalUncalibRecHitWorkerMultiFit::noiseConvariancesToken_
private

Definition at line 72 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

std::array<SampleMatrixGainArray, 2> EcalUncalibRecHitWorkerMultiFit::noisecors_
private

Definition at line 84 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by noisecor(), and set().

edm::ESHandle<EcalSamplesCorrelation> EcalUncalibRecHitWorkerMultiFit::noisecovariances
private

Definition at line 71 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by set().

edm::ESHandle<EcalTimeOffsetConstant> EcalUncalibRecHitWorkerMultiFit::offtime
private

Definition at line 157 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESGetToken<EcalTimeOffsetConstant, EcalTimeOffsetConstantRcd> EcalUncalibRecHitWorkerMultiFit::offtimeToken_
private

Definition at line 158 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG12mEB_
private

Definition at line 141 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG12mEE_
private

Definition at line 145 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG12pEB_
private

Definition at line 140 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG12pEE_
private

Definition at line 144 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG61mEB_
private

Definition at line 143 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG61mEE_
private

Definition at line 147 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG61pEB_
private

Definition at line 142 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG61pEE_
private

Definition at line 146 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

edm::ESHandle<EcalPedestals> EcalUncalibRecHitWorkerMultiFit::peds
private

Definition at line 67 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> EcalUncalibRecHitWorkerMultiFit::pedsToken_
private

Definition at line 68 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

double EcalUncalibRecHitWorkerMultiFit::prefitMaxChiSqEB_
private

Definition at line 111 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::prefitMaxChiSqEE_
private

Definition at line 112 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

edm::ESGetToken<EcalPulseCovariances, EcalPulseCovariancesRcd> EcalUncalibRecHitWorkerMultiFit::pulseConvariancesToken_
private

Definition at line 76 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

edm::ESHandle<EcalPulseCovariances> EcalUncalibRecHitWorkerMultiFit::pulsecovariances
private

Definition at line 75 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESHandle<EcalPulseShapes> EcalUncalibRecHitWorkerMultiFit::pulseshapes
private

Definition at line 73 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESGetToken<EcalPulseShapes, EcalPulseShapesRcd> EcalUncalibRecHitWorkerMultiFit::pulseShapesToken_
private

Definition at line 74 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

EcalUncalibRecHitRatioMethodAlgo<EBDataFrame> EcalUncalibRecHitWorkerMultiFit::ratioMethod_barrel_
private

Definition at line 133 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

EcalUncalibRecHitRatioMethodAlgo<EEDataFrame> EcalUncalibRecHitWorkerMultiFit::ratioMethod_endcap_
private

Definition at line 134 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

edm::ESHandle<EcalSampleMask> EcalUncalibRecHitWorkerMultiFit::sampleMaskHand_
private

Definition at line 94 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESGetToken<EcalSampleMask, EcalSampleMaskRcd> EcalUncalibRecHitWorkerMultiFit::sampleMaskToken_
private

Definition at line 95 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

bool EcalUncalibRecHitWorkerMultiFit::selectiveBadSampleCriteriaEB_
private

Definition at line 119 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

bool EcalUncalibRecHitWorkerMultiFit::selectiveBadSampleCriteriaEE_
private

Definition at line 120 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

bool EcalUncalibRecHitWorkerMultiFit::simplifiedNoiseModelForGainSwitch_
private

Definition at line 123 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

TimeAlgo EcalUncalibRecHitWorkerMultiFit::timealgo_ = noMethod
private

Definition at line 99 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

edm::ESHandle<EcalTimeBiasCorrections> EcalUncalibRecHitWorkerMultiFit::timeCorrBias_
private

Definition at line 152 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESGetToken<EcalTimeBiasCorrections, EcalTimeBiasCorrectionsRcd> EcalUncalibRecHitWorkerMultiFit::timeCorrBiasToken_
private

Definition at line 153 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

bool EcalUncalibRecHitWorkerMultiFit::useLumiInfoRunHeader_
private

Definition at line 87 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

const EcalWeightSet::EcalWeightMatrix* EcalUncalibRecHitWorkerMultiFit::weights[2]
private

Definition at line 106 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

EcalUncalibRecHitTimeWeightsAlgo<EBDataFrame> EcalUncalibRecHitWorkerMultiFit::weightsMethod_barrel_
private

Definition at line 107 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

EcalUncalibRecHitTimeWeightsAlgo<EEDataFrame> EcalUncalibRecHitWorkerMultiFit::weightsMethod_endcap_
private

Definition at line 108 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

edm::ESHandle<EcalTBWeights> EcalUncalibRecHitWorkerMultiFit::wgts
private

Definition at line 104 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

edm::ESGetToken<EcalTBWeights, EcalTBWeightsRcd> EcalUncalibRecHitWorkerMultiFit::wgtsToken_
private

Definition at line 105 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().