CMS 3D CMS Logo

List of all members | Public Member Functions
TotemT2RecHitProducerAlgorithm Class Reference

#include <TotemT2RecHitProducerAlgorithm.h>

Inheritance diagram for TotemT2RecHitProducerAlgorithm:
TimingRecHitProducerAlgorithm< TotemGeometry, edmNew::DetSetVector< TotemT2Digi >, edmNew::DetSetVector< TotemT2RecHit > >

Public Member Functions

void build (const TotemGeometry &, const edmNew::DetSetVector< TotemT2Digi > &, edmNew::DetSetVector< TotemT2RecHit > &) override
 
 TimingRecHitProducerAlgorithm (const edm::ParameterSet &iConfig)
 
- Public Member Functions inherited from TimingRecHitProducerAlgorithm< TotemGeometry, edmNew::DetSetVector< TotemT2Digi >, edmNew::DetSetVector< TotemT2RecHit > >
void setCalibration (const PPSTimingCalibration &calib, const PPSTimingCalibrationLUT &calibLUT)
 
 TimingRecHitProducerAlgorithm (const edm::ParameterSet &iConfig)
 
virtual ~TimingRecHitProducerAlgorithm ()=default
 

Additional Inherited Members

- Protected Attributes inherited from TimingRecHitProducerAlgorithm< TotemGeometry, edmNew::DetSetVector< TotemT2Digi >, edmNew::DetSetVector< TotemT2RecHit > >
bool apply_calib_
 Switch on/off the timing calibration. More...
 
const PPSTimingCalibrationcalib_
 DB-loaded calibration object. More...
 
std::unique_ptr< reco::FormulaEvaluatorcalib_fct_
 Timing correction formula. More...
 
const PPSTimingCalibrationLUTcalibLUT_
 
double ts_to_ns_
 Conversion constant between time slice and absolute time (in ns) More...
 

Detailed Description

Definition at line 20 of file TotemT2RecHitProducerAlgorithm.h.

Member Function Documentation

◆ build()

void TotemT2RecHitProducerAlgorithm::build ( const TotemGeometry geom,
const edmNew::DetSetVector< TotemT2Digi > &  input,
edmNew::DetSetVector< TotemT2RecHit > &  output 
)
overridevirtual

Implements TimingRecHitProducerAlgorithm< TotemGeometry, edmNew::DetSetVector< TotemT2Digi >, edmNew::DetSetVector< TotemT2RecHit > >.

Definition at line 15 of file TotemT2RecHitProducerAlgorithm.cc.

References TimingRecHitProducerAlgorithm< TotemGeometry, edmNew::DetSetVector< TotemT2Digi >, edmNew::DetSetVector< TotemT2RecHit > >::apply_calib_, TimingRecHitProducerAlgorithm< TotemGeometry, edmNew::DetSetVector< TotemT2Digi >, edmNew::DetSetVector< TotemT2RecHit > >::calib_, TimingRecHitProducerAlgorithm< TotemGeometry, edmNew::DetSetVector< TotemT2Digi >, edmNew::DetSetVector< TotemT2RecHit > >::calib_fct_, trigObjTnPSource_cfi::filler, relativeConstraints::geom, input, edm::isNotFinite(), convertSQLitetoXML_cfg::output, PPSTimingCalibration::parameters(), hgcalTBTopologyTester_cfi::sector, PPSTimingCalibration::timeOffset(), PPSTimingCalibration::timePrecision(), compareTotals::tot, and TimingRecHitProducerAlgorithm< TotemGeometry, edmNew::DetSetVector< TotemT2Digi >, edmNew::DetSetVector< TotemT2RecHit > >::ts_to_ns_.

Referenced by TotemT2RecHitProducer::produce().

17  {
18  for (const auto& vec : input) {
19  const TotemT2DetId detid(vec.detId());
20  const int sector = detid.arm(), plane = detid.plane(), channel = detid.channel();
21 
22  // retrieve the timing calibration part for this channel
23  const auto& ch_params = (apply_calib_) ? calib_->parameters(sector, 0, plane, channel) : std::vector<double>{};
24  // default values for offset + time precision if calibration object not found
25  const double ch_t_offset = (apply_calib_) ? calib_->timeOffset(sector, 0, plane, channel) : 0.;
26  const double ch_t_precis = (apply_calib_) ? calib_->timePrecision(sector, 0, plane, channel) : 0.;
27 
28  // prepare the output collection filler
30 
31  for (const auto& digi : vec) {
32  const int t_lead = digi.leadingEdge(), t_trail = digi.trailingEdge();
33  if (t_lead == 0 && t_trail == 0) // skip invalid digis
34  continue;
35  double tot = -1., ch_t_twc = 0.;
36  if (t_lead != 0 && t_trail != 0) {
37  tot = (t_trail - t_lead) * ts_to_ns_; // in ns
38  if (calib_fct_ && apply_calib_) { // compute the time-walk correction
39  ch_t_twc = calib_fct_->evaluate(std::vector<double>{tot}, ch_params);
40  if (edm::isNotFinite(ch_t_twc))
41  ch_t_twc = 0.;
42  }
43  }
44 
45  // retrieve the geometry element associated to this DetID
46  const auto& tile = geom.tile(detid);
47 
48  // store to the output collection
49  filler.emplace_back(tile.centre(), t_lead * ts_to_ns_ - ch_t_offset - ch_t_twc, ch_t_precis, tot);
50  }
51  }
52 }
Detector ID class for Totem T2 detectors. Bits [19:31] : Base CTPPSDetId class attributes Bits [16:18...
Definition: TotemT2DetId.h:25
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
double timeOffset(int key1, int key2, int key3, int key4=-1) const
static std::string const input
Definition: EdmProvDump.cc:50
double timePrecision(int key1, int key2, int key3, int key4=-1) const
std::vector< double > parameters(int key1, int key2, int key3, int key4) const

◆ TimingRecHitProducerAlgorithm()

Definition at line 24 of file TimingRecHitProducerAlgorithm.h.

25  : ts_to_ns_(iConfig.getParameter<double>("timeSliceNs")),
26  apply_calib_(iConfig.getParameter<bool>("applyCalibration")) {}