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  t_shift_( iConfig.getParameter<int>( "timeShift" ) )
16 {}
17 
18 void
20 {
21  for ( edm::DetSetVector<CTPPSDiamondDigi>::const_iterator vec = input.begin(); vec != input.end(); ++vec )
22  {
23  const CTPPSDiamondDetId detid( vec->detId() );
24 
25  if ( detid.channel() > 20 ) continue; // VFAT-like information, to be ignored by CTPPSDiamondRecHitProducer
26 
27  const DetGeomDesc* det = geom->GetDetector( detid );
28  const float x_pos = det->translation().x(),
29  x_width = 2.0 * det->params().at( 0 ), // parameters stand for half the size
30  y_pos = det->translation().y(),
31  y_width = 2.0 * det->params().at( 1 );
32 
33  edm::DetSet<CTPPSDiamondRecHit>& rec_hits = output.find_or_insert( detid );
34 
35  for ( edm::DetSet<CTPPSDiamondDigi>::const_iterator digi = vec->begin(); digi != vec->end(); ++digi )
36  {
37  const int t = digi->getLeadingEdge();
38  if ( t==0 ) { continue; }
39 
40  const int t0 = ( t-t_shift_ ) % 1024,
41  time_slice = ( t-t_shift_ ) / 1024;
42 
43  rec_hits.push_back( CTPPSDiamondRecHit( x_pos, x_width, y_pos, y_width, // spatial information
44  ( t0 * ts_to_ns_ ),
45  ( digi->getTrailingEdge()-t0 ) * ts_to_ns_,
46  time_slice,
47  digi->getHPTDCErrorFlags(),
48  digi->getMultipleHit() ) );
49  }
50  }
51 }
const DetGeomDesc * GetDetector(unsigned int) const
returns geometry of a detector performs necessary checks, returns NULL if fails input is raw ID ...
void push_back(const T &t)
Definition: DetSet.h:68
Reconstructed hit in diamond detectors.
void build(const TotemRPGeometry *, const edm::DetSetVector< CTPPSDiamondDigi > &, edm::DetSetVector< CTPPSDiamondRecHit > &)
static std::string const input
Definition: EdmProvDump.cc:44
reference find_or_insert(det_id_type id)
Definition: DetSetVector.h:254
double ts_to_ns_
Conversion constant between HPTDC time slice and absolute time (in ns)
Geometrical description of a detector.
Definition: DetGeomDesc.h:40
DDTranslation translation() const
Definition: DetGeomDesc.h:87
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
The manager class for TOTEM RP geometry.
std::vector< double > params() const
Definition: DetGeomDesc.h:92
CTPPSDiamondRecHitProducerAlgorithm(const edm::ParameterSet &conf)
Detector ID class for CTPPS Timing Diamond detectors. Bits [19:31] : Assigend in CTPPSDetId Calss Bit...
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:346
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104