CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
EcalUncalibRecHitWorkerRatio.cc
Go to the documentation of this file.
2 
7 
10 
13  EBtimeFitParameters_ = ps.getParameter<std::vector<double>>("EBtimeFitParameters");
14  EEtimeFitParameters_ = ps.getParameter<std::vector<double>>("EEtimeFitParameters");
15 
16  EBamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EBamplitudeFitParameters");
17  EEamplitudeFitParameters_ = ps.getParameter<std::vector<double>>("EEamplitudeFitParameters");
18 
19  EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
20  EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
21 
22  EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
23  EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
24 
25  EBtimeConstantTerm_ = ps.getParameter<double>("EBtimeConstantTerm");
26  EEtimeConstantTerm_ = ps.getParameter<double>("EEtimeConstantTerm");
27 
31 }
32 
34  // which of the samples need be used
36 
39 }
40 
44  DetId detid(itdg->id());
45 
46  const EcalSampleMask* sampleMask_ = sampleMaskHand_.product();
47 
48  const EcalPedestals::Item* aped = nullptr;
49  const EcalMGPAGainRatio* aGain = nullptr;
50 
51  if (detid.subdetId() == EcalEndcap) {
52  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
53  aped = &peds->endcap(hashedIndex);
54  aGain = &gains->endcap(hashedIndex);
55  } else {
56  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
57  aped = &peds->barrel(hashedIndex);
58  aGain = &gains->barrel(hashedIndex);
59  }
60 
61  pedVec[0] = aped->mean_x12;
62  pedVec[1] = aped->mean_x6;
63  pedVec[2] = aped->mean_x1;
64  pedRMSVec[0] = aped->rms_x12;
65  pedRMSVec[1] = aped->rms_x6;
66  pedRMSVec[2] = aped->rms_x1;
67  gainRatios[0] = 1.;
68  gainRatios[1] = aGain->gain12Over6();
69  gainRatios[2] = aGain->gain6Over1() * aGain->gain12Over6();
70 
71  float clockToNsConstant = 25.;
72  EcalUncalibratedRecHit uncalibRecHit;
73 
74  if (detid.subdetId() == EcalEndcap) {
75  uncalibRecHit = uncalibMaker_endcap_.makeRecHit(*itdg,
76  *sampleMask_,
77  pedVec,
78  pedRMSVec,
79  gainRatios,
82  EEtimeFitLimits_); //GF pass mask here
83 
85  uncalibRecHit.setAmplitude(crh.amplitudeMax);
86  uncalibRecHit.setJitter(crh.timeMax - 5);
87  uncalibRecHit.setJitterError(
88  std::sqrt(pow(crh.timeError, 2) + std::pow(EEtimeConstantTerm_, 2) / std::pow(clockToNsConstant, 2)));
89 
90  } else {
91  bool gainSwitch = uncalibMaker_barrel_.fixMGPAslew(*itdg);
92 
93  uncalibRecHit = uncalibMaker_barrel_.makeRecHit(*itdg,
94  *sampleMask_,
95  pedVec,
96  pedRMSVec,
97  gainRatios,
100  EBtimeFitLimits_); //GF pass mask here
101 
103 
104  uncalibRecHit.setAmplitude(crh.amplitudeMax);
105  if (gainSwitch) {
106  // introduce additional 1ns shift
107  uncalibRecHit.setJitter(crh.timeMax - 5 - 0.04);
108  } else {
109  uncalibRecHit.setJitter(crh.timeMax - 5);
110  }
111  uncalibRecHit.setJitterError(
112  std::sqrt(pow(crh.timeError, 2) + std::pow(EBtimeConstantTerm_, 2) / std::pow(clockToNsConstant, 2)));
113  }
114  result.push_back(uncalibRecHit);
115 
116  return true;
117 }
118 
121  std::vector<double> dSet1 = {-2.390548, 3.553628, -17.62341, 67.67538, -133.213, 140.7432, -75.41106, 16.20277};
122  std::vector<double> dSet2 = {-2.015452, 3.130702, -12.3473, 41.88921, -82.83944, 91.01147, -50.35761, 11.05621};
123 
124  psd.addNode(edm::ParameterDescription<double>("EEtimeFitLimits_Upper", 1.4, true) and
125  edm::ParameterDescription<double>("EEtimeConstantTerm", 0.18, true) and
126  edm::ParameterDescription<double>("EBtimeFitLimits_Lower", 0.2, true) and
127  edm::ParameterDescription<double>("EBtimeConstantTerm", 0.26, true) and
128  edm::ParameterDescription<double>("EEtimeFitLimits_Lower", 0.2, true) and
129  edm::ParameterDescription<std::vector<double>>("EEtimeFitParameters", dSet1, true) and
130  edm::ParameterDescription<std::vector<double>>("EEamplitudeFitParameters", {1.89, 1.4}, true) and
131  edm::ParameterDescription<double>("EBtimeFitLimits_Upper", 1.4, true) and
132  edm::ParameterDescription<std::vector<double>>("EBamplitudeFitParameters", {1.138, 1.652}, true) and
133  edm::ParameterDescription<std::vector<double>>("EBtimeFitParameters", dSet2, true));
134 
135  return psd;
136 }
137 
144  "EcalUncalibRecHitWorkerRatio");
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:82
const edm::EventSetup & c
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result) override
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > uncalibMaker_barrel_
void setJitter(float jitter)
edm::ESHandle< EcalPedestals > peds
edm::ESGetToken< EcalSampleMask, EcalSampleMaskRcd > sampleMaskToken_
std::vector< double > EEamplitudeFitParameters_
void push_back(T const &t)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
edm::ESHandle< EcalGainRatios > gains
void setJitterError(float jitterErr)
edm::ESHandle< EcalSampleMask > sampleMaskHand_
edm::ESGetToken< EcalGainRatios, EcalGainRatiosRcd > gainsToken_
tuple result
Definition: mps_fire.py:311
edm::ESGetToken< EcalPedestals, EcalPedestalsRcd > pedsToken_
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:36
EcalGainRatioMap EcalGainRatios
T sqrt(T t)
Definition: SSEVec.h:19
float gain6Over1() const
void set(const edm::EventSetup &es) override
EcalUncalibratedRecHit makeRecHit(const C &dataFrame, const EcalSampleMask &sampleMask, const double *pedestals, const double *pedestalRMSes, const double *gainRatios, std::vector< double > &timeFitParameters, std::vector< double > &amplitudeFitParameters, std::pair< double, double > &timeFitLimits)
edm::ParameterSetDescription getAlgoDescription() override
Definition: DetId.h:17
EcalPedestalsMap EcalPedestals
Definition: EcalPedestals.h:50
int hashedIndex() const
Definition: EEDetId.h:183
T const * product() const
Definition: ESHandle.h:86
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
float gain12Over6() const
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > uncalibMaker_endcap_
std::pair< double, double > EBtimeFitLimits_
#define DEFINE_EDM_PLUGIN(factory, type, name)
void setAmplitude(float amplitude)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
std::vector< double > EBamplitudeFitParameters_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
std::pair< double, double > EEtimeFitLimits_