diff --git a/Tr/TrackMonitors/src/UTGlobalEffMon.cpp b/Tr/TrackMonitors/src/UTGlobalEffMon.cpp index 0246509cbdbaec66025aecd13ee7219e19821dfd..004d4808207231088a6705592ad0401cf1c07cef 100644 --- a/Tr/TrackMonitors/src/UTGlobalEffMon.cpp +++ b/Tr/TrackMonitors/src/UTGlobalEffMon.cpp @@ -26,8 +26,6 @@ #include "TrackMonitorTupleBase.h" #include "UTDAQ/UTDAQHelper.h" #include "UTDAQ/UTInfo.h" -#include "UTDet/DeUTDetector.h" -#include "UTDet/DeUTSector.h" #include <algorithm> #include <bitset> #include <cstdint> @@ -64,10 +62,6 @@ namespace { return rc; } - std::vector<const LHCb::Track*> myconvert( const SmartRefVector<LHCb::Track>& tracks ) { - return myselect( tracks, []( const LHCb::Track* t ) { return t != nullptr; } ); - } - auto TrackTypePredicate = []( LHCb::Track::Types atype ) { return [=]( const LHCb::Track* track ) { return track->type() == atype; }; }; @@ -110,13 +104,13 @@ void buildHistogram( OWNER owner, std::map<K, H>& h, K k, std::string name, std: template <typename TFitResult, typename TNode> class UTGlobalEffMon : public LHCb::Algorithm::Consumer< - void( LHCb::Track::Range const&, DetectorElement const&, const DeUTDetector& ), - LHCb::DetDesc::usesBaseAndConditions<TrackMonitorTupleBase, DetectorElement, DeUTDetector>> { + void( LHCb::Track::Range const&, DetectorElement const& ), + LHCb::DetDesc::usesBaseAndConditions<TrackMonitorTupleBase, DetectorElement>> { public: UTGlobalEffMon( const std::string& name, ISvcLocator* pSvcLocator ); StatusCode initialize() override; - void operator()( LHCb::Track::Range const& tracks, DetectorElement const&, const DeUTDetector& deUT ) const override; + void operator()( LHCb::Track::Range const& tracks, DetectorElement const& ) const override; private: mutable Gaudi::Accumulators::Histogram<1> m_h_ntracks{ @@ -181,12 +175,10 @@ template <typename TFitResult, typename TNode> UTGlobalEffMon<TFitResult, TNode>::UTGlobalEffMon( const std::string& name, ISvcLocator* pSvcLocator ) : Consumer( name, pSvcLocator, { { "TracksInContainer", LHCb::TrackLocation::Default }, - { "StandardGeometryTop", LHCb::standard_geometry_top }, - { "DeUT", DeUTDetLocation::location() } } ) {} + { "StandardGeometryTop", LHCb::standard_geometry_top } } ) {} template <typename TFitResult, typename TNode> -void UTGlobalEffMon<TFitResult, TNode>::operator()( LHCb::Track::Range const& tracks, const DetectorElement& lhcb, - const DeUTDetector& deUT ) const { +void UTGlobalEffMon<TFitResult, TNode>::operator()( LHCb::Track::Range const& tracks, const DetectorElement& lhcb ) const { auto& geometry = *lhcb.geometry(); const double zutlay3 = 2652.5; const double UT_sensor_width = 95.6; // do not change this because you think this is not correct! @@ -222,21 +214,9 @@ void UTGlobalEffMon<TFitResult, TNode>::operator()( LHCb::Track::Range const& tr const double kDummy = 1000.0; - int _tr2ut0 = -1; - double _tr2utr0 = kDummy; - double _tr2utchi0 = 0.0; - - int _tr2ut1 = -1; - double _tr2utr1 = kDummy; - double _tr2utchi1 = 0.0; - - int _tr2ut2 = -1; - double _tr2utr2 = kDummy; - double _tr2utchi2 = 0.0; - - int _tr2ut3 = -1; - double _tr2utr3 = kDummy; - double _tr2utchi3 = 0.0; + int _tr2ut[4] = {-1, -1, -1, -1}; + double _tr2utr[4] = {kDummy, kDummy, kDummy, kDummy}; + double _tr2utchi[4] = {0.0, 0.0, 0.0, 0.0}; unsigned int utnode = 0; for ( const auto& node : nodes( *fitResult ) ) { @@ -252,96 +232,33 @@ void UTGlobalEffMon<TFitResult, TNode>::operator()( LHCb::Track::Range const& tr double chi = res / node.errResidual(); double ares = fabs( res ); unsigned int _layer = ( chID >> 18 ) & 3; - if ( 0 == _layer ) { - if ( ares < fabs( _tr2utr0 ) ) { - _tr2utr0 = res; - _tr2utchi0 = chi; - _tr2ut0 = chID; - } - } else if ( 1 == _layer ) { - if ( ares < fabs( _tr2utr1 ) ) { - _tr2utr1 = res; - _tr2utchi1 = chi; - _tr2ut1 = chID; - } - } else if ( 2 == _layer ) { - if ( ares < fabs( _tr2utr2 ) ) { - _tr2utr2 = res; - _tr2utchi2 = chi; - _tr2ut2 = chID; - } - } else { - if ( ares < fabs( _tr2utr3 ) ) { - _tr2utr3 = res; - _tr2utchi3 = chi; - _tr2ut3 = chID; - } + + //Loop over layers + if (ares < fabs(_tr2utr[_layer])) { + _tr2utr[_layer] = res; + _tr2utchi[_layer] = chi; + _tr2ut[_layer] = chID; } utnode++; } // nodes loop unsigned int nlay = 0; - if ( _tr2ut0 != -1 ) { - ++nlay; - UInt_t _mo = ( _tr2ut0 >> 10 ) & 7; - UInt_t _st = ( _tr2ut0 >> 14 ) & 15; - bool inner = ( _st == 0 ) && ( _mo == 3 || _mo == 4 ); - if ( inner ) { - ++m_h_residual_inner[_tr2utr0]; - ++m_h_residualpull_inner[_tr2utchi0]; - } else { - ++m_h_residual_outer[_tr2utr0]; - ++m_h_residualpull_outer[_tr2utchi0]; - } - } - if ( _tr2ut1 != -1 ) { - ++nlay; - bool inner = false; - UInt_t _mo = ( _tr2ut1 >> 10 ) & 7; - UInt_t _st = ( _tr2ut1 >> 14 ) & 15; - if ( _st == 0 ) { - if ( _mo == 3 || _mo == 4 ) { inner = true; } - } - if ( inner ) { - ++m_h_residual_inner[_tr2utr1]; - ++m_h_residualpull_inner[_tr2utchi1]; - } else { - ++m_h_residual_outer[_tr2utr1]; - ++m_h_residualpull_outer[_tr2utchi1]; - } - } - if ( _tr2ut2 != -1 ) { - ++nlay; - bool inner = false; - UInt_t _mo = ( _tr2ut2 >> 10 ) & 7; - UInt_t _st = ( _tr2ut2 >> 14 ) & 15; - if ( _st == 0 ) { - if ( _mo == 3 || _mo == 4 ) { inner = true; } - } - if ( inner ) { - ++m_h_residual_inner[_tr2utr2]; - ++m_h_residualpull_inner[_tr2utchi2]; - } else { - ++m_h_residual_outer[_tr2utr2]; - ++m_h_residualpull_outer[_tr2utchi2]; - } - } - if ( _tr2ut3 != -1 ) { - ++nlay; - bool inner = false; - UInt_t _mo = ( _tr2ut3 >> 10 ) & 7; - UInt_t _st = ( _tr2ut3 >> 14 ) & 15; - if ( _st == 0 ) { - if ( _mo == 3 || _mo == 4 ) { inner = true; } - } - if ( inner ) { - ++m_h_residual_inner[_tr2utr3]; - ++m_h_residualpull_inner[_tr2utchi3]; - } else { - ++m_h_residual_outer[_tr2utr3]; - ++m_h_residualpull_outer[_tr2utchi3]; - } + for (int layer = 0; layer < 4; ++layer) { + if (_tr2ut[layer] != -1) { + ++nlay; + // Extract values from the current layer + UInt_t _mo = (_tr2ut[layer] >> 10) & 7; + UInt_t _st = (_tr2ut[layer] >> 14) & 15; + bool inner = (_st == 0) && (_mo == 3 || _mo == 4); + if (inner) { + ++m_h_residual_inner[_tr2utr[layer]]; + ++m_h_residualpull_inner[_tr2utchi[layer]]; + } else { + ++m_h_residual_outer[_tr2utr[layer]]; + ++m_h_residualpull_outer[_tr2utchi[layer]]; + } + } } // tracks matched to UT hits (for nominator of efficiency map) diff --git a/UT/UTMonitors/src/UTBSMonitor.cpp b/UT/UTMonitors/src/UTBSMonitor.cpp index 890f8eb678cc5a9ffca33ff30dd0514d7a5611be..c6de3a6d6221356058c237f9f39769bd97b40ede 100644 --- a/UT/UTMonitors/src/UTBSMonitor.cpp +++ b/UT/UTMonitors/src/UTBSMonitor.cpp @@ -395,16 +395,15 @@ private: std::string module_name = std::get<4>( tuple ); std::string type = std::get<5>( tuple ); auto aSector = det.findSector( channelID ); - auto chanID = channelID.strip(); #ifdef USE_DD4HEP auto trajStrip0 = aSector.createTraj( 0, 0 ); auto trajStrip511 = aSector.createTraj( 511, 0 ); auto trajStrip127 = aSector.createTraj( 127, 0 ); #else - auto trajStrip0 = aSector->trajectory( chanID, 0 ); - auto trajStrip511 = aSector->trajectory( LHCb::Detector::UT::ChannelID{ chanID + 511 }, 0 ); - auto trajStrip127 = aSector->trajectory( LHCb::Detector::UT::ChannelID{ chanID + 127 }, 0 ); + auto trajStrip0 = aSector->trajectory( channelID, 0 ); + auto trajStrip511 = aSector->trajectory( LHCb::Detector::UT::ChannelID{ channelID + 511 }, 0 ); + auto trajStrip127 = aSector->trajectory( LHCb::Detector::UT::ChannelID{ channelID + 127 }, 0 ); #endif double stripx0 = -1 * ( trajStrip0.endPoint().x() + trajStrip0.beginPoint().x() ) * 0.5; double stripx511 = -1 * ( trajStrip511.endPoint().x() + trajStrip511.beginPoint().x() ) * 0.5; diff --git a/UT/UTMonitors/src/UTErrorMonitor.cpp b/UT/UTMonitors/src/UTErrorMonitor.cpp index b02b191afd6ea13d0479fd3f41cc079f2e8aa39d..6cd3d247f105af23e442b3d44c1b24f564e2febf 100644 --- a/UT/UTMonitors/src/UTErrorMonitor.cpp +++ b/UT/UTMonitors/src/UTErrorMonitor.cpp @@ -86,11 +86,7 @@ public: ToolHandle<IUTReadoutTool> readoutTool{ this, "ReadoutTool", "UTReadoutTool" }; // UTCoordinations map - mutable UTCoordinatesMap UTMap; - - mutable unsigned int asic_inError_19; - mutable unsigned int asic_inError_20; - mutable unsigned int asic_inError_21; + mutable UTCoordinatesMap UTMap; // TELL40 vs banktype plots mutable Gaudi::Accumulators::HistogramArray<Gaudi::Accumulators::Histogram<2>, s_HistBanksNames.size()> @@ -147,14 +143,20 @@ public: /// execute void operator()( const UTErrorASICs& errorsCont, DeUTDetector const& det ) const override { // number of errors - asic_inError_19 = 0; - asic_inError_20 = 0; - asic_inError_21 = 0; + unsigned int asic_inError_19 = 0; + unsigned int asic_inError_20 = 0; + unsigned int asic_inError_21 = 0; plot( (double)errorsCont.size(), "nErrors", -0.5, 9999.5, 10000 ); // histos per bank type // histos per error for ( const auto& e : errorsCont ) { + + // Handling UTError enocded in strip 1 + if ( e->strip() % 128 == 1 && e->packetId() == 19 ) asic_inError_19++; + if ( e->strip() % 128 == 1 && e->packetId() == 20 ) asic_inError_20++; + if ( e->strip() % 128 == 1 && e->packetId() == 21 ) asic_inError_21++; + fillBankHistograms( e ); fillHeatMap_Error( e, det ); } @@ -170,7 +172,7 @@ public: } private: - void fillBankHistograms( const LHCb::UTErrorASIC* aError ) const { + void fillBankHistograms( const LHCb::UTErrorASIC* aError) const { // Channel and source ID auto chanID = aError->channelID(); UTDAQID daqID = readoutTool->channelIDToDAQID( chanID ); @@ -202,11 +204,6 @@ private: } } - // Handling UTError enocded in strip 1 - if ( aError->strip() % 128 == 1 && aError->packetId() == 19 ) asic_inError_19++; - if ( aError->strip() % 128 == 1 && aError->packetId() == 20 ) asic_inError_20++; - if ( aError->strip() % 128 == 1 && aError->packetId() == 21 ) asic_inError_21++; - if ( aError->strip() % 128 == 1 && ( aError->packetId() == 19 || aError->packetId() == 20 || aError->packetId() == 21 ) ) { @@ -336,18 +333,8 @@ private: // Chip is in its correct geometrical order // Sector map // if ( ( aError->stave() > 1 ) || ( fabs( y ) > 2 ) ) { - if ( aError->layer() == 0 ) { - incrementHistogram( m_asics_UTError_Known[0], x, y, positionasic_one, positionasic_two ); - } - if ( aError->layer() == 1 ) { - incrementHistogram( m_asics_UTError_Known[1], x, y, positionasic_one, positionasic_two ); - } - if ( aError->layer() == 2 ) { - incrementHistogram( m_asics_UTError_Known[2], x, y, positionasic_one, positionasic_two ); - } - if ( aError->layer() == 3 ) { - incrementHistogram( m_asics_UTError_Known[3], x, y, positionasic_one, positionasic_two ); - } + assert(aError->layer() >= 0 && aError->layer() <= 3); + incrementHistogram(m_asics_UTError_Known[aError->layer()], x, y, positionasic_one, positionasic_two); } if ( ( ( aError->stave() == 1 ) && ( fabs( y ) < 2 ) ) || ( ( aError->stave() == 0 ) && ( fabs( y ) == 1.5 ) ) ) { diff --git a/UT/UTMonitors/src/UTVeloUTCorrelationsMonitor.cpp b/UT/UTMonitors/src/UTVeloUTCorrelationsMonitor.cpp index a147cc480d6c1a1515e4746f9e00763ca57c6b57..cc7a16ae4aef8a0d3df7c0256718d1a3c0e8bbf4 100644 --- a/UT/UTMonitors/src/UTVeloUTCorrelationsMonitor.cpp +++ b/UT/UTMonitors/src/UTVeloUTCorrelationsMonitor.cpp @@ -25,7 +25,6 @@ #include "UTDAQ/UTCoordinatesMap.h" #include "UTDAQ/UTDAQHelper.h" #include "UTDAQ/UTInfo.h" -#include "UTDet/DeUTDetector.h" // Needed for VELO #include "Event/VPFullCluster.h" @@ -63,9 +62,9 @@ template <masks m> /** ------------------------------------------------------------------------------------------------------------------------ */ class UTVeloUTCorrelationsMonitor - : public LHCb::Algorithm::Consumer<void( UTDigits const&, UTDigits const&, DeUTDetector const&, LHCb::ODIN const&, + : public LHCb::Algorithm::Consumer<void( UTDigits const&, UTDigits const&, LHCb::ODIN const&, std::vector<VPFullCluster> const& ), - LHCb::DetDesc::usesBaseAndConditions<GaudiHistoAlg, DeUTDetector>> { + LHCb::DetDesc::usesBaseAndConditions<GaudiHistoAlg>> { public: UTVeloUTCorrelationsMonitor( const std::string& name, ISvcLocator* svcloc ) : Consumer{ name, @@ -73,13 +72,12 @@ public: { { "InputData", UTDigitLocation::UTDigits }, { "InputErrorData", UTDigitLocation::UTDigits }, - { "UTLocation", DeUTDetLocation::location() }, { "ODINLocation", LHCb::ODINLocation::Default }, { "VeloClusterLocation", LHCb::VPFullClusterLocation::Default }, } } {} ToolHandle<IUTReadoutTool> readoutTool{ this, "ReadoutTool", "UTReadoutTool" }; - void operator()( const UTDigits&, const UTDigits&, DeUTDetector const&, LHCb::ODIN const&, + void operator()( const UTDigits&, const UTDigits&, LHCb::ODIN const&, const std::vector<LHCb::VPFullCluster>& ) const override; StatusCode initialize() override { @@ -90,7 +88,6 @@ public: } private: - mutable UTCoordinatesMap UTMap; // General plots mutable GA::Histogram<1> m_nUTDigits{ this, "nUTDigits", "Total UT Digits", AxisDIGIT }; @@ -116,7 +113,7 @@ private: DECLARE_COMPONENT( UTVeloUTCorrelationsMonitor ) void UTVeloUTCorrelationsMonitor::operator()( const UTDigits& digitsCont, const UTDigits& errdigitsCont, - DeUTDetector const& det, LHCb::ODIN const& odin, + LHCb::ODIN const& odin, const std::vector<LHCb::VPFullCluster>& vpClusters ) const { // General counters