CMS 3D CMS Logo

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

#include <RPixRoadFinder.h>

Inheritance diagram for RPixRoadFinder:
RPixDetPatternFinder

Public Member Functions

void findPattern () override
 
 RPixRoadFinder (const edm::ParameterSet &param)
 
 ~RPixRoadFinder () override
 
- Public Member Functions inherited from RPixDetPatternFinder
void clear ()
 
std::vector< Road > const & getPatterns () const
 
 RPixDetPatternFinder (edm::ParameterSet const &parameterSet)
 
void setGeometry (const CTPPSGeometry *geometry)
 
void setHits (const edm::DetSetVector< CTPPSPixelRecHit > *hitVector)
 
virtual ~RPixDetPatternFinder ()
 

Private Member Functions

void run (const edm::DetSetVector< CTPPSPixelRecHit > &input, const CTPPSGeometry &geometry, std::vector< Road > &roads)
 

Private Attributes

unsigned int maxRoadSize_
 
unsigned int minRoadSize_
 
double roadRadius_
 
int verbosity_
 

Additional Inherited Members

- Public Types inherited from RPixDetPatternFinder
typedef std::vector< PointInPlaneRoad
 
- Protected Attributes inherited from RPixDetPatternFinder
const CTPPSGeometrygeometry_
 
const edm::DetSetVector
< CTPPSPixelRecHit > * 
hitVector_
 
std::vector< RoadpatternVector_
 

Detailed Description

Definition at line 36 of file RPixRoadFinder.h.

Constructor & Destructor Documentation

RPixRoadFinder::RPixRoadFinder ( const edm::ParameterSet param)
explicit

Definition at line 29 of file RPixRoadFinder.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), maxRoadSize_, minRoadSize_, roadRadius_, and verbosity_.

30  verbosity_ = parameterSet.getUntrackedParameter<int>("verbosity");
31  roadRadius_ = parameterSet.getParameter<double>("roadRadius");
32  minRoadSize_ = parameterSet.getParameter<int>("minRoadSize");
33  maxRoadSize_ = parameterSet.getParameter<int>("maxRoadSize");
34 }
T getUntrackedParameter(std::string const &, T const &) const
unsigned int maxRoadSize_
RPixDetPatternFinder(edm::ParameterSet const &parameterSet)
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int minRoadSize_
RPixRoadFinder::~RPixRoadFinder ( )
override

Definition at line 38 of file RPixRoadFinder.cc.

38 {}

Member Function Documentation

void RPixRoadFinder::findPattern ( )
overridevirtual

1mm

Implements RPixDetPatternFinder.

Definition at line 42 of file RPixRoadFinder.cc.

References RPixDetPatternFinder::geometry_, RPixDetPatternFinder::hitVector_, CTPPSGeometry::localToGlobal(), maxRoadSize_, minRoadSize_, RPixDetPatternFinder::patternVector_, roadRadius_, DetGeomDesc::rotation(), CTPPSDetId::rpId(), CTPPSGeometry::sensor(), and verbosity_.

42  {
43  Road temp_all_hits;
44  temp_all_hits.clear();
45 
46  // convert local hit sto global and push them to a vector
47  for (const auto& ds_rh2 : *hitVector_) {
48  const auto myid = CTPPSPixelDetId(ds_rh2.id);
49  for (const auto& it_rh : ds_rh2.data) {
50  CTPPSGeometry::Vector localV(it_rh.point().x(), it_rh.point().y(), it_rh.point().z());
51  const auto& globalV = geometry_->localToGlobal(ds_rh2.id, localV);
52  math::Error<3>::type localError;
53  localError[0][0] = it_rh.error().xx();
54  localError[0][1] = it_rh.error().xy();
55  localError[0][2] = 0.;
56  localError[1][0] = it_rh.error().xy();
57  localError[1][1] = it_rh.error().yy();
58  localError[1][2] = 0.;
59  localError[2][0] = 0.;
60  localError[2][1] = 0.;
61  localError[2][2] = 0.;
62  if (verbosity_ > 2)
63  edm::LogInfo("RPixRoadFinder") << "Hits = " << ds_rh2.data.size();
64 
65  DetGeomDesc::RotationMatrix theRotationMatrix = geometry_->sensor(myid)->rotation();
66  AlgebraicMatrix33 theRotationTMatrix;
67  theRotationMatrix.GetComponents(theRotationTMatrix(0, 0),
68  theRotationTMatrix(0, 1),
69  theRotationTMatrix(0, 2),
70  theRotationTMatrix(1, 0),
71  theRotationTMatrix(1, 1),
72  theRotationTMatrix(1, 2),
73  theRotationTMatrix(2, 0),
74  theRotationTMatrix(2, 1),
75  theRotationTMatrix(2, 2));
76 
77  math::Error<3>::type globalError = ROOT::Math::SimilarityT(theRotationTMatrix, localError);
78  temp_all_hits.emplace_back(PointInPlane{globalV, globalError, it_rh, myid});
79  }
80  }
81 
82  Road::iterator it_gh1 = temp_all_hits.begin();
83  Road::iterator it_gh2;
84 
85  patternVector_.clear();
86 
87  //look for points near wrt each other
88  // starting algorithm
89  while (it_gh1 != temp_all_hits.end() && temp_all_hits.size() >= minRoadSize_) {
90  Road temp_road;
91 
92  it_gh2 = it_gh1;
93 
94  const auto currPoint = it_gh1->globalPoint;
95  CTPPSPixelDetId currDet = CTPPSPixelDetId(it_gh1->detId);
96 
97  while (it_gh2 != temp_all_hits.end()) {
98  bool same_pot = false;
99  CTPPSPixelDetId tmpGh2Id = CTPPSPixelDetId(it_gh2->detId);
100  if (currDet.rpId() == tmpGh2Id.rpId())
101  same_pot = true;
102  const auto subtraction = currPoint - it_gh2->globalPoint;
103 
104  if (subtraction.Rho() < roadRadius_ && same_pot) {
105  temp_road.push_back(*it_gh2);
106  temp_all_hits.erase(it_gh2);
107  } else {
108  ++it_gh2;
109  }
110  }
111 
112  if (temp_road.size() >= minRoadSize_ && temp_road.size() < maxRoadSize_)
113  patternVector_.push_back(temp_road);
114  }
115  // end of algorithm
116 }
ROOT::Math::SMatrix< double, 3, 3, ROOT::Math::MatRepStd< double, 3, 3 > > AlgebraicMatrix33
unsigned int maxRoadSize_
ErrorD< N >::type type
Definition: Error.h:32
std::vector< PointInPlane > Road
DetGeomDesc::Translation Vector
Definition: CTPPSGeometry.h:36
Vector localToGlobal(const DetGeomDesc *, const Vector &) const
CTPPSDetId rpId() const
Definition: CTPPSDetId.h:78
const CTPPSGeometry * geometry_
const edm::DetSetVector< CTPPSPixelRecHit > * hitVector_
std::vector< Road > patternVector_
std::pair< double, double > PointInPlane
Definition: HoughGrouping.h:29
Log< level::Info, false > LogInfo
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
unsigned int minRoadSize_
const RotationMatrix & rotation() const
Definition: DetGeomDesc.h:81
ROOT::Math::Rotation3D RotationMatrix
Definition: DetGeomDesc.h:54
void RPixRoadFinder::run ( const edm::DetSetVector< CTPPSPixelRecHit > &  input,
const CTPPSGeometry geometry,
std::vector< Road > &  roads 
)
private

Member Data Documentation

unsigned int RPixRoadFinder::maxRoadSize_
private

Definition at line 46 of file RPixRoadFinder.h.

Referenced by findPattern(), and RPixRoadFinder().

unsigned int RPixRoadFinder::minRoadSize_
private

Definition at line 45 of file RPixRoadFinder.h.

Referenced by findPattern(), and RPixRoadFinder().

double RPixRoadFinder::roadRadius_
private

Definition at line 44 of file RPixRoadFinder.h.

Referenced by findPattern(), and RPixRoadFinder().

int RPixRoadFinder::verbosity_
private

Definition at line 43 of file RPixRoadFinder.h.

Referenced by findPattern(), and RPixRoadFinder().