diff --git a/Muon/MuonMoniDigi/src/MuonDigitChecker.cpp b/Muon/MuonMoniDigi/src/MuonDigitChecker.cpp index 3329325f2ae8d558e672886a398f9996ceb6b310..4cb7f12e9c30215cfbcbe099399f567831d3d92d 100644 --- a/Muon/MuonMoniDigi/src/MuonDigitChecker.cpp +++ b/Muon/MuonMoniDigi/src/MuonDigitChecker.cpp @@ -8,13 +8,14 @@ * granted to it by virtue of its status as an Intergovernmental Organization * * or submit itself to any jurisdiction. * \*****************************************************************************/ - #include <Event/MCHeader.h> #include <Event/MCHit.h> #include <Event/MCMuonDigit.h> #include <Event/MuonDigit.h> #include <Gaudi/Accumulators.h> #include <GaudiAlg/GaudiTupleAlg.h> +#include <GaudiAlg/Tuple.h> +#include <GaudiAlg/TupleObj.h> #include <GaudiKernel/GaudiException.h> #include <LHCbAlgs/Consumer.h> #include <MuonDet/DeMuonDetector.h> @@ -74,7 +75,18 @@ private: return fmt::format( "M{}R{}/{}", n / 6 / 4 + 1, ( n / 6 ) % 4 + 1, digi_sources[n % 6] ); } ); - Gaudi::Property<bool> m_hitMonitor{this, "hitMonitor", false}; + // + // To activate ExpertMode + // add following lines in your Boole python file: + // + // from Configurables import MuonDigitChecker + // MuonDigitChecker().ExpertMode = True + // from Configurables import NTupleSvc + // NTupleSvc().Output = ["FILE1 DATAFILE='Boole-Muon-Expert.root' TYP='ROOT' OPT='NEW'"] + // + Gaudi::Property<bool> m_hitMonitor{this, "hitMonitor", true}; + Gaudi::Property<bool> m_expertMode{this, "ExpertMode", false}; + Gaudi::Property<bool> m_verboseMode{this, "VerboseMode", false}; std::size_t m_stationIdOffset{0}; }; @@ -166,12 +178,12 @@ void MuonDigitChecker::operator()( const LHCb::MCHeader& evt, const LHCb::MCHits z.push_back( zpos ); vtime.push_back( time ); - // Fill some histos - int hh = station * 4 + region; - - plot( r, hh + 2000, "Radial Multiplicity", 0., 6000., 200 ); - plot( tof, hh + 1000, "Time multiplicity", 0., 100., 200 ); - + // + if ( m_expertMode ) { + int hh = station * 4 + region; + plot( r, hh + 2000, "Hits Radial Multiplicity", 0., 6000., 200 ); + plot( tof, hh + 1000, "Hits Time multiplicity", 0., 100., 200 ); + } // MC truth const LHCb::MCParticle* particle = hit->mcParticle(); if ( particle ) { @@ -210,7 +222,8 @@ void MuonDigitChecker::operator()( const LHCb::MCHeader& evt, const LHCb::MCHits ++tnhit[( station + m_stationIdOffset ) * 4 + region]; } // the weird start of loop is to skip M1 if not present - for ( std::size_t i = m_stationIdOffset * 4; i < tnhit.size(); ++i ) { m_avgHits[i] += tnhit[i]; } + if ( m_expertMode ) + for ( std::size_t i = m_stationIdOffset * 4; i < tnhit.size(); ++i ) { m_avgHits[i] += tnhit[i]; } } // Loop on Digits (strips) @@ -219,6 +232,10 @@ void MuonDigitChecker::operator()( const LHCb::MCHeader& evt, const LHCb::MCHits double Dfir; bool Deve; + int occu[4] = {0}; + double r_digit = -999.; + double tX = -1.; + for ( const auto* jdigit : digits ) { Dsta = jdigit->key().station(); Dreg = jdigit->key().region(); @@ -239,6 +256,29 @@ void MuonDigitChecker::operator()( const LHCb::MCHeader& evt, const LHCb::MCHits digit_dy.push_back( pos->dY() ); digit_dz.push_back( pos->dZ() ); + // -- Prepare variables for Digits Monitoring Plots + occu[Dsta]++; + r_digit = sqrt( pow( pos->x(), 2 ) + pow( pos->y(), 2 ) ) / 10.; // cm + tX = ( jdigit->TimeStamp() * 1.6 ) / 3.; + + if ( Dsta == 0 ) { + plot( r_digit, 3012, "Digits Radial Distribution Station M2 ", 0., 600., 100 ); + plot( tX, 3112, "Digits Time Distribution Station M2 ", 0., 10., 10 ); + } + if ( Dsta == 1 ) { + plot( r_digit, 3013, "Digits Radial Distribution Station M3 ", 0., 600., 100 ); + plot( tX, 3113, "Digits Time Distribution Station M3 ", 0., 10., 10 ); + } + if ( Dsta == 2 ) { + plot( r_digit, 3014, "Digits Radial Distribution Station M4 ", 0., 600., 100 ); + plot( tX, 3114, "Digits Time Distribution Station M4 ", 0., 10., 10 ); + } + if ( Dsta == 3 ) { + plot( r_digit, 3015, "Digits Radial Distribution Station M5 ", 0., 600., 100 ); + plot( tX, 3115, "Digits Time Distribution Station M5 ", 0., 10., 10 ); + } + //--- + // Match with "true" MC digit LHCb::MCMuonDigit* MCmd = mcdigits.object( jdigit->key() ); if ( !MCmd ) { @@ -274,8 +314,15 @@ void MuonDigitChecker::operator()( const LHCb::MCHeader& evt, const LHCb::MCHits // the weird start of loop is to skip M1 if not present for ( std::size_t i = m_stationIdOffset * 4 * 6; i < tnDhit.size(); ++i ) { m_avgDHits[i] += tnDhit[i]; } - if ( m_hitMonitor ) { - Tuple nt1 = nTuple( 41, "MC HITS", CLID_ColumnWiseTuple ); + // -- Fill some histos with digits infos + plot( occu[0], 3002, "Digits Multiplicity Station M2 ", 0., 350., 50 ); + plot( occu[1], 3003, "Digits Multiplicity Station M3 ", 0., 350., 50 ); + plot( occu[2], 3004, "Digits Multiplicity Station M4 ", 0., 350., 50 ); + plot( occu[3], 3005, "Digits Multiplicity Station M5 ", 0., 350., 50 ); + // -- + + if ( m_expertMode ) { + Tuple nt1 = nTuple( 41, "MCHITS", CLID_ColumnWiseTuple ); StatusCode sc = nt1->column( "Event", evtNr, 0LL, 10000LL ); if ( sc.isFailure() && msgLevel( MSG::DEBUG ) ) debug() << "nt error" << endmsg; @@ -358,7 +405,7 @@ StatusCode MuonDigitChecker::finalize() { info() << "Muon Monitoring Tables:" << endmsg; - if ( fullDetail() && m_hitMonitor ) { + if ( fullDetail() && m_expertMode ) { std::stringstream msg; msg << "- Hit Information"; // FIXME: we should have a loop over `hits_sources`