CMS 3D CMS Logo

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

#include <HGCalUncalibRecHitRecWeightsAlgo.h>

Public Member Functions

bool isSiFESim () const
 
virtual HGCUncalibratedRecHit makeRecHit (const C &dataFrame)
 Compute parameters. 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 setGeometry (const HGCalGeometry *geom)
 
virtual ~HGCalUncalibRecHitRecWeightsAlgo ()
 

Private Attributes

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

Detailed Description

template<class C>
class HGCalUncalibRecHitRecWeightsAlgo< C >

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

Author
Valeri Andreev

Definition at line 22 of file HGCalUncalibRecHitRecWeightsAlgo.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file HGCalUncalibRecHitRecWeightsAlgo.h.

26 { };

Member Function Documentation

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

Compute parameters.

Definition at line 53 of file HGCalUncalibRecHitRecWeightsAlgo.h.

53  {
54  double amplitude_(-1.), pedestal_(-1.), jitter_(-1.), chi2_(-1.);
55  uint32_t flag = 0;
56 
57  constexpr int iSample=2; //only in-time sample
58  const auto& sample = dataFrame.sample(iSample);
59 
60  // are we using the SiFE Simulation?
61  if( isSiFESim_ ) {
62  // mode == true means TDC readout was activated
63  if( sample.mode() ) {
64  flag = !sample.threshold(); //raise flag if busy cell
65  // LG (23/06/2015):
66  //to get a continuous energy spectrum we must add here the maximum value in fC ever
67  //reported by the ADC. Namely: floor(tdcOnset/adcLSB_) * adcLSB_
68  // need to increment by one so TDC doesn't overlap with ADC last bin
69  // LG (11/04/2016):
70  // offset the TDC upwards to reflect the bin center
71  amplitude_ = ( std::floor(tdcOnsetfC_/adcLSB_) + 1.0 )* adcLSB_ + ( double(sample.data()) + 0.5) * tdcLSB_;
72  if(sample.getToAValid()) jitter_ = double(sample.toa()) * toaLSBToNS_;
73  LogDebug("HGCUncalibratedRecHit") << "TDC+: set the charge to: " << amplitude_ << ' ' << sample.data()
74  << ' ' << tdcLSB_ << std::endl
75  << "TDC+: set the ToA to: " << jitter_ << ' '
76  << sample.toa() << ' ' << toaLSBToNS_ << ' '
77  << " flag=" << flag << std::endl;
78  } else {
79  amplitude_ = double(sample.data()) * adcLSB_;
80  if(sample.getToAValid()) jitter_ = double(sample.toa()) * toaLSBToNS_;
81  LogDebug("HGCUncalibratedRecHit") << "ADC+: set the charge to: " << amplitude_ << ' ' << sample.data()
82  << ' ' << adcLSB_ << ' '
83  << "TDC+: set the ToA to: " << jitter_ << ' '
84  << sample.toa() << ' ' << toaLSBToNS_ << ' '<< std::endl;
85  }
86  } else {
87  amplitude_ = double(sample.data()) * adcLSB_;
88  LogDebug("HGCUncalibratedRecHit") << "ADC+: set the charge to: " << amplitude_ << ' ' << sample.data()
89  << ' ' << adcLSB_ << ' ' << std::endl;
90  }
91 
92  int thickness = 1;
93  if( ddd_ != nullptr ) {
94  HGCalDetId hid(dataFrame.id());
95  thickness = ddd_->waferTypeL(hid.wafer());
96  }
97  amplitude_ = amplitude_/fCPerMIP_[thickness-1];
98 
99  LogDebug("HGCUncalibratedRecHit") << "Final uncalibrated amplitude : " << amplitude_ << std::endl;
100 
101  return HGCUncalibratedRecHit( dataFrame.id(), amplitude_, pedestal_, jitter_, chi2_, flag);
102  }
#define LogDebug(id)
#define constexpr
int waferTypeL(int wafer) const
template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_ADCLSB ( const double  adclsb)
inline
template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_fCPerMIP ( const std::vector< double > &  fCPerMIP)
inline

Definition at line 38 of file HGCalUncalibRecHitRecWeightsAlgo.h.

38  {
39  if( std::any_of(fCPerMIP.cbegin(),
40  fCPerMIP.cend(),
41  [](double conv){ return conv <= 0.0; }) ) {
42  throw cms::Exception("BadConversionFactor") << "At least one of fCPerMIP is zero!" << std::endl;
43  }
45  }
static HepMC::IO_HEPEVT conv
template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_isSiFESim ( const bool  isSiFE)
inline
template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_TDCLSB ( const double  tdclsb)
inline
template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_tdcOnsetfC ( const double  tdcOnset)
inline
template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::set_toaLSBToNS ( const double  lsb2ns)
inline
template<class C>
void HGCalUncalibRecHitRecWeightsAlgo< C >::setGeometry ( const HGCalGeometry geom)
inline

Definition at line 47 of file HGCalUncalibRecHitRecWeightsAlgo.h.

47  {
48  if ( geom ) ddd_ = &(geom->topology().dddConstants());
49  else ddd_ = nullptr;
50  }
const HGCalTopology & topology() const
Definition: HGCalGeometry.h:99
const HGCalDDDConstants & dddConstants() const

Member Data Documentation

template<class C>
double HGCalUncalibRecHitRecWeightsAlgo< C >::adcLSB_
private
template<class C>
const HGCalDDDConstants* HGCalUncalibRecHitRecWeightsAlgo< C >::ddd_
private
template<class C>
std::vector<double> HGCalUncalibRecHitRecWeightsAlgo< C >::fCPerMIP_
private
template<class C>
bool HGCalUncalibRecHitRecWeightsAlgo< C >::isSiFESim_
private
template<class C>
double HGCalUncalibRecHitRecWeightsAlgo< C >::tdcLSB_
private
template<class C>
double HGCalUncalibRecHitRecWeightsAlgo< C >::tdcOnsetfC_
private
template<class C>
double HGCalUncalibRecHitRecWeightsAlgo< C >::toaLSBToNS_
private