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)) {
113 if(segmentMatch->isMask(type)) {
123 int Muon::numberOfMatchedStations( ArbitrationType type )
const 127 unsigned int theStationMask = stationMask(type);
129 for(
int it = 0; it < 8; ++it)
130 if (theStationMask & 1<<it)
136 unsigned int Muon::expectedNnumberOfMatchedStations(
float minDistanceFromEdge )
const 138 unsigned int stationMask = 0;
139 for(
auto& chamberMatch : muMatches_ )
142 float edgeX = chamberMatch.edgeX;
143 float edgeY = chamberMatch.edgeY;
145 if(edgeX<0 && fabs(edgeX)>fabs(minDistanceFromEdge) &&
146 edgeY<0 && fabs(edgeY)>fabs(minDistanceFromEdge))
147 stationMask |= 1<<( (chamberMatch.station()-1)+4*(chamberMatch.detector()-1) );
150 for(
unsigned int i=0;
i<8; ++
i)
151 if (stationMask&(1<<
i)) n++;
155 unsigned int Muon::stationMask( ArbitrationType type )
const 157 unsigned int totMask(0);
158 unsigned int curMask(0);
160 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
161 chamberMatch != muMatches_.end(); chamberMatch++ )
163 if(type == RPCHitAndTrackArbitration) {
164 if(chamberMatch->rpcMatches.empty())
continue;
167 const int region = rollId.
region();
168 int rpcIndex = 1;
if (region!=0) rpcIndex = 2;
170 for( std::vector<MuonRPCHitMatch>::const_iterator rpcMatch = chamberMatch->rpcMatches.begin();
171 rpcMatch != chamberMatch->rpcMatches.end(); rpcMatch++ )
173 curMask = 1<<( (chamberMatch->station()-1)+4*(rpcIndex-1) );
176 if(!(totMask & curMask))
182 if(chamberMatch->segmentMatches.empty())
continue;
183 if(type == NoArbitration) {
184 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
186 if(!(totMask & curMask))
191 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
192 segmentMatch != chamberMatch->segmentMatches.end(); segmentMatch++ )
194 if(type == SegmentArbitration)
195 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR)) {
196 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
198 if(!(totMask & curMask))
202 if(type == SegmentAndTrackArbitration)
203 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
204 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
205 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
207 if(!(totMask & curMask))
211 if(type == SegmentAndTrackArbitrationCleaned)
212 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
213 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
214 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
215 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
217 if(!(totMask & curMask))
222 if(segmentMatch->isMask(type)) {
223 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
225 if(!(totMask & curMask))
235 int Muon::numberOfMatchedRPCLayers( ArbitrationType type )
const 239 unsigned int theRPCLayerMask = RPClayerMask(type);
241 for(
int it = 0; it < 10; ++it)
242 if (theRPCLayerMask & 1<<it)
248 unsigned int Muon::RPClayerMask( ArbitrationType type )
const 250 unsigned int totMask(0);
251 unsigned int curMask(0);
252 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
253 chamberMatch != muMatches_.end(); chamberMatch++ )
255 if(chamberMatch->rpcMatches.empty())
continue;
258 const int region = rollId.
region();
260 const int layer = rollId.
layer();
261 int rpcLayer = chamberMatch->station();
263 rpcLayer = chamberMatch->station()-1 + chamberMatch->station()*layer;
264 if ((chamberMatch->station()==2 && layer==2) || (chamberMatch->station()==4 && layer==1)) rpcLayer -= 1;
265 }
else rpcLayer += 6;
267 for( std::vector<MuonRPCHitMatch>::const_iterator rpcMatch = chamberMatch->rpcMatches.begin();
268 rpcMatch != chamberMatch->rpcMatches.end(); rpcMatch++ )
270 curMask = 1<<(rpcLayer-1);
273 if(!(totMask & curMask))
282 unsigned int Muon::stationGapMaskDistance(
float distanceCut )
const 284 unsigned int totMask(0);
287 for(
int detectorIndex = 1; detectorIndex < 4; detectorIndex++ )
289 unsigned int curMask(0);
290 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
291 chamberMatch != muMatches_.end(); chamberMatch++ )
293 if(!(chamberMatch->station()==
stationIndex && chamberMatch->detector()==detectorIndex))
continue;
295 float edgeX = chamberMatch->edgeX;
296 float edgeY = chamberMatch->edgeY;
297 if(edgeX<0 && fabs(edgeX)>fabs(distanceCut) &&
298 edgeY<0 && fabs(edgeY)>fabs(distanceCut))
303 if( ( fabs(edgeX) < fabs(distanceCut) && edgeY < fabs(distanceCut) ) ||
304 ( fabs(edgeY) < fabs(distanceCut) && edgeX < fabs(distanceCut) ) )
315 unsigned int Muon::stationGapMaskPull(
float sigmaCut )
const 317 unsigned int totMask(0);
320 for(
int detectorIndex = 1; detectorIndex < 4; detectorIndex++ )
322 unsigned int curMask(0);
323 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
324 chamberMatch != muMatches_.end(); chamberMatch++ )
326 if(!(chamberMatch->station()==
stationIndex && chamberMatch->detector()==detectorIndex))
continue;
328 float edgeX = chamberMatch->edgeX;
329 float edgeY = chamberMatch->edgeY;
330 float xErr = chamberMatch->xErr+0.000001;
331 float yErr = chamberMatch->yErr+0.000001;
332 if(edgeX<0 && fabs(edgeX/xErr)>fabs(sigmaCut) &&
333 edgeY<0 && fabs(edgeY/yErr)>fabs(sigmaCut))
338 if( ( fabs(edgeX/xErr) < fabs(sigmaCut) && edgeY/yErr < fabs(sigmaCut) ) ||
339 ( fabs(edgeY/yErr) < fabs(sigmaCut) && edgeX/xErr < fabs(sigmaCut) ) )
350 int Muon::numberOfSegments(
int station,
int muonSubdetId, ArbitrationType type )
const 353 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
354 chamberMatch != muMatches_.end(); chamberMatch++ )
356 if(chamberMatch->segmentMatches.empty())
continue;
357 if(!(chamberMatch->station()==station && chamberMatch->detector()==muonSubdetId))
continue;
359 if(type == NoArbitration) {
360 segments += chamberMatch->segmentMatches.size();
364 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
365 segmentMatch != chamberMatch->segmentMatches.end(); segmentMatch++ )
367 if(type == SegmentArbitration)
368 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR)) {
372 if(type == SegmentAndTrackArbitration)
373 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
374 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
378 if(type == SegmentAndTrackArbitrationCleaned)
379 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
380 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
381 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
386 if(segmentMatch->isMask(type)) {
396 const std::vector<const MuonChamberMatch*>
Muon::chambers(
int station,
int muonSubdetId )
const 398 std::vector<const MuonChamberMatch*>
chambers;
399 for(std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
400 chamberMatch != muMatches_.end(); chamberMatch++)
401 if(chamberMatch->station()==station && chamberMatch->detector()==muonSubdetId)
402 chambers.push_back(&(*chamberMatch));
406 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> Muon::pair(
const std::vector<const MuonChamberMatch*> &chambers,
407 ArbitrationType type )
const 411 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair(m,s);
413 if(chambers.empty())
return chamberSegmentPair;
414 for( std::vector<const MuonChamberMatch*>::const_iterator chamberMatch = chambers.begin();
415 chamberMatch != chambers.end(); chamberMatch++ )
417 if((*chamberMatch)->segmentMatches.empty())
continue;
418 if(type == NoArbitration)
419 return std::make_pair(*chamberMatch, &((*chamberMatch)->segmentMatches.front()));
421 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = (*chamberMatch)->segmentMatches.begin();
422 segmentMatch != (*chamberMatch)->segmentMatches.end(); segmentMatch++ )
424 if(type == SegmentArbitration)
425 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR))
426 return std::make_pair(*chamberMatch, &(*segmentMatch));
427 if(type == SegmentAndTrackArbitration)
428 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
429 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR))
430 return std::make_pair(*chamberMatch, &(*segmentMatch));
431 if(type == SegmentAndTrackArbitrationCleaned)
432 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
433 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
434 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning))
435 return std::make_pair(*chamberMatch, &(*segmentMatch));
437 if(segmentMatch->isMask(type))
438 return std::make_pair(*chamberMatch, &(*segmentMatch));
442 return chamberSegmentPair;
445 float Muon::dX(
int station,
int muonSubdetId, ArbitrationType type )
const 447 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
448 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
449 if(! chamberSegmentPair.second->hasPhi())
return 999999;
450 return chamberSegmentPair.first->x-chamberSegmentPair.second->x;
453 float Muon::dY(
int station,
int muonSubdetId, ArbitrationType type )
const 456 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
457 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
458 if(! chamberSegmentPair.second->hasZed())
return 999999;
459 return chamberSegmentPair.first->y-chamberSegmentPair.second->y;
462 float Muon::dDxDz(
int station,
int muonSubdetId, ArbitrationType type )
const 464 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
465 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
466 if(! chamberSegmentPair.second->hasPhi())
return 999999;
467 return chamberSegmentPair.first->dXdZ-chamberSegmentPair.second->dXdZ;
470 float Muon::dDyDz(
int station,
int muonSubdetId, ArbitrationType type )
const 473 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
474 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
475 if(! chamberSegmentPair.second->hasZed())
return 999999;
476 return chamberSegmentPair.first->dYdZ-chamberSegmentPair.second->dYdZ;
479 float Muon::pullX(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError )
const 481 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
482 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
483 if(! chamberSegmentPair.second->hasPhi())
return 999999;
484 if(includeSegmentError)
485 return (chamberSegmentPair.first->x-chamberSegmentPair.second->x)/
sqrt(
pow(chamberSegmentPair.first->xErr,2)+
pow(chamberSegmentPair.second->xErr,2));
486 return (chamberSegmentPair.first->x-chamberSegmentPair.second->x)/chamberSegmentPair.first->xErr;
489 float Muon::pullY(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError)
const 492 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
493 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
494 if(! chamberSegmentPair.second->hasZed())
return 999999;
495 if(includeSegmentError)
496 return (chamberSegmentPair.first->y-chamberSegmentPair.second->y)/
sqrt(
pow(chamberSegmentPair.first->yErr,2)+
pow(chamberSegmentPair.second->yErr,2));
497 return (chamberSegmentPair.first->y-chamberSegmentPair.second->y)/chamberSegmentPair.first->yErr;
500 float Muon::pullDxDz(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError )
const 502 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
503 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
504 if(! chamberSegmentPair.second->hasPhi())
return 999999;
505 if(includeSegmentError)
506 return (chamberSegmentPair.first->dXdZ-chamberSegmentPair.second->dXdZ)/
sqrt(
pow(chamberSegmentPair.first->dXdZErr,2)+
pow(chamberSegmentPair.second->dXdZErr,2));
507 return (chamberSegmentPair.first->dXdZ-chamberSegmentPair.second->dXdZ)/chamberSegmentPair.first->dXdZErr;
510 float Muon::pullDyDz(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError )
const 513 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
514 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
515 if(! chamberSegmentPair.second->hasZed())
return 999999;
516 if(includeSegmentError)
517 return (chamberSegmentPair.first->dYdZ-chamberSegmentPair.second->dYdZ)/
sqrt(
pow(chamberSegmentPair.first->dYdZErr,2)+
pow(chamberSegmentPair.second->dYdZErr,2));
518 return (chamberSegmentPair.first->dYdZ-chamberSegmentPair.second->dYdZ)/chamberSegmentPair.first->dYdZErr;
521 float Muon::segmentX(
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->hasPhi())
return 999999;
526 return chamberSegmentPair.second->x;
529 float Muon::segmentY(
int station,
int muonSubdetId, ArbitrationType type )
const 532 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
533 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
534 if(! chamberSegmentPair.second->hasZed())
return 999999;
535 return chamberSegmentPair.second->y;
538 float Muon::segmentDxDz(
int station,
int muonSubdetId, ArbitrationType type )
const 540 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
541 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
542 if(! chamberSegmentPair.second->hasPhi())
return 999999;
543 return chamberSegmentPair.second->dXdZ;
546 float Muon::segmentDyDz(
int station,
int muonSubdetId, ArbitrationType type )
const 549 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
550 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
551 if(! chamberSegmentPair.second->hasZed())
return 999999;
552 return chamberSegmentPair.second->dYdZ;
555 float Muon::segmentXErr(
int station,
int muonSubdetId, ArbitrationType type )
const 557 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
558 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
559 if(! chamberSegmentPair.second->hasPhi())
return 999999;
560 return chamberSegmentPair.second->xErr;
563 float Muon::segmentYErr(
int station,
int muonSubdetId, ArbitrationType type )
const 566 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
567 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
568 if(! chamberSegmentPair.second->hasZed())
return 999999;
569 return chamberSegmentPair.second->yErr;
572 float Muon::segmentDxDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const 574 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
575 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
576 if(! chamberSegmentPair.second->hasPhi())
return 999999;
577 return chamberSegmentPair.second->dXdZErr;
580 float Muon::segmentDyDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const 583 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
584 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr)
return 999999;
585 if(! chamberSegmentPair.second->hasZed())
return 999999;
586 return chamberSegmentPair.second->dYdZErr;
589 float Muon::trackEdgeX(
int station,
int muonSubdetId, ArbitrationType type )
const 591 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
592 if(muonChambers.empty())
return 999999;
594 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
595 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
597 float supVar = 999999;
598 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
599 muonChamber != muonChambers.end(); ++muonChamber) {
600 float currDist = (*muonChamber)->dist();
603 supVar = (*muonChamber)->edgeX;
607 }
else return chamberSegmentPair.first->edgeX;
610 float Muon::trackEdgeY(
int station,
int muonSubdetId, ArbitrationType type )
const 612 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
613 if(muonChambers.empty())
return 999999;
615 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
616 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
618 float supVar = 999999;
619 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
620 muonChamber != muonChambers.end(); ++muonChamber) {
621 float currDist = (*muonChamber)->dist();
624 supVar = (*muonChamber)->edgeY;
628 }
else return chamberSegmentPair.first->edgeY;
631 float Muon::trackX(
int station,
int muonSubdetId, ArbitrationType type )
const 633 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
634 if(muonChambers.empty())
return 999999;
636 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
637 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
639 float supVar = 999999;
640 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
641 muonChamber != muonChambers.end(); ++muonChamber) {
642 float currDist = (*muonChamber)->dist();
645 supVar = (*muonChamber)->x;
649 }
else return chamberSegmentPair.first->x;
652 float Muon::trackY(
int station,
int muonSubdetId, ArbitrationType type )
const 654 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
655 if(muonChambers.empty())
return 999999;
657 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
658 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
660 float supVar = 999999;
661 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
662 muonChamber != muonChambers.end(); ++muonChamber) {
663 float currDist = (*muonChamber)->dist();
666 supVar = (*muonChamber)->y;
670 }
else return chamberSegmentPair.first->y;
673 float Muon::trackDxDz(
int station,
int muonSubdetId, ArbitrationType type )
const 675 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
676 if(muonChambers.empty())
return 999999;
678 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
679 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
681 float supVar = 999999;
682 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
683 muonChamber != muonChambers.end(); ++muonChamber) {
684 float currDist = (*muonChamber)->dist();
687 supVar = (*muonChamber)->dXdZ;
691 }
else return chamberSegmentPair.first->dXdZ;
694 float Muon::trackDyDz(
int station,
int muonSubdetId, ArbitrationType type )
const 696 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
697 if(muonChambers.empty())
return 999999;
699 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
700 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
702 float supVar = 999999;
703 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
704 muonChamber != muonChambers.end(); ++muonChamber) {
705 float currDist = (*muonChamber)->dist();
708 supVar = (*muonChamber)->dYdZ;
712 }
else return chamberSegmentPair.first->dYdZ;
715 float Muon::trackXErr(
int station,
int muonSubdetId, ArbitrationType type )
const 717 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
718 if(muonChambers.empty())
return 999999;
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(); ++muonChamber) {
726 float currDist = (*muonChamber)->dist();
729 supVar = (*muonChamber)->xErr;
733 }
else return chamberSegmentPair.first->xErr;
736 float Muon::trackYErr(
int station,
int muonSubdetId, ArbitrationType type )
const 738 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
739 if(muonChambers.empty())
return 999999;
741 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
742 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
744 float supVar = 999999;
745 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
746 muonChamber != muonChambers.end(); ++muonChamber) {
747 float currDist = (*muonChamber)->dist();
750 supVar = (*muonChamber)->yErr;
754 }
else return chamberSegmentPair.first->yErr;
757 float Muon::trackDxDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const 759 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
760 if(muonChambers.empty())
return 999999;
762 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
763 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
765 float supVar = 999999;
766 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
767 muonChamber != muonChambers.end(); ++muonChamber) {
768 float currDist = (*muonChamber)->dist();
771 supVar = (*muonChamber)->dXdZErr;
775 }
else return chamberSegmentPair.first->dXdZErr;
778 float Muon::trackDyDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const 780 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
781 if(muonChambers.empty())
return 999999;
783 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
784 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
786 float supVar = 999999;
787 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
788 muonChamber != muonChambers.end(); ++muonChamber) {
789 float currDist = (*muonChamber)->dist();
792 supVar = (*muonChamber)->dYdZErr;
796 }
else return chamberSegmentPair.first->dYdZErr;
799 float Muon::trackDist(
int station,
int muonSubdetId, ArbitrationType type )
const 801 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
802 if(muonChambers.empty())
return 999999;
804 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
805 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
807 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
808 muonChamber != muonChambers.end(); ++muonChamber) {
809 float currDist = (*muonChamber)->dist();
810 if(currDist<dist) dist = currDist;
813 }
else return chamberSegmentPair.first->dist();
816 float Muon::trackDistErr(
int station,
int muonSubdetId, ArbitrationType type )
const 818 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
819 if(muonChambers.empty())
return 999999;
821 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
822 if(chamberSegmentPair.first==
nullptr || chamberSegmentPair.second==
nullptr) {
824 float supVar = 999999;
825 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
826 muonChamber != muonChambers.end(); ++muonChamber) {
827 float currDist = (*muonChamber)->dist();
830 supVar = (*muonChamber)->distErr();
834 }
else return chamberSegmentPair.first->distErr();
839 isolationR03_ = isoR03;
840 isolationR05_ = isoR05;
841 isolationValid_ =
true;
847 if(label==
"pfIsolationR03")
848 pfIsolationR03_ = deposit;
850 if(label==
"pfIsolationR04")
851 pfIsolationR04_ = deposit;
853 if(label==
"pfIsoMeanDRProfileR03")
854 pfIsoMeanDRR03_ = deposit;
856 if(label==
"pfIsoMeanDRProfileR04")
857 pfIsoMeanDRR04_ = deposit;
859 if(label==
"pfIsoSumDRProfileR03")
860 pfIsoSumDRR03_ = deposit;
862 if(label==
"pfIsoSumDRProfileR04")
863 pfIsoSumDRR04_ = deposit;
865 pfIsolationValid_ =
true;
872 type_ = type_ | PFMuon;
877 void Muon::setOuterTrack(
const TrackRef &
t ) { outerTrack_ =
t; }
878 void Muon::setInnerTrack(
const TrackRef &
t ) { innerTrack_ =
t; }
879 void Muon::setTrack(
const TrackRef &
t ) { setInnerTrack(t); }
880 void Muon::setStandAlone(
const TrackRef &
t ) { setOuterTrack(t); }
881 void Muon::setGlobalTrack(
const TrackRef &
t ) { globalTrack_ =
t; }
882 void Muon::setCombined(
const TrackRef &
t ) { setGlobalTrack(t); }
885 bool Muon::isAValidMuonTrack(
const MuonTrackType& type)
const{
886 return muonTrack(type).isNonnull();
894 case TPFMS:
return tpfmsTrack();
895 case Picky:
return pickyTrack();
896 case DYT:
return dytTrack();
897 default:
return muonTrackFromMap(type);
904 case InnerTrack: setInnerTrack(t);
break;
905 case OuterTrack: setStandAlone(t);
break;
906 case CombinedTrack: setGlobalTrack(t);
break;
907 default: refittedTrackMap_[
type] =
t;
break;
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
LeafCandidate * clone() const override
returns a clone of the Candidate object
virtual reco::TrackRef standAloneMuon() const
reference to a stand-alone muon Track
virtual reco::TrackRef track() const
reference to a Track
uint32_t rawId() const
get the raw id
math::XYZTLorentzVector LorentzVector
const LorentzVector & p4() const final
four-momentum Lorentz vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
def checkOverlap(process)
bool overlap(const Candidate &) const override
check overlap with another Candidate
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.