CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
EcalUncalibRecHitWorkerMultiFit Class Reference

#include <EcalUncalibRecHitWorkerMultiFit.h>

Inheritance diagram for EcalUncalibRecHitWorkerMultiFit:
EcalUncalibRecHitWorkerBaseClass

Public Member Functions

 EcalUncalibRecHitWorkerMultiFit (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerMultiFit ()
 
edm::ParameterSetDescription getAlgoDescription ()
 
bool run (const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result) override
 
void set (const edm::EventSetup &es) override
 
void set (const edm::Event &evt) override
 
virtual ~EcalUncalibRecHitWorkerMultiFit ()
 
- Public Member Functions inherited from EcalUncalibRecHitWorkerBaseClass
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &, edm::ConsumesCollector &c)
 
 EcalUncalibRecHitWorkerBaseClass (const edm::ParameterSet &)
 
 EcalUncalibRecHitWorkerBaseClass ()
 
virtual ~EcalUncalibRecHitWorkerBaseClass ()
 

Protected Member Functions

const SampleMatrixnoisecor (bool barrel, int gain) const
 
double timeCorrection (float ampli, const std::vector< float > &amplitudeBins, const std::vector< float > &shiftBins)
 

Protected Attributes

BXVector activeBX
 
bool ampErrorCalculation_
 
double amplitudeThreshEB_
 
double amplitudeThreshEE_
 
edm::EDGetTokenT< int > bunchSpacing_
 
int bunchSpacingManual_
 
double chi2ThreshEB_
 
double chi2ThreshEE_
 
bool doPrefitEB_
 
bool doPrefitEE_
 
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_
 
FullSampleMatrix fullpulsecovEB
 
FullSampleMatrix fullpulsecovEE
 
FullSampleVector fullpulseEB
 
FullSampleVector fullpulseEE
 
double gainRatios [3]
 
edm::ESHandle< EcalGainRatiosgains
 
edm::ESHandle
< EcalWeightXtalGroups
grps
 
edm::ESHandle
< EcalTimeCalibConstants
itime
 
bool kPoorRecoFlagEB_
 
bool kPoorRecoFlagEE_
 
EcalUncalibRecHitMultiFitAlgo multiFitMethod_
 
SampleMatrix noisecorEBg1
 
SampleMatrix noisecorEBg12
 
SampleMatrix noisecorEBg6
 
SampleMatrix noisecorEEg1
 
SampleMatrix noisecorEEg12
 
SampleMatrix noisecorEEg6
 
edm::ESHandle
< EcalSamplesCorrelation
noisecovariances
 
edm::ESHandle
< EcalTimeOffsetConstant
offtime
 
double outOfTimeThreshG12mEB_
 
double outOfTimeThreshG12mEE_
 
double outOfTimeThreshG12pEB_
 
double outOfTimeThreshG12pEE_
 
double outOfTimeThreshG61mEB_
 
double outOfTimeThreshG61mEE_
 
double outOfTimeThreshG61pEB_
 
double outOfTimeThreshG61pEE_
 
double pedRMSVec [3]
 
edm::ESHandle< EcalPedestalspeds
 
double pedVec [3]
 
double prefitMaxChiSqEB_
 
double prefitMaxChiSqEE_
 
edm::ESHandle
< EcalPulseCovariances
pulsecovariances
 
edm::ESHandle< EcalPulseShapespulseshapes
 
EcalUncalibRecHitRatioMethodAlgo
< EBDataFrame
ratioMethod_barrel_
 
EcalUncalibRecHitRatioMethodAlgo
< EEDataFrame
ratioMethod_endcap_
 
edm::ESHandle< EcalSampleMasksampleMaskHand_
 
std::string timealgo_
 
edm::ESHandle
< EcalTimeBiasCorrections
timeCorrBias_
 
bool useLumiInfoRunHeader_
 
const
EcalWeightSet::EcalWeightMatrix
weights [2]
 
EcalUncalibRecHitTimeWeightsAlgo
< EBDataFrame
weightsMethod_barrel_
 
EcalUncalibRecHitTimeWeightsAlgo
< EEDataFrame
weightsMethod_endcap_
 
edm::ESHandle< EcalTBWeightswgts
 

Detailed Description

Definition at line 40 of file EcalUncalibRecHitWorkerMultiFit.h.

Constructor & Destructor Documentation

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

Definition at line 25 of file EcalUncalibRecHitWorkerMultiFit.cc.

References activeBX, ampErrorCalculation_, amplitudeThreshEB_, amplitudeThreshEE_, bunchSpacing_, bunchSpacingManual_, chi2ThreshEB_, chi2ThreshEE_, edm::ConsumesCollector::consumes(), doPrefitEB_, doPrefitEE_, EBamplitudeFitParameters_, ebPulseShape_, ebSpikeThresh_, EBtimeConstantTerm_, EBtimeFitLimits_, EBtimeFitParameters_, EBtimeNconst_, EEamplitudeFitParameters_, eePulseShape_, EEtimeConstantTerm_, EEtimeFitLimits_, EEtimeFitParameters_, EEtimeNconst_, edm::ParameterSet::getParameter(), HLT_25ns14e33_v1_cff::InputTag, kPoorRecoFlagEB_, kPoorRecoFlagEE_, outOfTimeThreshG12mEB_, outOfTimeThreshG12mEE_, outOfTimeThreshG12pEB_, outOfTimeThreshG12pEE_, outOfTimeThreshG61mEB_, outOfTimeThreshG61mEE_, outOfTimeThreshG61pEB_, outOfTimeThreshG61pEE_, prefitMaxChiSqEB_, prefitMaxChiSqEE_, BXVector< T >::resize(), AlCaHLTBitMon_QueryRunRegistry::string, timealgo_, and useLumiInfoRunHeader_.

25  :
27  noisecorEBg12(SampleMatrix::Zero()), noisecorEEg12(SampleMatrix::Zero()),
28  noisecorEBg6(SampleMatrix::Zero()), noisecorEEg6(SampleMatrix::Zero()),
29  noisecorEBg1(SampleMatrix::Zero()), noisecorEEg1(SampleMatrix::Zero()),
30  fullpulseEB(FullSampleVector::Zero()),fullpulseEE(FullSampleVector::Zero()),
31  fullpulsecovEB(FullSampleMatrix::Zero()),fullpulsecovEE(FullSampleMatrix::Zero()) {
32 
33  // get the BX for the pulses to be activated
34  std::vector<int32_t> activeBXs = ps.getParameter< std::vector<int32_t> >("activeBXs");
35  activeBX.resize(activeBXs.size());
36  for (unsigned int ibx=0; ibx<activeBXs.size(); ++ibx) {
37  activeBX.coeffRef(ibx) = activeBXs[ibx];
38  }
39 
40  // uncertainty calculation (CPU intensive)
41  ampErrorCalculation_ = ps.getParameter<bool>("ampErrorCalculation");
42  useLumiInfoRunHeader_ = ps.getParameter<bool>("useLumiInfoRunHeader");
43 
44  if (useLumiInfoRunHeader_) {
45  bunchSpacing_ = c.consumes<int>(edm::InputTag("addPileupInfo","bunchSpacing"));
47  } else {
48  bunchSpacingManual_ = ps.getParameter<int>("bunchSpacing");
49  }
50 
51  doPrefitEB_ = ps.getParameter<bool>("doPrefitEB");
52  doPrefitEE_ = ps.getParameter<bool>("doPrefitEE");
53 
54  prefitMaxChiSqEB_ = ps.getParameter<double>("prefitMaxChiSqEB");
55  prefitMaxChiSqEE_ = ps.getParameter<double>("prefitMaxChiSqEE");
56 
57  // algorithm to be used for timing
58  timealgo_ = ps.getParameter<std::string>("timealgo");
59 
60  // ratio method parameters
61  EBtimeFitParameters_ = ps.getParameter<std::vector<double> >("EBtimeFitParameters");
62  EEtimeFitParameters_ = ps.getParameter<std::vector<double> >("EEtimeFitParameters");
63  EBamplitudeFitParameters_ = ps.getParameter<std::vector<double> >("EBamplitudeFitParameters");
64  EEamplitudeFitParameters_ = ps.getParameter<std::vector<double> >("EEamplitudeFitParameters");
65  EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
66  EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
67  EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
68  EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
69  EBtimeConstantTerm_=ps.getParameter<double>("EBtimeConstantTerm");
70  EEtimeConstantTerm_=ps.getParameter<double>("EEtimeConstantTerm");
71  EBtimeNconst_=ps.getParameter<double>("EBtimeNconst");
72  EEtimeNconst_=ps.getParameter<double>("EEtimeNconst");
73  outOfTimeThreshG12pEB_ = ps.getParameter<double>("outOfTimeThresholdGain12pEB");
74  outOfTimeThreshG12mEB_ = ps.getParameter<double>("outOfTimeThresholdGain12mEB");
75  outOfTimeThreshG61pEB_ = ps.getParameter<double>("outOfTimeThresholdGain61pEB");
76  outOfTimeThreshG61mEB_ = ps.getParameter<double>("outOfTimeThresholdGain61mEB");
77  outOfTimeThreshG12pEE_ = ps.getParameter<double>("outOfTimeThresholdGain12pEE");
78  outOfTimeThreshG12mEE_ = ps.getParameter<double>("outOfTimeThresholdGain12mEE");
79  outOfTimeThreshG61pEE_ = ps.getParameter<double>("outOfTimeThresholdGain61pEE");
80  outOfTimeThreshG61mEE_ = ps.getParameter<double>("outOfTimeThresholdGain61mEE");
81  amplitudeThreshEB_ = ps.getParameter<double>("amplitudeThresholdEB");
82  amplitudeThreshEE_ = ps.getParameter<double>("amplitudeThresholdEE");
83 
84  // spike threshold
85  ebSpikeThresh_ = ps.getParameter<double>("ebSpikeThreshold");
86 
87  ebPulseShape_ = ps.getParameter<std::vector<double> >("ebPulseShape");
88  eePulseShape_ = ps.getParameter<std::vector<double> >("eePulseShape");
89 
90  // chi2 parameters for flags determination
91  kPoorRecoFlagEB_ = ps.getParameter<bool>("kPoorRecoFlagEB");
92  kPoorRecoFlagEE_ = ps.getParameter<bool>("kPoorRecoFlagEE");;
93  chi2ThreshEB_=ps.getParameter<double>("chi2ThreshEB_");
94  chi2ThreshEE_=ps.getParameter<double>("chi2ThreshEE_");
95 
96 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
void resize(int bx, unsigned size)
EcalUncalibRecHitWorkerMultiFit::EcalUncalibRecHitWorkerMultiFit ( )
inline

Definition at line 44 of file EcalUncalibRecHitWorkerMultiFit.h.

44 {};
virtual EcalUncalibRecHitWorkerMultiFit::~EcalUncalibRecHitWorkerMultiFit ( )
inlinevirtual

Definition at line 45 of file EcalUncalibRecHitWorkerMultiFit.h.

45 {};

Member Function Documentation

edm::ParameterSetDescription EcalUncalibRecHitWorkerMultiFit::getAlgoDescription ( )
virtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 575 of file EcalUncalibRecHitWorkerMultiFit.cc.

References edm::ParameterSetDescription::addNode(), and edm::ParameterSetDescription::addOptionalNode().

575  {
576 
578  psd0.addNode((edm::ParameterDescription<std::vector<double>>("EBPulseShapeTemplate", {1.13979e-02, 7.58151e-01, 1.00000e+00, 8.87744e-01, 6.73548e-01, 4.74332e-01, 3.19561e-01, 2.15144e-01, 1.47464e-01, 1.01087e-01, 6.93181e-02, 4.75044e-02}, true) and
579  edm::ParameterDescription<std::vector<double>>("EEPulseShapeTemplate", {1.16442e-01, 7.56246e-01, 1.00000e+00, 8.97182e-01, 6.86831e-01, 4.91506e-01, 3.44111e-01, 2.45731e-01, 1.74115e-01, 1.23361e-01, 8.74288e-02, 6.19570e-02}, true)));
580 
581  psd0.addNode((edm::ParameterDescription<std::string>("EEdigiCollection", "", true) and
582  edm::ParameterDescription<std::string>("EBdigiCollection", "", true) and
583  edm::ParameterDescription<std::string>("ESdigiCollection", "", true) and
584  edm::ParameterDescription<bool>("UseLCcorrection", true, false) and
585  edm::ParameterDescription<std::vector<double>>("EBCorrNoiseMatrixG12", {1.00000, 0.71073, 0.55721, 0.46089, 0.40449, 0.35931, 0.33924, 0.32439, 0.31581, 0.30481 }, true) and
586  edm::ParameterDescription<std::vector<double>>("EECorrNoiseMatrixG12", {1.00000, 0.71373, 0.44825, 0.30152, 0.21609, 0.14786, 0.11772, 0.10165, 0.09465, 0.08098 }, true) and
587  edm::ParameterDescription<std::vector<double>>("EBCorrNoiseMatrixG06", {1.00000, 0.70946, 0.58021, 0.49846, 0.45006, 0.41366, 0.39699, 0.38478, 0.37847, 0.37055 }, true) and
588  edm::ParameterDescription<std::vector<double>>("EECorrNoiseMatrixG06", {1.00000, 0.71217, 0.47464, 0.34056, 0.26282, 0.20287, 0.17734, 0.16256, 0.15618, 0.14443 }, true) and
589  edm::ParameterDescription<std::vector<double>>("EBCorrNoiseMatrixG01", {1.00000, 0.73354, 0.64442, 0.58851, 0.55425, 0.53082, 0.51916, 0.51097, 0.50732, 0.50409 }, true) and
590  edm::ParameterDescription<std::vector<double>>("EECorrNoiseMatrixG01", {1.00000, 0.72698, 0.62048, 0.55691, 0.51848, 0.49147, 0.47813, 0.47007, 0.46621, 0.46265 }, true) and
591  edm::ParameterDescription<bool>("EcalPreMixStage1", false, true) and
592  edm::ParameterDescription<bool>("EcalPreMixStage2", false, true)));
593 
594  psd0.addOptionalNode((edm::ParameterDescription<std::vector<double>>("EBPulseShapeCovariance", {3.001e-06, 1.233e-05, 0.000e+00, -4.416e-06, -4.571e-06, -3.614e-06, -2.636e-06, -1.286e-06, -8.410e-07, -5.296e-07, 0.000e+00, 0.000e+00,
595  1.233e-05, 6.154e-05, 0.000e+00, -2.200e-05, -2.309e-05, -1.838e-05, -1.373e-05, -7.334e-06, -5.088e-06, -3.745e-06, -2.428e-06, 0.000e+00,
596  0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
597  -4.416e-06, -2.200e-05, 0.000e+00, 8.319e-06, 8.545e-06, 6.792e-06, 5.059e-06, 2.678e-06, 1.816e-06, 1.223e-06, 8.245e-07, 5.589e-07,
598  -4.571e-06, -2.309e-05, 0.000e+00, 8.545e-06, 9.182e-06, 7.219e-06, 5.388e-06, 2.853e-06, 1.944e-06, 1.324e-06, 9.083e-07, 6.335e-07,
599  -3.614e-06, -1.838e-05, 0.000e+00, 6.792e-06, 7.219e-06, 6.016e-06, 4.437e-06, 2.385e-06, 1.636e-06, 1.118e-06, 7.754e-07, 5.556e-07,
600  -2.636e-06, -1.373e-05, 0.000e+00, 5.059e-06, 5.388e-06, 4.437e-06, 3.602e-06, 1.917e-06, 1.322e-06, 9.079e-07, 6.529e-07, 4.752e-07,
601  -1.286e-06, -7.334e-06, 0.000e+00, 2.678e-06, 2.853e-06, 2.385e-06, 1.917e-06, 1.375e-06, 9.100e-07, 6.455e-07, 4.693e-07, 3.657e-07,
602  -8.410e-07, -5.088e-06, 0.000e+00, 1.816e-06, 1.944e-06, 1.636e-06, 1.322e-06, 9.100e-07, 9.115e-07, 6.062e-07, 4.436e-07, 3.422e-07,
603  -5.296e-07, -3.745e-06, 0.000e+00, 1.223e-06, 1.324e-06, 1.118e-06, 9.079e-07, 6.455e-07, 6.062e-07, 7.217e-07, 4.862e-07, 3.768e-07,
604  0.000e+00, -2.428e-06, 0.000e+00, 8.245e-07, 9.083e-07, 7.754e-07, 6.529e-07, 4.693e-07, 4.436e-07, 4.862e-07, 6.509e-07, 4.418e-07,
605  0.000e+00, 0.000e+00, 0.000e+00, 5.589e-07, 6.335e-07, 5.556e-07, 4.752e-07, 3.657e-07, 3.422e-07, 3.768e-07, 4.418e-07, 6.142e-07}, true) and
606  edm::ParameterDescription<std::vector<double>>("EEPulseShapeCovariance", {3.941e-05, 3.333e-05, 0.000e+00, -1.449e-05, -1.661e-05, -1.424e-05, -1.183e-05, -6.842e-06, -4.915e-06, -3.411e-06, 0.000e+00, 0.000e+00,
607  3.333e-05, 2.862e-05, 0.000e+00, -1.244e-05, -1.431e-05, -1.233e-05, -1.032e-05, -5.883e-06, -4.154e-06, -2.902e-06, -2.128e-06, 0.000e+00,
608  0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00, 0.000e+00,
609  -1.449e-05, -1.244e-05, 0.000e+00, 5.840e-06, 6.649e-06, 5.720e-06, 4.812e-06, 2.708e-06, 1.869e-06, 1.330e-06, 9.186e-07, 6.446e-07,
610  -1.661e-05, -1.431e-05, 0.000e+00, 6.649e-06, 7.966e-06, 6.898e-06, 5.794e-06, 3.157e-06, 2.184e-06, 1.567e-06, 1.084e-06, 7.575e-07,
611  -1.424e-05, -1.233e-05, 0.000e+00, 5.720e-06, 6.898e-06, 6.341e-06, 5.347e-06, 2.859e-06, 1.991e-06, 1.431e-06, 9.839e-07, 6.886e-07,
612  -1.183e-05, -1.032e-05, 0.000e+00, 4.812e-06, 5.794e-06, 5.347e-06, 4.854e-06, 2.628e-06, 1.809e-06, 1.289e-06, 9.020e-07, 6.146e-07,
613  -6.842e-06, -5.883e-06, 0.000e+00, 2.708e-06, 3.157e-06, 2.859e-06, 2.628e-06, 1.863e-06, 1.296e-06, 8.882e-07, 6.108e-07, 4.283e-07,
614  -4.915e-06, -4.154e-06, 0.000e+00, 1.869e-06, 2.184e-06, 1.991e-06, 1.809e-06, 1.296e-06, 1.217e-06, 8.669e-07, 5.751e-07, 3.882e-07,
615  -3.411e-06, -2.902e-06, 0.000e+00, 1.330e-06, 1.567e-06, 1.431e-06, 1.289e-06, 8.882e-07, 8.669e-07, 9.522e-07, 6.717e-07, 4.293e-07,
616  0.000e+00, -2.128e-06, 0.000e+00, 9.186e-07, 1.084e-06, 9.839e-07, 9.020e-07, 6.108e-07, 5.751e-07, 6.717e-07, 7.911e-07, 5.493e-07,
617  0.000e+00, 0.000e+00, 0.000e+00, 6.446e-07, 7.575e-07, 6.886e-07, 6.146e-07, 4.283e-07, 3.882e-07, 4.293e-07, 5.493e-07, 7.027e-07}, true)), true);
618 
620  psd.addNode(edm::ParameterDescription<std::vector<int>>("activeBXs", {-5,-4,-3,-2,-1,0,1,2,3,4}, true) and
621  edm::ParameterDescription<bool>("ampErrorCalculation", true, true) and
622  edm::ParameterDescription<bool>("useLumiInfoRunHeader", true, true) and
623  edm::ParameterDescription<int>("bunchSpacing", 0, true) and
624  edm::ParameterDescription<bool>("doPrefitEB", false, true) and
625  edm::ParameterDescription<bool>("doPrefitEE", false, true) and
626  edm::ParameterDescription<double>("prefitMaxChiSqEB", 25., true) and
627  edm::ParameterDescription<double>("prefitMaxChiSqEE", 10., true) and
628  edm::ParameterDescription<std::string>("timealgo", "RatioMethod", true) and
629  edm::ParameterDescription<std::vector<double>>("EBtimeFitParameters", {-2.015452e+00, 3.130702e+00, -1.234730e+01, 4.188921e+01, -8.283944e+01, 9.101147e+01, -5.035761e+01, 1.105621e+01}, true) and
630  edm::ParameterDescription<std::vector<double>>("EEtimeFitParameters", {-2.390548e+00, 3.553628e+00, -1.762341e+01, 6.767538e+01, -1.332130e+02, 1.407432e+02, -7.541106e+01, 1.620277e+01}, true) and
631  edm::ParameterDescription<std::vector<double>>("EBamplitudeFitParameters", {1.138,1.652}, true) and
632  edm::ParameterDescription<std::vector<double>>("EEamplitudeFitParameters", {1.890,1.400}, true) and
633  edm::ParameterDescription<double>("EBtimeFitLimits_Lower", 0.2, true) and
634  edm::ParameterDescription<double>("EBtimeFitLimits_Upper", 1.4, true) and
635  edm::ParameterDescription<double>("EEtimeFitLimits_Lower", 0.2, true) and
636  edm::ParameterDescription<double>("EEtimeFitLimits_Upper", 1.4, true) and
637  edm::ParameterDescription<double>("EBtimeConstantTerm", .6, true) and
638  edm::ParameterDescription<double>("EEtimeConstantTerm", 1.0, true) and
639  edm::ParameterDescription<double>("EBtimeNconst", 28.5, true) and
640  edm::ParameterDescription<double>("EEtimeNconst", 31.8, true) and
641  edm::ParameterDescription<double>("outOfTimeThresholdGain12pEB", 5, true) and
642  edm::ParameterDescription<double>("outOfTimeThresholdGain12mEB", 5, true) and
643  edm::ParameterDescription<double>("outOfTimeThresholdGain61pEB", 5, true) and
644  edm::ParameterDescription<double>("outOfTimeThresholdGain61mEB", 5, true) and
645  edm::ParameterDescription<double>("outOfTimeThresholdGain12pEE", 1000, true) and
646  edm::ParameterDescription<double>("outOfTimeThresholdGain12mEE", 1000, true) and
647  edm::ParameterDescription<double>("outOfTimeThresholdGain61pEE", 1000, true) and
648  edm::ParameterDescription<double>("outOfTimeThresholdGain61mEE", 1000, true) and
649  edm::ParameterDescription<double>("amplitudeThresholdEB", 10, true) and
650  edm::ParameterDescription<double>("amplitudeThresholdEE", 10, true) and
651  edm::ParameterDescription<double>("ebSpikeThreshold", 1.042, true) and
652  edm::ParameterDescription<std::vector<double>>("ebPulseShape", {5.2e-05,-5.26e-05 , 6.66e-05, 0.1168, 0.7575, 1., 0.8876, 0.6732, 0.4741, 0.3194}, true) and
653  edm::ParameterDescription<std::vector<double>>("eePulseShape", {5.2e-05,-5.26e-05 , 6.66e-05, 0.1168, 0.7575, 1., 0.8876, 0.6732, 0.4741, 0.3194}, true) and
654  edm::ParameterDescription<bool>("kPoorRecoFlagEB", true, true) and
655  edm::ParameterDescription<bool>("kPoorRecoFlagEE", false, true) and
656  edm::ParameterDescription<double>("chi2ThreshEB_", 65.0, true) and
657  edm::ParameterDescription<double>("chi2ThreshEE_", 50.0, true) and
658  edm::ParameterDescription<edm::ParameterSetDescription>("EcalPulseShapeParameters", psd0, true));
659 
660  return psd;
661 }
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
ParameterDescriptionNode * addOptionalNode(ParameterDescriptionNode const &node, bool writeToCfi)
const SampleMatrix & EcalUncalibRecHitWorkerMultiFit::noisecor ( bool  barrel,
int  gain 
) const
protected

Definition at line 546 of file EcalUncalibRecHitWorkerMultiFit.cc.

References noisecorEBg1, noisecorEBg12, noisecorEBg6, noisecorEEg1, noisecorEEg12, and noisecorEEg6.

Referenced by run().

546  {
547  if (barrel) {
548  if (gain==6) {
549  return noisecorEBg6;
550  }
551  else if (gain==1) {
552  return noisecorEBg1;
553  }
554  else {
555  return noisecorEBg12;
556  }
557  }
558  else {
559  if (gain==6) {
560  return noisecorEEg6;
561  }
562  else if (gain==1) {
563  return noisecorEEg1;
564  }
565  else {
566  return noisecorEEg12;
567  }
568  }
569 
570  return noisecorEBg12;
571 
572 }
bool EcalUncalibRecHitWorkerMultiFit::run ( const edm::Event evt,
const EcalDigiCollection::const_iterator digi,
EcalUncalibratedRecHitCollection result 
)
overridevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 247 of file EcalUncalibRecHitWorkerMultiFit.cc.

References funct::abs(), activeBX, EcalUncalibratedRecHit::amplitude(), amplitudeThreshEB_, amplitudeThreshEE_, Reference_intrackfit_cff::barrel, EcalUncalibRecHitRatioMethodAlgo< C >::computeAmplitude(), EcalUncalibRecHitRatioMethodAlgo< C >::computeTime(), EcalPulseCovariance::covval, cond::rpcobgas::detid, doPrefitEB_, doPrefitEE_, EBamplitudeFitParameters_, EBtimeConstantTerm_, EBtimeFitLimits_, EBtimeFitParameters_, EBtimeNconst_, EcalBarrel, EcalEndcap, EEamplitudeFitParameters_, EEtimeConstantTerm_, EEtimeFitLimits_, EEtimeFitParameters_, EEtimeNconst_, EcalUncalibRecHitRatioMethodAlgo< C >::fixMGPAslew(), fullpulsecovEB, fullpulsecovEE, fullpulseEB, fullpulseEE, EcalMGPAGainRatio::gain12Over6(), EcalMGPAGainRatio::gain6Over1(), ecalMGPA::gainId(), gainRatios, gains, EcalUncalibRecHitRatioMethodAlgo< C >::getCalculatedRecHit(), EcalWeightSet::getWeightsAfterGainSwitch(), EcalWeightSet::getWeightsBeforeGainSwitch(), grps, ecalpyutils::hashedIndex(), EBDetId::hashedIndex(), EEDetId::hashedIndex(), i, EcalXtalGroupId::id(), EcalUncalibRecHitRatioMethodAlgo< C >::init(), itime, j, relval_steps::k, EcalUncalibratedRecHit::kHasSwitchToGain1, EcalUncalibratedRecHit::kHasSwitchToGain6, EcalUncalibratedRecHit::kOutOfTime, EcalUncalibratedRecHit::kSaturated, EcalUncalibRecHitMultiFitAlgo::makeRecHit(), EcalDataFrame::MAXSAMPLES, EcalPedestal::mean_x1, EcalPedestal::mean_x12, EcalPedestal::mean_x6, multiFitMethod_, noisecor(), noisecorEBg1, noisecorEBg12, noisecorEBg6, noisecorEEg1, noisecorEEg12, noisecorEEg6, noisecovariances, offtime, EcalUncalibratedRecHit::outOfTimeAmplitude(), outOfTimeThreshG12mEB_, outOfTimeThreshG12mEE_, outOfTimeThreshG12pEB_, outOfTimeThreshG12pEE_, outOfTimeThreshG61mEB_, outOfTimeThreshG61mEE_, outOfTimeThreshG61pEB_, outOfTimeThreshG61pEE_, EcalPulseShape::pdfval, EcalCondDBWriter_cfi::pedestal, pedRMSVec, peds, pedVec, funct::pow(), prefitMaxChiSqEB_, prefitMaxChiSqEE_, edm::ESHandle< class >::product(), pulsecovariances, pulseshapes, edm::SortedCollection< T, SORT >::push_back(), ratioMethod_barrel_, ratioMethod_endcap_, EcalPedestal::rms_x1, EcalPedestal::rms_x12, EcalPedestal::rms_x6, compare_using_db::sample, sampleMaskHand_, EcalUncalibratedRecHit::setChi2(), EcalUncalibRecHitMultiFitAlgo::setDoPrefit(), EcalUncalibratedRecHit::setFlagBit(), EcalUncalibratedRecHit::setJitter(), EcalUncalibratedRecHit::setJitterError(), EcalUncalibRecHitMultiFitAlgo::setPrefitMaxChiSq(), BXVector< T >::size(), mathSSE::sqrt(), EcalPulseShape::TEMPLATESAMPLES, EcalUncalibRecHitTimeWeightsAlgo< C >::time(), timealgo_, timeCorrBias_, timeCorrection(), weights, weightsMethod_barrel_, weightsMethod_endcap_, and wgts.

Referenced by set().

250 {
251  DetId detid(itdg->id());
252 
253  const EcalSampleMask *sampleMask_ = sampleMaskHand_.product();
254 
255  // intelligence for recHit computation
256  EcalUncalibratedRecHit uncalibRecHit;
257  float offsetTime = 0;
258 
259  const EcalPedestals::Item * aped = 0;
260  const EcalMGPAGainRatio * aGain = 0;
261  const EcalXtalGroupId * gid = 0;
262  const EcalPulseShapes::Item * aPulse = 0;
263  const EcalPulseCovariances::Item * aPulseCov = 0;
264 
265  if (detid.subdetId()==EcalEndcap) {
266  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
267  aped = &peds->endcap(hashedIndex);
268  aGain = &gains->endcap(hashedIndex);
269  gid = &grps->endcap(hashedIndex);
270  aPulse = &pulseshapes->endcap(hashedIndex);
271  aPulseCov = &pulsecovariances->endcap(hashedIndex);
274  offsetTime = offtime->getEEValue();
275  } else {
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);
284  offsetTime = offtime->getEBValue();
285  }
286 
287  pedVec[0] = aped->mean_x12;
288  pedVec[1] = aped->mean_x6;
289  pedVec[2] = aped->mean_x1;
290  pedRMSVec[0] = aped->rms_x12;
291  pedRMSVec[1] = aped->rms_x6;
292  pedRMSVec[2] = aped->rms_x1;
293  gainRatios[0] = 1.;
294  gainRatios[1] = aGain->gain12Over6();
295  gainRatios[2] = aGain->gain6Over1()*aGain->gain12Over6();
296 
297  int nnoise = noisecovariances->EBG12SamplesCorrelation.size();
298  for (int i=0; i<nnoise; ++i) {
299  for (int j=0; j<nnoise; ++j) {
300  int vidx = std::abs(j-i);
301  noisecorEBg12(i,j) = noisecovariances->EBG12SamplesCorrelation[vidx];
302  noisecorEEg12(i,j) = noisecovariances->EEG12SamplesCorrelation[vidx];
303  noisecorEBg6(i,j) = noisecovariances->EBG6SamplesCorrelation[vidx];
304  noisecorEEg6(i,j) = noisecovariances->EEG6SamplesCorrelation[vidx];
305  noisecorEBg1(i,j) = noisecovariances->EBG1SamplesCorrelation[vidx];
306  noisecorEEg1(i,j) = noisecovariances->EEG1SamplesCorrelation[vidx];
307  }
308  }
309 
310  for (int i=0; i<EcalPulseShape::TEMPLATESAMPLES; ++i) {
311  fullpulseEB(i+7) = aPulse->pdfval[i];
312  fullpulseEE(i+7) = aPulse->pdfval[i];
313  }
314 
315  for(int k=0; k<std::pow(EcalPulseShape::TEMPLATESAMPLES,2); ++k) {
318  fullpulsecovEB(i+7,j+7) = aPulseCov->covval[i][j];
319  fullpulsecovEE(i+7,j+7) = aPulseCov->covval[i][j];
320  }
321 
322  // compute the right bin of the pulse shape using time calibration constants
324  EcalTimeCalibConstant itimeconst = 0;
325  if( it != itime->end() ) {
326  itimeconst = (*it);
327  } else {
328  edm::LogError("EcalRecHitError") << "No time intercalib const found for xtal "
329  << detid.rawId()
330  << "! something wrong with EcalTimeCalibConstants in your DB? ";
331  }
332 
333  // === amplitude computation ===
334  int leadingSample = ((EcalDataFrame)(*itdg)).lastUnsaturatedSample();
335 
336  if ( leadingSample == 4 ) { // saturation on the expected max sample
337  uncalibRecHit = EcalUncalibratedRecHit( (*itdg).id(), 4095*12, 0, 0, 0);
339  // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
340  uncalibRecHit.setChi2(0);
341  } else if ( leadingSample >= 0 ) { // saturation on other samples: cannot extrapolate from the fourth one
342  double pedestal = 0.;
343  double gainratio = 1.;
344  int gainId = ((EcalDataFrame)(*itdg)).sample(5).gainId();
345 
346  if (gainId==0 || gainId==3) {
347  pedestal = aped->mean_x1;
348  gainratio = aGain->gain6Over1()*aGain->gain12Over6();
349  }
350  else if (gainId==1) {
351  pedestal = aped->mean_x12;
352  gainratio = 1.;
353  }
354  else if (gainId==2) {
355  pedestal = aped->mean_x6;
356  gainratio = aGain->gain12Over6();
357  }
358  double amplitude = ((double)(((EcalDataFrame)(*itdg)).sample(5).adc()) - pedestal) * gainratio;
359  uncalibRecHit = EcalUncalibratedRecHit( (*itdg).id(), amplitude, 0, 0, 0);
361  // do not propagate the default chi2 = -1 value to the calib rechit (mapped to 64), set it to 0 when saturation
362  uncalibRecHit.setChi2(0);
363  } else {
364  // multifit
365  bool barrel = detid.subdetId()==EcalBarrel;
366  int gain = 12;
367  if (((EcalDataFrame)(*itdg)).hasSwitchToGain6()) {
368  gain = 6;
369  }
370  if (((EcalDataFrame)(*itdg)).hasSwitchToGain1()) {
371  gain = 1;
372  }
373  const SampleMatrix &noisecormat = noisecor(barrel,gain);
374  const FullSampleVector &fullpulse = barrel ? fullpulseEB : fullpulseEE;
375  const FullSampleMatrix &fullpulsecov = barrel ? fullpulsecovEB : fullpulsecovEE;
376 
377  uncalibRecHit = multiFitMethod_.makeRecHit(*itdg, aped, aGain, noisecormat,fullpulse,fullpulsecov,activeBX);
378 
379  // === time computation ===
380  if(timealgo_.compare("RatioMethod")==0) {
381  // ratio method
382  float const clockToNsConstant = 25.;
383  if (detid.subdetId()==EcalEndcap) {
384  ratioMethod_endcap_.init( *itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios );
388  double theTimeCorrectionEE = timeCorrection(uncalibRecHit.amplitude(),
389  timeCorrBias_->EETimeCorrAmplitudeBins, timeCorrBias_->EETimeCorrShiftBins);
390 
391  uncalibRecHit.setJitter( crh.timeMax - 5 + theTimeCorrectionEE);
392  uncalibRecHit.setJitterError( std::sqrt(pow(crh.timeError,2) + std::pow(EEtimeConstantTerm_,2)/std::pow(clockToNsConstant,2)) );
393 
394  // consider flagging as kOutOfTime only if above noise
395  if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEE_){
396  float outOfTimeThreshP = outOfTimeThreshG12pEE_;
397  float outOfTimeThreshM = outOfTimeThreshG12mEE_;
398  // determine if gain has switched away from gainId==1 (x12 gain)
399  // and determine cuts (number of 'sigmas') to ose for kOutOfTime
400  // >3k ADC is necessasry condition for gain switch to occur
401  if (uncalibRecHit.amplitude() > 3000.){
402  for (int iSample = 0; iSample < EEDataFrame::MAXSAMPLES; iSample++) {
403  int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
404  if (GainId!=1) {
405  outOfTimeThreshP = outOfTimeThreshG61pEE_;
406  outOfTimeThreshM = outOfTimeThreshG61mEE_;
407  break;
408  }
409  }}
410  float correctedTime = (crh.timeMax-5) * clockToNsConstant + itimeconst + offsetTime;
411  float cterm = EEtimeConstantTerm_;
412  float sigmaped = pedRMSVec[0]; // approx for lower gains
413  float nterm = EEtimeNconst_*sigmaped/uncalibRecHit.amplitude();
414  float sigmat = std::sqrt( nterm*nterm + cterm*cterm );
415  if ( ( correctedTime > sigmat*outOfTimeThreshP ) ||
416  ( correctedTime < (-1.*sigmat*outOfTimeThreshM) ))
417  { uncalibRecHit.setFlagBit( EcalUncalibratedRecHit::kOutOfTime ); }
418  }
419 
420  } else {
421  ratioMethod_barrel_.init( *itdg, *sampleMask_, pedVec, pedRMSVec, gainRatios );
426 
427  double theTimeCorrectionEB = timeCorrection(uncalibRecHit.amplitude(),
428  timeCorrBias_->EBTimeCorrAmplitudeBins, timeCorrBias_->EBTimeCorrShiftBins);
429 
430  uncalibRecHit.setJitter( crh.timeMax - 5 + theTimeCorrectionEB);
431  uncalibRecHit.setJitterError( std::sqrt(std::pow(crh.timeError,2) + std::pow(EBtimeConstantTerm_,2)/std::pow(clockToNsConstant,2)) );
432 
433  // consider flagging as kOutOfTime only if above noise
434  if (uncalibRecHit.amplitude() > pedRMSVec[0] * amplitudeThreshEB_){
435  float outOfTimeThreshP = outOfTimeThreshG12pEB_;
436  float outOfTimeThreshM = outOfTimeThreshG12mEB_;
437  // determine if gain has switched away from gainId==1 (x12 gain)
438  // and determine cuts (number of 'sigmas') to ose for kOutOfTime
439  // >3k ADC is necessasry condition for gain switch to occur
440  if (uncalibRecHit.amplitude() > 3000.){
441  for (int iSample = 0; iSample < EBDataFrame::MAXSAMPLES; iSample++) {
442  int GainId = ((EcalDataFrame)(*itdg)).sample(iSample).gainId();
443  if (GainId!=1) {
444  outOfTimeThreshP = outOfTimeThreshG61pEB_;
445  outOfTimeThreshM = outOfTimeThreshG61mEB_;
446  break;}
447  } }
448  float correctedTime = (crh.timeMax-5) * clockToNsConstant + itimeconst + offsetTime;
449  float cterm = EBtimeConstantTerm_;
450  float sigmaped = pedRMSVec[0]; // approx for lower gains
451  float nterm = EBtimeNconst_*sigmaped/uncalibRecHit.amplitude();
452  float sigmat = std::sqrt( nterm*nterm + cterm*cterm );
453  if ( ( correctedTime > sigmat*outOfTimeThreshP ) ||
454  ( correctedTime < (-1.*sigmat*outOfTimeThreshM) ))
455  { uncalibRecHit.setFlagBit( EcalUncalibratedRecHit::kOutOfTime ); }
456  }
457 
458  }
459  } else if(timealgo_.compare("WeightsMethod")==0) {
460  // weights method on the PU subtracted pulse shape
461  std::vector<double> amplitudes;
462  for(unsigned int ibx=0; ibx<activeBX.size(); ++ibx) amplitudes.push_back(uncalibRecHit.outOfTimeAmplitude(ibx));
463 
464  EcalTBWeights::EcalTDCId tdcid(1);
465  EcalTBWeights::EcalTBWeightMap const & wgtsMap = wgts->getMap();
466  EcalTBWeights::EcalTBWeightMap::const_iterator wit;
467  wit = wgtsMap.find( std::make_pair(*gid,tdcid) );
468  if( wit == wgtsMap.end() ) {
469  edm::LogError("EcalUncalibRecHitError") << "No weights found for EcalGroupId: "
470  << gid->id() << " and EcalTDCId: " << tdcid
471  << "\n skipping digi with id: " << detid.rawId();
472 
473  return false;
474  }
475  const EcalWeightSet& wset = wit->second; // this is the EcalWeightSet
476 
479 
480  weights[0] = &mat1;
481  weights[1] = &mat2;
482 
483  double timerh;
484  if (detid.subdetId()==EcalEndcap) {
485  timerh = weightsMethod_endcap_.time( *itdg, amplitudes, aped, aGain, fullpulse, weights);
486  } else {
487  timerh = weightsMethod_barrel_.time( *itdg, amplitudes, aped, aGain, fullpulse, weights);
488  }
489  uncalibRecHit.setJitter( timerh );
490  uncalibRecHit.setJitterError( 0. ); // not computed with weights
491  } else if(timealgo_.compare("None")==0) {
492  uncalibRecHit.setJitter( 0. );
493  uncalibRecHit.setJitterError( 0. );
494  } else {
495  edm::LogError("EcalUncalibRecHitError") << "No time estimation algorithm called "
496  << timealgo_
497  << "\n setting jitter to 0. and jitter uncertainty to 10000. ";
498 
499  uncalibRecHit.setJitter( 0. );
500  uncalibRecHit.setJitterError( 10000. );
501  }
502  }
503 
504  // set flags if gain switch has occurred
505  if( ((EcalDataFrame)(*itdg)).hasSwitchToGain6() ) uncalibRecHit.setFlagBit( EcalUncalibratedRecHit::kHasSwitchToGain6 );
506  if( ((EcalDataFrame)(*itdg)).hasSwitchToGain1() ) uncalibRecHit.setFlagBit( EcalUncalibratedRecHit::kHasSwitchToGain1 );
507 
508  // set quality flags based on chi2 of the the fit
509  /*
510  if(detid.subdetId()==EcalEndcap) {
511  if(kPoorRecoFlagEE_ && uncalibRecHit.chi2()>chi2ThreshEE_) {
512  bool samplesok = true;
513  for (int sample =0; sample < EcalDataFrame::MAXSAMPLES; ++sample) {
514  if (!sampleMask_->useSampleEE(sample)) {
515  samplesok = false;
516  break;
517  }
518  }
519  if (samplesok) uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kPoorReco);
520  }
521  } else {
522  if(kPoorRecoFlagEB_ && uncalibRecHit.chi2()>chi2ThreshEB_) {
523  bool samplesok = true;
524  for (int sample =0; sample < EcalDataFrame::MAXSAMPLES; ++sample) {
525  if (!sampleMask_->useSampleEB(sample)) {
526  samplesok = false;
527  break;
528  }
529  }
530  if (samplesok) uncalibRecHit.setFlagBit(EcalUncalibratedRecHit::kPoorReco);
531  }
532  }
533  */
534 
535  // put the recHit in the collection
536  if (detid.subdetId()==EcalEndcap) {
537  result.push_back( uncalibRecHit );
538  } else {
539  result.push_back( uncalibRecHit );
540  }
541 
542  return true;
543 }
std::map< std::pair< EcalXtalGroupId, EcalTDCId >, EcalWeightSet > EcalTBWeightMap
Definition: EcalTBWeights.h:21
int i
Definition: DBlmapReader.cc:9
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:86
void computeAmplitude(std::vector< double > &amplitudeFitParameters)
unsigned size(int bx) const
EcalUncalibRecHitMultiFitAlgo multiFitMethod_
const SampleMatrix & noisecor(bool barrel, int gain) const
void setJitter(float jitter)
int gainId(sample_type sample)
get the gainId (2 bits)
EcalUncalibRecHitTimeWeightsAlgo< EEDataFrame > weightsMethod_endcap_
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.
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 > &amplitudeFitParameters)
static const int TEMPLATESAMPLES
edm::ESHandle< EcalWeightXtalGroups > grps
void push_back(T const &t)
void setJitterError(float jitterErr)
Eigen::Matrix< double, 19, 19 > FullSampleMatrix
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > ratioMethod_barrel_
const unsigned int id() const
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
float outOfTimeAmplitude(int bx) const
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > ratioMethod_endcap_
T sqrt(T t)
Definition: SSEVec.h:48
edm::ESHandle< EcalPulseShapes > pulseshapes
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
edm::ESHandle< EcalTimeCalibConstants > itime
double timeCorrection(float ampli, const std::vector< float > &amplitudeBins, const std::vector< float > &shiftBins)
float gain6Over1() const
Eigen::Matrix< double, 19, 1 > FullSampleVector
EcalWeightMatrix & getWeightsAfterGainSwitch()
Definition: EcalWeightSet.h:30
float covval[EcalPulseShape::TEMPLATESAMPLES][EcalPulseShape::TEMPLATESAMPLES]
edm::ESHandle< EcalTimeBiasCorrections > timeCorrBias_
Definition: DetId.h:18
edm::ESHandle< EcalPulseCovariances > pulsecovariances
int hashedIndex() const
Definition: EEDetId.h:182
EcalWeightMatrix & getWeightsBeforeGainSwitch()
Definition: EcalWeightSet.h:29
std::vector< Item >::const_iterator const_iterator
T const * product() const
Definition: ESHandle.h:86
float gain12Over6() const
EcalUncalibRecHitTimeWeightsAlgo< EBDataFrame > weightsMethod_barrel_
edm::ESHandle< EcalTimeOffsetConstant > offtime
float pdfval[TEMPLATESAMPLES]
float EcalTimeCalibConstant
math::Matrix< 3, 10 >::type EcalWeightMatrix
Definition: EcalWeightSet.h:22
edm::ESHandle< EcalSampleMask > sampleMaskHand_
const EcalWeightSet::EcalWeightMatrix * weights[2]
edm::ESHandle< EcalSamplesCorrelation > noisecovariances
Eigen::Matrix< double, 10, 10 > SampleMatrix
void init(const C &dataFrame, const EcalSampleMask &sampleMask, const double *pedestals, const double *pedestalRMSes, const double *gainRatios)
static const int MAXSAMPLES
Definition: EcalDataFrame.h:48
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
void EcalUncalibRecHitWorkerMultiFit::set ( const edm::EventSetup es)
overridevirtual

Implements EcalUncalibRecHitWorkerBaseClass.

Definition at line 101 of file EcalUncalibRecHitWorkerMultiFit.cc.

References ampErrorCalculation_, EcalUncalibRecHitMultiFitAlgo::disableErrorCalculation(), gains, edm::EventSetup::get(), grps, itime, multiFitMethod_, noisecovariances, offtime, peds, pulsecovariances, pulseshapes, sampleMaskHand_, timeCorrBias_, and wgts.

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

102 {
103 
104  // common setup
105  es.get<EcalGainRatiosRcd>().get(gains);
106  es.get<EcalPedestalsRcd>().get(peds);
107 
108  // for the multifit method
113 
114  // weights parameters for the time
115  es.get<EcalWeightXtalGroupsRcd>().get(grps);
116  es.get<EcalTBWeightsRcd>().get(wgts);
117 
118  // which of the samples need be used
120 
121  // for the ratio method
124 
125  // for the time correction methods
127 }
EcalUncalibRecHitMultiFitAlgo multiFitMethod_
edm::ESHandle< EcalWeightXtalGroups > grps
edm::ESHandle< EcalPulseShapes > pulseshapes
edm::ESHandle< EcalTimeCalibConstants > itime
edm::ESHandle< EcalTimeBiasCorrections > timeCorrBias_
edm::ESHandle< EcalPulseCovariances > pulsecovariances
const T & get() const
Definition: EventSetup.h:55
edm::ESHandle< EcalTimeOffsetConstant > offtime
edm::ESHandle< EcalSampleMask > sampleMaskHand_
edm::ESHandle< EcalSamplesCorrelation > noisecovariances
void EcalUncalibRecHitWorkerMultiFit::set ( const edm::Event evt)
overridevirtual

Reimplemented from EcalUncalibRecHitWorkerBaseClass.

Definition at line 130 of file EcalUncalibRecHitWorkerMultiFit.cc.

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

Referenced by betterConfigParser.BetterConfigParser::getGeneral().

131 {
132 
133  int bunchspacing = 450;
134 
135  if (useLumiInfoRunHeader_) {
136 
137  if (evt.isRealData()) {
138  edm::RunNumber_t run = evt.run();
139  if (run == 178003 ||
140  run == 178004 ||
141  run == 209089 ||
142  run == 209106 ||
143  run == 209109 ||
144  run == 209146 ||
145  run == 209148 ||
146  run == 209151) {
147  bunchspacing = 25;
148  }
149  else if (run < 253000) {
150  bunchspacing = 50;
151  }
152  else {
153  bunchspacing = 25;
154  }
155  }
156  else {
157  edm::Handle<int> bunchSpacingH;
158  evt.getByToken(bunchSpacing_,bunchSpacingH);
159  bunchspacing = *bunchSpacingH;
160  }
161 
162  }
163  else {
164  bunchspacing = bunchSpacingManual_;
165  }
166 
168  if (bunchspacing == 25) {
169  activeBX.resize(10);
170  activeBX << -5,-4,-3,-2,-1,0,1,2,3,4;
171  }
172  else {
173  //50ns configuration otherwise (also for no pileup)
174  activeBX.resize(5);
175  activeBX << -4,-2,0,2,4;
176  }
177  }
178 
179 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
bool isRealData() const
Definition: EventBase.h:64
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result) override
RunNumber_t run() const
Definition: Event.h:87
void resize(int bx, unsigned size)
unsigned int RunNumber_t
double EcalUncalibRecHitWorkerMultiFit::timeCorrection ( float  ampli,
const std::vector< float > &  amplitudeBins,
const std::vector< float > &  shiftBins 
)
protected

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 190 of file EcalUncalibRecHitWorkerMultiFit.cc.

References newFWLiteAna::bin.

Referenced by run().

193  {
194 
195  // computed initially in ns. Than turned in the BX's, as
196  // EcalUncalibratedRecHit need be.
197  double theCorrection = 0;
198 
199  // sanity check for arrays
200  if (amplitudeBins.size() == 0) {
201  edm::LogError("EcalRecHitError")
202  << "timeCorrAmplitudeBins is empty, forcing no time bias corrections.";
203 
204  return 0;
205  }
206 
207  if (amplitudeBins.size() != shiftBins.size()) {
208  edm::LogError("EcalRecHitError")
209  << "Size of timeCorrAmplitudeBins different from "
210  "timeCorrShiftBins. Forcing no time bias corrections. ";
211 
212  return 0;
213  }
214 
215  int myBin = -1;
216  for (int bin = 0; bin < (int) amplitudeBins.size(); bin++) {
217  if (ampli > amplitudeBins.at(bin)) {
218  myBin = bin;
219  } else {
220  break;
221  }
222  }
223 
224  if (myBin == -1) {
225  theCorrection = shiftBins.at(0);
226  } else if (myBin == ((int)(amplitudeBins.size() - 1))) {
227  theCorrection = shiftBins.at(myBin);
228  } else if (-1 < myBin && myBin < ((int) amplitudeBins.size() - 1)) {
229  // interpolate linearly between two assingned points
230  theCorrection = (shiftBins.at(myBin + 1) - shiftBins.at(myBin));
231  theCorrection *= (((double) ampli) - amplitudeBins.at(myBin)) /
232  (amplitudeBins.at(myBin + 1) - amplitudeBins.at(myBin));
233  theCorrection += shiftBins.at(myBin);
234  } else {
235  edm::LogError("EcalRecHitError")
236  << "Assigning time correction impossible. Setting it to 0 ";
237  theCorrection = 0.;
238  }
239 
240  // convert ns into clocks
241  return theCorrection / 25.;
242 }

Member Data Documentation

BXVector EcalUncalibRecHitWorkerMultiFit::activeBX
protected

Definition at line 80 of file EcalUncalibRecHitWorkerMultiFit.h.

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

bool EcalUncalibRecHitWorkerMultiFit::ampErrorCalculation_
protected

Definition at line 81 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

double EcalUncalibRecHitWorkerMultiFit::amplitudeThreshEB_
protected

Definition at line 128 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::amplitudeThreshEE_
protected

Definition at line 129 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

edm::EDGetTokenT<int> EcalUncalibRecHitWorkerMultiFit::bunchSpacing_
protected

Definition at line 86 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

int EcalUncalibRecHitWorkerMultiFit::bunchSpacingManual_
protected

Definition at line 85 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

double EcalUncalibRecHitWorkerMultiFit::chi2ThreshEB_
protected

Definition at line 143 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit().

double EcalUncalibRecHitWorkerMultiFit::chi2ThreshEE_
protected

Definition at line 144 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit().

bool EcalUncalibRecHitWorkerMultiFit::doPrefitEB_
protected

Definition at line 100 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

bool EcalUncalibRecHitWorkerMultiFit::doPrefitEE_
protected

Definition at line 101 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

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

Definition at line 108 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

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

Definition at line 136 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit().

double EcalUncalibRecHitWorkerMultiFit::ebSpikeThresh_
protected

Definition at line 130 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit().

double EcalUncalibRecHitWorkerMultiFit::EBtimeConstantTerm_
protected

Definition at line 116 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

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

Definition at line 110 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

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

Definition at line 106 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::EBtimeNconst_
protected

Definition at line 118 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

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

Definition at line 109 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

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

Definition at line 137 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit().

double EcalUncalibRecHitWorkerMultiFit::EEtimeConstantTerm_
protected

Definition at line 117 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

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

Definition at line 111 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

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

Definition at line 107 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::EEtimeNconst_
protected

Definition at line 119 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

FullSampleMatrix EcalUncalibRecHitWorkerMultiFit::fullpulsecovEB
protected

Definition at line 78 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

FullSampleMatrix EcalUncalibRecHitWorkerMultiFit::fullpulsecovEE
protected

Definition at line 79 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

FullSampleVector EcalUncalibRecHitWorkerMultiFit::fullpulseEB
protected

Definition at line 76 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

FullSampleVector EcalUncalibRecHitWorkerMultiFit::fullpulseEE
protected

Definition at line 77 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

double EcalUncalibRecHitWorkerMultiFit::gainRatios[3]
protected

Definition at line 56 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

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

Definition at line 59 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

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

Definition at line 95 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

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

Definition at line 134 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

bool EcalUncalibRecHitWorkerMultiFit::kPoorRecoFlagEB_
protected

Definition at line 141 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit().

bool EcalUncalibRecHitWorkerMultiFit::kPoorRecoFlagEE_
protected

Definition at line 142 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit().

EcalUncalibRecHitMultiFitAlgo EcalUncalibRecHitWorkerMultiFit::multiFitMethod_
protected

Definition at line 83 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

SampleMatrix EcalUncalibRecHitWorkerMultiFit::noisecorEBg1
protected

Definition at line 74 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by noisecor(), and run().

SampleMatrix EcalUncalibRecHitWorkerMultiFit::noisecorEBg12
protected

Definition at line 70 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by noisecor(), and run().

SampleMatrix EcalUncalibRecHitWorkerMultiFit::noisecorEBg6
protected

Definition at line 72 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by noisecor(), and run().

SampleMatrix EcalUncalibRecHitWorkerMultiFit::noisecorEEg1
protected

Definition at line 75 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by noisecor(), and run().

SampleMatrix EcalUncalibRecHitWorkerMultiFit::noisecorEEg12
protected

Definition at line 71 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by noisecor(), and run().

SampleMatrix EcalUncalibRecHitWorkerMultiFit::noisecorEEg6
protected

Definition at line 73 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by noisecor(), and run().

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

Definition at line 60 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

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

Definition at line 135 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG12mEB_
protected

Definition at line 121 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG12mEE_
protected

Definition at line 125 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG12pEB_
protected

Definition at line 120 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG12pEE_
protected

Definition at line 124 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG61mEB_
protected

Definition at line 123 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG61mEE_
protected

Definition at line 127 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG61pEB_
protected

Definition at line 122 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::outOfTimeThreshG61pEE_
protected

Definition at line 126 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::pedRMSVec[3]
protected

Definition at line 55 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

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

Definition at line 58 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

double EcalUncalibRecHitWorkerMultiFit::pedVec[3]
protected

Definition at line 54 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

double EcalUncalibRecHitWorkerMultiFit::prefitMaxChiSqEB_
protected

Definition at line 102 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

double EcalUncalibRecHitWorkerMultiFit::prefitMaxChiSqEE_
protected

Definition at line 103 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

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

Definition at line 62 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

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

Definition at line 61 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

EcalUncalibRecHitRatioMethodAlgo<EBDataFrame> EcalUncalibRecHitWorkerMultiFit::ratioMethod_barrel_
protected

Definition at line 113 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

EcalUncalibRecHitRatioMethodAlgo<EEDataFrame> EcalUncalibRecHitWorkerMultiFit::ratioMethod_endcap_
protected

Definition at line 114 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

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

Definition at line 89 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

std::string EcalUncalibRecHitWorkerMultiFit::timealgo_
protected

Definition at line 92 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and run().

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

Definition at line 132 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().

bool EcalUncalibRecHitWorkerMultiFit::useLumiInfoRunHeader_
protected

Definition at line 82 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by EcalUncalibRecHitWorkerMultiFit(), and set().

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

Definition at line 97 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

EcalUncalibRecHitTimeWeightsAlgo<EBDataFrame> EcalUncalibRecHitWorkerMultiFit::weightsMethod_barrel_
protected

Definition at line 98 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

EcalUncalibRecHitTimeWeightsAlgo<EEDataFrame> EcalUncalibRecHitWorkerMultiFit::weightsMethod_endcap_
protected

Definition at line 99 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run().

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

Definition at line 96 of file EcalUncalibRecHitWorkerMultiFit.h.

Referenced by run(), and set().