test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HGCalUncalibRecHitRecWeightsAlgo.h
Go to the documentation of this file.
1 #ifndef RecoLocalCalo_HGCalRecAlgos_HGCalUncalibRecHitRecWeightsAlgo_HH
2 #define RecoLocalCalo_HGCalRecAlgos_HGCalUncalibRecHitRecWeightsAlgo_HH
3 
14 #include <vector>
15 #include <cmath>
16 
19 
20 template<class C> class HGCalUncalibRecHitRecWeightsAlgo
21 {
22  public:
23  // destructor
25 
26  virtual void set_isSiFESim(const bool isSiFE) { isSiFESim_ = isSiFE; }
27 
28  virtual void set_ADCLSB(const double adclsb) { adcLSB_ = adclsb; }
29  virtual void set_TDCLSB(const double tdclsb) { tdcLSB_ = tdclsb; }
30 
31  virtual void set_toaLSBToNS(const double lsb2ns) { toaLSBToNS_ = lsb2ns; }
32 
33  virtual void set_tdcOnsetfC(const double tdcOnset) { tdcOnsetfC_ = tdcOnset; }
34 
36  virtual HGCUncalibratedRecHit makeRecHit( const C& dataFrame ) {
37  double amplitude_(-1.), pedestal_(-1.), jitter_(-1.), chi2_(-1.);
38  uint32_t flag = 0;
39 
40  constexpr int iSample=2; //only in-time sample
41  const auto& sample = dataFrame.sample(iSample);
42 
43  // are we using the SiFE Simulation?
44  if( isSiFESim_ ) {
45  // mode == true means TDC readout was activated
46  if( sample.mode() ) {
47  flag = !sample.threshold(); //raise flag if busy cell
48  // LG (23/06/2015):
49  //to get a continuous energy spectrum we must add here the maximum value in fC ever
50  //reported by the ADC. Namely: floor(tdcOnset/adcLSB_) * adcLSB_
51  // need to increment by one so TDC doesn't overlap with ADC last bin
52  amplitude_ = ( std::floor(tdcOnsetfC_/adcLSB_) + 1.0 )* adcLSB_ + double(sample.data()) * tdcLSB_;
53  jitter_ = double(sample.toa()) * toaLSBToNS_;
54  LogDebug("HGCUncalibratedRecHit") << "TDC+: set the energy to: " << amplitude_ << ' ' << sample.data()
55  << ' ' << tdcLSB_ << std::endl
56  << "TDC+: set the jitter to: " << jitter_ << ' '
57  << sample.toa() << ' ' << toaLSBToNS_ << ' '
58  << " flag=" << flag << std::endl;
59  }
60  else {
61  amplitude_ = double(sample.data()) * adcLSB_;
62  LogDebug("HGCUncalibratedRecHit") << "ADC+: set the energy to: " << amplitude_ << ' ' << sample.data()
63  << ' ' << adcLSB_ << ' ' << std::endl;
64  }
65  }
66  else {
67  amplitude_ = double(sample.data()) * adcLSB_;
68  LogDebug("HGCUncalibratedRecHit") << "ADC+: set the energy to: " << amplitude_ << ' ' << sample.data()
69  << ' ' << adcLSB_ << ' ' << std::endl;
70  }
71 
72  LogDebug("HGCUncalibratedRecHit") << "Final uncalibrated amplitude : " << amplitude_ << std::endl;
73  return HGCUncalibratedRecHit( dataFrame.id(), amplitude_, pedestal_, jitter_, chi2_, flag);
74  }
75 
76  private:
78  bool isSiFESim_;
79 };
80 #endif
#define LogDebug(id)
virtual void set_tdcOnsetfC(const double tdcOnset)
virtual void set_ADCLSB(const double adclsb)
#define constexpr
virtual HGCUncalibratedRecHit makeRecHit(const C &dataFrame)
Compute parameters.
virtual void set_toaLSBToNS(const double lsb2ns)
virtual void set_TDCLSB(const double tdclsb)
virtual void set_isSiFESim(const bool isSiFE)