16 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator
find(
17 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator firstIter,
18 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator lastIter,
20 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator
index = lastIter;
21 for (MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator iter = firstIter; iter != lastIter; iter++)
22 if ((*iter) == recHitRef)
38 isLayersmixed =
false;
41 isOuterLayerfilled =
false;
49 MaxDeltaPhi = iConfig.
getParameter<
double>(
"MaxDeltaPhi");
50 ClusterSet = iConfig.
getParameter<std::vector<int> >(
"ClusterSet");
58 AllrecHits[
i].clear();
72 const std::vector<DetId> AllRPCId = rpcGeometry->
detIds();
73 for (std::vector<DetId>::const_iterator it = AllRPCId.begin(); it != AllRPCId.end(); it++) {
75 int Region = RPCId.region();
76 int Station = RPCId.station();
77 int Layer = RPCId.layer();
80 innerBounds.push_back(RPCChamberSurface);
107 LayersinRPC = Layers;
113 if (isLayerset ==
false || isConfigured ==
false || isOutputset ==
false || isInputset ==
false ||
114 isEdgeset ==
false) {
115 cout <<
"Not set the IO or not configured yet" << endl;
121 if (LayersinRPC.empty()) {
122 cout <<
"Not set with any layers" << endl;
129 unsigned int Component = LayerComponent();
131 isLayersmixed =
true;
133 isLayersmixed =
false;
137 isOuterLayerfilled =
false;
138 complete(initVector, recHitRef);
149 for (std::vector<unsigned int>::const_iterator it = LayersinRPC.begin(); it != LayersinRPC.end(); it++) {
165 bool isrecHitsfound =
false;
168 for (MuonRecHitContainer::const_iterator it = AllrecHits[
i].
begin(); it != AllrecHits[
i].end(); it++) {
169 cout <<
"Finding recHits from " <<
i <<
" th layer" << endl;
171 GlobalPoint currentPosition = (*it)->globalPosition();
175 if (!(*it)->isValid())
181 RPCRecHit* thisRPCRecHit = dynamic_cast<RPCRecHit*>(thisTrackingRecHit);
182 currentBX = thisRPCRecHit->
BunchX();
184 delete thisTrackingRecHit;
186 if ((
unsigned int)
abs(currentBX) > BxRange)
190 bool Clustercheck =
false;
191 if (ClusterSet.empty())
193 for (std::vector<int>::const_iterator CluIter = ClusterSet.begin(); CluIter != ClusterSet.end(); CluIter++)
196 if (Clustercheck !=
true)
199 cout <<
"Candidate recHit's position: " << currentPosition.
x() <<
", " << currentPosition.
y() <<
", "
200 << currentPosition.
z() <<
". BX : " << currentBX << endl;
202 if (isOuterLayerfilled ==
false) {
204 if (!isouterLayer(*it))
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);
216 therecHits.pop_back();
217 isOuterLayerfilled =
false;
219 GlobalPoint lastPosition = lastrecHitRef->globalPosition();
222 RPCRecHit* lastRPCRecHit = dynamic_cast<RPCRecHit*>(lastTrackingRecHit);
224 delete lastTrackingRecHit;
227 if (currentPosition.
y() >= lastPosition.
y())
235 bool isinsideRegion = isinsideAngleRange(lastSegment, lastPosition, currentPosition);
236 cout <<
"Check isinsideRegion: " << isinsideRegion << endl;
241 bool iscrossanyEdge = iscorssEdge(lastrecHitRef, *it);
242 cout <<
"Check iscrossanyEdge: " << iscrossanyEdge << endl;
247 unsigned int NumberinSeed = therecHits.size();
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);
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;
264 therecHits.pop_back();
267 return isrecHitsfound;
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);
275 isinsideLayers =
true;
277 return isinsideLayers;
283 bool isinsideAngle =
true;
285 if (lastSegment.
mag() != 0)
286 if (fabs((lastSegment.
phi() - SegVec.
phi()).
value()) > MaxDeltaPhi)
287 isinsideAngle =
false;
289 return isinsideAngle;
294 bool iscorss =
false;
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);
314 if (isLayersmixed ==
false) {
315 DetId lastId = lastrecHitRef->geographicalId();
317 int lastRegion = lastRPCId.
region();
318 DetId currentId = currentrecHitRef->geographicalId();
320 int currentRegion = currentRPCId.
region();
322 if (lastRegion != currentRegion)
330 if (therecHits.size() >= 3) {
331 theSeed->setrecHits(therecHits);
334 cout <<
"Layer less than 3, could not fill a RPCSeedFinder" << endl;