CMS 3D CMS Logo

TotemT2RecHitProducerAlgorithm.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of PPS offline software.
4 * Authors:
5 * Laurent Forthomme (laurent.forthomme@cern.ch)
6 *
7 ****************************************************************************/
8 
11 
14 
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
void build(const TotemGeometry &, const edmNew::DetSetVector< TotemT2Digi > &, edmNew::DetSetVector< TotemT2RecHit > &) override
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
Definition: output.py:1