Skip to content

Commit

Permalink
updates for Trigger-Level Analyses (#1676)
Browse files Browse the repository at this point in the history
Changes needed in the dijet+ISR Trigger Level Analysis (TLA) which makes heavy use of xAH. They will also be necessary for other later trigger level analyses:

* changes to JetCalibrator for correcting HLT jets (new options for setting up JetCalibrationTool, yet to be upstreamed in Athena but planned)
* more functionality for filling TProfile & TH3 objects with HistogramManager
* changes to handling of photon containers in OverlapRemover, only for checking existence in TStore when deep/shallow copies exist
* changes to BasicEventSelection adding a TLA data flag to control how trigger decisions are checked (from some differences between trigger decisions stored in 2022 TLA data & the primary physics data stream)
---------

Co-authored-by: agekow <alex.gekow@cern.ch>
Co-authored-by: mamerl <maximilian.amerl@cern.ch>
  • Loading branch information
3 people committed Feb 16, 2024
1 parent 7e8797c commit 533c696
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 51 deletions.
67 changes: 42 additions & 25 deletions Root/BasicEventSelection.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,19 @@ EL::StatusCode BasicEventSelection :: execute ()

if ( m_applyTriggerCut ) {

if ( !triggerChainGroup->isPassed() ) {
// additional DEBUG logging to validate conditional logic
ANA_MSG_DEBUG("Applying trigger cut corresponding to chain group " << m_triggerSelection);
ANA_MSG_DEBUG("Is Trigger-Level Analysis (TLA) data = " << int(m_isTLAData));
ANA_MSG_DEBUG("Trigger chain group is passed = " << int(m_isTLAData ? triggerChainGroup->isPassed(TrigDefs::requireDecision) : triggerChainGroup->isPassed()));

// different behaviour for isPassed depending on whether you are running on TLA data or not
// if running on TLA data, we only store the HLT part of the trigger decision i.e. the L1 part
// will always be "false", so we need to use TrigDefs::requireDecision to limit the decision
// to being satisfied by the HLT leg(s) of the trigger chain
// TODO: check performance of this method when using trigger chains with the SAME HLT leg but different L1 seed
// e.g. HLT_j20_pf_ftf_L1J100 vs. HLT_j20_pf_ftf_L1HT190-J15s5pETA21
if ( (m_isTLAData && !triggerChainGroup->isPassed(TrigDefs::requireDecision)) || (!m_isTLAData && !triggerChainGroup->isPassed()) ) {
// if (!triggerChainGroup->isPassed(TrigDefs::requireDecision)) {
wk()->skipEvent();
return EL::StatusCode::SUCCESS;
}
Expand All @@ -986,7 +998,7 @@ EL::StatusCode BasicEventSelection :: execute ()
//
for ( auto &trigName : triggerChainGroup->getListOfTriggers() ) {
auto trigChain = m_trigDecTool_handle->getChainGroup( trigName );
if ( trigChain->isPassed() ) {
if ( (m_isTLAData && trigChain->isPassed(TrigDefs::requireDecision)) || (!m_isTLAData && trigChain->isPassed()) ) {
passedTriggers.push_back( trigName );
triggerPrescales.push_back( trigChain->getPrescale() );

Expand All @@ -999,33 +1011,34 @@ EL::StatusCode BasicEventSelection :: execute ()
}
isPassedBitsNames.push_back( trigName );
isPassedBits .push_back( m_trigDecTool_handle->isPassedBits(trigName) );
if(trigChain->getPrescale()<1) disabledTriggers.push_back( trigName );
if(trigChain->getPrescale()<1) disabledTriggers.push_back( trigName );
}

// Save info for extra triggers
//
if ( !m_extraTriggerSelection.empty() ) {

for ( const std::string &trigName : m_extraTriggerSelectionList ) {
auto trigChain = m_trigDecTool_handle->getChainGroup( trigName );
if ( trigChain->isPassed() ) {
passedTriggers.push_back( trigName );
triggerPrescales.push_back( trigChain->getPrescale() );

bool doLumiPrescale = true;
for ( const std::string &trigPart : trigChain->getListOfTriggers() ) {
if (std::find(m_triggerUnprescaleList.begin(), m_triggerUnprescaleList.end(), trigPart) == m_triggerUnprescaleList.end()) doLumiPrescale = false;
}
if ( doLumiPrescale ) {
triggerPrescalesLumi.push_back( m_pileup_tool_handle->getDataWeight( *eventInfo, trigName, true ) );
} else {
triggerPrescalesLumi.push_back( -1 );
}
}
isPassedBitsNames.push_back( trigName );
isPassedBits .push_back( m_trigDecTool_handle->isPassedBits(trigName) );
if(trigChain->getPrescale()<1) disabledTriggers.push_back( trigName );
}

for ( const std::string &trigName : m_extraTriggerSelectionList ) {
auto trigChain = m_trigDecTool_handle->getChainGroup( trigName );
if ( (m_isTLAData && trigChain->isPassed(TrigDefs::requireDecision)) || (!m_isTLAData && trigChain->isPassed()) ) {
passedTriggers.push_back( trigName );
triggerPrescales.push_back( trigChain->getPrescale() );

bool doLumiPrescale = true;
for ( const std::string &trigPart : trigChain->getListOfTriggers() ) {
if (std::find(m_triggerUnprescaleList.begin(), m_triggerUnprescaleList.end(), trigPart) == m_triggerUnprescaleList.end()) doLumiPrescale = false;
}
if ( doLumiPrescale ) {
triggerPrescalesLumi.push_back( m_pileup_tool_handle->getDataWeight( *eventInfo, trigName, true ) );
} else {
triggerPrescalesLumi.push_back( -1 );
}
}

isPassedBitsNames.push_back( trigName );
isPassedBits .push_back( m_trigDecTool_handle->isPassedBits(trigName) );
if(trigChain->getPrescale()<1) disabledTriggers.push_back( trigName );
}
}

static SG::AuxElement::Decorator< std::vector< std::string > > dec_passedTriggers("passedTriggers");
Expand Down Expand Up @@ -1054,7 +1067,11 @@ EL::StatusCode BasicEventSelection :: execute ()
}
if ( m_storePassHLT ) {
static SG::AuxElement::Decorator< int > passHLT("passHLT");
passHLT(*eventInfo) = ( m_triggerSelection.find("HLT_") != std::string::npos ) ? (int)m_trigDecTool_handle->isPassed(m_triggerSelection.c_str()) : -1;
if (!m_isTLAData) {
passHLT(*eventInfo) = ( m_triggerSelection.find("HLT_") != std::string::npos ) ? (int)m_trigDecTool_handle->isPassed(m_triggerSelection.c_str()) : -1;
} else {
passHLT(*eventInfo) = ( m_triggerSelection.find("HLT_") != std::string::npos ) ? (int)m_trigDecTool_handle->isPassed(m_triggerSelection.c_str(), TrigDefs::requireDecision) : -1;
}
}

} // if giving a specific list of triggers to look at
Expand Down
26 changes: 26 additions & 0 deletions Root/HistogramManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,29 @@ void HistogramManager::fillHist(const std::string& histName, double valueX, doub
}
histPointer->Fill(valueX, valueY, weight);
}

void HistogramManager::fillHist(const std::string& histName, double valueX, double valueY, double valueZ, double weight) {
TH3* histPointer(NULL);
HistMap_t::const_iterator it = m_histMap.find( histName );
if ( it == m_histMap.end() ) {
ANA_MSG_ERROR("Histogram name " << histName << " not found");
return;
}
else {
histPointer = (TH3*)it->second;
}
histPointer->Fill(valueX, valueY, valueZ, weight);
}

void HistogramManager::fillProfile(const std::string& histName, double valueX, double valueY, double weight) {
TProfile* histPointer(NULL);
HistMap_t::const_iterator it = m_histMap.find( histName );
if ( it == m_histMap.end() ) {
ANA_MSG_ERROR("Histogram name " << histName << " not found");
return;
}
else {
histPointer = (TProfile*)it->second;
}
histPointer->Fill(valueX, valueY, weight);
}
11 changes: 11 additions & 0 deletions Root/JetCalibrator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,17 @@ EL::StatusCode JetCalibrator :: initialize ()
if ( m_jetCalibToolsDEV ) {
ANA_CHECK( m_JetCalibrationTool_handle.setProperty("DEVmode", m_jetCalibToolsDEV));
}
// HLT jet re-calibration configuration
if (m_recalibrateHLTJets) {
ANA_CHECK( m_JetCalibrationTool_handle.setProperty("UseHLTEventShape", true) );
// Note: PrimaryVerticesContainerName is actually a private ReadHandleKey, but we can set its value via the setProperty method
ANA_CHECK( m_JetCalibrationTool_handle.setProperty("PrimaryVerticesContainerName", m_HLTVertexContainerName) );
ANA_CHECK( m_JetCalibrationTool_handle.setProperty("averageInteractionsPerCrossingKey", m_HLTAvgMuDecor) );
if (m_EvtInfoHLTNPVDecor != "") {
ANA_CHECK( m_JetCalibrationTool_handle.setProperty("UseNPVFromEventInfo", true) );
ANA_CHECK( m_JetCalibrationTool_handle.setProperty("NPVKey", m_EvtInfoHLTNPVDecor) );
}
}
ANA_CHECK( m_JetCalibrationTool_handle.retrieve());
ANA_MSG_DEBUG("Retrieved tool: " << m_JetCalibrationTool_handle);

Expand Down
Loading

0 comments on commit 533c696

Please sign in to comment.