From f2ea7172aa0fc46388b4a080c29a71ccf8194a0f Mon Sep 17 00:00:00 2001 From: Tadej Novak <tadej.novak@cern.ch> Date: Thu, 16 Sep 2021 14:09:44 +0200 Subject: [PATCH] TGC Digitization: Implementation of signal propagation time between the sensor edge and ASD --- .../MuonCondAlg/TgcDigitASDposCondAlg.h | 32 + .../MuonCondAlg/src/TgcDigitASDposCondAlg.cxx | 103 +++ .../src/components/MuonCondAlg_entries.cxx | 2 + .../MuonCondData/TgcDigitASDposData.h | 46 ++ .../MuonCondData/src/TgcDigitASDposData.cxx | 8 + .../src/components/MuonCondSvc_entries.cxx | 1 - .../MuonConfig/python/MuonCondAlgConfig.py | 6 +- .../python/TGC_DigitizationConfig.py | 12 + .../TGC_Digitization/CMakeLists.txt | 2 +- .../python/TGC_DigitizationConfig.py | 19 + .../TGC_Digitization_ASDpropTimeOffset.dat | 236 +++++++ .../share/TGC_Digitization_StripPosition.dat | 608 ++++++++++++++++++ .../TGC_Digitization/src/TgcDigitMaker.cxx | 487 ++++++++++---- .../TGC_Digitization/src/TgcDigitMaker.h | 60 +- .../src/TgcDigitizationTool.cxx | 16 +- .../src/TgcDigitizationTool.h | 7 +- .../python/DigitizationConfigFlags.py | 2 + .../Digitization/python/DigitizationFlags.py | 10 +- .../test/test_MC16a_Digi_tf_configuration.py | 2 +- 19 files changed, 1489 insertions(+), 170 deletions(-) create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcDigitASDposCondAlg.h create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcDigitASDposCondAlg.cxx create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcDigitASDposData.h create mode 100644 MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcDigitASDposData.cxx create mode 100644 MuonSpectrometer/MuonDigitization/TGC_Digitization/share/TGC_Digitization_ASDpropTimeOffset.dat create mode 100644 MuonSpectrometer/MuonDigitization/TGC_Digitization/share/TGC_Digitization_StripPosition.dat diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcDigitASDposCondAlg.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcDigitASDposCondAlg.h new file mode 100644 index 000000000000..9bcb72c60508 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/MuonCondAlg/TgcDigitASDposCondAlg.h @@ -0,0 +1,32 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TGCDIGITASDPOSCONDALG_H +#define TGCDIGITASDPOSCONDALG_H + +#include "AthenaBaseComps/AthReentrantAlgorithm.h" +#include "AthenaPoolUtilities/CondAttrListCollection.h" +#include "GaudiKernel/ICondSvc.h" +#include "MuonCondData/TgcDigitASDposData.h" +#include "StoreGate/ReadCondHandleKey.h" +#include "StoreGate/WriteCondHandleKey.h" + +class TgcDigitASDposCondAlg : public AthReentrantAlgorithm +{ + public: + TgcDigitASDposCondAlg (const std::string& name, ISvcLocator* pSvcLocator); + virtual ~TgcDigitASDposCondAlg() = default; + virtual StatusCode initialize() override; + virtual StatusCode execute(const EventContext& ctx) const override; + + private: + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_ASDpos{this, "ReadKeyAsdPos", "/TGC/DIGIT/ASDPOS", "SG key for TGCDIGITASDPOS"}; + SG::WriteCondHandleKey<TgcDigitASDposData> m_writeKey{this, "WriteKey", "TGCDigitASDposData", "SG Key of TGCDigit AsdPos"}; + + ServiceHandle<ICondSvc> m_condSvc{this, "CondSvc", "CondSvc"}; +}; + +#endif + + diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcDigitASDposCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcDigitASDposCondAlg.cxx new file mode 100644 index 000000000000..7804a61c8954 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/TgcDigitASDposCondAlg.cxx @@ -0,0 +1,103 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonCondAlg/TgcDigitASDposCondAlg.h" +#include "MuonCondSvc/MdtStringUtils.h" +#include "StoreGate/ReadCondHandle.h" +#include "StoreGate/WriteCondHandle.h" +#include "CoralBase/Blob.h" + +TgcDigitASDposCondAlg::TgcDigitASDposCondAlg(const std::string& name, ISvcLocator* pSvcLocator) : + AthReentrantAlgorithm(name, pSvcLocator) +{} + +StatusCode TgcDigitASDposCondAlg::initialize() +{ + ATH_MSG_DEBUG("initialize " << name()); + + ATH_CHECK(m_condSvc.retrieve()); + ATH_CHECK(m_readKey_ASDpos.initialize()); + ATH_CHECK(m_writeKey.initialize()); + + if(m_condSvc->regHandle(this, m_writeKey).isFailure()) { + ATH_MSG_FATAL("unable to register WriteCondHandle " << m_writeKey.fullKey() << " with CondSvc"); + return StatusCode::FAILURE; + } + + return StatusCode::SUCCESS; +} + +StatusCode TgcDigitASDposCondAlg::execute(const EventContext& ctx) const +{ + SG::WriteCondHandle<TgcDigitASDposData> writeHandle{m_writeKey, ctx}; + if (writeHandle.isValid()) { + ATH_MSG_DEBUG("CondHandle " << writeHandle.fullKey() << " is already valid." + << ". In theory this should not be called, but may happen" + << " if multiple concurrent events are being processed out of order."); + return StatusCode::SUCCESS; + } + + SG::ReadCondHandle<CondAttrListCollection> readHandle_ASDpos{m_readKey_ASDpos, ctx}; + if (readHandle_ASDpos.cptr() == nullptr) { + ATH_MSG_ERROR("Null pointer to the read conditions object"); + return StatusCode::FAILURE; + } + + ATH_MSG_DEBUG("Size of CondAttrListCollection" << readHandle_ASDpos.fullKey() << " = " << readHandle_ASDpos->size()); + + EventIDRange rangeW_ASDpos; + if (!readHandle_ASDpos.range(rangeW_ASDpos)) { + ATH_MSG_ERROR("Failed to retrieve validity range for " << readHandle_ASDpos.key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Range of input is " << rangeW_ASDpos); + + // write condition object + EventIDRange rangeIntersection = EventIDRange::intersect(rangeW_ASDpos); + if(rangeIntersection.start()>rangeIntersection.stop()) { + ATH_MSG_ERROR("Invalid intersection range: " << rangeIntersection); + return StatusCode::FAILURE; + } + + // Fill + auto outputCdo = std::make_unique<TgcDigitASDposData>(); + outputCdo->asdPos.assign(TgcDigitASDposData::N_STRIPASDPOS + TgcDigitASDposData::N_WIREASDPOS, std::vector<float>(readHandle_ASDpos->size(), 0)); + size_t dbLine{}; + + std::string delimiter{";"}; + for(const auto &[channel, attribute] : *readHandle_ASDpos.cptr()) { + const coral::Blob& blob = attribute["bASDPos"].data<coral::Blob>(); + const char *blobCStr = reinterpret_cast<const char *>(blob.startingAddress()); + std::string blobline(blobCStr); + std::vector<std::string> tokens; + MuonCalib::MdtStringUtils::tokenize(blobline, tokens, delimiter); + auto it = std::begin(tokens); + outputCdo->stationNum.push_back(stoi(*it)); + ++it; + outputCdo->stationEta.push_back(stoi(*it)); + ++it; + outputCdo->stationPhi.push_back(stoi(*it)); + + for(int i=0;i<TgcDigitASDposData::N_STRIPASDPOS;i++){ + ++it; + outputCdo->asdPos[i][dbLine] = stof(*it); + } + for(int i=0;i<TgcDigitASDposData::N_WIREASDPOS;i++){ + ++it; + outputCdo->asdPos[i + (int)TgcDigitASDposData::N_STRIPASDPOS][dbLine] = stof(*it); + } + dbLine += 1; + } // end of for(attrmap) + + // Record + if (writeHandle.record(rangeIntersection, std::move(outputCdo)).isFailure()) { + ATH_MSG_FATAL("Could not record TgcDigitASDposData " << writeHandle.key() + << " with EventRange " << rangeIntersection + << " into Conditions Store"); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("recorded new " << writeHandle.key() << " with range " << rangeIntersection << " into Conditions Store"); + + return StatusCode::SUCCESS; +} diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx index cd4001d6a5af..c698b1ac83bb 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondAlg/src/components/MuonCondAlg_entries.cxx @@ -6,6 +6,7 @@ #include "MuonCondAlg/MuonAlignmentErrorDbAlg.h" #include "MuonCondAlg/RpcCondDbAlg.h" #include "MuonCondAlg/TgcCondDbAlg.h" +#include "MuonCondAlg/TgcDigitASDposCondAlg.h" DECLARE_COMPONENT(CscCondDbAlg) DECLARE_COMPONENT(MdtCondDbAlg) @@ -15,3 +16,4 @@ DECLARE_COMPONENT(MuonAlignmentErrorDbAlg) DECLARE_COMPONENT(MuonAlignmentCondAlg) DECLARE_COMPONENT(MdtCalibDbAlg) DECLARE_COMPONENT(MdtCalibFormatAlgTest) +DECLARE_COMPONENT(TgcDigitASDposCondAlg) diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcDigitASDposData.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcDigitASDposData.h new file mode 100644 index 000000000000..8dde82a7cbd1 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/MuonCondData/TgcDigitASDposData.h @@ -0,0 +1,46 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TGCDIGITASDPOSDATA_H +#define TGCDIGITASDPOSDATA_H + +#include "AthenaKernel/BaseInfo.h" +#include "AthenaKernel/CLASS_DEF.h" +#include <vector> + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Contents of TGC_Digitization_AsdPosition.db * + * ================================================================== * + * |1|2|3|4|5|6|7|8|9|10|11|12|13| * + * * + * 1 -- station number(unsigned short) -> 41~48 * + * 2 -- station eta(unsigned short) -> 1~5 * + * 3 -- station phi(short) -> BW is -99, EI is 1~21, FI is 1~24 * + * 4~5 -- strip ASD position coordinate(float) * + * 6~13 -- Wire ASD position coordinate(float) * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +class TgcDigitASDposData +{ +public: + TgcDigitASDposData(); + virtual ~TgcDigitASDposData() = default; + + enum { + N_WIREASDPOS=8, + N_STRIPASDPOS=2, + N_CHANNELINPUT_TOASD=16 + }; + + std::vector<unsigned short> stationNum; + std::vector<unsigned short> stationEta; + std::vector<short> stationPhi; + std::vector<std::vector<float>> asdPos; +}; +CLASS_DEF(TgcDigitASDposData, 54799429, 1) + +#include "AthenaKernel/CondCont.h" +CLASS_DEF(CondCont<TgcDigitASDposData>, 50515203, 1) + +#endif // TGCDIGITASDPOSDATA_H diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcDigitASDposData.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcDigitASDposData.cxx new file mode 100644 index 000000000000..63d6b1f0ac63 --- /dev/null +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondData/src/TgcDigitASDposData.cxx @@ -0,0 +1,8 @@ +/* + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration +*/ + +#include "MuonCondData/TgcDigitASDposData.h" + +TgcDigitASDposData::TgcDigitASDposData() +{} diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/components/MuonCondSvc_entries.cxx b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/components/MuonCondSvc_entries.cxx index cd29a288f0ab..f0c4aebc19ec 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/components/MuonCondSvc_entries.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/src/components/MuonCondSvc_entries.cxx @@ -29,4 +29,3 @@ DECLARE_COMPONENT( RPC_STATUSConditionsSvc ) DECLARE_COMPONENT( RPC_DCSConditionsSvc ) DECLARE_COMPONENT( TriggerCoolSvc ) DECLARE_COMPONENT( TGC_STATUSConditionsSvc ) - diff --git a/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py b/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py index 6d5617ba651c..3a8be4504d61 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonCondAlgConfig.py @@ -150,4 +150,8 @@ def CscCondDbAlgCfg(flags, **kwargs): ### return result - +def TgcDigitASDposCondAlgCfg(flags): + result = ComponentAccumulator() + result.addCondAlgo(CompFactory.TgcDigitASDposCondAlg()) + result.merge(addFolders(flags, ["/TGC/DIGIT/ASDPOS"] , detDb="TGC_OFL", className="CondAttrListCollection")) + return result diff --git a/MuonSpectrometer/MuonConfig/python/TGC_DigitizationConfig.py b/MuonSpectrometer/MuonConfig/python/TGC_DigitizationConfig.py index 7227ef7961e3..433242280d07 100644 --- a/MuonSpectrometer/MuonConfig/python/TGC_DigitizationConfig.py +++ b/MuonSpectrometer/MuonConfig/python/TGC_DigitizationConfig.py @@ -46,6 +46,12 @@ def TGC_DigitizationToolCfg(flags, name="TgcDigitizationTool", **kwargs): kwargs.setdefault("OutputSDOName", flags.Overlay.BkgPrefix + "TGC_SDO") else: kwargs.setdefault("OutputSDOName", "TGC_SDO") + + if flags.Digitization.UseUpdatedTGCConditions: + from MuonConfig.MuonCondAlgConfig import TgcDigitASDposCondAlgCfg + acc.merge(TgcDigitASDposCondAlgCfg(flags)) + kwargs.setdefault("TGCDigitASDposKey", "TGCDigitASDposData") + TgcDigitizationTool = CompFactory.TgcDigitizationTool acc.setPrivateTools(TgcDigitizationTool(name, **kwargs)) return acc @@ -57,6 +63,12 @@ def TGC_OverlayDigitizationToolCfg(flags, name="Tgc_OverlayDigitizationTool", ** kwargs.setdefault("OnlyUseContainerName", False) kwargs.setdefault("OutputObjectName", flags.Overlay.SigPrefix + "TGC_DIGITS") kwargs.setdefault("OutputSDOName", flags.Overlay.SigPrefix + "TGC_SDO") + + if flags.Digitization.UseUpdatedTGCConditions: + from MuonConfig.MuonCondAlgConfig import TgcDigitASDposCondAlgCfg + acc.merge(TgcDigitASDposCondAlgCfg(flags)) + kwargs.setdefault("TGCDigitASDposKey", "TGCDigitASDposData") + TgcDigitizationTool = CompFactory.TgcDigitizationTool acc.setPrivateTools(TgcDigitizationTool(name, **kwargs)) return acc diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/CMakeLists.txt b/MuonSpectrometer/MuonDigitization/TGC_Digitization/CMakeLists.txt index 3e697afa95e5..d85b1b81841b 100755 --- a/MuonSpectrometer/MuonDigitization/TGC_Digitization/CMakeLists.txt +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/CMakeLists.txt @@ -15,7 +15,7 @@ atlas_add_component( TGC_Digitization src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${CORAL_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib GeoPrimitives Identifier GaudiKernel MuonSimEvent HitManagement xAODEventInfo GeneratorObjects MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData PathResolver RDBAccessSvcLib ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${CORAL_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib GeoPrimitives Identifier GaudiKernel MuonSimEvent HitManagement xAODEventInfo GeneratorObjects MuonCondData MuonReadoutGeometry MuonDigitContainer MuonIdHelpersLib MuonSimData PathResolver RDBAccessSvcLib ) # Install files from the package: atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/python/TGC_DigitizationConfig.py b/MuonSpectrometer/MuonDigitization/TGC_Digitization/python/TGC_DigitizationConfig.py index ae423145cd85..10e8e5d4ec77 100644 --- a/MuonSpectrometer/MuonDigitization/TGC_Digitization/python/TGC_DigitizationConfig.py +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/python/TGC_DigitizationConfig.py @@ -13,6 +13,14 @@ def TGC_FirstXing(): def TGC_LastXing(): return 75 +def setupTgcDigitASDposCondAlg(): + from AthenaCommon.AlgSequence import AthSequencer + condSequence = AthSequencer("AthCondSeq") + if not hasattr(condSequence, "TgcDigitASDposCondAlg"): + from IOVDbSvc.CondDB import conddb + conddb.addFolder("TGC_OFL", "/TGC/DIGIT/ASDPOS", className='CondAttrListCollection') + condSequence += CfgMgr.TgcDigitASDposCondAlg("TgcDigitASDposCondAlg") + def TgcDigitizationTool(name="TgcDigitizationTool", **kwargs): if jobproperties.Digitization.doXingByXingPileUp(): # PileUpTool approach # This should match the range for the TGC in Simulation/Digitization/share/MuonDigitization.py @@ -26,6 +34,11 @@ def TgcDigitizationTool(name="TgcDigitizationTool", **kwargs): else: kwargs.setdefault("OutputSDOName", "TGC_SDO") + from Digitization.DigitizationFlags import digitizationFlags + if digitizationFlags.UseUpdatedTGCConditions(): + setupTgcDigitASDposCondAlg() + kwargs.setdefault("TGCDigitASDposKey", "TGCDigitASDposData") + return CfgMgr.TgcDigitizationTool(name, **kwargs) def getTgcRange(name="TgcRange", **kwargs): @@ -46,6 +59,12 @@ def Tgc_OverlayDigitizationTool(name="Tgc_OverlayDigitizationTool", **kwargs): kwargs.setdefault("OutputObjectName",overlayFlags.evtStore()+"+TGC_DIGITS") if not overlayFlags.isDataOverlay(): kwargs.setdefault("OutputSDOName",overlayFlags.evtStore()+"+TGC_SDO") + + from Digitization.DigitizationFlags import digitizationFlags + if digitizationFlags.UseUpdatedTGCConditions(): + setupTgcDigitASDposCondAlg() + kwargs.setdefault("TGCDigitASDposKey", "TGCDigitASDposData") + return TgcDigitizationTool(name,**kwargs) def getTGC_OverlayDigitizer(name="TGC_OverlayDigitizer", **kwargs): diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/share/TGC_Digitization_ASDpropTimeOffset.dat b/MuonSpectrometer/MuonDigitization/TGC_Digitization/share/TGC_Digitization_ASDpropTimeOffset.dat new file mode 100644 index 000000000000..d7291067895d --- /dev/null +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/share/TGC_Digitization_ASDpropTimeOffset.dat @@ -0,0 +1,236 @@ +41 1 0 1 16 -5 +42 1 0 1 16 -6 +42 2 0 1 16 -4.5 +42 3 0 1 16 -5 +42 4 0 1 16 -8 +43 1 0 1 16 -5 +44 1 0 1 16 -6 +44 2 0 1 16 -6 +44 3 0 1 16 -6 +44 4 0 1 16 -6 +44 5 0 1 16 -6 +45 1 0 1 16 -5 +46 1 0 1 16 -6 +46 2 0 1 16 -6 +46 3 0 1 16 -6 +46 4 0 1 16 -6 +46 5 0 1 16 -6 +47 1 0 1 16 -6 +48 1 0 1 16 -8 +41 -1 0 1 16 -5 +42 -1 0 1 16 -6 +42 -2 0 1 16 -4.5 +42 -3 0 1 16 -6 +42 -4 0 1 16 -8 +43 -1 0 1 16 -5 +44 -1 0 1 16 -6 +44 -2 0 1 16 -6 +44 -3 0 1 16 -6 +44 -4 0 1 16 -6 +44 -5 0 1 16 -6 +45 -1 0 1 16 -5 +46 -1 0 1 16 -6 +46 -2 0 1 16 -6 +46 -3 0 1 16 -6 +46 -4 0 1 16 -6 +46 -5 0 1 16 -6 +47 -1 0 1 16 -6 +48 -1 0 1 16 -8 +41 1 0 2 32 -5 +42 1 0 2 32 -6 +42 2 0 2 32 -4.5 +42 3 0 2 32 -5 +42 4 0 2 32 -8 +43 1 0 2 32 -5 +44 1 0 2 32 -6 +44 2 0 2 32 -6 +44 3 0 2 32 -6 +44 4 0 2 32 -6 +44 5 0 2 32 -6 +45 1 0 2 32 -5 +46 1 0 2 32 -6 +46 2 0 2 32 -6 +46 3 0 2 32 -6 +46 4 0 2 32 -6 +46 5 0 2 32 -6 +47 1 0 2 32 -7 +48 1 0 2 32 -9 +41 -1 0 2 32 -5 +42 -1 0 2 32 -6 +42 -2 0 2 32 -4.5 +42 -3 0 2 32 -5 +42 -4 0 2 32 -8 +43 -1 0 2 32 -5 +44 -1 0 2 32 -6 +44 -2 0 2 32 -6 +44 -3 0 2 32 -6 +44 -4 0 2 32 -6 +44 -5 0 2 32 -6 +45 -1 0 2 32 -5 +46 -1 0 2 32 -6 +46 -2 0 2 32 -6 +46 -3 0 2 32 -6 +46 -4 0 2 32 -6 +46 -5 0 2 32 -6 +47 -1 0 2 32 -7 +48 -1 0 2 32 -9 +41 1 0 3 48 -5 +42 1 0 3 48 -6 +42 2 0 3 48 -4.5 +43 1 0 3 48 -5 +44 1 0 3 48 -6 +44 2 0 3 48 -6 +45 1 0 3 48 -5 +46 1 0 3 48 -6 +46 2 0 3 48 -6 +41 -1 0 3 48 -5 +42 -1 0 3 48 -6 +42 -2 0 3 48 -4.5 +43 -1 0 3 48 -5 +44 -1 0 3 48 -6 +44 -2 0 3 48 -6 +45 -1 0 3 48 -5 +46 -1 0 3 48 -6 +46 -2 0 3 48 -6 +41 1 0 4 64 -5 +42 1 0 4 64 -6 +42 2 0 4 64 -4.5 +43 1 0 4 64 -5 +44 1 0 4 64 -6 +44 2 0 4 64 -6 +45 1 0 4 64 -5 +46 1 0 4 64 -6 +46 2 0 4 64 -6 +41 -1 0 4 64 -5 +42 -1 0 4 64 -6 +42 -2 0 4 64 -4.5 +43 -1 0 4 64 -5 +44 -1 0 4 64 -6 +44 -2 0 4 64 -6 +45 -1 0 4 64 -5 +46 -1 0 4 64 -6 +46 -2 0 4 64 -6 +41 1 0 5 80 -5 +42 1 0 5 80 -6 +43 1 0 5 80 -5 +44 1 0 5 80 -6 +44 2 0 5 80 -6 +45 1 0 5 80 -5 +46 1 0 5 80 -6 +46 2 0 5 80 -6 +41 -1 0 5 80 -5 +42 -1 0 5 80 -6 +43 -1 0 5 80 -5 +44 -1 0 5 80 -6 +44 -2 0 5 80 -6 +45 -1 0 5 80 -5 +46 -1 0 5 80 -6 +46 -2 0 5 80 -6 +41 1 0 6 96 -5 +42 1 0 6 96 -6 +43 1 0 6 96 -5 +44 1 0 6 96 -6 +44 2 0 6 96 -6 +45 1 0 6 96 -5 +46 1 0 6 96 -6 +46 2 0 6 96 -6 +41 -1 0 6 96 -5 +42 -1 0 6 96 -6 +43 -1 0 6 96 -5 +44 -1 0 6 96 -6 +44 -2 0 6 96 -6 +45 -1 0 6 96 -5 +46 -1 0 6 96 -6 +46 -2 0 6 96 -6 +41 1 0 7 112 -5 +43 1 0 7 112 -5 +44 1 0 7 112 -6 +44 2 0 7 112 -6 +45 1 0 7 112 -5 +46 2 0 7 112 -6 +41 -1 0 7 112 -5 +43 -1 0 7 112 -5 +44 -1 0 7 112 -6 +44 -2 0 7 112 -6 +45 -1 0 7 112 -5 +46 -2 0 7 112 -6 +43 1 0 8 128 -5 +45 1 0 8 128 -5 +43 -1 0 8 128 -5 +45 -1 0 8 128 -5 +41 1 1 1 16 -1.5 +42 1 1 1 16 -1.5 +42 2 1 1 16 -1.5 +42 3 1 1 16 -2 +42 4 1 1 16 -2 +43 1 1 1 16 -2 +44 1 1 1 16 -1.5 +44 2 1 1 16 -1.5 +44 3 1 1 16 -2 +44 4 1 1 16 -2 +44 5 1 1 16 -2 +45 1 1 1 16 -2 +46 1 1 1 16 -1.5 +46 2 1 1 16 -1.5 +46 3 1 1 16 -2 +46 4 1 1 16 -2 +46 5 1 1 16 -2 +47 1 1 1 16 -8 +48 1 1 1 16 -7.5 +41 -1 1 1 16 -1.5 +42 -1 1 1 16 -1.5 +42 -2 1 1 16 -1.5 +42 -3 1 1 16 -2 +42 -4 1 1 16 -2 +43 -1 1 1 16 -2 +44 -1 1 1 16 -1.5 +44 -2 1 1 16 -1.5 +44 -3 1 1 16 -2 +44 -4 1 1 16 -2 +44 -5 1 1 16 -2 +45 -1 1 1 16 -2 +46 -1 1 1 16 -1.5 +46 -2 1 1 16 -1.5 +46 -3 1 1 16 -2 +46 -4 1 1 16 -2 +46 -5 1 1 16 -2 +47 -1 1 1 16 -8 +48 -1 1 1 16 -7.5 +41 1 1 2 32 -1.5 +42 1 1 2 32 -1.5 +42 2 1 2 32 -1.5 +42 3 1 2 32 -2 +42 4 1 2 32 -2 +43 1 1 2 32 -2 +44 1 1 2 32 -1.5 +44 2 1 2 32 -1.5 +44 3 1 2 32 -2 +44 4 1 2 32 -2 +44 5 1 2 32 -2 +45 1 1 2 32 -2 +46 1 1 2 32 -1.5 +46 2 1 2 32 -1.5 +46 3 1 2 32 -2 +46 4 1 2 32 -2 +46 5 1 2 32 -2 +47 1 1 2 32 -8 +48 1 1 2 32 -7.5 +41 -1 1 2 32 -1.5 +42 -1 1 2 32 -1.5 +42 -2 1 2 32 -1.5 +42 -3 1 2 32 -2 +42 -4 1 2 32 -2 +43 -1 1 2 32 -2 +44 -1 1 2 32 -1.5 +44 -2 1 2 32 -1.5 +44 -3 1 2 32 -2 +44 -4 1 2 32 -2 +44 -5 1 2 32 -2 +45 -1 1 2 32 -2 +46 -1 1 2 32 -1.5 +46 -2 1 2 32 -1.5 +46 -3 1 2 32 -2 +46 -4 1 2 32 -2 +46 -5 1 2 32 -2 +47 -1 1 2 32 -8 +48 -1 1 2 32 -7.5 diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/share/TGC_Digitization_StripPosition.dat b/MuonSpectrometer/MuonDigitization/TGC_Digitization/share/TGC_Digitization_StripPosition.dat new file mode 100644 index 000000000000..1fc966361e2c --- /dev/null +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/share/TGC_Digitization_StripPosition.dat @@ -0,0 +1,608 @@ +41 1 1 -537.92 +41 1 2 -523.07 +41 1 3 -487.23 +41 1 4 -451.48 +41 1 5 -415.8 +41 1 6 -380.18 +41 1 7 -344.63 +41 1 8 -309.13 +41 1 9 -273.68 +41 1 10 -238.28 +41 1 11 -202.91 +41 1 12 -167.57 +41 1 13 -132.27 +41 1 14 -96.98 +41 1 15 -61.71 +41 1 16 -26.44 +41 1 17 8.81 +41 1 18 44.07 +41 1 19 79.34 +41 1 20 114.62 +41 1 21 149.92 +41 1 22 185.24 +41 1 23 220.59 +41 1 24 255.97 +41 1 25 291.4 +41 1 26 326.87 +41 1 27 362.4 +41 1 28 397.98 +41 1 29 433.63 +41 1 30 469.35 +41 1 31 505.14 +41 1 32 541.01 +42 1 1 -438.01 +42 1 2 -404.78 +42 1 3 -377.27 +42 1 4 -349.77 +42 1 5 -322.28 +42 1 6 -294.81 +42 1 7 -267.35 +42 1 8 -239.9 +42 1 9 -212.46 +42 1 10 -185.03 +42 1 11 -157.6 +42 1 12 -130.18 +42 1 13 -102.77 +42 1 14 -75.36 +42 1 15 -47.96 +42 1 16 -20.55 +42 1 17 6.85 +42 1 18 34.25 +42 1 19 61.66 +42 1 20 89.07 +42 1 21 116.48 +42 1 22 143.89 +42 1 23 171.31 +42 1 24 198.74 +42 1 25 226.18 +42 1 26 253.62 +42 1 27 281.08 +42 1 28 308.54 +42 1 29 336.02 +42 1 30 363.51 +42 1 31 391.02 +42 1 32 418.54 +42 2 1 -438.76 +42 2 2 -401.47 +42 2 3 -374.18 +42 2 4 -346.91 +42 2 5 -319.65 +42 2 6 -292.4 +42 2 7 -265.16 +42 2 8 -237.94 +42 2 9 -210.72 +42 2 10 -183.51 +42 2 11 -156.31 +42 2 12 -129.12 +42 2 13 -101.93 +42 2 14 -74.75 +42 2 15 -47.56 +42 2 16 -20.38 +42 2 17 6.79 +42 2 18 33.97 +42 2 19 61.15 +42 2 20 88.34 +42 2 21 115.52 +42 2 22 142.72 +42 2 23 169.91 +42 2 24 197.12 +42 2 25 224.33 +42 2 26 251.55 +42 2 27 278.78 +42 2 28 306.02 +42 2 29 333.28 +42 2 30 360.55 +42 2 31 387.83 +42 2 32 415.13 +42 3 1 -670.3 +42 3 2 -630 +42 3 3 -587.17 +42 3 4 -544.37 +42 3 5 -501.59 +42 3 6 -458.84 +42 3 7 -416.1 +42 3 8 -373.37 +42 3 9 -330.67 +42 3 10 -287.97 +42 3 11 -245.29 +42 3 12 -202.62 +42 3 13 -159.95 +42 3 14 -117.29 +42 3 15 -74.64 +42 3 16 -31.99 +42 3 17 10.66 +42 3 18 53.31 +42 3 19 95.96 +42 3 20 138.62 +42 3 21 181.28 +42 3 22 223.95 +42 3 23 266.63 +42 3 24 309.32 +42 3 25 352.02 +42 3 26 394.73 +42 3 27 437.46 +42 3 28 480.21 +42 3 29 522.98 +42 3 30 565.77 +42 3 31 608.58 +42 3 32 651.42 +42 4 1 -664.93 +42 4 2 -624.57 +42 4 3 -582.12 +42 4 4 -539.69 +42 4 5 -497.28 +42 4 6 -454.89 +42 4 7 -412.52 +42 4 8 -370.16 +42 4 9 -327.82 +42 4 10 -285.49 +42 4 11 -243.18 +42 4 12 -200.87 +42 4 13 -158.57 +42 4 14 -116.28 +42 4 15 -74 +42 4 16 -31.71 +42 4 17 10.57 +42 4 18 52.85 +42 4 19 95.14 +42 4 20 137.43 +42 4 21 179.72 +42 4 22 222.02 +42 4 23 264.33 +42 4 24 306.66 +42 4 25 348.99 +42 4 26 391.34 +42 4 27 433.7 +42 4 28 476.08 +42 4 29 518.48 +42 4 30 560.9 +42 4 31 603.34 +42 4 32 645.81 +43 1 1 -590.15 +43 1 2 -568.82 +43 1 3 -529.85 +43 1 4 -490.97 +43 1 5 -452.17 +43 1 6 -413.44 +43 1 7 -374.77 +43 1 8 -336.17 +43 1 9 -297.62 +43 1 10 -259.12 +43 1 11 -220.66 +43 1 12 -182.23 +43 1 13 -143.83 +43 1 14 -105.46 +43 1 15 -67.1 +43 1 16 -28.76 +43 1 17 9.59 +43 1 18 47.93 +43 1 19 86.28 +43 1 20 124.65 +43 1 21 163.03 +43 1 22 201.44 +43 1 23 239.88 +43 1 24 278.36 +43 1 25 316.89 +43 1 26 355.47 +43 1 27 394.1 +43 1 28 432.79 +43 1 29 471.56 +43 1 30 510.4 +43 1 31 549.32 +43 1 32 590.15 +44 1 1 -438.01 +44 1 2 -404.78 +44 1 3 -377.27 +44 1 4 -349.77 +44 1 5 -322.28 +44 1 6 -294.81 +44 1 7 -267.35 +44 1 8 -239.9 +44 1 9 -212.46 +44 1 10 -185.03 +44 1 11 -157.6 +44 1 12 -130.18 +44 1 13 -102.77 +44 1 14 -75.36 +44 1 15 -47.96 +44 1 16 -20.55 +44 1 17 6.85 +44 1 18 34.25 +44 1 19 61.66 +44 1 20 89.07 +44 1 21 116.48 +44 1 22 143.89 +44 1 23 171.31 +44 1 24 198.74 +44 1 25 226.18 +44 1 26 253.62 +44 1 27 281.08 +44 1 28 308.54 +44 1 29 336.02 +44 1 30 363.51 +44 1 31 391.02 +44 1 32 418.54 +44 2 1 -438.76 +44 2 2 -401.47 +44 2 3 -374.18 +44 2 4 -346.91 +44 2 5 -319.65 +44 2 6 -292.4 +44 2 7 -265.16 +44 2 8 -237.94 +44 2 9 -210.72 +44 2 10 -183.51 +44 2 11 -156.31 +44 2 12 -129.12 +44 2 13 -101.93 +44 2 14 -74.75 +44 2 15 -47.56 +44 2 16 -20.38 +44 2 17 6.79 +44 2 18 33.97 +44 2 19 61.15 +44 2 20 88.34 +44 2 21 115.52 +44 2 22 142.72 +44 2 23 169.91 +44 2 24 197.12 +44 2 25 224.33 +44 2 26 251.55 +44 2 27 278.78 +44 2 28 306.02 +44 2 29 333.28 +44 2 30 360.55 +44 2 31 387.83 +44 2 32 415.13 +44 3 1 -670.3 +44 3 2 -630 +44 3 3 -587.17 +44 3 4 -544.37 +44 3 5 -501.59 +44 3 6 -458.84 +44 3 7 -416.1 +44 3 8 -373.37 +44 3 9 -330.67 +44 3 10 -287.97 +44 3 11 -245.29 +44 3 12 -202.62 +44 3 13 -159.95 +44 3 14 -117.29 +44 3 15 -74.64 +44 3 16 -31.99 +44 3 17 10.66 +44 3 18 53.31 +44 3 19 95.96 +44 3 20 138.62 +44 3 21 181.28 +44 3 22 223.95 +44 3 23 266.63 +44 3 24 309.32 +44 3 25 352.02 +44 3 26 394.73 +44 3 27 437.46 +44 3 28 480.21 +44 3 29 522.98 +44 3 30 565.77 +44 3 31 608.58 +44 3 32 651.42 +44 4 1 -664.93 +44 4 2 -624.57 +44 4 3 -582.12 +44 4 4 -539.69 +44 4 5 -497.28 +44 4 6 -454.89 +44 4 7 -412.52 +44 4 8 -370.16 +44 4 9 -327.82 +44 4 10 -285.49 +44 4 11 -243.18 +44 4 12 -200.87 +44 4 13 -158.57 +44 4 14 -116.28 +44 4 15 -74 +44 4 16 -31.71 +44 4 17 10.57 +44 4 18 52.85 +44 4 19 95.14 +44 4 20 137.43 +44 4 21 179.72 +44 4 22 222.02 +44 4 23 264.33 +44 4 24 306.66 +44 4 25 348.99 +44 4 26 391.34 +44 4 27 433.7 +44 4 28 476.08 +44 4 29 518.48 +44 4 30 560.9 +44 4 31 603.34 +44 4 32 645.81 +44 5 1 -741.67 +44 5 2 -706.03 +44 5 3 -658.03 +44 5 4 -610.07 +44 5 5 -562.13 +44 5 6 -514.21 +44 5 7 -466.31 +44 5 8 -418.43 +44 5 9 -370.57 +44 5 10 -322.73 +44 5 11 -274.89 +44 5 12 -227.07 +44 5 13 -179.25 +44 5 14 -131.45 +44 5 15 -83.65 +44 5 16 -35.85 +44 5 17 11.95 +44 5 18 59.75 +44 5 19 107.55 +44 5 20 155.35 +44 5 21 203.16 +44 5 22 250.98 +44 5 23 298.81 +44 5 24 346.65 +44 5 25 394.5 +44 5 26 442.37 +44 5 27 490.26 +44 5 28 538.17 +44 5 29 586.1 +44 5 30 634.05 +44 5 31 682.03 +44 5 32 730.03 +45 1 1 -590.15 +45 1 2 -579.94 +45 1 3 -540.21 +45 1 4 -500.57 +45 1 5 -461.01 +45 1 6 -421.52 +45 1 7 -382.1 +45 1 8 -342.74 +45 1 9 -303.44 +45 1 10 -264.18 +45 1 11 -224.97 +45 1 12 -185.79 +45 1 13 -146.65 +45 1 14 -107.52 +45 1 15 -68.42 +45 1 16 -29.32 +45 1 17 9.77 +45 1 18 48.87 +45 1 19 87.97 +45 1 20 127.08 +45 1 21 166.22 +45 1 22 205.38 +45 1 23 244.57 +45 1 24 283.81 +45 1 25 323.08 +45 1 26 362.41 +45 1 27 401.8 +45 1 28 441.25 +45 1 29 480.78 +45 1 30 520.38 +45 1 31 560.06 +45 1 32 599.84 +46 1 1 -438.01 +46 1 2 -404.78 +46 1 3 -377.27 +46 1 4 -349.77 +46 1 5 -322.28 +46 1 6 -294.81 +46 1 7 -267.35 +46 1 8 -239.9 +46 1 9 -212.46 +46 1 10 -185.03 +46 1 11 -157.6 +46 1 12 -130.18 +46 1 13 -102.77 +46 1 14 -75.36 +46 1 15 -47.96 +46 1 16 -20.55 +46 1 17 6.85 +46 1 18 34.25 +46 1 19 61.66 +46 1 20 89.07 +46 1 21 116.48 +46 1 22 143.89 +46 1 23 171.31 +46 1 24 198.74 +46 1 25 226.18 +46 1 26 253.62 +46 1 27 281.08 +46 1 28 308.54 +46 1 29 336.02 +46 1 30 363.51 +46 1 31 391.02 +46 1 32 418.54 +46 2 1 -438.76 +46 2 2 -401.47 +46 2 3 -374.18 +46 2 4 -346.91 +46 2 5 -319.65 +46 2 6 -292.4 +46 2 7 -265.16 +46 2 8 -237.94 +46 2 9 -210.72 +46 2 10 -183.51 +46 2 11 -156.31 +46 2 12 -129.12 +46 2 13 -101.93 +46 2 14 -74.75 +46 2 15 -47.56 +46 2 16 -20.38 +46 2 17 6.79 +46 2 18 33.97 +46 2 19 61.15 +46 2 20 88.34 +46 2 21 115.52 +46 2 22 142.72 +46 2 23 169.91 +46 2 24 197.12 +46 2 25 224.33 +46 2 26 251.55 +46 2 27 278.78 +46 2 28 306.02 +46 2 29 333.28 +46 2 30 360.55 +46 2 31 387.83 +46 2 32 415.13 +46 3 1 -670.3 +46 3 2 -630 +46 3 3 -587.17 +46 3 4 -544.37 +46 3 5 -501.59 +46 3 6 -458.84 +46 3 7 -416.1 +46 3 8 -373.37 +46 3 9 -330.67 +46 3 10 -287.97 +46 3 11 -245.29 +46 3 12 -202.62 +46 3 13 -159.95 +46 3 14 -117.29 +46 3 15 -74.64 +46 3 16 -31.99 +46 3 17 10.66 +46 3 18 53.31 +46 3 19 95.96 +46 3 20 138.62 +46 3 21 181.28 +46 3 22 223.95 +46 3 23 266.63 +46 3 24 309.32 +46 3 25 352.02 +46 3 26 394.73 +46 3 27 437.46 +46 3 28 480.21 +46 3 29 522.98 +46 3 30 565.77 +46 3 31 608.58 +46 3 32 651.42 +46 4 1 -664.93 +46 4 2 -624.57 +46 4 3 -582.12 +46 4 4 -539.69 +46 4 5 -497.28 +46 4 6 -454.89 +46 4 7 -412.52 +46 4 8 -370.16 +46 4 9 -327.82 +46 4 10 -285.49 +46 4 11 -243.18 +46 4 12 -200.87 +46 4 13 -158.57 +46 4 14 -116.28 +46 4 15 -74 +46 4 16 -31.71 +46 4 17 10.57 +46 4 18 52.85 +46 4 19 95.14 +46 4 20 137.43 +46 4 21 179.72 +46 4 22 222.02 +46 4 23 264.33 +46 4 24 306.66 +46 4 25 348.99 +46 4 26 391.34 +46 4 27 433.7 +46 4 28 476.08 +46 4 29 518.48 +46 4 30 560.9 +46 4 31 603.34 +46 4 32 645.81 +46 5 1 -741.67 +46 5 2 -706.03 +46 5 3 -658.03 +46 5 4 -610.07 +46 5 5 -562.13 +46 5 6 -514.21 +46 5 7 -466.31 +46 5 8 -418.43 +46 5 9 -370.57 +46 5 10 -322.73 +46 5 11 -274.89 +46 5 12 -227.07 +46 5 13 -179.25 +46 5 14 -131.45 +46 5 15 -83.65 +46 5 16 -35.85 +46 5 17 11.95 +46 5 18 59.75 +46 5 19 107.55 +46 5 20 155.35 +46 5 21 203.16 +46 5 22 250.98 +46 5 23 298.81 +46 5 24 346.65 +46 5 25 394.5 +46 5 26 442.37 +46 5 27 490.26 +46 5 28 538.17 +46 5 29 586.1 +46 5 30 634.05 +46 5 31 682.03 +46 5 32 730.03 +47 1 1 -586.2 +47 1 2 -546.67 +47 1 3 -509.27 +47 1 4 -471.94 +47 1 5 -434.68 +47 1 6 -397.47 +47 1 7 -360.33 +47 1 8 -323.23 +47 1 9 -286.18 +47 1 10 -249.17 +47 1 11 -212.19 +47 1 12 -175.25 +47 1 13 -138.33 +47 1 14 -101.42 +47 1 15 -64.54 +47 1 16 -27.66 +47 1 17 9.22 +47 1 18 46.1 +47 1 19 82.98 +47 1 20 119.87 +47 1 21 156.78 +47 1 22 193.72 +47 1 23 230.68 +47 1 24 267.67 +47 1 25 304.7 +47 1 26 341.77 +47 1 27 378.89 +47 1 28 416.07 +47 1 29 453.3 +47 1 30 490.6 +47 1 31 527.96 +47 1 32 565.4 +48 1 1 -517.54 +48 1 2 -481.84 +48 1 3 -449.05 +48 1 4 -416.29 +48 1 5 -383.55 +48 1 6 -350.84 +48 1 7 -318.14 +48 1 8 -285.46 +48 1 9 -252.8 +48 1 10 -220.15 +48 1 11 -187.51 +48 1 12 -154.89 +48 1 13 -122.27 +48 1 14 -89.66 +48 1 15 -57.05 +48 1 16 -24.45 +48 1 17 8.15 +48 1 18 40.75 +48 1 19 73.36 +48 1 20 105.96 +48 1 21 138.58 +48 1 22 171.2 +48 1 23 203.83 +48 1 24 236.47 +48 1 25 269.13 +48 1 26 301.8 +48 1 27 334.49 +48 1 28 367.19 +48 1 29 399.92 +48 1 30 432.67 +48 1 31 465.44 +48 1 32 498.24 diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitMaker.cxx b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitMaker.cxx index 0e92fd2117ae..92e7bd9c54bc 100644 --- a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitMaker.cxx +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitMaker.cxx @@ -15,6 +15,7 @@ #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonReadoutGeometry/TgcReadoutElement.h" +#include "AthenaBaseComps/AthCheckMacros.h" #include "GaudiKernel/MsgStream.h" #include "PathResolver/PathResolver.h" @@ -30,6 +31,7 @@ TgcDigitMaker::TgcDigitMaker(TgcHitIdHelper* hitIdHelper, const MuonGM::MuonDetectorManager* mdManager, unsigned int runperiod) + : AthMessaging (Athena::getMessageSvc(), "TgcDigitMaker") { m_hitIdHelper = hitIdHelper; m_mdManager = mdManager; @@ -62,24 +64,28 @@ StatusCode TgcDigitMaker::initialize() // initialize the TGC identifier helper m_idHelper = m_mdManager->tgcIdHelper(); - if (readFileOfTimeJitter().isFailure()) { - return StatusCode::FAILURE; - } + ATH_CHECK(readFileOfTimeJitter()); // Read share/TGC_Digitization_energyThreshold.dat file and store values in m_energyThreshold. - readFileOfEnergyThreshold(); + ATH_CHECK(readFileOfEnergyThreshold()); // Read share/TGC_Digitization_crossTalk.dat file and store values in m_crossTalk. - readFileOfCrossTalk(); + ATH_CHECK(readFileOfCrossTalk()); // Read share/TGC_Digitization_deadChamber.dat file and store values in m_isDeadChamber. - readFileOfDeadChamber(); + ATH_CHECK(readFileOfDeadChamber()); // Read share/TGC_Digitization_timeWindowOffset.dat file and store values in m_timeWindowOffset. - readFileOfTimeWindowOffset(); + ATH_CHECK(readFileOfTimeWindowOffset()); // Read share/TGC_Digitization_alignment.dat file and store values in m_alignmentZ, m_alignmentT, m_alignmentS, m_alignmentTHS - readFileOfAlignment(); + ATH_CHECK(readFileOfAlignment()); + + // Read share/TGC_Digitization_ASDpropTimeOffset.dat file and store values in m_ASDpropTimeOffset, m_maxch. + ATH_CHECK(readFileOfASDpropTimeOffset()); + + // Read share/TGC_Digitization_StripPosition.dat file and store values in m_StripPosition. + ATH_CHECK(readFileOfStripPosition()); return StatusCode::SUCCESS; } @@ -88,7 +94,8 @@ StatusCode TgcDigitMaker::initialize() // Execute Digitization //--------------------------------------------------- TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, - const double globalHitTime, + const double globalHitTime, + const TgcDigitASDposData* ASDpos, CLHEP::HepRandomEngine* rndmEngine) { ////////// convert ID for this digitizer system @@ -97,21 +104,20 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, int stationEta = m_hitIdHelper->GetStationEta(Id); int stationPhi = m_hitIdHelper->GetStationPhi(Id); int ilyr = m_hitIdHelper->GetGasGap(Id); - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "executeDigi() Got HIT Id." << endmsg; + ATH_MSG_DEBUG("executeDigi() Got HIT Id."); // Check the chamber is dead or not. if(isDeadChamber(stationName, stationEta, stationPhi, ilyr)) return nullptr; const Identifier elemId = m_idHelper -> elementID(stationName,stationEta,stationPhi); - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "executeDigi() - element identifier is: " << m_idHelper->show_to_string(elemId) << endmsg; + ATH_MSG_DEBUG("executeDigi() - element identifier is: " << m_idHelper->show_to_string(elemId)); const MuonGM::TgcReadoutElement *tgcChamber = m_mdManager->getTgcReadoutElement(elemId); if(!tgcChamber) { - if(msgLevel(MSG::WARNING)) msg(MSG::WARNING) << "executeDigi() - no ReadoutElement found for " << m_idHelper->show_to_string(elemId) << endmsg; + ATH_MSG_WARNING("executeDigi() - no ReadoutElement found for " << m_idHelper->show_to_string(elemId)); return nullptr; } - const Amg::Vector3D centreChamber = tgcChamber->globalPosition(); float height = tgcChamber->getRsize(); float hmin = sqrt(pow(centreChamber.x(),2)+pow(centreChamber.y(),2)) - height/2.; @@ -119,16 +125,13 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, float frameZwidth = 17. *CLHEP::mm; float frameXwidth = 20. *CLHEP::mm; - - IdContext tgcContext = m_idHelper->module_context(); IdentifierHash coll_hash; if(m_idHelper->get_hash(elemId, coll_hash, &tgcContext)) { - if(msgLevel(MSG::WARNING)) msg(MSG::WARNING) << "Unable to get TGC hash id from TGC Digit collection " + ATH_MSG_WARNING("Unable to get TGC hash id from TGC Digit collection " << "context begin_index = " << tgcContext.begin_index() << " context end_index = " << tgcContext.end_index() - << " the identifier is " - << endmsg; + << " the identifier is " << elemId); elemId.show(); } @@ -193,15 +196,14 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, // check a hit in the sensitive area if(zPosInSensArea < 0. || zPosInSensArea > tgcChamber->getTotalWires(ilyr)*wirePitch) { - iWireGroup[iPosition] = 0; - posInWireGroup[iPosition] = 0.; - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "executeDigi(): Wire: Hit position located at outside of a sensitive volume, " + iWireGroup[iPosition] = 0; + posInWireGroup[iPosition] = 0.; + ATH_MSG_DEBUG("executeDigi(): Wire: Hit position located at outside of a sensitive volume, " << " id: " << stationName << "/" << stationEta << "/" << stationPhi << "/" << ilyr << " position: " << zPosInSensArea << " xlocal: " << zLocal << " dir cosine: " << direCos[0] << "/" << direCos[1] << "/" << direCos[2] - << " active region: " << height-frameZwidth*2. - << endmsg; + << " active region: " << height-frameZwidth*2.); } else { int igang = 1; @@ -222,7 +224,7 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, int iWG[2] = {iWireGroup[jWG[0]], iWireGroup[jWG[1]]}; float posInWG[2] = {posInWireGroup[jWG[0]], posInWireGroup[jWG[1]]}; if(iWG[0]!=iWG[1]) { - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "executeDigi(): Multihits found in WIRE GROUPs:" << iWG[0] << " " << iWG[1] << endmsg; + ATH_MSG_DEBUG("executeDigi(): Multihits found in WIRE GROUPs:" << iWG[0] << " " << iWG[1]); } for(int iwg=iWG[0]; iwg<=iWG[1]; iwg++) { @@ -234,16 +236,29 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, float ySignPhi = (stationPhi%2==1) ? -1. : +1.; // stationPhi%2==0 : +1. : ASD attached at the smaller phi side of TGC // stationPhi%2==1 : -1. : ASD attached at the larger phi side of TGC - float wDigitTime = bunchTime + jit + wirePropagationTime*(ySignPhi*yLocal + tgcChamber->chamberWidth(zLocal)/2.) + this->timeDiffByCableRadiusOfInner(iStationName, stationPhi, iwg); + float wTimeDiffByRadiusOfInner = this->timeDiffByCableRadiusOfInner(iStationName, stationPhi, iwg); + float wDigitTime = bunchTime + jit + wirePropagationTime*(ySignPhi*yLocal + tgcChamber->chamberWidth(zLocal)/2.) + wTimeDiffByRadiusOfInner; + float wOffset = m_timeWindowOffsetSensor[sensor]; + float wASDDis{-1000}; + float wSigPropTimeDelay{-1000}; + if (ASDpos != nullptr) { + wASDDis = this->getDistanceToAsdFromSensor(ASDpos, iStationName, abs(stationEta), stationPhi, sensor, iwg, zLocal); + float wCableDis = wASDDis + (ySignPhi*yLocal + tgcChamber->chamberWidth(zLocal)/2.)/1000.; + wSigPropTimeDelay = this->getSigPropTimeDelay(wCableDis); + wDigitTime += wSigPropTimeDelay + wASDDis * 5; + wOffset += getASDpropTimeOffset(elemId, (int)sensor, iwg); + } + TgcStation station = (m_idHelper->stationName(elemId) > 46) ? kINNER : kOUTER; - uint16_t bctag = bcTagging(wDigitTime,m_gateTimeWindow[station][sensor],m_timeWindowOffsetSensor[sensor]); + uint16_t bctag = bcTagging(wDigitTime,m_gateTimeWindow[station][sensor],wOffset); - if(bctag == 0x0) { - if(msgLevel(MSG::DEBUG)) { - msg(MSG::DEBUG ) << "WireGroup: digitized time is outside of time window. " << wDigitTime + if(bctag == 0x0) { + ATH_MSG_DEBUG("WireGroup: digitized time is outside of time window. " << wDigitTime << " bunchTime: " << bunchTime << " time jitter: " << jitter - << " propagation time: " << wirePropagationTime*(ySignPhi*yLocal + height/2. + frameXwidth) << endmsg; - } + << " propagation time: " << wirePropagationTime*(ySignPhi*yLocal + height/2. + frameXwidth) + << " signal delay time: " << wSigPropTimeDelay + << " time difference by cable radius of inner station: " << wTimeDiffByRadiusOfInner + << " propagation time to the ASD from the sensor: " << wASDDis * 5); } else { Identifier newId = m_idHelper -> channelID(stationName,stationEta,stationPhi, @@ -254,19 +269,18 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, randomCrossTalk(elemId, ilyr, sensor, iwg, posInWG[0], wDigitTime, rndmEngine, digits.get()); } - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "WireGroup: newid breakdown digitTime x/y/z direcos height_gang bctag: " + ATH_MSG_DEBUG("WireGroup: newid breakdown digitTime x/y/z direcos height_gang bctag: " << newId << " " << stationName << "/" << stationEta << "/" << stationPhi << "/" << ilyr << "/" << sensor << "/" << iwg << " " << wDigitTime << " " << localPos.x() << "/" << localPos.y() << "/" << localPos.z() << " " << direCos.x() << "/" << direCos.y() << "/" << direCos.z() << " " << height << " " << tgcChamber->getNWires(ilyr,iwg) << " " - << bctag << endmsg; - } + << bctag); + } } else { - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Wire Gang id is out of range. id, x/y/z, height: " << iwg - << " " << localPos.x() << "/" << localPos.y() << "/" << localPos.z() << " " << height - << endmsg; + ATH_MSG_DEBUG("Wire Gang id is out of range. id, x/y/z, height: " << iwg + << " " << localPos.x() << "/" << localPos.y() << "/" << localPos.z() << " " << height); } } } // end of wire group calculation @@ -290,20 +304,18 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, // check a hit in the sensitive area float zPos = zLocal+height/2.-frameZwidth; if (zPos < 0.) { - iStrip[iPosition] = 0; - posInStrip[iPosition] = 0.; - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Strip: Hit position located at outside of a sensitive volume, id, position, xlocal0/1, dir cosine: " + iStrip[iPosition] = 0; + posInStrip[iPosition] = 0.; + ATH_MSG_DEBUG("Strip: Hit position located at outside of a sensitive volume, id, position, xlocal0/1, dir cosine: " << stationName << "/" << stationEta << "/" << stationPhi << "/" << ilyr - << zPos << " " << zLocal << " " << direCos[0] << "/" << direCos[1] << "/" << direCos[2] - << endmsg; + << zPos << " " << zLocal << " " << direCos[0] << "/" << direCos[1] << "/" << direCos[2]); } else if (zPos > height-frameZwidth*2.) { - iStrip[iPosition] = tgcChamber -> getNStrips(ilyr) + 1; - posInStrip[iPosition] = 0.; - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Strip: Hit position located at outside of a sensitive volume, id, position, active region: " + iStrip[iPosition] = tgcChamber -> getNStrips(ilyr) + 1; + posInStrip[iPosition] = 0.; + ATH_MSG_DEBUG("Strip: Hit position located at outside of a sensitive volume, id, position, active region: " << stationName << "/" << stationEta << "/" << stationPhi << "/" << ilyr - << zPos << " " << height-frameZwidth*2. - << endmsg; + << zPos << " " << height-frameZwidth*2.); } else { // sensitive area @@ -321,9 +333,8 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, } float phiLocal = atan2(yLocal, zLocal+ height/2.+hmin); - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "dphi, phiLocal, yLocal, zLocall+ height/2.+hmin: " - << dphi << " " << phiLocal << " " << yLocal << " " << zLocal+height/2.+hmin - << endmsg; + ATH_MSG_DEBUG("dphi, phiLocal, yLocal, zLocall+ height/2.+hmin: " + << dphi << " " << phiLocal << " " << yLocal << " " << zLocal+height/2.+hmin); int istr = 0; if ((stationEta > 0 && ilyr == 1) || @@ -360,7 +371,7 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, int iStr[2] = {iStrip[jStr[0]], iStrip[jStr[1]]}; float posInStr[2] = {posInStrip[jStr[0]], posInStrip[jStr[1]]}; if(iStr[0]!=iStr[1]) { - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Multihits found in STRIPs:" << iStr[0] << " " << iStr[1] << endmsg; + ATH_MSG_DEBUG("Multihits found in STRIPs:" << iStr[0] << " " << iStr[1]); } for(int istr=iStr[0]; istr<=iStr[1]; istr++) { @@ -374,18 +385,29 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, float zSignEta = (abs(stationEta)%2 == 1 && abs(stationEta) != 5) ? -1. : +1.; // if(abs(stationEta)%2 == 1 && abs(stationEta) != 5) : -1. : ASD attached at the longer base of TGC // else : +1. : ASD attached at the shorter base of TGC - float sDigitTime = bunchTime + jitter + stripPropagationTime*(height/2. + frameZwidth + zSignEta*zLocal) + this->timeDiffByCableRadiusOfInner(iStationName, stationPhi, istr); + float sTimeDiffByRadiusOfInner = this->timeDiffByCableRadiusOfInner(iStationName, stationPhi, istr); + float sDigitTime = bunchTime + jitter + stripPropagationTime*(height/2. + frameZwidth + zSignEta*zLocal) + sTimeDiffByRadiusOfInner; + float sOffset = m_timeWindowOffsetSensor[sensor]; + float sASDDis{-1000}; + float sSigPropTimeDelay{-1000}; + if (ASDpos != nullptr) { + sASDDis = this->getDistanceToAsdFromSensor(ASDpos, iStationName, abs(stationEta), stationPhi, sensor, istr, getStripPosition(stationName, abs(stationEta), istr)); + float sCableDis = sASDDis + (height/2. + frameZwidth + zSignEta*zLocal)/1000.; + sSigPropTimeDelay = this->getSigPropTimeDelay(sCableDis); + sDigitTime += sSigPropTimeDelay + sASDDis * 5; + sOffset += getASDpropTimeOffset(elemId, (int)sensor, istr); + } TgcStation station = (m_idHelper->stationName(elemId) > 46) ? kINNER : kOUTER; - uint16_t bctag = bcTagging(sDigitTime,m_gateTimeWindow[station][sensor],m_timeWindowOffsetSensor[sensor]); + uint16_t bctag = bcTagging(sDigitTime,m_gateTimeWindow[station][sensor],sOffset); if(bctag == 0x0) { - if(msgLevel(MSG::DEBUG)) { - msg(MSG::DEBUG) << "Strip: Digitized time is outside of time window. " << sDigitTime + ATH_MSG_DEBUG("Strip: Digitized time is outside of time window. " << sDigitTime << " bunchTime: " << bunchTime << " time jitter: " << jitter << " propagation time: " << stripPropagationTime*(height/2. + frameZwidth + zSignEta*zLocal) - << endmsg; - } + << " signal delay time: " << sSigPropTimeDelay + << " time difference by cable radius of inner station: " << sTimeDiffByRadiusOfInner + << " propagation time to the ASD from the sensor: " << sASDDis * 5); } else { Identifier newId = m_idHelper -> channelID(stationName,stationEta,stationPhi, @@ -396,17 +418,17 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, randomCrossTalk(elemId, ilyr, sensor, iStr[0], posInStr[0], sDigitTime, rndmEngine, digits.get()); } - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Strip: newid breakdown digitTime x/y/z direcos r_center bctag: " + ATH_MSG_DEBUG("Strip: newid breakdown digitTime x/y/z direcos r_center bctag: " << newId << " " << stationName << "/" << stationEta << "/" << stationPhi << "/" << ilyr << "/" << sensor << "/" << istr << " " << sDigitTime << " " << localPos.x() << "/" << localPos.y() << "/" << localPos.z() << " " << direCos.x() << "/" << direCos.y() << "/" << direCos.z() << " " << height/2.+hmin << " " - << bctag << endmsg; + << bctag); } } else { - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "Strip id is out of range: gap, id: " << ilyr << " " << istr << endmsg; + ATH_MSG_DEBUG("Strip id is out of range: gap, id: " << ilyr << " " << istr); } } } // end of strip number calculation @@ -414,9 +436,6 @@ TgcDigitCollection* TgcDigitMaker::executeDigi(const TGCSimHit* hit, return digits.release(); } -MsgStream& TgcDigitMaker::msg(const MSG::Level lvl) const { return m_msg << lvl ; } -bool TgcDigitMaker::msgLevel(const MSG::Level lvl) const { return m_msg.get().level() <= lvl ; } -void TgcDigitMaker::setMessageLevel(const MSG::Level lvl) const { m_msg.get().setLevel(lvl); return; } //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ StatusCode TgcDigitMaker::readFileOfTimeJitter() @@ -430,12 +449,12 @@ StatusCode TgcDigitMaker::readFileOfTimeJitter() ifs.open(fileWithPath.c_str(), std::ios::in); } else { - msg(MSG::FATAL) << "readFileOfTimeJitter(): Could not find file " << fileName << endmsg; + ATH_MSG_FATAL("readFileOfTimeJitter(): Could not find file " << fileName); return StatusCode::FAILURE; } if(ifs.bad()){ - msg(MSG::FATAL) << "readFileOfTimeJitter(): Could not open file "<< fileName << endmsg; + ATH_MSG_FATAL("readFileOfTimeJitter(): Could not open file "<< fileName); return StatusCode::FAILURE; } @@ -443,20 +462,20 @@ StatusCode TgcDigitMaker::readFileOfTimeJitter() int bins = 0; int i = 0; float prob = 0.; + bool verbose = msgLvl(MSG::VERBOSE); while(ifs.good()){ ifs >> angle >> bins; if (ifs.eof()) break; - if(msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "readFileOfTimeJitter(): Timejitter, angle, Number of bins, prob. dist.: " << angle << " " << bins << " "; + ATH_MSG_VERBOSE("readFileOfTimeJitter(): Timejitter, angle, Number of bins, prob. dist.: " << angle << " " << bins << " "); m_vecAngle_Time.resize(i + 1); for (int j = 0; j < 41/*bins*/; j++) { ifs >> prob; m_vecAngle_Time[i].push_back(prob); - if (j == 0) - if(msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << "readFileOfTimeJitter(): "; - if(msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << prob << " "; + if (j == 0 && verbose) msg(MSG::VERBOSE) << "readFileOfTimeJitter(): "; + if(verbose) msg(MSG::VERBOSE) << prob << " "; } - if(msgLevel(MSG::VERBOSE)) msg(MSG::VERBOSE) << endmsg; + if(verbose) msg(MSG::VERBOSE) << endmsg; i++; } ifs.close(); @@ -495,7 +514,7 @@ float TgcDigitMaker::timeJitter(const Amg::Vector3D& direCosLocal, CLHEP::HepRan //+++++++++++++++++++++++++++++++++++++++++++++++ bool TgcDigitMaker::efficiencyCheck(const TgcSensor sensor, CLHEP::HepRandomEngine* rndmEngine) const { if(CLHEP::RandFlat::shoot(rndmEngine,0.0,1.0) < m_efficiency[sensor]) return true; - if(msgLevel(MSG::DEBUG)) msg(MSG::DEBUG) << "efficiencyCheck(): Hit removed for sensor= " << sensor << "(0=WIRE,1=STRIP)" << endmsg; + ATH_MSG_DEBUG("efficiencyCheck(): Hit removed for sensor= " << sensor << "(0=WIRE,1=STRIP)"); return false; } //+++++++++++++++++++++++++++++++++++++++++++++++ @@ -563,7 +582,7 @@ void TgcDigitMaker::addDigit(const Identifier id, const uint16_t bctag, TgcDigit return; } -void TgcDigitMaker::readFileOfEnergyThreshold() { +StatusCode TgcDigitMaker::readFileOfEnergyThreshold() { // Indices to be used int iStationName, stationEta, stationPhi, gasGap, isStrip; @@ -583,16 +602,16 @@ void TgcDigitMaker::readFileOfEnergyThreshold() { const std::string fileName = "TGC_Digitization_energyThreshold.dat"; std::string fileWithPath = PathResolver::find_file(fileName.c_str(), "DATAPATH"); if(fileWithPath.empty()) { - msg(MSG::FATAL) << "readFileOfEnergyThreshold(): Could not find file " << fileName.c_str() << endmsg; - return; + ATH_MSG_FATAL("readFileOfEnergyThreshold(): Could not find file " << fileName); + return StatusCode::FAILURE; } // Open the TGC_Digitization_energyThreshold.dat file std::ifstream ifs; ifs.open(fileWithPath.c_str(), std::ios::in); if(ifs.bad()) { - msg(MSG::FATAL) << "readFileOfEnergyThreshold(): Could not open file " << fileName.c_str() << endmsg; - return; + ATH_MSG_FATAL("readFileOfEnergyThreshold(): Could not open file " << fileName); + return StatusCode::FAILURE; } double energyThreshold; @@ -600,17 +619,14 @@ void TgcDigitMaker::readFileOfEnergyThreshold() { while(ifs.good()) { ifs >> iStationName >> stationEta >> stationPhi - >> gasGap >> isStrip >> energyThreshold; - if(msgLevel(MSG::DEBUG)) { - msg(MSG::DEBUG) << "TgcDigitMaker::readFileOfEnergyThreshold" + >> gasGap >> isStrip >> energyThreshold; + ATH_MSG_DEBUG("readFileOfEnergyThreshold" << " stationName= " << iStationName << " stationEta= " << stationEta << " stationPhi= " << stationPhi << " gasGap= " << gasGap << " isStrip= " << isStrip - << " energyThreshold(MeV)= " << energyThreshold - << endmsg; - } + << " energyThreshold(MeV)= " << energyThreshold); // Subtract offsets to use indices of energyThreshold array iStationName -= OFFSET_STATIONNAME; @@ -634,9 +650,11 @@ void TgcDigitMaker::readFileOfEnergyThreshold() { // Close the TGC_Digitization_energyThreshold.dat file ifs.close(); + + return StatusCode::SUCCESS; } -void TgcDigitMaker::readFileOfCrossTalk() { +StatusCode TgcDigitMaker::readFileOfCrossTalk() { // Indices to be used int iStationName = -1; int stationEta = -1; @@ -663,16 +681,16 @@ void TgcDigitMaker::readFileOfCrossTalk() { const std::string fileName = "TGC_Digitization_crossTalk.dat"; std::string fileWithPath = PathResolver::find_file(fileName.c_str(), "DATAPATH"); if(fileWithPath.empty()) { - msg(MSG::FATAL) << "readFileOfCrossTalk(): Could not find file " << fileName.c_str() << endmsg; - return; + ATH_MSG_FATAL("readFileOfCrossTalk(): Could not find file " << fileName); + return StatusCode::FAILURE; } // Open the TGC_Digitization_crossTalk.dat file std::ifstream ifs; ifs.open(fileWithPath.c_str(), std::ios::in); if(ifs.bad()) { - msg(MSG::FATAL) << "readFileOfCrossTalk(): Could not open file " << fileName.c_str() << endmsg; - return; + ATH_MSG_FATAL("readFileOfCrossTalk(): Could not open file " << fileName); + return StatusCode::FAILURE; } double crossTalk_10 = 0.; @@ -682,8 +700,7 @@ void TgcDigitMaker::readFileOfCrossTalk() { // Read the TGC_Digitization_crossTalk.dat file while(ifs.good()) { ifs >> iStationName >> stationEta >> /*stationPhi >>*/ gasGap >> isStrip >> crossTalk_10 >> crossTalk_11 >> crossTalk_20 >> crossTalk_21; - if(msgLevel(MSG::DEBUG)) { - msg(MSG::DEBUG) << "TgcDigitMaker::readFileOfCrossTalk" + ATH_MSG_DEBUG("TgcDigitMaker::readFileOfCrossTalk" << " stationName= " << iStationName << " stationEta= " << stationEta // << " stationPhi= " << stationPhi @@ -692,9 +709,7 @@ void TgcDigitMaker::readFileOfCrossTalk() { << " prob(10) " << crossTalk_10 << " prob(11) " << crossTalk_11 << " prob(20) " << crossTalk_20 - << " prob(21) " << crossTalk_21 - << endmsg; - } + << " prob(21) " << crossTalk_21); // Subtract offsets to use indices of crossTalk array iStationName -= OFFSET_STATIONNAME; @@ -725,9 +740,11 @@ void TgcDigitMaker::readFileOfCrossTalk() { // Close the TGC_Digitization_crossTalk.dat file ifs.close(); + + return StatusCode::SUCCESS; } -void TgcDigitMaker::readFileOfDeadChamber() { +StatusCode TgcDigitMaker::readFileOfDeadChamber() { // Indices to be used int iStationName, stationEta, stationPhi, gasGap; @@ -747,22 +764,21 @@ void TgcDigitMaker::readFileOfDeadChamber() { else if(m_runperiod == 2) fileName = "TGC_Digitization_2016deadChamber.dat"; else if(m_runperiod == 3) fileName = "TGC_Digitization_NOdeadChamber.dat"; else { - msg(MSG::ERROR) << "Run Period " << m_runperiod << " is unexpected in TgcDigitMaker - using NOdeadChamber configuration." << endmsg; - fileName = "TGC_Digitization_NOdeadChamber.dat"; - return; + ATH_MSG_ERROR("Run Period " << m_runperiod << " is unexpected in TgcDigitMaker - using NOdeadChamber configuration."); + return StatusCode::FAILURE; } std::string fileWithPath = PathResolver::find_file(fileName.c_str(), "DATAPATH"); if(fileWithPath.empty()) { - msg(MSG::FATAL) << "readFileOfDeadChamber(): Could not find file " << fileName.c_str() << endmsg; - return; + ATH_MSG_FATAL("readFileOfDeadChamber(): Could not find file " << fileName); + return StatusCode::FAILURE; } // Open the TGC_Digitization_deadChamber.dat file std::ifstream ifs; ifs.open(fileWithPath.c_str(), std::ios::in); if(ifs.bad()) { - msg(MSG::FATAL) << "readFileOfDeadChamber(): Could not open file " << fileName.c_str() << endmsg; - return; + ATH_MSG_FATAL("readFileOfDeadChamber(): Could not open file " << fileName); + return StatusCode::FAILURE; } // Read the TGC_Digitization_deadChamber.dat file @@ -773,15 +789,12 @@ void TgcDigitMaker::readFileOfDeadChamber() { bool valid = getline(ifs, comment).good(); if(!valid) break; - if(msgLevel(MSG::DEBUG)) { - msg(MSG::DEBUG) << "TgcDigitMaker::readFileOfDeadChamber" + ATH_MSG_DEBUG("TgcDigitMaker::readFileOfDeadChamber" << " stationName= " << iStationName << " stationEta= " << stationEta << " stationPhi= " << stationPhi << " gasGap= " << gasGap - << " comment= " << comment - << endmsg; - } + << " comment= " << comment); // Subtract offsets to use indices of isDeadChamber array iStationName -= OFFSET_STATIONNAME; @@ -805,10 +818,12 @@ void TgcDigitMaker::readFileOfDeadChamber() { // Close the TGC_Digitization_deadChamber.dat file ifs.close(); - if(msgLevel(MSG::INFO)) msg(MSG::INFO) << "TgcDigitMaker::readFileOfDeadChamber: the number of dead chambers = " << nDeadChambers << endmsg; + ATH_MSG_INFO("readFileOfDeadChamber: the number of dead chambers = " << nDeadChambers); + + return StatusCode::SUCCESS; } -void TgcDigitMaker::readFileOfTimeWindowOffset() { +StatusCode TgcDigitMaker::readFileOfTimeWindowOffset() { // Indices to be used int iStationName, stationEta, isStrip; @@ -824,30 +839,27 @@ void TgcDigitMaker::readFileOfTimeWindowOffset() { const std::string fileName = "TGC_Digitization_timeWindowOffset.dat"; std::string fileWithPath = PathResolver::find_file(fileName.c_str(), "DATAPATH"); if(fileWithPath.empty()) { - msg(MSG::FATAL) << "readFileOfTimeWindowOffset(): Could not find file " << fileName.c_str() << endmsg; - return; + ATH_MSG_FATAL("readFileOfTimeWindowOffset(): Could not find file " << fileName); + return StatusCode::FAILURE; } // Open the TGC_Digitization_timeWindowOffset.dat file std::ifstream ifs; ifs.open(fileWithPath.c_str(), std::ios::in); if(ifs.bad()) { - msg(MSG::FATAL) << "readFileOfTimeWindowOffset(): Could not open file " << fileName.c_str() << endmsg; - return; + ATH_MSG_FATAL("readFileOfTimeWindowOffset(): Could not open file " << fileName); + return StatusCode::FAILURE; } // Read the TGC_Digitization_timeWindowOffset.dat file double timeWindowOffset; while(ifs.good()) { ifs >> iStationName >> stationEta >> isStrip >> timeWindowOffset; - if(msgLevel(MSG::DEBUG)) { - msg(MSG::DEBUG) << "TgcDigitMaker::readFileOfTimeWindowOffset" + ATH_MSG_DEBUG("TgcDigitMaker::readFileOfTimeWindowOffset" << " stationName= " << iStationName << " stationEta= " << stationEta << " isStrip= " << isStrip - << " timeWindowOffset= " << timeWindowOffset - << endmsg; - } + << " timeWindowOffset= " << timeWindowOffset); // Subtract offsets to use indices of isDeadChamber array iStationName -= OFFSET_STATIONNAME; @@ -867,9 +879,11 @@ void TgcDigitMaker::readFileOfTimeWindowOffset() { // Close the TGC_Digitization_timeWindowOffset.dat file ifs.close(); + + return StatusCode::SUCCESS; } -void TgcDigitMaker::readFileOfAlignment() { +StatusCode TgcDigitMaker::readFileOfAlignment() { // Indices to be used int iStationName, stationEta, stationPhi; @@ -888,16 +902,16 @@ void TgcDigitMaker::readFileOfAlignment() { const std::string fileName = "TGC_Digitization_alignment.dat"; std::string fileWithPath = PathResolver::find_file(fileName.c_str(), "DATAPATH"); if(fileWithPath.empty()) { - msg(MSG::FATAL) << "readFileOfAlignment(): Could not find file " << fileName.c_str() << endmsg; - return; + ATH_MSG_FATAL("readFileOfAlignment(): Could not find file " << fileName); + return StatusCode::FAILURE; } // Open the TGC_Digitization_alignment.dat file std::ifstream ifs; ifs.open(fileWithPath.c_str(), std::ios::in); if(ifs.bad()) { - msg(MSG::FATAL) << "readFileOfAlignment(): Could not open file " << fileName.c_str() << endmsg; - return; + ATH_MSG_FATAL("readFileOfAlignment(): Could not open file " << fileName); + return StatusCode::FAILURE; } // Read the TGC_Digitization_alignment.dat file @@ -907,17 +921,14 @@ void TgcDigitMaker::readFileOfAlignment() { double tmpTHS; while(ifs.good()) { ifs >> iStationName >> stationEta >> stationPhi >> tmpZ >> tmpT >> tmpS >> tmpTHS; - if(msgLevel(MSG::DEBUG)) { - msg(MSG::DEBUG) << "TgcDigitMaker::readFileOfAlignment" + ATH_MSG_DEBUG("readFileOfAlignment" << " stationName= " << iStationName << " stationEta= " << stationEta << " stationPhi= " << stationPhi << " z[mm]= " << tmpZ << " t[mm]= " << tmpT << " s[mm]= " << tmpS - << " ths[rad]= " << tmpTHS - << endmsg; - } + << " ths[rad]= " << tmpTHS); // Subtract offsets to use indices of m_alignmentZ, m_alignmentT, m_alignmentTHS arrays iStationName -= OFFSET_STATIONNAME; @@ -940,6 +951,137 @@ void TgcDigitMaker::readFileOfAlignment() { // Close the TGC_Digitization_timeWindowOffset.dat file ifs.close(); + + return StatusCode::SUCCESS; +} + +StatusCode TgcDigitMaker::readFileOfASDpropTimeOffset() { + // Indices to be used + int iStationName = -1; + int stationEta = -1; + int isStrip = -1; + int asdnum = -1; + + for(iStationName=0; iStationName<N_STATIONNAME; iStationName++) { + for(stationEta=0; stationEta<N_STATIONETA; stationEta++) { + for(isStrip=0; isStrip<N_ISSTRIP; isStrip++) { + for(asdnum=0; asdnum<N_ASDNUM; asdnum++) { + m_maxch[iStationName][stationEta][isStrip][asdnum] = 0.; + m_ASDpropTimeOffset[iStationName][stationEta][isStrip][asdnum] = 0.; + } + } + } + } + + // Find path to the TGC_Digitization_ASDpropTimeOffset.dat file + const std::string fileName = "TGC_Digitization_ASDpropTimeOffset.dat"; + std::string fileWithPath = PathResolver::find_file(fileName.c_str(), "DATAPATH"); + if(fileWithPath == "") { + ATH_MSG_FATAL("readFileOfASDpropTimeOffset(): Could not find file " << fileName); + return StatusCode::FAILURE; + } + + // Open the TGC_Digitization_ASDpropTimeOffset.dat file + std::ifstream ifs; + ifs.open(fileWithPath.c_str(), std::ios::in); + if(ifs.bad()) { + ATH_MSG_FATAL("readFileOfASDpropTimeOffset(): Could not open file " << fileName); + return StatusCode::FAILURE; + } + + double max_ch = 0.; + double asd_propTimeOffset = 0.; + // Read the TGC_Digitization_ASDpropTimeOffset.dat file + while(ifs.good()) { + ifs >> iStationName >> stationEta >> isStrip >> asdnum >> max_ch >> asd_propTimeOffset; + ATH_MSG_DEBUG("readFileOfASDpropTimeOffset" + << " stationName= " << iStationName + << " stationEta= " << stationEta + << " isStrip= " << isStrip + << " asdnum= " << asdnum + << " max_ch= " << max_ch + << " asd_propTimeOffset= " << asd_propTimeOffset); + + // Subtract offsets to use indices of ASDpropTimeOffset array + iStationName -= OFFSET_STATIONNAME; + stationEta -= OFFSET_STATIONETA; + isStrip -= OFFSET_ISSTRIP; + asdnum -= OFFSET_ASDNUM; + + // Check the indices are valid + if(iStationName<0 || iStationName>=N_STATIONNAME) continue; + if(stationEta <0 || stationEta >=N_STATIONETA ) continue; + if(isStrip <0 || isStrip >=N_ISSTRIP ) continue; + if(asdnum <0 || asdnum >=N_ASDNUM ) continue; + + m_maxch[iStationName][stationEta][isStrip][asdnum] = max_ch; + m_ASDpropTimeOffset[iStationName][stationEta][isStrip][asdnum] = asd_propTimeOffset; + + // If it is the end of the file, get out from while loop. + if(ifs.eof()) break; + } + + // Close the TGC_Digitization_ASDpropTimeOffset.dat file + ifs.close(); + + return StatusCode::SUCCESS; +} + +StatusCode TgcDigitMaker::readFileOfStripPosition() { + //Indices to be used + int iStationName, stationEta, channel; + + for(iStationName=0; iStationName<N_STATIONNAME; iStationName++) { + for(stationEta=0; stationEta<N_ABSSTATIONETA; stationEta++) { + for(channel=0; channel<N_STRIPCHANNEL; channel++) { + m_StripPos[iStationName][stationEta][channel] = 0.; + } + } + } + + // Find path to the TGC_Digitization_StripPosition.dat file + const std::string fileName = "TGC_Digitization_StripPosition.dat"; + std::string fileWithPath = PathResolver::find_file(fileName.c_str(), "DATAPATH"); + if(fileWithPath == "") { + ATH_MSG_FATAL("readFileOfStripPosition(): Could not find file " << fileName); + return StatusCode::FAILURE; + } + + // Open the TGC_Digitization_StripPosition.dat file + std::ifstream ifs; + ifs.open(fileWithPath.c_str(), std::ios::in); + if(ifs.bad()) { + ATH_MSG_FATAL("readFileOfStripPosition(): Could not open file " << fileName); + return StatusCode::FAILURE; + } + + // Read the TGC_Digitization_StripPosition.dat file + double strippos; + while(ifs.good()) { + ifs >> iStationName >> stationEta >> channel >> strippos; + ATH_MSG_DEBUG("readFileOfStripPosition" + << " stationName= " << iStationName + << " stationEta= " << stationEta + << " channel= " << channel + << " StripPosition= " << strippos); + + iStationName -= OFFSET_STATIONNAME; + stationEta -= OFFSET_ABSSTATIONETA; + channel -= OFFSET_STRIPCHANNEL; + + // Check the indices are valid + if(iStationName<0 || iStationName>=N_STATIONNAME ) continue; + if(stationEta <0 || stationEta >=N_ABSSTATIONETA) continue; + if(channel <0 || channel >=N_STRIPCHANNEL ) continue; + + m_StripPos[iStationName][stationEta][channel] = strippos; + // If it is the end of the file, get out from while loop. + if(ifs.eof()) break; + } + // Close the TGC_Digitization_StripPosition.dat file + ifs.close(); + + return StatusCode::SUCCESS; } double TgcDigitMaker::getEnergyThreshold(const std::string& stationName, int stationEta, int stationPhi, int gasGap, const TgcSensor sensor) const { @@ -963,16 +1105,13 @@ double TgcDigitMaker::getEnergyThreshold(const std::string& stationName, int sta } // Show the energy threshold value - if(msgLevel(MSG::VERBOSE)) { - msg(MSG::VERBOSE) << "TgcDigitMaker::getEnergyThreshold" + ATH_MSG_VERBOSE("getEnergyThreshold" << " stationName= " << iStationName+OFFSET_STATIONNAME << " stationEta= " << stationEta+OFFSET_STATIONETA << " stationPhi= " << stationPhi+OFFSET_STATIONPHI << " gasGap= " << gasGap+OFFSET_GASGAP << " sensor= " << sensor - << " energyThreshold(MeV)= " << energyThreshold - << endmsg; - } + << " energyThreshold(MeV)= " << energyThreshold); return energyThreshold; } @@ -1068,15 +1207,12 @@ bool TgcDigitMaker::isDeadChamber(const std::string& stationName, int stationEta } // Show the energy threshold value - if(msgLevel(MSG::VERBOSE)) { - msg(MSG::VERBOSE) << "TgcDigitMaker::getEnergyThreshold" + ATH_MSG_VERBOSE("TgcDigitMaker::getEnergyThreshold" << " stationName= " << iStationName+OFFSET_STATIONNAME << " stationEta= " << stationEta+OFFSET_STATIONETA << " stationPhi= " << stationPhi+OFFSET_STATIONPHI << " gasGap= " << gasGap+OFFSET_GASGAP - << " isDeadChamber= " << v_isDeadChamber - << endmsg; - } + << " isDeadChamber= " << v_isDeadChamber); return v_isDeadChamber; } @@ -1146,14 +1282,91 @@ void TgcDigitMaker::adHocPositionShift(const std::string& stationName, int stati localPos.z() = localPos.z()+localDisplacementZByX-localDisplacementZ; } +float TgcDigitMaker::getASDpropTimeOffset(const Identifier elemId, + const int isStrip, + const int channel) const +{ + int StationName = m_idHelper->stationName(elemId) - OFFSET_STATIONNAME; + int stationEta = m_idHelper->stationEta(elemId) - OFFSET_STATIONETA; + int stationPhi = m_idHelper->stationPhi(elemId) - OFFSET_STATIONPHI; + int iIsStrip = isStrip - OFFSET_ISSTRIP; + + std::array<double, N_ASDNUM> maxch{}; + double asdpropTimeOffset = 0.; + + if((StationName>=0 && StationName<N_STATIONNAME) && + (stationEta >=0 && stationEta <N_STATIONETA ) && + (stationPhi >=0 && stationPhi <N_STATIONPHI )) { + for(int asdnum=0; asdnum<N_ASDNUM; asdnum++){ + maxch[asdnum] = m_maxch[StationName][stationEta][iIsStrip][asdnum]; + } + for(int asdnum=0; asdnum<N_ASDNUM; asdnum++){ + if(maxch[asdnum] == 0) continue; + if(asdnum==0 && 1 <= channel && channel <= maxch[0]) asdpropTimeOffset = m_ASDpropTimeOffset[StationName][stationEta][iIsStrip][asdnum]; + if(asdnum!=0 && maxch[asdnum-1] < channel && channel <= maxch[asdnum]) asdpropTimeOffset = m_ASDpropTimeOffset[StationName][stationEta][iIsStrip][asdnum]; + } + } + return asdpropTimeOffset; +} + +float TgcDigitMaker::getStripPosition(const std::string stationName, int stationEta, int channel) const { + // Convert std::string stationName to int iStationName from 41 to 48 + int iStationName = getIStationName(stationName); + + // Subtract offsets to use these as the indices of the energyThreshold array + iStationName -= OFFSET_STATIONNAME; + stationEta -= OFFSET_ABSSTATIONETA; + channel -= OFFSET_STRIPCHANNEL; + + // Check the indices are valid + if(iStationName<0 || iStationName>=N_STATIONNAME ) return 0.; + if(stationEta <0 || stationEta >=N_ABSSTATIONETA) return 0.; + if(channel <0 || channel >=N_STRIPCHANNEL ) return 0.; + + return m_StripPos[iStationName][stationEta][channel]; +} + float TgcDigitMaker::timeDiffByCableRadiusOfInner(const int iStationName, const int stationPhi, const int channel) const { if(iStationName != 47 && iStationName != 48) return 0.0; // only EIFI station - if(channel < 12 || (channel > 16 && channel <27)) { + if(channel < 12 || (channel > 16 && channel < 27)) { int cablenum = (stationPhi >= 13) ? 25 - stationPhi : stationPhi; return 2.3 - 0.06 * cablenum; } return 0.0; } + +float TgcDigitMaker::getSigPropTimeDelay(const float cableDistance) const { + + return 0.0049 * std::pow(cableDistance, 2) + 0.0002 * cableDistance; +} + +float TgcDigitMaker::getDistanceToAsdFromSensor(const TgcDigitASDposData* readCdo, + const int iStationName, + const int stationEta, + const int stationPhi, + const TgcSensor sensor, + const int channel, + const float position) const { + + int phiId = (iStationName >= 47) ? stationPhi : -99; + int dbNum = -99; + + for(unsigned int i_dbNum=0;i_dbNum<readCdo->stationNum.size();i_dbNum++) { + if(iStationName != readCdo->stationNum.at(i_dbNum)) continue; + if(stationEta != readCdo->stationEta.at(i_dbNum)) continue; + if(phiId != readCdo->stationPhi.at(i_dbNum)) continue; + dbNum = i_dbNum; + break; + } + + unsigned int asdNum[TgcSensor::N_SENSOR]; + asdNum[TgcSensor::kSTRIP] = channel / TgcDigitASDposData::N_CHANNELINPUT_TOASD; + asdNum[TgcSensor::kWIRE] = channel / TgcDigitASDposData::N_CHANNELINPUT_TOASD + TgcDigitASDposData::N_STRIPASDPOS; + + float disToAsd = fabs( position*CLHEP::mm/CLHEP::m - readCdo->asdPos[ asdNum[sensor] ][dbNum] ); + + return disToAsd; +} diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitMaker.h b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitMaker.h index 39755bfb3517..db9e57e0120f 100644 --- a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitMaker.h +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitMaker.h @@ -11,15 +11,15 @@ #ifndef TGCDIGITMAKER_H #define TGCDIGITMAKER_H -#include "CxxUtils/checker_macros.h" + #include <vector> #include <string> +#include "AthenaBaseComps/AthMessaging.h" #include "GaudiKernel/StatusCode.h" -#include "Identifier/Identifier.h" -#include "AthenaKernel/MsgStreamMember.h" - #include "GeoPrimitives/GeoPrimitives.h" +#include "Identifier/Identifier.h" +#include "MuonCondData/TgcDigitASDposData.h" namespace CLHEP { class HepRandomEngine; @@ -35,7 +35,7 @@ class TgcIdHelper; class TGCSimHit; //--- class description -class TgcDigitMaker { +class TgcDigitMaker : public AthMessaging { //------ for public public: @@ -76,15 +76,10 @@ class TgcDigitMaker { will be included in future, too. */ TgcDigitCollection* executeDigi(const TGCSimHit* hit, - const double globalHitTime, + const double globalHitTime, + const TgcDigitASDposData* ASDpos, CLHEP::HepRandomEngine* rndmEngine); - //Declaring the Message method for further use - MsgStream& msg(const MSG::Level lvl) const ; - //Declaring the Method providing Verbosity Level - bool msgLevel(const MSG::Level lvl) const; - void setMessageLevel(const MSG::Level lvl) const; - //====== for private private: enum NumberOfDimensions { @@ -98,7 +93,13 @@ class TgcDigitMaker { OFFSET_GASGAP = 1, N_ISSTRIP = 2, OFFSET_ISSTRIP = 0, - N_CROSSTALK_PARAMETER = 4 + N_CROSSTALK_PARAMETER = 4, + N_ASDNUM = 8, + OFFSET_ASDNUM = 1, + N_ABSSTATIONETA = 5, + OFFSET_ABSSTATIONETA = 1, + N_STRIPCHANNEL = 32, + OFFSET_STRIPCHANNEL = 1 }; enum TgcStation { kOUTER = 0, @@ -131,15 +132,20 @@ class TgcDigitMaker { void addDigit(const Identifier id, const uint16_t bctag, TgcDigitCollection* digits) const; /** Read share/TGC_Digitization_energyThreshold.dat file */ - void readFileOfEnergyThreshold(); + StatusCode readFileOfEnergyThreshold(); /** Read share/TGC_Digitization_crossTalk.dat file */ - void readFileOfCrossTalk(); + StatusCode readFileOfCrossTalk(); /** Read share/TGC_Digitization_deadChamber.dat file */ - void readFileOfDeadChamber(); + StatusCode readFileOfDeadChamber(); /** Read share/TGC_Digitization_timeWindowOffset.dat file */ - void readFileOfTimeWindowOffset(); + StatusCode readFileOfTimeWindowOffset(); /** Read share/TGC_Digitization_alignment.dat file */ - void readFileOfAlignment(); + StatusCode readFileOfAlignment(); + /** Read share/TGC_Digitization_ASDpropTimeOffset.dat file */ + StatusCode readFileOfASDpropTimeOffset(); + /** Read share/TGC_Digitization_StripPosition.dat file */ + StatusCode readFileOfStripPosition(); + /** Get energy threshold value for each chamber */ double getEnergyThreshold(const std::string& stationName, int stationEta, int stationPhi, int gasGap, const TgcSensor sensor) const; void randomCrossTalk(const Identifier elemId, const int gasGap, const TgcSensor sensor, const int channel, const float posInStrip, const double digitTime, CLHEP::HepRandomEngine* rndmEngine, TgcDigitCollection* digits) const; @@ -152,8 +158,16 @@ class TgcDigitMaker { /** Ad hoc implementation of detector position shift */ void adHocPositionShift(const std::string& stationName, int stationEta, int stationPhi, const Amg::Vector3D& direCos, Amg::Vector3D &localPos) const; + /** Method to get propagation time offset of the ASD */ + float getASDpropTimeOffset(const Identifier elemId, const int isStrip, const int channel) const; + /** Method to get position of Strip channel */ + float getStripPosition(const std::string stationName, int stationEta, int channel) const; + /** Method to get signal propagation time delay */ + float getSigPropTimeDelay(const float cableDistance) const; /** Method to get time difference by cable radius of inner */ float timeDiffByCableRadiusOfInner(const int iStationName, const int stationPhi, const int channel) const; + /** Method to get propagation time to the ASD from the sensor */ + float getDistanceToAsdFromSensor(const TgcDigitASDposData* readCdo, const int iStationName, const int stationEta, const int stationPhi, const TgcSensor sensor, const int channel, const float position) const; /** Energy threshold value for each chamber */ double m_energyThreshold[N_STATIONNAME][N_STATIONETA][N_STATIONPHI][N_GASGAP][N_ISSTRIP]{}; @@ -173,6 +187,13 @@ class TgcDigitMaker { /** Alignment ths constants. Rotation around the global phi direction */ double m_alignmentTHS[N_STATIONNAME][N_STATIONETA][N_STATIONPHI]{}; + /** Position of Strip Channel (Longer base or Shorter base) */ + float m_StripPos[N_STATIONNAME][N_ABSSTATIONETA][N_STRIPCHANNEL]; + /** ASD propagation time offset for each chamber */ + float m_ASDpropTimeOffset[N_STATIONNAME][N_STATIONETA][N_ISSTRIP][N_ASDNUM]; + /** max channel for ASD */ + float m_maxch[N_STATIONNAME][N_STATIONETA][N_ISSTRIP][N_ASDNUM]; + std::vector<std::vector<float> > m_vecAngle_Time; TgcHitIdHelper* m_hitIdHelper; @@ -190,9 +211,6 @@ class TgcDigitMaker { double m_timeWindowOffsetSensor[N_SENSOR]{}; double m_gateTimeWindow[N_STATION][N_SENSOR]{}; double m_bunchCrossingTime; - - //Declaring private message stream member. - mutable Athena::MsgStreamMember m_msg ATLAS_THREAD_SAFE; }; #endif diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx index bfa40dc8094a..745459f57c12 100644 --- a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.cxx @@ -65,8 +65,9 @@ StatusCode TgcDigitizationTool::initialize() if(m_onlyUseContainerName) m_inputHitCollectionName = m_hitsContainerKey.key(); ATH_MSG_DEBUG("Input objects in container : '" << m_inputHitCollectionName << "'"); - // Initialize ReadHandleKey + // Initialize Read(Cond)HandleKey ATH_CHECK(m_hitsContainerKey.initialize(!m_onlyUseContainerName)); + ATH_CHECK(m_readCondKey_ASDpos.initialize(!m_readCondKey_ASDpos.empty())); //initialize the output WriteHandleKeys ATH_CHECK(m_outputDigitCollectionKey.initialize()); @@ -102,7 +103,7 @@ StatusCode TgcDigitizationTool::initialize() m_digitizer = new TgcDigitMaker(m_hitIdHelper, m_mdManager, runperiod); - m_digitizer->setMessageLevel(static_cast<MSG::Level>(msgLevel())); + m_digitizer->setLevel(static_cast<MSG::Level>(msgLevel())); ATH_CHECK(m_rndmSvc.retrieve()); ATH_CHECK(m_digitizer->initialize()); @@ -130,7 +131,7 @@ StatusCode TgcDigitizationTool::processBunchXing(int bunchXing, if (!(m_mergeSvc->retrieveSubSetEvtData(m_inputHitCollectionName, hitCollList, bunchXing, bSubEvents, eSubEvents).isSuccess()) && - hitCollList.empty()) { + hitCollList.empty()) { ATH_MSG_ERROR("Could not fill TimedHitCollList"); return StatusCode::FAILURE; } else { @@ -282,6 +283,13 @@ StatusCode TgcDigitizationTool::digitizeCore(const EventContext& ctx) const { // get the iterator pairs for this DetEl //iterate over hits and fill id-keyed drift time map IdContext tgcContext = m_idHelper->module_context(); + + // Read needed conditions data + const TgcDigitASDposData *ASDpos{}; + if (!m_readCondKey_ASDpos.empty()) { + SG::ReadCondHandle<TgcDigitASDposData> readHandle_ASDpos{m_readCondKey_ASDpos, ctx}; + ASDpos = readHandle_ASDpos.cptr(); + } TimedHitCollection<TGCSimHit>::const_iterator i, e; while(m_thpcTGC->nextDetectorElement(i, e)) { @@ -293,7 +301,7 @@ StatusCode TgcDigitizationTool::digitizeCore(const EventContext& ctx) const { const TGCSimHit& hit = *phit; double globalHitTime = hitTime(phit); double tof = phit->globalTime(); - TgcDigitCollection* digiHits = m_digitizer->executeDigi(&hit, globalHitTime, rndmEngine); + TgcDigitCollection* digiHits = m_digitizer->executeDigi(&hit, globalHitTime, ASDpos, rndmEngine); if(!digiHits) continue; diff --git a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.h b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.h index e6bcba20f431..73b5ded5e4da 100644 --- a/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.h +++ b/MuonSpectrometer/MuonDigitization/TGC_Digitization/src/TgcDigitizationTool.h @@ -1,7 +1,7 @@ /* -*- C++ -*- */ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONDIGITIZATION_TGC_DIGITIZATIONTOOL_H @@ -22,6 +22,7 @@ #include "MuonSimEvent/TGCSimHitCollection.h" #include "MuonDigitContainer/TgcDigitContainer.h" #include "MuonSimData/MuonSimDataCollection.h" +#include "MuonCondData/TgcDigitASDposData.h" class PileUpMergeSvc; class TgcDigitMaker; @@ -89,9 +90,9 @@ private: std::list<TGCSimHitCollection*> m_TGCHitCollList; Gaudi::Property<bool> m_onlyUseContainerName{this, "OnlyUseContainerName", true, "Don't use the ReadHandleKey directly. Just extract the container name from it."}; - SG::ReadHandleKey<TGCSimHitCollection> m_hitsContainerKey{this, "InputObjectName", "TGC_Hits", - "name of the input object"}; + SG::ReadHandleKey<TGCSimHitCollection> m_hitsContainerKey{this, "InputObjectName", "TGC_Hits", "name of the input object"}; std::string m_inputHitCollectionName{""}; + SG::ReadCondHandleKey<TgcDigitASDposData> m_readCondKey_ASDpos{this,"TGCDigitASDposKey","","ReadCondHandleKey for TGCDigitASDposData"}; SG::WriteHandleKey<TgcDigitContainer> m_outputDigitCollectionKey{this,"OutputObjectName","TGC_DIGITS","WriteHandleKey for Output TgcDigitContainer"}; // name of the output digits SG::WriteHandleKey<MuonSimDataCollection> m_outputSDO_CollectionKey{this,"OutputSDOName","TGC_SDO","WriteHandleKey for Output MuonSimDataCollection"}; // name of the output SDOs diff --git a/Simulation/Digitization/python/DigitizationConfigFlags.py b/Simulation/Digitization/python/DigitizationConfigFlags.py index c4ae8e92872b..ade5f68cdd5e 100644 --- a/Simulation/Digitization/python/DigitizationConfigFlags.py +++ b/Simulation/Digitization/python/DigitizationConfigFlags.py @@ -88,6 +88,8 @@ def createDigitizationCfgFlags(): # TRT Range cut used in simulation in mm. Should be 0.05 or 30. flags.addFlag("Digitization.TRTRangeCut", lambda prevFlags: float(GetFileMD(prevFlags.Input.Files).get('TRTRangeCut', 0.05))) + # Temporary TGC flag + flags.addFlag("Digitization.UseUpdatedTGCConditions", False) # Write out truth information? flags.addFlag("Digitization.TruthOutput", False) # Write out calorimeter digits diff --git a/Simulation/Digitization/python/DigitizationFlags.py b/Simulation/Digitization/python/DigitizationFlags.py index 96c3491973bb..38b6433bad01 100755 --- a/Simulation/Digitization/python/DigitizationFlags.py +++ b/Simulation/Digitization/python/DigitizationFlags.py @@ -735,6 +735,14 @@ class TRTRangeCut(JobProperty): allowedValues = [0.05,30.0] StoredValue=0.05 +# +class UseUpdatedTGCConditions(JobProperty): + """ Temporary flag for TGC conditions + """ + statusOn=True + allowedTypes=['bool'] + StoredValue=False + # class PileUpPresampling(JobProperty): """ Run pile-up presampling @@ -834,7 +842,7 @@ list_jobproperties=[doInDetNoise,doCaloNoise,doMuonNoise,doFwdNoise,doRadiationD bunchSpacing,initialBunchCrossing,finalBunchCrossing,doXingByXingPileUp,\ simRunNumber,dataRunNumber,BeamIntensityPattern,FixedT0BunchCrossing,cavernIgnoresBeamInt,\ RunAndLumiOverrideList,SignalPatternForSteppingCache, - experimentalDigi,pileupDSID,specialConfiguration,digiSteeringConf,TRTRangeCut,PileUpPresampling,doBeamSpotSizeReweighting,OldBeamSpotZSize] + experimentalDigi,pileupDSID,specialConfiguration,digiSteeringConf,TRTRangeCut,UseUpdatedTGCConditions,PileUpPresampling,doBeamSpotSizeReweighting,OldBeamSpotZSize] for i in list_jobproperties: jobproperties.Digitization.add_JobProperty(i) diff --git a/Simulation/Digitization/test/test_MC16a_Digi_tf_configuration.py b/Simulation/Digitization/test/test_MC16a_Digi_tf_configuration.py index 2350ca586f4d..8545c8cf547e 100755 --- a/Simulation/Digitization/test/test_MC16a_Digi_tf_configuration.py +++ b/Simulation/Digitization/test/test_MC16a_Digi_tf_configuration.py @@ -338,7 +338,7 @@ class TestDigitizationMC16a(unittest.TestCase): def test___TgcDigitizationTool_properties(self): tested_configurable_name = 'StandardSignalOnlyTruthPileUpToolsAlg.TgcDigitizationTool' - expected_property_list = ['DetStore', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FirstXing', 'InputObjectName', 'LastXing', 'OutputObjectName', 'OutputSDOName', 'PileUpMergeSvc', 'RndmSvc'] + expected_property_list = ['DetStore', 'EvtStore', 'ExtraInputs', 'ExtraOutputs', 'FirstXing', 'InputObjectName', 'LastXing', 'OutputObjectName', 'OutputSDOName', 'PileUpMergeSvc', 'RndmSvc', 'TGCDigitASDposKey'] expected_nonstring_properties = {'LastXing': '75', 'FirstXing': '-50'} expected_string_properties = {} # Not checking any specific property values self._detailed_ConfigurablePropertiesCheck( -- GitLab