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 {
15  EBtimeFitParameters_ = ps.getParameter<std::vector<double> >("EBtimeFitParameters");
16  EEtimeFitParameters_ = ps.getParameter<std::vector<double> >("EEtimeFitParameters");
17 
18  EBamplitudeFitParameters_ = ps.getParameter<std::vector<double> >("EBamplitudeFitParameters");
19  EEamplitudeFitParameters_ = ps.getParameter<std::vector<double> >("EEamplitudeFitParameters");
20 
21  EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
22  EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
23 
24  EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
25  EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
26 
27  EBtimeConstantTerm_ = ps.getParameter<double>("EBtimeConstantTerm");
28  EEtimeConstantTerm_ = ps.getParameter<double>("EEtimeConstantTerm");
29 }
30 
31 void
33 {
34 
35  // which of the samples need be used
37 
38  es.get<EcalGainRatiosRcd>().get(gains);
39  es.get<EcalPedestalsRcd>().get(peds);
40 
41 }
42 
43 
44 bool
48 {
49  DetId detid(itdg->id());
50 
51  const EcalSampleMask *sampleMask_ = sampleMaskHand_.product();
52 
53  const EcalPedestals::Item * aped = 0;
54  const EcalMGPAGainRatio * aGain = 0;
55 
56  if (detid.subdetId()==EcalEndcap) {
57  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
58  aped = &peds->endcap(hashedIndex);
59  aGain = &gains->endcap(hashedIndex);
60  } else {
61  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
62  aped = &peds->barrel(hashedIndex);
63  aGain = &gains->barrel(hashedIndex);
64  }
65 
66  pedVec[0] = aped->mean_x12;
67  pedVec[1] = aped->mean_x6;
68  pedVec[2] = aped->mean_x1;
69  pedRMSVec[0] = aped->rms_x12;
70  pedRMSVec[1] = aped->rms_x6;
71  pedRMSVec[2] = aped->rms_x1;
72  gainRatios[0] = 1.;
73  gainRatios[1] = aGain->gain12Over6();
74  gainRatios[2] = aGain->gain6Over1()*aGain->gain12Over6();
75 
76  float clockToNsConstant = 25.;
77  EcalUncalibratedRecHit uncalibRecHit;
78 
79  if (detid.subdetId()==EcalEndcap) {
80 
81  uncalibRecHit =
85  EEtimeFitLimits_);//GF pass mask here
86 
89  uncalibRecHit.setAmplitude( crh.amplitudeMax );
90  uncalibRecHit.setJitter( crh.timeMax - 5 );
91  uncalibRecHit.setJitterError( std::sqrt(pow(crh.timeError,2) +
93  std::pow(clockToNsConstant,2)) );
94 
95  } else {
96 
97 
98  bool gainSwitch = uncalibMaker_barrel_.fixMGPAslew(*itdg);
99 
100  uncalibRecHit=
101  uncalibMaker_barrel_.makeRecHit(*itdg,*sampleMask_,pedVec,pedRMSVec,
104  EBtimeFitLimits_);//GF pass mask here
105 
106 
109 
110  uncalibRecHit.setAmplitude( crh.amplitudeMax );
111  if(gainSwitch){
112  // introduce additional 1ns shift
113  uncalibRecHit.setJitter( crh.timeMax - 5 - 0.04 );
114  }else{
115  uncalibRecHit.setJitter( crh.timeMax - 5);
116  }
117  uncalibRecHit.setJitterError( std::sqrt(pow(crh.timeError,2) +
119  std::pow(clockToNsConstant,2)) );
120 
121  }
122  result.push_back(uncalibRecHit);
123 
124  return true;
125 }
126 
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)
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
virtual 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)
EcalUncalibRecHitWorkerRatio(const edm::ParameterSet &, edm::ConsumesCollector &c)
Definition: DetId.h:18
int hashedIndex() const
Definition: EEDetId.h:182
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
float gain12Over6() const
std::pair< double, double > EBtimeFitLimits_
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > uncalibMaker_endcap_
#define DEFINE_EDM_PLUGIN(factory, type, name)
void setAmplitude(float amplitude)
std::vector< double > EBamplitudeFitParameters_
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40