CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Static Private Attributes
HGCalUncalibRecHitRecWeightsAlgo< C > Class Template Reference

#include <HGCalUncalibRecHitRecWeightsAlgo.h>

Public Member Functions

bool isSiFESim () const
 
virtual HGCUncalibratedRecHit makeRecHit (const C &dataFrame, const bool computeLocalTime)
 Compute HGCUncalibratedRecHit from DataFrame. More...
 
void set_ADCLSB (const double adclsb)
 
void set_fCPerMIP (const std::vector< double > &fCPerMIP)
 
void set_isSiFESim (const bool isSiFE)
 
void set_TDCLSB (const double tdclsb)
 
void set_tdcOnsetfC (const double tdcOnset)
 
void set_toaLSBToNS (const double lsb2ns)
 
void set_tofDelay (const double tofDelay)
 
bool setGeometry (const edm::ESHandle< HGCalGeometry > &geom)
 
virtual ~HGCalUncalibRecHitRecWeightsAlgo ()
 

Private Attributes

double adcLSB_
 
const HGCalDDDConstantsddd_
 
std::vector< double > fCPerMIP_
 
const HGCalGeometrygeom_
 
bool isSiFESim_
 
double tdcLSB_
 
double tdcOnsetfC_
 
double toaLSBToNS_
 
double tofDelay_
 

Static Private Attributes

static constexpr float c_cm_ns = CLHEP::c_light * CLHEP::ns / CLHEP::cm
 

Detailed Description

template<class C>
class HGCalUncalibRecHitRecWeightsAlgo< C >

Template used to produce fast-track HGCAL Reco, weight=1

Author
Valeri Andreev

Definition at line 21 of file HGCalUncalibRecHitRecWeightsAlgo.h.

Constructor & Destructor Documentation

◆ ~HGCalUncalibRecHitRecWeightsAlgo()

template<class C>
virtual HGCalUncalibRecHitRecWeightsAlgo< C >::~HGCalUncalibRecHitRecWeightsAlgo ( )
inlinevirtual

Definition at line 24 of file HGCalUncalibRecHitRecWeightsAlgo.h.

24 {}

Member Function Documentation

◆ isSiFESim()

template<class C>
bool HGCalUncalibRecHitRecWeightsAlgo< C >::isSiFESim ( ) const
inline

◆ makeRecHit()

template<class C>
virtual HGCUncalibratedRecHit HGCalUncalibRecHitRecWeightsAlgo< C >::makeRecHit ( const C &  dataFrame,
const bool  computeLocalTime 
)
inlinevirtual

Compute HGCUncalibratedRecHit from DataFrame.

Definition at line 55 of file HGCalUncalibRecHitRecWeightsAlgo.h.

Referenced by HGCalUncalibRecHitWorkerWeights::run().

55  {
56  double amplitude_(-1.), pedestal_(-1.), jitter_(-99.), chi2_(-1.);
57  uint32_t flag = 0;
58 
59  constexpr int iSample = 2; //only in-time sample
60  const auto& sample = dataFrame.sample(iSample);
61 
62  // Were digis done w/ the complete digitization and using signal shape?
63  // (originally done only for the silicon, while for scitillator it was trivial. Fomr 11_ also scinti uses shape)
64  if (isSiFESim_) {
65  // mode == true: TDC readout was activated and amplitude comes from TimeOverThreshold
66  if (sample.mode()) {
67  flag = !sample.threshold(); // raise flag if busy cell
68  // LG (23/06/2015):
69  // to get a continuous energy spectrum we must add here the maximum value in fC ever
70  // reported by the ADC. Namely: floor(tdcOnset/adcLSB_) * adcLSB_
71  // need to increment by one so TDC doesn't overlap with ADC last bin
72  // LG (11/04/2016):
73  // offset the TDC upwards to reflect the bin center
74  amplitude_ = (std::floor(tdcOnsetfC_ / adcLSB_) + 1.0) * adcLSB_ + (double(sample.data()) + 0.5) * tdcLSB_;
75  } else {
76  amplitude_ = double(sample.data()) * adcLSB_; // why do we not have +0.5 here ?
77  } //isSiFESim_
78  } //mode()
79 
80  // trivial digitization, i.e. no signal shape
81  else {
82  amplitude_ = double(sample.data()) * adcLSB_;
83  }
84 
85  if (sample.getToAValid()) {
86  const auto& dist2center = geom_ ? geom_->getPosition(dataFrame.id()).mag() : 0;
87  jitter_ = computeLocalTime ? double(sample.toa()) * toaLSBToNS_ - tofDelay_
88  : double(sample.toa()) * toaLSBToNS_ - dist2center / c_cm_ns - tofDelay_;
89  }
90 
91  int thickness = (ddd_ != nullptr) ? ddd_->waferType(dataFrame.id(), false) : 0;
92  amplitude_ = amplitude_ / fCPerMIP_[thickness];
93 
94  LogDebug("HGCUncalibratedRecHit") << "isSiFESim_: " << isSiFESim_ << " ADC+: set the charge to: " << amplitude_
95  << ' ' << sample.data() << ' ' << adcLSB_ << ' '
96  << " TDC+: set the ToA to: " << jitter_ << ' ' << sample.toa()
97  << ' ' << toaLSBToNS_ << ' ' << tdcLSB_
98  << " getToAValid(): " << sample.getToAValid()
99  << " mode(): " << sample.mode() << std::endl;
100  LogDebug("HGCUncalibratedRecHit") << "Final uncalibrated amplitude : " << amplitude_ << std::endl;
101 
102  return HGCUncalibratedRecHit(dataFrame.id(), amplitude_, pedestal_, jitter_, chi2_, flag);
103  }
GlobalPoint getPosition(const DetId &id, bool cog, bool debug) const
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
int waferType(DetId const &id, bool fromFile) const
#define LogDebug(id)

◆ set_ADCLSB()

template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_ADCLSB ( const double  adclsb)
inline

Definition at line 29 of file HGCalUncalibRecHitRecWeightsAlgo.h.

Referenced by configureIt().

◆ set_fCPerMIP()

template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_fCPerMIP ( const std::vector< double > &  fCPerMIP)
inline

Definition at line 38 of file HGCalUncalibRecHitRecWeightsAlgo.h.

Referenced by configureIt().

38  {
39  if (std::any_of(fCPerMIP.cbegin(), fCPerMIP.cend(), [](double conv) { return conv <= 0.0; })) {
40  throw cms::Exception("BadConversionFactor") << "At least one of fCPerMIP is zero!" << std::endl;
41  }
43  }
EPOS::IO_EPOS conv

◆ set_isSiFESim()

template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_isSiFESim ( const bool  isSiFE)
inline

◆ set_TDCLSB()

template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_TDCLSB ( const double  tdclsb)
inline

Definition at line 30 of file HGCalUncalibRecHitRecWeightsAlgo.h.

Referenced by configureIt().

◆ set_tdcOnsetfC()

template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_tdcOnsetfC ( const double  tdcOnset)
inline

◆ set_toaLSBToNS()

template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_toaLSBToNS ( const double  lsb2ns)
inline

Definition at line 32 of file HGCalUncalibRecHitRecWeightsAlgo.h.

Referenced by configureIt().

◆ set_tofDelay()

template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_tofDelay ( const double  tofDelay)
inline

◆ setGeometry()

template<class C>
bool HGCalUncalibRecHitRecWeightsAlgo< C >::setGeometry ( const edm::ESHandle< HGCalGeometry > &  geom)
inline

Definition at line 45 of file HGCalUncalibRecHitRecWeightsAlgo.h.

Referenced by HGCalUncalibRecHitWorkerWeights::run().

45  {
46  geom_ = geom.isValid() ? geom.product() : nullptr;
47  if (isSiFESim_ && geom_)
48  ddd_ = &(geom_->topology().dddConstants());
49  else
50  ddd_ = nullptr;
51  return geom_ != nullptr;
52  }
const HGCalTopology & topology() const
const HGCalDDDConstants & dddConstants() const
Definition: HGCalTopology.h:98

Member Data Documentation

◆ adcLSB_

template<class C>
double HGCalUncalibRecHitRecWeightsAlgo< C >::adcLSB_
private

◆ c_cm_ns

template<class C>
constexpr float HGCalUncalibRecHitRecWeightsAlgo< C >::c_cm_ns = CLHEP::c_light * CLHEP::ns / CLHEP::cm
staticprivate

◆ ddd_

template<class C>
const HGCalDDDConstants* HGCalUncalibRecHitRecWeightsAlgo< C >::ddd_
private

◆ fCPerMIP_

template<class C>
std::vector<double> HGCalUncalibRecHitRecWeightsAlgo< C >::fCPerMIP_
private

◆ geom_

template<class C>
const HGCalGeometry* HGCalUncalibRecHitRecWeightsAlgo< C >::geom_
private

◆ isSiFESim_

template<class C>
bool HGCalUncalibRecHitRecWeightsAlgo< C >::isSiFESim_
private

◆ tdcLSB_

template<class C>
double HGCalUncalibRecHitRecWeightsAlgo< C >::tdcLSB_
private

◆ tdcOnsetfC_

template<class C>
double HGCalUncalibRecHitRecWeightsAlgo< C >::tdcOnsetfC_
private

◆ toaLSBToNS_

template<class C>
double HGCalUncalibRecHitRecWeightsAlgo< C >::toaLSBToNS_
private

◆ tofDelay_

template<class C>
double HGCalUncalibRecHitRecWeightsAlgo< C >::tofDelay_
private