10 matchesValid_ =
false;
11 isolationValid_ =
false;
12 pfIsolationValid_ =
false;
13 qualityValid_ =
false;
14 caloCompatibility_ = -9999.;
22 matchesValid_ =
false;
23 isolationValid_ =
false;
24 pfIsolationValid_ =
false;
25 qualityValid_ =
false;
26 caloCompatibility_ = -9999.;
36 ( checkOverlap( track(), o->
track() ) ||
40 checkOverlap( combinedMuon(), o->
track() ) )
45 return new Muon( *
this );
48 int Muon::numberOfChambersNoRPC()
const
51 int nAll = numberOfChambers();
52 for (
int iC = 0; iC < nAll; ++iC){
60 int Muon::numberOfMatches( ArbitrationType
type )
const
63 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
64 chamberMatch != muMatches_.end(); chamberMatch++ )
66 if(type == RPCHitAndTrackArbitration) {
67 if(chamberMatch->rpcMatches.empty())
continue;
68 matches += chamberMatch->rpcMatches.size();
72 if(chamberMatch->segmentMatches.empty())
continue;
73 if(type == NoArbitration) {
78 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
79 segmentMatch != chamberMatch->segmentMatches.end(); segmentMatch++ )
81 if(type == SegmentArbitration)
82 if(segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR)) {
86 if(type == SegmentAndTrackArbitration)
87 if(segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR) &&
88 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
92 if(type == SegmentAndTrackArbitrationCleaned)
93 if(segmentMatch->isMask(MuonSegmentMatch::BestInChamberByDR) &&
94 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
95 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
100 if(segmentMatch->isMask(type)) {
110 int Muon::numberOfMatchedStations( ArbitrationType type )
const
114 unsigned int theStationMask = stationMask(type);
116 for(
int it = 0; it < 8; ++it)
117 if (theStationMask & 1<<it)
123 unsigned int Muon::stationMask( ArbitrationType type )
const
125 unsigned int totMask(0);
126 unsigned int curMask(0);
128 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
129 chamberMatch != muMatches_.end(); chamberMatch++ )
131 if(type == RPCHitAndTrackArbitration) {
132 if(chamberMatch->rpcMatches.empty())
continue;
136 int rpcIndex = 1;
if (region!=0) rpcIndex = 2;
138 for( std::vector<MuonRPCHitMatch>::const_iterator rpcMatch = chamberMatch->rpcMatches.begin();
139 rpcMatch != chamberMatch->rpcMatches.end(); rpcMatch++ )
141 curMask = 1<<( (chamberMatch->station()-1)+4*(rpcIndex-1) );
144 if(!(totMask & curMask))
150 if(chamberMatch->segmentMatches.empty())
continue;
151 if(type == NoArbitration) {
152 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
154 if(!(totMask & curMask))
159 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
160 segmentMatch != chamberMatch->segmentMatches.end(); segmentMatch++ )
162 if(type == SegmentArbitration)
163 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR)) {
164 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
166 if(!(totMask & curMask))
170 if(type == SegmentAndTrackArbitration)
171 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
172 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
173 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
175 if(!(totMask & curMask))
179 if(type == SegmentAndTrackArbitrationCleaned)
180 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
181 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
182 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
183 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
185 if(!(totMask & curMask))
190 if(segmentMatch->isMask(type)) {
191 curMask = 1<<( (chamberMatch->station()-1)+4*(chamberMatch->detector()-1) );
193 if(!(totMask & curMask))
203 int Muon::numberOfMatchedRPCLayers( ArbitrationType type )
const
207 unsigned int theRPCLayerMask = RPClayerMask(type);
209 for(
int it = 0; it < 10; ++it)
210 if (theRPCLayerMask & 1<<it)
216 unsigned int Muon::RPClayerMask( ArbitrationType type )
const
218 unsigned int totMask(0);
219 unsigned int curMask(0);
220 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
221 chamberMatch != muMatches_.end(); chamberMatch++ )
223 if(chamberMatch->rpcMatches.empty())
continue;
226 const int region = rollId.
region();
228 const int layer = rollId.
layer();
229 int rpcLayer = chamberMatch->station();
231 rpcLayer = chamberMatch->station()-1 + chamberMatch->station()*layer;
232 if ((chamberMatch->station()==2 && layer==2) || (chamberMatch->station()==4 && layer==1)) rpcLayer -= 1;
233 }
else rpcLayer += 6;
235 for( std::vector<MuonRPCHitMatch>::const_iterator rpcMatch = chamberMatch->rpcMatches.begin();
236 rpcMatch != chamberMatch->rpcMatches.end(); rpcMatch++ )
238 curMask = 1<<(rpcLayer-1);
241 if(!(totMask & curMask))
250 unsigned int Muon::stationGapMaskDistance(
float distanceCut )
const
252 unsigned int totMask(0);
255 for(
int detectorIndex = 1; detectorIndex < 4; detectorIndex++ )
257 unsigned int curMask(0);
258 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
259 chamberMatch != muMatches_.end(); chamberMatch++ )
261 if(!(chamberMatch->station()==
stationIndex && chamberMatch->detector()==detectorIndex))
continue;
263 float edgeX = chamberMatch->edgeX;
264 float edgeY = chamberMatch->edgeY;
265 if(edgeX<0 && fabs(edgeX)>fabs(distanceCut) &&
266 edgeY<0 && fabs(edgeY)>fabs(distanceCut))
271 if( ( fabs(edgeX) < fabs(distanceCut) && edgeY < fabs(distanceCut) ) ||
272 ( fabs(edgeY) < fabs(distanceCut) && edgeX < fabs(distanceCut) ) )
283 unsigned int Muon::stationGapMaskPull(
float sigmaCut )
const
285 unsigned int totMask(0);
288 for(
int detectorIndex = 1; detectorIndex < 4; detectorIndex++ )
290 unsigned int curMask(0);
291 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
292 chamberMatch != muMatches_.end(); chamberMatch++ )
294 if(!(chamberMatch->station()==
stationIndex && chamberMatch->detector()==detectorIndex))
continue;
296 float edgeX = chamberMatch->edgeX;
297 float edgeY = chamberMatch->edgeY;
298 float xErr = chamberMatch->xErr+0.000001;
299 float yErr = chamberMatch->yErr+0.000001;
300 if(edgeX<0 && fabs(edgeX/xErr)>fabs(sigmaCut) &&
301 edgeY<0 && fabs(edgeY/yErr)>fabs(sigmaCut))
306 if( ( fabs(edgeX/xErr) < fabs(sigmaCut) && edgeY/yErr < fabs(sigmaCut) ) ||
307 ( fabs(edgeY/yErr) < fabs(sigmaCut) && edgeX/xErr < fabs(sigmaCut) ) )
318 int Muon::numberOfSegments(
int station,
int muonSubdetId, ArbitrationType type )
const
321 for( std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
322 chamberMatch != muMatches_.end(); chamberMatch++ )
324 if(chamberMatch->segmentMatches.empty())
continue;
325 if(!(chamberMatch->station()==station && chamberMatch->detector()==muonSubdetId))
continue;
327 if(type == NoArbitration) {
328 segments += chamberMatch->segmentMatches.size();
332 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = chamberMatch->segmentMatches.begin();
333 segmentMatch != chamberMatch->segmentMatches.end(); segmentMatch++ )
335 if(type == SegmentArbitration)
336 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR)) {
340 if(type == SegmentAndTrackArbitration)
341 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
342 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR)) {
346 if(type == SegmentAndTrackArbitrationCleaned)
347 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
348 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
349 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning)) {
354 if(segmentMatch->isMask(type)) {
364 const std::vector<const MuonChamberMatch*>
Muon::chambers(
int station,
int muonSubdetId )
const
366 std::vector<const MuonChamberMatch*>
chambers;
367 for(std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
368 chamberMatch != muMatches_.end(); chamberMatch++)
369 if(chamberMatch->station()==station && chamberMatch->detector()==muonSubdetId)
370 chambers.push_back(&(*chamberMatch));
374 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> Muon::pair(
const std::vector<const MuonChamberMatch*> &chambers,
375 ArbitrationType type )
const
379 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair(m,s);
381 if(chambers.empty())
return chamberSegmentPair;
382 for( std::vector<const MuonChamberMatch*>::const_iterator chamberMatch = chambers.begin();
383 chamberMatch != chambers.end(); chamberMatch++ )
385 if((*chamberMatch)->segmentMatches.empty())
continue;
386 if(type == NoArbitration)
387 return std::make_pair(*chamberMatch, &((*chamberMatch)->segmentMatches.front()));
389 for( std::vector<MuonSegmentMatch>::const_iterator segmentMatch = (*chamberMatch)->segmentMatches.begin();
390 segmentMatch != (*chamberMatch)->segmentMatches.end(); segmentMatch++ )
392 if(type == SegmentArbitration)
393 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR))
394 return std::make_pair(*chamberMatch, &(*segmentMatch));
395 if(type == SegmentAndTrackArbitration)
396 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
397 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR))
398 return std::make_pair(*chamberMatch, &(*segmentMatch));
399 if(type == SegmentAndTrackArbitrationCleaned)
400 if(segmentMatch->isMask(MuonSegmentMatch::BestInStationByDR) &&
401 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByDR) &&
402 segmentMatch->isMask(MuonSegmentMatch::BelongsToTrackByCleaning))
403 return std::make_pair(*chamberMatch, &(*segmentMatch));
405 if(segmentMatch->isMask(type))
406 return std::make_pair(*chamberMatch, &(*segmentMatch));
410 return chamberSegmentPair;
413 float Muon::dX(
int station,
int muonSubdetId, ArbitrationType type )
const
415 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
416 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
417 if(! chamberSegmentPair.second->hasPhi())
return 999999;
418 return chamberSegmentPair.first->x-chamberSegmentPair.second->x;
421 float Muon::dY(
int station,
int muonSubdetId, ArbitrationType type )
const
424 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
425 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
426 if(! chamberSegmentPair.second->hasZed())
return 999999;
427 return chamberSegmentPair.first->y-chamberSegmentPair.second->y;
430 float Muon::dDxDz(
int station,
int muonSubdetId, ArbitrationType type )
const
432 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
433 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
434 if(! chamberSegmentPair.second->hasPhi())
return 999999;
435 return chamberSegmentPair.first->dXdZ-chamberSegmentPair.second->dXdZ;
438 float Muon::dDyDz(
int station,
int muonSubdetId, ArbitrationType type )
const
441 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
442 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
443 if(! chamberSegmentPair.second->hasZed())
return 999999;
444 return chamberSegmentPair.first->dYdZ-chamberSegmentPair.second->dYdZ;
447 float Muon::pullX(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError )
const
449 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
450 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
451 if(! chamberSegmentPair.second->hasPhi())
return 999999;
452 if(includeSegmentError)
453 return (chamberSegmentPair.first->x-chamberSegmentPair.second->x)/
sqrt(
pow(chamberSegmentPair.first->xErr,2)+
pow(chamberSegmentPair.second->xErr,2));
454 return (chamberSegmentPair.first->x-chamberSegmentPair.second->x)/chamberSegmentPair.first->xErr;
457 float Muon::pullY(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError)
const
460 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
461 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
462 if(! chamberSegmentPair.second->hasZed())
return 999999;
463 if(includeSegmentError)
464 return (chamberSegmentPair.first->y-chamberSegmentPair.second->y)/
sqrt(
pow(chamberSegmentPair.first->yErr,2)+
pow(chamberSegmentPair.second->yErr,2));
465 return (chamberSegmentPair.first->y-chamberSegmentPair.second->y)/chamberSegmentPair.first->yErr;
468 float Muon::pullDxDz(
int station,
int muonSubdetId, ArbitrationType type,
bool includeSegmentError )
const
470 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
471 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
472 if(! chamberSegmentPair.second->hasPhi())
return 999999;
473 if(includeSegmentError)
474 return (chamberSegmentPair.first->dXdZ-chamberSegmentPair.second->dXdZ)/
sqrt(
pow(chamberSegmentPair.first->dXdZErr,2)+
pow(chamberSegmentPair.second->dXdZErr,2));
475 return (chamberSegmentPair.first->dXdZ-chamberSegmentPair.second->dXdZ)/chamberSegmentPair.first->dXdZErr;
478 float Muon::pullDyDz(
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==0 || chamberSegmentPair.second==0)
return 999999;
483 if(! chamberSegmentPair.second->hasZed())
return 999999;
484 if(includeSegmentError)
485 return (chamberSegmentPair.first->dYdZ-chamberSegmentPair.second->dYdZ)/
sqrt(
pow(chamberSegmentPair.first->dYdZErr,2)+
pow(chamberSegmentPair.second->dYdZErr,2));
486 return (chamberSegmentPair.first->dYdZ-chamberSegmentPair.second->dYdZ)/chamberSegmentPair.first->dYdZErr;
489 float Muon::segmentX(
int station,
int muonSubdetId, ArbitrationType type )
const
491 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
492 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
493 if(! chamberSegmentPair.second->hasPhi())
return 999999;
494 return chamberSegmentPair.second->x;
497 float Muon::segmentY(
int station,
int muonSubdetId, ArbitrationType type )
const
500 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
501 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
502 if(! chamberSegmentPair.second->hasZed())
return 999999;
503 return chamberSegmentPair.second->y;
506 float Muon::segmentDxDz(
int station,
int muonSubdetId, ArbitrationType type )
const
508 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
509 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
510 if(! chamberSegmentPair.second->hasPhi())
return 999999;
511 return chamberSegmentPair.second->dXdZ;
514 float Muon::segmentDyDz(
int station,
int muonSubdetId, ArbitrationType type )
const
517 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
518 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
519 if(! chamberSegmentPair.second->hasZed())
return 999999;
520 return chamberSegmentPair.second->dYdZ;
523 float Muon::segmentXErr(
int station,
int muonSubdetId, ArbitrationType type )
const
525 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
526 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
527 if(! chamberSegmentPair.second->hasPhi())
return 999999;
528 return chamberSegmentPair.second->xErr;
531 float Muon::segmentYErr(
int station,
int muonSubdetId, ArbitrationType type )
const
534 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
535 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
536 if(! chamberSegmentPair.second->hasZed())
return 999999;
537 return chamberSegmentPair.second->yErr;
540 float Muon::segmentDxDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const
542 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
543 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
544 if(! chamberSegmentPair.second->hasPhi())
return 999999;
545 return chamberSegmentPair.second->dXdZErr;
548 float Muon::segmentDyDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const
551 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(
chambers(station,muonSubdetId),type);
552 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0)
return 999999;
553 if(! chamberSegmentPair.second->hasZed())
return 999999;
554 return chamberSegmentPair.second->dYdZErr;
557 float Muon::trackEdgeX(
int station,
int muonSubdetId, ArbitrationType type )
const
559 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
560 if(muonChambers.empty())
return 999999;
562 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
563 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
565 float supVar = 999999;
566 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
567 muonChamber != muonChambers.end(); ++muonChamber) {
568 float currDist = (*muonChamber)->dist();
571 supVar = (*muonChamber)->edgeX;
575 }
else return chamberSegmentPair.first->edgeX;
578 float Muon::trackEdgeY(
int station,
int muonSubdetId, ArbitrationType type )
const
580 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
581 if(muonChambers.empty())
return 999999;
583 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
584 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
586 float supVar = 999999;
587 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
588 muonChamber != muonChambers.end(); ++muonChamber) {
589 float currDist = (*muonChamber)->dist();
592 supVar = (*muonChamber)->edgeY;
596 }
else return chamberSegmentPair.first->edgeY;
599 float Muon::trackX(
int station,
int muonSubdetId, ArbitrationType type )
const
601 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
602 if(muonChambers.empty())
return 999999;
604 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
605 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
607 float supVar = 999999;
608 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
609 muonChamber != muonChambers.end(); ++muonChamber) {
610 float currDist = (*muonChamber)->dist();
613 supVar = (*muonChamber)->x;
617 }
else return chamberSegmentPair.first->x;
620 float Muon::trackY(
int station,
int muonSubdetId, ArbitrationType type )
const
622 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
623 if(muonChambers.empty())
return 999999;
625 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
626 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
628 float supVar = 999999;
629 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
630 muonChamber != muonChambers.end(); ++muonChamber) {
631 float currDist = (*muonChamber)->dist();
634 supVar = (*muonChamber)->y;
638 }
else return chamberSegmentPair.first->y;
641 float Muon::trackDxDz(
int station,
int muonSubdetId, ArbitrationType type )
const
643 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
644 if(muonChambers.empty())
return 999999;
646 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
647 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
649 float supVar = 999999;
650 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
651 muonChamber != muonChambers.end(); ++muonChamber) {
652 float currDist = (*muonChamber)->dist();
655 supVar = (*muonChamber)->dXdZ;
659 }
else return chamberSegmentPair.first->dXdZ;
662 float Muon::trackDyDz(
int station,
int muonSubdetId, ArbitrationType type )
const
664 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
665 if(muonChambers.empty())
return 999999;
667 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
668 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
670 float supVar = 999999;
671 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
672 muonChamber != muonChambers.end(); ++muonChamber) {
673 float currDist = (*muonChamber)->dist();
676 supVar = (*muonChamber)->dYdZ;
680 }
else return chamberSegmentPair.first->dYdZ;
683 float Muon::trackXErr(
int station,
int muonSubdetId, ArbitrationType type )
const
685 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
686 if(muonChambers.empty())
return 999999;
688 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
689 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
691 float supVar = 999999;
692 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
693 muonChamber != muonChambers.end(); ++muonChamber) {
694 float currDist = (*muonChamber)->dist();
697 supVar = (*muonChamber)->xErr;
701 }
else return chamberSegmentPair.first->xErr;
704 float Muon::trackYErr(
int station,
int muonSubdetId, ArbitrationType type )
const
706 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
707 if(muonChambers.empty())
return 999999;
709 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
710 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
712 float supVar = 999999;
713 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
714 muonChamber != muonChambers.end(); ++muonChamber) {
715 float currDist = (*muonChamber)->dist();
718 supVar = (*muonChamber)->yErr;
722 }
else return chamberSegmentPair.first->yErr;
725 float Muon::trackDxDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const
727 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
728 if(muonChambers.empty())
return 999999;
730 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
731 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
733 float supVar = 999999;
734 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
735 muonChamber != muonChambers.end(); ++muonChamber) {
736 float currDist = (*muonChamber)->dist();
739 supVar = (*muonChamber)->dXdZErr;
743 }
else return chamberSegmentPair.first->dXdZErr;
746 float Muon::trackDyDzErr(
int station,
int muonSubdetId, ArbitrationType type )
const
748 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
749 if(muonChambers.empty())
return 999999;
751 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
752 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
754 float supVar = 999999;
755 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
756 muonChamber != muonChambers.end(); ++muonChamber) {
757 float currDist = (*muonChamber)->dist();
760 supVar = (*muonChamber)->dYdZErr;
764 }
else return chamberSegmentPair.first->dYdZErr;
767 float Muon::trackDist(
int station,
int muonSubdetId, ArbitrationType type )
const
769 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
770 if(muonChambers.empty())
return 999999;
772 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
773 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
775 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
776 muonChamber != muonChambers.end(); ++muonChamber) {
777 float currDist = (*muonChamber)->dist();
778 if(currDist<dist) dist = currDist;
781 }
else return chamberSegmentPair.first->dist();
784 float Muon::trackDistErr(
int station,
int muonSubdetId, ArbitrationType type )
const
786 const std::vector<const MuonChamberMatch*> muonChambers =
chambers(station, muonSubdetId);
787 if(muonChambers.empty())
return 999999;
789 std::pair<const MuonChamberMatch*,const MuonSegmentMatch*> chamberSegmentPair = pair(muonChambers,type);
790 if(chamberSegmentPair.first==0 || chamberSegmentPair.second==0) {
792 float supVar = 999999;
793 for(std::vector<const MuonChamberMatch*>::const_iterator muonChamber = muonChambers.begin();
794 muonChamber != muonChambers.end(); ++muonChamber) {
795 float currDist = (*muonChamber)->dist();
798 supVar = (*muonChamber)->distErr();
802 }
else return chamberSegmentPair.first->distErr();
807 isolationR03_ = isoR03;
808 isolationR05_ = isoR05;
809 isolationValid_ =
true;
815 if(label==
"pfIsolationR03")
816 pfIsolationR03_ = deposit;
818 if(label==
"pfIsolationR04")
819 pfIsolationR04_ = deposit;
821 if(label==
"pfIsoMeanDRProfileR03")
822 pfIsoMeanDRR03_ = deposit;
824 if(label==
"pfIsoMeanDRProfileR04")
825 pfIsoMeanDRR04_ = deposit;
827 if(label==
"pfIsoSumDRProfileR03")
828 pfIsoSumDRR03_ = deposit;
830 if(label==
"pfIsoSumDRProfileR04")
831 pfIsoSumDRR04_ = deposit;
833 pfIsolationValid_ =
true;
840 type_ = type_ | PFMuon;
845 void Muon::setOuterTrack(
const TrackRef &
t ) { outerTrack_ =
t; }
846 void Muon::setInnerTrack(
const TrackRef &
t ) { innerTrack_ =
t; }
847 void Muon::setTrack(
const TrackRef &
t ) { setInnerTrack(t); }
848 void Muon::setStandAlone(
const TrackRef &
t ) { setOuterTrack(t); }
849 void Muon::setGlobalTrack(
const TrackRef &
t ) { globalTrack_ =
t; }
850 void Muon::setCombined(
const TrackRef &
t ) { setGlobalTrack(t); }
853 bool Muon::isAValidMuonTrack(
const MuonTrackType& type)
const{
854 return muonTrack(type).isNonnull();
861 case CombinedTrack:
return globalTrack();
862 case TPFMS:
return tpfmsTrack();
863 case Picky:
return pickyTrack();
864 case DYT:
return dytTrack();
865 default:
return muonTrackFromMap(type);
872 case InnerTrack: setInnerTrack(t);
break;
873 case OuterTrack: setStandAlone(t);
break;
874 case CombinedTrack: setGlobalTrack(t);
break;
875 default: refittedTrackMap_[
type] =
t;
break;
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
math::XYZTLorentzVector LorentzVector
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
virtual bool overlap(const Candidate &) const
check overlap with another Candidate
math::XYZTLorentzVector LorentzVector
Lorentz vector.
virtual LeafCandidate * clone() const
returns a clone of the Candidate object
static char chambers[264][20]
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
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.