CMS 3D CMS Logo

CTPPSDiamondRecHitProducerAlgorithm.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of CTPPS offline software.
4 * Authors:
5 * Laurent Forthomme (laurent.forthomme@cern.ch)
6 *
7 ****************************************************************************/
8 
10 
11 //----------------------------------------------------------------------------------------------------
12 
14  ts_to_ns_( iConfig.getParameter<double>( "timeSliceNs" ) )
15 {}
16 
17 void
19 {
20  for ( const auto& vec : input ) {
21  const CTPPSDiamondDetId detid( vec.detId() );
22 
23  if ( detid.channel() > 20 ) continue; // VFAT-like information, to be ignored
24 
25  // retrieve the geometry element associated to this DetID
26  const DetGeomDesc* det = geom->getSensor( detid );
27 
28  const float x_pos = det->translation().x(),
29  y_pos = det->translation().y();
30  float z_pos = 0.;
31  z_pos = det->parentZPosition(); // retrieve the plane position;
32 
33  const float x_width = 2.0 * det->params().at( 0 ), // parameters stand for half the size
34  y_width = 2.0 * det->params().at( 1 ),
35  z_width = 2.0 * det->params().at( 2 );
36 
37  edm::DetSet<CTPPSDiamondRecHit>& rec_hits = output.find_or_insert( detid );
38 
39  for ( const auto& digi : vec ) {
40  if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() == 0 ) continue;
41 
42  const int t = digi.getLeadingEdge();
43  const int t0 = t % 1024;
44  const int time_slice = ( t != 0 ) ? t / 1024 : CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING;
45 
46  int tot = 0;
47  if ( t != 0 && digi.getTrailingEdge() != 0 ) tot = ( (int)digi.getTrailingEdge() ) - t;
48 
49  rec_hits.push_back( CTPPSDiamondRecHit( x_pos, x_width, y_pos, y_width, z_pos, z_width, // spatial information
50  ( t0 * ts_to_ns_ ),
51  ( tot * ts_to_ns_),
52  0., // time precision
53  time_slice,
54  digi.getHPTDCErrorFlags(),
55  digi.getMultipleHit() ) );
56  }
57  }
58 }
Translation translation() const
Definition: DetGeomDesc.h:66
void push_back(const T &t)
Definition: DetSet.h:68
Reconstructed hit in diamond detectors.
static std::string const input
Definition: EdmProvDump.cc:45
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:254
const DetGeomDesc * getSensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
void build(const CTPPSGeometry *, const edm::DetSetVector< CTPPSDiamondDigi > &, edm::DetSetVector< CTPPSDiamondRecHit > &)
double ts_to_ns_
Conversion constant between HPTDC time slice and absolute time (in ns)
Geometrical description of a sensor.
Definition: DetGeomDesc.h:35
The manager class for TOTEM RP geometry.
Definition: CTPPSGeometry.h:33
float parentZPosition() const
Definition: DetGeomDesc.h:58
static constexpr int TIMESLICE_WITHOUT_LEADING
std::vector< double > params() const
Definition: DetGeomDesc.h:68
CTPPSDiamondRecHitProducerAlgorithm(const edm::ParameterSet &conf)
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...