CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalUncalibRecHitWorkerRatio.cc
Go to the documentation of this file.
2 
7 
11 
14 
17 {
18  EBtimeFitParameters_ = ps.getParameter<std::vector<double> >("EBtimeFitParameters");
19  EEtimeFitParameters_ = ps.getParameter<std::vector<double> >("EEtimeFitParameters");
20 
21  EBamplitudeFitParameters_ = ps.getParameter<std::vector<double> >("EBamplitudeFitParameters");
22  EEamplitudeFitParameters_ = ps.getParameter<std::vector<double> >("EEamplitudeFitParameters");
23 
24  EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
25  EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
26 
27  EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
28  EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
29 
30  EBtimeConstantTerm_ = ps.getParameter<double>("EBtimeConstantTerm");
31  EEtimeConstantTerm_ = ps.getParameter<double>("EEtimeConstantTerm");
32 }
33 
34 void
36 {
37 
38  // which of the samples need be used
40 
41  es.get<EcalGainRatiosRcd>().get(gains);
42  es.get<EcalPedestalsRcd>().get(peds);
43 
44 }
45 
46 
47 bool
51 {
52  DetId detid(itdg->id());
53 
54  const EcalSampleMask *sampleMask_ = sampleMaskHand_.product();
55 
56  const EcalPedestals::Item * aped = 0;
57  const EcalMGPAGainRatio * aGain = 0;
58 
59  if (detid.subdetId()==EcalEndcap) {
60  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
61  aped = &peds->endcap(hashedIndex);
62  aGain = &gains->endcap(hashedIndex);
63  } else {
64  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
65  aped = &peds->barrel(hashedIndex);
66  aGain = &gains->barrel(hashedIndex);
67  }
68 
69  pedVec[0] = aped->mean_x12;
70  pedVec[1] = aped->mean_x6;
71  pedVec[2] = aped->mean_x1;
72  pedRMSVec[0] = aped->rms_x12;
73  pedRMSVec[1] = aped->rms_x6;
74  pedRMSVec[2] = aped->rms_x1;
75  gainRatios[0] = 1.;
76  gainRatios[1] = aGain->gain12Over6();
77  gainRatios[2] = aGain->gain6Over1()*aGain->gain12Over6();
78 
79  float clockToNsConstant = 25.;
80  EcalUncalibratedRecHit uncalibRecHit;
81 
82  if (detid.subdetId()==EcalEndcap) {
83 
84  uncalibRecHit =
88  EEtimeFitLimits_);//GF pass mask here
89 
92  uncalibRecHit.setAmplitude( crh.amplitudeMax );
93  uncalibRecHit.setJitter( crh.timeMax - 5 );
94  uncalibRecHit.setJitterError( std::sqrt(pow(crh.timeError,2) +
96  std::pow(clockToNsConstant,2)) );
97 
98  } else {
99 
100 
101  bool gainSwitch = uncalibMaker_barrel_.fixMGPAslew(*itdg);
102 
103  uncalibRecHit=
104  uncalibMaker_barrel_.makeRecHit(*itdg,*sampleMask_,pedVec,pedRMSVec,
107  EBtimeFitLimits_);//GF pass mask here
108 
109 
112 
113  uncalibRecHit.setAmplitude( crh.amplitudeMax );
114  if(gainSwitch){
115  // introduce additional 1ns shift
116  uncalibRecHit.setJitter( crh.timeMax - 5 - 0.04 );
117  }else{
118  uncalibRecHit.setJitter( crh.timeMax - 5);
119  }
120  uncalibRecHit.setJitterError( std::sqrt(pow(crh.timeError,2) +
122  std::pow(clockToNsConstant,2)) );
123 
124  }
125  result.push_back(uncalibRecHit);
126 
127  return true;
128 }
129 
132 
134  std::vector<double> dSet1 = {-2.390548,3.553628,-17.62341,67.67538,-133.213,140.7432,-75.41106,16.20277};
135  std::vector<double> dSet2 = {-2.015452, 3.130702, -12.3473, 41.88921, -82.83944, 91.01147, -50.35761, 11.05621};
136 
137  psd.addNode(edm::ParameterDescription<double>("EEtimeFitLimits_Upper", 1.4, true) and
138  edm::ParameterDescription<double>("EEtimeConstantTerm", 0.18, true) and
139  edm::ParameterDescription<double>("EBtimeFitLimits_Lower", 0.2, true) and
140  edm::ParameterDescription<double>("EBtimeConstantTerm", 0.26, true) and
141  edm::ParameterDescription<double>("EEtimeFitLimits_Lower", 0.2, true) and
142  edm::ParameterDescription<std::vector<double> >("EEtimeFitParameters", dSet1, true) and
143  edm::ParameterDescription<std::vector<double>>("EEamplitudeFitParameters", {1.89, 1.4}, true) and
144  edm::ParameterDescription<double>("EBtimeFitLimits_Upper", 1.4, true) and
145  edm::ParameterDescription<std::vector<double>>("EBamplitudeFitParameters", {1.138,1.652}, true) and
146  edm::ParameterDescription<std::vector<double>>("EBtimeFitParameters", dSet2, true) );
147 
148  return psd;
149 }
150 
T getParameter(std::string const &) const
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:86
void set(const edm::EventSetup &es)
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > uncalibMaker_barrel_
void setJitter(float jitter)
edm::ESHandle< EcalPedestals > peds
std::vector< double > EEamplitudeFitParameters_
void push_back(T const &t)
ParameterDescriptionNode * addNode(ParameterDescriptionNode const &node)
std::pair< double, double > EEtimeFitLimits_
edm::ESHandle< EcalGainRatios > gains
void setJitterError(float jitterErr)
edm::ESHandle< EcalSampleMask > sampleMaskHand_
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
T sqrt(T t)
Definition: SSEVec.h:48
tuple result
Definition: query.py:137
float gain6Over1() const
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)
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result)
Definition: DetId.h:18
int hashedIndex() const
Definition: EEDetId.h:182
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
float gain12Over6() const
std::pair< double, double > EBtimeFitLimits_
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > uncalibMaker_endcap_
#define DEFINE_EDM_PLUGIN(factory, type, name)
void setAmplitude(float amplitude)
edm::ParameterSetDescription getAlgoDescription()
std::vector< double > EBamplitudeFitParameters_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40