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 
10 
13 {
14  EBtimeFitParameters_ = ps.getParameter<std::vector<double> >("EBtimeFitParameters");
15  EEtimeFitParameters_ = ps.getParameter<std::vector<double> >("EEtimeFitParameters");
16 
17  EBamplitudeFitParameters_ = ps.getParameter<std::vector<double> >("EBamplitudeFitParameters");
18  EEamplitudeFitParameters_ = ps.getParameter<std::vector<double> >("EEamplitudeFitParameters");
19 
20  EBtimeFitLimits_.first = ps.getParameter<double>("EBtimeFitLimits_Lower");
21  EBtimeFitLimits_.second = ps.getParameter<double>("EBtimeFitLimits_Upper");
22 
23  EEtimeFitLimits_.first = ps.getParameter<double>("EEtimeFitLimits_Lower");
24  EEtimeFitLimits_.second = ps.getParameter<double>("EEtimeFitLimits_Upper");
25 
26  EBtimeConstantTerm_ = ps.getParameter<double>("EBtimeConstantTerm");
27  EEtimeConstantTerm_ = ps.getParameter<double>("EEtimeConstantTerm");
28 }
29 
30 void
32 {
33  es.get<EcalGainRatiosRcd>().get(gains);
34  es.get<EcalPedestalsRcd>().get(peds);
35 
36 }
37 
38 
39 bool
43 {
44  DetId detid(itdg->id());
45 
46  const EcalPedestals::Item * aped = 0;
47  const EcalMGPAGainRatio * aGain = 0;
48 
49  if (detid.subdetId()==EcalEndcap) {
50  unsigned int hashedIndex = EEDetId(detid).hashedIndex();
51  aped = &peds->endcap(hashedIndex);
52  aGain = &gains->endcap(hashedIndex);
53  } else {
54  unsigned int hashedIndex = EBDetId(detid).hashedIndex();
55  aped = &peds->barrel(hashedIndex);
56  aGain = &gains->barrel(hashedIndex);
57  }
58 
59  pedVec[0] = aped->mean_x12;
60  pedVec[1] = aped->mean_x6;
61  pedVec[2] = aped->mean_x1;
62  pedRMSVec[0] = aped->rms_x12;
63  pedRMSVec[1] = aped->rms_x6;
64  pedRMSVec[2] = aped->rms_x1;
65  gainRatios[0] = 1.;
66  gainRatios[1] = aGain->gain12Over6();
67  gainRatios[2] = aGain->gain6Over1()*aGain->gain12Over6();
68 
69  float clockToNsConstant = 25.;
70  EcalUncalibratedRecHit uncalibRecHit;
71 
72  if (detid.subdetId()==EcalEndcap) {
80  uncalibRecHit.setAmplitude( crh.amplitudeMax );
81  uncalibRecHit.setJitter( crh.timeMax - 5 );
82  uncalibRecHit.setJitterError( std::sqrt(pow(crh.timeError,2) +
84  std::pow(clockToNsConstant,2)) );
85 
86  } else {
87 
89  bool gainSwitch = uncalibMaker_barrel_.fixMGPAslew(*itdg);
96  uncalibRecHit.setAmplitude( crh.amplitudeMax );
97  if(gainSwitch){
98  // introduce additional 1ns shift
99  uncalibRecHit.setJitter( crh.timeMax - 5 - 0.04 );
100  }else{
101  uncalibRecHit.setJitter( crh.timeMax - 5);
102  }
103  uncalibRecHit.setJitterError( std::sqrt(pow(crh.timeError,2) +
105  std::pow(clockToNsConstant,2)) );
106 
107  }
108  result.push_back(uncalibRecHit);
109 
110  return true;
111 }
112 
T getParameter(std::string const &) const
int hashedIndex() const
get a compact index for arrays
Definition: EBDetId.h:73
void set(const edm::EventSetup &es)
void computeAmplitude(std::vector< double > &amplitudeFitParameters)
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
EcalUncalibRecHitRatioMethodAlgo< EBDataFrame > uncalibMaker_barrel_
edm::ESHandle< EcalPedestals > peds
void computeTime(std::vector< double > &timeFitParameters, std::pair< double, double > &timeFitLimits, std::vector< double > &amplitudeFitParameters)
std::vector< double > EEamplitudeFitParameters_
void push_back(T const &t)
std::pair< double, double > EEtimeFitLimits_
EcalUncalibRecHitWorkerRatio(const edm::ParameterSet &)
edm::ESHandle< EcalGainRatios > gains
void setJitterError(float jitterErr)
int hashedIndex(int ieta, int iphi)
Definition: EcalPyUtils.cc:42
T sqrt(T t)
Definition: SSEVec.h:28
tuple result
Definition: query.py:137
float gain6Over1() const
void setJitter(double jitter)
bool run(const edm::Event &evt, const EcalDigiCollection::const_iterator &digi, EcalUncalibratedRecHitCollection &result)
Definition: DetId.h:20
int hashedIndex() const
Definition: EEDetId.h:177
const T & get() const
Definition: EventSetup.h:55
void init(const C &dataFrame, const double *pedestals, const double *pedestalRMSes, const double *gainRatios)
float gain12Over6() const
std::pair< double, double > EBtimeFitLimits_
EcalUncalibRecHitRatioMethodAlgo< EEDataFrame > uncalibMaker_endcap_
#define DEFINE_EDM_PLUGIN(factory, type, name)
std::vector< double > EBamplitudeFitParameters_
void setAmplitude(double amplitude)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40