Skip to content
Snippets Groups Projects
Commit fed33700 authored by Gitlab CI's avatar Gitlab CI Committed by Dorothea vom Bruch
Browse files

Fixed formatting

patch generated by https://gitlab.cern.ch/lhcb/LHCb/-/jobs/13485697
parent 5373e1a8
No related branches found
No related tags found
1 merge request!3043Add functional raw event combiner
......@@ -33,90 +33,115 @@
template <typename T>
using VOC = Gaudi::Functional::vector_of_const_<T>;
class RawEventCombiner final :public Gaudi::Functional::MergingTransformer<LHCb::RawEvent(VOC<LHCb::RawEvent*> const&)> {
class RawEventCombiner final
: public Gaudi::Functional::MergingTransformer<LHCb::RawEvent( VOC<LHCb::RawEvent*> const& )> {
public:
/// Standard constructor
RawEventCombiner(const std::string& name, ISvcLocator* pSvcLocator);
RawEventCombiner( const std::string& name, ISvcLocator* pSvcLocator );
StatusCode initialize() override;
LHCb::RawEvent operator()(
VOC<LHCb::RawEvent*> const& rawEvents) const override;
StatusCode initialize() override;
LHCb::RawEvent operator()( VOC<LHCb::RawEvent*> const& rawEvents ) const override;
private:
// By default skip all non-Run 3 raw banks
Gaudi::Property<std::vector<std::string>> m_banksToSkip {
this,
"BankTypesToSkip",
{"L0Calo", "L0DU", "PrsE", "PrsTrig", "L0PU", "TT", "IT", "OT", "TTFull", "ITFull", "PrsPacked", "L0Muon", "ITError", "TTError", "ITPedestal", "TTPedestal", "PrsPackedError", "L0CaloFull", "L0CaloError", "L0MuonCtrlAll", "L0MuonProcCand", "L0MuonProcData", "L0MuonRaw", "L0MuonError", "TTProcFull", "ITProcFull", "L0DUError", "L0PUFull", "L0PUError" }};
std::vector<LHCb::RawBank::BankType> m_bankTypes;
Gaudi::Property<std::vector<std::string>> m_banksToSkip{this,
"BankTypesToSkip",
{"L0Calo",
"L0DU",
"PrsE",
"PrsTrig",
"L0PU",
"TT",
"IT",
"OT",
"TTFull",
"ITFull",
"PrsPacked",
"L0Muon",
"ITError",
"TTError",
"ITPedestal",
"TTPedestal",
"PrsPackedError",
"L0CaloFull",
"L0CaloError",
"L0MuonCtrlAll",
"L0MuonProcCand",
"L0MuonProcData",
"L0MuonRaw",
"L0MuonError",
"TTProcFull",
"ITProcFull",
"L0DUError",
"L0PUFull",
"L0PUError"}};
std::vector<LHCb::RawBank::BankType> m_bankTypes;
};
// Declaration of the Algorithm Factory
DECLARE_COMPONENT( RawEventCombiner )
RawEventCombiner::RawEventCombiner(const std::string& name, ISvcLocator* pSvcLocator) :
MergingTransformer(
name,
pSvcLocator,
// Inputs
KeyValues {"RawEventLocations", {LHCb::RawEventLocation::Default}},
// Output
KeyValue {"RawEvent", "Event/DAQ/MergedEvent"} ) {}
RawEventCombiner::RawEventCombiner( const std::string& name, ISvcLocator* pSvcLocator )
: MergingTransformer( name, pSvcLocator,
// Inputs
KeyValues{"RawEventLocations", {LHCb::RawEventLocation::Default}},
// Output
KeyValue{"RawEvent", "Event/DAQ/MergedEvent"} ) {}
StatusCode RawEventCombiner::initialize() {
StatusCode sc = GaudiAlgorithm::initialize();
if ( sc.isFailure() ) return sc;
m_bankTypes.clear();
for ( int i = 0; i != (int)LHCb::RawBank::LastType; i++ ) {
const std::string bank_name = LHCb::RawBank::typeName( (LHCb::RawBank::BankType)i);
if ( std::find(m_banksToSkip.begin(), m_banksToSkip.end(), bank_name) != m_banksToSkip.end() )
continue;
m_bankTypes.push_back( (LHCb::RawBank::BankType)i );
for ( int i = 0; i != (int)LHCb::RawBank::LastType; i++ ) {
const std::string bank_name = LHCb::RawBank::typeName( (LHCb::RawBank::BankType)i );
if ( std::find( m_banksToSkip.begin(), m_banksToSkip.end(), bank_name ) != m_banksToSkip.end() ) continue;
m_bankTypes.push_back( (LHCb::RawBank::BankType)i );
}
if ( msgLevel( MSG::INFO ) )
info() << m_bankTypes.size() << " / " << (int)LHCb::RawBank::LastType << " possible RawBank types will be copied from inputs to output RawEvent " << endmsg;
info() << m_bankTypes.size() << " / " << (int)LHCb::RawBank::LastType
<< " possible RawBank types will be copied from inputs to output RawEvent " << endmsg;
return sc;
}
LHCb::RawEvent RawEventCombiner::operator() (
VOC<LHCb::RawEvent*> const& rawEvents ) const
{
LHCb::RawEvent RawEventCombiner::operator()( VOC<LHCb::RawEvent*> const& rawEvents ) const {
LHCb::RawEvent outputRawEvent;
bool stop_loop = false;
for (auto const* rawEvent : rawEvents) {
bool stop_loop = false;
for ( auto const* rawEvent : rawEvents ) {
for ( auto ib = m_bankTypes.begin(); ib != m_bankTypes.end(); ++ib ) {
const LHCb::span<const LHCb::RawBank* const> input_banks = rawEvent->banks(*ib);
if (input_banks.size() == 0) continue;
for ( auto ib = m_bankTypes.begin(); ib != m_bankTypes.end(); ++ib ) {
const LHCb::span<const LHCb::RawBank* const> input_banks = rawEvent->banks( *ib );
if ( input_banks.size() == 0 ) continue;
// Check if ib already exists in output raw event
// if yes, exit with error
const LHCb::span<const LHCb::RawBank* const> output_banks = outputRawEvent.banks(*ib);
if (output_banks.size() != 0) {
Error("Raw bank type " + LHCb::RawBank::typeName(*ib) + " already exists in output raw event, aborting merge", StatusCode::FAILURE).ignore();
const LHCb::span<const LHCb::RawBank* const> output_banks = outputRawEvent.banks( *ib );
if ( output_banks.size() != 0 ) {
Error( "Raw bank type " + LHCb::RawBank::typeName( *ib ) +
" already exists in output raw event, aborting merge",
StatusCode::FAILURE )
.ignore();
stop_loop = true;
break;
}
// If it does not yet exist, add it to the outputRawEvent
for ( const LHCb::RawBank* b : rawEvent->banks(*ib) ) {
if ( !b ) continue;
outputRawEvent.adoptBank( outputRawEvent.createBank( b->sourceID(), *ib, b->version(), b->size(), b->data() ), true);
for ( const LHCb::RawBank* b : rawEvent->banks( *ib ) ) {
if ( !b ) continue;
outputRawEvent.adoptBank( outputRawEvent.createBank( b->sourceID(), *ib, b->version(), b->size(), b->data() ),
true );
if ( msgLevel( MSG::VERBOSE ) ) {
verbose() << " Copied RawBank type=" << LHCb::RawBank::typeName( *ib ) << " version= " << b->version() << " sourceID= " << b->sourceID() << " size (bytes) = " << b->size() << endmsg;
}
verbose() << " Copied RawBank type=" << LHCb::RawBank::typeName( *ib ) << " version= " << b->version()
<< " sourceID= " << b->sourceID() << " size (bytes) = " << b->size() << endmsg;
}
}
}
if (stop_loop) break;
if ( stop_loop ) break;
}
return outputRawEvent;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment