Skip to content
Snippets Groups Projects

Separate calib BXIDs from digit monitoring

Merged Aniol Lobo Salvia requested to merge calo_monitoring_calib into master
@@ -14,6 +14,7 @@
#include "CaloFutureUtils/CaloFutureAlgUtils.h"
#include "DetDesc/GenericConditionAccessorHolder.h"
#include "Event/CaloDigits_v2.h"
#include "Event/ODIN.h"
#include "LHCbAlgs/Consumer.h"
// =============================================================================
@@ -43,27 +44,32 @@
using Input = LHCb::Event::Calo::Digits;
class CaloFutureDigitMonitor final
: public LHCb::Algorithm::Consumer<void( const Input&, const DeCalorimeter& ),
: public LHCb::Algorithm::Consumer<void( const Input&, const LHCb::ODIN&, const DeCalorimeter& ),
LHCb::DetDesc::usesBaseAndConditions<CaloFutureMoniAlg, DeCalorimeter>> {
public:
StatusCode initialize() override;
void operator()( const Input&, const DeCalorimeter& ) const override;
void operator()( const Input&, const LHCb::ODIN&, const DeCalorimeter& ) const override;
CaloFutureDigitMonitor( const std::string& name, ISvcLocator* pSvcLocator );
private:
Gaudi::Property<bool> m_spectrum{this, "Spectrum", false, "activate spectrum per channel histogramming"};
Gaudi::Property<bool> m_SeparateCalib{this, "SeparateCalib", true, "separate Calib BXIDs/Triger type to Calib plots"};
Gaudi::Property<std::vector<int>> m_Calib_BXIDsA{this, "Calib_BXIDsA"};
Gaudi::Property<std::vector<int>> m_Calib_BXIDsB{this, "Calib_BXIDsB"};
Gaudi::Property<std::vector<int>> m_perBXIDlist{this, "perBXIDlist"};
};
// =============================================================================
DECLARE_COMPONENT( CaloFutureDigitMonitor )
DECLARE_COMPONENT_WITH_ID( CaloFutureDigitMonitor, "CaloFutureDigitMonitor" )
// =============================================================================
CaloFutureDigitMonitor::CaloFutureDigitMonitor( const std::string& name, ISvcLocator* pSvcLocator )
: Consumer( name, pSvcLocator,
{KeyValue{"Input", LHCb::CaloFutureAlgUtils::CaloFutureDigitLocation( name )},
KeyValue{"ODINLocation", LHCb::ODINLocation::Default},
KeyValue{"Detector", LHCb::Calo::Utilities::DeCaloFutureLocation( name )}} ) {}
// =============================================================================
@@ -71,23 +77,21 @@ CaloFutureDigitMonitor::CaloFutureDigitMonitor( const std::string& name, ISvcLoc
// =============================================================================
StatusCode CaloFutureDigitMonitor::initialize() {
StatusCode sc = Consumer::initialize();
if ( sc.isFailure() ) return sc;
hBook1( "1", detData() + " : # of Digits", m_multMin, m_multMax, m_multBin );
hBook1( "4", "Hypo X " + inputLocation(), m_xMin, m_xMax, m_xBin );
hBook1( "5", "Hypo Y " + inputLocation(), m_yMin, m_yMax, m_yBin );
hBook2( "6", "Digit position x vs y " + inputLocation(), m_xMin, m_xMax, m_xBin, m_yMin, m_yMax, m_yBin );
info() << detData() << " digits from " << inputLocation() << endmsg;
return StatusCode::SUCCESS;
return Consumer::initialize().andThen( [&] {
hBook1( "1", detData() + " : # of Digits", m_multMin, m_multMax, m_multBin );
hBook1( "4", "Hypo X " + inputLocation(), m_xMin, m_xMax, m_xBin );
hBook1( "5", "Hypo Y " + inputLocation(), m_yMin, m_yMax, m_yBin );
hBook2( "6", "Digit position x vs y " + inputLocation(), m_xMin, m_xMax, m_xBin, m_yMin, m_yMax, m_yBin );
info() << detData() << " digits from " << inputLocation() << endmsg;
} );
}
// ============================================================================
// standard execution method
// ============================================================================
void CaloFutureDigitMonitor::operator()( const Input& digits, const DeCalorimeter& calo ) const {
void CaloFutureDigitMonitor::operator()( const Input& digits, const LHCb::ODIN& odin,
const DeCalorimeter& calo ) const {
if ( msgLevel( MSG::DEBUG ) ) debug() << name() << " execute " << endmsg;
@@ -102,6 +106,25 @@ void CaloFutureDigitMonitor::operator()( const Input& digits, const DeCalorimete
initCounters();
std::string Suff = "_Other";
std::string Suff_BXID = "";
if ( m_SeparateCalib ) {
if ( odin.bunchCrossingType() == LHCb::ODINImplementation::v7::ODIN::BXTypes::BeamCrossing ) {
Suff = "";
} else if ( odin.calibrationType() > 0 ) {
Suff = fmt::format( "_Calib{}", odin.calibrationType() );
}
if ( std::find( m_Calib_BXIDsA.begin(), m_Calib_BXIDsA.end(), odin.bunchId() ) != m_Calib_BXIDsA.end() ) {
Suff = std::string( "_Calib1" );
}
if ( std::find( m_Calib_BXIDsB.begin(), m_Calib_BXIDsB.end(), odin.bunchId() ) != m_Calib_BXIDsB.end() ) {
Suff = std::string( "_Calib2" );
}
}
if ( std::find( m_perBXIDlist.begin(), m_perBXIDlist.end(), odin.bunchId() ) != m_perBXIDlist.end() ) {
Suff_BXID = fmt::format( "_BXID_{}", odin.bunchId() );
}
for ( const auto& digit : digits ) {
const auto id = digit.cellID();
const auto e = digit.energy();
@@ -117,9 +140,19 @@ void CaloFutureDigitMonitor::operator()( const Input& digits, const DeCalorimete
hFill1( id, "4", x );
hFill1( id, "5", y );
hFill2( id, "6", x, y );
if ( doHisto( "7" ) ) fillCaloFuture2D( "7", id, e, detData() + " energy weighted" );
if ( doHisto( "8" ) ) fillCaloFuture2D( "8", id, 1., detData() + " digits position 2D view" );
if ( doHisto( "9" ) ) fillCaloFuture2D( "9", id, adc, detData() + " ADC 2D view" );
if ( doHisto( "7" ) )
fillCaloFuture2D( fmt::format( "7{}", Suff ), id, e, fmt::format( "{} Accumulated Energy {}", detData(), Suff ) );
if ( doHisto( "8" ) )
fillCaloFuture2D( fmt::format( "8{}", Suff ), id, 1.,
fmt::format( "{} Accumulated Digits filled {}", detData(), Suff ) );
if ( doHisto( "9" ) )
fillCaloFuture2D( fmt::format( "9{}", Suff ), id, adc, fmt::format( "{} Accumulated ADCs {}", detData(), Suff ) );
if ( Suff_BXID != "" ) {
fillCaloFuture2D( fmt::format( "ADC{}", Suff_BXID ), id, adc,
fmt::format( "{} Accumulated ADCs {}", detData(), Suff_BXID ) );
fillCaloFuture2D( fmt::format( "Occupancy{}", Suff_BXID ), id, 1,
fmt::format( "{} Accumulated ADCs {}", detData(), Suff_BXID ) );
}
if ( m_spectrum ) {
if ( msgLevel( MSG::DEBUG ) ) debug() << "Filling cell by cell histograms" << endmsg;
Loading