CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
RPCSeedOverlapper Class Reference

#include <RPCSeedOverlapper.h>

Public Member Functions

void configure (const edm::ParameterSet &iConfig)
 
 RPCSeedOverlapper ()
 
void run ()
 
void setGeometry (const RPCGeometry &iGeom)
 
void setIO (std::vector< weightedTrajectorySeed > *goodweightedRef, std::vector< weightedTrajectorySeed > *candidateweightedRef)
 
void unsetIO ()
 
 ~RPCSeedOverlapper ()
 

Private Types

typedef RPCSeedPattern::weightedTrajectorySeed weightedTrajectorySeed
 

Private Member Functions

void CheckOverlap (const RPCGeometry &iGeom, std::vector< weightedTrajectorySeed > *SeedsRef)
 
bool isShareHit (const std::vector< TrackingRecHit const *> &RecHits, const TrackingRecHit &hit, const RPCGeometry &rpcGeometry)
 

Private Attributes

std::vector< weightedTrajectorySeed > * candidateweightedSeedsRef
 
std::vector< weightedTrajectorySeed > * goodweightedSeedsRef
 
bool isCheckcandidateOverlap
 
bool isCheckgoodOverlap
 
bool isConfigured
 
bool isIOset
 
const RPCGeometryrpcGeometry
 
unsigned int ShareRecHitsNumberThreshold
 

Detailed Description

Definition at line 18 of file RPCSeedOverlapper.h.

Member Typedef Documentation

◆ weightedTrajectorySeed

Definition at line 19 of file RPCSeedOverlapper.h.

Constructor & Destructor Documentation

◆ RPCSeedOverlapper()

RPCSeedOverlapper::RPCSeedOverlapper ( )

Definition at line 13 of file RPCSeedOverlapper.cc.

13  : rpcGeometry{nullptr} {
14  isConfigured = false;
15  isIOset = false;
16 }
const RPCGeometry * rpcGeometry

◆ ~RPCSeedOverlapper()

RPCSeedOverlapper::~RPCSeedOverlapper ( )

Definition at line 18 of file RPCSeedOverlapper.cc.

18 {}

Member Function Documentation

◆ CheckOverlap()

void RPCSeedOverlapper::CheckOverlap ( const RPCGeometry iGeom,
std::vector< weightedTrajectorySeed > *  SeedsRef 
)
private

Definition at line 49 of file RPCSeedOverlapper.cc.

References gather_cfg::cout, isShareHit(), N, nHits, rpcGeometry, and ShareRecHitsNumberThreshold.

Referenced by run().

50  {
51  std::vector<weightedTrajectorySeed> sortweightedSeeds;
52  std::vector<weightedTrajectorySeed> tempweightedSeeds;
53  std::vector<TrackingRecHit const *> tempRecHits;
54 
55  while (!weightedSeedsRef->empty()) {
56  cout << "Finding the weighted seeds group from " << weightedSeedsRef->size() << " seeds which share some recHits"
57  << endl;
58  // Take 1st seed in SeedsRef as referrence and find a collection which always share some recHits with some other
59  tempRecHits.clear();
60  tempweightedSeeds.clear();
61  int N = 0;
62  for (vector<weightedTrajectorySeed>::iterator itweightedseed = weightedSeedsRef->begin();
63  itweightedseed != weightedSeedsRef->end();
64  N++) {
65  auto const &recHitsRange = itweightedseed->first.recHits();
66  if (N == 0) {
67  cout << "Always take the 1st weighted seed to be the referrence." << endl;
68  for (auto const &hit : recHitsRange) {
69  cout << "Put its recHits to tempRecHits" << endl;
70  tempRecHits.push_back(&hit);
71  }
72  cout << "Put it to tempweightedSeeds" << endl;
73  tempweightedSeeds.push_back(*itweightedseed);
74  cout << "Then erase from weightedSeedsRef->" << endl;
75  itweightedseed = weightedSeedsRef->erase(itweightedseed);
76  } else {
77  cout << "Come to other weighted seed for checking " << itweightedseed->first.nHits() << " recHits from "
78  << tempRecHits.size() << " temp recHits" << endl;
79  unsigned int ShareRecHitsNumber = 0;
80  for (auto const &hit : recHitsRange) {
81  if (isShareHit(tempRecHits, hit, rpcGeometry))
82  ShareRecHitsNumber++;
83  }
84  if (ShareRecHitsNumber >= ShareRecHitsNumberThreshold) {
85  cout << "This seed is found to belong to current share group" << endl;
86  for (auto const &hit : recHitsRange) {
87  if (!isShareHit(tempRecHits, hit, rpcGeometry)) {
88  cout << "Put its extra recHits to tempRecHits" << endl;
89  tempRecHits.push_back(&hit);
90  }
91  }
92  cout << "Put it to tempSeeds" << endl;
93  tempweightedSeeds.push_back(*itweightedseed);
94  cout << "Then erase from SeedsRef" << endl;
95  itweightedseed = weightedSeedsRef->erase(itweightedseed);
96  } else
97  itweightedseed++;
98  }
99  }
100  // Find the best weighted seed and kick out those share recHits with it
101  // The best weighted seed save in sortweightedSeeds, those don't share recHits with it will be push back to weightedSeedsRef for next while loop
102  weightedTrajectorySeed bestweightedSeed;
103  vector<weightedTrajectorySeed>::iterator bestweightediter;
104  // Find the min Spt wrt Pt as the best Seed
105  double Quality = 1000000;
106  unsigned NumberofHits = 0;
107  cout << "Find " << tempweightedSeeds.size() << " seeds into one trajectory group" << endl;
108  for (vector<weightedTrajectorySeed>::iterator itweightedseed = tempweightedSeeds.begin();
109  itweightedseed != tempweightedSeeds.end();
110  itweightedseed++) {
111  unsigned int nHits = itweightedseed->first.nHits();
112  //std::vector<float> seed_error = itweightedseed->first.startingState().errorMatrix();
113  //double Spt = seed_error[1];
114  double weightedQuality = itweightedseed->second;
115  cout << "Find a weighted seed with quality " << weightedQuality << endl;
116  if ((NumberofHits < nHits) || (NumberofHits == nHits && weightedQuality < Quality)) {
117  NumberofHits = nHits;
118  Quality = weightedQuality;
119  bestweightedSeed = *itweightedseed;
120  bestweightediter = itweightedseed;
121  }
122  }
123  cout << "Best good temp seed's quality is " << Quality << endl;
124  sortweightedSeeds.push_back(bestweightedSeed);
125  tempweightedSeeds.erase(bestweightediter);
126  tempRecHits.clear();
127 
128  for (auto const &hit : bestweightedSeed.first.recHits()) {
129  tempRecHits.push_back(&hit);
130  }
131 
132  for (vector<weightedTrajectorySeed>::iterator itweightedseed = tempweightedSeeds.begin();
133  itweightedseed != tempweightedSeeds.end();) {
134  cout << "Checking the temp weighted seed's " << itweightedseed->first.nHits() << " hits to " << tempRecHits.size()
135  << " temp recHits" << endl;
136  bool isShare = false;
137  for (auto const &hit : itweightedseed->first.recHits()) {
138  if (isShareHit(tempRecHits, hit, rpcGeometry))
139  isShare = true;
140  }
141 
142  if (isShare == true) {
143  cout << "Find one temp seed share some recHits with best weighted seed" << endl;
144  itweightedseed = tempweightedSeeds.erase(itweightedseed);
145  } else {
146  cout << "This seed has no relation with best weighted seed" << endl;
147  weightedSeedsRef->push_back(*itweightedseed);
148  itweightedseed = tempweightedSeeds.erase(itweightedseed);
149  }
150  }
151  }
152  // At the end exchange SeedsRef with sortSeeds
153  weightedSeedsRef->clear();
154  *weightedSeedsRef = sortweightedSeeds;
155 }
bool isShareHit(const std::vector< TrackingRecHit const *> &RecHits, const TrackingRecHit &hit, const RPCGeometry &rpcGeometry)
unsigned int ShareRecHitsNumberThreshold
#define N
Definition: blowfish.cc:9
RPCSeedPattern::weightedTrajectorySeed weightedTrajectorySeed
caConstants::TupleMultiplicity const CAHitNtupletGeneratorKernelsGPU::HitToTuple const cms::cuda::AtomicPairCounter GPUCACell const *__restrict__ uint32_t const *__restrict__ gpuPixelDoublets::CellNeighborsVector const gpuPixelDoublets::CellTracksVector const GPUCACell::OuterHitOfCell const int32_t nHits
const RPCGeometry * rpcGeometry

◆ configure()

void RPCSeedOverlapper::configure ( const edm::ParameterSet iConfig)

Definition at line 20 of file RPCSeedOverlapper.cc.

References edm::ParameterSet::getParameter(), isCheckcandidateOverlap, isCheckgoodOverlap, isConfigured, and ShareRecHitsNumberThreshold.

20  {
21  isCheckgoodOverlap = iConfig.getParameter<bool>("isCheckgoodOverlap");
22  isCheckcandidateOverlap = iConfig.getParameter<bool>("isCheckcandidateOverlap");
23  ShareRecHitsNumberThreshold = iConfig.getParameter<unsigned int>("ShareRecHitsNumberThreshold");
24  isConfigured = true;
25 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
unsigned int ShareRecHitsNumberThreshold

◆ isShareHit()

bool RPCSeedOverlapper::isShareHit ( const std::vector< TrackingRecHit const *> &  RecHits,
const TrackingRecHit hit,
const RPCGeometry rpcGeometry 
)
private

Definition at line 157 of file RPCSeedOverlapper.cc.

References gather_cfg::cout, RPCGeometry::idToDetUnit(), dqmiodumpmetadata::n, rpcPointValidation_cfi::recHit, FastTrackerRecHitMaskProducer_cfi::recHits, rpcGeometry, GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by CheckOverlap().

159  {
160  bool istheSame = false;
161  unsigned int n = 1;
162  cout << "Checking from " << recHits.size() << " temp recHits" << endl;
163 
164  LocalPoint lpos1 = hit.localPosition();
165  DetId RPCId1 = hit.geographicalId();
166  const GeomDetUnit *rpcroll1 = rpcGeometry.idToDetUnit(RPCId1);
167  GlobalPoint gpos1 = rpcroll1->toGlobal(lpos1);
168  cout << "The hit's position: " << gpos1.x() << ", " << gpos1.y() << ", " << gpos1.z() << endl;
169  for (auto const &recHit : recHits) {
170  cout << "Checking the " << (n++) << " th recHit from tempRecHits" << endl;
171  LocalPoint lpos2 = recHit->localPosition();
172  DetId RPCId2 = recHit->geographicalId();
173  const GeomDetUnit *rpcroll2 = rpcGeometry.idToDetUnit(RPCId2);
174  GlobalPoint gpos2 = rpcroll2->toGlobal(lpos2);
175  cout << "The temp hit's position: " << gpos2.x() << ", " << gpos2.y() << ", " << gpos2.z() << endl;
176 
177  if ((gpos1.x() == gpos2.x()) && (gpos1.y() == gpos2.y()) && (gpos1.z() == gpos2.z())) {
178  cout << "This hit is found to be the same" << endl;
179  istheSame = true;
180  }
181  }
182  return istheSame;
183 }
T z() const
Definition: PV3DBase.h:61
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: RPCGeometry.cc:30
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
Definition: DetId.h:17
const RPCGeometry * rpcGeometry

◆ run()

void RPCSeedOverlapper::run ( )

Definition at line 38 of file RPCSeedOverlapper.cc.

References candidateweightedSeedsRef, CheckOverlap(), gather_cfg::cout, goodweightedSeedsRef, isCheckcandidateOverlap, isCheckgoodOverlap, isConfigured, isIOset, and rpcGeometry.

38  {
39  if (isConfigured == false || isIOset == false || rpcGeometry == nullptr) {
40  cout << "Configuration or IO is not set yet" << endl;
41  return;
42  }
43  if (isCheckgoodOverlap == true)
45  if (isCheckcandidateOverlap == true)
47 }
std::vector< weightedTrajectorySeed > * candidateweightedSeedsRef
std::vector< weightedTrajectorySeed > * goodweightedSeedsRef
void CheckOverlap(const RPCGeometry &iGeom, std::vector< weightedTrajectorySeed > *SeedsRef)
const RPCGeometry * rpcGeometry

◆ setGeometry()

void RPCSeedOverlapper::setGeometry ( const RPCGeometry iGeom)

Definition at line 36 of file RPCSeedOverlapper.cc.

References rpcGeometry.

36 { rpcGeometry = &iGeom; }
const RPCGeometry * rpcGeometry

◆ setIO()

void RPCSeedOverlapper::setIO ( std::vector< weightedTrajectorySeed > *  goodweightedRef,
std::vector< weightedTrajectorySeed > *  candidateweightedRef 
)

Definition at line 27 of file RPCSeedOverlapper.cc.

References candidateweightedSeedsRef, goodweightedSeedsRef, and isIOset.

28  {
29  goodweightedSeedsRef = goodweightedRef;
30  candidateweightedSeedsRef = candidateweightedRef;
31  isIOset = true;
32 }
std::vector< weightedTrajectorySeed > * candidateweightedSeedsRef
std::vector< weightedTrajectorySeed > * goodweightedSeedsRef

◆ unsetIO()

void RPCSeedOverlapper::unsetIO ( )

Definition at line 34 of file RPCSeedOverlapper.cc.

References isIOset.

34 { isIOset = false; }

Member Data Documentation

◆ candidateweightedSeedsRef

std::vector<weightedTrajectorySeed>* RPCSeedOverlapper::candidateweightedSeedsRef
private

Definition at line 45 of file RPCSeedOverlapper.h.

Referenced by run(), and setIO().

◆ goodweightedSeedsRef

std::vector<weightedTrajectorySeed>* RPCSeedOverlapper::goodweightedSeedsRef
private

Definition at line 44 of file RPCSeedOverlapper.h.

Referenced by run(), and setIO().

◆ isCheckcandidateOverlap

bool RPCSeedOverlapper::isCheckcandidateOverlap
private

Definition at line 41 of file RPCSeedOverlapper.h.

Referenced by configure(), and run().

◆ isCheckgoodOverlap

bool RPCSeedOverlapper::isCheckgoodOverlap
private

Definition at line 40 of file RPCSeedOverlapper.h.

Referenced by configure(), and run().

◆ isConfigured

bool RPCSeedOverlapper::isConfigured
private

Definition at line 37 of file RPCSeedOverlapper.h.

Referenced by configure(), and run().

◆ isIOset

bool RPCSeedOverlapper::isIOset
private

Definition at line 38 of file RPCSeedOverlapper.h.

Referenced by run(), setIO(), and unsetIO().

◆ rpcGeometry

const RPCGeometry* RPCSeedOverlapper::rpcGeometry
private

Definition at line 46 of file RPCSeedOverlapper.h.

Referenced by CheckOverlap(), isShareHit(), run(), and setGeometry().

◆ ShareRecHitsNumberThreshold

unsigned int RPCSeedOverlapper::ShareRecHitsNumberThreshold
private

Definition at line 42 of file RPCSeedOverlapper.h.

Referenced by CheckOverlap(), and configure().