CMS 3D CMS Logo

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

#include <RPCCosmicSeedrecHitFinder.h>

Public Member Functions

void configure (const edm::ParameterSet &iConfig)
 
void fillrecHits ()
 
 RPCCosmicSeedrecHitFinder ()
 
void setEdge (const edm::EventSetup &iSetup)
 
void setInput (MuonRecHitContainer(&recHits)[12])
 
void setLayers (const std::vector< unsigned int > &Layers)
 
void setOutput (RPCSeedFinder *Seed)
 
void unsetEdge ()
 
void unsetInput ()
 
 ~RPCCosmicSeedrecHitFinder ()
 

Private Types

typedef MuonTransientTrackingRecHit::ConstMuonRecHitContainer ConstMuonRecHitContainer
 
typedef MuonTransientTrackingRecHit::ConstMuonRecHitPointer ConstMuonRecHitPointer
 
typedef MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
 
typedef MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
 

Private Member Functions

void checkandfill ()
 
bool complete (const GlobalVector &lastSegment, const MuonRecHitPointer &lastrecHitRef)
 
bool iscorssEdge (const MuonRecHitPointer &lastrecHitRef, const MuonRecHitPointer &currentrecHitRef)
 
bool isinsideAngleRange (const GlobalVector &lastSegment, const GlobalPoint &lastPosition, const GlobalPoint &currentPosition)
 
bool isouterLayer (const MuonRecHitPointer &recHitRef)
 
int LayerComponent ()
 

Private Attributes

MuonRecHitContainer AllrecHits [12]
 
unsigned int BxRange
 
std::vector< int > ClusterSet
 
std::vector< BoundPlaneinnerBounds
 
bool isConfigured
 
bool isEdgeset
 
bool isInputset
 
bool isLayerset
 
bool isLayersmixed
 
bool isOuterLayerfilled
 
bool isOutputset
 
std::vector< unsigned int > LayersinRPC
 
double MaxDeltaPhi
 
ConstMuonRecHitContainer therecHits
 
RPCSeedFindertheSeed
 

Detailed Description

Definition at line 29 of file RPCCosmicSeedrecHitFinder.h.

Member Typedef Documentation

Definition at line 33 of file RPCCosmicSeedrecHitFinder.h.

Definition at line 31 of file RPCCosmicSeedrecHitFinder.h.

Definition at line 32 of file RPCCosmicSeedrecHitFinder.h.

Definition at line 30 of file RPCCosmicSeedrecHitFinder.h.

Constructor & Destructor Documentation

RPCCosmicSeedrecHitFinder::RPCCosmicSeedrecHitFinder ( )

Definition at line 27 of file RPCCosmicSeedrecHitFinder.cc.

27  {
28  // Initiate the member
29  isLayerset = false;
30  isConfigured = false;
31  isInputset = false;
32  isOutputset = false;
33  isEdgeset = false;
34  BxRange = 0;
35  MaxDeltaPhi = 0;
36  ClusterSet.clear();
37  innerBounds.clear();
38  isLayersmixed = false;
39  LayersinRPC.clear();
40  therecHits.clear();
41  isOuterLayerfilled = false;
42 }
std::vector< unsigned int > LayersinRPC
ConstMuonRecHitContainer therecHits
std::vector< BoundPlane > innerBounds
RPCCosmicSeedrecHitFinder::~RPCCosmicSeedrecHitFinder ( )

Definition at line 44 of file RPCCosmicSeedrecHitFinder.cc.

44 {}

Member Function Documentation

void RPCCosmicSeedrecHitFinder::checkandfill ( )
private

Definition at line 329 of file RPCCosmicSeedrecHitFinder.cc.

References gather_cfg::cout.

329  {
330  if (therecHits.size() >= 3) {
332  theSeed->seed();
333  } else
334  cout << "Layer less than 3, could not fill a RPCSeedFinder" << endl;
335 }
void setrecHits(ConstMuonRecHitContainer &recHits)
ConstMuonRecHitContainer therecHits
bool RPCCosmicSeedrecHitFinder::complete ( const GlobalVector lastSegment,
const MuonRecHitPointer lastrecHitRef 
)
private

Definition at line 164 of file RPCCosmicSeedrecHitFinder.cc.

References funct::abs(), begin, RPCRecHit::BunchX(), TrackingRecHit::clone(), RPCRecHit::clusterSize(), gather_cfg::cout, TrackingRecHit::hit(), mps_fire::i, RPCBxOrConfig_cff::lastBX, RPCLayerNumber, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

164  {
165  bool isrecHitsfound = false;
166 
167  for (unsigned int i = 0; i < RPCLayerNumber; i++)
168  for (MuonRecHitContainer::const_iterator it = AllrecHits[i].begin(); it != AllrecHits[i].end(); it++) {
169  cout << "Finding recHits from " << i << " th layer" << endl;
170  // information for recHits
171  GlobalPoint currentPosition = (*it)->globalPosition();
172  int currentBX;
173 
174  // Check validation
175  if (!(*it)->isValid())
176  continue;
177 
178  // Check BX range, be sure there is only RPCRecHit in the MuonRecHitContainer when use the dynamic_cast
179  TrackingRecHit* thisTrackingRecHit = (*it)->hit()->clone();
180  // Should also delete the RPCRecHit object cast by dynamic_cast<> ?
181  RPCRecHit* thisRPCRecHit = dynamic_cast<RPCRecHit*>(thisTrackingRecHit);
182  currentBX = thisRPCRecHit->BunchX();
183  int ClusterSize = thisRPCRecHit->clusterSize();
184  delete thisTrackingRecHit;
185  // Check BX
186  if ((unsigned int)abs(currentBX) > BxRange)
187  continue;
188 
189  // Check cluster size
190  bool Clustercheck = false;
191  if (ClusterSet.empty())
192  Clustercheck = true;
193  for (std::vector<int>::const_iterator CluIter = ClusterSet.begin(); CluIter != ClusterSet.end(); CluIter++)
194  if (ClusterSize == (*CluIter))
195  Clustercheck = true;
196  if (Clustercheck != true)
197  continue;
198 
199  cout << "Candidate recHit's position: " << currentPosition.x() << ", " << currentPosition.y() << ", "
200  << currentPosition.z() << ". BX : " << currentBX << endl;
201  // Fill 1st recHit from outer layers and rest recHits from all layers
202  if (isOuterLayerfilled == false) {
203  // Pick out the recHit from outer layers and fill it
204  if (!isouterLayer(*it))
205  continue;
206 
207  // If pass all, add to the seed
208  GlobalVector currentSegment = GlobalVector(0, 0, 0);
209  cout << "1st recHit's global position: " << currentPosition.x() << ", " << currentPosition.y() << ", "
210  << currentPosition.z() << ". BX: " << currentBX << endl;
211  isrecHitsfound = true;
212  therecHits.push_back(*it);
213  isOuterLayerfilled = true;
214  complete(currentSegment, *it);
215  // Remember to pop the recHit before add another one from the same layer!
216  therecHits.pop_back();
217  isOuterLayerfilled = false;
218  } else {
219  GlobalPoint lastPosition = lastrecHitRef->globalPosition();
220  TrackingRecHit* lastTrackingRecHit = lastrecHitRef->hit()->clone();
221  // Should also delete the RPCRecHit object cast by dynamic_cast<> ?
222  RPCRecHit* lastRPCRecHit = dynamic_cast<RPCRecHit*>(lastTrackingRecHit);
223  int lastBX = lastRPCRecHit->BunchX();
224  delete lastTrackingRecHit;
225 
226  // Check the Y coordinate, shoule be lower than current one
227  if (currentPosition.y() >= lastPosition.y())
228  continue;
229 
230  // Check the BX, should be larger than current one
231  if (currentBX < lastBX)
232  continue;
233 
234  // If be the 2nd recHit, just fill it
235  bool isinsideRegion = isinsideAngleRange(lastSegment, lastPosition, currentPosition);
236  cout << "Check isinsideRegion: " << isinsideRegion << endl;
237  if (!isinsideRegion)
238  continue;
239 
240  // If cross the edge the recHit should belong to another seed
241  bool iscrossanyEdge = iscorssEdge(lastrecHitRef, *it);
242  cout << "Check iscrossanyEdge: " << iscrossanyEdge << endl;
243  if (iscrossanyEdge)
244  continue;
245 
246  // If pass all, add to the seed
247  unsigned int NumberinSeed = therecHits.size();
248  GlobalVector currentSegment = (GlobalVector)(currentPosition - lastPosition);
249  cout << (NumberinSeed + 1) << "th recHit's global position: " << currentPosition.x() << ", "
250  << currentPosition.y() << ", " << currentPosition.z() << ". BX: " << currentBX << endl;
251  isrecHitsfound = true;
252  therecHits.push_back(*it);
253 
254  // if could not find next recHit in the search path, and have enough recHits already, that is the candidate
255  bool findNext = complete(currentSegment, *it);
256  if (findNext == false && therecHits.size() > 3) {
257  for (ConstMuonRecHitContainer::const_iterator iter = therecHits.begin(); iter != therecHits.end(); iter++)
258  cout << "Find recHit in seed candidate : " << (*iter)->globalPosition().x() << ", "
259  << (*iter)->globalPosition().y() << ", " << (*iter)->globalPosition().z() << endl;
260  checkandfill();
261  }
262 
263  // Remember to pop the recHit before add another one from the same layer!
264  therecHits.pop_back();
265  }
266  }
267  return isrecHitsfound;
268 }
bool iscorssEdge(const MuonRecHitPointer &lastrecHitRef, const MuonRecHitPointer &currentrecHitRef)
MuonRecHitContainer AllrecHits[12]
T y() const
Definition: PV3DBase.h:60
#define RPCLayerNumber
int clusterSize() const
Definition: RPCRecHit.h:77
bool isinsideAngleRange(const GlobalVector &lastSegment, const GlobalPoint &lastPosition, const GlobalPoint &currentPosition)
T z() const
Definition: PV3DBase.h:61
virtual TrackingRecHit * clone() const =0
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual TrackingRecHit const * hit() const
bool isouterLayer(const MuonRecHitPointer &recHitRef)
#define begin
Definition: vmac.h:32
ConstMuonRecHitContainer therecHits
int BunchX() const
Definition: RPCRecHit.h:73
T x() const
Definition: PV3DBase.h:59
bool complete(const GlobalVector &lastSegment, const MuonRecHitPointer &lastrecHitRef)
Global3DVector GlobalVector
Definition: GlobalVector.h:10
void RPCCosmicSeedrecHitFinder::configure ( const edm::ParameterSet iConfig)

Definition at line 46 of file RPCCosmicSeedrecHitFinder.cc.

References edm::ParameterSet::getParameter().

46  {
47  // Set the configuration
48  BxRange = iConfig.getParameter<unsigned int>("BxRange");
49  MaxDeltaPhi = iConfig.getParameter<double>("MaxDeltaPhi");
50  ClusterSet = iConfig.getParameter<std::vector<int> >("ClusterSet");
51 
52  // Set the signal open
53  isConfigured = true;
54 }
T getParameter(std::string const &) const
void RPCCosmicSeedrecHitFinder::fillrecHits ( )

Definition at line 112 of file RPCCosmicSeedrecHitFinder.cc.

References gather_cfg::cout.

112  {
113  if (isLayerset == false || isConfigured == false || isOutputset == false || isInputset == false ||
114  isEdgeset == false) {
115  cout << "Not set the IO or not configured yet" << endl;
116  return;
117  }
118 
119  therecHits.clear();
120 
121  if (LayersinRPC.empty()) {
122  cout << "Not set with any layers" << endl;
123  LayersinRPC.clear();
124  therecHits.clear();
125  isLayerset = false;
126  }
127 
128  // check the layers, 1=all barrel, 2=all endcap, 3=mix
129  unsigned int Component = LayerComponent();
130  if (Component == 3)
131  isLayersmixed = true;
132  else
133  isLayersmixed = false;
134 
135  GlobalVector initVector(0, 0, 0);
136  const MuonRecHitPointer recHitRef;
137  isOuterLayerfilled = false;
138  complete(initVector, recHitRef);
139 
140  // Unset the signal
141  LayersinRPC.clear();
142  therecHits.clear();
143  isLayerset = false;
144 }
MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
std::vector< unsigned int > LayersinRPC
ConstMuonRecHitContainer therecHits
bool complete(const GlobalVector &lastSegment, const MuonRecHitPointer &lastrecHitRef)
bool RPCCosmicSeedrecHitFinder::iscorssEdge ( const MuonRecHitPointer lastrecHitRef,
const MuonRecHitPointer currentrecHitRef 
)
private

Definition at line 292 of file RPCCosmicSeedrecHitFinder.cc.

References DetId::rawId(), RPCDetId::region(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

293  {
294  bool iscorss = false;
295 
296  // Check if 2 recHits corss the inner bounds
297  GlobalPoint lastPosition = lastrecHitRef->globalPosition();
298  GlobalPoint currentPosition = currentrecHitRef->globalPosition();
299  GlobalPoint testPosition((lastPosition.x() + currentPosition.x()) / 2,
300  (lastPosition.y() + currentPosition.y()) / 2,
301  (lastPosition.z() + currentPosition.z()) / 2);
302  /*
303  for(std::vector<BoundPlane>::const_iterator it = innerBounds.begin(); it != innerBounds.end(); it++) {
304  //SurfaceOrientation::Side TestSide0 = it->side(currentPosition, 0);
305  //SurfaceOrientation::Side TestSide1 = it->side(lastPosition, 0);
306  SurfaceOrientation::Side TestSide = it->side(testPosition, 0);
307  //cout << "Side of currentPosition: " << TestSide0 << ", Side of lastPosition: " << TestSide1 << ", Side of middlePosition: " << TestSide << endl;
308  //if(TestSide != SurfaceOrientation::positiveSide)
309  //iscorss = true;
310  }
311  */
312 
313  // Check when mixLayer is not set
314  if (isLayersmixed == false) {
315  DetId lastId = lastrecHitRef->geographicalId();
316  RPCDetId lastRPCId(lastId.rawId());
317  int lastRegion = lastRPCId.region();
318  DetId currentId = currentrecHitRef->geographicalId();
319  RPCDetId currentRPCId(currentId.rawId());
320  int currentRegion = currentRPCId.region();
321  // Check if 2 recHits from different regions
322  if (lastRegion != currentRegion)
323  iscorss = true;
324  }
325 
326  return iscorss;
327 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
T y() const
Definition: PV3DBase.h:60
T z() const
Definition: PV3DBase.h:61
Definition: DetId.h:17
T x() const
Definition: PV3DBase.h:59
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
bool RPCCosmicSeedrecHitFinder::isinsideAngleRange ( const GlobalVector lastSegment,
const GlobalPoint lastPosition,
const GlobalPoint currentPosition 
)
private

Definition at line 280 of file RPCCosmicSeedrecHitFinder.cc.

References PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::phi(), and relativeConstraints::value.

282  {
283  bool isinsideAngle = true;
284  GlobalVector SegVec = currentPosition - lastPosition;
285  if (lastSegment.mag() != 0)
286  if (fabs((lastSegment.phi() - SegVec.phi()).value()) > MaxDeltaPhi)
287  isinsideAngle = false;
288 
289  return isinsideAngle;
290 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
T mag() const
Definition: PV3DBase.h:64
bool RPCCosmicSeedrecHitFinder::isouterLayer ( const MuonRecHitPointer recHitRef)
private

Definition at line 270 of file RPCCosmicSeedrecHitFinder.cc.

References begin, end, and find().

270  {
271  bool isinsideLayers = false;
272  for (std::vector<unsigned int>::const_iterator it = LayersinRPC.begin(); it != LayersinRPC.end(); it++) {
273  MuonRecHitContainer::const_iterator index = find(AllrecHits[*it].begin(), AllrecHits[*it].end(), recHitRef);
274  if (index != AllrecHits[*it].end())
275  isinsideLayers = true;
276  }
277  return isinsideLayers;
278 }
MuonRecHitContainer AllrecHits[12]
MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator find(MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator firstIter, MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator lastIter, const MuonTransientTrackingRecHit::MuonRecHitPointer &recHitRef)
std::vector< unsigned int > LayersinRPC
#define end
Definition: vmac.h:39
#define begin
Definition: vmac.h:32
int RPCCosmicSeedrecHitFinder::LayerComponent ( )
private

Definition at line 146 of file RPCCosmicSeedrecHitFinder.cc.

References BarrelLayerNumber, EachEndcapLayerNumber, PixelPluginsPhase0_cfi::isBarrel, and GeomDetEnumerators::isEndcap().

146  {
147  bool isBarrel = false;
148  bool isEndcap = false;
149  for (std::vector<unsigned int>::const_iterator it = LayersinRPC.begin(); it != LayersinRPC.end(); it++) {
150  if ((*it) < BarrelLayerNumber)
151  isBarrel = true;
152  if ((*it) >= BarrelLayerNumber && (*it) < (BarrelLayerNumber + EachEndcapLayerNumber * 2))
153  isEndcap = true;
154  }
155  if (isBarrel == true && isEndcap == true)
156  return 3;
157  if (isEndcap == true)
158  return 2;
159  if (isBarrel == true)
160  return 1;
161  return 0;
162 }
std::vector< unsigned int > LayersinRPC
bool isEndcap(GeomDetEnumerators::SubDetector m)
#define EachEndcapLayerNumber
#define BarrelLayerNumber
void RPCCosmicSeedrecHitFinder::setEdge ( const edm::EventSetup iSetup)

Definition at line 66 of file RPCCosmicSeedrecHitFinder.cc.

References RPCGeometry::chamber(), RPCGeometry::detIds(), edm::EventSetup::get(), g4SimHits_cfi::Region, and GeomDet::surface().

66  {
67  // Get RPCGeometry
68  edm::ESHandle<RPCGeometry> rpcGeometry;
69  iSetup.get<MuonGeometryRecord>().get(rpcGeometry);
70 
71  // Find all chamber in RB1in and collect their surface
72  const std::vector<DetId> AllRPCId = rpcGeometry->detIds();
73  for (std::vector<DetId>::const_iterator it = AllRPCId.begin(); it != AllRPCId.end(); it++) {
74  RPCDetId RPCId(it->rawId());
75  int Region = RPCId.region();
76  int Station = RPCId.station();
77  int Layer = RPCId.layer();
78  if (Region == 0 && Station == 1 && Layer == 1) {
79  const BoundPlane RPCChamberSurface = rpcGeometry->chamber(RPCId)->surface();
80  innerBounds.push_back(RPCChamberSurface);
81  }
82  }
83 
84  // Set the signal open
85  isEdgeset = true;
86 }
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Definition: RPCGeometry.cc:28
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
SeedingLayerSetsHits::SeedingLayer Layer
Definition: LayerTriplets.h:14
const RPCChamber * chamber(RPCDetId id) const
Definition: RPCGeometry.cc:46
T get() const
Definition: EventSetup.h:73
std::vector< BoundPlane > innerBounds
void RPCCosmicSeedrecHitFinder::setInput ( MuonRecHitContainer(&)  recHits[12])

Definition at line 56 of file RPCCosmicSeedrecHitFinder.cc.

References mps_fire::i, FastTrackerRecHitMaskProducer_cfi::recHits, and RPCLayerNumber.

56  {
57  for (unsigned int i = 0; i < RPCLayerNumber; i++) {
58  AllrecHits[i].clear();
59  AllrecHits[i] = recHits[i];
60  }
61 
62  // Set the signal open
63  isInputset = true;
64 }
MuonRecHitContainer AllrecHits[12]
#define RPCLayerNumber
void RPCCosmicSeedrecHitFinder::setLayers ( const std::vector< unsigned int > &  Layers)

Definition at line 106 of file RPCCosmicSeedrecHitFinder.cc.

106  {
107  LayersinRPC = Layers;
108  // Set the signal open
109  isLayerset = true;
110 }
std::vector< unsigned int > LayersinRPC
void RPCCosmicSeedrecHitFinder::setOutput ( RPCSeedFinder Seed)

Definition at line 100 of file RPCCosmicSeedrecHitFinder.cc.

100  {
101  theSeed = Seed;
102  // Set the signal open
103  isOutputset = true;
104 }
void RPCCosmicSeedrecHitFinder::unsetEdge ( )

Definition at line 88 of file RPCCosmicSeedrecHitFinder.cc.

88  {
89  // Clear all surfaces of chambers in RB1in
90  innerBounds.clear();
91  isEdgeset = false;
92 }
std::vector< BoundPlane > innerBounds
void RPCCosmicSeedrecHitFinder::unsetInput ( )

Definition at line 94 of file RPCCosmicSeedrecHitFinder.cc.

References hitfit::clear(), mps_fire::i, and RPCLayerNumber.

94  {
95  for (unsigned int i = 0; i < RPCLayerNumber; i++)
96  AllrecHits[i].clear();
97  isInputset = false;
98 }
MuonRecHitContainer AllrecHits[12]
#define RPCLayerNumber
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:151

Member Data Documentation

MuonRecHitContainer RPCCosmicSeedrecHitFinder::AllrecHits[12]
private

Definition at line 76 of file RPCCosmicSeedrecHitFinder.h.

unsigned int RPCCosmicSeedrecHitFinder::BxRange
private

Definition at line 60 of file RPCCosmicSeedrecHitFinder.h.

std::vector<int> RPCCosmicSeedrecHitFinder::ClusterSet
private

Definition at line 61 of file RPCCosmicSeedrecHitFinder.h.

std::vector<BoundPlane> RPCCosmicSeedrecHitFinder::innerBounds
private

Definition at line 74 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isConfigured
private

Definition at line 65 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isEdgeset
private

Definition at line 68 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isInputset
private

Definition at line 66 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isLayerset
private

Definition at line 64 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isLayersmixed
private

Definition at line 75 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isOuterLayerfilled
private

Definition at line 70 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isOutputset
private

Definition at line 67 of file RPCCosmicSeedrecHitFinder.h.

std::vector<unsigned int> RPCCosmicSeedrecHitFinder::LayersinRPC
private

Definition at line 72 of file RPCCosmicSeedrecHitFinder.h.

double RPCCosmicSeedrecHitFinder::MaxDeltaPhi
private

Definition at line 62 of file RPCCosmicSeedrecHitFinder.h.

ConstMuonRecHitContainer RPCCosmicSeedrecHitFinder::therecHits
private

Definition at line 77 of file RPCCosmicSeedrecHitFinder.h.

RPCSeedFinder* RPCCosmicSeedrecHitFinder::theSeed
private

Definition at line 78 of file RPCCosmicSeedrecHitFinder.h.