12 matchesValid_ =
false;
13 isolationValid_ =
false;
14 pfIsolationValid_ =
false;
15 qualityValid_ =
false;
16 caloCompatibility_ = -9999.;
25 matchesValid_ =
false;
26 isolationValid_ =
false;
27 pfIsolationValid_ =
false;
28 qualityValid_ =
false;
29 caloCompatibility_ = -9999.;
38 return ( o !=
nullptr &&
48 return new Muon( *
this );
51 int Muon::numberOfChambersCSCorDT()
const 54 int nAll = numberOfChambers();
55 for (
int iC = 0; iC < nAll; ++iC){
63 int Muon::numberOfMatches( ArbitrationType
type )
const 66 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
67 chamberMatch != muMatches_.end(); chamberMatch++ )
69 if(type == RPCHitAndTrackArbitration) {
70 if(chamberMatch->rpcMatches.empty())
continue;
71 matches += chamberMatch->rpcMatches.size();
74 if(type == ME0SegmentAndTrackArbitration) {
75 if(chamberMatch->me0Matches.empty())
continue;
76 matches += chamberMatch->me0Matches.size();
79 if(type == GEMSegmentAndTrackArbitration) {
80 if(chamberMatch->gemMatches.empty())
continue;
81 matches += chamberMatch->gemMatches.size();
85 if(chamberMatch->segmentMatches.empty())
continue;
86 if(type == NoArbitration) {
91 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
92 segmentMatch != chamberMatch->segmentMatches.end(); segmentMatch++ )
94 if(type == SegmentArbitration)
95 if(segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR)) {
99 if(type == SegmentAndTrackArbitration)
100 if(segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR) &&
101 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
105 if(type == SegmentAndTrackArbitrationCleaned)
106 if(segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR) &&
107 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
108 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
118 int Muon::numberOfMatchedStations( ArbitrationType type )
const 122 unsigned int theStationMask = stationMask(type);
124 for(
int it = 0; it < 8; ++it)
125 if (theStationMask & 1<<it)
131 unsigned int Muon::expectedNnumberOfMatchedStations(
float minDistanceFromEdge )
const 133 unsigned int stationMask = 0;
134 for(
auto& chamberMatch : muMatches_ )
137 float edgeX = chamberMatch.edgeX;
138 float edgeY = chamberMatch.edgeY;
140 if(edgeX<0 && fabs(edgeX)>fabs(minDistanceFromEdge) &&
141 edgeY<0 && fabs(edgeY)>fabs(minDistanceFromEdge))
142 stationMask |= 1<<( (chamberMatch.station()-1)+4*(chamberMatch.detector()-1) );
145 for(
unsigned int i=0;
i<8; ++
i)
146 if (stationMask&(1<<
i)) n++;
150 unsigned int Muon::stationMask( ArbitrationType type )
const 152 unsigned int totMask(0);
153 unsigned int curMask(0);
155 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
156 chamberMatch != muMatches_.end(); chamberMatch++ )
158 if(type == RPCHitAndTrackArbitration) {
159 if(chamberMatch->rpcMatches.empty())
continue;
162 const int region = rollId.
region();
163 int rpcIndex = 1;
if (region!=0) rpcIndex = 2;
165 for( std::vector<MuonRPCHitMatch>::const_iterator rpcMatch = chamberMatch->rpcMatches.begin();
166 rpcMatch != chamberMatch->rpcMatches.end(); rpcMatch++ )
168 curMask = 1<<( (chamberMatch->station()-1)+4*(rpcIndex-1) );
171 if(!(totMask & curMask))
177 if(chamberMatch->segmentMatches.empty())
continue;
178 if(type == NoArbitration) {
179 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
181 if(!(totMask & curMask))
186 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
187 segmentMatch != chamberMatch->segmentMatches.end(); segmentMatch++ )
189 if(type == SegmentArbitration)
190 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR)) {
191 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
193 if(!(totMask & curMask))
197 if(type == SegmentAndTrackArbitration)
198 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
199 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
200 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
202 if(!(totMask & curMask))
206 if(type == SegmentAndTrackArbitrationCleaned)
207 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
208 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
209 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
210 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
212 if(!(totMask & curMask))
222 int Muon::numberOfMatchedRPCLayers( ArbitrationType type )
const 226 unsigned int theRPCLayerMask = RPClayerMask(type);
228 for(
int it = 0; it < 10; ++it)
229 if (theRPCLayerMask & 1<<it)
235 unsigned int Muon::RPClayerMask( ArbitrationType type )
const 237 unsigned int totMask(0);
238 unsigned int curMask(0);
239 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
240 chamberMatch != muMatches_.end(); chamberMatch++ )
242 if(chamberMatch->rpcMatches.empty())
continue;
245 const int region = rollId.
region();
247 const int layer = rollId.
layer();
248 int rpcLayer = chamberMatch->station();
250 rpcLayer = chamberMatch->station()-1 + chamberMatch->station()*layer;
251 if ((chamberMatch->station()==2 && layer==2) || (chamberMatch->station()==4 && layer==1)) rpcLayer -= 1;
252 }
else rpcLayer += 6;
254 for( std::vector<MuonRPCHitMatch>::const_iterator rpcMatch = chamberMatch->rpcMatches.begin();
255 rpcMatch != chamberMatch->rpcMatches.end(); rpcMatch++ )
257 curMask = 1<<(rpcLayer-1);
260 if(!(totMask & curMask))
269 unsigned int Muon::stationGapMaskDistance(
float distanceCut )
const 271 unsigned int totMask(0);
274 for(
int detectorIndex = 1; detectorIndex < 4; detectorIndex++ )
276 unsigned int curMask(0);
277 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
278 chamberMatch != muMatches_.end(); chamberMatch++ )
280 if(!(chamberMatch->station()==
stationIndex && chamberMatch->detector()==detectorIndex))
continue;
282 float edgeX = chamberMatch->edgeX;
283 float edgeY = chamberMatch->edgeY;
284 if(edgeX<0 && fabs(edgeX)>fabs(distanceCut) &&
285 edgeY<0 && fabs(edgeY)>fabs(distanceCut))
290 if( ( fabs(edgeX) < fabs(distanceCut) && edgeY < fabs(distanceCut) ) ||
291 ( fabs(edgeY) < fabs(distanceCut) && edgeX < fabs(distanceCut) ) )
302 unsigned int Muon::stationGapMaskPull(
float sigmaCut )
const 304 unsigned int totMask(0);
307 for(
int detectorIndex = 1; detectorIndex < 4; detectorIndex++ )
309 unsigned int curMask(0);
310 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
311 chamberMatch != muMatches_.end(); chamberMatch++ )
313 if(!(chamberMatch->station()==
stationIndex && chamberMatch->detector()==detectorIndex))
continue;
315 float edgeX = chamberMatch->edgeX;
316 float edgeY = chamberMatch->edgeY;
317 float xErr = chamberMatch->xErr+0.000001;
318 float yErr = chamberMatch->yErr+0.000001;
319 if(edgeX<0 && fabs(edgeX/xErr)>fabs(sigmaCut) &&
320 edgeY<0 && fabs(edgeY/yErr)>fabs(sigmaCut))
325 if( ( fabs(edgeX/xErr) < fabs(sigmaCut) && edgeY/yErr < fabs(sigmaCut) ) ||
326 ( fabs(edgeY/yErr) < fabs(sigmaCut) && edgeX/xErr < fabs(sigmaCut) ) )
337 int Muon::nDigisInStation(
int station,
int muonSubdetId )
const 340 std::map<int, int> me11DigisPerCh;
346 for (
auto &
match : muMatches_ )
348 if (
match.detector() != muonSubdetId ||
352 int nDigisInCh =
match.nDigisInRange;
359 int ring =
id.ring();
361 if ( ring == 1 || ring == 4 )
363 if( me11DigisPerCh.find(chamber) == me11DigisPerCh.end() )
364 me11DigisPerCh[chamber] = 0;
366 me11DigisPerCh[
chamber] += nDigisInCh;
372 if( nDigisInCh > nDigis )
376 for (
const auto & me11DigisInCh : me11DigisPerCh )
378 int nMe11DigisInCh = me11DigisInCh.second;
379 if ( nMe11DigisInCh > nDigis )
380 nDigis = nMe11DigisInCh;
386 bool Muon::hasShowerInStation(
int station,
int muonSubdetId,
int nDtDigisCut,
int nCscDigisCut )
const 389 auto nDigisCut = muonSubdetId ==
MuonSubdetId::DT ? nDtDigisCut : nCscDigisCut;
391 return nDigisInStation(station,muonSubdetId) >= nDigisCut ;
394 int Muon::numberOfShowers(
int nDtDigisCut,
int nCscDigisCut )
const 397 for (
int station = 1; station < 5; ++
station )
399 if ( hasShowerInStation(station,
MuonSubdetId::DT,nDtDigisCut,nCscDigisCut) )
408 int Muon::numberOfSegments(
int station,
int muonSubdetId, ArbitrationType type )
const 411 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
412 chamberMatch != muMatches_.end(); chamberMatch++ )
414 if(chamberMatch->segmentMatches.empty())
continue;
415 if(!(chamberMatch->station()==station && chamberMatch->detector()==muonSubdetId))
continue;
417 if(type == NoArbitration) {
418 segments += chamberMatch->segmentMatches.size();
422 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
423 segmentMatch != chamberMatch->segmentMatches.end(); segmentMatch++ )
425 if(type == SegmentArbitration)
426 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR)) {
430 if(type == SegmentAndTrackArbitration)
431 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
432 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
436 if(type == SegmentAndTrackArbitrationCleaned)
437 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
438 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
439 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
449 const std::vector<const MuonChamberMatch*>
Muon::chambers(
int station,
int muonSubdetId )
const 451 std::vector<const MuonChamberMatch*>
chambers;
452 for(std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
453 chamberMatch != muMatches_.end(); chamberMatch++)
454 if(chamberMatch->station()==station && chamberMatch->detector()==muonSubdetId)
455 chambers.push_back(&(*chamberMatch));
459 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> Muon::pair(
const std::vector<const MuonChamberMatch*> &chambers,
460 ArbitrationType type )
const 464 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair(m,s);
466 if(chambers.empty())
return chamberSegmentPair;
467 for( std::vector<const MuonChamberMatch*>::const_iterator chamberMatch = chambers.begin();
468 chamberMatch != chambers.end(); chamberMatch++ )
470 if((*chamberMatch)->segmentMatches.empty())
continue;
471 if(type == NoArbitration)
472 return std::make_pair(*chamberMatch, &((*chamberMatch)->segmentMatches.front()));
474 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = (*chamberMatch)->segmentMatches.begin();
475 segmentMatch != (*chamberMatch)->segmentMatches.end(); segmentMatch++ )
477 if(type == SegmentArbitration)
478 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR))
479 return std::make_pair(*chamberMatch, &(*segmentMatch));
480 if(type == SegmentAndTrackArbitration)
481 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
482 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR))
483 return std::make_pair(*chamberMatch, &(*segmentMatch));
484 if(type == SegmentAndTrackArbitrationCleaned)
485 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
486 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
487 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning))
488 return std::make_pair(*chamberMatch, &(*segmentMatch));
492 return chamberSegmentPair;
495 float Muon::dX(
int station,
int muonSubdetId, ArbitrationType type )
const 497 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
498 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
499 if(! chamberSegmentPair.second->hasPhi())
return 999999;
500 return chamberSegmentPair.first->x-chamberSegmentPair.second->x;
503 float Muon::dY(
int station,
int muonSubdetId, ArbitrationType type )
const 506 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
507 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
508 if(! chamberSegmentPair.second->hasZed())
return 999999;
509 return chamberSegmentPair.first->y-chamberSegmentPair.second->y;
512 float Muon::dDxDz(
int station,
int muonSubdetId, ArbitrationType type )
const 514 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
515 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
516 if(! chamberSegmentPair.second->hasPhi())
return 999999;
517 return chamberSegmentPair.first->dXdZ-chamberSegmentPair.second->dXdZ;
520 float Muon::dDyDz(
int station,
int muonSubdetId, ArbitrationType type )
const 523 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
524 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
525 if(! chamberSegmentPair.second->hasZed())
return 999999;
526 return chamberSegmentPair.first->dYdZ-chamberSegmentPair.second->dYdZ;
529 float Muon::pullX(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError )
const 531 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
532 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
533 if(! chamberSegmentPair.second->hasPhi())
return 999999;
534 if(includeSegmentError)
535 return (chamberSegmentPair.first->x-chamberSegmentPair.second->x)/
sqrt(
pow(chamberSegmentPair.first->xErr,2)+
pow(chamberSegmentPair.second->xErr,2));
536 return (chamberSegmentPair.first->x-chamberSegmentPair.second->x)/chamberSegmentPair.first->xErr;
539 float Muon::pullY(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError)
const 542 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
543 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
544 if(! chamberSegmentPair.second->hasZed())
return 999999;
545 if(includeSegmentError)
546 return (chamberSegmentPair.first->y-chamberSegmentPair.second->y)/
sqrt(
pow(chamberSegmentPair.first->yErr,2)+
pow(chamberSegmentPair.second->yErr,2));
547 return (chamberSegmentPair.first->y-chamberSegmentPair.second->y)/chamberSegmentPair.first->yErr;
550 float Muon::pullDxDz(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError )
const 552 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
553 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
554 if(! chamberSegmentPair.second->hasPhi())
return 999999;
555 if(includeSegmentError)
556 return (chamberSegmentPair.first->dXdZ-chamberSegmentPair.second->dXdZ)/
sqrt(
pow(chamberSegmentPair.first->dXdZErr,2)+
pow(chamberSegmentPair.second->dXdZErr,2));
557 return (chamberSegmentPair.first->dXdZ-chamberSegmentPair.second->dXdZ)/chamberSegmentPair.first->dXdZErr;
560 float Muon::pullDyDz(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError )
const 563 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
564 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
565 if(! chamberSegmentPair.second->hasZed())
return 999999;
566 if(includeSegmentError)
567 return (chamberSegmentPair.first->dYdZ-chamberSegmentPair.second->dYdZ)/
sqrt(
pow(chamberSegmentPair.first->dYdZErr,2)+
pow(chamberSegmentPair.second->dYdZErr,2));
568 return (chamberSegmentPair.first->dYdZ-chamberSegmentPair.second->dYdZ)/chamberSegmentPair.first->dYdZErr;
571 float Muon::segmentX(
int station,
int muonSubdetId, ArbitrationType type )
const 573 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
574 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
575 if(! chamberSegmentPair.second->hasPhi())
return 999999;
576 return chamberSegmentPair.second->x;
579 float Muon::segmentY(
int station,
int muonSubdetId, ArbitrationType type )
const 582 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
583 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
584 if(! chamberSegmentPair.second->hasZed())
return 999999;
585 return chamberSegmentPair.second->y;
588 float Muon::segmentDxDz(
int station,
int muonSubdetId, ArbitrationType type )
const 590 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
591 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
592 if(! chamberSegmentPair.second->hasPhi())
return 999999;
593 return chamberSegmentPair.second->dXdZ;
596 float Muon::segmentDyDz(
int station,
int muonSubdetId, ArbitrationType type )
const 599 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
600 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
601 if(! chamberSegmentPair.second->hasZed())
return 999999;
602 return chamberSegmentPair.second->dYdZ;
605 float Muon::segmentXErr(
int station,
int muonSubdetId, ArbitrationType type )
const 607 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
608 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
609 if(! chamberSegmentPair.second->hasPhi())
return 999999;
610 return chamberSegmentPair.second->xErr;
613 float Muon::segmentYErr(
int station,
int muonSubdetId, ArbitrationType type )
const 616 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
617 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
618 if(! chamberSegmentPair.second->hasZed())
return 999999;
619 return chamberSegmentPair.second->yErr;
622 float Muon::segmentDxDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const 624 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
625 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
626 if(! chamberSegmentPair.second->hasPhi())
return 999999;
627 return chamberSegmentPair.second->dXdZErr;
630 float Muon::segmentDyDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const 633 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
634 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
635 if(! chamberSegmentPair.second->hasZed())
return 999999;
636 return chamberSegmentPair.second->dYdZErr;
639 float Muon::trackEdgeX(
int station,
int muonSubdetId, ArbitrationType type )
const 641 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
642 if(muonChambers.empty())
return 999999;
644 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
645 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
647 float supVar = 999999;
648 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
649 muonChamber != muonChambers.end(); ++muonChamber) {
650 float currDist = (*muonChamber)->dist();
653 supVar = (*muonChamber)->edgeX;
657 }
else return chamberSegmentPair.first->edgeX;
660 float Muon::trackEdgeY(
int station,
int muonSubdetId, ArbitrationType type )
const 662 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
663 if(muonChambers.empty())
return 999999;
665 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
666 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
668 float supVar = 999999;
669 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
670 muonChamber != muonChambers.end(); ++muonChamber) {
671 float currDist = (*muonChamber)->dist();
674 supVar = (*muonChamber)->edgeY;
678 }
else return chamberSegmentPair.first->edgeY;
681 float Muon::trackX(
int station,
int muonSubdetId, ArbitrationType type )
const 683 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
684 if(muonChambers.empty())
return 999999;
686 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
687 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
689 float supVar = 999999;
690 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
691 muonChamber != muonChambers.end(); ++muonChamber) {
692 float currDist = (*muonChamber)->dist();
695 supVar = (*muonChamber)->x;
699 }
else return chamberSegmentPair.first->x;
702 float Muon::trackY(
int station,
int muonSubdetId, ArbitrationType type )
const 704 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
705 if(muonChambers.empty())
return 999999;
707 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
708 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
710 float supVar = 999999;
711 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
712 muonChamber != muonChambers.end(); ++muonChamber) {
713 float currDist = (*muonChamber)->dist();
716 supVar = (*muonChamber)->y;
720 }
else return chamberSegmentPair.first->y;
723 float Muon::trackDxDz(
int station,
int muonSubdetId, ArbitrationType type )
const 725 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
726 if(muonChambers.empty())
return 999999;
728 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
729 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
731 float supVar = 999999;
732 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
733 muonChamber != muonChambers.end(); ++muonChamber) {
734 float currDist = (*muonChamber)->dist();
737 supVar = (*muonChamber)->dXdZ;
741 }
else return chamberSegmentPair.first->dXdZ;
744 float Muon::trackDyDz(
int station,
int muonSubdetId, ArbitrationType type )
const 746 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
747 if(muonChambers.empty())
return 999999;
749 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
750 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
752 float supVar = 999999;
753 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
754 muonChamber != muonChambers.end(); ++muonChamber) {
755 float currDist = (*muonChamber)->dist();
758 supVar = (*muonChamber)->dYdZ;
762 }
else return chamberSegmentPair.first->dYdZ;
765 float Muon::trackXErr(
int station,
int muonSubdetId, ArbitrationType type )
const 767 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
768 if(muonChambers.empty())
return 999999;
770 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
771 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
773 float supVar = 999999;
774 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
775 muonChamber != muonChambers.end(); ++muonChamber) {
776 float currDist = (*muonChamber)->dist();
779 supVar = (*muonChamber)->xErr;
783 }
else return chamberSegmentPair.first->xErr;
786 float Muon::trackYErr(
int station,
int muonSubdetId, ArbitrationType type )
const 788 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
789 if(muonChambers.empty())
return 999999;
791 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
792 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
794 float supVar = 999999;
795 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
796 muonChamber != muonChambers.end(); ++muonChamber) {
797 float currDist = (*muonChamber)->dist();
800 supVar = (*muonChamber)->yErr;
804 }
else return chamberSegmentPair.first->yErr;
807 float Muon::trackDxDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const 809 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
810 if(muonChambers.empty())
return 999999;
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(); ++muonChamber) {
818 float currDist = (*muonChamber)->dist();
821 supVar = (*muonChamber)->dXdZErr;
825 }
else return chamberSegmentPair.first->dXdZErr;
828 float Muon::trackDyDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const 830 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
831 if(muonChambers.empty())
return 999999;
833 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
834 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
836 float supVar = 999999;
837 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
838 muonChamber != muonChambers.end(); ++muonChamber) {
839 float currDist = (*muonChamber)->dist();
842 supVar = (*muonChamber)->dYdZErr;
846 }
else return chamberSegmentPair.first->dYdZErr;
849 float Muon::trackDist(
int station,
int muonSubdetId, ArbitrationType type )
const 851 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
852 if(muonChambers.empty())
return 999999;
854 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
855 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
857 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
858 muonChamber != muonChambers.end(); ++muonChamber) {
859 float currDist = (*muonChamber)->dist();
860 if(currDist<dist) dist = currDist;
863 }
else return chamberSegmentPair.first->dist();
866 float Muon::trackDistErr(
int station,
int muonSubdetId, ArbitrationType type )
const 868 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
869 if(muonChambers.empty())
return 999999;
871 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
872 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
874 float supVar = 999999;
875 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
876 muonChamber != muonChambers.end(); ++muonChamber) {
877 float currDist = (*muonChamber)->dist();
880 supVar = (*muonChamber)->distErr();
884 }
else return chamberSegmentPair.first->distErr();
889 isolationR03_ = isoR03;
890 isolationR05_ = isoR05;
891 isolationValid_ =
true;
897 if(label==
"pfIsolationR03")
898 pfIsolationR03_ = deposit;
900 if(label==
"pfIsolationR04")
901 pfIsolationR04_ = deposit;
903 if(label==
"pfIsoMeanDRProfileR03")
904 pfIsoMeanDRR03_ = deposit;
906 if(label==
"pfIsoMeanDRProfileR04")
907 pfIsoMeanDRR04_ = deposit;
909 if(label==
"pfIsoSumDRProfileR03")
910 pfIsoSumDRR03_ = deposit;
912 if(label==
"pfIsoSumDRProfileR04")
913 pfIsoSumDRR04_ = deposit;
915 pfIsolationValid_ =
true;
922 type_ = type_ | PFMuon;
927 void Muon::setOuterTrack(
const TrackRef &
t ) { outerTrack_ =
t; }
928 void Muon::setInnerTrack(
const TrackRef &
t ) { innerTrack_ =
t; }
929 void Muon::setTrack(
const TrackRef &
t ) { setInnerTrack(t); }
930 void Muon::setStandAlone(
const TrackRef &
t ) { setOuterTrack(t); }
931 void Muon::setGlobalTrack(
const TrackRef &
t ) { globalTrack_ =
t; }
932 void Muon::setCombined(
const TrackRef &
t ) { setGlobalTrack(t); }
935 bool Muon::isAValidMuonTrack(
const MuonTrackType& type)
const{
936 return muonTrack(type).isNonnull();
944 case TPFMS:
return tpfmsTrack();
945 case Picky:
return pickyTrack();
946 case DYT:
return dytTrack();
947 default:
return muonTrackFromMap(type);
954 case InnerTrack: setInnerTrack(t);
break;
955 case OuterTrack: setStandAlone(t);
break;
956 case CombinedTrack: setGlobalTrack(t);
break;
957 default: refittedTrackMap_[
type] =
t;
break;
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
LeafCandidate * clone() const override
returns a clone of the Candidate object
constexpr uint32_t rawId() const
get the raw id
virtual reco::TrackRef standAloneMuon() const
reference to a stand-alone muon Track
virtual reco::TrackRef track() const
reference to a Track
math::XYZTLorentzVector LorentzVector
const LorentzVector & p4() const final
four-momentum Lorentz vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
def checkOverlap(process)
Structure Point Contains parameters of Gaussian fits to DMRs.
bool overlap(const Candidate &) const override
check overlap with another Candidate
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
static char chambers[264][20]
Power< A, B >::type pow(const A &a, const B &b)
virtual reco::TrackRef combinedMuon() const
reference to a stand-alone muon Track
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.