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  if ( det->parents().empty() )
32  edm::LogWarning("CTPPSDiamondRecHitProducerAlgorithm") << "The geometry element for " << detid << " has no parents. Check the geometry hierarchy!";
33  else
34  z_pos = det->parents()[det->parents().size()-1].absTranslation().z(); // retrieve the plane position;
35 
36  const float x_width = 2.0 * det->params().at( 0 ), // parameters stand for half the size
37  y_width = 2.0 * det->params().at( 1 ),
38  z_width = 2.0 * det->params().at( 2 );
39 
40  edm::DetSet<CTPPSDiamondRecHit>& rec_hits = output.find_or_insert( detid );
41 
42  for ( const auto& digi : vec ) {
43  if ( digi.getLeadingEdge() == 0 && digi.getTrailingEdge() == 0 ) continue;
44 
45  const int t = digi.getLeadingEdge();
46  const int t0 = t % 1024;
47  const int time_slice = ( t != 0 ) ? t / 1024 : CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING;
48 
49  int tot = 0;
50  if ( t != 0 && digi.getTrailingEdge() != 0 ) tot = ( (int)digi.getTrailingEdge() ) - t;
51 
52  rec_hits.push_back( CTPPSDiamondRecHit( x_pos, x_width, y_pos, y_width, z_pos, z_width, // spatial information
53  ( t0 * ts_to_ns_ ),
54  ( tot * ts_to_ns_),
55  0., // time precision
56  time_slice,
57  digi.getHPTDCErrorFlags(),
58  digi.getMultipleHit() ) );
59  }
60  }
61 }
void push_back(const T &t)
Definition: DetSet.h:68
Reconstructed hit in diamond detectors.
static std::string const input
Definition: EdmProvDump.cc:44
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:37
virtual std::vector< DDExpandedNode > parents() const
returns all the components below
Definition: DetGeomDesc.h:67
DDTranslation translation() const
Definition: DetGeomDesc.h:84
The manager class for TOTEM RP geometry.
Definition: CTPPSGeometry.h:33
static constexpr int TIMESLICE_WITHOUT_LEADING
std::vector< double > params() const
Definition: DetGeomDesc.h:89
CTPPSDiamondRecHitProducerAlgorithm(const edm::ParameterSet &conf)
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...