17 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator
find(MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator firstIter, MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator lastIter,
const MuonTransientTrackingRecHit::MuonRecHitPointer& recHitRef) {
19 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator
index = lastIter;
20 for(MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator iter = firstIter; iter != lastIter; iter++)
21 if((*iter) == recHitRef)
38 isLayersmixed =
false;
41 isOuterLayerfilled =
false;
52 MaxDeltaPhi = iConfig.
getParameter<
double>(
"MaxDeltaPhi");
53 ClusterSet = iConfig.
getParameter< std::vector<int> >(
"ClusterSet");
62 AllrecHits[
i].clear();
63 AllrecHits[
i] = recHits[
i];
77 const std::vector<DetId> AllRPCId = rpcGeometry->
detIds();
78 for(std::vector<DetId>::const_iterator it = AllRPCId.begin(); it != AllRPCId.end(); it++) {
80 int Region = RPCId.region();
81 int Station = RPCId.station();
82 int Layer = RPCId.layer();
83 if(Region == 0 && Station == 1 && Layer == 1) {
85 innerBounds.push_back(RPCChamberSurface);
116 LayersinRPC = Layers;
123 if(isLayerset ==
false || isConfigured ==
false || isOutputset ==
false || isInputset ==
false || isEdgeset ==
false) {
124 cout <<
"Not set the IO or not configured yet" << endl;
130 if(LayersinRPC.size() == 0) {
131 cout <<
"Not set with any layers" << endl;
138 unsigned int Component = LayerComponent();
140 isLayersmixed =
true;
142 isLayersmixed =
false;
146 isOuterLayerfilled =
false;
147 complete(initVector, recHitRef);
159 for(std::vector<unsigned int>::const_iterator it = LayersinRPC.begin(); it != LayersinRPC.end(); it++) {
165 if(isBarrel ==
true && isEndcap ==
true)
176 bool isrecHitsfound =
false;
179 for(MuonRecHitContainer::const_iterator it = AllrecHits[
i].
begin(); it != AllrecHits[
i].end(); it++) {
181 cout <<
"Finding recHits from " <<
i <<
" th layer" << endl;
183 GlobalPoint currentPosition = (*it)->globalPosition();
187 if(!(*it)->isValid())
194 currentBX = thisRPCRecHit->
BunchX();
196 delete thisTrackingRecHit;
198 if((
unsigned int)
abs(currentBX) > BxRange)
202 bool Clustercheck =
false;
203 if(ClusterSet.size() == 0)
205 for(std::vector<int>::const_iterator CluIter = ClusterSet.begin(); CluIter != ClusterSet.end(); CluIter++)
206 if(ClusterSize == (*CluIter))
208 if(Clustercheck !=
true)
211 cout <<
"Candidate recHit's position: " << currentPosition.
x() <<
", " << currentPosition.
y() <<
", " << currentPosition.
z() <<
". BX : " << currentBX << endl;
213 if(isOuterLayerfilled ==
false) {
215 if(!isouterLayer(*it))
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);
226 therecHits.pop_back();
227 isOuterLayerfilled =
false;
230 GlobalPoint lastPosition = lastrecHitRef->globalPosition();
234 int lastBX = lastRPCRecHit->
BunchX();
235 delete lastTrackingRecHit;
238 if(currentPosition.
y() >= lastPosition.
y())
242 if(currentBX < lastBX)
246 bool isinsideRegion = isinsideAngleRange(lastSegment, lastPosition, currentPosition);
247 cout <<
"Check isinsideRegion: " << isinsideRegion << endl;
252 bool iscrossanyEdge = iscorssEdge(lastrecHitRef, *it);
253 cout <<
"Check iscrossanyEdge: " << iscrossanyEdge << endl;
258 unsigned int NumberinSeed = therecHits.size();
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);
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;
273 therecHits.pop_back();
276 return isrecHitsfound;
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;
287 return isinsideLayers;
292 bool isinsideAngle =
true;
294 if(lastSegment.
mag() != 0)
295 if(fabs((lastSegment.
phi()-SegVec.
phi()).
value()) > MaxDeltaPhi)
296 isinsideAngle =
false;
298 return isinsideAngle;
303 bool iscorss =
false;
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);
322 if(isLayersmixed ==
false) {
323 DetId lastId = lastrecHitRef->geographicalId();
325 int lastRegion = lastRPCId.
region();
326 DetId currentId = currentrecHitRef->geographicalId();
328 int currentRegion = currentRPCId.
region();
330 if(lastRegion != currentRegion)
339 if(therecHits.size() >= 3) {
340 theSeed->setrecHits(therecHits);
344 cout <<
"Layer less than 3, could not fill a RPCSeedFinder" << endl;
T getParameter(std::string const &) const
void setEdge(const edm::EventSetup &iSetup)
void setInput(MuonRecHitContainer(&recHits)[12])
bool iscorssEdge(const MuonRecHitPointer &lastrecHitRef, const MuonRecHitPointer ¤trecHitRef)
MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
Geom::Phi< T > phi() const
MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator find(MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator firstIter, MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator lastIter, const MuonTransientTrackingRecHit::MuonRecHitPointer &recHitRef)
virtual const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
const Plane & surface() const
The nominal surface of the GeomDet.
SeedingLayerSetsHits::SeedingLayer Layer
uint32_t rawId() const
get the raw id
const RPCChamber * chamber(RPCDetId id) const
std::shared_ptr< MuonTransientTrackingRecHit > MuonRecHitPointer
bool isinsideAngleRange(const GlobalVector &lastSegment, const GlobalPoint &lastPosition, const GlobalPoint ¤tPosition)
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
virtual TrackingRecHit * clone() const =0
Abs< T >::type abs(const T &t)
RPCCosmicSeedrecHitFinder()
bool isEndcap(GeomDetEnumerators::SubDetector m)
void setLayers(const std::vector< unsigned int > &Layers)
virtual TrackingRecHit const * hit() const
bool isouterLayer(const MuonRecHitPointer &recHitRef)
#define EachEndcapLayerNumber
void setOutput(RPCSeedFinder *Seed)
MuonTransientTrackingRecHit::MuonRecHitContainer MuonRecHitContainer
#define BarrelLayerNumber
~RPCCosmicSeedrecHitFinder()
bool complete(const GlobalVector &lastSegment, const MuonRecHitPointer &lastrecHitRef)
Global3DVector GlobalVector
void configure(const edm::ParameterSet &iConfig)
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.