CMS 3D CMS Logo

TotemTimingTrackRecognition.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  * Nicola Minafra (nicola.minafra@cern.ch)
7  * Mateusz Szpyrka (mateusz.szpyrka@cern.ch)
8  *
9  ****************************************************************************/
10 
12 
13 //----------------------------------------------------------------------------------------------------
14 
17 {}
18 
19 //----------------------------------------------------------------------------------------------------
20 
21 void
23 {
24  if ( recHit.getT() != TotemTimingRecHit::NO_T_AVAILABLE )
25  hitVectorMap_[0].emplace_back( recHit );
26 }
27 
28 //----------------------------------------------------------------------------------------------------
29 
30 int
32 {
33  int numberOfTracks = 0;
34  DimensionParameters param;
35 
36  auto getX = []( const TotemTimingRecHit& hit ){ return hit.getX(); };
37  auto getXWidth = []( const TotemTimingRecHit& hit ){ return hit.getXWidth(); };
38  auto setX = []( TotemTimingLocalTrack& track, float x ){ track.setPosition( math::XYZPoint( x, 0., 0. ) ); };
39  auto setXSigma = []( TotemTimingLocalTrack& track, float sigma ){ track.setPositionSigma( math::XYZPoint( sigma, 0., 0. ) ); };
40  auto getY = []( const TotemTimingRecHit& hit ){ return hit.getY(); };
41  auto getYWidth = []( const TotemTimingRecHit& hit ){ return hit.getYWidth(); };
42  auto setY = []( TotemTimingLocalTrack& track, float y ){ track.setPosition( math::XYZPoint( 0., y, 0. ) ); };
43  auto setYSigma = []( TotemTimingLocalTrack& track, float sigma ){ track.setPositionSigma( math::XYZPoint( 0., sigma, 0. ) ); };
44 
45  for ( const auto& hitBatch : hitVectorMap_ ) {
46  const auto& hits = hitBatch.second;
47  const auto& hitRange = getHitSpatialRange( hits );
48 
49  TrackVector xPartTracks, yPartTracks;
50 
51  param.rangeBegin = hitRange.xBegin;
52  param.rangeEnd = hitRange.xEnd;
53  producePartialTracks( hits, param, getX, getXWidth, setX, setXSigma, xPartTracks );
54 
55  param.rangeBegin = hitRange.yBegin;
56  param.rangeEnd = hitRange.yEnd;
57  producePartialTracks( hits, param, getY, getYWidth, setY, setYSigma, yPartTracks );
58 
59  if ( xPartTracks.empty() && yPartTracks.empty() )
60  continue;
61 
62  unsigned int validHitsNumber = (unsigned int)threshold_+1;
63 
64  for ( const auto& xTrack : xPartTracks ) {
65  for ( const auto& yTrack : yPartTracks ) {
66  math::XYZPoint position( xTrack.getX0(), yTrack.getY0(), 0.5f*( hitRange.zBegin + hitRange.zEnd ) );
67  math::XYZPoint positionSigma( xTrack.getX0Sigma(), yTrack.getY0Sigma(), 0.5f*( hitRange.zEnd - hitRange.zBegin ) );
68 
69  TotemTimingLocalTrack newTrack( position, positionSigma, 0., 0. );
70 
71  HitVector componentHits;
72  for ( const auto& hit : hits )
73  if ( newTrack.containsHit( hit, tolerance_ ) )
74  componentHits.emplace_back( hit );
75  if ( componentHits.size() < validHitsNumber )
76  continue;
77 
78  float mean_time = 0.f, time_sigma = 0.f;
79  bool valid_hits = timeEval( componentHits, mean_time, time_sigma );
80  newTrack.setValid( valid_hits );
81  newTrack.setT( mean_time );
82  newTrack.setTSigma( time_sigma );
83  // in a next iteration, we will be setting validity / numHits / numPlanes
84  tracks.push_back( newTrack );
85  }
86  }
87  }
88 
89  return numberOfTracks;
90 }
91 
void push_back(const T &t)
Definition: DetSet.h:68
void producePartialTracks(const HitVector &hits, const DimensionParameters &param, float(*getHitCenter)(const TotemTimingRecHit &), float(*getHitRangeWidth)(const TotemTimingRecHit &), void(*setTrackCenter)(TotemTimingLocalTrack &, float), void(*setTrackSigma)(TotemTimingLocalTrack &, float), TrackVector &result)
float getT() const
TotemTimingTrackRecognition(const edm::ParameterSet &iConfig)
void addHit(const TotemTimingRecHit &recHit) override
Add new hit to the set from which the tracks are reconstructed.
bool timeEval(const HitVector &hits, float &meanTime, float &timeSigma) const
void setTSigma(float t_sigma)
bool containsHit(const CTPPSTimingRecHit &recHit, float tolerance=0.1f, CheckDimension check=CheckDimension::all) const
void setPosition(const math::XYZPoint &pos0)
HitVectorMap hitVectorMap_
RecHit vectors that should be processed separately while reconstructing tracks.
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
static int position[264][3]
Definition: ReadPGInfo.cc:509
int produceTracks(edm::DetSet< TotemTimingLocalTrack > &tracks) override
Produces a collection of tracks for the current station, given its hits collection.
void setPositionSigma(const math::XYZPoint &pos0_sigma)