CMS 3D CMS Logo

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 (bool isbadpot) 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_
 
double roadRadiusBadPot_
 
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 34 of file RPixRoadFinder.h.

Constructor & Destructor Documentation

◆ RPixRoadFinder()

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

Definition at line 18 of file RPixRoadFinder.cc.

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

19  verbosity_ = parameterSet.getUntrackedParameter<int>("verbosity");
20  roadRadius_ = parameterSet.getParameter<double>("roadRadius");
21  minRoadSize_ = parameterSet.getParameter<int>("minRoadSize");
22  maxRoadSize_ = parameterSet.getParameter<int>("maxRoadSize");
23  roadRadiusBadPot_ = parameterSet.getParameter<double>("roadRadiusBadPot");
24  // isBadPot_ = parameterSet.getParameter<bool>("isBadPot");
25 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int maxRoadSize_
RPixDetPatternFinder(edm::ParameterSet const &parameterSet)
ParameterSet const & parameterSet(StableProvenance const &provenance, ProcessHistory const &history)
Definition: Provenance.cc:11
T getUntrackedParameter(std::string const &, T const &) const
double roadRadiusBadPot_
unsigned int minRoadSize_

◆ ~RPixRoadFinder()

RPixRoadFinder::~RPixRoadFinder ( )
override

Definition at line 29 of file RPixRoadFinder.cc.

29 {}

Member Function Documentation

◆ findPattern()

void RPixRoadFinder::findPattern ( bool  isbadpot)
overridevirtual

1mm

Implements RPixDetPatternFinder.

Definition at line 33 of file RPixRoadFinder.cc.

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

33  {
34  Road temp_all_hits;
35  temp_all_hits.clear();
36 
37  Road temp_all_hits_badPot;
38  temp_all_hits_badPot.clear();
39 
40  // convert local hit sto global and push them to a vector
41  for (const auto& ds_rh2 : *hitVector_) {
42  const auto myid = CTPPSPixelDetId(ds_rh2.id);
43  for (const auto& it_rh : ds_rh2.data) {
44  CTPPSGeometry::Vector localV(it_rh.point().x(), it_rh.point().y(), it_rh.point().z());
45  const auto& globalV = geometry_->localToGlobal(ds_rh2.id, localV);
46  math::Error<3>::type localError;
47  localError[0][0] = it_rh.error().xx();
48  localError[0][1] = it_rh.error().xy();
49  localError[0][2] = 0.;
50  localError[1][0] = it_rh.error().xy();
51  localError[1][1] = it_rh.error().yy();
52  localError[1][2] = 0.;
53  localError[2][0] = 0.;
54  localError[2][1] = 0.;
55  localError[2][2] = 0.;
56  if (verbosity_ > 2)
57  edm::LogInfo("RPixRoadFinder") << "Hits = " << ds_rh2.data.size();
58 
59  DetGeomDesc::RotationMatrix theRotationMatrix = geometry_->sensor(myid)->rotation();
60  AlgebraicMatrix33 theRotationTMatrix;
61  theRotationMatrix.GetComponents(theRotationTMatrix(0, 0),
62  theRotationTMatrix(0, 1),
63  theRotationTMatrix(0, 2),
64  theRotationTMatrix(1, 0),
65  theRotationTMatrix(1, 1),
66  theRotationTMatrix(1, 2),
67  theRotationTMatrix(2, 0),
68  theRotationTMatrix(2, 1),
69  theRotationTMatrix(2, 2));
70 
71  math::Error<3>::type globalError = ROOT::Math::SimilarityT(theRotationTMatrix, localError);
72 
73  // create new collection for planes 0 and 5 of pot 45-220-fr
74 
75  if (isBadPot == true && myid.arm() == 0 && myid.station() == 2 && localV.x() > 0 &&
76  (myid.plane() == 0 || myid.plane() == 5)) { // 45-220-far
77 
78  temp_all_hits_badPot.emplace_back(PointInPlane{globalV, globalError, it_rh, myid});
79  }
80  temp_all_hits.emplace_back(PointInPlane{globalV, globalError, it_rh, myid});
81  }
82  }
83 
84  Road::iterator it_gh1 = temp_all_hits.begin();
85  Road::iterator it_gh2;
86 
87  patternVector_.clear();
88 
89  //look for points near wrt each other
90  // starting algorithm
91  while (it_gh1 != temp_all_hits.end() && temp_all_hits.size() >= minRoadSize_) {
92  Road temp_road;
93 
94  it_gh2 = it_gh1;
95 
96  const auto currPoint = it_gh1->globalPoint;
97  CTPPSPixelDetId currDet = CTPPSPixelDetId(it_gh1->detId);
98 
99  while (it_gh2 != temp_all_hits.end()) {
100  bool same_pot = false;
101  CTPPSPixelDetId tmpGh2Id = CTPPSPixelDetId(it_gh2->detId);
102  if (currDet.rpId() == tmpGh2Id.rpId())
103  same_pot = true;
104  const auto subtraction = currPoint - it_gh2->globalPoint;
105 
106  if (subtraction.Rho() < roadRadius_ && same_pot) {
107  temp_road.push_back(*it_gh2);
108  temp_all_hits.erase(it_gh2);
109  } else {
110  ++it_gh2;
111  }
112  }
113 
114  if (temp_road.size() >= minRoadSize_ && temp_road.size() < maxRoadSize_)
115  patternVector_.push_back(temp_road);
116  }
117  // end of algorithm
118 
119  // badPot algorithm
120  Road::iterator it_gh1_bP = temp_all_hits_badPot.begin();
121  Road::iterator it_gh2_bP;
122 
123  while (it_gh1_bP != temp_all_hits_badPot.end() && temp_all_hits_badPot.size() >= 2) {
124  Road temp_road;
125 
126  it_gh2_bP = it_gh1_bP;
127 
128  const auto currPoint = it_gh1_bP->globalPoint;
129 
130  while (it_gh2_bP != temp_all_hits_badPot.end()) {
131  const auto subtraction = currPoint - it_gh2_bP->globalPoint;
132 
133  if (subtraction.Rho() < roadRadiusBadPot_) {
134  temp_road.push_back(*it_gh2_bP);
135  temp_all_hits_badPot.erase(it_gh2_bP);
136  } else {
137  ++it_gh2_bP;
138  }
139  }
140 
141  if (temp_road.size() == 2) { // look for isolated tracks
142  patternVector_.push_back(temp_road);
143  }
144  }
145 }
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
Vector localToGlobal(const DetGeomDesc *, const Vector &) const
DetGeomDesc::Translation Vector
Definition: CTPPSGeometry.h:36
const CTPPSGeometry * geometry_
const edm::DetSetVector< CTPPSPixelRecHit > * hitVector_
CTPPSDetId rpId() const
Definition: CTPPSDetId.h:78
const DetGeomDesc * sensor(unsigned int id) const
returns geometry of a detector performs necessary checks, returns NULL if fails
std::vector< Road > patternVector_
std::pair< double, double > PointInPlane
Definition: HoughGrouping.h:29
Log< level::Info, false > LogInfo
double roadRadiusBadPot_
const RotationMatrix & rotation() const
Definition: DetGeomDesc.h:81
unsigned int minRoadSize_
ROOT::Math::Rotation3D RotationMatrix
Definition: DetGeomDesc.h:54

◆ run()

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

Member Data Documentation

◆ maxRoadSize_

unsigned int RPixRoadFinder::maxRoadSize_
private

Definition at line 44 of file RPixRoadFinder.h.

Referenced by findPattern(), and RPixRoadFinder().

◆ minRoadSize_

unsigned int RPixRoadFinder::minRoadSize_
private

Definition at line 43 of file RPixRoadFinder.h.

Referenced by findPattern(), and RPixRoadFinder().

◆ roadRadius_

double RPixRoadFinder::roadRadius_
private

Definition at line 42 of file RPixRoadFinder.h.

Referenced by findPattern(), and RPixRoadFinder().

◆ roadRadiusBadPot_

double RPixRoadFinder::roadRadiusBadPot_
private

Definition at line 45 of file RPixRoadFinder.h.

Referenced by findPattern(), and RPixRoadFinder().

◆ verbosity_

int RPixRoadFinder::verbosity_
private

Definition at line 41 of file RPixRoadFinder.h.

Referenced by findPattern(), and RPixRoadFinder().