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 30 of file RPCCosmicSeedrecHitFinder.h.

Member Typedef Documentation

Definition at line 35 of file RPCCosmicSeedrecHitFinder.h.

Definition at line 33 of file RPCCosmicSeedrecHitFinder.h.

Definition at line 34 of file RPCCosmicSeedrecHitFinder.h.

Definition at line 32 of file RPCCosmicSeedrecHitFinder.h.

Constructor & Destructor Documentation

RPCCosmicSeedrecHitFinder::RPCCosmicSeedrecHitFinder ( )

Definition at line 26 of file RPCCosmicSeedrecHitFinder.cc.

26  {
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  {
45 
46 }

Member Function Documentation

void RPCCosmicSeedrecHitFinder::checkandfill ( )
private

Definition at line 337 of file RPCCosmicSeedrecHitFinder.cc.

References gather_cfg::cout.

337  {
338 
339  if(therecHits.size() >= 3) {
341  theSeed->seed();
342  }
343  else
344  cout << "Layer less than 3, could not fill a RPCSeedFinder" << endl;
345 }
void setrecHits(ConstMuonRecHitContainer &recHits)
ConstMuonRecHitContainer therecHits
bool RPCCosmicSeedrecHitFinder::complete ( const GlobalVector lastSegment,
const MuonRecHitPointer lastrecHitRef 
)
private

Definition at line 174 of file RPCCosmicSeedrecHitFinder.cc.

References funct::abs(), begin, RPCRecHit::BunchX(), TrackingRecHit::clone(), RPCRecHit::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().

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

Definition at line 48 of file RPCCosmicSeedrecHitFinder.cc.

References edm::ParameterSet::getParameter().

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

Definition at line 121 of file RPCCosmicSeedrecHitFinder.cc.

References gather_cfg::cout.

121  {
122 
123  if(isLayerset == false || isConfigured == false || isOutputset == false || isInputset == false || isEdgeset == false) {
124  cout << "Not set the IO or not configured yet" << endl;
125  return;
126  }
127 
128  therecHits.clear();
129 
130  if(LayersinRPC.empty()) {
131  cout << "Not set with any layers" << endl;
132  LayersinRPC.clear();
133  therecHits.clear();
134  isLayerset = false;
135  }
136 
137  // check the layers, 1=all barrel, 2=all endcap, 3=mix
138  unsigned int Component = LayerComponent();
139  if(Component == 3)
140  isLayersmixed = true;
141  else
142  isLayersmixed = false;
143 
144  GlobalVector initVector(0, 0, 0);
145  const MuonRecHitPointer recHitRef;
146  isOuterLayerfilled = false;
147  complete(initVector, recHitRef);
148 
149  // Unset the signal
150  LayersinRPC.clear();
151  therecHits.clear();
152  isLayerset = false;
153 }
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 301 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().

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

Definition at line 290 of file RPCCosmicSeedrecHitFinder.cc.

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

290  {
291 
292  bool isinsideAngle = true;
293  GlobalVector SegVec = currentPosition - lastPosition;
294  if(lastSegment.mag() != 0)
295  if(fabs((lastSegment.phi()-SegVec.phi()).value()) > MaxDeltaPhi)
296  isinsideAngle = false;
297 
298  return isinsideAngle;
299 }
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
T mag() const
Definition: PV3DBase.h:67
bool RPCCosmicSeedrecHitFinder::isouterLayer ( const MuonRecHitPointer recHitRef)
private

Definition at line 279 of file RPCCosmicSeedrecHitFinder.cc.

References begin, end, and find().

279  {
280 
281  bool isinsideLayers = false;
282  for(std::vector<unsigned int>::const_iterator it = LayersinRPC.begin(); it != LayersinRPC.end(); it++) {
283  MuonRecHitContainer::const_iterator index = find(AllrecHits[*it].begin(), AllrecHits[*it].end(), recHitRef);
284  if(index != AllrecHits[*it].end())
285  isinsideLayers = true;
286  }
287  return isinsideLayers;
288 }
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 155 of file RPCCosmicSeedrecHitFinder.cc.

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

155  {
156 
157  bool isBarrel = false;
158  bool isEndcap = false;
159  for(std::vector<unsigned int>::const_iterator it = LayersinRPC.begin(); it != LayersinRPC.end(); it++) {
160  if((*it) < BarrelLayerNumber)
161  isBarrel = true;
162  if((*it) >= BarrelLayerNumber && (*it) < (BarrelLayerNumber+EachEndcapLayerNumber*2))
163  isEndcap = true;
164  }
165  if(isBarrel == true && isEndcap == true)
166  return 3;
167  if(isEndcap == true)
168  return 2;
169  if(isBarrel == true)
170  return 1;
171  return 0;
172 }
std::vector< unsigned int > LayersinRPC
bool isEndcap(GeomDetEnumerators::SubDetector m)
#define EachEndcapLayerNumber
#define BarrelLayerNumber
void RPCCosmicSeedrecHitFinder::setEdge ( const edm::EventSetup iSetup)

Definition at line 70 of file RPCCosmicSeedrecHitFinder.cc.

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

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

Definition at line 59 of file RPCCosmicSeedrecHitFinder.cc.

References mps_fire::i, and RPCLayerNumber.

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

Definition at line 114 of file RPCCosmicSeedrecHitFinder.cc.

114  {
115 
116  LayersinRPC = Layers;
117  // Set the signal open
118  isLayerset = true;
119 }
std::vector< unsigned int > LayersinRPC
void RPCCosmicSeedrecHitFinder::setOutput ( RPCSeedFinder Seed)

Definition at line 107 of file RPCCosmicSeedrecHitFinder.cc.

107  {
108 
109  theSeed = Seed;
110  // Set the signal open
111  isOutputset = true;
112 }
void RPCCosmicSeedrecHitFinder::unsetEdge ( )

Definition at line 93 of file RPCCosmicSeedrecHitFinder.cc.

93  {
94 
95  // Clear all surfaces of chambers in RB1in
96  innerBounds.clear();
97  isEdgeset = false;
98 }
std::vector< BoundPlane > innerBounds
void RPCCosmicSeedrecHitFinder::unsetInput ( )

Definition at line 100 of file RPCCosmicSeedrecHitFinder.cc.

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

100  {
101 
102  for(unsigned int i = 0; i < RPCLayerNumber; i++)
103  AllrecHits[i].clear();
104  isInputset = false;
105 }
MuonRecHitContainer AllrecHits[12]
#define RPCLayerNumber
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167

Member Data Documentation

MuonRecHitContainer RPCCosmicSeedrecHitFinder::AllrecHits[12]
private

Definition at line 75 of file RPCCosmicSeedrecHitFinder.h.

unsigned int RPCCosmicSeedrecHitFinder::BxRange
private

Definition at line 59 of file RPCCosmicSeedrecHitFinder.h.

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

Definition at line 60 of file RPCCosmicSeedrecHitFinder.h.

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

Definition at line 73 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isConfigured
private

Definition at line 64 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isEdgeset
private

Definition at line 67 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isInputset
private

Definition at line 65 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isLayerset
private

Definition at line 63 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isLayersmixed
private

Definition at line 74 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isOuterLayerfilled
private

Definition at line 69 of file RPCCosmicSeedrecHitFinder.h.

bool RPCCosmicSeedrecHitFinder::isOutputset
private

Definition at line 66 of file RPCCosmicSeedrecHitFinder.h.

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

Definition at line 71 of file RPCCosmicSeedrecHitFinder.h.

double RPCCosmicSeedrecHitFinder::MaxDeltaPhi
private

Definition at line 61 of file RPCCosmicSeedrecHitFinder.h.

ConstMuonRecHitContainer RPCCosmicSeedrecHitFinder::therecHits
private

Definition at line 76 of file RPCCosmicSeedrecHitFinder.h.

RPCSeedFinder* RPCCosmicSeedrecHitFinder::theSeed
private

Definition at line 77 of file RPCCosmicSeedrecHitFinder.h.