CMS 3D CMS Logo

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< HitParametersHitParametersVector
 
typedef std::unordered_map< int, HitParametersVectorHitParametersVectorMap
 

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 yPositionInitial_
 
float yWidth_
 
float yWidthInitial_
 
float zPosition_
 
float zPositionInitial_
 
float zWidth_
 
float zWidthInitial_
 

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  yPositionInitial_ ( iConfig.getParameter<double>( "yPosition" ) ),
28  yWidthInitial_ ( iConfig.getParameter<double>( "yWidth" ) ),
29  hit_f_( "hit_TF1_CTPPS", iConfig.getParameter<std::string>( "pixelEfficiencyFunction" ).c_str(), startFromX_, stopAtX_ )
30 {
31  if ( sigma_ == 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 57 of file CTPPSDiamondTrackRecognition.cc.

References CTPPSDiamondRecHit::getOOTIndex(), CTPPSDiamondRecHit::getX(), CTPPSDiamondRecHit::getXWidth(), CTPPSDiamondRecHit::getY(), CTPPSDiamondRecHit::getYWidth(), CTPPSDiamondRecHit::getZ(), CTPPSDiamondRecHit::getZWidth(), hitParametersVectorMap_, yPosition_, yPositionInitial_, yWidth_, yWidthInitial_, zPosition_, zPositionInitial_, zWidth_, and zWidthInitial_.

Referenced by CTPPSDiamondLocalTrackFitter::produce().

58 {
59  // store hit parameters
60  hitParametersVectorMap_[recHit.getOOTIndex()].emplace_back( recHit.getX(), recHit.getXWidth() );
61 
62  // check y
64  yPosition_ = recHit.getY();
65  yWidth_ = recHit.getYWidth();
66  }
67 
68  // check z
70  zPosition_ = recHit.getZ();
71  zWidth_ = recHit.getZWidth();
72  }
73 }
float getXWidth() const
int getOOTIndex() const
HitParametersVectorMap hitParametersVectorMap_
float getYWidth() const
float getZWidth() const
void CTPPSDiamondTrackRecognition::clear ( void  )

Reset the list of hits.

Definition at line 44 of file CTPPSDiamondTrackRecognition.cc.

References hitParametersVectorMap_, mhMap_, yPosition_, yPositionInitial_, yWidth_, yWidthInitial_, zPosition_, zPositionInitial_, zWidth_, and zWidthInitial_.

Referenced by CTPPSDiamondLocalTrackFitter::produce().

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_, mps_fire::i, mhMap_, edm::DetSet< T >::push_back(), resolution_, sigma_, startFromX_, stopAtX_, electronIdCutBased_cfi::threshold, threshold_, thresholdFromMaximum_, HiIsolationCommonParameters_cff::track, yPosition_, yWidth_, zPosition_, and zWidth_.

Referenced by CTPPSDiamondLocalTrackFitter::produce().

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

Referenced by CTPPSDiamondTrackRecognition(), and produceTracks().

HitParametersVectorMap CTPPSDiamondTrackRecognition::hitParametersVectorMap_
private

Definition at line 75 of file CTPPSDiamondTrackRecognition.h.

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

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

Definition at line 76 of file CTPPSDiamondTrackRecognition.h.

Referenced by 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(), clear(), and produceTracks().

float CTPPSDiamondTrackRecognition::yPositionInitial_
private

Definition at line 66 of file CTPPSDiamondTrackRecognition.h.

Referenced by addHit(), and clear().

float CTPPSDiamondTrackRecognition::yWidth_
private

Definition at line 65 of file CTPPSDiamondTrackRecognition.h.

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

float CTPPSDiamondTrackRecognition::yWidthInitial_
private

Definition at line 67 of file CTPPSDiamondTrackRecognition.h.

Referenced by addHit(), and clear().

float CTPPSDiamondTrackRecognition::zPosition_
private

Definition at line 68 of file CTPPSDiamondTrackRecognition.h.

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

float CTPPSDiamondTrackRecognition::zPositionInitial_
private

Definition at line 70 of file CTPPSDiamondTrackRecognition.h.

Referenced by addHit(), and clear().

float CTPPSDiamondTrackRecognition::zWidth_
private

Definition at line 69 of file CTPPSDiamondTrackRecognition.h.

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

float CTPPSDiamondTrackRecognition::zWidthInitial_
private

Definition at line 71 of file CTPPSDiamondTrackRecognition.h.

Referenced by addHit(), and clear().