diff --git a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.cxx index aa111b3dae92cd2448224ece7271d5bae343877f..20699ef3f956f63f3943a56050406986207524d1 100644 --- a/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.cxx +++ b/Reconstruction/MuonIdentification/MuonCombinedBaseTools/src/MuonDressingTool.cxx @@ -89,16 +89,30 @@ namespace MuonCombined { uint8_t etaLayer3Holes = 0; uint8_t etaLayer4Holes = 0; + uint8_t innerCloseHits = 0; + uint8_t middleCloseHits = 0; + uint8_t outerCloseHits = 0; + uint8_t extendedCloseHits = 0; + + uint8_t innerOutBoundsHits = 0; + uint8_t middleOutBoundsHits = 0; + uint8_t outerOutBoundsHits = 0; + uint8_t extendedOutBoundsHits = 0; + + uint8_t combinedTrackOutBoundsHits = 0; + uint8_t numberOfPrecisionLayers = 0; uint8_t numberOfPrecisionHoleLayers = 0; uint8_t numberOfPhiLayers = 0; uint8_t numberOfPhiHoleLayers = 0; uint8_t numberOfTriggerEtaLayers = 0; uint8_t numberOfTriggerEtaHoleLayers = 0; - - uint8_t nearbyHitsInner = 0; - uint8_t nearbyHitsMiddle = 0; - uint8_t nearbyHitsOuter = 0; + uint8_t numberOfGoodPrecisionLayers = 0; + + uint8_t isEndcap = 0; + uint8_t isSmall = 0; + + const Trk::TrackSummary* mstpTrackSummary=0; if( !trackSummary ){ // get link to track particle @@ -106,8 +120,8 @@ namespace MuonCombined { if( !tpLink.isValid() ) tpLink = muon.muonSpectrometerTrackParticleLink(); if( tpLink.isValid() ){ - // check link to track - if( (*tpLink)->trackLink().isValid() ) trackSummary = (*tpLink)->track()->trackSummary(); + // check link to track + if( (*tpLink)->trackLink().isValid() ) trackSummary = (*tpLink)->track()->trackSummary(); } } @@ -117,7 +131,7 @@ namespace MuonCombined { mainSector = summary.mainSector; secondSector = mainSector; for( auto sec : summary.sectors ){ - if( sec != summary.mainSector ) secondSector = sec; + if( sec != summary.mainSector ) secondSector = sec; } numberOfPrecisionLayers = summary.nprecisionLayers; @@ -126,134 +140,167 @@ namespace MuonCombined { numberOfPhiHoleLayers = summary.nphiHoleLayers; numberOfTriggerEtaLayers = summary.ntrigEtaLayers; numberOfTriggerEtaHoleLayers = summary.ntrigEtaHoleLayers; + numberOfGoodPrecisionLayers = summary.nprecisionGoodLayers; + //std::cout<<"isEndcap starts as "<<(int)isEndcap<<" and isSmall as "<<(int)isSmall<<std::endl; + if(summary.isEndcap){ isEndcap=1; /*std::cout<<"now, isEndcap is "<<(int)isEndcap<<std::endl;*/} + if(summary.isSmall){ isSmall=1; /*std::cout<<"now, isSmall is "<<(int)isSmall<<std::endl;*/} + + for(auto layer : summary.stationLayers){ + combinedTrackOutBoundsHits+=layer.second.noutBoundsHits; + if(layer.first==Muon::MuonStationIndex::BI || layer.first==Muon::MuonStationIndex::EI){ + innerCloseHits+=layer.second.nprecisionCloseHits; + } + if(layer.first==Muon::MuonStationIndex::BM || layer.first==Muon::MuonStationIndex::EM){ + middleCloseHits+=layer.second.nprecisionCloseHits; + } + if(layer.first==Muon::MuonStationIndex::BO || layer.first==Muon::MuonStationIndex::EO){ + outerCloseHits+=layer.second.nprecisionCloseHits; + } + if(layer.first==Muon::MuonStationIndex::BE || layer.first==Muon::MuonStationIndex::EE){ + extendedCloseHits+=layer.second.nprecisionCloseHits; + } + } + + //get out-of-bounds from ME track, shouldn't be any on combined track anyway + ElementLink< xAOD::TrackParticleContainer > mstpLink = muon.muonSpectrometerTrackParticleLink(); + if(mstpLink.isValid()){ + if( (*mstpLink)->trackLink().isValid() ) mstpTrackSummary = (*mstpLink)->track()->trackSummary(); + + if(mstpTrackSummary){ + for(auto layer : m_hitSummaryTool->summary(*mstpTrackSummary).stationLayers){ + if(layer.first==Muon::MuonStationIndex::BI || layer.first==Muon::MuonStationIndex::EI){ + innerOutBoundsHits+=layer.second.noutBoundsHits; + } + if(layer.first==Muon::MuonStationIndex::BM || layer.first==Muon::MuonStationIndex::EM){ + middleOutBoundsHits+=layer.second.noutBoundsHits; + } + if(layer.first==Muon::MuonStationIndex::BO || layer.first==Muon::MuonStationIndex::EO){ + outerOutBoundsHits+=layer.second.noutBoundsHits; + } + if(layer.first==Muon::MuonStationIndex::BE || layer.first==Muon::MuonStationIndex::EE){ + extendedOutBoundsHits+=layer.second.noutBoundsHits; + } + } + } + } // hack for now to get hit counts onto the track particle ElementLink< xAOD::TrackParticleContainer > tpLink = muon.combinedTrackParticleLink(); if( !tpLink.isValid() ) tpLink = muon.muonSpectrometerTrackParticleLink(); if( tpLink.isValid() ){ - xAOD::TrackParticle* tp = const_cast<xAOD::TrackParticle*>(*tpLink); - if( tp ){ - uint8_t numberOfPrecisionLayers = summary.nprecisionLayers; - uint8_t numberOfPrecisionHoleLayers = summary.nprecisionHoleLayers; - uint8_t numberOfPhiLayers = summary.nphiLayers; - uint8_t numberOfPhiHoleLayers = summary.nphiHoleLayers; - uint8_t numberOfTriggerEtaLayers = summary.ntrigEtaLayers; - uint8_t numberOfTriggerEtaHoleLayers = summary.ntrigEtaHoleLayers; - tp->setSummaryValue(numberOfPrecisionLayers,xAOD::numberOfPrecisionLayers); - tp->setSummaryValue(numberOfPrecisionHoleLayers,xAOD::numberOfPrecisionHoleLayers); - tp->setSummaryValue(numberOfPhiLayers,xAOD::numberOfPhiLayers); - tp->setSummaryValue(numberOfPhiHoleLayers,xAOD::numberOfPhiHoleLayers); - tp->setSummaryValue(numberOfTriggerEtaLayers,xAOD::numberOfTriggerEtaLayers); - tp->setSummaryValue(numberOfTriggerEtaHoleLayers,xAOD::numberOfTriggerEtaHoleLayers); - } + xAOD::TrackParticle* tp = const_cast<xAOD::TrackParticle*>(*tpLink); + if( tp ){ + uint8_t numberOfPrecisionLayers = summary.nprecisionLayers; + uint8_t numberOfPrecisionHoleLayers = summary.nprecisionHoleLayers; + uint8_t numberOfPhiLayers = summary.nphiLayers; + uint8_t numberOfPhiHoleLayers = summary.nphiHoleLayers; + uint8_t numberOfTriggerEtaLayers = summary.ntrigEtaLayers; + uint8_t numberOfTriggerEtaHoleLayers = summary.ntrigEtaHoleLayers; + tp->setSummaryValue(numberOfPrecisionLayers,xAOD::numberOfPrecisionLayers); + tp->setSummaryValue(numberOfPrecisionHoleLayers,xAOD::numberOfPrecisionHoleLayers); + tp->setSummaryValue(numberOfPhiLayers,xAOD::numberOfPhiLayers); + tp->setSummaryValue(numberOfPhiHoleLayers,xAOD::numberOfPhiHoleLayers); + tp->setSummaryValue(numberOfTriggerEtaLayers,xAOD::numberOfTriggerEtaLayers); + tp->setSummaryValue(numberOfTriggerEtaHoleLayers,xAOD::numberOfTriggerEtaHoleLayers); + } } if( trackSummary->muonTrackSummary() ){ - const Trk::MuonTrackSummary& mts = *trackSummary->muonTrackSummary(); + const Trk::MuonTrackSummary& mts = *trackSummary->muonTrackSummary(); - // loop over chambers - std::vector<Trk::MuonTrackSummary::ChamberHitSummary>::const_iterator chit = mts.chamberHitSummary().begin(); - std::vector<Trk::MuonTrackSummary::ChamberHitSummary>::const_iterator chit_end = mts.chamberHitSummary().end(); - for( ;chit!=chit_end;++chit ) { - const Identifier& chId = chit->chamberId(); - bool isMdt = m_idHelper->isMdt(chId); - bool isCsc = m_idHelper->isCsc(chId); - bool isMM = m_idHelper->isMM(chId); - bool issTgc = m_idHelper->issTgc(chId); - - if( isMdt || isMM || isCsc || issTgc ){ - Muon::MuonStationIndex::ChIndex index = m_idHelper->chamberIndex(chId); - uint8_t* hits = 0; - uint8_t* holes = 0; - - + // loop over chambers + std::vector<Trk::MuonTrackSummary::ChamberHitSummary>::const_iterator chit = mts.chamberHitSummary().begin(); + std::vector<Trk::MuonTrackSummary::ChamberHitSummary>::const_iterator chit_end = mts.chamberHitSummary().end(); + for( ;chit!=chit_end;++chit ) { + const Identifier& chId = chit->chamberId(); + bool isMdt = m_idHelper->isMdt(chId); + bool isCsc = m_idHelper->isCsc(chId); + bool isMM = m_idHelper->isMM(chId); + bool issTgc = m_idHelper->issTgc(chId); + if( isMdt || isMM || isCsc || issTgc ){ + Muon::MuonStationIndex::ChIndex index = m_idHelper->chamberIndex(chId); + uint8_t* hits = 0; + uint8_t* holes = 0; if( index == Muon::MuonStationIndex::BIS || index == Muon::MuonStationIndex::EIS || index == Muon::MuonStationIndex::CSS ) { - hits = &innerSmallHits; - holes = &innerSmallHoles; - nearbyHitsInner+=chit->ncloseHits(); - }else if( index == Muon::MuonStationIndex::BIL || index == Muon::MuonStationIndex::EIL || index == Muon::MuonStationIndex::CSL ){ - hits = &innerLargeHits; - holes = &innerLargeHoles; - nearbyHitsInner+=chit->ncloseHits(); - }else if( index == Muon::MuonStationIndex::BMS || index == Muon::MuonStationIndex::EMS ){ - hits = &middleSmallHits; - holes = &middleSmallHoles; - nearbyHitsMiddle+=chit->ncloseHits(); - }else if( index == Muon::MuonStationIndex::BML || index == Muon::MuonStationIndex::EML ){ - hits = &middleLargeHits; - holes = &middleLargeHoles; - nearbyHitsMiddle+=chit->ncloseHits(); - }else if( index == Muon::MuonStationIndex::BOS || index == Muon::MuonStationIndex::EOS ){ - hits = &outerSmallHits; - holes = &outerSmallHoles; - nearbyHitsOuter+=chit->ncloseHits(); - }else if( index == Muon::MuonStationIndex::BOL || index == Muon::MuonStationIndex::EOL ){ - hits = &outerLargeHits; - holes = &outerLargeHoles; - nearbyHitsOuter+=chit->ncloseHits(); - }else if( index == Muon::MuonStationIndex::BEE || index == Muon::MuonStationIndex::EES ){ - hits = &extendedSmallHits; - holes = &extendedSmallHoles; - nearbyHitsMiddle+=chit->ncloseHits(); - }else if( index == Muon::MuonStationIndex::EEL ){ - hits = &extendedLargeHits; - holes = &extendedLargeHoles; - nearbyHitsMiddle+=chit->ncloseHits(); - }else{ - ATH_MSG_WARNING("Unknown ChamberIndex" << Muon::MuonStationIndex::chName(index) ); - } - if( hits ){ - if(isMdt) { - *hits += chit->nhits(); - *holes += chit->nholes(); - } else { - *hits += chit->netaHits(); - *holes += chit->etaProjection().nholes; - } - } - } - if( !isMdt && !isMM ){ - - uint8_t* phiHits = 0; - uint8_t* phiHoles = 0; - uint8_t* etaHits = 0; - uint8_t* etaHoles = 0; - Muon::MuonStationIndex::PhiIndex index = m_idHelper->phiIndex(chId); - if( index == Muon::MuonStationIndex::BM1 || index == Muon::MuonStationIndex::T4 || - index == Muon::MuonStationIndex::CSC || index == Muon::MuonStationIndex::STGC1 || - index == Muon::MuonStationIndex::STGC2 ) { - phiHits = &phiLayer1Hits; - phiHoles = &phiLayer1Holes; - etaHits = &etaLayer1Hits; - etaHoles = &etaLayer1Holes; - }else if( index == Muon::MuonStationIndex::BM2 || index == Muon::MuonStationIndex::T1 ){ - phiHits = &phiLayer2Hits; - phiHoles = &phiLayer2Holes; - etaHits = &etaLayer2Hits; - etaHoles = &etaLayer2Holes; - }else if( index == Muon::MuonStationIndex::BO1 || index == Muon::MuonStationIndex::T2 ){ - phiHits = &phiLayer3Hits; - phiHoles = &phiLayer3Holes; - etaHits = &etaLayer3Hits; - etaHoles = &etaLayer3Holes; - }else if( index == Muon::MuonStationIndex::T3 ){ - phiHits = &phiLayer4Hits; - phiHoles = &phiLayer4Holes; - etaHits = &etaLayer4Hits; - etaHoles = &etaLayer4Holes; - }else{ - ATH_MSG_WARNING("Unknown ChamberIndex" << Muon::MuonStationIndex::phiName(index) ); - } - if( phiHits ){ - *phiHits += chit->nphiHits(); - *phiHoles += chit->phiProjection().nholes; - } - if( etaHits && !isCsc && !issTgc ){ - *etaHits += chit->netaHits(); - *etaHoles += chit->etaProjection().nholes; - } - } - } + hits = &innerSmallHits; + holes = &innerSmallHoles; + }else if( index == Muon::MuonStationIndex::BIL || index == Muon::MuonStationIndex::EIL || index == Muon::MuonStationIndex::CSL ){ + hits = &innerLargeHits; + holes = &innerLargeHoles; + }else if( index == Muon::MuonStationIndex::BMS || index == Muon::MuonStationIndex::EMS ){ + hits = &middleSmallHits; + holes = &middleSmallHoles; + }else if( index == Muon::MuonStationIndex::BML || index == Muon::MuonStationIndex::EML ){ + hits = &middleLargeHits; + holes = &middleLargeHoles; + }else if( index == Muon::MuonStationIndex::BOS || index == Muon::MuonStationIndex::EOS ){ + hits = &outerSmallHits; + holes = &outerSmallHoles; + }else if( index == Muon::MuonStationIndex::BOL || index == Muon::MuonStationIndex::EOL ){ + hits = &outerLargeHits; + holes = &outerLargeHoles; + }else if( index == Muon::MuonStationIndex::BEE || index == Muon::MuonStationIndex::EES ){ + hits = &extendedSmallHits; + holes = &extendedSmallHoles; + }else if( index == Muon::MuonStationIndex::EEL ){ + hits = &extendedLargeHits; + holes = &extendedLargeHoles; + }else{ + ATH_MSG_WARNING("Unknown ChamberIndex" << Muon::MuonStationIndex::chName(index) ); + } + if( hits ){ + if(isMdt){ + *hits += chit->nhits(); + *holes += chit->nholes(); + } + else{ + *hits += chit->netaHits(); + *holes += chit->etaProjection().nholes; + } + } + } + if( !isMdt && !isMM ){ + + uint8_t* phiHits = 0; + uint8_t* phiHoles = 0; + uint8_t* etaHits = 0; + uint8_t* etaHoles = 0; + Muon::MuonStationIndex::PhiIndex index = m_idHelper->phiIndex(chId); + if( index == Muon::MuonStationIndex::BM1 || index == Muon::MuonStationIndex::T4 || + index == Muon::MuonStationIndex::CSC || index == Muon::MuonStationIndex::STGC1 || + index == Muon::MuonStationIndex::STGC2 ) { + phiHits = &phiLayer1Hits; + phiHoles = &phiLayer1Holes; + etaHits = &etaLayer1Hits; + etaHoles = &etaLayer1Holes; + }else if( index == Muon::MuonStationIndex::BM2 || index == Muon::MuonStationIndex::T1 ){ + phiHits = &phiLayer2Hits; + phiHoles = &phiLayer2Holes; + etaHits = &etaLayer2Hits; + etaHoles = &etaLayer2Holes; + }else if( index == Muon::MuonStationIndex::BO1 || index == Muon::MuonStationIndex::T2 ){ + phiHits = &phiLayer3Hits; + phiHoles = &phiLayer3Holes; + etaHits = &etaLayer3Hits; + etaHoles = &etaLayer3Holes; + }else if( index == Muon::MuonStationIndex::T3 ){ + phiHits = &phiLayer4Hits; + phiHoles = &phiLayer4Holes; + etaHits = &etaLayer4Hits; + etaHoles = &etaLayer4Holes; + }else{ + ATH_MSG_WARNING("Unknown ChamberIndex" << Muon::MuonStationIndex::phiName(index) ); + } + if( phiHits ){ + *phiHits += chit->nphiHits(); + *phiHoles += chit->phiProjection().nholes; + } + if( etaHits && !isCsc && !issTgc ){ + *etaHits += chit->netaHits(); + *etaHoles += chit->etaProjection().nholes; + } + } + } } } @@ -263,6 +310,7 @@ namespace MuonCombined { muon.setSummaryValue(numberOfPhiHoleLayers,xAOD::numberOfPhiHoleLayers); muon.setSummaryValue(numberOfTriggerEtaLayers,xAOD::numberOfTriggerEtaLayers); muon.setSummaryValue(numberOfTriggerEtaHoleLayers,xAOD::numberOfTriggerEtaHoleLayers); + muon.setSummaryValue(numberOfGoodPrecisionLayers,xAOD::numberOfGoodPrecisionLayers); muon.setSummaryValue(mainSector,xAOD::primarySector); muon.setSummaryValue(secondSector,xAOD::secondarySector); @@ -284,10 +332,6 @@ namespace MuonCombined { muon.setSummaryValue(extendedSmallHoles,xAOD::extendedSmallHoles); muon.setSummaryValue(extendedLargeHoles,xAOD::extendedLargeHoles); - muon.setParameter(nearbyHitsInner,xAOD::Muon::NearbyHitsInner); - muon.setParameter(nearbyHitsMiddle,xAOD::Muon::NearbyHitsMiddle); - muon.setParameter(nearbyHitsOuter,xAOD::Muon::NearbyHitsOuter); - muon.setSummaryValue(phiLayer1Hits,xAOD::phiLayer1Hits); muon.setSummaryValue(phiLayer2Hits,xAOD::phiLayer2Hits); muon.setSummaryValue(phiLayer3Hits,xAOD::phiLayer3Hits); @@ -308,6 +352,21 @@ namespace MuonCombined { muon.setSummaryValue(etaLayer3Holes,xAOD::etaLayer3Holes); muon.setSummaryValue(etaLayer4Holes,xAOD::etaLayer4Holes); + muon.setSummaryValue(innerCloseHits,xAOD::innerClosePrecisionHits); + muon.setSummaryValue(middleCloseHits,xAOD::middleClosePrecisionHits); + muon.setSummaryValue(outerCloseHits,xAOD::outerClosePrecisionHits); + muon.setSummaryValue(extendedCloseHits,xAOD::extendedClosePrecisionHits); + + muon.setSummaryValue(innerOutBoundsHits,xAOD::innerOutBoundsPrecisionHits); + muon.setSummaryValue(middleOutBoundsHits,xAOD::middleOutBoundsPrecisionHits); + muon.setSummaryValue(outerOutBoundsHits,xAOD::outerOutBoundsPrecisionHits); + muon.setSummaryValue(extendedOutBoundsHits,xAOD::extendedOutBoundsPrecisionHits); + + muon.setSummaryValue(combinedTrackOutBoundsHits,xAOD::combinedTrackOutBoundsPrecisionHits); + + muon.setSummaryValue(isEndcap,xAOD::isEndcapGoodLayers); + muon.setSummaryValue(isSmall,xAOD::isSmallGoodSectors); + } } // end of namespace