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 setEventSetup (const edm::EventSetup &iSetup)
 
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 edm::EventSetup &iSetup, std::vector< weightedTrajectorySeed > *SeedsRef)
 
bool isShareHit (const edm::OwnVector< TrackingRecHit > &RecHits, const TrackingRecHit &hit, edm::ESHandle< RPCGeometry > rpcGeometry)
 

Private Attributes

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

Detailed Description

Definition at line 20 of file RPCSeedOverlapper.h.

Member Typedef Documentation

◆ weightedTrajectorySeed

Definition at line 21 of file RPCSeedOverlapper.h.

Constructor & Destructor Documentation

◆ RPCSeedOverlapper()

RPCSeedOverlapper::RPCSeedOverlapper ( )

Definition at line 13 of file RPCSeedOverlapper.cc.

13  {
14  isConfigured = false;
15  isIOset = false;
16  isEventSetupset = false;
17 }

◆ ~RPCSeedOverlapper()

RPCSeedOverlapper::~RPCSeedOverlapper ( )

Definition at line 19 of file RPCSeedOverlapper.cc.

19 {}

Member Function Documentation

◆ CheckOverlap()

void RPCSeedOverlapper::CheckOverlap ( const edm::EventSetup iSetup,
std::vector< weightedTrajectorySeed > *  SeedsRef 
)
private

Definition at line 53 of file RPCSeedOverlapper.cc.

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

References edm::OwnVector< T, P >::clear(), gather_cfg::cout, edm::EventSetup::get(), get, N, edm::OwnVector< T, P >::push_back(), and edm::OwnVector< T, P >::size().

◆ configure()

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

Definition at line 21 of file RPCSeedOverlapper.cc.

21  {
22  isCheckgoodOverlap = iConfig.getParameter<bool>("isCheckgoodOverlap");
23  isCheckcandidateOverlap = iConfig.getParameter<bool>("isCheckcandidateOverlap");
24  ShareRecHitsNumberThreshold = iConfig.getParameter<unsigned int>("ShareRecHitsNumberThreshold");
25  isConfigured = true;
26 }

References edm::ParameterSet::getParameter().

◆ isShareHit()

bool RPCSeedOverlapper::isShareHit ( const edm::OwnVector< TrackingRecHit > &  RecHits,
const TrackingRecHit hit,
edm::ESHandle< RPCGeometry rpcGeometry 
)
private

Definition at line 165 of file RPCSeedOverlapper.cc.

167  {
168  bool istheSame = false;
169  unsigned int n = 1;
170  cout << "Checking from " << RecHits.size() << " temp recHits" << endl;
171 
172  LocalPoint lpos1 = hit.localPosition();
173  DetId RPCId1 = hit.geographicalId();
174  const GeomDetUnit *rpcroll1 = rpcGeometry->idToDetUnit(RPCId1);
175  GlobalPoint gpos1 = rpcroll1->toGlobal(lpos1);
176  cout << "The hit's position: " << gpos1.x() << ", " << gpos1.y() << ", " << gpos1.z() << endl;
177  for (edm::OwnVector<TrackingRecHit>::const_iterator it = RecHits.begin(); it != RecHits.end(); it++, n++) {
178  cout << "Checking the " << n << " th recHit from tempRecHits" << endl;
179  LocalPoint lpos2 = it->localPosition();
180  DetId RPCId2 = it->geographicalId();
181  const GeomDetUnit *rpcroll2 = rpcGeometry->idToDetUnit(RPCId2);
182  GlobalPoint gpos2 = rpcroll2->toGlobal(lpos2);
183  cout << "The temp hit's position: " << gpos2.x() << ", " << gpos2.y() << ", " << gpos2.z() << endl;
184 
185  if ((gpos1.x() == gpos2.x()) && (gpos1.y() == gpos2.y()) && (gpos1.z() == gpos2.z())) {
186  cout << "This hit is found to be the same" << endl;
187  istheSame = true;
188  }
189  }
190  return istheSame;
191 }

References edm::OwnVector< T, P >::begin(), gather_cfg::cout, edm::OwnVector< T, P >::end(), RPCGeometry::idToDetUnit(), dqmiodumpmetadata::n, edm::OwnVector< T, P >::size(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

◆ run()

void RPCSeedOverlapper::run ( )

Definition at line 42 of file RPCSeedOverlapper.cc.

42  {
43  if (isConfigured == false || isIOset == false || isEventSetupset == false) {
44  cout << "Configuration or IO is not set yet" << endl;
45  return;
46  }
47  if (isCheckgoodOverlap == true)
49  if (isCheckcandidateOverlap == true)
51 }

References g4TestOverlap_cfg::CheckOverlap, and gather_cfg::cout.

◆ setEventSetup()

void RPCSeedOverlapper::setEventSetup ( const edm::EventSetup iSetup)

Definition at line 37 of file RPCSeedOverlapper.cc.

37  {
38  eSetup = &iSetup;
39  isEventSetupset = true;
40 }

◆ setIO()

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

Definition at line 28 of file RPCSeedOverlapper.cc.

29  {
30  goodweightedSeedsRef = goodweightedRef;
31  candidateweightedSeedsRef = candidateweightedRef;
32  isIOset = true;
33 }

◆ unsetIO()

void RPCSeedOverlapper::unsetIO ( )

Definition at line 35 of file RPCSeedOverlapper.cc.

35 { isIOset = false; }

Member Data Documentation

◆ candidateweightedSeedsRef

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

Definition at line 48 of file RPCSeedOverlapper.h.

◆ eSetup

const edm::EventSetup* RPCSeedOverlapper::eSetup
private

Definition at line 49 of file RPCSeedOverlapper.h.

◆ goodweightedSeedsRef

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

Definition at line 47 of file RPCSeedOverlapper.h.

◆ isCheckcandidateOverlap

bool RPCSeedOverlapper::isCheckcandidateOverlap
private

Definition at line 44 of file RPCSeedOverlapper.h.

◆ isCheckgoodOverlap

bool RPCSeedOverlapper::isCheckgoodOverlap
private

Definition at line 43 of file RPCSeedOverlapper.h.

◆ isConfigured

bool RPCSeedOverlapper::isConfigured
private

Definition at line 39 of file RPCSeedOverlapper.h.

◆ isEventSetupset

bool RPCSeedOverlapper::isEventSetupset
private

Definition at line 41 of file RPCSeedOverlapper.h.

◆ isIOset

bool RPCSeedOverlapper::isIOset
private

Definition at line 40 of file RPCSeedOverlapper.h.

◆ ShareRecHitsNumberThreshold

unsigned int RPCSeedOverlapper::ShareRecHitsNumberThreshold
private

Definition at line 45 of file RPCSeedOverlapper.h.

RPCSeedOverlapper::CheckOverlap
void CheckOverlap(const edm::EventSetup &iSetup, std::vector< weightedTrajectorySeed > *SeedsRef)
Definition: RPCSeedOverlapper.cc:53
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
GeomDet
Definition: GeomDet.h:27
edm::OwnVector::end
iterator end()
Definition: OwnVector.h:285
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
TrajectorySeed::range
std::pair< const_iterator, const_iterator > range
Definition: TrajectorySeed.h:21
RPCSeedOverlapper::isEventSetupset
bool isEventSetupset
Definition: RPCSeedOverlapper.h:41
RPCSeedOverlapper::goodweightedSeedsRef
std::vector< weightedTrajectorySeed > * goodweightedSeedsRef
Definition: RPCSeedOverlapper.h:47
gather_cfg.cout
cout
Definition: gather_cfg.py:144
RPCSeedOverlapper::isIOset
bool isIOset
Definition: RPCSeedOverlapper.h:40
TrajectorySeed::const_iterator
recHitContainer::const_iterator const_iterator
Definition: TrajectorySeed.h:20
RPCSeedOverlapper::isCheckcandidateOverlap
bool isCheckcandidateOverlap
Definition: RPCSeedOverlapper.h:44
RPCSeedOverlapper::candidateweightedSeedsRef
std::vector< weightedTrajectorySeed > * candidateweightedSeedsRef
Definition: RPCSeedOverlapper.h:48
RPCGeometry::idToDetUnit
const GeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
Definition: RPCGeometry.cc:30
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
DetId
Definition: DetId.h:17
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
RPCSeedOverlapper::ShareRecHitsNumberThreshold
unsigned int ShareRecHitsNumberThreshold
Definition: RPCSeedOverlapper.h:45
edm::ESHandle< RPCGeometry >
N
#define N
Definition: blowfish.cc:9
Point3DBase< float, LocalTag >
RPCSeedOverlapper::eSetup
const edm::EventSetup * eSetup
Definition: RPCSeedOverlapper.h:49
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
GeomDet::toGlobal
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
RPCSeedOverlapper::isShareHit
bool isShareHit(const edm::OwnVector< TrackingRecHit > &RecHits, const TrackingRecHit &hit, edm::ESHandle< RPCGeometry > rpcGeometry)
Definition: RPCSeedOverlapper.cc:165
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
get
#define get
weightedTrajectorySeed
RPCSeedPattern::weightedTrajectorySeed weightedTrajectorySeed
Definition: RPCSeedGenerator.cc:65
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
RPCSeedOverlapper::isCheckgoodOverlap
bool isCheckgoodOverlap
Definition: RPCSeedOverlapper.h:43
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
edm::OwnVector::begin
iterator begin()
Definition: OwnVector.h:280
RPCSeedOverlapper::isConfigured
bool isConfigured
Definition: RPCSeedOverlapper.h:39
edm::OwnVector::size
size_type size() const
Definition: OwnVector.h:300
edm::OwnVector::clear
void clear()
Definition: OwnVector.h:481
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
hit
Definition: SiStripHitEffFromCalibTree.cc:88
edm::OwnVector< TrackingRecHit >
ecaldqm::Quality
Quality
Definition: DBWriterWorkers.cc:55