10 std::vector<susybsm::RPCHit4D> HSCPRPCRecHits = uHSCPRPCRecHits;
12 bool outOfTime =
false;
13 bool increasing =
true;
14 bool anydifferentzero =
true;
15 bool anydifferentone =
true;
19 std::sort(HSCPRPCRecHits.begin(), HSCPRPCRecHits.end());
21 for (std::vector<susybsm::RPCHit4D>::iterator
point = HSCPRPCRecHits.begin();
point < HSCPRPCRecHits.end(); ++
point) {
22 outOfTime |= (
point->bx != 0);
23 increasing &= (
point->bx >= lastbx);
24 anydifferentzero &= (!(
point->bx == 0));
25 anydifferentone &= (!(
point->bx == 1));
31 bool Candidate = (outOfTime && increasing);
41 float maginfirstknee = 0;
42 for (std::vector<susybsm::RPCHit4D>::iterator
point = HSCPRPCRecHits.begin();
point < HSCPRPCRecHits.end(); ++
point) {
44 maginfirstknee =
point->gp.mag();
45 }
else if ((lastbx !=
point->bx)) {
47 maginknee =
point->gp.mag();
55 betavalue = maginfirstknee / (25. -
delay + maginfirstknee / 30.) / 30.;
56 }
else if (knees == 1) {
61 if (!anydifferentzero) {
62 betavalue = maginknee / (25 -
delay + maginknee / 30.) / 30.;
63 }
else if (!anydifferentone) {
64 betavalue = maginknee / (50 -
delay + maginknee / 30.) / 30.;
66 betavalue1 = maginknee / (25 -
delay + maginknee / 30.) / 30.;
67 float dr = (maginknee - maginfirstknee);
68 betavalue2 =
dr / (25. -
delay +
dr / 30.);
70 betavalue = (betavalue1 + betavalue2) * 0.5;
72 }
else if (knees == 2) {
79 for (std::vector<susybsm::RPCHit4D>::iterator
point = HSCPRPCRecHits.begin();
point < HSCPRPCRecHits.end();
82 maginfirstknee =
point->gp.mag();
83 }
else if ((lastbx !=
point->bx)) {
87 float maginsecondknee =
point->gp.mag();
88 betavalue1 = maginknee / (25 -
delay + maginknee / 30.) / 30.;
89 float dr = (maginknee - maginsecondknee);
90 betavalue2 =
dr / (25. +
dr / 30.);
96 betavalue = (betavalue1 + betavalue2) * 0.5;
106 if (HSCPRPCRecHits.empty()) {
119 iEvent.getByToken(rpcRecHitsToken, rpcHits);
123 std::vector<RPCHit4D>
hits;
129 start = candidate.
muonRef()->combinedMuon()->recHitsBegin();
130 stop = candidate.
muonRef()->combinedMuon()->recHitsEnd();
133 start = candidate.
muonRef()->standAloneMuon()->recHitsBegin();
134 stop = candidate.
muonRef()->standAloneMuon()->recHitsEnd();
150 if ((*recHit)->geographicalId().det() !=
DetId::Muon)
152 if (!(*recHit)->isValid())
157 typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
158 rangeRecHits recHitCollection = rpcHits->get(rollId);
163 for (recHitC = recHitCollection.first; recHitC != recHitCollection.second; recHitC++) {
164 clusterS = (*recHitC).clusterSize();
174 LocalPoint recHitPos = (*recHit)->localPosition();
175 const RPCRoll* rollasociated = rpcGeo->
roll(rollId);
180 ThisHit.
gp = RPCSurface.toGlobal(recHitPos);
181 ThisHit.
id = (
RPCDetId)(*recHit)->geographicalId().rawId();
182 hits.push_back(ThisHit);
185 std::sort(
hits.begin(),
hits.end());
187 bool increasing =
true;
188 bool outOfTime =
false;
190 outOfTime |= (
point->bx != 0);
191 increasing &= (
point->bx >= lastbx);
194 result.isCandidate = (outOfTime && increasing);