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 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 RPCGeometry &)
 
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 26 of file RPCCosmicSeedrecHitFinder.cc.

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

Definition at line 43 of file RPCCosmicSeedrecHitFinder.cc.

43 {}

Member Function Documentation

void RPCCosmicSeedrecHitFinder::checkandfill ( )
private

Definition at line 324 of file RPCCosmicSeedrecHitFinder.cc.

References gather_cfg::cout.

324  {
325  if (therecHits.size() >= 3) {
327  theSeed->seed();
328  } else
329  cout << "Layer less than 3, could not fill a RPCSeedFinder" << endl;
330 }
void setrecHits(ConstMuonRecHitContainer &recHits)
ConstMuonRecHitContainer therecHits
tuple cout
Definition: gather_cfg.py:144
bool RPCCosmicSeedrecHitFinder::complete ( const GlobalVector lastSegment,
const MuonRecHitPointer lastrecHitRef 
)
private

Definition at line 159 of file RPCCosmicSeedrecHitFinder.cc.

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

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

References edm::ParameterSet::getParameter().

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

Definition at line 107 of file RPCCosmicSeedrecHitFinder.cc.

References gather_cfg::cout.

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

Definition at line 287 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().

288  {
289  bool iscorss = false;
290 
291  // Check if 2 recHits corss the inner bounds
292  GlobalPoint lastPosition = lastrecHitRef->globalPosition();
293  GlobalPoint currentPosition = currentrecHitRef->globalPosition();
294  GlobalPoint testPosition((lastPosition.x() + currentPosition.x()) / 2,
295  (lastPosition.y() + currentPosition.y()) / 2,
296  (lastPosition.z() + currentPosition.z()) / 2);
297  /*
298  for(std::vector<BoundPlane>::const_iterator it = innerBounds.begin(); it != innerBounds.end(); it++) {
299  //SurfaceOrientation::Side TestSide0 = it->side(currentPosition, 0);
300  //SurfaceOrientation::Side TestSide1 = it->side(lastPosition, 0);
301  SurfaceOrientation::Side TestSide = it->side(testPosition, 0);
302  //cout << "Side of currentPosition: " << TestSide0 << ", Side of lastPosition: " << TestSide1 << ", Side of middlePosition: " << TestSide << endl;
303  //if(TestSide != SurfaceOrientation::positiveSide)
304  //iscorss = true;
305  }
306  */
307 
308  // Check when mixLayer is not set
309  if (isLayersmixed == false) {
310  DetId lastId = lastrecHitRef->geographicalId();
311  RPCDetId lastRPCId(lastId.rawId());
312  int lastRegion = lastRPCId.region();
313  DetId currentId = currentrecHitRef->geographicalId();
314  RPCDetId currentRPCId(currentId.rawId());
315  int currentRegion = currentRPCId.region();
316  // Check if 2 recHits from different regions
317  if (lastRegion != currentRegion)
318  iscorss = true;
319  }
320 
321  return iscorss;
322 }
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 275 of file RPCCosmicSeedrecHitFinder.cc.

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

277  {
278  bool isinsideAngle = true;
279  GlobalVector SegVec = currentPosition - lastPosition;
280  if (lastSegment.mag() != 0)
281  if (fabs((lastSegment.phi() - SegVec.phi()).value()) > MaxDeltaPhi)
282  isinsideAngle = false;
283 
284  return isinsideAngle;
285 }
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 265 of file RPCCosmicSeedrecHitFinder.cc.

References SplitLinear::begin, dataset::end, and spr::find().

265  {
266  bool isinsideLayers = false;
267  for (std::vector<unsigned int>::const_iterator it = LayersinRPC.begin(); it != LayersinRPC.end(); it++) {
268  MuonRecHitContainer::const_iterator index = find(AllrecHits[*it].begin(), AllrecHits[*it].end(), recHitRef);
269  if (index != AllrecHits[*it].end())
270  isinsideLayers = true;
271  }
272  return isinsideLayers;
273 }
MuonRecHitContainer AllrecHits[12]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
std::vector< unsigned int > LayersinRPC
string end
Definition: dataset.py:937
int RPCCosmicSeedrecHitFinder::LayerComponent ( )
private

Definition at line 141 of file RPCCosmicSeedrecHitFinder.cc.

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

141  {
142  bool isBarrel = false;
143  bool isEndcap = false;
144  for (std::vector<unsigned int>::const_iterator it = LayersinRPC.begin(); it != LayersinRPC.end(); it++) {
145  if ((*it) < BarrelLayerNumber)
146  isBarrel = true;
147  if ((*it) >= BarrelLayerNumber && (*it) < (BarrelLayerNumber + EachEndcapLayerNumber * 2))
148  isEndcap = true;
149  }
150  if (isBarrel == true && isEndcap == true)
151  return 3;
152  if (isEndcap == true)
153  return 2;
154  if (isBarrel == true)
155  return 1;
156  return 0;
157 }
std::vector< unsigned int > LayersinRPC
bool isEndcap(GeomDetEnumerators::SubDetector m)
#define EachEndcapLayerNumber
#define BarrelLayerNumber
void RPCCosmicSeedrecHitFinder::setEdge ( const RPCGeometry rpcGeometry)

Definition at line 65 of file RPCCosmicSeedrecHitFinder.cc.

References RPCGeometry::chamber(), RPCGeometry::detIds(), RPCDetId::region(), and GeomDet::surface().

65  {
66  // Find all chamber in RB1in and collect their surface
67  const std::vector<DetId>& AllRPCId = rpcGeometry.detIds();
68  for (std::vector<DetId>::const_iterator it = AllRPCId.begin(); it != AllRPCId.end(); it++) {
69  RPCDetId RPCId(it->rawId());
70  int Region = RPCId.region();
71  int Station = RPCId.station();
72  int Layer = RPCId.layer();
73  if (Region == 0 && Station == 1 && Layer == 1) {
74  const BoundPlane RPCChamberSurface = rpcGeometry.chamber(RPCId)->surface();
75  innerBounds.push_back(RPCChamberSurface);
76  }
77  }
78 
79  // Set the signal open
80  isEdgeset = true;
81 }
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
std::vector< BoundPlane > innerBounds
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
void RPCCosmicSeedrecHitFinder::setInput ( MuonRecHitContainer(&)  recHits[12])

Definition at line 55 of file RPCCosmicSeedrecHitFinder.cc.

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

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

Definition at line 101 of file RPCCosmicSeedrecHitFinder.cc.

101  {
102  LayersinRPC = Layers;
103  // Set the signal open
104  isLayerset = true;
105 }
std::vector< unsigned int > LayersinRPC
void RPCCosmicSeedrecHitFinder::setOutput ( RPCSeedFinder Seed)

Definition at line 95 of file RPCCosmicSeedrecHitFinder.cc.

95  {
96  theSeed = Seed;
97  // Set the signal open
98  isOutputset = true;
99 }
void RPCCosmicSeedrecHitFinder::unsetEdge ( )

Definition at line 83 of file RPCCosmicSeedrecHitFinder.cc.

83  {
84  // Clear all surfaces of chambers in RB1in
85  innerBounds.clear();
86  isEdgeset = false;
87 }
std::vector< BoundPlane > innerBounds
void RPCCosmicSeedrecHitFinder::unsetInput ( )

Definition at line 89 of file RPCCosmicSeedrecHitFinder.cc.

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

89  {
90  for (unsigned int i = 0; i < RPCLayerNumber; i++)
91  AllrecHits[i].clear();
92  isInputset = false;
93 }
activeDets clear()
MuonRecHitContainer AllrecHits[12]
#define RPCLayerNumber

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.