CMS 3D CMS Logo

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

#include <CTPPSDiamondRecHitProducerAlgorithm.h>

Public Member Functions

void build (const CTPPSGeometry *, const edm::DetSetVector< CTPPSDiamondDigi > &, edm::DetSetVector< CTPPSDiamondRecHit > &)
 
 CTPPSDiamondRecHitProducerAlgorithm (const edm::ParameterSet &conf)
 

Private Attributes

double ts_to_ns_
 Conversion constant between HPTDC time slice and absolute time (in ns) More...
 

Detailed Description

Definition at line 23 of file CTPPSDiamondRecHitProducerAlgorithm.h.

Constructor & Destructor Documentation

CTPPSDiamondRecHitProducerAlgorithm::CTPPSDiamondRecHitProducerAlgorithm ( const edm::ParameterSet conf)

Definition at line 13 of file CTPPSDiamondRecHitProducerAlgorithm.cc.

13  :
14  ts_to_ns_( iConfig.getParameter<double>( "timeSliceNs" ) )
15 {}
double ts_to_ns_
Conversion constant between HPTDC time slice and absolute time (in ns)

Member Function Documentation

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

Definition at line 18 of file CTPPSDiamondRecHitProducerAlgorithm.cc.

References edm::DetSetVector< T >::find_or_insert(), CTPPSGeometry::getSensor(), DetGeomDesc::params(), DetGeomDesc::parents(), edm::DetSet< T >::push_back(), lumiQTWidget::t, cscNeutronWriter_cfi::t0, CTPPSDiamondRecHit::TIMESLICE_WITHOUT_LEADING, DetGeomDesc::translation(), and ts_to_ns_.

Referenced by CTPPSDiamondRecHitProducer::produce().

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.
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
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
static constexpr int TIMESLICE_WITHOUT_LEADING
std::vector< double > params() const
Definition: DetGeomDesc.h:89
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...

Member Data Documentation

double CTPPSDiamondRecHitProducerAlgorithm::ts_to_ns_
private

Conversion constant between HPTDC time slice and absolute time (in ns)

Definition at line 32 of file CTPPSDiamondRecHitProducerAlgorithm.h.

Referenced by build().