11 matchesValid_ =
false;
12 isolationValid_ =
false;
13 pfIsolationValid_ =
false;
14 qualityValid_ =
false;
15 caloCompatibility_ = -9999.;
24 matchesValid_ =
false;
25 isolationValid_ =
false;
26 pfIsolationValid_ =
false;
27 qualityValid_ =
false;
28 caloCompatibility_ = -9999.;
44 int Muon::numberOfChambersCSCorDT()
const {
46 int nAll = numberOfChambers();
47 for (
int iC = 0; iC < nAll; ++iC) {
55 int Muon::numberOfMatches(ArbitrationType
type)
const {
57 for (std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
58 chamberMatch != muMatches_.end();
60 if (
type == RPCHitAndTrackArbitration) {
61 if (chamberMatch->rpcMatches.empty())
63 matches += chamberMatch->rpcMatches.size();
66 if (
type == ME0SegmentAndTrackArbitration) {
67 if (chamberMatch->me0Matches.empty())
69 matches += chamberMatch->me0Matches.size();
72 if (
type == GEMSegmentAndTrackArbitration) {
73 if (chamberMatch->gemMatches.empty())
75 matches += chamberMatch->gemMatches.size();
79 if (chamberMatch->segmentMatches.empty())
81 if (
type == NoArbitration) {
86 for (std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
87 segmentMatch != chamberMatch->segmentMatches.end();
89 if (
type == SegmentArbitration)
90 if (segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR)) {
94 if (
type == SegmentAndTrackArbitration)
95 if (segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR) &&
96 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
100 if (
type == SegmentAndTrackArbitrationCleaned)
101 if (segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR) &&
102 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
103 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
113 int Muon::numberOfMatchedStations(ArbitrationType
type)
const {
116 unsigned int theStationMask = stationMask(
type);
118 for (
int it = 0; it < 8; ++it)
119 if (theStationMask & 1 << it)
125 unsigned int Muon::expectedNnumberOfMatchedStations(
float minDistanceFromEdge)
const {
126 unsigned int stationMask = 0;
127 for (
auto& chamberMatch : muMatches_) {
130 float edgeX = chamberMatch.edgeX;
131 float edgeY = chamberMatch.edgeY;
133 if (edgeX < 0 && fabs(edgeX) > fabs(minDistanceFromEdge) && edgeY < 0 && fabs(edgeY) > fabs(minDistanceFromEdge))
134 stationMask |= 1 << ((chamberMatch.station() - 1) + 4 * (chamberMatch.detector() - 1));
137 for (
unsigned int i = 0;
i < 8; ++
i)
138 if (stationMask & (1 <<
i))
143 unsigned int Muon::stationMask(ArbitrationType
type)
const {
144 unsigned int totMask(0);
145 unsigned int curMask(0);
147 for (std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
148 chamberMatch != muMatches_.end();
150 if (
type == RPCHitAndTrackArbitration) {
151 if (chamberMatch->rpcMatches.empty())
160 for (std::vector<MuonRPCHitMatch>::const_iterator rpcMatch = chamberMatch->rpcMatches.begin();
161 rpcMatch != chamberMatch->rpcMatches.end();
163 curMask = 1 << ((chamberMatch->station() - 1) + 4 * (rpcIndex - 1));
166 if (!(totMask & curMask))
172 if (chamberMatch->segmentMatches.empty())
174 if (
type == NoArbitration) {
175 curMask = 1 << ((chamberMatch->station() - 1) + 4 * (chamberMatch->detector() - 1));
177 if (!(totMask & curMask))
182 for (std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
183 segmentMatch != chamberMatch->segmentMatches.end();
185 if (
type == SegmentArbitration)
186 if (segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR)) {
187 curMask = 1 << ((chamberMatch->station() - 1) + 4 * (chamberMatch->detector() - 1));
189 if (!(totMask & curMask))
193 if (
type == SegmentAndTrackArbitration)
194 if (segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
195 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
196 curMask = 1 << ((chamberMatch->station() - 1) + 4 * (chamberMatch->detector() - 1));
198 if (!(totMask & curMask))
202 if (
type == SegmentAndTrackArbitrationCleaned)
203 if (segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
204 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
205 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
206 curMask = 1 << ((chamberMatch->station() - 1) + 4 * (chamberMatch->detector() - 1));
208 if (!(totMask & curMask))
218 int Muon::numberOfMatchedRPCLayers(ArbitrationType
type)
const {
221 unsigned int theRPCLayerMask = RPClayerMask(
type);
223 for (
int it = 0; it < 10; ++it)
224 if (theRPCLayerMask & 1 << it)
230 unsigned int Muon::RPClayerMask(ArbitrationType
type)
const {
231 unsigned int totMask(0);
232 unsigned int curMask(0);
233 for (std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
234 chamberMatch != muMatches_.end();
236 if (chamberMatch->rpcMatches.empty())
242 const int layer = rollId.
layer();
243 int rpcLayer = chamberMatch->station();
245 rpcLayer = chamberMatch->station() - 1 + chamberMatch->station() * layer;
246 if ((chamberMatch->station() == 2 && layer == 2) || (chamberMatch->station() == 4 && layer == 1))
251 for (std::vector<MuonRPCHitMatch>::const_iterator rpcMatch = chamberMatch->rpcMatches.begin();
252 rpcMatch != chamberMatch->rpcMatches.end();
254 curMask = 1 << (rpcLayer - 1);
257 if (!(totMask & curMask))
265 unsigned int Muon::stationGapMaskDistance(
float distanceCut)
const {
266 unsigned int totMask(0);
268 for (
int detectorIndex = 1; detectorIndex < 4; detectorIndex++) {
269 unsigned int curMask(0);
270 for (std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
271 chamberMatch != muMatches_.end();
273 if (!(chamberMatch->station() ==
stationIndex && chamberMatch->detector() == detectorIndex))
276 float edgeX = chamberMatch->edgeX;
277 float edgeY = chamberMatch->edgeY;
278 if (edgeX < 0 && fabs(edgeX) > fabs(distanceCut) && edgeY < 0 &&
279 fabs(edgeY) > fabs(distanceCut))
284 if ((fabs(edgeX) < fabs(distanceCut) && edgeY < fabs(distanceCut)) ||
285 (fabs(edgeY) < fabs(distanceCut) && edgeX < fabs(distanceCut)))
286 curMask = 1 << ((
stationIndex - 1) + 4 * (detectorIndex - 1));
296 unsigned int Muon::stationGapMaskPull(
float sigmaCut)
const {
297 unsigned int totMask(0);
299 for (
int detectorIndex = 1; detectorIndex < 4; detectorIndex++) {
300 unsigned int curMask(0);
301 for (std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
302 chamberMatch != muMatches_.end();
304 if (!(chamberMatch->station() ==
stationIndex && chamberMatch->detector() == detectorIndex))
307 float edgeX = chamberMatch->edgeX;
308 float edgeY = chamberMatch->edgeY;
309 float xErr = chamberMatch->xErr + 0.000001;
310 float yErr = chamberMatch->yErr + 0.000001;
311 if (edgeX < 0 && fabs(edgeX / xErr) > fabs(
sigmaCut) && edgeY < 0 &&
312 fabs(edgeY / yErr) > fabs(
sigmaCut))
317 if ((fabs(edgeX / xErr) < fabs(
sigmaCut) && edgeY / yErr < fabs(
sigmaCut)) ||
319 curMask = 1 << ((
stationIndex - 1) + 4 * (detectorIndex - 1));
329 int Muon::nDigisInStation(
int station,
int muonSubdetId)
const {
331 std::map<int, int> me11DigisPerCh;
336 for (
auto&
match : muMatches_) {
340 int nDigisInCh =
match.nDigisInRange;
346 int ring =
id.ring();
350 if (me11DigisPerCh.find(
chamber) == me11DigisPerCh.end())
353 me11DigisPerCh[
chamber] += nDigisInCh;
359 if (nDigisInCh > nDigis)
363 for (
const auto& me11DigisInCh : me11DigisPerCh) {
364 int nMe11DigisInCh = me11DigisInCh.second;
365 if (nMe11DigisInCh > nDigis)
366 nDigis = nMe11DigisInCh;
372 bool Muon::hasShowerInStation(
int station,
int muonSubdetId,
int nDtDigisCut,
int nCscDigisCut)
const {
375 auto nDigisCut = muonSubdetId ==
MuonSubdetId::DT ? nDtDigisCut : nCscDigisCut;
377 return nDigisInStation(
station, muonSubdetId) >= nDigisCut;
380 int Muon::numberOfShowers(
int nDtDigisCut,
int nCscDigisCut)
const {
392 int Muon::numberOfSegments(
int station,
int muonSubdetId, ArbitrationType
type)
const {
394 for (std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
395 chamberMatch != muMatches_.end();
397 if (chamberMatch->segmentMatches.empty())
399 if (!(chamberMatch->station() ==
station && chamberMatch->detector() == muonSubdetId))
402 if (
type == NoArbitration) {
403 segments += chamberMatch->segmentMatches.size();
407 for (std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
408 segmentMatch != chamberMatch->segmentMatches.end();
410 if (
type == SegmentArbitration)
411 if (segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR)) {
415 if (
type == SegmentAndTrackArbitration)
416 if (segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
417 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
421 if (
type == SegmentAndTrackArbitrationCleaned)
422 if (segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
423 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
424 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
435 std::vector<const MuonChamberMatch*>
chambers;
436 for (std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
437 chamberMatch != muMatches_.end();
439 if (chamberMatch->station() ==
station && chamberMatch->detector() == muonSubdetId)
440 chambers.push_back(&(*chamberMatch));
444 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> Muon::pair(
445 const std::vector<const MuonChamberMatch*>&
chambers, ArbitrationType
type)
const {
448 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair(
m,
s);
451 return chamberSegmentPair;
452 for (std::vector<const MuonChamberMatch*>::const_iterator chamberMatch =
chambers.begin();
455 if ((*chamberMatch)->segmentMatches.empty())
457 if (
type == NoArbitration)
458 return std::make_pair(*chamberMatch, &((*chamberMatch)->segmentMatches.front()));
460 for (std::vector<MuonSegmentMatch>::const_iterator segmentMatch = (*chamberMatch)->segmentMatches.begin();
461 segmentMatch != (*chamberMatch)->segmentMatches.end();
463 if (
type == SegmentArbitration)
464 if (segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR))
465 return std::make_pair(*chamberMatch, &(*segmentMatch));
466 if (
type == SegmentAndTrackArbitration)
467 if (segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
468 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR))
469 return std::make_pair(*chamberMatch, &(*segmentMatch));
470 if (
type == SegmentAndTrackArbitrationCleaned)
471 if (segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
472 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
473 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning))
474 return std::make_pair(*chamberMatch, &(*segmentMatch));
478 return chamberSegmentPair;
481 float Muon::dX(
int station,
int muonSubdetId, ArbitrationType
type)
const {
482 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
484 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
486 if (!chamberSegmentPair.second->hasPhi())
488 return chamberSegmentPair.first->x - chamberSegmentPair.second->x;
491 float Muon::dY(
int station,
int muonSubdetId, ArbitrationType
type)
const {
494 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
496 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
498 if (!chamberSegmentPair.second->hasZed())
500 return chamberSegmentPair.first->y - chamberSegmentPair.second->y;
503 float Muon::dDxDz(
int station,
int muonSubdetId, ArbitrationType
type)
const {
504 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
506 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
508 if (!chamberSegmentPair.second->hasPhi())
510 return chamberSegmentPair.first->dXdZ - chamberSegmentPair.second->dXdZ;
513 float Muon::dDyDz(
int station,
int muonSubdetId, ArbitrationType
type)
const {
516 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
518 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
520 if (!chamberSegmentPair.second->hasZed())
522 return chamberSegmentPair.first->dYdZ - chamberSegmentPair.second->dYdZ;
525 float Muon::pullX(
int station,
int muonSubdetId, ArbitrationType
type,
bool includeSegmentError)
const {
526 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
528 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
530 if (!chamberSegmentPair.second->hasPhi())
532 if (includeSegmentError)
533 return (chamberSegmentPair.first->x - chamberSegmentPair.second->x) /
534 sqrt(
pow(chamberSegmentPair.first->xErr, 2) +
pow(chamberSegmentPair.second->xErr, 2));
535 return (chamberSegmentPair.first->x - chamberSegmentPair.second->x) / chamberSegmentPair.first->xErr;
538 float Muon::pullY(
int station,
int muonSubdetId, ArbitrationType
type,
bool includeSegmentError)
const {
541 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
543 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
545 if (!chamberSegmentPair.second->hasZed())
547 if (includeSegmentError)
548 return (chamberSegmentPair.first->y - chamberSegmentPair.second->y) /
549 sqrt(
pow(chamberSegmentPair.first->yErr, 2) +
pow(chamberSegmentPair.second->yErr, 2));
550 return (chamberSegmentPair.first->y - chamberSegmentPair.second->y) / chamberSegmentPair.first->yErr;
553 float Muon::pullDxDz(
int station,
int muonSubdetId, ArbitrationType
type,
bool includeSegmentError)
const {
554 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
556 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
558 if (!chamberSegmentPair.second->hasPhi())
560 if (includeSegmentError)
561 return (chamberSegmentPair.first->dXdZ - chamberSegmentPair.second->dXdZ) /
562 sqrt(
pow(chamberSegmentPair.first->dXdZErr, 2) +
pow(chamberSegmentPair.second->dXdZErr, 2));
563 return (chamberSegmentPair.first->dXdZ - chamberSegmentPair.second->dXdZ) / chamberSegmentPair.first->dXdZErr;
566 float Muon::pullDyDz(
int station,
int muonSubdetId, ArbitrationType
type,
bool includeSegmentError)
const {
569 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
571 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
573 if (!chamberSegmentPair.second->hasZed())
575 if (includeSegmentError)
576 return (chamberSegmentPair.first->dYdZ - chamberSegmentPair.second->dYdZ) /
577 sqrt(
pow(chamberSegmentPair.first->dYdZErr, 2) +
pow(chamberSegmentPair.second->dYdZErr, 2));
578 return (chamberSegmentPair.first->dYdZ - chamberSegmentPair.second->dYdZ) / chamberSegmentPair.first->dYdZErr;
581 float Muon::segmentX(
int station,
int muonSubdetId, ArbitrationType
type)
const {
582 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
584 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
586 if (!chamberSegmentPair.second->hasPhi())
588 return chamberSegmentPair.second->x;
591 float Muon::segmentY(
int station,
int muonSubdetId, ArbitrationType
type)
const {
594 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
596 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
598 if (!chamberSegmentPair.second->hasZed())
600 return chamberSegmentPair.second->y;
603 float Muon::segmentDxDz(
int station,
int muonSubdetId, ArbitrationType
type)
const {
604 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
606 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
608 if (!chamberSegmentPair.second->hasPhi())
610 return chamberSegmentPair.second->dXdZ;
613 float Muon::segmentDyDz(
int station,
int muonSubdetId, ArbitrationType
type)
const {
616 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
618 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
620 if (!chamberSegmentPair.second->hasZed())
622 return chamberSegmentPair.second->dYdZ;
625 float Muon::segmentXErr(
int station,
int muonSubdetId, ArbitrationType
type)
const {
626 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
628 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
630 if (!chamberSegmentPair.second->hasPhi())
632 return chamberSegmentPair.second->xErr;
635 float Muon::segmentYErr(
int station,
int muonSubdetId, ArbitrationType
type)
const {
638 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
640 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
642 if (!chamberSegmentPair.second->hasZed())
644 return chamberSegmentPair.second->yErr;
647 float Muon::segmentDxDzErr(
int station,
int muonSubdetId, ArbitrationType
type)
const {
648 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
650 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
652 if (!chamberSegmentPair.second->hasPhi())
654 return chamberSegmentPair.second->dXdZErr;
657 float Muon::segmentDyDzErr(
int station,
int muonSubdetId, ArbitrationType
type)
const {
660 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair =
662 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr)
664 if (!chamberSegmentPair.second->hasZed())
666 return chamberSegmentPair.second->dYdZErr;
669 float Muon::trackEdgeX(
int station,
int muonSubdetId, ArbitrationType
type)
const {
670 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
671 if (muonChambers.empty())
674 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
675 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
677 float supVar = 999999;
678 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
679 muonChamber != muonChambers.end();
681 float currDist = (*muonChamber)->dist();
682 if (currDist < dist) {
684 supVar = (*muonChamber)->edgeX;
689 return chamberSegmentPair.first->edgeX;
692 float Muon::trackEdgeY(
int station,
int muonSubdetId, ArbitrationType
type)
const {
693 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
694 if (muonChambers.empty())
697 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
698 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
700 float supVar = 999999;
701 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
702 muonChamber != muonChambers.end();
704 float currDist = (*muonChamber)->dist();
705 if (currDist < dist) {
707 supVar = (*muonChamber)->edgeY;
712 return chamberSegmentPair.first->edgeY;
715 float Muon::trackX(
int station,
int muonSubdetId, ArbitrationType
type)
const {
716 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
717 if (muonChambers.empty())
720 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
721 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
723 float supVar = 999999;
724 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
725 muonChamber != muonChambers.end();
727 float currDist = (*muonChamber)->dist();
728 if (currDist < dist) {
730 supVar = (*muonChamber)->x;
735 return chamberSegmentPair.first->x;
738 float Muon::trackY(
int station,
int muonSubdetId, ArbitrationType
type)
const {
739 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
740 if (muonChambers.empty())
743 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
744 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
746 float supVar = 999999;
747 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
748 muonChamber != muonChambers.end();
750 float currDist = (*muonChamber)->dist();
751 if (currDist < dist) {
753 supVar = (*muonChamber)->y;
758 return chamberSegmentPair.first->y;
761 float Muon::trackDxDz(
int station,
int muonSubdetId, ArbitrationType
type)
const {
762 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
763 if (muonChambers.empty())
766 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
767 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
769 float supVar = 999999;
770 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
771 muonChamber != muonChambers.end();
773 float currDist = (*muonChamber)->dist();
774 if (currDist < dist) {
776 supVar = (*muonChamber)->dXdZ;
781 return chamberSegmentPair.first->dXdZ;
784 float Muon::trackDyDz(
int station,
int muonSubdetId, ArbitrationType
type)
const {
785 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
786 if (muonChambers.empty())
789 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
790 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
792 float supVar = 999999;
793 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
794 muonChamber != muonChambers.end();
796 float currDist = (*muonChamber)->dist();
797 if (currDist < dist) {
799 supVar = (*muonChamber)->dYdZ;
804 return chamberSegmentPair.first->dYdZ;
807 float Muon::trackXErr(
int station,
int muonSubdetId, ArbitrationType
type)
const {
808 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
809 if (muonChambers.empty())
812 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
813 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
815 float supVar = 999999;
816 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
817 muonChamber != muonChambers.end();
819 float currDist = (*muonChamber)->dist();
820 if (currDist < dist) {
822 supVar = (*muonChamber)->xErr;
827 return chamberSegmentPair.first->xErr;
830 float Muon::trackYErr(
int station,
int muonSubdetId, ArbitrationType
type)
const {
831 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
832 if (muonChambers.empty())
835 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
836 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
838 float supVar = 999999;
839 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
840 muonChamber != muonChambers.end();
842 float currDist = (*muonChamber)->dist();
843 if (currDist < dist) {
845 supVar = (*muonChamber)->yErr;
850 return chamberSegmentPair.first->yErr;
853 float Muon::trackDxDzErr(
int station,
int muonSubdetId, ArbitrationType
type)
const {
854 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
855 if (muonChambers.empty())
858 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
859 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
861 float supVar = 999999;
862 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
863 muonChamber != muonChambers.end();
865 float currDist = (*muonChamber)->dist();
866 if (currDist < dist) {
868 supVar = (*muonChamber)->dXdZErr;
873 return chamberSegmentPair.first->dXdZErr;
876 float Muon::trackDyDzErr(
int station,
int muonSubdetId, ArbitrationType
type)
const {
877 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
878 if (muonChambers.empty())
881 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
882 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
884 float supVar = 999999;
885 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
886 muonChamber != muonChambers.end();
888 float currDist = (*muonChamber)->dist();
889 if (currDist < dist) {
891 supVar = (*muonChamber)->dYdZErr;
896 return chamberSegmentPair.first->dYdZErr;
899 float Muon::trackDist(
int station,
int muonSubdetId, ArbitrationType
type)
const {
900 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
901 if (muonChambers.empty())
904 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
905 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
907 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
908 muonChamber != muonChambers.end();
910 float currDist = (*muonChamber)->dist();
916 return chamberSegmentPair.first->dist();
919 float Muon::trackDistErr(
int station,
int muonSubdetId, ArbitrationType
type)
const {
920 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(
station, muonSubdetId);
921 if (muonChambers.empty())
924 std::pair<const MuonChamberMatch*, const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,
type);
925 if (chamberSegmentPair.first ==
nullptr || chamberSegmentPair.second ==
nullptr) {
927 float supVar = 999999;
928 for (std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
929 muonChamber != muonChambers.end();
931 float currDist = (*muonChamber)->dist();
932 if (currDist < dist) {
934 supVar = (*muonChamber)->distErr();
939 return chamberSegmentPair.first->distErr();
943 isolationR03_ = isoR03;
944 isolationR05_ = isoR05;
945 isolationValid_ =
true;
949 if (
label ==
"pfIsolationR03")
950 pfIsolationR03_ = deposit;
952 if (
label ==
"pfIsolationR04")
953 pfIsolationR04_ = deposit;
955 if (
label ==
"pfIsoMeanDRProfileR03")
956 pfIsoMeanDRR03_ = deposit;
958 if (
label ==
"pfIsoMeanDRProfileR04")
959 pfIsoMeanDRR04_ = deposit;
961 if (
label ==
"pfIsoSumDRProfileR03")
962 pfIsoSumDRR03_ = deposit;
964 if (
label ==
"pfIsoSumDRProfileR04")
965 pfIsoSumDRR04_ = deposit;
967 pfIsolationValid_ =
true;
972 type_ = type_ | PFMuon;
975 void Muon::setOuterTrack(
const TrackRef&
t) { outerTrack_ =
t; }
976 void Muon::setInnerTrack(
const TrackRef&
t) { innerTrack_ =
t; }
977 void Muon::setTrack(
const TrackRef&
t) { setInnerTrack(
t); }
978 void Muon::setStandAlone(
const TrackRef&
t) { setOuterTrack(
t); }
979 void Muon::setGlobalTrack(
const TrackRef&
t) { globalTrack_ =
t; }
980 void Muon::setCombined(
const TrackRef&
t) { setGlobalTrack(
t); }
982 bool Muon::isAValidMuonTrack(
const MuonTrackType&
type)
const {
return muonTrack(
type).isNonnull(); }
999 return muonTrackFromMap(
type);
1015 refittedTrackMap_[
type] =
t;