15 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator
find(
16 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator firstIter,
17 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator lastIter,
19 MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator
index = lastIter;
20 for (MuonTransientTrackingRecHit::MuonRecHitContainer::const_iterator iter = firstIter; iter != lastIter; iter++)
21 if ((*iter) == recHitRef)
37 isLayersmixed =
false;
40 isOuterLayerfilled =
false;
48 MaxDeltaPhi = iConfig.
getParameter<
double>(
"MaxDeltaPhi");
49 ClusterSet = iConfig.
getParameter<std::vector<int> >(
"ClusterSet");
57 AllrecHits[
i].clear();
67 const std::vector<DetId>& AllRPCId = rpcGeometry.
detIds();
68 for (std::vector<DetId>::const_iterator it = AllRPCId.begin(); it != AllRPCId.end(); it++) {
70 int Region = RPCId.
region();
71 int Station = RPCId.station();
72 int Layer = RPCId.layer();
73 if (Region == 0 && Station == 1 && Layer == 1) {
75 innerBounds.push_back(RPCChamberSurface);
102 LayersinRPC = Layers;
108 if (isLayerset ==
false || isConfigured ==
false || isOutputset ==
false || isInputset ==
false ||
109 isEdgeset ==
false) {
110 cout <<
"Not set the IO or not configured yet" << endl;
116 if (LayersinRPC.empty()) {
117 cout <<
"Not set with any layers" << endl;
124 unsigned int Component = LayerComponent();
126 isLayersmixed =
true;
128 isLayersmixed =
false;
132 isOuterLayerfilled =
false;
133 complete(initVector, recHitRef);
144 for (std::vector<unsigned int>::const_iterator it = LayersinRPC.begin(); it != LayersinRPC.end(); it++) {
150 if (isBarrel ==
true && isEndcap ==
true)
152 if (isEndcap ==
true)
154 if (isBarrel ==
true)
160 bool isrecHitsfound =
false;
163 for (MuonRecHitContainer::const_iterator it = AllrecHits[
i].
begin(); it != AllrecHits[
i].end(); it++) {
164 cout <<
"Finding recHits from " <<
i <<
" th layer" << endl;
166 GlobalPoint currentPosition = (*it)->globalPosition();
170 if (!(*it)->isValid())
177 currentBX = thisRPCRecHit->
BunchX();
179 delete thisTrackingRecHit;
181 if ((
unsigned int)
abs(currentBX) > BxRange)
185 bool Clustercheck =
false;
186 if (ClusterSet.empty())
188 for (std::vector<int>::const_iterator CluIter = ClusterSet.begin(); CluIter != ClusterSet.end(); CluIter++)
189 if (ClusterSize == (*CluIter))
191 if (Clustercheck !=
true)
194 cout <<
"Candidate recHit's position: " << currentPosition.
x() <<
", " << currentPosition.
y() <<
", "
195 << currentPosition.
z() <<
". BX : " << currentBX << endl;
197 if (isOuterLayerfilled ==
false) {
199 if (!isouterLayer(*it))
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);
211 therecHits.pop_back();
212 isOuterLayerfilled =
false;
214 GlobalPoint lastPosition = lastrecHitRef->globalPosition();
218 int lastBX = lastRPCRecHit->
BunchX();
219 delete lastTrackingRecHit;
222 if (currentPosition.
y() >= lastPosition.
y())
226 if (currentBX < lastBX)
230 bool isinsideRegion = isinsideAngleRange(lastSegment, lastPosition, currentPosition);
231 cout <<
"Check isinsideRegion: " << isinsideRegion << endl;
236 bool iscrossanyEdge = iscorssEdge(lastrecHitRef, *it);
237 cout <<
"Check iscrossanyEdge: " << iscrossanyEdge << endl;
242 unsigned int NumberinSeed = therecHits.size();
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);
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;
259 therecHits.pop_back();
262 return isrecHitsfound;
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;
272 return isinsideLayers;
278 bool isinsideAngle =
true;
280 if (lastSegment.
mag() != 0)
281 if (fabs((lastSegment.
phi() - SegVec.
phi()).
value()) > MaxDeltaPhi)
282 isinsideAngle =
false;
284 return isinsideAngle;
289 bool iscorss =
false;
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);
309 if (isLayersmixed ==
false) {
310 DetId lastId = lastrecHitRef->geographicalId();
312 int lastRegion = lastRPCId.
region();
313 DetId currentId = currentrecHitRef->geographicalId();
315 int currentRegion = currentRPCId.
region();
317 if (lastRegion != currentRegion)
325 if (therecHits.size() >= 3) {
326 theSeed->setrecHits(therecHits);
329 cout <<
"Layer less than 3, could not fill a RPCSeedFinder" << endl;
void setEdge(const RPCGeometry &)
void setInput(MuonRecHitContainer(&recHits)[12])
bool iscorssEdge(const MuonRecHitPointer &lastrecHitRef, const MuonRecHitPointer ¤trecHitRef)
MuonTransientTrackingRecHit::MuonRecHitPointer MuonRecHitPointer
Geom::Phi< T > phi() const
constexpr uint32_t rawId() const
get the raw id
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const Plane & surface() const
The nominal surface of the GeomDet.
SeedingLayerSetsHits::SeedingLayer Layer
const RPCChamber * chamber(RPCDetId id) const
std::shared_ptr< MuonTransientTrackingRecHit > MuonRecHitPointer
bool isinsideAngleRange(const GlobalVector &lastSegment, const GlobalPoint &lastPosition, const GlobalPoint ¤tPosition)
Abs< T >::type abs(const T &t)
RPCCosmicSeedrecHitFinder()
bool isEndcap(GeomDetEnumerators::SubDetector m)
virtual TrackingRecHit * clone() const =0
void setLayers(const std::vector< unsigned int > &Layers)
virtual TrackingRecHit const * hit() const
T getParameter(std::string const &) 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.