From b26e2af2cc3c71c66a17a3b5ebd72e40f5d2bf41 Mon Sep 17 00:00:00 2001 From: Xuhao Yuan Date: Sun, 4 Apr 2021 15:46:36 +0200 Subject: [PATCH] rebase and merge --- Digi/Boole/python/Boole/Configuration.py | 21 +++++++++++-------- .../tests/options/testBoole-defaults-notag.py | 18 ++++++++++++++++ Digi/Boole/tests/refs/boole-write-xdigi.ref | 1 - Digi/DigiAlg/src/BuildMCTrackInfo.cpp | 9 ++++---- .../src/MCUTDepositCreator.cpp | 12 +++++++---- UT/UTDigiAlgorithms/src/MCUTDigitCreator.cpp | 1 + UT/UTDigiAlgorithms/src/UTDigitCreator.cpp | 7 ++++--- UT/UTDigiAlgorithms/src/UTPedestalSimTool.cpp | 3 ++- 8 files changed, 49 insertions(+), 23 deletions(-) create mode 100755 Digi/Boole/tests/options/testBoole-defaults-notag.py delete mode 120000 Digi/Boole/tests/refs/boole-write-xdigi.ref diff --git a/Digi/Boole/python/Boole/Configuration.py b/Digi/Boole/python/Boole/Configuration.py index 02e54ea81..36830c152 100755 --- a/Digi/Boole/python/Boole/Configuration.py +++ b/Digi/Boole/python/Boole/Configuration.py @@ -597,13 +597,12 @@ class Boole(LHCbConfigurableUser): if "UT" in linkDets: from Configurables import ( - UTDigit2MCHitLinker, UTClusterCreator_Monitor, - UTCluster2MCHitLinker, UTCluster2MCParticleLinker) + UTDigit2MCHitLinker, UTDigit2MCParticleLinker, + UTTightDigit2MCHitLinker, UTTightDigit2MCParticleLinker) seq = GaudiSequencer("LinkUTSeq") seq.Members += [UTDigit2MCHitLinker("UTDigitLinker")] - seq.Members += [UTClusterCreator_Monitor()] - seq.Members += [UTCluster2MCHitLinker("UTClusterLinker")] - seq.Members += [UTCluster2MCParticleLinker("UTTruthLinker")] + seq.Members += [UTTightDigit2MCHitLinker("UTTightDigitLinker")] + seq.Members += [UTTightDigit2MCParticleLinker("UTTruthLinker")] if "Tr" in linkDets and doWriteTruth: from Configurables import BuildMCTrackInfo @@ -920,14 +919,14 @@ class Boole(LHCbConfigurableUser): if "UT" in moniDets: from Configurables import (MCUTDepositMonitor, MCUTDigitMonitor, - UTDigitMonitor, UT__UTClusterMonitor, + UTDigitMonitor, UT__UTTightDigitMonitor, UTEffChecker, MCParticle2MCHitAlg, MCParticleSelector) from GaudiKernel.SystemOfUnits import GeV mcDepMoni = MCUTDepositMonitor("MCUTDepositMonitor") mcDigitMoni = MCUTDigitMonitor("MCUTDigitMonitor") digitMoni = UTDigitMonitor("UTDigitMonitor") - clusMoni = UT__UTClusterMonitor("UTClusterMonitor") + #tightdigitMoni = UT__UTTightDigitMonitor("UTTightDigitMonitor") mcp2MCHit = MCParticle2MCHitAlg( "MCP2UTMCHitAlg", MCHitPath="MC/UT/Hits", @@ -937,9 +936,13 @@ class Boole(LHCbConfigurableUser): effCheck.MCParticleSelector.zOrigin = 50.0 effCheck.MCParticleSelector.pMin = 1.0 * GeV effCheck.MCParticleSelector.betaGammaMin = 1.0 - clusMoni.ClusterLocation = "Raw/UT/Clusters" GaudiSequencer("MoniUTSeq").Members += [ - mcDepMoni, mcDigitMoni, digitMoni, mcp2MCHit, effCheck + mcDepMoni, + mcDigitMoni, + digitMoni, + mcp2MCHit, + #mcDepMoni, mcDigitMoni, digitMoni, mcp2MCHit, tightdigitMoni, + effCheck ] if False: from Configurables import UTSpilloverSubtrMonitor diff --git a/Digi/Boole/tests/options/testBoole-defaults-notag.py b/Digi/Boole/tests/options/testBoole-defaults-notag.py new file mode 100755 index 000000000..f72c1abb8 --- /dev/null +++ b/Digi/Boole/tests/options/testBoole-defaults-notag.py @@ -0,0 +1,18 @@ +############################################################################### +# (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration # +# # +# This software is distributed under the terms of the GNU General Public # +# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". # +# # +# In applying this licence, CERN does not waive the privileges and immunities # +# granted to it by virtue of its status as an Intergovernmental Organization # +# or submit itself to any jurisdiction. # +############################################################################### +# Default settings for all Boole tests +from Configurables import Boole, CondDB + +CondDB().Upgrade = True +Boole().EvtMax = 10 +Boole().Outputs = ["DIGI", "MDF"] # Test all output types +Boole().Monitors = ["SC", "FPE"] # Add StatusCode and FPE checks +Boole().DisableTiming = True # Do not print timing table diff --git a/Digi/Boole/tests/refs/boole-write-xdigi.ref b/Digi/Boole/tests/refs/boole-write-xdigi.ref deleted file mode 120000 index ef0cb7896..000000000 --- a/Digi/Boole/tests/refs/boole-write-xdigi.ref +++ /dev/null @@ -1 +0,0 @@ -boole-write-xdigi.ref.detdesc \ No newline at end of file diff --git a/Digi/DigiAlg/src/BuildMCTrackInfo.cpp b/Digi/DigiAlg/src/BuildMCTrackInfo.cpp index 4086ef6f3..e1f0c4e40 100755 --- a/Digi/DigiAlg/src/BuildMCTrackInfo.cpp +++ b/Digi/DigiAlg/src/BuildMCTrackInfo.cpp @@ -8,6 +8,7 @@ * granted to it by virtue of its status as an Intergovernmental Organization * * or submit itself to any jurisdiction. * \*****************************************************************************/ +#include "Event/UTDigit.h" //no need for cluster #include #include #include @@ -165,13 +166,12 @@ StatusCode BuildMCTrackInfo::execute() { } if ( m_withUT ) { //== UT cluster -> particle associaton - LHCb::UTClusters const* UTDig = get( LHCb::UTClusterLocation::UTClusters ); + LHCb::UTDigits const* UTDig = get( LHCb::UTDigitLocation::UTTightDigits ); LHCb::LinksByKey const* lnks = get( LHCb::LinksByKey::linkerName( LHCb::UTClusterLocation::UTClusters ) ); - for ( const auto& dig : *UTDig ) { - int sta = dig->channelID().station() - 1; // 0-1 from 1-2 - int lay = ( dig->channelID().layer() - 1 ) % 4; + int sta = dig->channelID().station() - 1; // 0-1 from 1-2 + int lay = ( dig->channelID().layer() ) % 2; // New UTChannelID layer() is in [0,3] bool isX = ( 0 == lay ) || ( 3 == lay ); for ( const auto& part : LinkedTo{lnks}.range( dig ) ) { if ( mcParts == part.parent() ) { @@ -211,7 +211,6 @@ StatusCode BuildMCTrackInfo::execute() { computeAcceptance( station ); //== Build now the trackInfo tracks - for ( auto const& part : *mcParts ) { MCNum = part->key(); int mask = station[MCNum]; diff --git a/UT/UTDigiAlgorithms/src/MCUTDepositCreator.cpp b/UT/UTDigiAlgorithms/src/MCUTDepositCreator.cpp index 4c9838602..d17f06068 100644 --- a/UT/UTDigiAlgorithms/src/MCUTDepositCreator.cpp +++ b/UT/UTDigiAlgorithms/src/MCUTDepositCreator.cpp @@ -22,6 +22,9 @@ #include "UTDet/DeUTDetector.h" #include "UTDet/DeUTSector.h" #include "UTDet/DeUTSensor.h" +// To be removed later... +#include "DetDesc/SolidBox.h" +#include "UTDAQ/UTInfo.h" #include "LHCbAlgs/Consumer.h" @@ -265,8 +268,9 @@ void MCUTDepositCreator::createDeposits( const MCHits* mcHitsCont, const double for ( unsigned int iStrip = firstStrip; iStrip <= lastStrip; ++iStrip ) { + // old utchannelID starts from 1, but new id starts from 0: // Determine whether Tell1 neighbour(!) channel is even or odd - bool tell1ChanEven = ( ( iStrip % 2 == 1 ) == aSensor->xInverted() ); + bool tell1ChanEven = ( ( iStrip % 2 == 1 ) ); // Determine cross talk level for this readout sector double xTalkRight = 0.0; @@ -284,8 +288,8 @@ void MCUTDepositCreator::createDeposits( const MCHits* mcHitsCont, const double if ( iStrip != firstStrip ) prevCharge = stripMap[iStrip - 1]; double nextCharge = 0.0; if ( iStrip != lastStrip ) nextCharge = stripMap[iStrip + 1]; - double leftCharge = aSensor->xInverted() ? nextCharge : prevCharge; - double rightCharge = aSensor->xInverted() ? prevCharge : nextCharge; + double leftCharge = prevCharge; + double rightCharge = nextCharge; // Capacitive coupling double weightedCharge = @@ -418,7 +422,7 @@ std::map MCUTDepositCreator::chargeSharing( const std::vec auto lastIter = std::prev( stripMap.end() ); auto firstStrip = startIter->first; - if ( aSensor.isStrip( firstStrip - 1 ) ) { stripMap[firstStrip - 1] += 0.0; } + if ( ( firstStrip > 0 ) && ( aSensor.isStrip( firstStrip - 1 ) ) ) { stripMap[firstStrip - 1] += 0.0; } const unsigned int lastStrip = lastIter->first; if ( aSensor.isStrip( lastStrip + 1 ) ) { stripMap[lastStrip + 1] += 0.0; } diff --git a/UT/UTDigiAlgorithms/src/MCUTDigitCreator.cpp b/UT/UTDigiAlgorithms/src/MCUTDigitCreator.cpp index 7e95c098d..bcf17dfcf 100644 --- a/UT/UTDigiAlgorithms/src/MCUTDigitCreator.cpp +++ b/UT/UTDigiAlgorithms/src/MCUTDigitCreator.cpp @@ -41,6 +41,7 @@ MCUTDigitCreator::MCUTDigitCreator( const std::string& name, ISvcLocator* pSvcLo {"OutputLocation", MCUTDigitLocation::UTDigits}} {} MCUTDigits MCUTDigitCreator::operator()( const MCUTDeposits& depositCont ) const { + // digits container MCUTDigits digitCont; digitCont.reserve( depositCont.size() ); diff --git a/UT/UTDigiAlgorithms/src/UTDigitCreator.cpp b/UT/UTDigiAlgorithms/src/UTDigitCreator.cpp index ac443ee2e..2549b148e 100644 --- a/UT/UTDigiAlgorithms/src/UTDigitCreator.cpp +++ b/UT/UTDigiAlgorithms/src/UTDigitCreator.cpp @@ -176,6 +176,7 @@ UTDigits UTDigitCreator::operator()( const MCUTDigits& mcDigitCont, DeUTDetector .ignore( /* AUTOMATICALLY ADDED FOR gaudi/Gaudi!763 */ ); // register UTDigits in the transient data store + return digitsCont; } @@ -191,7 +192,7 @@ void UTDigitCreator::genRanNoiseStrips( std::vector& noiseCont, DeUTD // generate a random readout sector int iSector = (int)( m_uniformDist->shoot() * nSector ); auto& aSector = det.sector( iSector ); - int iStrip = (int)( m_uniformDist->shoot() * aSector.nStrip() ) + 1; + int iStrip = (int)( m_uniformDist->shoot() * aSector.nStrip() ) + aSector.firstStrip(); Detector::UT::ChannelID aChan = aSector.stripToChan( iStrip ); if ( m_useStatusConditions == false || aSector.isOKStrip( aChan ) == true ) { @@ -202,7 +203,7 @@ void UTDigitCreator::genRanNoiseStrips( std::vector& noiseCont, DeUTD } // iNoiseStrip } else { det.applyToAllSectors( [&]( DeUTSector const& sector ) { - for ( unsigned int iStrip = 1u; iStrip <= sector.nStrip(); ++iStrip ) { + for ( unsigned int iStrip = sector.firstStrip(); iStrip < sector.firstStrip() + sector.nStrip(); ++iStrip ) { Detector::UT::ChannelID aChan = sector.stripToChan( iStrip ); double ranNoise = sector.noise( aChan ) * m_gaussDist->shoot(); noiseCont.emplace_back( ranNoise, aChan ); @@ -242,7 +243,7 @@ void UTDigitCreator::createDigits( const MCUTDigits* mcDigitCont, UTDigits* digi void UTDigitCreator::mergeContainers( LHCb::span noiseCont, UTDigits* digitsCont, DeUTDetector const& det ) const { // merge the two containers - Detector::UT::ChannelID prevChan( 0u, 0u, 0u, 0u, 0u, 0u ); + Detector::UT::ChannelID prevChan( 0u ); auto lastIter = digitsCont->end(); auto cachedIter = digitsCont->begin(); diff --git a/UT/UTDigiAlgorithms/src/UTPedestalSimTool.cpp b/UT/UTDigiAlgorithms/src/UTPedestalSimTool.cpp index 034c2215f..d38c06971 100644 --- a/UT/UTDigiAlgorithms/src/UTPedestalSimTool.cpp +++ b/UT/UTDigiAlgorithms/src/UTPedestalSimTool.cpp @@ -27,7 +27,8 @@ public: using extends::extends; double pedestal( const LHCb::Detector::UT::ChannelID& chan ) const override { - const unsigned int beetleStrip = ( chan.strip() - 1u ) % LHCbConstants::nStripsInBeetle; + const unsigned int beetleStrip = + ( chan.strip() ) % LHCbConstants::nStripsInBeetle; // strip() starts from 0u in LHCb::UTChannelID::IDType::v1 // cubic param of the baseline return ( m_param[0] + beetleStrip * ( m_param[1] + beetleStrip * ( m_param[2] + beetleStrip * m_param[3] ) ) ); } -- GitLab