CMS 3D CMS Logo

List of all members | Public Member Functions | Static Private Attributes
CTPPSDiamondRecHitProducerAlgorithm Class Reference

#include <CTPPSDiamondRecHitProducerAlgorithm.h>

Inheritance diagram for CTPPSDiamondRecHitProducerAlgorithm:
TimingRecHitProducerAlgorithm< CTPPSGeometry, edm::DetSetVector< CTPPSDiamondDigi >, edm::DetSetVector< CTPPSDiamondRecHit > >

Public Member Functions

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

Static Private Attributes

static constexpr unsigned short MAX_CHANNEL = 20
 

Additional Inherited Members

- Protected Attributes inherited from TimingRecHitProducerAlgorithm< CTPPSGeometry, edm::DetSetVector< CTPPSDiamondDigi >, edm::DetSetVector< CTPPSDiamondRecHit > >
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 CTPPSDiamondRecHitProducerAlgorithm.h.

Member Function Documentation

◆ build()

void CTPPSDiamondRecHitProducerAlgorithm::build ( const CTPPSGeometry geom,
const edm::DetSetVector< CTPPSDiamondDigi > &  input,
edm::DetSetVector< CTPPSDiamondRecHit > &  output 
)
overridevirtual

Implements TimingRecHitProducerAlgorithm< CTPPSGeometry, edm::DetSetVector< CTPPSDiamondDigi >, edm::DetSetVector< CTPPSDiamondRecHit > >.

Definition at line 16 of file CTPPSDiamondRecHitProducerAlgorithm.cc.

References TimingRecHitProducerAlgorithm< CTPPSGeometry, edm::DetSetVector< CTPPSDiamondDigi >, edm::DetSetVector< CTPPSDiamondRecHit > >::apply_calib_, PPSTimingCalibrationLUT::bins(), TimingRecHitProducerAlgorithm< CTPPSGeometry, edm::DetSetVector< CTPPSDiamondDigi >, edm::DetSetVector< CTPPSDiamondRecHit > >::calib_, TimingRecHitProducerAlgorithm< CTPPSGeometry, edm::DetSetVector< CTPPSDiamondDigi >, edm::DetSetVector< CTPPSDiamondRecHit > >::calib_fct_, TimingRecHitProducerAlgorithm< CTPPSGeometry, edm::DetSetVector< CTPPSDiamondDigi >, edm::DetSetVector< CTPPSDiamondRecHit > >::calibLUT_, edm::DetSet< T >::emplace_back(), relativeConstraints::geom, DetGeomDesc::getDiamondDimensions(), input, edm::isNotFinite(), MAX_CHANNEL, PPSTimingCalibration::parameters(), DetGeomDesc::parentZPosition(), hgcalTBTopologyTester_cfi::sector, relativeConstraints::station, FrontierCondition_GT_autoExpress_cfi::t0, PPSTimingCalibration::timeOffset(), PPSTimingCalibration::timePrecision(), CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING, compareTotals::tot, DetGeomDesc::translation(), TimingRecHitProducerAlgorithm< CTPPSGeometry, edm::DetSetVector< CTPPSDiamondDigi >, edm::DetSetVector< CTPPSDiamondRecHit > >::ts_to_ns_, and DiamondDimensions::xHalfWidth.

Referenced by CTPPSDiamondRecHitProducer::produce().

18  {
19  for (const auto& vec : input) {
20  const CTPPSDiamondDetId detid(vec.detId());
21 
22  if (detid.channel() > MAX_CHANNEL) // VFAT-like information, to be ignored
23  continue;
24 
25  // retrieve the geometry element associated to this DetID
26  const DetGeomDesc* det = geom.sensor(detid);
27 
28  const float x_pos = det->translation().x(), y_pos = det->translation().y();
29  float z_pos = 0.;
30  z_pos = det->parentZPosition(); // retrieve the plane position;
31 
32  // parameters stand for half the size
33  const auto& diamondDimensions = det->getDiamondDimensions();
34  const float x_width = 2.0 * diamondDimensions.xHalfWidth;
35  const float y_width = 2.0 * diamondDimensions.yHalfWidth;
36  const float z_width = 2.0 * diamondDimensions.zHalfWidth;
37 
38  const int sector = detid.arm(), station = detid.station(), plane = detid.plane(), channel = detid.channel();
39  //LUT calibration
40  std::vector<double> lut;
41  if (apply_calib_)
42  lut = calibLUT_->bins(sector, station, plane, channel);
43  if (lut.size() != 1024)
44  lut = std::vector<double>(1024, 0.0);
45 
46  // retrieve the timing calibration part for this channel
47  const auto& ch_params =
48  (apply_calib_) ? calib_->parameters(sector, station, plane, channel) : std::vector<double>{};
49  // default values for offset + time precision if calibration object not found
50  const double ch_t_offset = (apply_calib_) ? calib_->timeOffset(sector, station, plane, channel) : 0.;
51  const double ch_t_precis = (apply_calib_) ? calib_->timePrecision(sector, station, plane, channel) : 0.;
52 
53  edm::DetSet<CTPPSDiamondRecHit>& rec_hits = output.find_or_insert(detid);
54 
55  for (const auto& digi : vec) {
56  const int t_lead = digi.leadingEdge(), t_trail = digi.trailingEdge();
57  // skip invalid digis
58  if (t_lead == 0 && t_trail == 0)
59  continue;
60 
61  double tot = -1., ch_t_twc = 0.;
62  if (t_lead != 0 && t_trail != 0) {
63  tot = (t_trail - t_lead) * ts_to_ns_; // in ns
64  if (calib_fct_ && apply_calib_ && !ch_params.empty()) {
65  // compute the time-walk correction
66  ch_t_twc = calib_fct_->evaluate(std::vector<double>{tot}, ch_params);
67  if (edm::isNotFinite(ch_t_twc))
68  ch_t_twc = 0.;
69  }
70  }
71 
72  const int time_slice =
73  (t_lead != 0) ? (t_lead - ch_t_offset / ts_to_ns_) / 1024 : CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING;
74 
75  // calibrated time of arrival
76  const double t0 = (t_lead % 1024) * ts_to_ns_ + lut[t_lead % 1024] * ts_to_ns_ - ch_t_twc;
77  rec_hits.emplace_back(
78  // spatial information
79  x_pos,
80  x_width,
81  y_pos,
82  y_width,
83  z_pos,
84  z_width,
85  // timing information
86  t0,
87  tot,
88  ch_t_precis,
89  time_slice,
90  // readout information
91  digi.hptdcErrorFlags(),
92  digi.multipleHit());
93  }
94  }
95 }
const Translation & translation() const
Definition: DetGeomDesc.h:80
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
float parentZPosition() const
Definition: DetGeomDesc.h:106
decltype(auto) emplace_back(Args &&... args)
Definition: DetSet.h:68
std::vector< double > bins(int key1, int key2, int key3, int key4) const
double timePrecision(int key1, int key2, int key3, int key4=-1) const
const DiamondDimensions & getDiamondDimensions() const
Definition: DetGeomDesc.h:90
std::vector< double > parameters(int key1, int key2, int key3, int key4) const
static constexpr int TIMESLICE_WITHOUT_LEADING
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
Definition: output.py:1

◆ TimingRecHitProducerAlgorithm()

Definition at line 24 of file TimingRecHitProducerAlgorithm.h.

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

Member Data Documentation

◆ MAX_CHANNEL

constexpr unsigned short CTPPSDiamondRecHitProducerAlgorithm::MAX_CHANNEL = 20
staticprivate

Definition at line 31 of file CTPPSDiamondRecHitProducerAlgorithm.h.

Referenced by build().