Skip to content

Commit

Permalink
Fix LRT muon selection and PRW (#1660)
Browse files Browse the repository at this point in the history
* remove forward slash

* add WP check for LRT muons

* clean up logic

* BIG cleanup

* Remove brace

---------

Co-authored-by: Sagar Addepalli <addepalli.sagar@cern.ch>
  • Loading branch information
SagarA17 and Sagar Addepalli committed Oct 20, 2023
1 parent 0111e8c commit 577178c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Root/BasicEventSelection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ StatusCode BasicEventSelection::autoconfigurePileupRWTool()
std::vector<std::string> prwConfigFiles;
for(const auto& mcCampaign : mcCampaignList)
{
std::string prwConfigFile = PathResolverFindCalibFile("/dev/PileupReweighting/share/DSID" + std::to_string(DSID_INT/1000) +"xxx/pileup_" + mcCampaign + "_dsid" + std::to_string(DSID_INT) + "_" + SimulationFlavour + ".root");
std::string prwConfigFile = PathResolverFindCalibFile("dev/PileupReweighting/share/DSID" + std::to_string(DSID_INT/1000) +"xxx/pileup_" + mcCampaign + "_dsid" + std::to_string(DSID_INT) + "_" + SimulationFlavour + ".root");
TFile testF(prwConfigFile.data(),"read");
if(testF.IsZombie())
{
Expand Down
25 changes: 8 additions & 17 deletions Root/MuonSelector.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -796,30 +796,21 @@ int MuonSelector :: passCuts( const xAOD::Muon* muon, const xAOD::Vertex *primar
isMediumQDecor( *muon ) = ( this_quality <= static_cast<int>(xAOD::Muon::Medium) ) ? 1 : 0;
isTightQDecor( *muon ) = ( this_quality <= static_cast<int>(xAOD::Muon::Tight) ) ? 1 : 0;

bool LRTdecorIsAvailable = false;
bool muonIsLRT = false;
bool AcceptPromptMuon = (bool)m_muonSelectionTool_handle->accept( *muon );
bool acceptMuon = (bool)m_muonSelectionTool_handle->accept( *muon );

if ( m_doLRT ){
if ( m_doLRT ) {
static SG::AuxElement::Decorator< char > passIDcuts("passIDcuts");
static SG::AuxElement::Accessor< char > isLRTmuon("isLRT");
passIDcuts( *muon ) = m_muonSelectionTool_handle->passedIDCuts( *muon ) ? 1 : 0;
LRTdecorIsAvailable = isLRTmuon.isAvailable(*muon);
muonIsLRT = isLRTmuon(*muon) > 0.5;
if ( isLRTmuon.isAvailable(*muon) && isLRTmuon(*muon) ) { //checks if a muon is LRT
acceptMuon = this_quality <= m_muonQuality; //LRT WP do not have the ID cuts applied so use getQuality()
}
}

ANA_MSG_DEBUG( "Doing muon quality" );
if ( !m_doLRT ){
if( !AcceptPromptMuon ){
ANA_MSG_DEBUG( "Muon failed requirements of MuonSelectionTool.");
return 0;
}
}
else {
if ( (!LRTdecorIsAvailable && !AcceptPromptMuon) || (LRTdecorIsAvailable && !muonIsLRT && !AcceptPromptMuon) ) {
ANA_MSG_DEBUG( "Muon failed requirements of MuonSelectionTool.");
return 0;
}
if ( !acceptMuon ) {
ANA_MSG_DEBUG( "Muon failed requirements of MuonSelectionTool.");
return 0;
}

if (!m_isUsedBefore && m_useCutFlow) m_mu_cutflowHist_1->Fill( m_mu_cutflow_eta_and_quaility_cut, 1 );
Expand Down

0 comments on commit 577178c

Please sign in to comment.