Skip to content
Snippets Groups Projects

Fix RICH lumi counters

Merged Edoardo Franzoso requested to merge ef_fixLumiCountersFromRich into master
1 file
+ 34
26
Compare changes
  • Side-by-side
  • Inline
@@ -39,8 +39,12 @@ public:
LHCb::HltLumiSummary operator()( Rich::Future::DAQ::DecodedData const& data ) const override {
int hits[48] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
// init temporary counter name
std::string counterName = "";
// create a map of counter names to hits vector
std::map<std::string, int> counterMap;
// assign as keys the counter names and init the values to 0
for ( auto i = 0u; i < m_counterNames.size(); ++i ) { counterMap[m_counterBaseName + m_counterNames[i]] = 0; }
// Loop over RICHes
for ( const auto rich : Rich::detectors() ) {
@@ -50,7 +54,6 @@ public:
// sides per RICH
for ( const auto& pD : rD ) {
// PD modules per side
for ( const auto& mD : pD ) {
@@ -60,33 +63,38 @@ public:
// PD ID
const auto pdID = PD.pdID();
if ( pdID.isValid() ) {
// Determine the index of the counter
unsigned counterIndex = 16u * pdID.rich();
if ( pdID.rich() == 0 ) {
if ( pdID.panelLocalModuleColumn() < 6 || pdID.panelLocalModuleColumn() > 9 ) continue;
if ( pdID.columnLocalModuleNum() < 2 || pdID.columnLocalModuleNum() > 3 ) continue;
counterIndex += 2u * ( pdID.panelLocalModuleColumn() - 6u );
counterIndex += pdID.columnLocalModuleNum() - 2u;
} else {
if ( pdID.panelLocalModuleColumn() < 5 || pdID.panelLocalModuleColumn() > 8 ) continue;
if ( pdID.columnLocalModuleNum() < 1 || pdID.columnLocalModuleNum() > 4 ) continue;
counterIndex += 4u * ( pdID.panelLocalModuleColumn() - 5u );
counterIndex += pdID.columnLocalModuleNum() - 1u;
}
// Vector of SmartIDs
const auto irich = pdID.rich();
const auto ipanel = pdID.panel();
const auto icolumn = pdID.panelLocalModuleColumn();
const auto ipdm = pdID.columnLocalModuleNum();
// compose the counter name using hit info
counterName = std::to_string( irich + 1 ) + "S" + std::to_string( ipanel + 1 ) + "C" +
std::to_string( icolumn ) + "M" + std::to_string( ipdm ) + "Hits";
const auto& rawIDs = PD.smartIDs();
hits[counterIndex] += rawIDs.size();
}
}
}
}
}
// Do we have any hits
if ( !rawIDs.empty() ) {
// check if the counter name is in counterNames vector
if ( !( std::find( m_counterNames.begin(), m_counterNames.end(), counterName ) ==
m_counterNames.end() ) ) {
// increment the counter value by the number of hits
counterMap[m_counterBaseName + counterName] += rawIDs.size();
} // end if counter name is in counterNames vector
} // end if we have hits
} // end if pdID is valid
} // end loop over PDs per module
} // end loop over PD modules per side
} // end loop over sides per RICH
} // end loop over RICHes
LHCb::HltLumiSummary summary{};
for ( auto i = 0u; i < 48; ++i ) { summary.addInfo( m_counterBaseName + m_counterNames[i], hits[i] ); }
for ( auto i = 0u; i < m_counterNames.size(); ++i ) {
summary.addInfo( m_counterBaseName + m_counterNames[i], counterMap[m_counterBaseName + m_counterNames[i]] );
}
return summary;
}
Loading