CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Types | Private Attributes | Static Private Attributes
CTPPSDiamondTrackRecognition Class Reference

Class performing smart reconstruction for CTPPS Diamond Detectors. More...

#include <CTPPSDiamondTrackRecognition.h>

Classes

struct  HitParameters
 

Public Member Functions

void addHit (const CTPPSDiamondRecHit &recHit)
 Feed a new hit to the tracks recognition algorithm. More...
 
void clear ()
 Reset the list of hits. More...
 
 CTPPSDiamondTrackRecognition (const edm::ParameterSet &)
 
int produceTracks (edm::DetSet< CTPPSDiamondLocalTrack > &tracks)
 Produce a collection of tracks for the current station, given its hits collection. More...
 
 ~CTPPSDiamondTrackRecognition ()
 

Private Types

typedef std::vector
< HitParameters
HitParametersVector
 
typedef std::unordered_map
< int, HitParametersVector
HitParametersVectorMap
 

Private Attributes

TF1 hit_f_
 Function for pad efficiency. More...
 
HitParametersVectorMap hitParametersVectorMap_
 
std::unordered_map< int, int > mhMap_
 
const float resolution_
 
const float sigma_
 
const float startFromX_
 
const float stopAtX_
 
const float threshold_
 
const float thresholdFromMaximum_
 
float yPosition_
 
float yWidth_
 

Static Private Attributes

static const std::string pixelEfficiencyDefaultFunction_ = "(x>[0]-0.5*[1])*(x<[0]+0.5*[1])"
 Default hit function accounting for the pad spatial efficiency. More...
 

Detailed Description

Class performing smart reconstruction for CTPPS Diamond Detectors.

Date
Jan 2017

Definition at line 29 of file CTPPSDiamondTrackRecognition.h.

Member Typedef Documentation

Definition at line 51 of file CTPPSDiamondTrackRecognition.h.

Definition at line 52 of file CTPPSDiamondTrackRecognition.h.

Constructor & Destructor Documentation

CTPPSDiamondTrackRecognition::CTPPSDiamondTrackRecognition ( const edm::ParameterSet iConfig)

Definition at line 20 of file CTPPSDiamondTrackRecognition.cc.

References hit_f_, pixelEfficiencyDefaultFunction_, sigma_, startFromX_, and stopAtX_.

20  :
21  threshold_ ( iConfig.getParameter<double>( "threshold" ) ),
22  thresholdFromMaximum_( iConfig.getParameter<double>( "thresholdFromMaximum" ) ),
23  resolution_ ( iConfig.getParameter<double>( "resolution" ) ),
24  sigma_ ( iConfig.getParameter<double>( "sigma" ) ),
25  startFromX_ ( iConfig.getParameter<double>( "startFromX" ) ),
26  stopAtX_ ( iConfig.getParameter<double>( "stopAtX" ) ),
27  yPosition_ ( iConfig.getParameter<double>( "yPosition" ) ),
28  yWidth_ ( iConfig.getParameter<double>( "yWidth" ) ),
29  hit_f_( "hit_TF1_CTPPS", iConfig.getParameter<std::string>( "pixelEfficiencyFunction" ).c_str(), startFromX_, stopAtX_ )
30 {
31  if (sigma_==0.0) {
32  hit_f_ = TF1( "hit_TF1_CTPPS", pixelEfficiencyDefaultFunction_.c_str(), startFromX_, stopAtX_ ); // simple step function
33  }
34 }
T getParameter(std::string const &) const
static const std::string pixelEfficiencyDefaultFunction_
Default hit function accounting for the pad spatial efficiency.
TF1 hit_f_
Function for pad efficiency.
CTPPSDiamondTrackRecognition::~CTPPSDiamondTrackRecognition ( )

Definition at line 38 of file CTPPSDiamondTrackRecognition.cc.

39 {}

Member Function Documentation

void CTPPSDiamondTrackRecognition::addHit ( const CTPPSDiamondRecHit recHit)

Feed a new hit to the tracks recognition algorithm.

Definition at line 53 of file CTPPSDiamondTrackRecognition.cc.

References CTPPSDiamondRecHit::getMultipleHits(), CTPPSDiamondRecHit::getOOTIndex(), CTPPSDiamondRecHit::getX(), CTPPSDiamondRecHit::getXWidth(), CTPPSDiamondRecHit::getY(), CTPPSDiamondRecHit::getYWidth(), hitParametersVectorMap_, mhMap_, yPosition_, and yWidth_.

Referenced by CTPPSDiamondLocalTrackFitter::produce().

54 {
55  // store hit parameters
56  hitParametersVectorMap_[recHit.getOOTIndex()].emplace_back( recHit.getX(), recHit.getXWidth() );
57 
58  // Check vertical coordinates
59  if ( yPosition_ == 0.0 and yWidth_ == 0.0 ) {
60  yPosition_ = recHit.getY();
61  yWidth_ = recHit.getYWidth();
62  }
63 
64  //Multiple hits in the RP
65  if ( recHit.getMultipleHits() ) {
66  if ( mhMap_.find( recHit.getOOTIndex() ) == mhMap_.end() ) {
67  mhMap_[recHit.getOOTIndex()] = 1;
68  }
69  else {
70  ++( mhMap_[recHit.getOOTIndex()] );
71  }
72  }
73 }
float getXWidth() const
int getOOTIndex() const
HitParametersVectorMap hitParametersVectorMap_
float getYWidth() const
bool getMultipleHits() const
std::unordered_map< int, int > mhMap_
void CTPPSDiamondTrackRecognition::clear ( void  )

Reset the list of hits.

Definition at line 44 of file CTPPSDiamondTrackRecognition.cc.

References hitParametersVectorMap_, and mhMap_.

Referenced by CTPPSDiamondLocalTrackFitter::produce().

45 {
47  mhMap_.clear();
48 }
HitParametersVectorMap hitParametersVectorMap_
std::unordered_map< int, int > mhMap_
int CTPPSDiamondTrackRecognition::produceTracks ( edm::DetSet< CTPPSDiamondLocalTrack > &  tracks)

Produce a collection of tracks for the current station, given its hits collection.

Definition at line 78 of file CTPPSDiamondTrackRecognition.cc.

References hit_f_, hitParametersVectorMap_, i, j, mhMap_, edm::DetSet< T >::push_back(), resolution_, CTPPSDiamondLocalTrack::setValid(), sigma_, startFromX_, stopAtX_, dtDQMClient_cfg::threshold, threshold_, thresholdFromMaximum_, yPosition_, and yWidth_.

Referenced by CTPPSDiamondLocalTrackFitter::produce().

79 {
80  int number_of_tracks = 0;
81  for ( auto const& oot : hitParametersVectorMap_ ) {
82  std::vector<float> hit_profile( ( stopAtX_-startFromX_ )/resolution_, 0. );
83  for ( auto const& param : oot.second ) {
84  hit_f_.SetParameters( param.center, param.width, sigma_ );
85  for ( unsigned int i=0; i<hit_profile.size(); ++i ) {
86  hit_profile[i] += hit_f_.Eval( startFromX_ + i*resolution_ );
87  }
88  }
89 
90  float maximum = 0.;
91  bool below = true; // start below the threshold
92  int track_start_n = 0;
93 
94  for ( unsigned int i=0; i<hit_profile.size(); ++i ) {
95  if ( below && hit_profile[i] >= threshold_ ) { // going above the threshold
96  track_start_n = i;
97  maximum=0;
98  below = false;
99  }
100  if ( !below ) {
101  if ( hit_profile[i] > maximum ) {
102  maximum = hit_profile[i];
103  }
104  if ( hit_profile[i] < threshold_ ) { // going back below the threshold
105  below = true;
106 
107  // go back and use new threshold
108  const float threshold = maximum - thresholdFromMaximum_;
109  for ( unsigned int j=track_start_n; j<=i; ++j ) {
110  if ( below && hit_profile[j] >= threshold ) { // going above the threshold
111  track_start_n = j;
112  below = false;
113  }
114  if ( !below && hit_profile[j] < threshold ) { // going back below the threshold
115  below = true;
116 
117  //store track
118  math::XYZPoint pos0_sigma( ( j-track_start_n )*resolution_*0.5, yWidth_ * 0.5, 0. );
119  math::XYZPoint pos0( startFromX_ + track_start_n*resolution_ + pos0_sigma.X(), yPosition_, 0. );
120  int mult_hits = 0;
121  if ( mhMap_.find( oot.first ) != mhMap_.end() ) mult_hits = mhMap_[oot.first];
122 
123  CTPPSDiamondLocalTrack track( pos0, pos0_sigma, 0., 0., 0., oot.first, mult_hits );
124  track.setValid( true );
125  tracks.push_back( track );
126  ++number_of_tracks;
127  }
128  }
129  }
130  }
131  }
132  }
133 
134  return number_of_tracks;
135 }
int i
Definition: DBlmapReader.cc:9
void push_back(const T &t)
Definition: DetSet.h:68
HitParametersVectorMap hitParametersVectorMap_
int j
Definition: DBlmapReader.cc:9
TF1 hit_f_
Function for pad efficiency.
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::unordered_map< int, int > mhMap_

Member Data Documentation

TF1 CTPPSDiamondTrackRecognition::hit_f_
private

Function for pad efficiency.

Definition at line 68 of file CTPPSDiamondTrackRecognition.h.

Referenced by CTPPSDiamondTrackRecognition(), and produceTracks().

HitParametersVectorMap CTPPSDiamondTrackRecognition::hitParametersVectorMap_
private

Definition at line 69 of file CTPPSDiamondTrackRecognition.h.

Referenced by addHit(), clear(), and produceTracks().

std::unordered_map<int,int> CTPPSDiamondTrackRecognition::mhMap_
private

Definition at line 70 of file CTPPSDiamondTrackRecognition.h.

Referenced by addHit(), clear(), and produceTracks().

const std::string CTPPSDiamondTrackRecognition::pixelEfficiencyDefaultFunction_ = "(x>[0]-0.5*[1])*(x<[0]+0.5*[1])"
staticprivate

Default hit function accounting for the pad spatial efficiency.

Definition at line 55 of file CTPPSDiamondTrackRecognition.h.

Referenced by CTPPSDiamondTrackRecognition().

const float CTPPSDiamondTrackRecognition::resolution_
private

Definition at line 59 of file CTPPSDiamondTrackRecognition.h.

Referenced by produceTracks().

const float CTPPSDiamondTrackRecognition::sigma_
private

Definition at line 60 of file CTPPSDiamondTrackRecognition.h.

Referenced by CTPPSDiamondTrackRecognition(), and produceTracks().

const float CTPPSDiamondTrackRecognition::startFromX_
private

Definition at line 61 of file CTPPSDiamondTrackRecognition.h.

Referenced by CTPPSDiamondTrackRecognition(), and produceTracks().

const float CTPPSDiamondTrackRecognition::stopAtX_
private

Definition at line 62 of file CTPPSDiamondTrackRecognition.h.

Referenced by CTPPSDiamondTrackRecognition(), and produceTracks().

const float CTPPSDiamondTrackRecognition::threshold_
private

Definition at line 57 of file CTPPSDiamondTrackRecognition.h.

Referenced by produceTracks().

const float CTPPSDiamondTrackRecognition::thresholdFromMaximum_
private

Definition at line 58 of file CTPPSDiamondTrackRecognition.h.

Referenced by produceTracks().

float CTPPSDiamondTrackRecognition::yPosition_
private

Definition at line 64 of file CTPPSDiamondTrackRecognition.h.

Referenced by addHit(), and produceTracks().

float CTPPSDiamondTrackRecognition::yWidth_
private

Definition at line 65 of file CTPPSDiamondTrackRecognition.h.

Referenced by addHit(), and produceTracks().