diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTest.ref b/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTest.ref index 1a669f329ba1aff313d6ca11f42d424e28f8e181..6616b6f92ff63011c28c0206087d7101e738940b 100644 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTest.ref +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/share/DoubleEventSelectorOverlayTest.ref @@ -1,63 +1,107 @@ -Thu Apr 18 18:48:07 CEST 2019 -Preloading tcmalloc_minimal.so +Wed Feb 5 08:51:05 EST 2020 Py:Athena INFO including file "AthenaCommon/Preparation.py" -Py:Athena INFO using release [WorkDir-22.0.2] [x86_64-slc6-gcc8-opt] [master-DES-ReadWrite-Handle/ef4bb18542] -- built on [2019-04-18T1721] +Py:Athena INFO using release [?-21.0.0] [?] [?/?] -- built on [?] Py:Athena INFO including file "AthenaCommon/Atlas.UnixStandardJob.py" Py:Athena INFO executing ROOT6Setup +Warning in <TInterpreter::ReadRootmapFile>: class CP::IMuonCalibrationAndSmearingTool found in libMuonAnalysisInterfacesDict.so is already in libMuonMomentumCorrectionsDict.so Py:Athena INFO including file "AthenaCommon/Execution.py" Py:Athena INFO including file "AthenaPoolTest/DoubleEventSelectorOverlayTest.py" -Py:ConfigurableDb INFO Read module info for 5471 configurables from 8 genConfDb files +Py:ConfigurableDb INFO Read module info for 5167 configurables from 2 genConfDb files Py:ConfigurableDb INFO No duplicates have been found: that's good ! -Py:ConfiguredFactory INFO imported 132 confDb modules in 1.08 seconds +Py:ConfiguredFactory INFO imported 98 confDb modules in 0.11 seconds Py:Athena INFO including file "AthenaPoolTest/NoStats_jobOptions.py" Py:Athena INFO including file "AthenaCommon/runbatch.py" -[?1034hApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 +# setting LC_ALL to "C" +ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 ApplicationMgr SUCCESS ==================================================================================================================================== - Welcome to ApplicationMgr (GaudiCoreSvc v31r0) - running on f9pc23.ijs.si on Thu Apr 18 18:48:21 2019 + Welcome to ApplicationMgr (GaudiCoreSvc v27r1p99) + running on karma on Wed Feb 5 08:51:09 2020 ==================================================================================================================================== ApplicationMgr INFO Application Manager Configured successfully ApplicationMgr INFO Updating Gaudi::PluginService::SetDebug(level) to level= 'PluginDebugLevel':0 StatusCodeSvc INFO initialize +AthDictLoaderSvc INFO in initialize... +AthDictLoaderSvc INFO acquired Dso-registry +ClassIDSvc INFO getRegistryEntries: read 4431 CLIDRegistry entries for module ALL +CoreDumpSvc INFO install f-a-t-a-l handler... (flag = -1) +CoreDumpSvc INFO Handling signals: 11(Segmentation fault) 7(Bus error) 4(Illegal instruction) 8(Floating point exception) +AthenaEventLoopMgr INFO Initializing AthenaEventLoopMgr - package version AthenaServices-00-00-00 +ClassIDSvc INFO getRegistryEntries: read 5894 CLIDRegistry entries for module ALL +MetaDataSvc INFO Initializing MetaDataSvc - package version AthenaServices-00-00-00 +AthenaPoolCnvSvc INFO Initializing AthenaPoolCnvSvc - package version AthenaPoolCnvSvc-00-00-00 +PoolSvc INFO io_register[PoolSvc](xmlcatalog_file:PoolFileCatalog.xml) [ok] +PoolSvc INFO Set connectionsvc retry/timeout/IDLE timeout to 'ConnectionRetrialPeriod':300/ 'ConnectionRetrialTimeOut':3600/ 'ConnectionTimeOut':5 seconds with connection cleanup disabled +PoolSvc INFO Frontier compression level set to 5 +DBReplicaSvc INFO Read replica configuration from /home/sss/atlas/rootaccess/build/share/dbreplica.config +DBReplicaSvc INFO No specific match for domain found - use default fallback +DBReplicaSvc INFO Total of 1 servers found for host karma [atlas_dd ] +PoolSvc INFO Successfully setup replica sorting algorithm +PoolSvc INFO Setting up APR FileCatalog and Streams +PoolSvc INFO POOL WriteCatalog is xmlcatalog_file:PoolFileCatalog.xml +DbSession INFO Open DbSession +Domain[ROOT_All] INFO > Access DbDomain READ [ROOT_All] +MetaDataSvc INFO Found MetaDataTools = PublicToolHandleArray(['IOVDbMetaDataTool']) AthenaPoolAddre... DEBUG Property update for OutputLevel : new value = 2 AthenaPoolAddre... DEBUG Service base class initialized successfully AthenaPoolAddre... DEBUG Property update for OutputLevel : new value = 2 AthenaPoolAddre... DEBUG Service base class initialized successfully AddressRemappin... DEBUG Property update for OutputLevel : new value = 2 AddressRemappin... DEBUG Service base class initialized successfully +ClassIDSvc INFO getRegistryEntries: read 1552 CLIDRegistry entries for module ALL ProxyProviderSvc DEBUG Property update for OutputLevel : new value = 2 ProxyProviderSvc DEBUG Service base class initialized successfully +DecisionSvc INFO Inserting stream: Stream1 with no Algs +OutputStreamSeq... INFO Initializing OutputStreamSequencerSvc - package version AthenaServices-00-00-00 Stream1.Stream1... INFO Initializing Stream1.Stream1Tool - package version AthenaServices-00-00-00 AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. AthenaPoolAddre... DEBUG Cannot retrieve DataHeader from DetectorStore. -Stream1 INFO Found HelperTools = PrivateToolHandleArray([]) +Stream1 INFO Found HelperTools = PrivateToolHandleArray(['Athena::ThinningCacheTool/ThinningCacheTool_Stream1']) Stream1 INFO Data output: OutputRDO.root Stream1 INFO I/O reinitialization... -HistogramPersis...WARNING Histograms saving not required. DoubleEventSele... DEBUG Property update for OutputLevel : new value = 2 -DoubleEventSele... INFO Initializing DoubleEventSelector - package version EventSelectorAthenaPool-00-00-00 +DoubleEventSele... DEBUG Initializing DoubleEventSelector DoubleEventSele... DEBUG Service base class initialized successfully -DoubleEventSele... INFO reinitialization... -DoubleEventSele... INFO EventSelection with query -DoubleEventSele... DEBUG Try item: "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/PileupPremixing/22.0/RDO.merged-pileup-MT.unittest.pool.root" from the collection list. +DoubleEventSele... DEBUG reinitialization... DoubleEventSele... INFO EventSelection with query -DoubleEventSele... DEBUG Try item: "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000765.pool.root.1" from the collection list. +DoubleEventSele... DEBUG Try item: "/home/sss/nobackup/referencefiles/OverlayMonitoringRTT/PileupPremixing/22.0/RDO.merged-pileup-MT.unittest.pool.root" from the collection list. +Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 8BCD9728-EB56-6042-AFDF-61C0C379D70E +Domain[ROOT_All] INFO /home/sss/nobackup/referencefiles/OverlayMonitoringRTT/PileupPremixing/22.0/RDO.merged-pileup-MT.unittest.pool.root +RootDatabase.open INFO /home/sss/nobackup/referencefiles/OverlayMonitoringRTT/PileupPremixing/22.0/RDO.merged-pileup-MT.unittest.pool.root File version:61600 +ClassIDSvc INFO getRegistryEntries: read 11670 CLIDRegistry entries for module ALL +EventPersistenc... INFO Added successfully Conversion service:AthenaPoolCnvSvc +ClassIDSvc INFO getRegistryEntries: read 21 CLIDRegistry entries for module ALL +SecondaryEventS... DEBUG Property update for OutputLevel : new value = 2 +SecondaryEventS... DEBUG Initializing secondary event selector SecondaryEventSelector +SecondaryEventS... DEBUG Service base class initialized successfully +SecondaryEventS... DEBUG reinitialization... +SecondaryEventS... INFO EventSelection with query +SecondaryEventS... DEBUG Try item: "/home/sss/nobackup/referencefiles/OverlayMonitoringRTT/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000765.pool.root.1" from the collection list. +Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 9553B87B-1832-3346-A65E-916E6C1DEAB5 +Domain[ROOT_All] INFO /home/sss/nobackup/referencefiles/OverlayMonitoringRTT/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000765.pool.root.1 +RootDatabase.open INFO /home/sss/nobackup/referencefiles/OverlayMonitoringRTT/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000765.pool.root.1 File version:60802 +ClassIDSvc INFO getRegistryEntries: read 1579 CLIDRegistry entries for module ALL +AthenaEventLoopMgr INFO Setup EventSelector service DoubleEventSelector +AthenaEventLoopMgr INFO Using secondary event number. ApplicationMgr INFO Application Manager Initialized successfully -DoubleEventSele... DEBUG Try item: "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/PileupPremixing/22.0/RDO.merged-pileup-MT.unittest.pool.root" from the collection list. -DoubleEventSele... DEBUG Try item: "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/OverlayMonitoringRTT/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000765.pool.root.1" from the collection list. +/home/sss/nobac... INFO Database being retired... +Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 9553B87B-1832-3346-A65E-916E6C1DEAB5 +SecondaryEventS... DEBUG Try item: "/home/sss/nobackup/referencefiles/OverlayMonitoringRTT/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000765.pool.root.1" from the collection list. +Domain[ROOT_All] INFO -> Access DbDatabase READ [ROOT_All] 9553B87B-1832-3346-A65E-916E6C1DEAB5 +Domain[ROOT_All] INFO /home/sss/nobackup/referencefiles/OverlayMonitoringRTT/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000765.pool.root.1 +RootDatabase.open INFO /home/sss/nobackup/referencefiles/OverlayMonitoringRTT/valid1.410000.PowhegPythiaEvtGen_P2012_ttbar_hdamp172p5_nonallhad.simul.HITS.e4993_s3091/HITS.10504490._000765.pool.root.1 File version:60802 +DoubleEventSele... DEBUG Try item: "/home/sss/nobackup/referencefiles/OverlayMonitoringRTT/PileupPremixing/22.0/RDO.merged-pileup-MT.unittest.pool.root" from the collection list. ApplicationMgr INFO Application Manager Started successfully -DoubleEventSele... DEBUG guid != m_primaryGuid -DoubleEventSele... DEBUG guid != m_secondaryGuid -DoubleEventSele... DEBUG Try recording AttributeLists +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::next +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::recordAttributeList DoubleEventSele... DEBUG Get AttributeList from the collection DoubleEventSele... DEBUG AttributeList size 12 DoubleEventSele... DEBUG record AthenaAttribute, name = Token = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000000]. -DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary -DoubleEventSele... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000000]. -DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000000]. DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000000]. +DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary +SecondaryEventS... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000000]. +SecondaryEventS... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000000]. DoubleEventSele... DEBUG found AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000000] AthenaPoolAddre... DEBUG found AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000000] AthenaPoolAddre... DEBUG Created dataHeader SecondaryEventSelector @@ -123,14 +167,37 @@ AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonEntryLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonExitLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1312841250, name = LArCalibrationHitDeadMaterial -DoubleEventSele... DEBUG Try recording AttributeLists +AlgResourcePool INFO TopAlg list empty. Recovering the one of Application Manager +ClassIDSvc INFO getRegistryEntries: read 1 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 6 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 89 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 75 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 2 CLIDRegistry entries for module ALL +ClassIDSvc INFO getRegistryEntries: read 54 CLIDRegistry entries for module ALL +AthenaPoolConve... INFO massageEventInfo: unable to get OverrideRunNumberFromInput property from EventSelector +AthenaEventLoopMgr INFO ===>>> using secondary event #76408 instead of #1<<<=== +AthenaEventLoopMgr INFO ===>>> start of run 300000 <<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #76408, run #300000 0 events processed so far <<<=== +ClassIDSvc INFO getRegistryEntries: read 180 CLIDRegistry entries for module ALL +DbSession INFO Open DbSession +Domain[ROOT_All] INFO > Access DbDomain UPDATE [ROOT_All] +Domain[ROOT_All] INFO -> Access DbDatabase CREATE [ROOT_All] 22B32F76-1345-524A-B55B-D789FB399093 +Domain[ROOT_All] INFO OutputRDO.root +RootDatabase.open INFO OutputRDO.root File version:61800 +StorageSvc INFO Building shape according to reflection information using shape ID for: +StorageSvc INFO DataHeader_p6 [4DDBD295-EFCE-472A-9EC8-15CD35A9EB8D] +StorageSvc INFO Building shape according to reflection information using shape ID for: +StorageSvc INFO DataHeaderForm_p6 [7BE56CEF-C866-4BEE-9348-A5F34B5F1DAD] +AthenaEventLoopMgr INFO ===>>> done processing event #76408, run #300000 1 events processed so far <<<=== +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::next +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::recordAttributeList DoubleEventSele... DEBUG Get AttributeList from the collection DoubleEventSele... DEBUG AttributeList size 12 DoubleEventSele... DEBUG record AthenaAttribute, name = Token = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000001]. -DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary -DoubleEventSele... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000001]. -DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000001]. DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000001]. +DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary +SecondaryEventS... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000001]. +SecondaryEventS... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000001]. DoubleEventSele... DEBUG found AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000001] AthenaPoolAddre... DEBUG found AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000001] AthenaPoolAddre... DEBUG Created dataHeader SecondaryEventSelector @@ -196,14 +263,18 @@ AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonEntryLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonExitLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1312841250, name = LArCalibrationHitDeadMaterial -DoubleEventSele... DEBUG Try recording AttributeLists +AthenaEventLoopMgr INFO ===>>> using secondary event #76419 instead of #2<<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #76419, run #300000 1 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #76419, run #300000 2 events processed so far <<<=== +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::next +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::recordAttributeList DoubleEventSele... DEBUG Get AttributeList from the collection DoubleEventSele... DEBUG AttributeList size 12 DoubleEventSele... DEBUG record AthenaAttribute, name = Token = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000002]. -DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary -DoubleEventSele... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000002]. -DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000002]. DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000002]. +DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary +SecondaryEventS... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000002]. +SecondaryEventS... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000002]. DoubleEventSele... DEBUG found AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000002] AthenaPoolAddre... DEBUG found AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000002] AthenaPoolAddre... DEBUG Created dataHeader SecondaryEventSelector @@ -269,14 +340,18 @@ AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonEntryLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonExitLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1312841250, name = LArCalibrationHitDeadMaterial -DoubleEventSele... DEBUG Try recording AttributeLists +AthenaEventLoopMgr INFO ===>>> using secondary event #76430 instead of #3<<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #76430, run #300000 2 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #76430, run #300000 3 events processed so far <<<=== +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::next +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::recordAttributeList DoubleEventSele... DEBUG Get AttributeList from the collection DoubleEventSele... DEBUG AttributeList size 12 DoubleEventSele... DEBUG record AthenaAttribute, name = Token = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000003]. -DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary -DoubleEventSele... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000003]. -DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000003]. DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000003]. +DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary +SecondaryEventS... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000003]. +SecondaryEventS... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000003]. DoubleEventSele... DEBUG found AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000003] AthenaPoolAddre... DEBUG found AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000003] AthenaPoolAddre... DEBUG Created dataHeader SecondaryEventSelector @@ -342,14 +417,18 @@ AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonEntryLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonExitLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1312841250, name = LArCalibrationHitDeadMaterial -DoubleEventSele... DEBUG Try recording AttributeLists +AthenaEventLoopMgr INFO ===>>> using secondary event #76440 instead of #4<<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #76440, run #300000 3 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #76440, run #300000 4 events processed so far <<<=== +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::next +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::recordAttributeList DoubleEventSele... DEBUG Get AttributeList from the collection DoubleEventSele... DEBUG AttributeList size 12 DoubleEventSele... DEBUG record AthenaAttribute, name = Token = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000004]. -DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary -DoubleEventSele... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000004]. -DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000004]. DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000004]. +DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary +SecondaryEventS... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000004]. +SecondaryEventS... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000004]. DoubleEventSele... DEBUG found AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000004] AthenaPoolAddre... DEBUG found AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000004] AthenaPoolAddre... DEBUG Created dataHeader SecondaryEventSelector @@ -415,14 +494,18 @@ AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonEntryLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonExitLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1312841250, name = LArCalibrationHitDeadMaterial -DoubleEventSele... DEBUG Try recording AttributeLists +AthenaEventLoopMgr INFO ===>>> using secondary event #76452 instead of #5<<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #76452, run #300000 4 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #76452, run #300000 5 events processed so far <<<=== +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::next +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::recordAttributeList DoubleEventSele... DEBUG Get AttributeList from the collection DoubleEventSele... DEBUG AttributeList size 12 DoubleEventSele... DEBUG record AthenaAttribute, name = Token = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000005]. -DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary -DoubleEventSele... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000005]. -DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000005]. DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000005]. +DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary +SecondaryEventS... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000005]. +SecondaryEventS... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000005]. DoubleEventSele... DEBUG found AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000005] AthenaPoolAddre... DEBUG found AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000005] AthenaPoolAddre... DEBUG Created dataHeader SecondaryEventSelector @@ -488,14 +571,18 @@ AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonEntryLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonExitLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1312841250, name = LArCalibrationHitDeadMaterial -DoubleEventSele... DEBUG Try recording AttributeLists +AthenaEventLoopMgr INFO ===>>> using secondary event #76460 instead of #6<<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #76460, run #300000 5 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #76460, run #300000 6 events processed so far <<<=== +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::next +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::recordAttributeList DoubleEventSele... DEBUG Get AttributeList from the collection DoubleEventSele... DEBUG AttributeList size 12 DoubleEventSele... DEBUG record AthenaAttribute, name = Token = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000006]. -DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary -DoubleEventSele... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000006]. -DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000006]. DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000006]. +DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary +SecondaryEventS... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000006]. +SecondaryEventS... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000006]. DoubleEventSele... DEBUG found AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000006] AthenaPoolAddre... DEBUG found AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000006] AthenaPoolAddre... DEBUG Created dataHeader SecondaryEventSelector @@ -561,14 +648,18 @@ AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonEntryLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonExitLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1312841250, name = LArCalibrationHitDeadMaterial -DoubleEventSele... DEBUG Try recording AttributeLists +AthenaEventLoopMgr INFO ===>>> using secondary event #76467 instead of #7<<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #76467, run #300000 6 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #76467, run #300000 7 events processed so far <<<=== +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::next +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::recordAttributeList DoubleEventSele... DEBUG Get AttributeList from the collection DoubleEventSele... DEBUG AttributeList size 12 DoubleEventSele... DEBUG record AthenaAttribute, name = Token = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000007]. -DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary -DoubleEventSele... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000007]. -DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000007]. DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000007]. +DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary +SecondaryEventS... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000007]. +SecondaryEventS... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000007]. DoubleEventSele... DEBUG found AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000007] AthenaPoolAddre... DEBUG found AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000007] AthenaPoolAddre... DEBUG Created dataHeader SecondaryEventSelector @@ -634,14 +725,18 @@ AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonEntryLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonExitLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1312841250, name = LArCalibrationHitDeadMaterial -DoubleEventSele... DEBUG Try recording AttributeLists +AthenaEventLoopMgr INFO ===>>> using secondary event #76473 instead of #8<<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #76473, run #300000 7 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #76473, run #300000 8 events processed so far <<<=== +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::next +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::recordAttributeList DoubleEventSele... DEBUG Get AttributeList from the collection DoubleEventSele... DEBUG AttributeList size 12 DoubleEventSele... DEBUG record AthenaAttribute, name = Token = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000008]. -DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary -DoubleEventSele... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000008]. -DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000008]. DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000008]. +DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary +SecondaryEventS... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000008]. +SecondaryEventS... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000008]. DoubleEventSele... DEBUG found AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000008] AthenaPoolAddre... DEBUG found AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000008] AthenaPoolAddre... DEBUG Created dataHeader SecondaryEventSelector @@ -707,14 +802,18 @@ AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonEntryLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonExitLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1312841250, name = LArCalibrationHitDeadMaterial -DoubleEventSele... DEBUG Try recording AttributeLists +AthenaEventLoopMgr INFO ===>>> using secondary event #76478 instead of #9<<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #76478, run #300000 8 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #76478, run #300000 9 events processed so far <<<=== +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::next +DoubleEventSele... DEBUG DoubleEventSelectorAthenaPool::recordAttributeList DoubleEventSele... DEBUG Get AttributeList from the collection DoubleEventSele... DEBUG AttributeList size 12 DoubleEventSele... DEBUG record AthenaAttribute, name = Token = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000009]. -DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary -DoubleEventSele... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000009]. -DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000009]. DoubleEventSele... DEBUG record AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000009]. +DoubleEventSele... DEBUG Append secondary attribute list properties to the primary one with a suffix: secondary +SecondaryEventS... DEBUG record AthenaAttribute, name = Token_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000009]. +SecondaryEventS... DEBUG record AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000009]. DoubleEventSele... DEBUG found AthenaAttribute, name = eventRef = [DB=8BCD9728-EB56-6042-AFDF-61C0C379D70E][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=0000000000000029-0000000000000009] AthenaPoolAddre... DEBUG found AthenaAttribute, name = eventRef_secondary = [DB=9553B87B-1832-3346-A65E-916E6C1DEAB5][CNT=POOLContainer(DataHeader)][CLID=D82968A1-CF91-4320-B2DD-E0F739CBC7E6][TECH=00000202][OID=000000000000001B-0000000000000009] AthenaPoolAddre... DEBUG Created dataHeader SecondaryEventSelector @@ -780,8 +879,25 @@ AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonEntryLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1235574503, name = MuonExitLayer AthenaPoolAddre... DEBUG loadAddresses: DataObject address, clid = 1312841250, name = LArCalibrationHitDeadMaterial +AthenaEventLoopMgr INFO ===>>> using secondary event #76487 instead of #10<<<=== +AthenaEventLoopMgr INFO ===>>> start processing event #76487, run #300000 9 events processed so far <<<=== +AthenaEventLoopMgr INFO ===>>> done processing event #76487, run #300000 10 events processed so far <<<=== Stream1 INFO Records written: 11 +/home/sss/nobac... INFO Database being retired... +Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 8BCD9728-EB56-6042-AFDF-61C0C379D70E +/home/sss/nobac... INFO Database being retired... +Domain[ROOT_All] INFO -> Deaccess DbDatabase READ [ROOT_All] 9553B87B-1832-3346-A65E-916E6C1DEAB5 +OutputRDO.root INFO Database being retired... +Domain[ROOT_All] INFO -> Deaccess DbDatabase CREATE [ROOT_All] 22B32F76-1345-524A-B55B-D789FB399093 +Domain[ROOT_All] INFO > Deaccess DbDomain UPDATE [ROOT_All] ApplicationMgr INFO Application Manager Stopped successfully +IncidentProcAlg1 INFO Finalize +IncidentProcAlg2 INFO Finalize +Domain[ROOT_All] INFO > Deaccess DbDomain READ [ROOT_All] +DecisionSvc INFO Finalized successfully. +AthDictLoaderSvc INFO in finalize... +ToolSvc INFO Removing all tools created by ToolSvc +ChronoStatSvc.f... INFO Service finalized successfully ApplicationMgr INFO Application Manager Finalized successfully ApplicationMgr INFO Application Manager Terminated successfully Py:Athena INFO leaving with code 0: "successful run" diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/test/post_check_with_select.sh b/AtlasTest/DatabaseTest/AthenaPoolTest/test/post_check_with_select.sh index 289787d111d0ff6fcc660670fdd583756c90fcfa..6bda0070aef3e9bb6ceee928c478dafd053b5cbf 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/test/post_check_with_select.sh +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/test/post_check_with_select.sh @@ -57,7 +57,7 @@ select=$2 diff -a -b -B $joblog $reflog |\ # select only the differing lines egrep -a '^[<>] ' |\ - egrep -a ${select} |\ + egrep -a "${select}" |\ # ignore file name after Id - needed for EventInfo tests: egrep -a -v '\$Id:' |\ # Ignore line with 'Release' in it @@ -75,7 +75,8 @@ select=$2 # Destructor can be called at different times. egrep -a -v 'DEBUG Calling destructor'|\ egrep -a -v 'Service base class initialized successfully'|\ - egrep -a -v 'DEBUG fillTagInfo:' + egrep -a -v 'DEBUG fillTagInfo:' |\ + egrep -a -v 'DEBUG Try item:' else # echo " post.sh> Now comparing output with reference" diff --git a/AtlasTest/DatabaseTest/IOVDbTestAlg/CMakeLists.txt b/AtlasTest/DatabaseTest/IOVDbTestAlg/CMakeLists.txt index 7277478425d44dc95e6194d7771a4891ce32193a..343323f9db14d390fb967664e916f62253ac5296 100644 --- a/AtlasTest/DatabaseTest/IOVDbTestAlg/CMakeLists.txt +++ b/AtlasTest/DatabaseTest/IOVDbTestAlg/CMakeLists.txt @@ -35,9 +35,10 @@ function (iovdbtestalg_run_test testName jo) cmake_parse_arguments( ARG "" "DEPENDS" "" ${ARGN} ) atlas_add_test( ${testName} - SCRIPT "POOL_OUTMSG_LEVEL=4 athena.py IOVDbTestAlg/${jo}.py" + SCRIPT "athena.py IOVDbTestAlg/${jo}.py" LOG_SELECT_PATTERN "^IOVDbTestAlg" PROPERTIES TIMEOUT 300 + ENVIRONMENT "POOL_OUTMSG_LEVEL=4" ) if( ARG_DEPENDS ) set_tests_properties( IOVDbTestAlg_${testName}_ctest diff --git a/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h b/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h index 451c569497d7f93d69dcba62a477a2ecb43c5083..699410b9b5dd79ec9561ada3c00eaab7ddd98ad5 100755 --- a/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h +++ b/Calorimeter/CaloClusterCorrection/CaloClusterCorrection/CaloFillRectangularCluster.h @@ -1,7 +1,7 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: CaloFillRectangularCluster.h,v 1.7 2009-04-25 17:57:00 ssnyder Exp $ @@ -43,6 +43,7 @@ #include "AthenaKernel/IOVSvcDefs.h" #include "StoreGate/ReadHandleKey.h" #include "GaudiKernel/ThreadLocalContext.h" +class CaloDetDescrManager; // Helper object used for the per-sampling calculations. namespace CaloClusterCorr { @@ -148,6 +149,7 @@ private: * @param samplings List of samplings for this region. */ void makeCorrection1 (const EventContext& ctx, + const CaloDetDescrManager& dd_man, CaloClusterCorr::SamplingHelper& helper, double eta, double phi, @@ -160,6 +162,7 @@ private: * @param helper Sampling calculation helper object. */ void makeCorrection2 (const EventContext& ctx, + const CaloDetDescrManager& dd_man, CaloClusterCorr::SamplingHelper& helper) const; diff --git a/Calorimeter/CaloClusterCorrection/python/CaloClusterTimeTool.py b/Calorimeter/CaloClusterCorrection/python/CaloClusterTimeTool.py deleted file mode 100644 index a0eae2d6f826cd019d19966b79786d1843628c5d..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloClusterCorrection/python/CaloClusterTimeTool.py +++ /dev/null @@ -1,15 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -def GetCaloClusterTimeTool(name, name_FebOffset='',name_RunOffset=''): - - from AthenaCommon.AppMgr import ToolSvc,theApp - - - from CaloClusterCorrection.CaloClusterCorrectionConf import CaloClusterTimeTool - - theTool = CaloClusterTimeTool( name, - keyFebOffset = name_FebOffset, - keyRunOffset = name_RunOffset - ) - - return theTool diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx b/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx index a8b2d61d81eb45a60bf68a9fc7bf28d0e548cdc7..3f6d9703ff0cf6d5824268f9e306ab5f21455dfc 100755 --- a/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx +++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalib.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CaloClusterCorrection/CaloClusterLocalCalib.h" @@ -93,8 +93,8 @@ StatusCode CaloClusterLocalCalib::execute(const EventContext& ctx, double oldEnergy = theCluster->e(); - const CaloDetDescrManager* calo_dd_man = CaloDetDescrManager::instance(); - const CaloCell_ID* calo_id = calo_dd_man->getCaloCell_ID(); + const CaloCell_ID* calo_id = nullptr; + ATH_CHECK(detStore()->retrieve(calo_id,"CaloCell_ID")); // Make new Cluster and CellColl CaloCellContainer* myCellColl = new CaloCellContainer(SG::OWN_ELEMENTS); diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalibCone.cxx b/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalibCone.cxx index c1461af172e496721293586c2039d75d4b8abe48..2cd9ef867659bfa0239f3fea08ce59dd259e09dc 100755 --- a/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalibCone.cxx +++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalibCone.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------- @@ -50,8 +50,6 @@ CaloClusterLocalCalibCone::CaloClusterLocalCalibCone(const std::string& type, m_hadWeightFileName(""), m_signalOverNoiseCut(2), m_hadWeightFile(0), - m_calo_id(0), - m_calo_dd_man(0), m_noiseTool(0) { m_etaBins.resize(0); @@ -84,9 +82,6 @@ StatusCode CaloClusterLocalCalibCone::initialize() msg(MSG::INFO) << "Initializing " << name() << endmsg; - // pointer to detector manager: - m_calo_dd_man = CaloDetDescrManager::instance(); - m_calo_id = m_calo_dd_man->getCaloCell_ID(); //---- retrieve the noise tool ---------------- @@ -221,127 +216,105 @@ CaloClusterLocalCalibCone::execute(const EventContext& /*ctx*/, xAOD::CaloClusterContainer::iterator clusIter = clusColl->begin(); xAOD::CaloClusterContainer::iterator clusIterEnd = clusColl->end(); unsigned int iClus=0; - for( ;clusIter!=clusIterEnd;clusIter++,iClus++) { - xAOD::CaloCluster * thisCluster = *clusIter; + for (; clusIter != clusIterEnd; clusIter++, iClus++) { + xAOD::CaloCluster* thisCluster = *clusIter; // check existing jets - for(unsigned int ijet=0;ijet<jets.size();ijet++) { - if ( ( m_coneSchema == Angle - && jets[ijet]->Angle(thisCluster->p4().Vect()) < m_coneDistance ) - || ( m_coneSchema == DeltaR - && jets[ijet]->DeltaR(thisCluster->p4()) < m_coneDistance ) ) { - if ( thisCluster->e()+jets[ijet]->E() > 0 ) { - pjet[iClus] = jets[ijet]; - // add energy only - don't change jet direction - (*jets[ijet]) *= ((thisCluster->e()+jets[ijet]->E()) - /jets[ijet]->E()); - - ATH_MSG_DEBUG( - "added cluster with E/eta/phi = " << thisCluster->e() - << "/" << thisCluster->eta() - << "/" << thisCluster->phi() - << " to jet " << ijet << " which has now E/eta/phi/M = " - << jets[ijet]->E() - << "/" << jets[ijet]->Eta() - << "/" << jets[ijet]->Phi() - << "/" << jets[ijet]->M() - << endmsg); - } - break; + for (unsigned int ijet = 0; ijet < jets.size(); ijet++) { + if ((m_coneSchema == Angle && jets[ijet]->Angle(thisCluster->p4().Vect()) < m_coneDistance) || + (m_coneSchema == DeltaR && jets[ijet]->DeltaR(thisCluster->p4()) < m_coneDistance)) { + if (thisCluster->e() + jets[ijet]->E() > 0) { + pjet[iClus] = jets[ijet]; + // add energy only - don't change jet direction + (*jets[ijet]) *= ((thisCluster->e() + jets[ijet]->E()) / jets[ijet]->E()); + + ATH_MSG_DEBUG("added cluster with E/eta/phi = " + << thisCluster->e() << "/" << thisCluster->eta() << "/" << thisCluster->phi() << " to jet " + << ijet << " which has now E/eta/phi/M = " << jets[ijet]->E() << "/" << jets[ijet]->Eta() << "/" + << jets[ijet]->Phi() << "/" << jets[ijet]->M() << endmsg); + } + break; } } - if ( !pjet[iClus] && thisCluster->e() > 0 ) { + if (!pjet[iClus] && thisCluster->e() > 0) { // make new jet - TLorentzVector *theJet = new TLorentzVector(thisCluster->p4()); + TLorentzVector* theJet = new TLorentzVector(thisCluster->p4()); pjet[iClus] = theJet; jets.push_back(theJet); - ATH_MSG_DEBUG( - "cluster with E/eta/phi = " << thisCluster->e() - << "/" << thisCluster->eta() - << "/" << thisCluster->phi() - << " started new jet " << jets.size()-1 - << " which has now E/eta/phi/M = " - << theJet->E() - << "/" << theJet->Eta() - << "/" << theJet->Phi() - << "/" << theJet->M() - << endmsg); + ATH_MSG_DEBUG("cluster with E/eta/phi = " + << thisCluster->e() << "/" << thisCluster->eta() << "/" << thisCluster->phi() << " started new jet " + << jets.size() - 1 << " which has now E/eta/phi/M = " << theJet->E() << "/" << theJet->Eta() << "/" + << theJet->Phi() << "/" << theJet->M() << endmsg); } } + const CaloDetDescrManager* calo_dd_man = nullptr; + ATH_CHECK( detStore()->retrieve(calo_dd_man,"CaloMgr") ); + clusIter = clusColl->begin(); - iClus=0; - for( ;clusIter!=clusIterEnd;clusIter++,iClus++) { - xAOD::CaloCluster * thisCluster = *clusIter; - if ( pjet[iClus] - && thisCluster->recoStatus().checkStatus(CaloRecoStatus::StatusIndicator(m_recoStatus))) { - TLorentzVector *thisJet = pjet[iClus]; + iClus = 0; + for (; clusIter != clusIterEnd; clusIter++, iClus++) { + xAOD::CaloCluster* thisCluster = *clusIter; + if (pjet[iClus] && thisCluster->recoStatus().checkStatus(CaloRecoStatus::StatusIndicator(m_recoStatus))) { + TLorentzVector* thisJet = pjet[iClus]; // weight all cells in selected cluster xAOD::CaloCluster::cell_iterator itrCell = thisCluster->cell_begin(); xAOD::CaloCluster::cell_iterator itrCell_e = thisCluster->cell_end(); - for (;itrCell!=itrCell_e;++itrCell) { - const CaloCell* thisCell = *itrCell; - double weight = itrCell.weight(); - // check calo and sampling index for current cell - Identifier myId = thisCell->ID(); - CaloCell_ID::CaloSample theSample = thisCell->caloDDE()->getSampling(); - if ( theSample < (int)m_caloIndices.size() - && m_caloIndices[theSample] >= 0 - && m_samplingIndices[theSample] >= 0 ) { - // check noise level and energy density of the current cell - double sigma = m_noiseTool->getNoise(thisCell,ICalorimeterNoiseTool::ELECTRONICNOISE); - double energy = fabs(thisCell->e()); - double ratio = 0; - if ( finite(sigma) && sigma > 0 ) - ratio = energy/sigma; - if ( ratio > m_signalOverNoiseCut ) { - double volume = 0; - double density = 0; - const CaloDetDescrElement* myCDDE = m_calo_dd_man->get_element(myId); - if ( myCDDE ) { - volume = myCDDE->volume(); - } - if ( volume > 0 ) - density = energy/volume; - if ( density > 0 ) { - int neta = m_etaBins.size()-1; - int ieta; - double abseta = fabs(thisCell->eta()); - for(ieta=0;ieta<neta;ieta++) { - if (abseta >= m_etaBins[ieta] - && abseta < m_etaBins[ieta+1]) - break; - } - if ( ieta < neta && m_data[theSample][ieta]) { - double log10edens = log10(density); - double log10conee = log10(thisJet->E()); - double lemax = m_data[theSample][ieta]->GetXaxis()->GetBinCenter(m_data[theSample][ieta]->GetNbinsX()); - if ( log10conee > lemax ) - log10conee = lemax; - int iBin = m_data[theSample][ieta]->FindBin(log10conee,log10edens); - double num = m_data[theSample][ieta]->GetBinEntries(iBin); - if (num > 10 ) { - weight *= m_data[theSample][ieta]->GetBinContent(iBin); - thisCluster->reweightCell(itrCell,weight); - ATH_MSG_VERBOSE( - "cell with E/eta/phi = " << thisCell->e() - << "/" << thisCell->eta() - << "/" << thisCell->phi() - << " in jet with E/eta/phi/M = " - << thisJet->E() - << "/" << thisJet->Eta() - << "/" << thisJet->Phi() - << "/" << thisJet->M() - << " weighted with w = " << weight - << endmsg); - } - } - }//end if density >0 - }//end if noise cut - } - }//end loop over cells + for (; itrCell != itrCell_e; ++itrCell) { + const CaloCell* thisCell = *itrCell; + double weight = itrCell.weight(); + // check calo and sampling index for current cell + Identifier myId = thisCell->ID(); + CaloCell_ID::CaloSample theSample = thisCell->caloDDE()->getSampling(); + if (theSample < (int)m_caloIndices.size() && m_caloIndices[theSample] >= 0 && + m_samplingIndices[theSample] >= 0) { + // check noise level and energy density of the current cell + double sigma = m_noiseTool->getNoise(thisCell, ICalorimeterNoiseTool::ELECTRONICNOISE); + double energy = fabs(thisCell->e()); + double ratio = 0; + if (finite(sigma) && sigma > 0) + ratio = energy / sigma; + if (ratio > m_signalOverNoiseCut) { + double volume = 0; + double density = 0; + const CaloDetDescrElement* myCDDE = calo_dd_man->get_element(myId); + if (myCDDE) { + volume = myCDDE->volume(); + } + if (volume > 0) + density = energy / volume; + if (density > 0) { + int neta = m_etaBins.size() - 1; + int ieta; + double abseta = fabs(thisCell->eta()); + for (ieta = 0; ieta < neta; ieta++) { + if (abseta >= m_etaBins[ieta] && abseta < m_etaBins[ieta + 1]) + break; + } + if (ieta < neta && m_data[theSample][ieta]) { + double log10edens = log10(density); + double log10conee = log10(thisJet->E()); + double lemax = m_data[theSample][ieta]->GetXaxis()->GetBinCenter(m_data[theSample][ieta]->GetNbinsX()); + if (log10conee > lemax) + log10conee = lemax; + int iBin = m_data[theSample][ieta]->FindBin(log10conee, log10edens); + double num = m_data[theSample][ieta]->GetBinEntries(iBin); + if (num > 10) { + weight *= m_data[theSample][ieta]->GetBinContent(iBin); + thisCluster->reweightCell(itrCell, weight); + ATH_MSG_VERBOSE("cell with E/eta/phi = " + << thisCell->e() << "/" << thisCell->eta() << "/" << thisCell->phi() + << " in jet with E/eta/phi/M = " << thisJet->E() << "/" << thisJet->Eta() << "/" + << thisJet->Phi() << "/" << thisJet->M() << " weighted with w = " << weight + << endmsg); + } + } + } // end if density >0 + } // end if noise cut + } + } // end loop over cells CaloClusterKineHelper::calculateKine(thisCluster,true,m_updateSamplingVars); - - }//end if reco status - }//end loop over clusters + + } // end if reco status + } // end loop over clusters for(unsigned int ijet=0;ijet<jets.size();ijet++) { delete jets[ijet]; } diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalibCone.h b/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalibCone.h index 19aabf53f55c9673a5393c39cf59224a4d2ae1df..fb0a4580cddb404e3052a30036d4a6a6bc998e15 100755 --- a/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalibCone.h +++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterLocalCalibCone.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CALOCLUSTERCORRECTION_CALOCLUSTERLOCALCALIBCONE_H @@ -152,8 +152,6 @@ class CaloClusterLocalCalibCone : public AthAlgTool, virtual public CaloClusterC std::vector<std::vector<TProfile2D *> > m_data; - const CaloCell_ID* m_calo_id; - const CaloDetDescrManager* m_calo_dd_man; ICalorimeterNoiseTool * m_noiseTool; }; diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterLogPos.cxx b/Calorimeter/CaloClusterCorrection/src/CaloClusterLogPos.cxx index 11d8e7af81440a825b80d84abc11c5c37cbd2757..035deb219b6ed3803679b1766ed33dafddd5cfc2 100644 --- a/Calorimeter/CaloClusterCorrection/src/CaloClusterLogPos.cxx +++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterLogPos.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CaloClusterLogPos.h" @@ -17,9 +17,7 @@ CaloClusterLogPos::CaloClusterLogPos(const std::string& type, const std::string& name, const IInterface* parent) :CaloClusterProcessor(type, name, parent), - m_offset(4.7), - m_calo_id(0), - m_calo_dd_man(0) + m_offset(4.7) { declareProperty ("LogPosOffset",m_offset) ; } @@ -29,10 +27,6 @@ StatusCode CaloClusterLogPos::initialize() { ATH_MSG_DEBUG("Initializing " << name() << endmsg ) ; - // pointer to detector manager: - m_calo_dd_man = CaloDetDescrManager::instance(); - m_calo_id = m_calo_dd_man->getCaloCell_ID(); - return StatusCode::SUCCESS; } diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterLogPos.h b/Calorimeter/CaloClusterCorrection/src/CaloClusterLogPos.h index b2fd225986c714f0a77b7d946e0cacb89ac882ef..1180166b28f87df6888d1fbcd525d65995f59cf8 100644 --- a/Calorimeter/CaloClusterCorrection/src/CaloClusterLogPos.h +++ b/Calorimeter/CaloClusterCorrection/src/CaloClusterLogPos.h @@ -1,7 +1,7 @@ // This file's extension implies that it's C, but it's really -*- C++ -*-. /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: CaloClusterLogPos.h,v 1.3 2009-04-22 17:26:21 ssnyder Exp $ @@ -69,8 +69,6 @@ class CaloClusterLogPos : public CaloClusterProcessor // property: offset for the logarithmic weighting double m_offset; - const CaloCell_ID* m_calo_id; - const CaloDetDescrManager* m_calo_dd_man; }; diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterTimeTool.cxx b/Calorimeter/CaloClusterCorrection/src/CaloClusterTimeTool.cxx deleted file mode 100644 index 4243fabeb70819c163b7de4f9400395870677d4b..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloClusterCorrection/src/CaloClusterTimeTool.cxx +++ /dev/null @@ -1,493 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/******************************************************************** - -NAME: CaloClusterTimeTool.cxx -PACKAGE: offline/Calorimeter/CaloClusterCorrection - -AUTHORS: D. Hu -CREATED: Jan 2012 - -PURPOSE: correct time for EM clusters - -********************************************************************/ - -#include "CaloClusterTimeTool.h" -#include "Identifier/Identifier.h" -#include "Identifier/HWIdentifier.h" - -#include "CaloIdentifier/CaloGain.h" -#include "CaloDetDescr/CaloDetDescrElement.h" -//#include "CaloEvent/CaloSampling.h" -#include "CaloIdentifier/CaloCell_ID.h" - -#include "CaloCondBlobObjs/CaloCondUtils.h" - -#include "AthenaKernel/IOVSvcDefs.h" -#include "AsgTools/MsgStream.h" - -using xAOD::CaloCluster; - - -CaloClusterTimeTool::CaloClusterTimeTool (const std::string& type,const std::string& name,const IInterface* parent) - : AthAlgTool( type, name, parent ), - m_LArOnlineIDHelper(nullptr), - m_calo_id(nullptr) -{ - declareInterface<ICaloClusterTimeTool>(this); - - declareProperty("keyFebOffset", m_keyFebOffset); - declareProperty("keyRunOffset", m_keyRunOffset); - m_runOffsetBlob=0; - m_lastItFeb=m_febOffsetBlobMap.begin(); -} - -CaloClusterTimeTool::~CaloClusterTimeTool() {} - -StatusCode CaloClusterTimeTool::initialize ATLAS_NOT_THREAD_SAFE /*Can Register callbacks but no need to be thread safe*/(){ - - ATH_MSG_INFO( "initialize CaloClusterTimeTool " ); - - StatusCode sc = StatusCode::SUCCESS; - - sc = AthAlgTool::initialize(); - if (sc.isFailure()) { - ATH_MSG_ERROR( "Could not initialize AthAlgTool for CaloClusterTimeTool " ); - return StatusCode::SUCCESS; - } - else { - ATH_MSG_INFO( "initialize AthAlgTool for CaloClusterTimeTool " ); - } - - - // Retrieve online ID helper - sc = detStore()->retrieve(m_LArOnlineIDHelper, "LArOnlineID"); - if (sc.isFailure()) { - ATH_MSG_ERROR( "Could not get LArOnlineIDHelper" ); - return StatusCode::SUCCESS; - } - else{ - ATH_MSG_INFO( "LArOnlineIDHelper is retrieved" ); - } - - // Retrieve CaloCell_ID - sc = detStore()->retrieve(m_calo_id); - if (sc.isFailure()) { - ATH_MSG_ERROR("Unable to retrieve CALO ID"); - return sc; - } - else{ - ATH_MSG_INFO("pointer to Calo ID is retrieved"); - } - - ATH_CHECK( m_cablingKey.initialize() ); - - // register callback - if(m_keyFebOffset!=""){ - sc = detStore()->regFcn(&CaloClusterTimeTool::updateFebOffsetMap, this, m_febOffsetColl, m_keyFebOffset); - if (sc.isFailure()) { - ATH_MSG_ERROR( "Could not register callback" ); - return StatusCode::SUCCESS; - } - else{ - ATH_MSG_INFO( "callback is registered" ); - } - } - - if(m_keyRunOffset!=""){ - sc = detStore()->regFcn(&CaloClusterTimeTool::updateRunOffsetMap, this, m_runOffsetColl, m_keyRunOffset); - if (sc.isFailure()) { - ATH_MSG_ERROR( "Could not register callback" ); - return StatusCode::SUCCESS; - } - else{ - ATH_MSG_INFO( "callback is registered" ); - } - } - - ATH_MSG_INFO( "CaloClusterTimeTool is initialized " ); - - return sc; -} - -StatusCode CaloClusterTimeTool::updateFebOffsetMap(IOVSVC_CALLBACK_ARGS_K(/*keys*/)){ - ATH_MSG_DEBUG( "CaloClusterTimeTool updateFebOffsetMap is called" ); - std::list<std::string>::const_iterator itr; - //for(itr=keys.begin(); itr!=keys.end(); ++itr){ - // msg() << *itr <<""; - //} - //msg() << endreq; - - CondAttrListCollection::const_iterator iColl = m_febOffsetColl->begin(); - CondAttrListCollection::const_iterator last = m_febOffsetColl->end(); - for(;iColl != last; ++iColl) { - unsigned int sysId = static_cast<unsigned int>(iColl->first); - - std::map<unsigned int, const CaloCondBlobFlt*>::iterator iOld = m_febOffsetBlobMap.find(sysId); - if(iOld != m_febOffsetBlobMap.end()){ - delete iOld->second; - } - - const coral::Blob& blob = iColl->second["CaloCondBlob16M"].data<coral::Blob>(); - const CaloCondBlobFlt* flt = CaloCondBlobFlt::getInstance(blob); - - m_febOffsetBlobMap[sysId] = flt; - } - - m_lastItFeb=m_febOffsetBlobMap.begin(); - return StatusCode::SUCCESS; -} - -StatusCode CaloClusterTimeTool::updateRunOffsetMap(IOVSVC_CALLBACK_ARGS_K(/*keys*/)){ - ATH_MSG_DEBUG( "CaloClusterTimeTool updateRunOffsetMap is called" ); - std::list<std::string>::const_iterator itr; - //for(itr=keys.begin(); itr!=keys.end(); ++itr){ - // msg() << *itr <<""; - //} - //msg() << endreq; - - CondAttrListCollection::const_iterator iColl = m_runOffsetColl->begin(); - CondAttrListCollection::const_iterator last = m_runOffsetColl->end(); - for(;iColl != last; ++iColl) { - unsigned int sysId = static_cast<unsigned int>(iColl->first); - - if(sysId==1){ - if(m_runOffsetBlob){ - delete m_runOffsetBlob; - m_runOffsetBlob=0; - } - const coral::Blob& blob = iColl->second["CaloCondBlob16M"].data<coral::Blob>(); - const CaloCondBlobFlt* flt = CaloCondBlobFlt::getInstance(blob); - m_runOffsetBlob = flt; - } - - } - - return StatusCode::SUCCESS; -} - - -void CaloClusterTimeTool::makeClusterTimeCorrection(float pv_z, const CaloCluster* cluster, float& time, float& error, unsigned int& flag) -{ - - ATH_MSG_DEBUG( " during CaloClusterTimeTool::makeClusterTimeCorrection " ); - error=0.; - flag=0x0; - - if(cluster){ - - float emax=-9999.; - const CaloCell* cell_maxE=0; - - const CaloClusterCellLink* cellLink=cluster->getCellLinks(); - if (cellLink) { - CaloClusterCellLink::const_iterator cellIter = cluster->cell_begin(); - CaloClusterCellLink::const_iterator cellIterEnd = cluster->cell_end(); - for (;cellIter!=cellIterEnd;cellIter++) { - const CaloCell* cell = (*cellIter); - int sampling = cell->caloDDE()->getSampling(); - if (sampling== CaloCell_ID::EMB2 || sampling== CaloCell_ID::EME2) { - if ( (cell->provenance() & 0x2000) ) { - if (cell->e() > emax) { - emax=cell->e(); - if(emax>5000.) cell_maxE=cell; - } - } - } - } - } - else{ - flag += ( 0x1 << CELL_INFO_MISSING); - ATH_MSG_WARNING( "cell link is invalid " ); - } - - if(cell_maxE){ - makeCellTimeCorrection(pv_z, cell_maxE, time, error, flag); - } - else{ - flag += ( 0x1 << CLUS_GOODMIDCELL_MISSING); - ATH_MSG_WARNING( "no cell found in middle layer with max energy > 5 GeV and good quality " ); - } - } - else{ - flag += ( 0x1 << CLUS_INFO_MISSING); - ATH_MSG_WARNING( "cluster is empty " ); - } -} - -void CaloClusterTimeTool::makeCellTimeCorrection(float pv_z,const CaloCell* cell, float & time, float & error, unsigned int& flag){ - - ATH_MSG_DEBUG( " during CaloClusterTimeTool::makeCellTimeCorrection " ); - - time = cell->time(); - error=0.; - float e_GEV = cell->e()*(1./1000.) ; - CaloGain::CaloGain gain= cell->gain(); - unsigned int dbGain = CaloCondUtils::getDbCaloGain(gain); - - if(dbGain==0) flag += ( 0x1 << HIGH_GAIN_SET); - if(dbGain==1) flag += ( 0x1 << MEDIUM_GAIN_SET); - if(dbGain==2) flag += ( 0x1 << LOW_GAIN_SET); - - Identifier cell_ID = cell->ID(); - const unsigned int cell_ID_value = cell_ID.get_compact(); - IdentifierHash cellHash = m_calo_id->calo_cell_hash(cell_ID); - int sub_Calo(0); - unsigned int sub_Hash = m_calo_id->subcalo_cell_hash(cellHash, sub_Calo); - unsigned int subHash_calo=0; - unsigned int sysId = 0; - - //Calo sysId Offset - //EMEC NEG 0 0 - //EMB NEG 1 31872 - //EMB POS 2 31872 + 54784 = 86656 - //EMEC POS 3 31872 + 54784 + 54784 =141440 - //HEC 16 0 - //FCAL 32 0 - //TILE 48 0 - if (sub_Calo==CaloCell_ID::LAREM) { - if (sub_Hash >= 141440) { - subHash_calo=sub_Hash-141440; - sysId=3; - } - else if (sub_Hash>=86656) { - subHash_calo=sub_Hash-86656; - sysId=2; - } - else if (sub_Hash>=31872) { - subHash_calo=sub_Hash-31872; - sysId=1; - } - else{ - subHash_calo=sub_Hash; - sysId=0; - } - }// end if LAr EM - else{ - ATH_MSG_WARNING( "channel is not in EMEC or EMB no correction" ); - flag += ( 0x1 << CELL_NO_EM); - return; - } - - if(m_lastItFeb!=m_febOffsetBlobMap.end()){ - if(m_lastItFeb->first!=sysId){ - m_lastItFeb=m_febOffsetBlobMap.find(sysId); - } - } - else m_lastItFeb=m_febOffsetBlobMap.find(sysId); - -/* - if(sub_Calo==CaloCell_ID::LAREM) { subHash_calo=sub_Hash; } - else if(sub_Calo==CaloCell_ID::LARHEC) { subHash_calo=sub_Hash+173312; } - else if(sub_Calo==CaloCell_ID::LARFCAL) { subHash_calo=sub_Hash+173312+5632; } - else if(sub_Calo==CaloCell_ID::TILE) { subHash_calo=sub_Hash+173312+5632+3524; } -*/ - - const CaloDetDescrElement* caloDDEl= cell->caloDDE(); - Identifier cell_ID_1 = caloDDEl->identify(); - const unsigned int cell_ID_1_value = cell_ID_1.get_compact(); - float cell_x = caloDDEl->x(); // or x_raw() - float cell_y = caloDDEl->y(); // or y_raw() - float cell_z = caloDDEl->z(); // or z_raw() - - float febchaOff = 0; - float errOff[2]={0}; - float eneOff[15]={0}; - float runOff = 0; - float runEntry = 0; - - if(m_lastItFeb!=m_febOffsetBlobMap.end()){ - const CaloCondBlobFlt* const flt_feb = m_lastItFeb->second; - febchaOff = flt_feb->getData(subHash_calo, dbGain, 0); - errOff[0] = flt_feb->getData(subHash_calo, dbGain, 1); - errOff[1] = flt_feb->getData(subHash_calo, dbGain, 2); - eneOff[0] = flt_feb->getData(subHash_calo, dbGain, 3); - eneOff[1] = flt_feb->getData(subHash_calo, dbGain, 4); - eneOff[2] = flt_feb->getData(subHash_calo, dbGain, 5); - eneOff[3] = flt_feb->getData(subHash_calo, dbGain, 6); - eneOff[4] = flt_feb->getData(subHash_calo, dbGain, 7); - eneOff[5] = flt_feb->getData(subHash_calo, dbGain, 8); - eneOff[6] = flt_feb->getData(subHash_calo, dbGain, 9); - eneOff[7] = flt_feb->getData(subHash_calo, dbGain, 10); - eneOff[8] = flt_feb->getData(subHash_calo, dbGain, 11); - eneOff[9] = flt_feb->getData(subHash_calo, dbGain, 12); - eneOff[10] = flt_feb->getData(subHash_calo, dbGain, 13); - eneOff[11] = flt_feb->getData(subHash_calo, dbGain, 14); - eneOff[12] = flt_feb->getData(subHash_calo, dbGain, 15); - eneOff[13] = flt_feb->getData(subHash_calo, dbGain, 16); - eneOff[14] = flt_feb->getData(subHash_calo, dbGain, 17); - } - else { - ATH_MSG_WARNING("no sysId="<<sysId<<" find in m_febOffsetBlobMap"); - flag += ( 0x1 << DB_ALL_MISSING); - } - - SG::ReadCondHandle<LArOnOffIdMapping> cablingHdl{m_cablingKey}; - const LArOnOffIdMapping* cabling{*cablingHdl}; - if(!cabling) { - ATH_MSG_ERROR( "Do not have cabling mapping from key " << m_cablingKey.key() ); - return; - } - //if(run_number < 177986 || run_number > 191933) flag += ( 0x1 << RUN_NO_OUT_OF_RANGE); - IdentifierHash cell_onHash = caloDDEl->onl1(); - HWIdentifier cell_onID = m_LArOnlineIDHelper->channel_Id(cell_onHash) ; - HWIdentifier cell_onID_1 = cabling->createSignalChannelID(cell_ID); - HWIdentifier feb_onID = m_LArOnlineIDHelper->feb_Id(cell_onID_1); - HWIdentifier ft_onID = m_LArOnlineIDHelper->feedthrough_Id(cell_onID_1); - bool ifValidId = m_LArOnlineIDHelper->isValidId(ft_onID); - ATH_MSG_DEBUG("ifValidId="<<ifValidId ); - if(!ifValidId) { - ATH_MSG_WARNING( "ft_onID is not valid" ); - flag += ( 0x1 << CELL_FTONID_INVALID); - return; - } - const unsigned int cell_onHash_value = cell_onHash; - const unsigned int ft_onID_value = ft_onID.get_compact(); - const unsigned int feb_onID_value = feb_onID.get_compact(); - const unsigned int cell_onID_value = cell_onID.get_compact(); - const unsigned int cell_onID_1_value = cell_onID_1.get_compact(); - int feedthrough = m_LArOnlineIDHelper->feedthrough(ft_onID); // [0,31] ==barrel A/C - // 00,01,04,07,08,11,12,13,14,17,18,19,20,23,24 = EMEC Standard crates - // 02,09,15,21 = EMEC Special crates - // 03,10,16,22 = HEC crates - // 06 = FCAL crate - int pos_neg = m_LArOnlineIDHelper->pos_neg(ft_onID); // A:0; C:1 - int barrel_ec = m_LArOnlineIDHelper->barrel_ec(ft_onID); // Barrel:0; EC:1 - int index = feedthrough; - if(!barrel_ec){ // barrel - if(pos_neg) index = feedthrough; //barrel C [0,31] - else index = 32 + feedthrough; // barrel A [32,63] - } - else { //EC - if(pos_neg) index = 64 + feedthrough; // EMEC C [64,88] - else index = 25 + 64 + feedthrough; // EMEC A [89,113] - } - - if(m_runOffsetBlob){ - runOff = m_runOffsetBlob->getData(index, dbGain, 0); - runEntry = m_runOffsetBlob->getData(index, dbGain, 1); - } - else { - ATH_MSG_WARNING("m_runOffsetBlob is empty"); - flag += ( 0x1 << DB_RUN_MISSING); - } - - if (msgLvl(MSG::DEBUG)){ - ATH_MSG_DEBUG("cell_ID_value="<<cell_ID_value<<"; cell_ID_1_value="<<cell_ID_1_value <<"; cellHash="<<cellHash<<"; sub_Hash="<<sub_Hash<<"; subHash_calo="<<subHash_calo <<"; gain=" << dbGain); - ATH_MSG_DEBUG("febchaOff="<<febchaOff); - ATH_MSG_DEBUG("errOff[0]="<<errOff[0]); - ATH_MSG_DEBUG("errOff[1]="<<errOff[1]); - ATH_MSG_DEBUG("eneOff[0]="<<eneOff[0]); - ATH_MSG_DEBUG("eneOff[1]="<<eneOff[1]); - ATH_MSG_DEBUG("eneOff[2]="<<eneOff[2]); - ATH_MSG_DEBUG("eneOff[3]="<<eneOff[3]); - ATH_MSG_DEBUG("eneOff[4]="<<eneOff[4]); - ATH_MSG_DEBUG("eneOff[5]="<<eneOff[5]); - ATH_MSG_DEBUG("eneOff[6]="<<eneOff[6]); - ATH_MSG_DEBUG("eneOff[7]="<<eneOff[7]); - ATH_MSG_DEBUG("eneOff[8]="<<eneOff[8]); - ATH_MSG_DEBUG("eneOff[9]="<<eneOff[9]); - ATH_MSG_DEBUG("eneOff[10]="<<eneOff[10]); - ATH_MSG_DEBUG("eneOff[11]="<<eneOff[11]); - ATH_MSG_DEBUG("eneOff[12]="<<eneOff[12]); - ATH_MSG_DEBUG("eneOff[13]="<<eneOff[13]); - ATH_MSG_DEBUG("eneOff[14]="<<eneOff[14]); - ATH_MSG_DEBUG("cell_onHash_value="<<cell_onHash_value <<"cell_onID_value="<<cell_onID_value<<";cell_onID_1_value= "<<cell_onID_1_value<<";feb_onID_value"<<feb_onID_value<<";ft_onID_value="<<ft_onID_value<<";feedthrough="<<feedthrough<<";pos_neg="<<pos_neg<<";barrel_ec="<<barrel_ec<<";index="<<index<<"; gain="<< dbGain); - ATH_MSG_DEBUG("runOff="<<runOff); - ATH_MSG_DEBUG("runEntry="<<runEntry); - } - - if(runOff==0.) flag += ( 0x1 << RUN_NO_CORRECTION_ZERO); - if(runEntry<50) flag += ( 0x1 << RUN_NO_CORRECTION_LOW_STATS); - - // pass1 correction : HFEC depended run correction - time = time - runOff; - - // pass2,3 correction : feb correction, channel correction - time = time - febchaOff; - - // pass4 correction: slot(FEB) depended energy correction - time = time - energyCorr(eneOff,15, e_GEV); - if(e_GEV<5.0 || e_GEV>250.0) flag += ( 0x1 << ENERGY_CORRECTION_FAILED); - - // pass5 correction: primary vertex correction - time = time - pvCorr(cell_x, cell_y, cell_z, pv_z); - - error = errorCompute(errOff, 2, e_GEV); -} - -float CaloClusterTimeTool::energyCorr(float eneOff[], int num, float energy){ - ATH_MSG_DEBUG("inside energyCorr"); - if(num < 15){ - ATH_MSG_ERROR( "less than 15 parameters are passed to energyCorr" ); - return 0; - } - - float ene_use=0.; - float tOff=0.; - - if(eneOff[0]==eneOff[8]){ - if(energy<eneOff[0]) ene_use=eneOff[0]; - else if(energy>eneOff[1]) ene_use=eneOff[1]; - else ene_use=energy; - - tOff=eneOff[2]+ - eneOff[3]*ene_use+ - eneOff[4]*ene_use*ene_use+ - eneOff[5]*ene_use*ene_use*ene_use+ - eneOff[6]*ene_use*ene_use*ene_use*ene_use+ - eneOff[7]*ene_use*ene_use*ene_use*ene_use*ene_use; - } - else { - if(energy>=eneOff[8]){ - if(energy>eneOff[1]) ene_use=eneOff[1]; - else ene_use=energy; - - tOff=eneOff[2]+ - eneOff[3]*ene_use+ - eneOff[4]*ene_use*ene_use+ - eneOff[5]*ene_use*ene_use*ene_use+ - eneOff[6]*ene_use*ene_use*ene_use*ene_use+ - eneOff[7]*ene_use*ene_use*ene_use*ene_use*ene_use; - } - else{ - if(energy<eneOff[0]) ene_use=eneOff[0]; - else ene_use=energy; - - tOff=eneOff[9]+ - eneOff[10]*ene_use+ - eneOff[11]*ene_use*ene_use+ - eneOff[12]*ene_use*ene_use*ene_use+ - eneOff[13]*ene_use*ene_use*ene_use*ene_use; - } - } - - return tOff; -} - -float CaloClusterTimeTool::pvCorr(float cellX, float cellY, float cellZ, float pvZ){ - ATH_MSG_DEBUG("inside pvCorr"); - float r_cen = sqrt(cellX*cellX + cellY*cellY + cellZ*cellZ); - float r_pv = sqrt(cellX*cellX + cellY*cellY + (cellZ-pvZ)*(cellZ-pvZ)); - float tOff = (r_pv-r_cen)*(0.01/3.0); - - return tOff; -} - -float CaloClusterTimeTool::errorCompute(float errOff[], int num, float energy){ - ATH_MSG_DEBUG("inside errorCompute"); - if(num < 2){ - ATH_MSG_ERROR( "less than 2 parameters are passed to errorCompute" ); - return 0; - } - - const float relerr = errOff[0]/energy; - float error = sqrt( relerr*relerr + errOff[1]*errOff[1] ); - - return error; -} - - - diff --git a/Calorimeter/CaloClusterCorrection/src/CaloClusterTimeTool.h b/Calorimeter/CaloClusterCorrection/src/CaloClusterTimeTool.h deleted file mode 100644 index b2fba8a28efcae372cd01525f31b37562330e937..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloClusterCorrection/src/CaloClusterTimeTool.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef CALOCLUSTERTIMETOOL_H -#define CALOCLUSTERTIMETOOL_H -/******************************************************************** - -NAME: CaloClusterTimeTool.h -PACKAGE: offline/Calorimeter/CaloClusterCorrection - -AUTHORS: D. Hu -CREATED: Jan 2012 - -PURPOSE: correct time for EM clusters - -********************************************************************/ - -#include "GaudiKernel/ToolHandle.h" -#include "StoreGate/DataHandle.h" -#include "AthenaBaseComps/AthAlgTool.h" -#include "CaloInterface/ICaloClusterTimeTool.h" - -#include "CaloCondBlobObjs/CaloCondBlobFlt.h" -#include "AthenaPoolUtilities/CondAttrListCollection.h" -#include "xAODCaloEvent/CaloCluster.h" -#include "CaloEvent/CaloCell.h" -#include "CaloIdentifier/CaloCell_ID.h" -#include "LArIdentifier/LArOnlineID.h" -#include "LArCabling/LArOnOffIdMapping.h" - -#include <string> -#include <vector> -#include <iostream> -#include <fstream> -#include <sstream> - -#include "CxxUtils/checker_macros.h" -class CaloClusterTimeTool : public AthAlgTool, virtual public ICaloClusterTimeTool -{ -public: - - enum CaloClusterTimeFlags{ - - RUN_NO_CORRECTION_FAILED=0, - RUN_NO_CORRECTION_ZERO=1, - RUN_NO_CORRECTION_LOW_STATS=2, - - DB_ALL_MISSING=3, - DB_RUN_MISSING=4, - - FEB_CORRECTION_FAILED=5, - - CHANNEL_CORRECTION_FAILED=10, - - ENERGY_CORRECTION_FAILED=15, - ENERGY_OUT_OF_RANGE=16, - - PV_CORRECTION_FAILED=20, - PV_INFO_MISSING=21, - - CLUS_INFO_MISSING = 23, - CLUS_GOODMIDCELL_MISSING = 24, - CELL_INFO_MISSING = 25, - CELL_NO_EM = 26, - CELL_FTONID_INVALID=27, - - HIGH_GAIN_SET = 29, - MEDIUM_GAIN_SET =30, - LOW_GAIN_SET = 31 - - }; - - // constructor - CaloClusterTimeTool (const std::string& type, const std::string& name, const IInterface* parent); - - virtual ~CaloClusterTimeTool(); - - virtual StatusCode initialize(); - - virtual void makeClusterTimeCorrection(float pv_z, const xAOD::CaloCluster* cluster,float& time_corr, float& error, unsigned int& flag ); - virtual void makeCellTimeCorrection(float pv_z, const CaloCell* cell, float& time_corr, float& error, unsigned int& flag); - - - - -#define IOVSVC_CALLBACK_ARGS_K(K) int&,std::list<std::string>& K - - - - //StatusCode updateFebOffsetMap(IOVSVC_CALLBACK_ARGS); - //StatusCode updateRunOffsetMap(IOVSVC_CALLBACK_ARGS); - // Ewan edit - added these two - StatusCode updateFebOffsetMap(IOVSVC_CALLBACK_ARGS_K(keys)); - StatusCode updateRunOffsetMap(IOVSVC_CALLBACK_ARGS_K(keys)); - - - - - float energyCorr(float eneOff[], int num, float energy); - - float pvCorr(float cellX, float cellY, float cellZ, float pvZ); - - float errorCompute(float errOff[], int num, float energy); - -private: - - const LArOnlineID* m_LArOnlineIDHelper; - const CaloCell_ID* m_calo_id; - SG::ReadCondHandleKey<LArOnOffIdMapping> m_cablingKey{this,"CablingKey","LArOnOffIdMap","SG Key of LArOnOffIdMapping object"}; - - const DataHandle<CondAttrListCollection> m_febOffsetColl; - const DataHandle<CondAttrListCollection> m_runOffsetColl; - std::map<unsigned int, const CaloCondBlobFlt*> m_febOffsetBlobMap; - const CaloCondBlobFlt* m_runOffsetBlob; - std::map<unsigned int, const CaloCondBlobFlt*>::const_iterator m_lastItFeb; - std::string m_keyFebOffset; - std::string m_keyRunOffset; - -}; - -#endif - diff --git a/Calorimeter/CaloClusterCorrection/src/CaloFillRectangularCluster.cxx b/Calorimeter/CaloClusterCorrection/src/CaloFillRectangularCluster.cxx index 513050814346789d22c79784e309567e8d3681fb..28a01ccf53fbd8f7ff590bc4a86309621fbb69c9 100755 --- a/Calorimeter/CaloClusterCorrection/src/CaloFillRectangularCluster.cxx +++ b/Calorimeter/CaloClusterCorrection/src/CaloFillRectangularCluster.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: CaloFillRectangularCluster.cxx,v 1.20 2009-04-25 17:57:01 ssnyder Exp $ @@ -62,7 +62,8 @@ namespace CaloClusterCorr { * direction, and finding the centers of those cells. Then we use * the larger of these for the symmetric range. */ -void etaphi_range (double eta, +void etaphi_range (const CaloDetDescrManager& dd_man, + double eta, double phi, CaloCell_ID::CaloSample sampling, double& deta, @@ -72,15 +73,14 @@ void etaphi_range (double eta, dphi = 0; // Get the DD element for the central cell. - const CaloDetDescrManager* dd_man = CaloDetDescrManager::instance(); - const CaloDetDescrElement* elt = dd_man->get_element_raw (sampling, eta, phi); + const CaloDetDescrElement* elt = dd_man.get_element_raw (sampling, eta, phi); if (!elt) return; // Should be smaller than the eta half-width of any cell. const double eps = 0.001; // Now look in the negative eta direction. - const CaloDetDescrElement* elt_l = dd_man->get_element_raw + const CaloDetDescrElement* elt_l = dd_man.get_element_raw (sampling, eta - elt->deta() - eps, phi); @@ -89,7 +89,7 @@ void etaphi_range (double eta, deta_l = std::abs (eta - elt_l->eta_raw()) + eps; // Now look in the positive eta direction. - const CaloDetDescrElement* elt_r = dd_man->get_element_raw + const CaloDetDescrElement* elt_r = dd_man.get_element_raw (sampling, eta + elt->deta() + eps, phi); @@ -106,7 +106,7 @@ void etaphi_range (double eta, // take the largest variation. // Now look in the negative eta direction. - elt_l = dd_man->get_element_raw + elt_l = dd_man.get_element_raw (sampling, eta - elt->deta() - eps, CaloPhiRange::fix (phi - elt->dphi() - eps)); @@ -115,7 +115,7 @@ void etaphi_range (double eta, dphi_l = std::abs (CaloPhiRange::fix (phi - elt_l->phi_raw())) + eps; // Now look in the positive eta direction. - elt_r = dd_man->get_element_raw + elt_r = dd_man.get_element_raw (sampling, eta + elt->deta() + eps, CaloPhiRange::fix (phi - elt->dphi() - eps)); @@ -137,18 +137,15 @@ void etaphi_range (double eta, class Segmentation { public: - Segmentation (StoreGateSvc* detStore); - + Segmentation (const CaloDetDescrManager* dd_man); /// middle layer cell segmentation size double m_detas2; double m_dphis2; }; - -Segmentation::Segmentation (StoreGateSvc* detStore) +Segmentation::Segmentation (const CaloDetDescrManager* dd_man) { - const CaloDetDescrManager* dd_man = nullptr; - if (detStore->retrieve (dd_man, "CaloMgr").isFailure()) { + if(dd_man == nullptr){ m_detas2 = 0; m_dphis2 = 0; } @@ -822,6 +819,7 @@ StatusCode CaloFillRectangularCluster::initialize() */ void CaloFillRectangularCluster::makeCorrection1(const EventContext& ctx, + const CaloDetDescrManager& dd_man, CaloClusterCorr::SamplingHelper& helper, double eta, @@ -862,7 +860,7 @@ CaloFillRectangularCluster::makeCorrection1(const EventContext& ctx, // This only makes sense if the previous step was OK if (refine) { double detastr, dphistr; - CaloClusterCorr::etaphi_range (helper.etamax(), helper.phimax(), + CaloClusterCorr::etaphi_range (dd_man,helper.etamax(), helper.phimax(), xsample, detastr, dphistr); @@ -871,9 +869,9 @@ CaloFillRectangularCluster::makeCorrection1(const EventContext& ctx, detastr, dphistr, samplings[1]); if (helper.etam()!=-999.) { - eta1 = helper.etam(); - double eta1r = helper.etareal(); - helper.cluster()->setEta(samplings[1], eta1r); + eta1 = helper.etam(); + double eta1r = helper.etareal(); + helper.cluster()->setEta(samplings[1], eta1r); } } } @@ -952,6 +950,7 @@ CaloFillRectangularCluster::makeCorrection1(const EventContext& ctx, */ void CaloFillRectangularCluster::makeCorrection2 (const EventContext& ctx, + const CaloDetDescrManager& dd_man, CaloClusterCorr::SamplingHelper& helper) const { @@ -1041,12 +1040,12 @@ CaloFillRectangularCluster::makeCorrection2 (const EventContext& ctx, // Barrel if (aeta < 1.6) { - makeCorrection1 (ctx, helper, eta, phi, samplings_b); + makeCorrection1 (ctx, dd_man,helper, eta, phi, samplings_b); } // Endcap if (aeta > 1.3) { - makeCorrection1 (ctx, helper, eta, phi, samplings_e); + makeCorrection1 (ctx, dd_man,helper, eta, phi, samplings_e); } // Set the total cluster energy to the sum over all samplings. @@ -1075,8 +1074,14 @@ void CaloFillRectangularCluster::makeCorrection(const EventContext& ctx, CaloCluster* cluster) const { ATH_MSG_DEBUG( "Executing CaloFillRectangularCluster" << endmsg) ; + + const CaloDetDescrManager* calodetdescrmgr = nullptr; + if(detStore()->retrieve(calodetdescrmgr,"CaloMgr").isFailure()){ + ATH_MSG_ERROR ("Failed to retrieve CaloDetDescrManager : CaloMgr"); + } + - CaloClusterCorr::Segmentation seg (&*detStore()); + CaloClusterCorr::Segmentation seg (calodetdescrmgr); if (seg.m_detas2 == 0) { ATH_MSG_ERROR ("Retrieving cell segmentation"); return; @@ -1121,12 +1126,12 @@ void CaloFillRectangularCluster::makeCorrection(const EventContext& ctx, cluster, cell_list, cell_container); - makeCorrection2 (ctx, helper); + makeCorrection2 (ctx,*calodetdescrmgr, helper); } else { // We're recalculating a cluster using the existing cells. CaloClusterCorr::SamplingHelper_Cluster helper (*this, windows, cluster); - makeCorrection2 (ctx, helper); + makeCorrection2 (ctx, *calodetdescrmgr,helper); } } diff --git a/Calorimeter/CaloClusterCorrection/src/components/CaloClusterCorrection_entries.cxx b/Calorimeter/CaloClusterCorrection/src/components/CaloClusterCorrection_entries.cxx index 6d94e932c2c52aa7cc1e09608f267d6ddfb7d52e..a20f094759b0de7e59bc802e87877cf5e625defa 100644 --- a/Calorimeter/CaloClusterCorrection/src/components/CaloClusterCorrection_entries.cxx +++ b/Calorimeter/CaloClusterCorrection/src/components/CaloClusterCorrection_entries.cxx @@ -52,8 +52,6 @@ #include "../CaloRunClusterCorrections.h" #include "../CaloDummyCorrection.h" -#include "../CaloClusterTimeTool.h" - DECLARE_COMPONENT( CaloClusterLocalCalibCone ) DECLARE_COMPONENT( CaloClusterLocalCalib ) @@ -109,5 +107,3 @@ DECLARE_COMPONENT( CaloClusterRemoveBad ) DECLARE_COMPONENT( CaloRunClusterCorrections ) DECLARE_COMPONENT( CaloDummyCorrection ) -DECLARE_COMPONENT( CaloClusterTimeTool ) - diff --git a/Calorimeter/CaloInterface/CaloInterface/ICaloClusterTimeTool.h b/Calorimeter/CaloInterface/CaloInterface/ICaloClusterTimeTool.h deleted file mode 100644 index ca32e5a2a45b2e11f79e79f03d2f494aee513040..0000000000000000000000000000000000000000 --- a/Calorimeter/CaloInterface/CaloInterface/ICaloClusterTimeTool.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef ICALOCLUSTERTIMETOOL_H -#define ICALOCLUSTERTIMETOOL_H -/******************************************************************** - -NAME: ICaloClusterTimeTool.h -PACKAGE: offline/Calorimeter/CaloInterface - -AUTHORS: D. Hu -CREATED: Jan 2012 - -PURPOSE: interface of CaloClusterTimeTool - -********************************************************************/ - -#include "GaudiKernel/IAlgTool.h" -#include "xAODCaloEvent/CaloClusterFwd.h" - -class CaloCell; - -static const InterfaceID IID_ICaloClusterTimeTool("ICaloClusterTimeTool",1,0); - -class ICaloClusterTimeTool : virtual public IAlgTool -{ -public: - - static const InterfaceID& interfaceID(); - - virtual void makeClusterTimeCorrection(float pv_z,const xAOD::CaloCluster* cluster, float& time_corr, float& error, unsigned int& flag) = 0; - virtual void makeCellTimeCorrection(float pv_z,const CaloCell* cell, float& time_corr, float& error, unsigned int& flag) = 0; - -}; - -inline const InterfaceID& ICaloClusterTimeTool::interfaceID() -{ - return IID_ICaloClusterTimeTool; -} - -#endif - diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx index d97e53c389c8901441c701335663aa56bc3f9b2c..dee3d32a26867aa4aa73f4949d05572495222bac 100644 --- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx +++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------- @@ -235,10 +235,7 @@ StatusCode CaloClusterMomentsMaker::initialize() } } */ - // pointer to detector manager: - //m_calo_dd_man = CaloDetDescrManager::instance(); - //m_calo_id = m_calo_dd_man->getCaloCell_ID(); CHECK(detStore()->retrieve(m_calo_id,"CaloCell_ID")); CHECK(m_caloDepthTool.retrieve()); diff --git a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx index 0278524847d3d6cda2b48b79cff5880e50d13425..7fe70f71064eff669dcd332cec4854187c91d857 100755 --- a/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx +++ b/Calorimeter/CaloRec/src/CaloClusterMomentsMaker_DigiHSTruth.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //----------------------------------------------------------------------- // File and Version Information: @@ -240,10 +240,7 @@ StatusCode CaloClusterMomentsMaker_DigiHSTruth::initialize() } } */ - // pointer to detector manager: - //m_calo_dd_man = CaloDetDescrManager::instance(); - //m_calo_id = m_calo_dd_man->getCaloCell_ID(); ATH_CHECK(detStore()->retrieve(m_calo_id,"CaloCell_ID")); ATH_CHECK(m_caloDepthTool.retrieve()); diff --git a/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderToolBase.h b/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderToolBase.h index cd013103843932006bedd57cb0f436e7e8cf22d3..ddc4732fd41ee1a5ec06826f998f4eaa3c03c035 100644 --- a/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderToolBase.h +++ b/Calorimeter/CaloUtils/CaloUtils/CaloTowerBuilderToolBase.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CALOREC_CALOTOWERBUILDERTOOLBASE_H @@ -29,7 +29,7 @@ class CaloTowerContainer; class CaloCellContainer; class IGeoAlignTool; -class ATLAS_NOT_THREAD_SAFE CaloTowerBuilderToolBase: public AthAlgTool, +class CaloTowerBuilderToolBase: public AthAlgTool, virtual public ICaloTowerBuilderToolBase, public IIncidentListener { @@ -41,7 +41,7 @@ class ATLAS_NOT_THREAD_SAFE CaloTowerBuilderToolBase: public AthAlgTool, virtual ~CaloTowerBuilderToolBase(); /// common initialization - virtual StatusCode initialize() override; + virtual StatusCode initialize ATLAS_NOT_THREAD_SAFE () override; virtual void setTowerSeg(const CaloTowerSeg& theTowerSeg) override; diff --git a/Calorimeter/CaloUtils/src/CaloTowerBuilderToolBase.cxx b/Calorimeter/CaloUtils/src/CaloTowerBuilderToolBase.cxx index 1e7b9d7d973aa30e14fb301a12e8d3569c7e87fe..ed6967094a9ff4c450d013c0ebaa4cbbe3e83b4b 100644 --- a/Calorimeter/CaloUtils/src/CaloTowerBuilderToolBase.cxx +++ b/Calorimeter/CaloUtils/src/CaloTowerBuilderToolBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "GaudiKernel/Service.h" @@ -28,7 +28,7 @@ CaloTowerBuilderToolBase::CaloTowerBuilderToolBase(const std::string& name, CaloTowerBuilderToolBase::~CaloTowerBuilderToolBase() { } -StatusCode CaloTowerBuilderToolBase::initialize() { +StatusCode CaloTowerBuilderToolBase::initialize ATLAS_NOT_THREAD_SAFE () { if (!m_cellContainerName.key().empty()) { ATH_CHECK( m_cellContainerName.initialize() ); } diff --git a/Commission/CommissionRec/src/ComTimeRec.cxx b/Commission/CommissionRec/src/ComTimeRec.cxx index 6a1570302e6fb083e6de737da22426667e64b7da..0d24ad3a1de03763d8bf02e932d2c4d6c4e32cd1 100755 --- a/Commission/CommissionRec/src/ComTimeRec.cxx +++ b/Commission/CommissionRec/src/ComTimeRec.cxx @@ -197,6 +197,12 @@ StatusCode ComTimeRec::execute() ComTime *theComTime = new ComTime(); CHECK( evtStore()->record(theComTime, m_comTimeKey) ); } + } else if(m_mode == "CollisionMode" ) { + // Using cosmic reco during collisions. Fire on BCIDs. + // Just provide a default ComTime object. + ComTime *theComTime = new ComTime(); + CHECK( evtStore()->record(theComTime, m_comTimeKey) ); + return StatusCode::SUCCESS; } else { ATH_MSG_FATAL( "Invalid mode = " << m_mode ); return StatusCode::SUCCESS; diff --git a/Control/AthToolSupport/AsgMessaging/CMakeLists.txt b/Control/AthToolSupport/AsgMessaging/CMakeLists.txt index 166aec0ddb9117297ae7f409f5931e430e4a9bd4..6fc449312609c51b069be5c2c226db3e9ddd1a32 100644 --- a/Control/AthToolSupport/AsgMessaging/CMakeLists.txt +++ b/Control/AthToolSupport/AsgMessaging/CMakeLists.txt @@ -19,7 +19,7 @@ if( XAOD_STANDALONE ) else() set( sources Root/MsgLevel.cxx Root/AsgMessaging.cxx Root/AsgMessagingForward.cxx Root/MsgHelpers.cxx - Root/MessageCheck.cxx Root/MessageCheckLocal.cxx Root/UnitTest.cxx src/*.cxx ) + Root/MessageCheck.cxx Root/MessageCheckLocal.cxx src/*.cxx ) endif() # Component(s) in the package: diff --git a/Control/AthToolSupport/AsgMessaging/share/ut_asgmessaging_statuscode.ref b/Control/AthToolSupport/AsgMessaging/share/ut_asgmessaging_statuscode.ref new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/Control/AthenaCommon/python/AthOptionsParser.py b/Control/AthenaCommon/python/AthOptionsParser.py index 0bdbb87f4c36ddc3dbf54c76c0d064d2b666b5ad..3ba8b7c8a44b4a33fa4e62226eb32918a5630010 100644 --- a/Control/AthenaCommon/python/AthOptionsParser.py +++ b/Control/AthenaCommon/python/AthOptionsParser.py @@ -35,7 +35,7 @@ _userlongopts = [ "debugWorker", "pycintex_minvmem=", "cppyy_minvmem", "minimal", # private, undocumented - "threads=", "concurrent-events=", "eventServiceMt", + "threads=", "concurrent-events=", "mtes", "mtes-channel=", "evtMax=", #will set theApp.EvtMax just before theApp.run() in runbatch.py "skipEvents=",#will set svcMgr.EventSelector.SkipEvents just before theApp.run() in runbatch.py "filesInput=" #will set the AthenaCommonFlags.FilesInput job option and lock it @@ -100,7 +100,9 @@ Accepted command line options: --threads=n ... number of threads for AthenaMT With AthenaMP, number of threads per worker --concurrent-events ... number of concurrent events for AthenaMT - --eventServiceMt ... activate multithreaded Event Service + --mtes ... activate multithreaded event service + --mtes-channel ... the name of the yampl channel between pilot and AthenaMT + when running in the event service mode --debugWorker ... pause AthenaMP workers at bootstrap until SIGUSR1 signal received [<file1>.py [<file2>.py [...]]] ... scripts to run """ @@ -155,7 +157,8 @@ def parse(chk_tcmalloc=True): opts.nprocs = 0 # enable AthenaMP if >= 1 or == -1 opts.threads = 0 # enable AthenaMT if >= 1 opts.concurrent_events = 0 # enable AthenaMT if >= 1 - opts.event_service_mt = False# activate multithreaded Event Service + opts.mtes = False # activate multithreaded event service + opts.mtes_channel="EventService_EventRanges" # yampl channel between pilot and athenaMT opts.debug_worker = False # pause AthenaMP worker after bootstrap until SIGUSR1 received opts.cppyy_minvmem = None # artificial vmem bump around cppyy's import opts.minimal = False # private, undocumented @@ -396,8 +399,13 @@ def parse(chk_tcmalloc=True): _help_and_exit() opts.concurrent_events = arg - elif opt in ("--eventServiceMt",): - opts.event_service_mt = True + elif opt in ("--mtes-channel",): + if not arg: + arg = "EventService_EventRanges" + opts.mtes_channel = arg + + elif opt in ("--mtes",): + opts.mtes = True elif opt in ("--debugWorker",): opts.debug_worker = True diff --git a/Control/AthenaCommon/python/AtlasThreadedEsJob.py b/Control/AthenaCommon/python/AtlasThreadedEsJob.py deleted file mode 100644 index 29595920bee86e2ac67ffab768a81f8125fad289..0000000000000000000000000000000000000000 --- a/Control/AthenaCommon/python/AtlasThreadedEsJob.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - -from __future__ import print_function - -def _setupAtlasThreadedEsJob(): - from AthenaCommon.AppMgr import theApp - from AthenaCommon.AppMgr import ServiceMgr as svcMgr - from AthenaCommon import Constants - - from AthenaCommon.ConcurrencyFlags import jobproperties as jps - - if (jps.ConcurrencyFlags.NumProcs() == 0) : - theApp.MessageSvcType = "InertMessageSvc" - else: - # InertMessageSvc doesn't play nice with MP - theApp.MessageSvcType = "MessageSvc" - - svcMgr.MessageSvc.defaultLimit = 0 - msgFmt = "% F%40W%S%4W%e%s%7W%R%T %0W%M" - svcMgr.MessageSvc.Format = msgFmt - - theApp.StatusCodeCheck = False - - svcMgr.StatusCodeSvc.AbortOnError = False - - numStores = jps.ConcurrencyFlags.NumConcurrentEvents() - - from StoreGate.StoreGateConf import SG__HiveMgrSvc - svcMgr += SG__HiveMgrSvc("EventDataSvc") - svcMgr.EventDataSvc.NSlots = numStores - - - from GaudiHive.GaudiHiveConf import AlgResourcePool - arp=AlgResourcePool( OutputLevel = Constants.INFO ) - arp.TopAlg=["AthMasterSeq"] #this should enable control flow - svcMgr += arp - - from AthenaCommon.AlgScheduler import AlgScheduler - AlgScheduler.ShowDataDependencies(False) - AlgScheduler.ShowControlFlow(False) - - from AthenaCommon.AlgSequence import AlgSequence - topSequence = AlgSequence() - from SGComps.SGCompsConf import SGInputLoader - # FailIfNoProxy=False makes it a warning, not an error, if unmet data - # dependencies are not found in the store. It should probably be changed - # to True eventually. - topSequence += SGInputLoader (FailIfNoProxy = False) - AlgScheduler.setDataLoaderAlg ('SGInputLoader' ) - - from AthenaServices.AthenaServicesConf import AthenaMtesEventLoopMgr - - svcMgr += AthenaMtesEventLoopMgr() - svcMgr.AthenaMtesEventLoopMgr.WhiteboardSvc = "EventDataSvc" - svcMgr.AthenaMtesEventLoopMgr.SchedulerSvc = AlgScheduler.getScheduler().getName() - - theApp.EventLoop = "AthenaMtesEventLoopMgr" - - # enable timeline recording - from GaudiHive.GaudiHiveConf import TimelineSvc - svcMgr += TimelineSvc( RecordTimeline = True, Partial = False ) - - # - ## Setup SGCommitAuditor to sweep new DataObjects at end of Alg execute - # - - theAuditorSvc = svcMgr.AuditorSvc - theApp.AuditAlgorithms=True - from SGComps.SGCompsConf import SGCommitAuditor - theAuditorSvc += SGCommitAuditor() - - -## load basic services configuration at module import -_setupAtlasThreadedEsJob() - -## clean-up: avoid running multiple times this method -del _setupAtlasThreadedEsJob diff --git a/Control/AthenaCommon/python/AtlasThreadedJob.py b/Control/AthenaCommon/python/AtlasThreadedJob.py index 354f0244b118af9fc95c6339535d2ac8b88e08f4..476d9f2ffa8b30e87675a1842467deeb46963995 100644 --- a/Control/AthenaCommon/python/AtlasThreadedJob.py +++ b/Control/AthenaCommon/python/AtlasThreadedJob.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @file AtlasThreadedJob.py ## @brief py-module to configure the Athena AppMgr for threaded (Hive) jobs @@ -52,13 +52,24 @@ def _setupAtlasThreadedJob(): topSequence += SGInputLoader (FailIfNoProxy = False) AlgScheduler.setDataLoaderAlg ('SGInputLoader' ) - from AthenaServices.AthenaServicesConf import AthenaHiveEventLoopMgr + if theApp._opts.mtes : + # Multi-threaded Event Service + from AthenaServices.AthenaServicesConf import AthenaMtesEventLoopMgr + + svcMgr += AthenaMtesEventLoopMgr() + svcMgr.AthenaMtesEventLoopMgr.WhiteboardSvc = "EventDataSvc" + svcMgr.AthenaMtesEventLoopMgr.SchedulerSvc = AlgScheduler.getScheduler().getName() + svcMgr.AthenaMtesEventLoopMgr.EventRangeChannel = theApp._opts.mtes_channel + + theApp.EventLoop = "AthenaMtesEventLoopMgr" + else: + from AthenaServices.AthenaServicesConf import AthenaHiveEventLoopMgr - svcMgr += AthenaHiveEventLoopMgr() - svcMgr.AthenaHiveEventLoopMgr.WhiteboardSvc = "EventDataSvc" - svcMgr.AthenaHiveEventLoopMgr.SchedulerSvc = AlgScheduler.getScheduler().getName() + svcMgr += AthenaHiveEventLoopMgr() + svcMgr.AthenaHiveEventLoopMgr.WhiteboardSvc = "EventDataSvc" + svcMgr.AthenaHiveEventLoopMgr.SchedulerSvc = AlgScheduler.getScheduler().getName() - theApp.EventLoop = "AthenaHiveEventLoopMgr" + theApp.EventLoop = "AthenaHiveEventLoopMgr" # enable timeline recording from GaudiHive.GaudiHiveConf import TimelineSvc diff --git a/Control/AthenaCommon/python/Include.py b/Control/AthenaCommon/python/Include.py index 284bc6424fbf258335071a0c67d1ce80df0aecb5..2a841b5a20f9c346c510f311dde345783fb159e1 100755 --- a/Control/AthenaCommon/python/Include.py +++ b/Control/AthenaCommon/python/Include.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # File: AthenaCommon/python/Include.py # Author: Wim Lavrijsen (WLavrijsen@lbl.gov) @@ -14,7 +14,6 @@ printfunc = getattr(builtins,'print') import os, sys, re, fnmatch from AthenaCommon.Utils.unixtools import FindFile - ### data --------------------------------------------------------------------- __version__ = '1.3.0' __author__ = 'Wim Lavrijsen (WLavrijsen@lbl.gov)' @@ -36,13 +35,14 @@ fidMarker = '%2d' # do not trace any files that fnmatch these names: excludeTracePattern = [ '*/GaudiPython/*', '*/GaudiKernel/*', # Gaudi framework files - '*/InstallArea/*/AthenaCommon/*', # Athena framework files + '*/AthenaCommon/*', # Athena framework files '*/python%d.%d/*' % sys.version_info[:2], # python system - '*/InstallArea/python/*/*Conf.py', # generated conf files + '*/python/*/*Conf.py', # generated conf files '*/PyUtils/decorator.py', # very verbose '*/PyUtils/Decorators.py', # ditto '*/PyUtils/Helper*.py', # ditto '*/lib/ROOT.py', # ROOT import hook gets executed very many times + '*importlib._bootstrap*', ] # unless they are explicitly included here: @@ -226,6 +226,9 @@ class Include( object ): # code tracer --------------------------------------------------------------- def _trace_include( self, frame, event, arg ): fn = frame.f_code.co_filename + if fn.find ('importlib._bootstrap') >= 0: + return self._trace_include + if not os.path.exists( fn ): fn = FindFile( basename2( fn ), sys.path, os.R_OK ) @@ -246,7 +249,7 @@ class Include( object ): # import is done, and we're back, accept this file from this point on _filecache[ fn ] = open( fn, 'r' ).readlines() or '\n' - _linecache[ fn ] = sys.maxint, self.fid + _linecache[ fn ] = sys.maxsize, self.fid self.fid += 1 lno = frame.f_lineno diff --git a/Control/AthenaCommon/share/GenerateBootstrapTest.ref b/Control/AthenaCommon/share/GenerateBootstrapTest.ref index d0c072f0b8beaf242202e412b8a489eb25ffa370..e2e89752d4db2d59dfcb0d3a78d289a4d57711d2 100644 --- a/Control/AthenaCommon/share/GenerateBootstrapTest.ref +++ b/Control/AthenaCommon/share/GenerateBootstrapTest.ref @@ -1,12 +1,20 @@ Willing to acquire file bootstrap.pkl from -/afs/cern.ch/work/s/smh/idconfig/bld/x86_64-centos7-gcc8-opt/share/bootstrap.pkl -File bootstrap.pkl exists in the current directory -Remove and copy bootstrap.pkl +/afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/share/bootstrap.pkl +copy bootstrap.pkl ... Read 3 items from python pickle file: bootstrap.pkl ... Read 3 items from python pickle file: bootstrap_test.pkl +Step 1: reference file #components: 26 +Step 2: file to check #components: 26 +Step 1: reference file #components: 5 +Step 2: file to check #components: 5 +Given list of size 0. Not looking for differences. Willing to acquire file bootstrap_threaded.pkl from -/afs/cern.ch/work/s/smh/idconfig/bld/x86_64-centos7-gcc8-opt/share/bootstrap_threaded.pkl -File bootstrap_threaded.pkl exists in the current directory -Remove and copy bootstrap_threaded.pkl +/afs/cern.ch/user/s/ssnyder/atlas-work3/build-x86_64-centos7-gcc8-opt/x86_64-centos7-gcc8-opt/share/bootstrap_threaded.pkl +copy bootstrap_threaded.pkl ... Read 3 items from python pickle file: bootstrap_threaded.pkl ... Read 3 items from python pickle file: bootstrap_threaded_test.pkl +Step 1: reference file #components: 32 +Step 2: file to check #components: 32 +Step 1: reference file #components: 5 +Step 2: file to check #components: 5 +Given list of size 0. Not looking for differences. diff --git a/Control/AthenaCommon/share/Preparation.py b/Control/AthenaCommon/share/Preparation.py index 08c72587d252a6a20a4efe8fffae566b0335f2ce..5787138fd8ccd20dfe49053b207ca92da50afd91 100644 --- a/Control/AthenaCommon/share/Preparation.py +++ b/Control/AthenaCommon/share/Preparation.py @@ -220,11 +220,4 @@ if ( (opts.threads and (opts.threads != 0)) or (opts.concurrent_events and (opts _msg.error ("ConcurrencyFlags.NumProcs() cannot == -1 !!") sys.exit() - if (opts.event_service_mt == True) : - import AthenaCommon.AtlasThreadedEsJob - else: - import AthenaCommon.AtlasThreadedJob - - - - + import AthenaCommon.AtlasThreadedJob diff --git a/Control/AthenaConfiguration/python/AtlasSemantics.py b/Control/AthenaConfiguration/python/AtlasSemantics.py index b52360b43c85049622dd45f1dd7ee4ed15f6a3cf..0c528ce823fa4d40a644d5de0a48c0d0df742f14 100644 --- a/Control/AthenaConfiguration/python/AtlasSemantics.py +++ b/Control/AthenaConfiguration/python/AtlasSemantics.py @@ -3,6 +3,7 @@ import GaudiConfig2.semantics import re import collections +import copy class AppendListSemantics(GaudiConfig2.semantics.SequenceSemantics): ''' @@ -56,7 +57,31 @@ class ToolHandleSemantics(GaudiConfig2.semantics.PropertySemantics): def merge(self,a,b): return a.merge(b) + +class PublicHandleSemantics(GaudiConfig2.semantics.PropertySemantics): + ''' + ServiceHandles (and the deprecated PublicToolHandles) are assigned as strings + ''' + __handled_types__ = ("PublicToolHandle","ServiceHandle") + + def __init__(self,cpp_type,name=None): + super(PublicHandleSemantics, self).__init__(cpp_type,name) + def default(self,value): + return value.typeAndName + + def store(self,value): + if value.__component_type__ not in ('Service','AlgTool'): + raise TypeError('{} expected, got {!r} in assignemnt to {}'.\ + format(value.__component_type__,value, self.name)) + + #It would be great if at this point we could verify that the service was + #ineed added to the ComponentAccumulator. Latest, do that when bootstapping + #the application + + return "{}/{}".format(value.__cpp_type__,value.name) + + class ToolHandleArraySemantics(GaudiConfig2.semantics.PropertySemantics): ''' Private alg-tools need recusive merging (de-duplication): @@ -66,8 +91,7 @@ class ToolHandleArraySemantics(GaudiConfig2.semantics.PropertySemantics): super(ToolHandleArraySemantics, self).__init__(cpp_type,name) def default(self,value): - from GaudiKernel.GaudiHandles import PrivateToolHandleArray - return PrivateToolHandleArray() + return copy.copy(value) def merge(self,a,b): for bTool in b: @@ -94,9 +118,17 @@ class SubAlgoSemantics(GaudiConfig2.semantics.PropertySemantics): format(value, self.name)) return value + + #Without explicitly definig a default, calling .append or += will change the class-default, + #affecting all instances of the same class. + def default(self,value): + return [] + + GaudiConfig2.semantics.SEMANTICS.append(SetSemantics) GaudiConfig2.semantics.SEMANTICS.append(AppendListSemantics) GaudiConfig2.semantics.SEMANTICS.append(VarHandleSematics) GaudiConfig2.semantics.SEMANTICS.append(ToolHandleSemantics) GaudiConfig2.semantics.SEMANTICS.append(ToolHandleArraySemantics) +GaudiConfig2.semantics.SEMANTICS.append(PublicHandleSemantics) GaudiConfig2.semantics.SEMANTICS.append(SubAlgoSemantics) diff --git a/Control/AthenaConfiguration/share/confTool.py b/Control/AthenaConfiguration/share/confTool.py index e061d0ae333b7afdac10f29d494c469de4f29243..46138963d27b30ea93ab1d98bfb0aa3d6efac4f1 100755 --- a/Control/AthenaConfiguration/share/confTool.py +++ b/Control/AthenaConfiguration/share/confTool.py @@ -3,8 +3,8 @@ # # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration # - from __future__ import print_function + import pickle import pprint import json @@ -12,146 +12,284 @@ import sys import argparse import ast -parser = argparse.ArgumentParser(description='Utility to transform/display athena configurations') -parser.add_argument('--print', dest="pr", action='store_true', help='Prints') -parser.add_argument('--printComps', dest="prComps", action='store_true', help='Prints only the components') -parser.add_argument('--diff', dest="diff", action='store_true', help='Diffs two files') -parser.add_argument('--toJSON', help='Convert to JSON file') -parser.add_argument('file', nargs='+', help='Files to work with') -args = parser.parse_args() +def main(): + parser = argparse.ArgumentParser( + description="Utility to transform/display athena configurations" + ) + parser.add_argument("-p", "--printConf", action="store_true", help="Prints") + parser.add_argument( + "--printComps", action="store_true", help="Prints only the components" + ) + parser.add_argument( + "--diff", dest="diff", action="store_true", help="Diffs two files" + ) + parser.add_argument("--toJSON", help="Convert to JSON file") + parser.add_argument("--toPickle", help="Convert to pickle file") + + parser.add_argument("file", nargs="+", help="Files to work with") + parser.add_argument( + "--comps", + nargs="*", + help="Report only component containing this string", + action="append", + ) + parser.add_argument( + "--ignoreMissing", + help="Don't report components existing in only of the two configuartions", + action="store_true", + ) + parser.add_argument( + "--allComponentPrint", + help="Print all component if there are differences in any of its properties", + action="store_true", + ) + parser.add_argument( + "--printIdenticalComponents", + help="Print all components even, if there are no differences.", + action="store_true", + ) + parser.add_argument( + "--printIdenticalPerParameter", + help="Print all parameters in component with difference even, if there are no differences.", + action="store_true", + ) + parser.add_argument( + "--ignoreIrrelevant", + help="Ignore differences in e.g. outputlevel", + action="store_true", + ) + + args = parser.parse_args() + + if args.printComps: + for fileName in args.file: + conf = __loadSingleFile(fileName, args) + __printComps(conf) + + if args.printConf: + for fileName in args.file: + conf = __loadSingleFile(fileName, args) + __print(conf) + + if args.toJSON: + if len(args.file) != 1: + sys.exit("ERROR, can convert single file at a time, got: %s" % args.file) + conf = __loadSingleFile(args.file[0], args) + with open(args.toJSON, "w") as oFile: + json.dump(conf, oFile, indent=2, ensure_ascii=True) + + if args.toPickle: + if len(args.file) != 1: + sys.exit("ERROR, can convert single file at a time, got: %s" % args.file) + conf = __loadSingleFile(args.file[0], args) + with open(args.toPickle, "wb") as oFile: + for item in conf: + pickle.dump(item, oFile) + + if args.diff: + if len(args.file) != 2: + sys.exit("ERROR, can diff exactly two files at a time, got: %s" % args.file) + configRef = __loadSingleFile(args.file[0], args) + configChk = __loadSingleFile(args.file[1], args) + for ref, chk in zip(configRef, configChk): + if isinstance(ref, dict) and isinstance(chk, dict): + __compareConfig(ref, chk, args) + else: + print("Given list of size %d. Not looking for differences." % len(ref)) -def __loadSingleFile( fname ): +def __loadSingleFile(fname, args): conf = [] - if fname.endswith( ".pkl" ): - input_file = open( fname, 'rb' ) - conf = [] - while True: - try: - conf.append( pickle.load( input_file ) ) - except EOFError: - break - print ("... Read", len(conf), "items from python pickle file: ", fname) + if fname.endswith(".pkl"): + with open(fname, "rb") as input_file: + while True: + try: + conf.append(pickle.load(input_file)) + except EOFError: + break + print("... Read", len(conf), "items from python pickle file: ", fname) - if fname.endswith( ".json" ): + elif fname.endswith(".json"): def __keepPlainStrings(element): - if isinstance(element, unicode): + if isinstance(element, str): return str(element) if isinstance(element, list): - return [ __keepPlainStrings(x) for x in element ] + return [__keepPlainStrings(x) for x in element] if isinstance(element, dict): - return dict( [ (__keepPlainStrings(key), __keepPlainStrings(value)) for key,value in element.iteritems() ] ) + return { + __keepPlainStrings(key): __keepPlainStrings(value) + for key, value in element.items() + } return element - conf = json.load( file( args.file[0] ), object_hook=__keepPlainStrings ) - print ("... Read", len(conf), "items from JSON file: ", fname) + with open(fname, "r") as input_file: + conf = json.load(input_file, object_hook=__keepPlainStrings) + print("... Read", len(conf), "items from JSON file: ", fname) + + else: + sys.exit("File format not supported.") + + if conf is None: + sys.exit("Unable to load %s file" % fname) + + if args.comps: # returning only wanted components + + def is_component_from_list(component): + return True in [s in component for s in compsToReport] + + compsToReport = [ + item for elem in args.comps for item in elem + ] # creates flat list of wanted components + conf = [ + {key: value for (key, value) in dic.items() if is_component_from_list(key)} + for dic in conf + if isinstance(dic, dict) + ] return conf -def __print( fname ): - conf = __loadSingleFile( fname ) - print ("... ", fname, "content") - for n,c in enumerate(conf): - print ("Item", n, "*"*80) - try: - pprint.pprint(dict(c)) - except: - print("This item is not a dictionary" ) - print( c ) - print ("... EOF", fname) - -def __printComps( fname ): - conf = __loadSingleFile( fname ) - print ("... ", fname, "content") - def __printdict( d ): - for name, k in dict( d ).iteritems(): - if name in "Histograms": + +def __print(conf): + for item in conf: + pprint.pprint(dict(item)) + + +def __printComps(conf): + + def __printDict(d): + for key, value in dict(d).items(): + if key in "Histograms": continue - if isinstance( k, dict ): - __printdict( k ) - elif isinstance(k, str) and '/' in k: - if not '[' in k: # not an array - if k.count('/') == 1: - print (k) - else: # handle arrays - actualType = ast.literal_eval(k) - if isinstance( actualType, list ): + if isinstance(value, dict): + __printDict(value) + elif isinstance(value, str) and "/" in value: + if "[" not in value: # not an array + if value.count("/") == 1: + print(value) + else: # handle arrays + actualType = ast.literal_eval(value) + if isinstance(actualType, list): for el in actualType: - if el.count('/') == 1 : # ==1 eliminates COOL folders - print (el) + if el.count("/") == 1: # ==1 eliminates COOL folders + print(el) + for item in conf: + __printDict(item) - for n,c in enumerate(conf): - __printdict( c ) - +def __compareConfig(configRef, configChk, args): + # Find superset of all components: + allComps = set(list(configRef.keys()) + list(configChk.keys())) + print("Step 1: reference file #components:", len(configRef)) + print("Step 2: file to check #components:", len(configChk)) - print ("... EOF", fname) + for component in allComps: + if component not in configRef and not args.ignoreMissing: + print( + "\n\033[91m Component ", + component, + " \033[94m exists only in Chk \033[0m \033[0m \n", + ) + continue -def __diff(): - def __merge( c ): - confdict = {} - def __updateIfDict( data ): - emptyDict = {} - try: - confdict.update(data) - except: - pass - - [ __updateIfDict( el ) for el in c if el ] - return confdict - - confs = [ __merge( __loadSingleFile( f )) for f in args.file ] - - allkeys = set( list(confs[0].keys()) + list(confs[1].keys())) - - for comp in allkeys: - if comp not in confs[0]: - print ("... component %-54s" % comp, "absent in", args.file[0]) - elif comp not in confs[1]: - print ("... component %-54s" % comp, "absent in", args.file[1]) - elif confs[0][comp] != confs[1][comp]: - same = False - if comp == "JobOptionsSvc": - same = True - for conf in confs[0][comp]: - if conf == "SEARCHPATH":#SEARCHPATH depends on nightly, ignore it - continue - if confs[0][comp][conf] != confs[1][comp][conf]: - break - if not same: - print ("... component %-54s" % comp, "present in both files but with different settings") - print ("... in file: ", args.file[0]) - pprint.pprint( confs[0][comp]) - print ("... in file: ", args.file[1]) - pprint.pprint( confs[1][comp]) + if component not in configChk and not args.ignoreMissing: + print( + "\n\033[91m Component", + component, + " \033[92m exists only in Ref \033[0m \033[0m \n", + ) + continue + refValue = configRef[component] + chkValue = configChk[component] + + if chkValue == refValue: + if args.printIdenticalComponents: + print("Component", component, "identical") else: - print ("... component %-54s" % comp, "identical") + print("\033[91m Component", component, "differ \033[0m") + if not args.allComponentPrint: + __compareComponent(refValue, chkValue, "\t", args) + else: + print( + "\t\033[92mRef\033[0m\t", + sorted(configRef[component].items(), key=lambda kv: kv[0]), + ) + print( + "\t\033[94mChk\033[0m\t", + sorted(configChk[component].items(), key=lambda kv: kv[0]), + ) + +def __compareComponent(compRef, compChk, prefix, args): -if args.prComps: - for fileName in args.file: - __printComps( fileName ) + if isinstance(compRef, dict): -if args.pr: - for fileName in args.file: - __print( fileName ) + allProps = set(list(compRef.keys()) + list(compChk.keys())) + + ignoreList = ["StoreGateSvc", "OutputLevel", "MuonEDMHelperSvc"] + for prop in allProps: + if prop not in compRef.keys(): + print( + "%s%s: \033[94m exists only in Chk \033[0m \033[91m<< !!!\033[0m" + % (prefix, prop) + ) + continue + + if prop not in compChk.keys(): + print( + "%s%s: \033[92m exists only in Ref \033[0m \033[91m<< !!!\033[0m" + % (prefix, prop) + ) + continue + refVal = compRef[prop] + chkVal = compChk[prop] -if args.toJSON: - if len( args.file ) != 1: - print ("ERROR, can convert single file at a time, got: ", args.file) - sys.exit( -1 ) - conf = __loadSingleFile( args.file[0] ) - oFile = open( args.toJSON, "w" ) - json.dump( conf, oFile, indent=2, ensure_ascii=True ) - oFile.close() + if args.ignoreIrrelevant and chkVal in ignoreList: + continue + + if chkVal == refVal: + if not args.printIdenticalPerParameter: + continue + diffmarker = "" + else: + diffmarker = " \033[91m<< !!!\033[0m" + + print( + "%s%s : \033[92m %s \033[0m vs \033[94m %s \033[0m %s" + % (prefix, prop, str(refVal), str(chkVal), diffmarker) + ) + + try: + refVal = ast.literal_eval(str(refVal)) + chkVal = ast.literal_eval(str(chkVal)) + except ValueError: + pass # literal_eval exception when parsing particular strings + + if refVal and (isinstance(refVal, list) or isinstance(refVal, dict)): + __compareComponent(refVal, chkVal, "\t" + prefix + ">> ", args) + + elif isinstance(compRef, list) and len(compRef) > 1: + if len(compRef) != len(compChk): + diff = list(set(compRef) - set(compChk)) + inRef = all(elem in compRef for elem in compChk) + missingIn = "Ref" if inRef else "Chk" + color = "\033[92m" if inRef else "\033[94m" + print( + "%s exists only in %s : %s %s \033[0m \033[91m<< !!!\033[0m" + % (prefix, missingIn, color, str(diff)) + ) + else: + for refVal, chkVal in zip(compRef, compChk): + if refVal != chkVal: + print( + "%s : \033[92m %s \033[0m vs \033[94m %s \033[0m \033[91m<< !!!\033[0m" + % (prefix, str(refVal), str(chkVal)) + ) + __compareComponent(refVal, chkVal, "\t" + prefix + ">> ", args) -if args.diff: - if len( args.file ) != 2: - print ("ERROR, can only diff two files at a time, got: ", args.file) - sys.exit( -1 ) - __diff() +if __name__ == "__main__": + main() diff --git a/Control/AthenaKernel/AthenaKernel/MetaCont.h b/Control/AthenaKernel/AthenaKernel/MetaCont.h index eea7f589e48309b446bc516729e38cc3d64e8652..ff6fea20ef1e298d28bfbacb356090e7bb7af822 100644 --- a/Control/AthenaKernel/AthenaKernel/MetaCont.h +++ b/Control/AthenaKernel/AthenaKernel/MetaCont.h @@ -63,6 +63,7 @@ class MetaCont: public MetaContBase { // Non-virtual functions bool insert(const SourceID& sid, T* t); bool find(const SourceID& sid, T*& t) const; + const T* get(const SourceID& sid) const; private: @@ -141,6 +142,21 @@ bool MetaCont<T>::find(const SourceID& sid, T*& t) const { } +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +template <typename T> +const T* MetaCont<T>::get(const SourceID& sid) const { + std::lock_guard<std::mutex> lock(m_mut); + + typename MetaContSet::const_iterator itr = m_metaSet.find(sid); + if (itr != m_metaSet.end()) { + return itr->second; + } + + return nullptr; +} + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ template <typename T> diff --git a/Control/AthenaMonitoring/CMakeLists.txt b/Control/AthenaMonitoring/CMakeLists.txt index 7fe85456d7027ee6702c712bd53e8dbe97b8d4c7..86ac78b87c1e2e3d90ebbfef83b79ccf15c24853 100644 --- a/Control/AthenaMonitoring/CMakeLists.txt +++ b/Control/AthenaMonitoring/CMakeLists.txt @@ -27,6 +27,7 @@ atlas_depends_on_subdirs( # External dependencies: find_package( CORAL COMPONENTS CoralBase CoralKernel RelationalAccess ) +find_package( ROOT COMPONENTS Core Hist ) find_package( Boost ) # Component(s) in the package: diff --git a/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py b/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py index ffa4588bde24358937eda4f5ef451a29cd5aaa34..16022c705375e84e9e18aa492fb61db34ab6a879 100644 --- a/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py +++ b/Control/AthenaMonitoring/python/ExampleMonitorAlgorithm.py @@ -85,6 +85,9 @@ def ExampleMonitoringConfig(inputFlags): xbins=[0,.1,.2,.4,.8,1.6]) myGroup.defineHistogram('random,pT', type='TH2F', title='title;x;y',path='ToBringThemAll', xbins=[0,.1,.2,.4,.8,1.6],ybins=[0,10,30,40,60,70,90]) + # specify a merge method + myGroup.defineHistogram('lumiPerBCID;lumiPerBCID_merge',title='Luminosity,WithCommaInTitle;L/BCID;Events', + path='ToRuleThemAll',xbins=40,xmin=0.0,xmax=80.0, merge='weightedAverage') # TEfficiencies myGroup.defineHistogram('pT_passed,pT', type='TEfficiency', title='Test TEfficiency;x;Eff', path='AndInTheDarkness', xbins=100, xmin=0.0, xmax=50.0) diff --git a/Control/AthenaMonitoring/share/DataQualityInit_jobOptions.py b/Control/AthenaMonitoring/share/DataQualityInit_jobOptions.py index 814979e131ec4ab0ec97864e9a9c5711ad5afd06..2ba251977e06a4534be3d961f030533fc9c2986a 100644 --- a/Control/AthenaMonitoring/share/DataQualityInit_jobOptions.py +++ b/Control/AthenaMonitoring/share/DataQualityInit_jobOptions.py @@ -50,6 +50,6 @@ InDetFlags.doMonitoringPixel=DQMonFlags.doPixelMon() InDetFlags.doMonitoringSCT=DQMonFlags.doSCTMon() InDetFlags.doMonitoringTRT=DQMonFlags.doTRTMon() InDetFlags.doMonitoringGlobal=DQMonFlags.doInDetGlobalMon() -InDetFlags.doMonitoringPrimaryVertexingEnhanced=DQMonFlags.doInDetGlobalMon() +#InDetFlags.doMonitoringPrimaryVertexingEnhanced=DQMonFlags.doInDetGlobalMon() InDetFlags.doMonitoringAlignment=DQMonFlags.doInDetAlignMon() diff --git a/Control/AthenaMonitoring/share/hist_diff.sh b/Control/AthenaMonitoring/share/hist_diff.sh index 6c572af8c06003ee08c75e684fd87f32e6591bc9..251d57b6fce0066265c4ffcefac1c4c292e9c4f8 100755 --- a/Control/AthenaMonitoring/share/hist_diff.sh +++ b/Control/AthenaMonitoring/share/hist_diff.sh @@ -1,16 +1,22 @@ #!/bin/bash +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration FILE1=$1 FILE2=$2 shift 2 GREPOPTS="--regexp=.*" -while getopts "x:" opt; do +DUMPOPTS="" +while getopts "ix:" opt; do case ${opt} in x ) echo "Will ignore: $OPTARG" GREPOPTS="-v -E $OPTARG" ;; + i ) + echo "Doing fuzzy check" + DUMPOPTS="$DUMPOPTS --no_onfile -r name" + ;; \? ) echo "Invalid option: -$OPTARG" exit 1 @@ -24,10 +30,11 @@ if [[ ! -f $FILE2 ]] ; then { echo "$FILE2 does not exist"; exit 1; } ; fi LOG1=$(mktemp F1.XXXXXXX) LOG2=$(mktemp F2.XXXXXXX) -hist_file_dump.py $FILE1 --hash | grep ${GREPOPTS} > $LOG1 +echo "Invoking" $(which hist_file_dump.py) +hist_file_dump.py $FILE1 --hash ${DUMPOPTS} | grep ${GREPOPTS} > $LOG1 RV=$? if [ $RV != 0 ]; then { echo "Failure dumping $FILE1"; echo $RV ; cat $LOG1; rm -f $LOG1 $LOG2; exit $RV ; }; fi -hist_file_dump.py $FILE2 --hash | grep ${GREPOPTS} > $LOG2 +hist_file_dump.py $FILE2 --hash ${DUMPOPTS} | grep ${GREPOPTS} > $LOG2 RV=$? if [ $RV != 0 ]; then { echo "Failure dumping $FILE2"; rm -f $LOG1 $LOG2; exit $RV ; }; fi diff --git a/Control/AthenaMonitoring/share/hist_file_dump.py b/Control/AthenaMonitoring/share/hist_file_dump.py index 91dc0afb0576cd4b95489b79080435bd06bb99bb..e37718d361813ebf58e2a22b89468dbdcd516b52 100755 --- a/Control/AthenaMonitoring/share/hist_file_dump.py +++ b/Control/AthenaMonitoring/share/hist_file_dump.py @@ -1,10 +1,22 @@ #!/usr/bin/env python +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function import ROOT import sys, os, operator import argparse import zlib +import json + +def jsonfixup(instr): + instr = instr.Data() + j=json.loads(instr) + for badkey in ('fTsumw', 'fTsumwx', 'fTsumw2', 'fTsumwx2', 'fTsumwy', 'fTsumwy2', 'fTsumwxy'): + if badkey in j: + if isinstance(j[badkey], float): + j[badkey] = float(str(j[badkey])[:8]) + #print(type(j["fTsumwx"])) + return json.dumps(j) parser=argparse.ArgumentParser() parser.add_argument('filename', @@ -32,6 +44,7 @@ ROOT.gInterpreter.LoadText("UInt_t bufferhash(TKey* key) { key->SetBuffer(); key ROOT.gInterpreter.LoadText("void* getbuffer(TKey* key) { key->SetBuffer(); key->ReadFile(); return (void*) (key->GetBuffer()+key->GetKeylen()); }") ROOT.gInterpreter.LoadText("UInt_t bufferhash2(TKey* key) { TObject* obj = key->ReadObj(); TMessage msg(kMESS_OBJECT); msg.WriteObject(obj); UInt_t rv = TString::Hash(msg.Buffer(), msg.Length()); delete obj; return rv; }") ROOT.gInterpreter.LoadText("UInt_t bufferhash3(TKey* key) { TObject* obj = key->ReadObj(); UInt_t rv = obj->Hash(); delete obj; return rv; }") +ROOT.gInterpreter.LoadText("TString getjson(TKey* key) { TObject* obj = key->ReadObj(); auto rv = TBufferJSON::ConvertToJSON(obj); delete obj; return rv; }") ROOT.gSystem.Load('libDataQualityUtils') def dumpdir(d): @@ -47,7 +60,7 @@ def dumpdir(d): subdirs.append(k) else: if args.hash: - lhash = ROOT.bufferhash2(k) + lhash = zlib.adler32(jsonfixup(ROOT.getjson(k))) else: lhash = 0 idxname = os.path.join(thispath, k.GetName()) @@ -77,14 +90,14 @@ sortedl = sorted(accounting.items(), key=key, reverse=True) if args.hash: print('\n'.join(('%s %s: ' + ('%d uncompressed' % b if not args.no_inmem else '') - + (', %d on file ' % c if not args.no_onfile else '') + + (', %d on file ' % c if not args.no_onfile else ' ') + '(hash %s)') % (types[a], a, hashes[a]) for a, (b, c) in sortedl) ) else: print('\n'.join(('%s %s: ' + ('%d uncompressed' % b if not args.no_inmem else '') - + (', %d on file' % c if not args.no_onfile else '')) + + (', %d on file' % c if not args.no_onfile else ' ')) % (types[a], a) for a, (b, c) in sortedl) ) diff --git a/Control/AthenaMonitoring/test/test_run3dq_r21_aod.sh b/Control/AthenaMonitoring/test/test_run3dq_r21_aod.sh index 1d194fa69c213c8cc3e0388742ffaf0071932c9b..034f779766799169dd805b34029641acceedb9c9 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r21_aod.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r21_aod.sh @@ -11,5 +11,5 @@ echo "art-result: $? HIST_Creation" ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute -i echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoring/test/test_run3dq_r21_aod_mt_t8.sh b/Control/AthenaMonitoring/test/test_run3dq_r21_aod_mt_t8.sh index c5c5906d505469445d15688e5d92833e1c69f805..852ca01f3b3945319de2718ac6821f146cdf9311 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r21_aod_mt_t8.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r21_aod_mt_t8.sh @@ -12,9 +12,9 @@ echo "art-result: $? HIST_Creation" ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute -i echo "art-result: $? HIST_Diff" art.py download AthenaMonitoring test_run3dq_r21_aod.sh -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute -i echo "art-result: $? HIST_Diff_Serial" diff --git a/Control/AthenaMonitoring/test/test_run3dq_r21_esd.sh b/Control/AthenaMonitoring/test/test_run3dq_r21_esd.sh index a019e5a9ee39ebcff619f98914e908b9ba700857..0e55c590f87f2cda43cd9ac622b6fef04e1cb70f 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r21_esd.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r21_esd.sh @@ -11,5 +11,5 @@ echo "art-result: $? HIST_Creation" ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute -i echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mc.sh b/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mc.sh index bdeb68408b85c9e822cc598a78e3f441db4205d7..ff1c39c4cc080e9bdbd0f202235d9ae553f8f418 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mc.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mc.sh @@ -11,5 +11,5 @@ echo "art-result: $? HIST_Creation" ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute -i echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mt.sh b/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mt.sh index 51f8e6b530d77b9a17211e1bc45927dc52a46868..e20539308cba6a8ba65e05c2b70901bbc122f00e 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mt.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r21_esd_mt.sh @@ -11,11 +11,11 @@ echo "art-result: $? HIST_Creation" ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute -i echo "art-result: $? HIST_Diff" rm -rf ref-* art.py download AthenaMonitoring test_run3dq_r21_esd.sh -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute -i echo "art-result: $? HIST_Diff_Serial" diff --git a/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger.sh b/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger.sh index 8547a0a61f64f74cf05da155dd8602c70f5a57a8..77d5e6301741eb6f514d728e2bdfea356ece54f5 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger.sh @@ -14,5 +14,5 @@ rm -rf ref-* ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -i echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger_mt.sh b/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger_mt.sh index f620be9e49a3c7af76045ec5c4f463a8e8c259d7..11920651e9d1c3760caad71dbcf69582004787a5 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger_mt.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r22_aod_trigger_mt.sh @@ -14,9 +14,9 @@ rm -rf ref-* ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -i echo "art-result: $? HIST_Diff" art.py download AthenaMonitoring test_run3dq_r22_aod_trigger.sh -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -i echo "art-result: $? HIST_Diff_Serial" diff --git a/Control/AthenaMonitoring/test/test_run3dq_r22_esd.sh b/Control/AthenaMonitoring/test/test_run3dq_r22_esd.sh index a458e861085b0688cf161fede472a3d9b1b9f56f..72e0c8f62d964ebcfeb14da7096603265fe320e0 100755 --- a/Control/AthenaMonitoring/test/test_run3dq_r22_esd.sh +++ b/Control/AthenaMonitoring/test/test_run3dq_r22_esd.sh @@ -14,5 +14,5 @@ rm -rf ref-* ArtPackage=$1 ArtJobName=$2 art.py download ${ArtPackage} ${ArtJobName} -hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute +hist_diff.sh ExampleMonitorOutput.root ./ref-*/ExampleMonitorOutput.root -x TIME_execute -i echo "art-result: $? HIST_Diff" diff --git a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramDef.h b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramDef.h index d391dcc26829985843782a75c3433d0abc2a72c1..d3e457bc5087f50aaec3de39e2d8f4a608a10b6f 100644 --- a/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramDef.h +++ b/Control/AthenaMonitoringKernel/AthenaMonitoringKernel/HistogramDef.h @@ -44,6 +44,8 @@ namespace Monitored { float zmax; //!< z axis maximum std::vector<std::string> zlabels; //!< labels for z axis + std::string merge; + std::string treeDef; bool ok{false}; //!< good declaration diff --git a/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py b/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py index 60e7581fbf38cab4f4e495d0597353382691e96f..51087c2d7063a9803afc3eced256f0a2c8e0ec46 100644 --- a/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py +++ b/Control/AthenaMonitoringKernel/python/GenericMonitoringTool.py @@ -119,6 +119,8 @@ class GenericMonitoringArray: # @param xlabels List of x bin labels. # @param ylabels List of y bin labels. # @param zlabels List of x bin labels. +# @param merge Merge method to use for object, if not default. Possible algorithms for offline DQM +# are given in https://twiki.cern.ch/twiki/bin/view/Atlas/DQMergeAlgs def defineHistogram(varname, type='TH1F', path=None, title=None, weight=None, alias=None, @@ -126,11 +128,11 @@ def defineHistogram(varname, type='TH1F', path=None, ybins=None, ymin=None, ymax=None, ylabels=None, zmin=None, zmax=None, zlabels=None, opt='', treedef=None, labels=None, convention=None, - cutmask=None): + cutmask=None, merge=None): # All of these fields default to an empty string stringSettingsKeys = ['xvar', 'yvar', 'zvar', 'type', 'path', 'title', 'weight', - 'cutMask', 'opt', 'convention', 'alias', 'treeDef'] + 'cutMask', 'opt', 'convention', 'alias', 'treeDef', 'merge'] # All of these fileds default to 0 numberSettingsKeys = ['xbins', 'xmin', 'xmax', 'ybins', 'ymin', 'ymax', 'zbins', 'zmin', 'zmax'] @@ -264,6 +266,11 @@ def defineHistogram(varname, type='TH1F', path=None, assert isinstance(zlabels, (list, tuple)),'zlabels must be list or tuple' settings['zlabels'] = zlabels + # merge method + if merge is not None: + assert type not in ['TEfficiency', 'TTree', 'TGraph'],'only default merge defined for non-histogram objects' + settings['merge'] = merge + # Tree branches if treedef is not None: assert type=='TTree','cannot define tree branches for a non-TTree object' diff --git a/Control/AthenaMonitoringKernel/share/GenericMon.txt b/Control/AthenaMonitoringKernel/share/GenericMon.txt index 767e42e4c310b9f6644cc111f960507036b7785d..2d7ffae79152aa088fa0c525d2a2cbde57c90b63 100644 --- a/Control/AthenaMonitoringKernel/share/GenericMon.txt +++ b/Control/AthenaMonitoringKernel/share/GenericMon.txt @@ -15,15 +15,15 @@ THistSvc.OutputLevel = 0; THistSvc.Output= {"EXPERT DATAFILE='expert-monitoring.root' OPT='RECREATE'" }; ToolSvc.MonTool.OutputLevel = 0; ToolSvc.MonTool.HistPath="TestGroup"; -ToolSvc.MonTool.Histograms = {'{"alias": "Eta", "allvars": ["Eta"], "convention": "", "opt": "", "path": "EXPERT", "title": "#eta of Clusters; #eta; number of RoIs", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": [], "xmax": 2.50, "xmin": -2.50, "xvar": "Eta", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "Eta_CutMask", "allvars": ["Eta"], "convention": "", "opt": "", "path": "EXPERT", "title": "#eta of Clusters, with cut; #eta; number of RoIs", "type": "TH1F", "weight": "", "cutMask": "CutMask", "xarray": [], "xbins": 2, "xlabels": [], "xmax": 2.50, "xmin": -2.50, "xvar": "Eta", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "Phi", "allvars": ["Phi"], "convention": "", "opt": "", "path": "EXPERT", "title": "#phi of Clusters; #phi; number of RoIs", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": [], "xmax": 3.15, "xmin": -3.15, "xvar": "Phi", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "Phi_vs_Eta", "allvars": ["Eta", "Phi"], "convention": "", "opt": "", "path": "EXPERT", "title": "#phi vs #eta of Clusters; #eta; #phi; number of RoIs", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": [], "xmax": 2.5, "xmin": -2.5, "xvar": "Eta", "yarray": [], "ybins": 2, "ylabels": [], "ymax": 3.15, "ymin": -3.15, "yvar": "Phi", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "Phi_vs_Eta_Tree", "allvars": ["Eta", "Phi"], "convention": "", "opt": "", "path": "EXPERT", "title": "Test Tree", "type": "TTree", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": [], "xmax": 2.5, "xmin": -2.5, "xvar": "Eta", "yarray": [], "ybins": 2, "ylabels": [], "ymax": 3.15, "ymin": -3.15, "yvar": "Phi", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "Eta/F:Phi/vector<float>"}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "TIME_t1", "allvars": ["TIME_t1"], "convention": "", "opt": "", "path": "EXPERT", "title": "Timing of tool 1", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 200, "xlabels": [], "xmax": 20000.0, "xmin": 0.0, "xvar": "TIME_t1", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "TIME_t2", "allvars": ["TIME_t2"], "convention": "", "opt": "", "path": "EXPERT", "title": "Timing of tool 2", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 100.0, "xmin": 0.0, "xvar": "TIME_t2", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "TIME_t3", "allvars": ["TIME_t3"], "convention": "", "opt": "", "path": "EXPERT", "title": "Timing of tool 3", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 100.0, "xmin": 0.0, "xvar": "TIME_t3", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "DetID", "allvars": ["DetID"], "convention": "", "opt": "", "path": "EXPERT", "title": "Test of text filling", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "DetID", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "DetID_vs_DetCalo", "allvars": ["DetCalo", "DetID"], "convention": "", "opt": "", "path": "EXPERT", "title": "Fill 2D with strings", "type": "TH2I", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "DetCalo", "yarray": [], "ybins": 10, "ylabels": [], "ymax": 10.0, "ymin": 0.0, "yvar": "DetID", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "y_vs_DetCalo", "allvars": ["DetCalo", "y"], "convention": "", "opt": "", "path": "EXPERT", "title": "Fill 2D with string & double", "type": "TH2I", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "DetCalo", "yarray": [], "ybins": 10, "ylabels": [], "ymax": 10.0, "ymin": 0.0, "yvar": "y", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; -ToolSvc.MonTool.Histograms += {'{"alias": "DetCalo_vs_x", "allvars": ["x", "DetCalo"], "convention": "", "opt": "", "path": "EXPERT", "title": "Fill 2D with double & string", "type": "TH2I", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "x", "yarray": [], "ybins": 10, "ylabels": [], "ymax": 10.0, "ymin": 0.0, "yvar": "DetCalo", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": ""}'}; +ToolSvc.MonTool.Histograms = {'{"alias": "Eta", "allvars": ["Eta"], "convention": "", "opt": "", "path": "EXPERT", "title": "#eta of Clusters; #eta; number of RoIs", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": [], "xmax": 2.50, "xmin": -2.50, "xvar": "Eta", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "Eta_CutMask", "allvars": ["Eta"], "convention": "", "opt": "", "path": "EXPERT", "title": "#eta of Clusters, with cut; #eta; number of RoIs", "type": "TH1F", "weight": "", "cutMask": "CutMask", "xarray": [], "xbins": 2, "xlabels": [], "xmax": 2.50, "xmin": -2.50, "xvar": "Eta", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "Phi", "allvars": ["Phi"], "convention": "", "opt": "", "path": "EXPERT", "title": "#phi of Clusters; #phi; number of RoIs", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": [], "xmax": 3.15, "xmin": -3.15, "xvar": "Phi", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "Phi_vs_Eta", "allvars": ["Eta", "Phi"], "convention": "", "opt": "", "path": "EXPERT", "title": "#phi vs #eta of Clusters; #eta; #phi; number of RoIs", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": [], "xmax": 2.5, "xmin": -2.5, "xvar": "Eta", "yarray": [], "ybins": 2, "ylabels": [], "ymax": 3.15, "ymin": -3.15, "yvar": "Phi", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "Phi_vs_Eta_Tree", "allvars": ["Eta", "Phi"], "convention": "", "opt": "", "path": "EXPERT", "title": "Test Tree", "type": "TTree", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": [], "xmax": 2.5, "xmin": -2.5, "xvar": "Eta", "yarray": [], "ybins": 2, "ylabels": [], "ymax": 3.15, "ymin": -3.15, "yvar": "Phi", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "Eta/F:Phi/vector<float>", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "TIME_t1", "allvars": ["TIME_t1"], "convention": "", "opt": "", "path": "EXPERT", "title": "Timing of tool 1", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 200, "xlabels": [], "xmax": 20000.0, "xmin": 0.0, "xvar": "TIME_t1", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "TIME_t2", "allvars": ["TIME_t2"], "convention": "", "opt": "", "path": "EXPERT", "title": "Timing of tool 2", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 100.0, "xmin": 0.0, "xvar": "TIME_t2", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "TIME_t3", "allvars": ["TIME_t3"], "convention": "", "opt": "", "path": "EXPERT", "title": "Timing of tool 3", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 100.0, "xmin": 0.0, "xvar": "TIME_t3", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "DetID", "allvars": ["DetID"], "convention": "", "opt": "", "path": "EXPERT", "title": "Test of text filling", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "DetID", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "DetID_vs_DetCalo", "allvars": ["DetCalo", "DetID"], "convention": "", "opt": "", "path": "EXPERT", "title": "Fill 2D with strings", "type": "TH2I", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "DetCalo", "yarray": [], "ybins": 10, "ylabels": [], "ymax": 10.0, "ymin": 0.0, "yvar": "DetID", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "y_vs_DetCalo", "allvars": ["DetCalo", "y"], "convention": "", "opt": "", "path": "EXPERT", "title": "Fill 2D with string & double", "type": "TH2I", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "DetCalo", "yarray": [], "ybins": 10, "ylabels": [], "ymax": 10.0, "ymin": 0.0, "yvar": "y", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; +ToolSvc.MonTool.Histograms += {'{"alias": "DetCalo_vs_x", "allvars": ["x", "DetCalo"], "convention": "", "opt": "", "path": "EXPERT", "title": "Fill 2D with double & string", "type": "TH2I", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "x", "yarray": [], "ybins": 10, "ylabels": [], "ymax": 10.0, "ymin": 0.0, "yvar": "DetCalo", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": "", "treeDef": "", "merge": ""}'}; diff --git a/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx b/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx index 80a00244bc48dcc98fa81f5a58fa449952add633..c9c3a35d8f58b225002cc95f23fca3bab8b0d746 100644 --- a/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx +++ b/Control/AthenaMonitoringKernel/src/GenericMonitoringTool.cxx @@ -170,23 +170,23 @@ std::vector<std::shared_ptr<HistogramFiller>> GenericMonitoringTool::getHistogra } } - if (ATH_UNLIKELY(fillerVariables.size() != variables.size())) { - ATH_MSG_WARNING("Filler has different variables than monitoredVariables:" - << "\n Filler variables : " << fillerVariables - << "\n Asked to fill from mon. vars: " << monitoredVariables - << "\n Selected monitored variables: " << variables); + if (fillerVariables.size() != variables.size()) { + ATH_MSG_DEBUG("Filler has different variables than monitoredVariables:" + << "\n Filler variables : " << fillerVariables + << "\n Asked to fill from mon. vars: " << monitoredVariables + << "\n Selected monitored variables: " << variables); continue; } if (ATH_UNLIKELY(!fillerWeight.empty() && !weight)) { - ATH_MSG_WARNING("Filler weight not found in monitoredVariables:" - << "\n Filler weight : " << fillerWeight - << "\n Asked to fill from mon. vars: " << monitoredVariables); + ATH_MSG_DEBUG("Filler weight not found in monitoredVariables:" + << "\n Filler weight : " << fillerWeight + << "\n Asked to fill from mon. vars: " << monitoredVariables); continue; } if (ATH_UNLIKELY(!fillerCutMask.empty() && !cutmask)) { - ATH_MSG_WARNING("Filler cut mask not found in monitoredVariables:" - << "\n Filler cut mask : " << fillerCutMask - << "\n Asked to fill from mon. vars: " << monitoredVariables); + ATH_MSG_DEBUG("Filler cut mask not found in monitoredVariables:" + << "\n Filler cut mask : " << fillerCutMask + << "\n Asked to fill from mon. vars: " << monitoredVariables); continue; } HistogramFiller* fillerCopy(filler->clone()); diff --git a/Control/AthenaMonitoringKernel/src/HistogramDef.cxx b/Control/AthenaMonitoringKernel/src/HistogramDef.cxx index 0c358c1107df14f0f849d56adf034904e223c0cd..e68d252d7fc50338ead532644fd47e179834ef9f 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramDef.cxx +++ b/Control/AthenaMonitoringKernel/src/HistogramDef.cxx @@ -42,6 +42,8 @@ const HistogramDef HistogramDef::parse(const std::string& histogramDefinition) { result.zmax = setting["zmax"]; result.zlabels = setting["zlabels"].get<std::vector<std::string>>(); + result.merge = setting["merge"]; + result.treeDef = setting["treeDef"]; result.ok = true; diff --git a/Control/AthenaMonitoringKernel/src/HistogramFiller/OfflineHistogramProvider.h b/Control/AthenaMonitoringKernel/src/HistogramFiller/OfflineHistogramProvider.h index 2cca3b1f45e434ac93cfb40d4e8cb9d3d0b9fdf7..7f2ede7d97d35da9278ffa96033090e1bd5cb01a 100644 --- a/Control/AthenaMonitoringKernel/src/HistogramFiller/OfflineHistogramProvider.h +++ b/Control/AthenaMonitoringKernel/src/HistogramFiller/OfflineHistogramProvider.h @@ -124,7 +124,9 @@ namespace Monitored { std::string interval; std::string conv = m_histDef->convention; char triggerData[] = "<none>"; - char mergeData[] = "<default>"; + const std::string mergeDataStr = m_histDef->merge == "" ? "<default>" : m_histDef->merge; + std::vector<char> mergeData{mergeDataStr.begin(), mergeDataStr.end()}; + mergeData.push_back('\0'); if (conv.find("run") != std::string::npos) { interval = "run"; } else if (conv.find("lowStat") != std::string::npos) { @@ -138,7 +140,7 @@ namespace Monitored { tree->Branch("Name", &(splitPath.second[0]), "Name/C"); tree->Branch("Interval", &(interval[0]), "Interval/C"); tree->Branch("TriggerChain", triggerData, "TriggerChain/C"); - tree->Branch("MergeMethod", mergeData, "MergeMethod/C"); + tree->Branch("MergeMethod", mergeData.data(), "MergeMethod/C"); tree->Fill(); if (!histSvc->regTree(treePath, std::move(tree))) { @@ -152,7 +154,7 @@ namespace Monitored { tree->SetBranchAddress("Name", &(splitPath.second[0])); tree->SetBranchAddress("Interval", &(interval[0])); tree->SetBranchAddress("TriggerChain", triggerData); - tree->SetBranchAddress("MergeMethod", mergeData); + tree->SetBranchAddress("MergeMethod", mergeData.data()); tree->Fill(); } else { MsgStream log(Athena::getMessageSvc(), "OfflineHistogramProvider"); diff --git a/Control/AthenaMonitoringKernel/test/GenericMonFilling_test.cxx b/Control/AthenaMonitoringKernel/test/GenericMonFilling_test.cxx index 5a7f54d3ded0eed4720068ca46cbd746b9c148bc..e0e0e0d963cf70f782f6468b7276aea07c90968e 100644 --- a/Control/AthenaMonitoringKernel/test/GenericMonFilling_test.cxx +++ b/Control/AthenaMonitoringKernel/test/GenericMonFilling_test.cxx @@ -22,6 +22,7 @@ #include "THashList.h" #include "TInterpreter.h" + const TH1* getHist( ITHistSvc* histSvc, const std::string& histName ) { TH1* h( nullptr ); histSvc->getHist( histName, h ); @@ -41,16 +42,13 @@ void resetHist( ITHistSvc* histSvc, const std::string& histName ) { h->Reset(); } -void resetTree( ITHistSvc* histSvc, const std::string& histName ) { - getTree( histSvc, histName )->Reset(); -} - void resetHists( ITHistSvc* histSvc ) { - resetHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta" ); - resetHist( histSvc, "/EXPERT/TestGroup/Eta" ); - resetHist( histSvc, "/EXPERT/TestGroup/Phi" ); - resetHist( histSvc, "/EXPERT/TestGroup/Eta_CutMask"); - resetTree( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta_Tree"); + for (const std::string& name : histSvc->getHists()) { + resetHist( histSvc, name ); + } + for (const std::string& name : histSvc->getTrees()) { + getTree( histSvc, name )->Reset(); + } } double contentInBin1DHist( ITHistSvc* histSvc, const std::string& histName, int bin ) { @@ -80,30 +78,65 @@ bool noToolBehaviourCorrect( ToolHandle<GenericMonitoringTool>& monTool ) { return true; } +/** + * Launch `nthreads` each calling `func` `nfills` times. + * @return Total number of fills performed + */ +template <typename F> +size_t fill_mt(const F& func) +{ + const size_t nthreads = 10; + const size_t nfills = 1000; + + // Create threads + std::vector<std::thread> threads; + std::vector<size_t> fills(nthreads, 0); + threads.reserve(nthreads); + for (size_t i = 0; i < nthreads; ++i) { + threads.push_back(std::thread([&, i]() { + for (size_t j = 0; j < nfills; ++j) fills[i] += func(); + })); + } + // Launch and wait + for (auto& t : threads) t.join(); + + // Return total number of fills performed + return std::accumulate(fills.begin(), fills.end(), 0); +} + bool fillFromScalarWorked( ToolHandle<GenericMonitoringTool>& monTool, ITHistSvc* histSvc ) { - resetHists( histSvc ); - { + + auto fill = [&]() { auto roiPhi = Monitored::Scalar( "Phi", -99.0 ); //deduced double auto roiEta = Monitored::Scalar<double>( "Eta", -99 ); //explicit double auto monitorIt = Monitored::Group( monTool, roiPhi, roiEta ); roiPhi = 0.1; roiEta = -0.2; - } - VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Phi", 1 ) ) EXPECTED( 0 ); - VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Phi", 2 ) ) EXPECTED( 1 ); - - VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta", 1 ) ) EXPECTED( 1 ); - VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta", 2 ) ) EXPECTED( 0 ); + return 1; + }; + + auto check = [&](size_t N) { + VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Phi", 1 ) ) EXPECTED( 0 ); + VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Phi", 2 ) ) EXPECTED( N ); + + VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta", 1 ) ) EXPECTED( N ); + VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta", 2 ) ) EXPECTED( 0 ); + + auto tree = getTree( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta_Tree" ); + VALUE( tree->GetEntries() ) EXPECTED( N ); + std::vector<float> tmpvec; + Float_t tmp; + tree->GetBranch("Phi")->SetObject(&tmpvec); + tree->GetBranch("Eta")->SetAddress(&tmp); + for (int i=0; i<tree->GetEntries(); ++i) { + tree->GetEntry(i); + VALUE( tmp ) EXPECTED ( -0.2 ); + VALUE( (const float&) tmpvec.at(0) ) EXPECTED( 0.1 ); + } + }; - auto tree = getTree( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta_Tree" ); - VALUE( tree->GetEntries() ) EXPECTED( 1 ); - std::vector<float> tmpvec; - Float_t tmp; - tree->GetBranch("Phi")->SetObject(&tmpvec); - tree->GetBranch("Eta")->SetAddress(&tmp); - tree->GetEntry(0); - VALUE( tmp ) EXPECTED ( -0.2 ); - VALUE( (const float&) tmpvec.at(0) ) EXPECTED( 0.1 ); + resetHists( histSvc ); check(fill()); + resetHists( histSvc ); check(fill_mt(fill)); return true; } @@ -142,22 +175,27 @@ bool fillFromScalarIndependentScopesWorked( ToolHandle<GenericMonitoringTool>& m } bool fill2DWorked( ToolHandle<GenericMonitoringTool>& monTool, ITHistSvc* histSvc ) { - resetHists( histSvc ); auto roiPhi = Monitored::Scalar( "Phi", -99.0 ); auto roiEta = Monitored::Scalar( "Eta", -99.0 ); - { + + auto fill = [&]() { auto monitorIt = Monitored::Group( monTool, roiEta, roiPhi ); roiEta = 0.2; roiPhi = -0.1; - } - - VALUE( contentInBin2DHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta", 1, 1 ) ) EXPECTED( 0 ); - VALUE( contentInBin2DHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta", 1, 2 ) ) EXPECTED( 0 ); - VALUE( contentInBin2DHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta", 2, 1 ) ) EXPECTED( 1 ); - VALUE( contentInBin2DHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta", 2, 2 ) ) EXPECTED( 0 ); - VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta", 2 ) ) EXPECTED( 1 ); // counts also visible in 1 D - VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Phi", 1 ) ) EXPECTED( 1 ); + return 1; + }; + auto check = [&](size_t N) { + VALUE( contentInBin2DHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta", 1, 1 ) ) EXPECTED( 0 ); + VALUE( contentInBin2DHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta", 1, 2 ) ) EXPECTED( 0 ); + VALUE( contentInBin2DHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta", 2, 1 ) ) EXPECTED( N ); + VALUE( contentInBin2DHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta", 2, 2 ) ) EXPECTED( 0 ); + VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta", 2 ) ) EXPECTED( N ); // counts also visible in 1 D + VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Phi", 1 ) ) EXPECTED( N ); + }; + + resetHists( histSvc ); check(fill()); + resetHists( histSvc ); check(fill_mt(fill)); // 2 D Hist fill should not affect 1 D resetHists( histSvc ); @@ -175,7 +213,7 @@ bool fill2DWorked( ToolHandle<GenericMonitoringTool>& monTool, ITHistSvc* histSv roiEta = 0.2; roiPhi = -0.1; } - VALUE( getHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta" )->GetEntries() ) EXPECTED( 0 ); // still no entries as scope used above is not having both needed varaibles + VALUE( getHist( histSvc, "/EXPERT/TestGroup/Phi_vs_Eta" )->GetEntries() ) EXPECTED( 0 ); // still no entries as scope used above is not having both needed variables VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta", 2 ) ) EXPECTED( 1 ); // no increase of counts VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Phi", 1 ) ) EXPECTED( 1 ); @@ -221,29 +259,38 @@ bool fillExplicitlyWorked( ToolHandle<GenericMonitoringTool>& monTool, ITHistSvc } bool fillWithCutMaskWorked( ToolHandle<GenericMonitoringTool>& monTool, ITHistSvc* histSvc ) { - resetHists( histSvc ); - for (int ctr = 0; ctr < 10; ++ctr) { - auto roiEta = Monitored::Scalar<double>( "Eta", -99 ); //explicit double - auto cutMask = Monitored::Scalar<bool>( "CutMask", (ctr % 2) == 0); - auto monitorIt = Monitored::Group( monTool, roiEta, cutMask ); - roiEta = -0.2; - monitorIt.fill(); - } - - VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta_CutMask", 1 ) ) EXPECTED( 5 ); - VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta_CutMask", 2 ) ) EXPECTED( 0 ); - resetHists( histSvc ); - { + auto fill1 = [&]() { + for (int ctr = 0; ctr < 10; ++ctr) { + auto roiEta = Monitored::Scalar<double>( "Eta", -99 ); //explicit double + auto cutMask = Monitored::Scalar<bool>( "CutMask", (ctr % 2) == 0); + auto monitorIt = Monitored::Group( monTool, roiEta, cutMask ); + roiEta = -0.2; + monitorIt.fill(); + } + return 5; + }; + auto check1 = [&](size_t N) { + VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta_CutMask", 1 ) ) EXPECTED( N ); + VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta_CutMask", 2 ) ) EXPECTED( 0 ); + }; + resetHists( histSvc ); check1(fill1()); + resetHists( histSvc ); check1(fill_mt(fill1)); + + auto fill2 = [&]() { std::vector<float> etaVec{-0.2, 0.2, -0.4, 0.4, -0.6}; auto roiEta = Monitored::Collection( "Eta", etaVec ); std::vector<char> cutMaskVec = { 0, 1, 1, 1, 0 }; auto cutMask = Monitored::Collection( "CutMask", cutMaskVec ); auto monitorIt = Monitored::Group( monTool, roiEta, cutMask ); - } - - VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta_CutMask", 1 ) ) EXPECTED( 1 ); - VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta_CutMask", 2 ) ) EXPECTED( 2 ); + return 1; + }; + auto check2 = [&](size_t N) { + VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta_CutMask", 1 ) ) EXPECTED( N ); + VALUE( contentInBin1DHist( histSvc, "/EXPERT/TestGroup/Eta_CutMask", 2 ) ) EXPECTED( 2*N ); + }; + resetHists( histSvc ); check2(fill2()); + resetHists( histSvc ); check2(fill_mt(fill2)); return true; } @@ -395,75 +442,86 @@ bool timerFillingWorked( ToolHandle<GenericMonitoringTool>& monTool, ITHistSvc* bool stringFillingWorked(ToolHandle<GenericMonitoringTool>& monTool, ITHistSvc* histSvc) { - auto count = Monitored::Scalar<std::string>( "DetID", "SCT" ); - { + + auto fill = [&]() { + auto count = Monitored::Scalar<std::string>( "DetID", "SCT" ); Monitored::Group(monTool, count); Monitored::Group(monTool, count); - } - - const TH1* h = getHist( histSvc, "/EXPERT/TestGroup/DetID" ); - VALUE( h->GetEntries() ) EXPECTED( 2 ); - VALUE( h->GetXaxis()->GetLabels()->GetEntries() ) EXPECTED( 1 ); - const int sctBin = h->GetXaxis()->FindFixBin("SCT"); - VALUE( sctBin ) EXPECTED( 1 ); - VALUE( h->GetBinContent( sctBin ) ) EXPECTED( 2 ); + return 2; + }; + auto check = [&](size_t N) { + const TH1* h = getHist( histSvc, "/EXPERT/TestGroup/DetID" ); + VALUE( h->GetEntries() ) EXPECTED( N ); + VALUE( h->GetXaxis()->GetLabels()->GetEntries() ) EXPECTED( 1 ); + const int sctBin = h->GetXaxis()->FindFixBin("SCT"); + VALUE( sctBin ) EXPECTED( 1 ); + VALUE( h->GetBinContent( sctBin ) ) EXPECTED( N ); + }; + + resetHists( histSvc ); check(fill()); + resetHists( histSvc ); check(fill_mt(fill)); return true; } bool string2DFillingWorked(ToolHandle<GenericMonitoringTool>& monTool, ITHistSvc* histSvc) { - auto countID = Monitored::Scalar<std::string>( "DetID", "SCT" ); - std::vector<std::string> caloLabels( { "LAr", "LAr", "Tile" } ); - auto countCalo = Monitored::Collection<std::vector<std::string>>( "DetCalo", caloLabels ); - auto x = Monitored::Scalar("x", 1.2 ); - std::vector<double> yvalues({0.2, 2.1, 1.3}); - auto y = Monitored::Collection("y", yvalues ); - // this should fill like this - // SCT, LAr - // SCT, LAr - // SCT, Tile - { - Monitored::Group(monTool, countID, countCalo); - } - { + + auto fill = [&]() { + auto countID = Monitored::Scalar<std::string>( "DetID", "SCT" ); + std::vector<std::string> caloLabels( { "LAr", "LAr", "Tile" } ); + auto countCalo = Monitored::Collection<std::vector<std::string>>( "DetCalo", caloLabels ); + auto x = Monitored::Scalar("x", 1.2 ); + std::vector<double> yvalues({0.2, 2.1, 1.3}); + auto y = Monitored::Collection("y", yvalues ); + { + // this should fill like this + // SCT, LAr + // SCT, LAr + // SCT, Tile + Monitored::Group(monTool, countID, countCalo); + } + { + // this should fill like this + // LAr, 0.2 + // LAr, 2.1 + // Tile, 1.3 + Monitored::Group(monTool, countCalo, y); + } + { + // this should fill like this + // LAr, 1.2 + // LAr, 1.2 + // Tile, 1.2 + Monitored::Group(monTool, countCalo, x); + } + return 1; + }; + auto check = [&](size_t N) { const TH1* h = getHist( histSvc, "/EXPERT/TestGroup/DetID_vs_DetCalo" ); - const int larBin = h->GetXaxis()->FindFixBin("LAr"); - const int sctBin = h->GetYaxis()->FindFixBin("SCT"); - VALUE( h->GetBinContent( larBin, sctBin ) ) EXPECTED( 2 ); - } - // this should fill like this - // LAr, 0.2 - // LAr, 2.1 - // Tile, 1.3 - { - Monitored::Group(monTool, countCalo, y); - } - { - const TH1* h = getHist( histSvc, "/EXPERT/TestGroup/y_vs_DetCalo" ); - const int larBin = h->GetXaxis()->FindFixBin("LAr"); - const int tileBin = h->GetXaxis()->FindFixBin("Tile"); - VALUE( h->GetBinContent( larBin, 1 ) ) EXPECTED( 1 ); + int larBin = h->GetXaxis()->FindFixBin("LAr"); + int sctBin = h->GetYaxis()->FindFixBin("SCT"); + VALUE( h->GetBinContent( larBin, sctBin ) ) EXPECTED( 2*N ); + + h = getHist( histSvc, "/EXPERT/TestGroup/y_vs_DetCalo" ); + larBin = h->GetXaxis()->FindFixBin("LAr"); + int tileBin = h->GetXaxis()->FindFixBin("Tile"); + VALUE( h->GetBinContent( larBin, 1 ) ) EXPECTED( N ); VALUE( h->GetBinContent( larBin, 2 ) ) EXPECTED( 0 ); - VALUE( h->GetBinContent( larBin, 3 ) ) EXPECTED( 1 ); + VALUE( h->GetBinContent( larBin, 3 ) ) EXPECTED( N ); VALUE( h->GetBinContent( tileBin, 1 ) ) EXPECTED( 0 ); - VALUE( h->GetBinContent( tileBin, 2 ) ) EXPECTED( 1 ); - } - // this should fill like this - // LAr, 1.2 - // LAr, 1.2 - // Tile, 1.2 - { - Monitored::Group(monTool, countCalo, x); - } - { - const TH1* h = getHist( histSvc, "/EXPERT/TestGroup/DetCalo_vs_x" ); - const int larBin = h->GetYaxis()->FindFixBin("LAr"); - const int tileBin = h->GetYaxis()->FindFixBin("Tile"); + VALUE( h->GetBinContent( tileBin, 2 ) ) EXPECTED( N ); + + h = getHist( histSvc, "/EXPERT/TestGroup/DetCalo_vs_x" ); + larBin = h->GetYaxis()->FindFixBin("LAr"); + tileBin = h->GetYaxis()->FindFixBin("Tile"); VALUE( h->GetBinContent( 1, larBin) ) EXPECTED( 0 ); - VALUE( h->GetBinContent( 2, larBin) ) EXPECTED( 2 ); + VALUE( h->GetBinContent( 2, larBin) ) EXPECTED( 2*N ); VALUE( h->GetBinContent( 1, tileBin) ) EXPECTED( 0 ); - VALUE( h->GetBinContent( 2, tileBin) ) EXPECTED( 1 ); - } + VALUE( h->GetBinContent( 2, tileBin) ) EXPECTED( N ); + }; + + resetHists( histSvc ); check(fill()); + resetHists( histSvc ); check(fill_mt(fill)); return true; } diff --git a/Control/AthenaMonitoringKernel/test/GenericMonParsing_test.cxx b/Control/AthenaMonitoringKernel/test/GenericMonParsing_test.cxx index 7e4beba45de9233dc699d5c128b9c76175c41796..12b32244262cdc63d0d3988376c44888983fc652 100644 --- a/Control/AthenaMonitoringKernel/test/GenericMonParsing_test.cxx +++ b/Control/AthenaMonitoringKernel/test/GenericMonParsing_test.cxx @@ -41,6 +41,7 @@ json defaultJson() { j["zmax"] = 0.0; j["zmin"] = 0.0; j["zvar"] = ""; + j["merge"] = ""; j["treeDef"] = ""; return j; } diff --git a/Control/AthenaMonitoringKernel/test/test_defineHistogram.py b/Control/AthenaMonitoringKernel/test/test_defineHistogram.py index b4f23ea2be0e58290df7e37d1284ae86bcd178df..1f0f6bc51267bb8d5d7fc7734b9209fbe726c858 100644 --- a/Control/AthenaMonitoringKernel/test/test_defineHistogram.py +++ b/Control/AthenaMonitoringKernel/test/test_defineHistogram.py @@ -11,83 +11,88 @@ from AthenaMonitoringKernel.GenericMonitoringTool import defineHistogram, define class Test( unittest.TestCase ): def test_1D( self ): check = defineHistogram('var', 'TH1F', 'EXPERT', 'title', '', '', 10, 0.0, 10.0) - true = '{"alias": "var", "allvars": ["var"], "convention": "", "opt": "", "path": "EXPERT", "title": "title", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "opt": "", "path": "EXPERT", "title": "title", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_1D_opt( self ): check = defineHistogram('var', opt='myopt') - true = '{"alias": "var", "allvars": ["var"], "convention": "", "opt": "myopt", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "opt": "myopt", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_1D_weight( self ): check = defineHistogram('var', weight='myweight') - true = '{"alias": "var", "allvars": ["var"], "convention": "", "opt": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "myweight", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "opt": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "myweight", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_1D_cutmask( self ): check = defineHistogram('var', cutmask='mycutmask') - true = '{"alias": "var", "allvars": ["var"], "convention": "", "opt": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "mycutmask", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "opt": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "mycutmask", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_1D_array( self ): check = defineHistogram('var', xbins=[0, 1, 2, 4, 8]) - true = '{"alias": "var", "allvars": ["var"], "convention": "", "opt": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [0, 1, 2, 4, 8], "xbins": 4, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "opt": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [0, 1, 2, 4, 8], "xbins": 4, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_1D_title( self ): check = defineHistogram('var', title='mytitle') - true = '{"alias": "var", "allvars": ["var"], "convention": "", "opt": "", "path": "", "title": "mytitle", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "opt": "", "path": "", "title": "mytitle", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_1D_labelsX( self ): check = defineHistogram('var', xlabels=["bin0", "bin1"]) - true = '{"alias": "var", "allvars": ["var"], "convention": "", "opt": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": ["bin0", "bin1"], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "opt": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": ["bin0", "bin1"], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_1D_labelsY( self ): check = defineHistogram('var', ylabels=["bin0", "bin1"]) - true = '{"alias": "var", "allvars": ["var"], "convention": "", "opt": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 2, "ylabels": ["bin0", "bin1"], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "", "opt": "", "path": "", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 2, "ylabels": ["bin0", "bin1"], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_2D( self ): check = defineHistogram('varX,varY', type='TH2F', xbins=10, xmin=0.0, xmax=10.0, ybins=40, ymin=0.0, ymax=20.0) - true = '{"alias": "varY_vs_varX", "allvars": ["varX", "varY"], "convention": "", "opt": "", "path": "", "title": "varX,varY", "treeDef": "", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "varX", "yarray": [], "ybins": 40, "ylabels": [], "ymax": 20.0, "ymin": 0.0, "yvar": "varY", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "varY_vs_varX", "allvars": ["varX", "varY"], "convention": "", "merge": "", "opt": "", "path": "", "title": "varX,varY", "treeDef": "", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "varX", "yarray": [], "ybins": 40, "ylabels": [], "ymax": 20.0, "ymin": 0.0, "yvar": "varY", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_2D_space( self ): check = defineHistogram(' varX , varY ', type='TH2F', xbins=10, xmin=0.0, xmax=10.0, ybins=40, ymin=0.0, ymax=20.0) - true = '{"alias": "varY_vs_varX", "allvars": ["varX", "varY"], "convention": "", "opt": "", "path": "", "title": " varX , varY ", "treeDef": "", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "varX", "yarray": [], "ybins": 40, "ylabels": [], "ymax": 20.0, "ymin": 0.0, "yvar": "varY", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "varY_vs_varX", "allvars": ["varX", "varY"], "convention": "", "merge": "", "opt": "", "path": "", "title": " varX , varY ", "treeDef": "", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "varX", "yarray": [], "ybins": 40, "ylabels": [], "ymax": 20.0, "ymin": 0.0, "yvar": "varY", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_2D_array( self ): check = defineHistogram('varX,varY', 'TH2F', xbins=[0,1,2], ybins=[1,2,3,7]) - true = '{"alias": "varY_vs_varX", "allvars": ["varX", "varY"], "convention": "", "opt": "", "path": "", "title": "varX,varY", "treeDef": "", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [0, 1, 2], "xbins": 2, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "varX", "yarray": [1, 2, 3, 7], "ybins": 3, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "varY", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "varY_vs_varX", "allvars": ["varX", "varY"], "convention": "", "merge": "", "opt": "", "path": "", "title": "varX,varY", "treeDef": "", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [0, 1, 2], "xbins": 2, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "varX", "yarray": [1, 2, 3, 7], "ybins": 3, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "varY", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_2D_labelsXY( self ): check = defineHistogram('varX,varY', 'TH2F', xlabels=["bin0", "bin1"], ylabels=["bin0", "bin1", "bin2"]) - true = '{"alias": "varY_vs_varX", "allvars": ["varX", "varY"], "convention": "", "opt": "", "path": "", "title": "varX,varY", "treeDef": "", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": ["bin0", "bin1"], "xmax": 1, "xmin": 0, "xvar": "varX", "yarray": [], "ybins": 3, "ylabels": ["bin0", "bin1", "bin2"], "ymax": 0.0, "ymin": 0.0, "yvar": "varY", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "varY_vs_varX", "allvars": ["varX", "varY"], "convention": "", "merge": "", "opt": "", "path": "", "title": "varX,varY", "treeDef": "", "type": "TH2F", "weight": "", "cutMask": "", "xarray": [], "xbins": 2, "xlabels": ["bin0", "bin1"], "xmax": 1, "xmin": 0, "xvar": "varX", "yarray": [], "ybins": 3, "ylabels": ["bin0", "bin1", "bin2"], "ymax": 0.0, "ymin": 0.0, "yvar": "varY", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_3D( self ): check = defineHistogram('varX,varY,varZ', 'TProfile2D', xbins=10, xmin=0.0, xmax=10.0, ybins=40, ymin=0.0, ymax=20.0, zmin=-1.0, zmax=1.0) - true = '{"alias": "varZ_vs_varY_vs_varX", "allvars": ["varX", "varY", "varZ"], "convention": "", "opt": "", "path": "", "title": "varX,varY,varZ", "treeDef": "", "type": "TProfile2D", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "varX", "yarray": [], "ybins": 40, "ylabels": [], "ymax": 20.0, "ymin": 0.0, "yvar": "varY", "zbins": 0, "zlabels": [], "zmax": 1.0, "zmin": -1.0, "zvar": "varZ"}' + true = '{"alias": "varZ_vs_varY_vs_varX", "allvars": ["varX", "varY", "varZ"], "convention": "", "merge": "", "opt": "", "path": "", "title": "varX,varY,varZ", "treeDef": "", "type": "TProfile2D", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "varX", "yarray": [], "ybins": 40, "ylabels": [], "ymax": 20.0, "ymin": 0.0, "yvar": "varY", "zbins": 0, "zlabels": [], "zmax": 1.0, "zmin": -1.0, "zvar": "varZ"}' self.assertEqual(json.loads(check), json.loads(true)) def test_efficiency( self ): check = defineHistogram('var,pass', type='TEfficiency') - true = '{"alias": "pass_vs_var", "allvars": ["var", "pass"], "convention": "", "opt": "", "path": "", "title": "var,pass", "treeDef": "", "type": "TEfficiency", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "pass", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "pass_vs_var", "allvars": ["var", "pass"], "convention": "", "merge": "", "opt": "", "path": "", "title": "var,pass", "treeDef": "", "type": "TEfficiency", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "pass", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_tree( self ): check = defineTree('var,pass', treedef='var/F:pass/I') - true = '{"alias": "pass_vs_var", "allvars": ["var", "pass"], "convention": "", "opt": "", "path": "", "title": "var,pass", "treeDef": "var/F:pass/I", "type": "TTree", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "pass", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "pass_vs_var", "allvars": ["var", "pass"], "convention": "", "merge": "", "opt": "", "path": "", "title": "var,pass", "treeDef": "var/F:pass/I", "type": "TTree", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "pass", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_offlineNamingConvention( self ): check = defineHistogram('var', path='EXPERT', convention='OFFLINE:lowStat') - true = '{"alias": "var", "allvars": ["var"], "convention": "OFFLINE:lowStat", "opt": "", "path": "EXPERT", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + true = '{"alias": "var", "allvars": ["var"], "convention": "OFFLINE:lowStat", "merge": "", "opt": "", "path": "EXPERT", "title": "var", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 100, "xlabels": [], "xmax": 1, "xmin": 0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' + self.assertEqual(json.loads(check), json.loads(true)) + + def test_merge( self ): + check = defineHistogram('var', 'TH1F', 'EXPERT', 'title', '', '', 10, 0.0, 10.0, merge='weightedAverage') + true = '{"alias": "var", "allvars": ["var"], "convention": "", "merge": "weightedAverage", "opt": "", "path": "EXPERT", "title": "title", "treeDef": "", "type": "TH1F", "weight": "", "cutMask": "", "xarray": [], "xbins": 10, "xlabels": [], "xmax": 10.0, "xmin": 0.0, "xvar": "var", "yarray": [], "ybins": 0.0, "ylabels": [], "ymax": 0.0, "ymin": 0.0, "yvar": "", "zbins": 0, "zlabels": [], "zmax": 0.0, "zmin": 0.0, "zvar": ""}' self.assertEqual(json.loads(check), json.loads(true)) def test_enforcePath( self ): @@ -106,5 +111,13 @@ class Test( unittest.TestCase ): self.assertIs(check, '') athenaCommonFlags.isOnline = False + def test_enforceMergeTypesTest( self ): + from AthenaCommon.AthenaCommonFlags import athenaCommonFlags + with self.assertRaises(AssertionError): + check = defineHistogram('var,pass', type='TEfficiency', merge='weightedAverage') + with self.assertRaises(AssertionError): + check = defineHistogram('var,pass', type='TTree', merge='weightedAverage') + + if __name__ == '__main__': unittest.main() diff --git a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx index d242defa7f27ee198f73341af61d0102b6b6d3a9..f6a34f3e0130816b6a6a092cad93c0b676e96e11 100644 --- a/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx +++ b/Control/AthenaServices/src/AthenaHiveEventLoopMgr.cxx @@ -230,57 +230,41 @@ StatusCode AthenaHiveEventLoopMgr::initialize() m_histoPersSvc = IConversionSvc_t( "HistogramPersistencySvc", this->name() ); - if( !sc.isSuccess() ) { - warning() << "Histograms cannot not be saved - though required." - << endmsg; - } else { - - IService *is = 0; - if (histPersName == "ROOT") { - sc = serviceLocator()->service("RootHistSvc", is); - } else if ( histPersName == "HBOOK" ) { - sc = serviceLocator()->service("HbookHistSvc", is); - } + IService *is = 0; + if (histPersName == "ROOT") { + sc = serviceLocator()->service("RootHistSvc", is); + } else if ( histPersName == "HBOOK" ) { + sc = serviceLocator()->service("HbookHistSvc", is); + } - if (sc.isFailure()) { - error() << "could not locate actual Histogram persistency service" - << endmsg; + if (sc.isFailure()) { + error() << "could not locate actual Histogram persistency service" + << endmsg; + } else { + Service *s = dynamic_cast<Service*>(is); + if (s == 0) { + error() << "Could not dcast HistPersSvc to a Service" + << endmsg; } else { - Service *s = dynamic_cast<Service*>(is); - if (s == 0) { - error() << "Could not dcast HistPersSvc to a Service" - << endmsg; - } else { - const Property &prop = s->getProperty("OutputFile"); - std::string val; - try { - const StringProperty &sprop = dynamic_cast<const StringProperty&>( prop ); - - val = sprop.value(); - - } catch (...) { - verbose() << "could not dcast OutputFile property to a StringProperty." - << " Need to fix Gaudi." - << endmsg; - - val = prop.toString(); - - // val.erase(0,val.find(":")+1); - // val.erase(0,val.find("\"")+1); - // val.erase(val.find("\""),val.length()); - } - - if (val != "" && - val != "UndefinedROOTOutputFileName" && - val != "UndefinedHbookOutputFileName" ) { - m_writeHists = true; - } + const Property &prop = s->getProperty("OutputFile"); + std::string val; + try { + const StringProperty &sprop = dynamic_cast<const StringProperty&>( prop ); + val = sprop.value(); + } catch (...) { + verbose() << "could not dcast OutputFile property to a StringProperty." + << " Need to fix Gaudi." + << endmsg; + val = prop.toString(); + } + if (val != "" && + val != "UndefinedROOTOutputFileName" && + val != "UndefinedHbookOutputFileName" ) { + m_writeHists = true; } } } - - } else { if (msgLevel(MSG::DEBUG)) { debug() << "Histograms saving not required." << endmsg; } diff --git a/Control/AthenaServices/src/AthenaMtesEventLoopMgr.cxx b/Control/AthenaServices/src/AthenaMtesEventLoopMgr.cxx index 219f9ac95e5cbc53ca92d100dc9d9df3dd3b731a..b2210dc2e1640af4db5906a14f19f8477c5e8eac 100644 --- a/Control/AthenaServices/src/AthenaMtesEventLoopMgr.cxx +++ b/Control/AthenaServices/src/AthenaMtesEventLoopMgr.cxx @@ -1,20 +1,14 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#define ATHENASERVICES_ATHENAMTESEVENTLOOPMGR_CPP - -#include <cassert> -#include <ios> -#include <iostream> -#include <fstream> /* ofstream */ -#include <iomanip> +#include "AthenaMtesEventLoopMgr.h" +#include "ClearStorePolicy.h" +#include "OutputStreamSequencerSvc.h" #include "PersistentDataModel/AthenaAttributeList.h" #include "AthenaKernel/ITimeKeeper.h" -#include "AthenaKernel/IEventSeek.h" #include "AthenaKernel/IEvtSelectorSeek.h" -#include "AthenaKernel/IAthenaEvtLoopPreSelectTool.h" #include "AthenaKernel/ExtendedEventContext.h" #include "AthenaKernel/EventContextClid.h" #include "AthenaKernel/errorcheck.h" @@ -24,7 +18,6 @@ #include "GaudiKernel/Incident.h" #include "GaudiKernel/DataObject.h" #include "GaudiKernel/IIncidentSvc.h" -#include "GaudiKernel/IEvtSelector.h" #include "GaudiKernel/IDataManagerSvc.h" #include "GaudiKernel/IDataProviderSvc.h" #include "GaudiKernel/IConversionSvc.h" @@ -32,12 +25,11 @@ #include "GaudiKernel/GaudiException.h" #include "GaudiKernel/AppReturnCode.h" #include "GaudiKernel/MsgStream.h" -#include "GaudiKernel/Property.h" #include "GaudiKernel/EventIDBase.h" #include "GaudiKernel/ThreadLocalContext.h" +#include "GaudiKernel/FileIncident.h" #include "StoreGate/StoreGateSvc.h" -#include "StoreGate/ActiveStoreSvc.h" #include "EventInfo/EventInfo.h" #include "EventInfo/EventID.h" @@ -45,38 +37,39 @@ #include "xAODEventInfo/EventInfo.h" #include "EventInfoUtils/EventInfoFromxAOD.h" -#include "AthenaMtesEventLoopMgr.h" - -#include <GaudiKernel/IScheduler.h> -// External libraries #include "tbb/tick_count.h" +#include "yampl/SocketFactory.h" -#include "ClearStorePolicy.h" - -// Temporary includes -#include "GaudiKernel/FileIncident.h" +#include <cassert> +#include <ios> +#include <iostream> #include <fstream> +#include <iomanip> #include <cstdlib> -#include "OutputStreamSequencerSvc.h" -#include "yampl/SocketFactory.h" - -//========================================================================= -// Standard Constructor -//========================================================================= -AthenaMtesEventLoopMgr::AthenaMtesEventLoopMgr(const std::string& nam, - ISvcLocator* svcLoc) - : MinimalEventLoopMgr(nam, svcLoc), - m_incidentSvc ( "IncidentSvc", nam ), - m_eventStore( "StoreGateSvc", nam ), - m_evtSelector(0), m_evtContext(0), - m_histoDataMgrSvc( "HistogramDataSvc", nam ), - m_histoPersSvc ( "HistogramPersistencySvc", nam ), - m_activeStoreSvc ( "ActiveStoreSvc", nam ), - m_pITK(0), - m_currentRun(0), m_firstRun(true), m_tools(this), m_nevt(0), m_writeHists(false), - m_nev(0), m_proc(0), m_useTools(false),m_doEvtHeartbeat(false), - m_conditionsCleaner( "Athena::ConditionsCleanerSvc", nam ), - m_outSeqSvc("OutputStreamSequencerSvc", nam) +#include <unistd.h> + +AthenaMtesEventLoopMgr::AthenaMtesEventLoopMgr(const std::string& nam + , ISvcLocator* svcLoc) + : MinimalEventLoopMgr(nam, svcLoc) + , m_incidentSvc ( "IncidentSvc", nam ) + , m_eventStore( "StoreGateSvc", nam ) + , m_evtSelector{nullptr} + , m_evtContext{nullptr} + , m_histoDataMgrSvc( "HistogramDataSvc", nam ) + , m_histoPersSvc ( "HistogramPersistencySvc", nam ) + , m_activeStoreSvc ( "ActiveStoreSvc", nam ) + , m_pITK{nullptr} + , m_currentRun(0) + , m_firstRun(true) + , m_tools(this) + , m_nevt(0) + , m_writeHists(false) + , m_nev(0) + , m_proc(0) + , m_useTools(false) + , m_doEvtHeartbeat(false) + , m_conditionsCleaner( "Athena::ConditionsCleanerSvc", nam ) + , m_outSeqSvc("OutputStreamSequencerSvc", nam) { declareProperty("EvtSel", m_evtsel, "Name of Event Selector to use. If empty string (default) " @@ -105,7 +98,7 @@ AthenaMtesEventLoopMgr::AthenaMtesEventLoopMgr(const std::string& nam, "(default as it is makes things easier for memory management" ") or at BeginEvent (easier e.g. for interactive use)"); declareProperty("PreSelectTools",m_tools,"AlgTools for event pre-selection")-> - declareUpdateHandler( &AthenaMtesEventLoopMgr::setupPreSelectTools, this ); ; + declareUpdateHandler( &AthenaMtesEventLoopMgr::setupPreSelectTools, this ); declareProperty("SchedulerSvc", m_schedulerName="ForwardSchedulerSvc", "Name of the scheduler to be used"); @@ -129,205 +122,149 @@ AthenaMtesEventLoopMgr::AthenaMtesEventLoopMgr(const std::string& nam, } -//========================================================================= -// Standard Destructor -//========================================================================= AthenaMtesEventLoopMgr::~AthenaMtesEventLoopMgr() { } -//========================================================================= -// implementation of IAppMgrUI::initalize -//========================================================================= StatusCode AthenaMtesEventLoopMgr::initialize() { - info() << "Initializing " << name() - << " - package version " << PACKAGE_VERSION << endmsg ; - + << " - package version " << PACKAGE_VERSION << endmsg; StatusCode sc = MinimalEventLoopMgr::initialize(); - if ( !sc.isSuccess() ) - { - error() << "Failed to initialize base class MinimalEventLoopMgr" - << endmsg; + if(!sc.isSuccess()) { + error() << "Failed to initialize base class MinimalEventLoopMgr" << endmsg; return sc; - } + } //------------------------------------------------------------------------- // Setup stuff for hive //------------------------------------------------------------------------- m_whiteboard = serviceLocator()->service(m_whiteboardName); - if( !m_whiteboard.isValid() ) { - fatal() << "Error retrieving " << m_whiteboardName << " interface IHiveWhiteBoard." - << endmsg; + if(!m_whiteboard.isValid()) { + fatal() << "Error retrieving " << m_whiteboardName << " interface IHiveWhiteBoard." << endmsg; return StatusCode::FAILURE; } m_schedulerSvc = serviceLocator()->service(m_schedulerName); - if ( !m_schedulerSvc.isValid()){ - fatal() << "Error retrieving SchedulerSvc interface ISchedulerSvc." - << endmsg; + if(!m_schedulerSvc.isValid()) { + fatal() << "Error retrieving SchedulerSvc interface ISchedulerSvc." << endmsg; return StatusCode::FAILURE; } - // Setup algorithm resource pool + m_algResourcePool = serviceLocator()->service("AlgResourcePool"); - if( !m_algResourcePool.isValid() ) { + if(!m_algResourcePool.isValid()) { fatal() << "Error retrieving AlgResourcePool" << endmsg; return StatusCode::FAILURE; } m_aess = serviceLocator()->service("AlgExecStateSvc"); - if( !m_aess.isValid() ) { + if(!m_aess.isValid()) { fatal() << "Error retrieving AlgExecStateSvc" << endmsg; return StatusCode::FAILURE; } - sc = m_eventStore.retrieve(); - if( !sc.isSuccess() ) - { - fatal() << "Error retrieving pointer to StoreGateSvc" - << endmsg; - return sc; - } - -//-------------------------------------------------------------------------- -// Get the references to the services that are needed by the ApplicationMgr -// itself -//-------------------------------------------------------------------------- - sc = m_incidentSvc.retrieve(); - if( !sc.isSuccess() ) - { - fatal() << "Error retrieving IncidentSvc." << endmsg; - return sc; - } + ATH_CHECK(m_eventStore.retrieve()); + ATH_CHECK(m_incidentSvc.retrieve()); //-------------------------------------------------------------------------- // Access Property Manager interface: //-------------------------------------------------------------------------- SmartIF<IProperty> prpMgr(serviceLocator()); - if ( !prpMgr.isValid() ) - { - fatal() << "IProperty interface not found in ApplicationMgr." - << endmsg; + if(!prpMgr.isValid()) { + fatal() << "IProperty interface not found in ApplicationMgr." << endmsg; return StatusCode::FAILURE; } - -//-------------------------------------------------------------------------- -// Set up the Histogram Service -//-------------------------------------------------------------------------- - sc = m_histoDataMgrSvc.retrieve(); - if( !sc.isSuccess() ) - { - fatal() << "Error retrieving HistogramDataSvc" - << endmsg; - return sc; - } + ATH_CHECK(m_histoDataMgrSvc.retrieve()); const std::string& histPersName(m_histPersName.value()); - if ( histPersName.length() == 0 ) - { + if(histPersName.empty()) { setProperty(prpMgr->getProperty("HistogramPersistency")).ignore(); } - if ( histPersName != "NONE" ) { + if(histPersName != "NONE") { m_histoPersSvc = IConversionSvc_t( "HistogramPersistencySvc", this->name() ); - if( !sc.isSuccess() ) { - warning() << "Histograms cannot not be saved - though required." - << endmsg; - } else { + IService *is{nullptr}; + sc = serviceLocator()->service("RootHistSvc", is); - IService *is = 0; - if (histPersName == "ROOT") { - sc = serviceLocator()->service("RootHistSvc", is); - } else if ( histPersName == "HBOOK" ) { - sc = serviceLocator()->service("HbookHistSvc", is); + if (sc.isFailure()) { + error() << "could not locate actual Histogram persistency service" << endmsg; + } + else { + Service *s = dynamic_cast<Service*>(is); + if(!s) { + error() << "Could not dcast HistPersSvc to a Service" << endmsg; } + else { + const Property &prop = s->getProperty("OutputFile"); + std::string val; + try { + const StringProperty &sprop = dynamic_cast<const StringProperty&>(prop); + val = sprop.value(); + } + catch (...) { + verbose() << "could not dcast OutputFile property to a StringProperty." + << " Need to fix Gaudi." + << endmsg; - if (sc.isFailure()) { - error() << "could not locate actual Histogram persistency service" - << endmsg; - } else { - Service *s = dynamic_cast<Service*>(is); - if (s == 0) { - error() << "Could not dcast HistPersSvc to a Service" - << endmsg; - } else { - const Property &prop = s->getProperty("OutputFile"); - std::string val; - try { - const StringProperty &sprop = dynamic_cast<const StringProperty&>( prop ); - - val = sprop.value(); - - } catch (...) { - verbose() << "could not dcast OutputFile property to a StringProperty." - << " Need to fix Gaudi." - << endmsg; - - val = prop.toString(); - - // val.erase(0,val.find(":")+1); - // val.erase(0,val.find("\"")+1); - // val.erase(val.find("\""),val.length()); - } - - if (val != "" && - val != "UndefinedROOTOutputFileName" && - val != "UndefinedHbookOutputFileName" ) { - m_writeHists = true; - } + val = prop.toString(); + } + if (val != "" + && val != "UndefinedROOTOutputFileName") { + m_writeHists = true; } } } - - - } else { if (msgLevel(MSG::DEBUG)) { - debug() << "Histograms saving not required." - << endmsg; } } + else { + if (msgLevel(MSG::DEBUG)) { + debug() << "Histograms saving not required." << endmsg; + } + } + //------------------------------------------------------------------------- // Setup EventSelector service //------------------------------------------------------------------------- const std::string& selName(m_evtsel.value()); // the evt sel is usually specified as a property of ApplicationMgr - if (selName.empty()) + if (selName.empty()) { sc = setProperty(prpMgr->getProperty("EvtSel")); - if (sc.isFailure()) warning() << "Unable to set EvtSel property" << endmsg; + } + if (sc.isFailure()) { + warning() << "Unable to set EvtSel property" << endmsg; + } // We do not expect a Event Selector necessarily being declared if( !selName.empty() && selName != "NONE") { - IEvtSelector* theEvtSel(0); - StatusCode sc(serviceLocator()->service( selName, theEvtSel )); - if( sc.isSuccess() && ( theEvtSel != m_evtSelector ) ) { + IEvtSelector* theEvtSel{nullptr}; + sc = serviceLocator()->service(selName, theEvtSel); + if(sc.isSuccess() && (theEvtSel != m_evtSelector)) { // Event Selector changed (or setup for the first time) m_evtSelector = theEvtSel; // reset iterator if (m_evtSelector->createContext(m_evtContext).isFailure()) { - fatal() << "Can not create the event selector Context." - << endmsg; + fatal() << "Can not create the event selector Context." << endmsg; return StatusCode::FAILURE; } if (msgLevel(MSG::INFO)) { INamedInterface* named (dynamic_cast< INamedInterface* >(theEvtSel)); if (0 != named) { - info() << "Setup EventSelector service " << named->name( ) - << endmsg; + info() << "Setup EventSelector service " << named->name( ) << endmsg; } } - } else if (sc.isFailure()) { - fatal() << "No valid event selector called " << selName - << endmsg; + } + else if (sc.isFailure()) { + fatal() << "No valid event selector called " << selName << endmsg; return StatusCode::FAILURE; } - } + } //------------------------------------------------------------------------- // Setup TimeKeeper service //------------------------------------------------------------------------- @@ -347,12 +284,7 @@ StatusCode AthenaMtesEventLoopMgr::initialize() // We don't use this, but want to be sure that it gets created // during initialization, to avoid heap fragmentation. //------------------------------------------------------------------------- - sc = m_activeStoreSvc.retrieve(); - if( !sc.isSuccess() ) - { - fatal() << "Error retrieving ActiveStoreSvc." << endmsg; - return sc; - } + ATH_CHECK(m_activeStoreSvc.retrieve()); // Listen to the BeforeFork incident m_incidentSvc->addListener(this,"BeforeFork",0); @@ -360,6 +292,10 @@ StatusCode AthenaMtesEventLoopMgr::initialize() CHECK( m_conditionsCleaner.retrieve() ); CHECK( m_outSeqSvc.retrieve() ); + // Print if we override the event number using the one from secondary event + if(m_useSecondaryEventNumber) { + info() << "Using secondary event number." << endmsg; + } return sc; } @@ -563,22 +499,6 @@ StatusCode AthenaMtesEventLoopMgr::writeHistograms(bool force) { return sc; } -//========================================================================= -// Run the algorithms beginRun hook -//========================================================================= -StatusCode AthenaMtesEventLoopMgr::beginRunAlgorithms() { - - return StatusCode::SUCCESS; -} - -//========================================================================= -// Run the algorithms endRun hook -//========================================================================= -StatusCode AthenaMtesEventLoopMgr::endRunAlgorithms() { - - return StatusCode::SUCCESS; -} - //========================================================================= // Call sysInitialize() on all algorithms and output streams //========================================================================= @@ -636,7 +556,7 @@ StatusCode AthenaMtesEventLoopMgr::executeEvent( EventContext &&ctx ) conditionsRun = (*attr)["ConditionsRun"].data<unsigned int>(); } } - ctx.template getExtension<Atlas::ExtendedEventContext>().setConditionsRun (conditionsRun); + Atlas::getExtendedEventContext(ctx).setConditionsRun (conditionsRun); Gaudi::Hive::setCurrentContext ( ctx ); // Record EventContext in current whiteboard @@ -739,21 +659,13 @@ StatusCode AthenaMtesEventLoopMgr::executeEvent( EventContext &&ctx ) //========================================================================= StatusCode AthenaMtesEventLoopMgr::executeRun(int maxevt) { - - StatusCode sc; - bool eventfailed = false; - - // Call now the nextEvent(...) - sc = nextEvent(maxevt); - if (!sc.isSuccess()) - eventfailed = true; - - if (eventfailed) - return StatusCode::FAILURE; - - m_incidentSvc->fireIncident(Incident(name(),"EndEvtLoop")); - return StatusCode::SUCCESS; + StatusCode sc = nextEvent(maxevt); + if (sc.isSuccess()) { + m_incidentSvc->fireIncident(Incident(name(),"EndEvtLoop")); + } + return sc; } + //----------------------------------------------------------------------------- // Implementation of IEventProcessor::stopRun() //----------------------------------------------------------------------------- @@ -795,17 +707,11 @@ StatusCode AthenaMtesEventLoopMgr::stop() } -//========================================================================= -// implementation of IAppMgrUI::nextEvent -//========================================================================= -StatusCode AthenaMtesEventLoopMgr::nextEvent(int maxevt) +StatusCode AthenaMtesEventLoopMgr::nextEvent(int /*maxevt*/) { - // make nextEvent(0) a dummy call - if (0 == maxevt) return StatusCode::SUCCESS; - yampl::ISocketFactory* socketFactory = new yampl::SocketFactory(); // Create a socket to communicate with the Pilot - yampl::ISocket* socket2Pilot = socketFactory->createClientSocket(yampl::Channel("EventService_EventRanges",yampl::LOCAL),yampl::MOVE_DATA); + yampl::ISocket* socket2Pilot = socketFactory->createClientSocket(yampl::Channel(m_eventRangeChannel.value(),yampl::LOCAL),yampl::MOVE_DATA); // Reset the application return code. Gaudi::setAppReturnCode(m_appMgrProperty, Gaudi::ReturnCode::Success, true).ignore(); @@ -814,11 +720,6 @@ StatusCode AthenaMtesEventLoopMgr::nextEvent(int maxevt) int createdEvts =0; info() << "Starting loop on events" << endmsg; - // loop over events if the maxevt (received as input) is different from -1. - // if evtmax is -1 it means infinite loop (till time limit that is) - // int nevt(0); - // CGL: FIXME - // bool noTimeLimit(false); StatusCode sc(StatusCode::SUCCESS,true); // Calculate runtime @@ -827,13 +728,19 @@ StatusCode AthenaMtesEventLoopMgr::nextEvent(int maxevt) return (tbb::tick_count::now()-start_time).seconds(); }; - std::unique_ptr<RangeStruct_t> range = getNextRange(socket2Pilot); - if(range) { + std::unique_ptr<RangeStruct> range; + while(!range) { + range = getNextRange(socket2Pilot); + usleep(1000); + } + + bool loop_ended = range->eventRangeID.empty(); + if(!loop_ended) { m_currentEvntNum = range->startEvent; // Fire NextRange incident m_incidentSvc->fireIncident(FileIncident(name(), "NextEventRange",range->eventRangeID)); } - bool loop_ended = !range; + bool no_more_events = false; while(!loop_ended) { @@ -863,18 +770,22 @@ StatusCode AthenaMtesEventLoopMgr::nextEvent(int maxevt) ++createdEvts; if(++m_currentEvntNum > range->lastEvent) { // Fetch next event range - range = getNextRange(socket2Pilot); - if(range) { + range.reset(); + while(!range) { + range = getNextRange(socket2Pilot); + usleep(1000); + } + if(range->eventRangeID.empty()) { + no_more_events = true; + } + else { m_currentEvntNum = range->startEvent; // Fire NextRange incident m_incidentSvc->fireIncident(FileIncident(name(), "NextEventRange",range->eventRangeID)); } - else { - no_more_events = true; - } } } - } + } else { // all the events were created but not all finished or the slots were // all busy: the scheduler should finish its job @@ -1165,25 +1076,32 @@ int AthenaMtesEventLoopMgr::declareEventRootAddress(EventContext& ctx){ // an option to override primary eventNumber with the secondary one in case of DoubleEventSelector if ( m_useSecondaryEventNumber ) { + unsigned long long eventNumberSecondary{}; if ( !(pAttrList->exists("hasSecondaryInput") && (*pAttrList)["hasSecondaryInput"].data<bool>()) ) { fatal() << "Secondary EventNumber requested, but secondary input does not exist!" << endmsg; return -1; } if ( pAttrList->exists("EventNumber_secondary") ) { - eventNumber = (*pAttrList)["EventNumber_secondary"].data<unsigned long long>(); + eventNumberSecondary = (*pAttrList)["EventNumber_secondary"].data<unsigned long long>(); } else { // try legacy EventInfo if secondary input did not have attribute list // primary input should not have this EventInfo type const EventInfo* pEventSecondary = eventStore()->tryConstRetrieve<EventInfo>(); if (pEventSecondary) { - eventNumber = pEventSecondary->event_ID()->event_number(); + eventNumberSecondary = pEventSecondary->event_ID()->event_number(); } else { fatal() << "Secondary EventNumber requested, but it does not exist!" << endmsg; return -1; } } + if (eventNumberSecondary != 0) { + if (m_doEvtHeartbeat) { + info() << " ===>>> using secondary event #" << eventNumberSecondary << " instead of #" << eventNumber << "<<<===" << endmsg; + } + eventNumber = eventNumberSecondary; + } } auto pEventPtr = std::make_unique<EventInfo> @@ -1267,7 +1185,7 @@ EventContext AthenaMtesEventLoopMgr::createEventContext() { << " could not be selected for the WhiteBoard" << endmsg; return EventContext{}; // invalid EventContext } else { - ctx.setExtension( Atlas::ExtendedEventContext( eventStore()->hiveProxyDict() ) ); + Atlas::setExtendedEventContext(ctx, Atlas::ExtendedEventContext( eventStore()->hiveProxyDict() ) ); debug() << "created EventContext, num: " << ctx.evt() << " in slot: " << ctx.slot() << endmsg; @@ -1420,7 +1338,7 @@ StatusCode AthenaMtesEventLoopMgr::clearWBSlot(int evtSlot) { } //--------------------------------------------------------------------------- -std::unique_ptr<AthenaMtesEventLoopMgr::RangeStruct_t> AthenaMtesEventLoopMgr::getNextRange(yampl::ISocket* socket) +std::unique_ptr<AthenaMtesEventLoopMgr::RangeStruct> AthenaMtesEventLoopMgr::getNextRange(yampl::ISocket* socket) { std::string strReady("Ready for events"); std::string strStopProcessing("No more events"); @@ -1435,7 +1353,7 @@ std::unique_ptr<AthenaMtesEventLoopMgr::RangeStruct_t> AthenaMtesEventLoopMgr::g size_t carRet = range.find('\n'); if(carRet!=std::string::npos) range = range.substr(0,carRet); - std::unique_ptr<RangeStruct_t> result; + std::unique_ptr<RangeStruct> result = std::make_unique<RangeStruct>(); if(range.compare(strStopProcessing)==0) return result; info() << "Got Event Range from the pilot: " << range << endmsg; @@ -1472,35 +1390,86 @@ std::unique_ptr<AthenaMtesEventLoopMgr::RangeStruct_t> AthenaMtesEventLoopMgr::g trimRangeStrings(strVal); eventRangeMap[strKey]=strVal; + // _____________________ Consistency check for range string _____________________________ + // Three checks are performed: + // 1. The existence of all required fields + // 2. The consistency of field values + // 3. Protection against having event ranges from different input files + // NB. The last check is hopefully a temporary limitation of MTES + std::string errorStr{""}; + if(eventRangeMap.find("eventRangeID")==eventRangeMap.end() || eventRangeMap.find("startEvent")==eventRangeMap.end() || eventRangeMap.find("lastEvent")==eventRangeMap.end() || eventRangeMap.find("PFN")==eventRangeMap.end()) { - // Handle wrong format - error() << "Wrong format of the input Event Range: " << range << endmsg; - return result; + // Wrong format + errorStr = "ERR_ATHENAMP_PARSE \"" + range + "\": Wrong format"; } - else { + + if(errorStr.empty()) { + result->startEvent = std::atoi(eventRangeMap["startEvent"].c_str()); + result->lastEvent = std::atoi(eventRangeMap["lastEvent"].c_str()); + + if(eventRangeMap["eventRangeID"].empty() + || eventRangeMap["PFN"].empty() + || result->lastEvent < result->startEvent) { + // Wrong values of range fields + errorStr = "ERR_ATHENAMP_PARSE \"" + range + "\": Wrong values of range fields"; + } + else { + if(m_pfn.empty()) { + // This is a first event range. Cache its PFN value, and also set it as input file name to the Event Selector + IProperty* propertyServer = dynamic_cast<IProperty*>(m_evtSelector); + if(!propertyServer) { + errorStr = "ERR_ATHENAMP_PARSE \"" + range + "\": Unable to dyn-cast the event selector to IProperty"; + } + else { + std::string strInpuCol("InputCollections"); + std::vector<std::string> vectInpCol{eventRangeMap["PFN"],}; + StringArrayProperty inputFileList(strInpuCol, vectInpCol); + if(propertyServer->setProperty(inputFileList).isFailure()) { + errorStr = "ERR_ATHENAMP_PARSE \"" + range + "\": Unable to set input file name property to the Event Selector"; + } + else { + m_pfn = eventRangeMap["PFN"]; + } + } + // std::vector<std::string> vectInpCol; + // StringArrayProperty inputFileList(strInpuCol, vectInpCol); + // if(propertyServer->getProperty(&inputFileList).isFailure()) { + // error() << "Failed to get InputCollections property value of the Event Selector" << endmsg; + // return StatusCode::FAILURE; + // } + // m_pfn = inputFileList.value()[0]; + } + else { + if(m_pfn!=eventRangeMap["PFN"]) { + errorStr = "ERR_ATHENAMP_PARSE \"" + range + "\": one instance of AthenaMT cannot support event ranges from more than one input file"; + } + } + } + } + + if(errorStr.empty()) { + // Event range parsing was successful debug() << "*** Decoded Event Range ***" << endmsg; for (const auto& fieldvalue : eventRangeMap) { debug() << fieldvalue.first << ":" << fieldvalue.second << endmsg; } + + result->eventRangeID = eventRangeMap["eventRangeID"]; + result->pfn = eventRangeMap["PFN"]; } - - result = std::make_unique<RangeStruct_t>(); - result->eventRangeID = eventRangeMap["eventRangeID"]; - result->pfn = eventRangeMap["PFN"]; - result->startEvent = std::atoi(eventRangeMap["startEvent"].c_str()); - result->lastEvent = std::atoi(eventRangeMap["lastEvent"].c_str()); - - if(result->eventRangeID.empty() - || result->pfn.empty() - || result->lastEvent < result->startEvent) { - // Handle wrong content of the range string - error() << "Wrong values of the input Event Range fields: " << range << endmsg; + else { + // We got here because there was an error + // Report the error to the pilot and reset the result, so that the next range can be tried + warning() << errorStr << endmsg; + info() << "Ignoring this event range" << endmsg; + void* errorMessage = malloc(errorStr.size()); + memcpy(errorMessage,errorStr.data(),errorStr.size()); + socket->send(errorMessage,errorStr.size()); result.reset(); } - // _____________________ Decode range string _____________________________ return result; } diff --git a/Control/AthenaServices/src/AthenaMtesEventLoopMgr.h b/Control/AthenaServices/src/AthenaMtesEventLoopMgr.h index 4efac700c8553017d09d46b775d6e623c0dfa564..12e7fbaed03b8e3b47fd07015ae45c2acf644bb0 100644 --- a/Control/AthenaServices/src/AthenaMtesEventLoopMgr.h +++ b/Control/AthenaServices/src/AthenaMtesEventLoopMgr.h @@ -1,51 +1,39 @@ // -*- C++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef ATHENASERVICES_ATHENAMTESEVENTLOOPMGR_H #define ATHENASERVICES_ATHENAMTESEVENTLOOPMGR_H -#include <string> -#include <vector> - #include "GaudiKernel/IEvtSelector.h" #include "GaudiKernel/Property.h" #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/MsgStream.h" #include "GaudiKernel/MinimalEventLoopMgr.h" #include "GaudiKernel/IIncidentListener.h" +#include "GaudiKernel/IAlgResourcePool.h" +#include "GaudiKernel/IHiveWhiteBoard.h" +#include "GaudiKernel/IScheduler.h" +#include "GaudiKernel/IAlgExecStateSvc.h" + #include "AthenaKernel/Timeout.h" #include "AthenaKernel/IAthenaEvtLoopPreSelectTool.h" #include "AthenaKernel/IEventSeek.h" #include "AthenaKernel/ICollectionSize.h" #include "AthenaKernel/IConditionsCleanerSvc.h" +#include "StoreGate/ActiveStoreSvc.h" -////////////////////////////////////////////////// -#include "GaudiKernel/IAlgResourcePool.h" -#include "GaudiKernel/IEvtSelector.h" -#include "GaudiKernel/IHiveWhiteBoard.h" -#include "GaudiKernel/IScheduler.h" -#include "GaudiKernel/IAlgExecStateSvc.h" - -// Standard includes +#include <memory> +#include <string> +#include <vector> #include <functional> -// External Libraries -#include "tbb/concurrent_queue.h" -////////////////////////////////////////////////// - #ifndef EVENTINFO_EVENTID_H # include "EventInfo/EventID.h" /* number_type */ #endif -#include "StoreGate/ActiveStoreSvc.h" - -#include <memory> -#include <fstream> - // Forward declarations class IConversionSvc; class IDataManagerSvc; @@ -153,12 +141,6 @@ protected: /// Run the algorithms for the current event virtual StatusCode executeAlgorithms(); - /// Fire BeginRun Incident, run the algorithms beginRun hook - StatusCode beginRunAlgorithms(); - - /// Fire EndEvtLoop,EndRun, run the algorithms endRun hook - StatusCode endRunAlgorithms(); - /// Initialize all algorithms and output streams StatusCode initializeAlgorithms(); @@ -282,18 +264,34 @@ private: // at the end of event processing. EventContext m_lastEventContext; + // Event Service Specific stuff + struct RangeStruct{ + RangeStruct() + : eventRangeID{""} + , pfn{""} + , startEvent{-1} + , lastEvent{-1} {} - typedef struct { std::string eventRangeID; std::string pfn; int startEvent; int lastEvent; - } RangeStruct_t; + }; - std::unique_ptr<RangeStruct_t> getNextRange(yampl::ISocket* socket); + std::unique_ptr<RangeStruct> getNextRange(yampl::ISocket* socket); void trimRangeStrings(std::string& str); ServiceHandle<OutputStreamSequencerSvc> m_outSeqSvc; + + Gaudi::Property<std::string> m_eventRangeChannel{this + , "EventRangeChannel" + , "EventService_EventRanges" + , "The name of the Yampl channel between AthenaMT and the Pilot" + }; + + // Hopefully a temporary measurement. For the time being we cannot + // support event ranges from different input files. + std::string m_pfn{""}; }; #endif // ATHENASERVICES_ATHENAHIVEEVENTLOOPMGR_H diff --git a/Control/AthenaServices/src/AthenaOutputStream.cxx b/Control/AthenaServices/src/AthenaOutputStream.cxx index 84fdf7bb607fe040616887e9dd5c047995b98d7f..1241655ecfec9275cbcf26f29de0872bb7885e22 100644 --- a/Control/AthenaServices/src/AthenaOutputStream.cxx +++ b/Control/AthenaServices/src/AthenaOutputStream.cxx @@ -165,7 +165,6 @@ AthenaOutputStream::AthenaOutputStream(const string& name, ISvcLocator* pSvcLoca m_helperTools(this) { assert(pSvcLocator); - declareProperty("ItemList", m_itemList); declareProperty("MetadataItemList", m_metadataItemList); declareProperty("TransientItems", m_transientItems); declareProperty("OutputFile", m_outputName="DidNotNameOutput.root"); diff --git a/Control/AthenaServices/src/AthenaOutputStream.h b/Control/AthenaServices/src/AthenaOutputStream.h index de944c9641c9dacdf50caab756003abb8da6c4b2..5c4451ff682492c0d9a23bbc17a9dd27d22f0bb8 100644 --- a/Control/AthenaServices/src/AthenaOutputStream.h +++ b/Control/AthenaServices/src/AthenaOutputStream.h @@ -76,7 +76,7 @@ protected: ServiceHandle<OutputStreamSequencerSvc> m_outSeqSvc; /// Vector of item names - StringArrayProperty m_itemList; + StringArrayProperty m_itemList{this,"ItemList",{},"List of items to write","Set<std::string>"}; /// Vector of item names StringArrayProperty m_metadataItemList; /// Vector of item names diff --git a/Control/AthenaServices/src/ItemListSvc.cxx b/Control/AthenaServices/src/ItemListSvc.cxx index 511e2d8441d4264ecb2fbbf6d58b743653d618ba..f8e5d5ee4ba66f6795eab269140d2e5cc554a744 100644 --- a/Control/AthenaServices/src/ItemListSvc.cxx +++ b/Control/AthenaServices/src/ItemListSvc.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ItemListSvc.cxx @@ -73,6 +73,7 @@ StatusCode ItemListSvc::finalize() // add item to list for stream StatusCode ItemListSvc::addStreamItem(const std::string& stream, const std::string& itemname) { + lock_t lock (m_mutex); // Add to stream list // Check if item is already present std::map<std::string, std::set<std::string> >::iterator it = m_streamItems.find(stream); @@ -95,6 +96,7 @@ StatusCode ItemListSvc::addStreamItem(const std::string& stream, const std::stri // remove item from list for stream StatusCode ItemListSvc::removeStreamItem(const std::string& stream, const std::string& itemname) { + lock_t lock (m_mutex); std::map<std::string, std::set<std::string> >::iterator it = m_streamItems.find(stream); if (it == m_streamItems.end()) { ATH_MSG_INFO("Tried to remove non-existing item " << itemname << " for " << stream); @@ -110,6 +112,7 @@ StatusCode ItemListSvc::removeStreamItem(const std::string& stream, const std::s // simple test to see if item or (stream,item) is already being written bool ItemListSvc::containsItem(const std::string& itemname, const std::string& stream) const { + lock_t lock (m_mutex); bool contains=false; std::map<std::string, std::set<std::string> >::const_iterator it = m_streamItems.begin(); while (it != m_streamItems.end()) { @@ -124,6 +127,7 @@ bool ItemListSvc::containsItem(const std::string& itemname, const std::string& s // This returns all the streams that an item was written to std::vector<std::string> ItemListSvc::getStreamsForItem(const std::string& itemname) const { + lock_t lock (m_mutex); std::vector<std::string> t; std::map<std::string, std::set<std::string> >::const_iterator it = m_streamItems.begin(); while (it != m_streamItems.end()) { @@ -136,6 +140,7 @@ std::vector<std::string> ItemListSvc::getStreamsForItem(const std::string& itemn // This returns the items that were output to a certain stream std::vector<std::string> ItemListSvc::getItemsForStream(const std::string& stream) const { + lock_t lock (m_mutex); std::vector<std::string> t; std::map<std::string, std::set<std::string> >::const_iterator it = m_streamItems.find(stream); if (it != m_streamItems.end()) std::copy(it->second.begin(), it->second.end(),t.begin()); diff --git a/Control/AthenaServices/src/ItemListSvc.h b/Control/AthenaServices/src/ItemListSvc.h index b5270a536deeec0b2a72d94f0dbf7ad9fbe338e6..b04b7fdebc7241232ed6dbf2ab7c5d636b3301e1 100644 --- a/Control/AthenaServices/src/ItemListSvc.h +++ b/Control/AthenaServices/src/ItemListSvc.h @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ItemListSvc.h @@ -26,6 +26,7 @@ #include <string> #include <vector> #include <map> +#include <mutex> // FrameWork includes #include "GaudiKernel/IAlgManager.h" @@ -90,6 +91,8 @@ private: // Map between streams and items std::map<std::string, std::set<std::string> > m_streamItems; float m_verboseThresh; + mutable std::mutex m_mutex; + typedef std::lock_guard<std::mutex> lock_t; // Avoid coverity warnings. ItemListSvc (const ItemListSvc&); diff --git a/Control/IOVSvc/src/CondInputLoader.cxx b/Control/IOVSvc/src/CondInputLoader.cxx index 4fefff68bfb5861db81d06092ecf47194fad46fc..4d40ed5b22a0f33998edb0d1a6968494e78ceabb 100644 --- a/Control/IOVSvc/src/CondInputLoader.cxx +++ b/Control/IOVSvc/src/CondInputLoader.cxx @@ -72,9 +72,6 @@ CondInputLoader::CondInputLoader( const std::string& name, (&CondInputLoader::extraDeps_update_handler, this); } } - - declareProperty( "Load", m_load); - //->declareUpdateHandler(&CondInputLoader::loader, this); } // Destructor @@ -164,7 +161,7 @@ CondInputLoader::initialize() ost << " " << base << " (" << clid2 << ")"; SG::VarHandleKey vhk(clid2,e->key(),Gaudi::DataHandle::Writer, StoreID::storeName(StoreID::CONDITION_STORE)); - m_load.emplace(vhk.fullKey()); + m_load.value().emplace(vhk.fullKey()); } } } diff --git a/Control/IOVSvc/src/CondInputLoader.h b/Control/IOVSvc/src/CondInputLoader.h index 240a8afda01899ede3ca11dd5330a4e57a15ab08..f8239fe27631873f7c7f394abfb6a26946f0688c 100644 --- a/Control/IOVSvc/src/CondInputLoader.h +++ b/Control/IOVSvc/src/CondInputLoader.h @@ -76,7 +76,8 @@ class CondInputLoader // void loader(Property&); /// Containers - DataObjIDColl m_load, m_handlesToCreate; + Gaudi::Property<DataObjIDColl> m_load{this,"Load",{},"List of objects to be loaded","Set<std::string>"}; + DataObjIDColl m_handlesToCreate; std::vector< SG::VarHandleKey > m_vhk; Gaudi::Property<bool> m_dumpEvt{ this, "DumpCondStore", false, diff --git a/Control/PerformanceMonitoring/PerfMonComps/CMakeLists.txt b/Control/PerformanceMonitoring/PerfMonComps/CMakeLists.txt index 513fc7d3b131cf4222d8a6bfb69523508a961c52..efa4b530d8c5379395a01139f84d20eeb34c7d14 100644 --- a/Control/PerformanceMonitoring/PerfMonComps/CMakeLists.txt +++ b/Control/PerformanceMonitoring/PerfMonComps/CMakeLists.txt @@ -39,4 +39,3 @@ atlas_add_component( PerfMonComps # Install files from the package: atlas_install_python_modules( python/*.py ) atlas_install_joboptions( share/*.py ) -atlas_install_scripts( scripts/PerfMonMTSvc_plotter.py ) diff --git a/Control/SGComps/src/ProxyProviderSvc.h b/Control/SGComps/src/ProxyProviderSvc.h index 8bf8e9743594f3a538fd7e78e5beff5a630da392..0b0da21c65bc3df683385d4e6cb44f6ddfe8fd83 100644 --- a/Control/SGComps/src/ProxyProviderSvc.h +++ b/Control/SGComps/src/ProxyProviderSvc.h @@ -101,7 +101,7 @@ private: /// property: the services declared as providers StringArrayProperty m_providerNames{this,"ProviderNames",{}, - "names of the services to be use as address providers"}; + "names of the services to be use as address providers","Set<std::string>"}; /// the handler for m_providerNames void providerNamesPropertyHandler( Property& theProp ); diff --git a/Control/SGTools/SGTools/T2pMap.h b/Control/SGTools/SGTools/T2pMap.h index c3e0d7f65b9e85a0c2b6356044405246b0376091..a192e41b3508ac87013c8738dacd95b19889ab37 100755 --- a/Control/SGTools/SGTools/T2pMap.h +++ b/Control/SGTools/SGTools/T2pMap.h @@ -1,7 +1,7 @@ /* -*- C++ -*- */ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef SGTOOLS_T2PMAP_H @@ -11,6 +11,7 @@ #include <utility> #include <vector> #include <unordered_map> +#include <mutex> #include "AthenaKernel/IPageAccessControlSvc.h" namespace SG { @@ -31,6 +32,7 @@ class T2pMap { // associate a void* (T*) with a proxy bool t2pRegister(const void* const pTrans, DataProxy* const pPers) { + std::lock_guard<std::mutex> lock (m_mutex); bool success(m_t2p.insert (std::make_pair (pTrans, pPers)) . second); if (m_pac) m_pac->controlPage(pTrans); return success; @@ -38,6 +40,7 @@ class T2pMap { // locate a proxy in t2p map DataProxy* locatePersistent(const void* const pTransient) const { + std::lock_guard<std::mutex> lock (m_mutex); t2p::const_iterator i = m_t2p.find(pTransient); if (i == m_t2p.end()) @@ -48,11 +51,13 @@ class T2pMap { // clear the t2p map void clear() { + std::lock_guard<std::mutex> lock (m_mutex); m_t2p.clear(); } // remove a void* from t2p void t2pRemove(const void* const pTrans) { + std::lock_guard<std::mutex> lock (m_mutex); m_t2p.erase(pTrans); } @@ -65,7 +70,7 @@ class T2pMap { private: IPageAccessControlSvc* m_pac; t2p m_t2p; - + mutable std::mutex m_mutex; }; } diff --git a/DataQuality/DataQualityUtils/src/HanOutputFile.cxx b/DataQuality/DataQualityUtils/src/HanOutputFile.cxx index 025fc8508dfa64dc2aa96d66a1d03b5a905d91f3..f0b1565d1db18e2c97291b3ab642c87ea202b085 100644 --- a/DataQuality/DataQualityUtils/src/HanOutputFile.cxx +++ b/DataQuality/DataQualityUtils/src/HanOutputFile.cxx @@ -1659,9 +1659,22 @@ bool HanOutputFile::saveHistogramToFileSuperimposed( std::string nameHis, std::s convertToGraphics(cnvsType,myC.get(),namePNG,nameJSON); } else if( h != 0 && hist2!=0){ + // Petronel + double scale = 1.0; + if (display.find("ScaleRef")!=std::string::npos) { + scale = getScaleVal(display); + } else if ( h->Integral("width") > 0.0 && hist2->Integral("width") > 0.0 && (AlgoName.find("BinContentComp")==std::string::npos) && (display.find("NoNorm")==std::string::npos) ) { + scale = h->Integral("width")/hist2->Integral("width"); + } + hist2->Scale( scale ); + double ymin = ( hist2->GetMinimum() < h->GetMinimum() )? hist2->GetMinimum(): h->GetMinimum(); + double ymax = ( hist2->GetMaximum() > h->GetMaximum() )? hist2->GetMaximum(): h->GetMaximum(); + double yMargin=(ymax-ymin)*0.05; + h->SetAxisRange(ymin-yMargin,ymax+yMargin,"Y"); + h->SetMarkerColor(1); h->SetFillStyle(0); - h->SetLineWidth(2); + h->SetLineWidth(2); hist2->SetMarkerColor(4); hist2->SetLineColor(4); hist2->SetFillStyle(0); @@ -1679,8 +1692,12 @@ bool HanOutputFile::saveHistogramToFileSuperimposed( std::string nameHis, std::s legend->SetMargin(0.15); legend->SetFillStyle(0); legend->SetBorderSize(0); - legend->AddEntry(h,"Data1"); - legend->AddEntry(hist2,"Data2"); + + std::size_t foundN1 = run_min_LB.find_first_of("-"); + std::size_t foundN2 = run_min_LB.find_first_of(","); + + legend->AddEntry(h,("Run "+run_min_LB.substr(5,foundN1-5)).c_str()); + legend->AddEntry(hist2,("Run "+run_min_LB.substr(foundN1+1,foundN2-foundN1-1)).c_str()); if(hRef){ legend->AddEntry(hRef,"Reference"); } diff --git a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py index 2f901c14cfdb470de4db3d9eef25262d215125d0..72353461a1cfe22d5d2e4eadfb142f94beac81af 100644 --- a/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py +++ b/Database/AthenaPOOL/AthenaPoolCnvSvc/python/PoolReadConfig.py @@ -24,13 +24,13 @@ def PoolReadCfg(configFlags): result.addService(PoolSvc(MaxFilesOpen=0)) apcs=AthenaPoolCnvSvc() + apcs.InputPoolAttributes += ["DatabaseName = '*'; ContainerName = 'CollectionTree'; TREE_CACHE = '-1'"] result.addService(apcs) result.addService(EvtPersistencySvc("EventPersistencySvc",CnvServices=[apcs.getFullJobOptName(),])) #No service handle yet??? result.addService(StoreGateSvc("MetaDataStore")) - if filenamesSecondary: # Create DoubleEventSelector (universal for any seconday input type) evSel = DoubleEventSelectorAthenaPool("DoubleEventSelector", diff --git a/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h b/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h index fe8695c2857777bfb6b9fa4ec780b5515d7df9a9..4b203cf22e14fe8955db5ac976154d1e7773f06a 100644 --- a/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h +++ b/Database/AthenaPOOL/PoolSvc/src/PoolSvc.h @@ -203,7 +203,7 @@ private: // properties /// default = "" (use POOL default). StringProperty m_writeCatalog{this,"WriteCatalog","xmlcatalog_file:PoolFileCatalog.xml"}; /// ReadCatalog, the list of additional POOL input file catalogs to consult: default = empty vector. - StringArrayProperty m_readCatalog{this,"ReadCatalog",{},"List of catalog files to read from"}; + StringArrayProperty m_readCatalog{this,"ReadCatalog",{},"List of catalog files to read from","Set<std::string>"}; /// Use ROOT Implicit MultiThreading, default = true. BooleanProperty m_useROOTIMT{this,"UseROOTImplicitMT",true}; /// AttemptCatalogPatch, option to create catalog: default = false. diff --git a/Database/IOVDbSvc/src/IOVDbSvc.h b/Database/IOVDbSvc/src/IOVDbSvc.h index 6b81bb40528310e35eff772f5acbccea77cb253a..0b3326952d7c739095cb0327f29725fb9f025801 100644 --- a/Database/IOVDbSvc/src/IOVDbSvc.h +++ b/Database/IOVDbSvc/src/IOVDbSvc.h @@ -186,11 +186,11 @@ private: // production database instance, used to cross-check global tag Gaudi::Property<std::string> m_par_dbinst{this,"DBInstance","","Database instance (like OFLP200)"}; // a list of folders to preload - Gaudi::Property<std::vector<std::string> > m_par_folders{this,"Folders",{},"List of database folders to preload"}; + Gaudi::Property<std::vector<std::string> > m_par_folders{this,"Folders",{},"List of database folders to preload","Set<std::string>"}; // a list of overriding tags definitions - Gaudi::Property<std::vector<std::string> > m_par_overrideTags{this,"overrideTags",{},"List of foolder-tag overrides"}; + Gaudi::Property<std::vector<std::string> > m_par_overrideTags{this,"overrideTags",{},"List of foolder-tag overrides","Set<std::string>"}; // a list of folders to write to file meta data - Gaudi::Property<std::vector<std::string> > m_par_foldersToWrite{this,"FoldersToMetaData",{},"list of folders to write to file meta data"}; + Gaudi::Property<std::vector<std::string> > m_par_foldersToWrite{this,"FoldersToMetaData",{},"list of folders to write to file meta data","Set<std::string>"}; // a flag to trigger the connections management BooleanProperty m_par_manageConnections{this,"ManageConnections",true,"flag to trigger the connections management"}; // a flag to manage pool connections @@ -211,7 +211,7 @@ private: IntegerProperty m_par_cacheTime{this,"CacheTime",0,"force larger timeranges to be cached (seconds)"}; // cache alignment - divide cache into N slices and align queries on slice // should be useful to improve Frontier cache hit rate - UnsignedIntegerProperty m_par_cacheAlign{this,"CacheAlign",0,"cache alignment - divide cache into N slices and align queries on slice"}; + UnsignedIntegerProperty m_par_cacheAlign{this,"CacheAlign",0,"cache alignment - divide cache into N slices and align queries on slice"}; // online mode flag to ignore missing channels outside cache range BooleanProperty m_par_onlineMode{this,"OnlineMode",false,"online mode flag to ignore missing channels outside cache range"}; // check to ensure global/HVS tags are locked (for production) diff --git a/DetectorDescription/GeoModel/GeoAdaptors/CMakeLists.txt b/DetectorDescription/GeoModel/GeoAdaptors/CMakeLists.txt index 476207e339f686e0b8d12887ca9efdb25ed04788..4af992852cc10bd38eede00d4a7c8eabcdbaf755 100644 --- a/DetectorDescription/GeoModel/GeoAdaptors/CMakeLists.txt +++ b/DetectorDescription/GeoModel/GeoAdaptors/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/GeoPrimitives InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetSimEvent LArCalorimeter/LArSimEvent MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry @@ -31,5 +32,5 @@ atlas_add_library( GeoAdaptors PUBLIC_HEADERS GeoAdaptors INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloIdentifier CaloSimEvent Identifier InDetIdentifier InDetReadoutGeometry InDetSimEvent LArSimEvent MuonReadoutGeometry MuonPrepRawData MuonSimEvent CaloDetDescrLib StoreGateLib SGtests MuonIdHelpersLib ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} CaloIdentifier CaloSimEvent Identifier InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry InDetSimEvent LArSimEvent MuonReadoutGeometry MuonPrepRawData MuonSimEvent CaloDetDescrLib StoreGateLib SGtests MuonIdHelpersLib ) diff --git a/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoSiHit.icc b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoSiHit.icc index 2a6c9edbdd74dc7bbcf462a0c602c5e8da67a6c9..807ecad9de3857f628f3556a51d15fb34a571c03 100755 --- a/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoSiHit.icc +++ b/DetectorDescription/GeoModel/GeoAdaptors/GeoAdaptors/GeoSiHit.icc @@ -5,7 +5,7 @@ #include "InDetSimEvent/SiHit.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "StoreGate/StoreGateSvc.h" #include "StoreGate/StoreGate.h" #include "InDetIdentifier/PixelID.h" diff --git a/Event/EventInfoMgt/CMakeLists.txt b/Event/EventInfoMgt/CMakeLists.txt index 87e42df6fb28fa4ef93637b6d476dbc05ecf7e7a..f372b0658a6fa778bfb9d3d81b4f52fea96d620e 100644 --- a/Event/EventInfoMgt/CMakeLists.txt +++ b/Event/EventInfoMgt/CMakeLists.txt @@ -30,7 +30,7 @@ atlas_add_component( EventInfoMgt # Install files from the package: atlas_install_headers( EventInfoMgt ) atlas_install_python_modules( python/*.py ) -atlas_install_joboptions( share/EventInfoMgt_jobOptions.py share/TagInfoMgr_jobOptions.py ) +atlas_install_joboptions( share/EventInfoMgt_jobOptions.py ) atlas_install_scripts( share/dumpRunNumber.py ) atlas_add_test( TagInfoMgrCfg diff --git a/Event/EventPrimitives/EventPrimitives/ATLAS_CHECK_THREAD_SAFETY b/Event/EventPrimitives/EventPrimitives/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..63e4513712dd5d9cbf336714572a03abd9beeaf5 --- /dev/null +++ b/Event/EventPrimitives/EventPrimitives/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Event/EventPrimitives diff --git a/Event/FourMomUtils/FourMomUtils/P4AscendingSorters.h b/Event/FourMomUtils/FourMomUtils/P4AscendingSorters.h index be6b3122de6a3e24e3c3d8ba998f761895de50ef..e3cfbdeb57451b37b8c745aab88bd73bc888c93d 100644 --- a/Event/FourMomUtils/FourMomUtils/P4AscendingSorters.h +++ b/Event/FourMomUtils/FourMomUtils/P4AscendingSorters.h @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // P4AscendingSorters.h @@ -15,30 +15,19 @@ #ifndef XAOD_ANALYSIS // STL includes -#include <functional> // binary_function #include <cmath> -// HepMC / CLHEP includes - // core includes #include "CxxUtils/fpcompare.h" // EventKernel includes #include "EventKernel/I4Momentum.h" -// Forward declaration - namespace P4Sorters { -typedef std::binary_function< const I4Momentum*, - const I4Momentum*, - bool - > - I4MomPredicate_t; - namespace Ascending { -class Px : public I4MomPredicate_t +class Px { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -46,7 +35,7 @@ public: } }; -class Py : public I4MomPredicate_t +class Py { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -54,7 +43,7 @@ public: } }; -class Pz : public I4MomPredicate_t +class Pz { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -63,7 +52,7 @@ public: }; -class Mass : public I4MomPredicate_t +class Mass { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -71,7 +60,7 @@ public: } }; -class MassSquared : public I4MomPredicate_t +class MassSquared { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -79,7 +68,7 @@ public: } }; -class Momentum : public I4MomPredicate_t +class Momentum { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -87,7 +76,7 @@ public: } }; -class MomentumSquared : public I4MomPredicate_t +class MomentumSquared { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -95,7 +84,7 @@ public: } }; -class Eta : public I4MomPredicate_t +class Eta { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -103,7 +92,7 @@ public: } }; -class AbsEta : public I4MomPredicate_t +class AbsEta { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -112,16 +101,7 @@ public: } }; -// not yet... -// class Phi : public I4MomPredicate_t -// { -// public: -// bool operator()( const I4Momentum* a, const I4Momentum* b ) { -// return CxxUtils::fpcompare::less( a->phi(), b->phi() ); -// } -// }; - -class Ene : public I4MomPredicate_t +class Ene { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -129,7 +109,7 @@ class Ene : public I4MomPredicate_t } }; -class Et : public I4MomPredicate_t +class Et { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -137,7 +117,7 @@ public: } }; -class Pt : public I4MomPredicate_t +class Pt { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -145,7 +125,7 @@ public: } }; -class InvPt : public I4MomPredicate_t +class InvPt { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -154,7 +134,7 @@ public: }; // Are those usefull anyway ?? -class CosTh : public I4MomPredicate_t +class CosTh { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -162,7 +142,7 @@ public: } }; -class SinTh : public I4MomPredicate_t +class SinTh { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -170,7 +150,7 @@ public: } }; -class CotTh : public I4MomPredicate_t +class CotTh { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { diff --git a/Event/FourMomUtils/FourMomUtils/P4DescendingSorters.h b/Event/FourMomUtils/FourMomUtils/P4DescendingSorters.h index db98259eeb3e390516cad43f9a8569b7d4ee702a..137ce9b1c19c9b4e42bdb3725eba02ccac8b59d8 100644 --- a/Event/FourMomUtils/FourMomUtils/P4DescendingSorters.h +++ b/Event/FourMomUtils/FourMomUtils/P4DescendingSorters.h @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // P4DescendingSorters.h @@ -15,29 +15,19 @@ #ifndef XAOD_ANALYSIS // STL includes -#include <functional> // binary_function #include <cmath> -// HepMC / CLHEP includes - // core includes #include "CxxUtils/fpcompare.h" // EventKernel includes #include "EventKernel/I4Momentum.h" -// Forward declaration - namespace P4Sorters { -typedef std::binary_function< const I4Momentum*, - const I4Momentum*, - bool - > - I4MomPredicate_t; namespace Descending { -class Px : public I4MomPredicate_t +class Px { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -45,7 +35,7 @@ public: } }; -class Py : public I4MomPredicate_t +class Py { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -53,7 +43,7 @@ public: } }; -class Pz : public I4MomPredicate_t +class Pz { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -62,7 +52,7 @@ public: }; -class Mass : public I4MomPredicate_t +class Mass { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -70,7 +60,7 @@ public: } }; -class MassSquared : public I4MomPredicate_t +class MassSquared { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -78,7 +68,7 @@ public: } }; -class Momentum : public I4MomPredicate_t +class Momentum { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -86,7 +76,7 @@ public: } }; -class MomentumSquared : public I4MomPredicate_t +class MomentumSquared { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -94,7 +84,7 @@ public: } }; -class Eta : public I4MomPredicate_t +class Eta { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -102,7 +92,7 @@ public: } }; -class AbsEta : public I4MomPredicate_t +class AbsEta { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -111,16 +101,7 @@ public: } }; -// not yet... -// class Phi : public I4MomPredicate_t -// { -// public: -// bool operator()( const I4Momentum* a, const I4Momentum* b ) { -// return CxxUtils::fpcompare::greater( a->phi(), b->phi() ); -// } -// }; - -class Ene : public I4MomPredicate_t +class Ene { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -128,7 +109,7 @@ class Ene : public I4MomPredicate_t } }; -class Et : public I4MomPredicate_t +class Et { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -136,7 +117,7 @@ public: } }; -class Pt : public I4MomPredicate_t +class Pt { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -144,7 +125,7 @@ public: } }; -class InvPt : public I4MomPredicate_t +class InvPt { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -153,7 +134,7 @@ public: }; // Are those usefull anyway ?? -class CosTh : public I4MomPredicate_t +class CosTh { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -161,7 +142,7 @@ public: } }; -class SinTh : public I4MomPredicate_t +class SinTh { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { @@ -169,7 +150,7 @@ public: } }; -class CotTh : public I4MomPredicate_t +class CotTh { public: bool operator()( const I4Momentum* a, const I4Momentum* b ) const { diff --git a/Event/NavFourMom/NavFourMom/INav4MomAssocs.h b/Event/NavFourMom/NavFourMom/INav4MomAssocs.h index b6276c6e0a45503f83d363b278f69020ceb22643..8419a2eb566f7a8568a8099298793dd8e6e2fd80 100644 --- a/Event/NavFourMom/NavFourMom/INav4MomAssocs.h +++ b/Event/NavFourMom/NavFourMom/INav4MomAssocs.h @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // INav4MomAssocs.h @@ -25,6 +25,7 @@ #include "NavFourMom/INav4MomLinkContainer.h" #include "CxxUtils/checker_macros.h" // Forward declaration +#include "AthContainers/ConstDataVector.h" class INav4MomAssocs : public AssociationMap< INavigable4MomentumCollection, INavigable4MomentumCollection > @@ -62,8 +63,8 @@ class INav4MomAssocs : public AssociationMap< INavigable4MomentumCollection, /** Retrieve all the associated-to objects which have been associated * to the given \param object */ - bool assocs ATLAS_NOT_CONST_THREAD_SAFE ( const INavigable4Momentum* object, - INavigable4MomentumCollection& assocs ) const; + bool assocs ( const INavigable4Momentum* object, + ConstDataVector<INavigable4MomentumCollection>& assocs ) const; /** Retrieve all the associated-to ElementLinks_to_objects which have * been associated to the given \param objectLink diff --git a/Event/NavFourMom/src/INav4MomAssocs.cxx b/Event/NavFourMom/src/INav4MomAssocs.cxx index 3ff2febdf5119ab4f7007a0ac86114745f1c7b8f..1a8130aada499b7227637d79183483f94605be11 100644 --- a/Event/NavFourMom/src/INav4MomAssocs.cxx +++ b/Event/NavFourMom/src/INav4MomAssocs.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -51,8 +51,8 @@ INav4MomAssocs& INav4MomAssocs::operator=(const INav4MomAssocs& rhs) /////////////////////////////////////////////////////////////////// bool -INav4MomAssocs::assocs ATLAS_NOT_CONST_THREAD_SAFE ( const INavigable4Momentum* object, - INavigable4MomentumCollection& associatedElems ) const +INav4MomAssocs::assocs ( const INavigable4Momentum* object, + ConstDataVector<INavigable4MomentumCollection>& associatedElems ) const { if ( 0 == object ) { return false; diff --git a/Event/xAOD/xAODCaloEvent/Root/CaloClusterAccessors_v1.cxx b/Event/xAOD/xAODCaloEvent/Root/CaloClusterAccessors_v1.cxx index 3a8d455d0c3bd6d2e228f74db0e6033442bf03d7..0a3353663d6450f8aaaaad3af0ac8700533add0c 100644 --- a/Event/xAOD/xAODCaloEvent/Root/CaloClusterAccessors_v1.cxx +++ b/Event/xAOD/xAODCaloEvent/Root/CaloClusterAccessors_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: CaloClusterAccessors_v1.cxx 794609 2017-01-30 15:51:25Z menke $ @@ -147,7 +147,7 @@ namespace xAOD { default: std::cerr << "xAOD::CaloCluster_v1 ERROR Unknown moment (" << moment << ") requested" << std::endl; - return 0; + return nullptr; } } } // namespace xAOD diff --git a/Event/xAOD/xAODCaloEvent/Root/CaloCluster_v1.cxx b/Event/xAOD/xAODCaloEvent/Root/CaloCluster_v1.cxx index a72774e74a77af85117ac4a9f021718554201ec4..4a58e8f355d35bd77d17f2e8f1db6f62140d94d0 100644 --- a/Event/xAOD/xAODCaloEvent/Root/CaloCluster_v1.cxx +++ b/Event/xAOD/xAODCaloEvent/Root/CaloCluster_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: CaloCluster_v1.cxx 783594 2016-11-11 05:03:25Z ssnyder $ @@ -52,7 +52,9 @@ namespace xAOD { CaloCluster_v1& CaloCluster_v1::operator=(const xAOD::CaloCluster_v1& other) { - if (this == &other) return *this; + if (this == &other) { + return *this; + } SG::AuxElement::operator=( other ); //Call assignment operator of base-class m_recoStatus=other.m_recoStatus; @@ -106,15 +108,17 @@ namespace xAOD { allAcc.end(); for( ; acc_itr != acc_end; ++acc_itr ) { if( ( *acc_itr )->isAvailable( *this ) ) { - if( ( **acc_itr )( *this ).size() > 0 ) { - if (clearSamplingVars) - ( **acc_itr )( *this ).clear(); - else + if ((**acc_itr)(*this).size() > 0) { + if (clearSamplingVars){ + (**acc_itr)(*this).clear(); + } + else{ std::cerr << "CaloCluster_v1 ERROR Attempt update sampling " << "pattern while sampling variables are already set!" << std::endl; + } //std::abort(); - } + } } } #else @@ -123,15 +127,17 @@ namespace xAOD { &phisizeAcc } }; for( auto a : allAcc ) { if( a->isAvailable( *this ) ) { - if( ( *a )( *this ).size() > 0 ) { - if (clearSamplingVars) - (*a)(*this).clear(); - else + if (!(*a)(*this).empty()) { + if (clearSamplingVars){ + (*a)(*this).clear(); + } + else{ std::cerr << "CaloCluster_v1 ERROR Attempt update sampling " << "pattern while sampling variables are already set!" << std::endl; + } //std::abort(); - } + } } } #endif // C++11 @@ -301,8 +307,7 @@ namespace xAOD { void CaloCluster_v1::setBadChannelList(const CaloClusterBadChannelList& bcl) { static const Accessor<xAOD::CaloClusterBadChannelList> accBCL("BadChannelList"); accBCL(*this)=bcl; - return; - } + } const CaloClusterBadChannelList& CaloCluster_v1::badChannelList() const { static const Accessor<xAOD::CaloClusterBadChannelList> accBCL("BadChannelList"); @@ -414,8 +419,7 @@ namespace xAOD { default: break; } - return; - } + } void CaloCluster_v1::setEta(CaloCluster_v1::flt_t theEta) { switch (m_signalState) { @@ -431,8 +435,7 @@ namespace xAOD { default: break; } - return; - } + } void CaloCluster_v1::setPhi(CaloCluster_v1::flt_t thePhi) { switch (m_signalState) { @@ -448,8 +451,7 @@ namespace xAOD { default: break; } - return; - } + } void CaloCluster_v1::setM(CaloCluster_v1::flt_t theM) { @@ -466,8 +468,7 @@ namespace xAOD { default: break; } - return; - } + } bool CaloCluster_v1::setSignalState( CaloCluster_v1::State s) { m_signalState=s; @@ -529,7 +530,7 @@ namespace xAOD { if (idx<vec.size() ) { return vec[idx]; } - else + //std::cout <<Sampling " << sampling << ", Pattern=" << std::hex <<m_samplingPattern << std::dec << ", index=" << idx << " size=" << vec.size() << std::endl; return errorvalue; } @@ -563,9 +564,10 @@ namespace xAOD { float CaloCluster_v1::etaSample(const CaloSample sampling) const { static const Accessor< std::vector <float > > etaAcc("eta_sampl"); - if (!etaAcc.isAvailable( *this )) + if (!etaAcc.isAvailable( *this )){ return -999; - else + } + return getSamplVarFromAcc(etaAcc,sampling); } @@ -577,9 +579,10 @@ namespace xAOD { float CaloCluster_v1::phiSample(const CaloSample sampling) const { static const Accessor< std::vector <float > > phiAcc("phi_sampl"); - if (!phiAcc.isAvailable( *this )) + if (!phiAcc.isAvailable( *this )){ return -999; - else + } + return getSamplVarFromAcc(phiAcc,sampling); } @@ -592,9 +595,9 @@ namespace xAOD { float CaloCluster_v1::energy_max(const CaloSample sampling) const { static const Accessor< std::vector <float > > emaxAcc("emax_sampl"); - if (!emaxAcc.isAvailable( *this )) + if (!emaxAcc.isAvailable( *this )){ return 0.0; - else + } return getSamplVarFromAcc(emaxAcc,sampling,0.0); //Return energy 0 in case of failure (eg. sampling not set) } @@ -605,9 +608,9 @@ namespace xAOD { float CaloCluster_v1::etamax(const CaloSample sampling) const { static const Accessor< std::vector <float > > etamaxAcc("etamax_sampl"); - if (!etamaxAcc.isAvailable( *this )) + if (!etamaxAcc.isAvailable( *this )){ return -999; - else + } return getSamplVarFromAcc(etamaxAcc,sampling); } @@ -618,9 +621,9 @@ namespace xAOD { float CaloCluster_v1::phimax(const CaloSample sampling) const { static const Accessor< std::vector <float > > phimaxAcc("phimax_sampl"); - if (!phimaxAcc.isAvailable( *this )) + if (!phimaxAcc.isAvailable( *this )){ return -999; - else + } return getSamplVarFromAcc(phimaxAcc,sampling); } @@ -632,10 +635,10 @@ namespace xAOD { float CaloCluster_v1::etasize(const CaloSample sampling) const { static const Accessor< std::vector <float > > etasizeAcc("etasize_sampl"); - if (!etasizeAcc.isAvailable( *this )) + if (!etasizeAcc.isAvailable( *this )){ return -999; - else - return getSamplVarFromAcc(etasizeAcc,sampling); + } + return getSamplVarFromAcc(etasizeAcc, sampling); } bool CaloCluster_v1::setEtasize(const CaloSample sampling, const float etaSize ) { @@ -645,9 +648,9 @@ namespace xAOD { float CaloCluster_v1::phisize(const CaloSample sampling) const { static const Accessor< std::vector <float > > phisizeAcc("phisize_sampl"); - if (!phisizeAcc.isAvailable( *this )) + if (!phisizeAcc.isAvailable( *this )){ return -999; - else + } return getSamplVarFromAcc(phisizeAcc,sampling); } @@ -672,7 +675,7 @@ namespace xAOD { } float CaloCluster_v1::etaBE(const unsigned sample) const { - if (sample>3) return -999; + if (sample>3) {return -999;} const CaloSample barrelSample=(CaloSample)(CaloSampling::PreSamplerB+sample); const CaloSample endcapSample=(CaloSample)(CaloSampling::PreSamplerE+sample); const bool haveBarrel=this->hasSampling(barrelSample); @@ -687,24 +690,23 @@ namespace xAOD { float eSum=eBarrel + eEndcap; if (eSum > 100 /*MeV*/) { //E-weighted average ... - return (eBarrel * etaBarrel + eEndcap * etaEndcap ) / (eBarrel + eEndcap); + return (eBarrel * etaBarrel + eEndcap * etaEndcap) / (eBarrel + eEndcap); }//else eSum==0 case, should never happen - return (0.5*(etaBarrel+etaEndcap)); + return (0.5 * (etaBarrel + etaEndcap)); } - if (haveBarrel) { + if (haveBarrel) { return etaSample(barrelSample); } if (haveEndcap) { return etaSample(endcapSample); } - + //Should never reach this point ... return -999; } - float CaloCluster_v1::phiBE(const unsigned sample) const { - if (sample>3) return -999; + if (sample>3) {return -999;} const CaloSample barrelSample=(CaloSample)(CaloSampling::PreSamplerB+sample); const CaloSample endcapSample=(CaloSample)(CaloSampling::PreSamplerE+sample); const bool haveBarrel=this->hasSampling(barrelSample); @@ -716,14 +718,12 @@ namespace xAOD { float eSum=eBarrel+eEndcap; float phiBarrel=phiSample(barrelSample); float phiEndcap=phiSample(endcapSample); - static CaloPhiRange phiRange; - if (eSum!=0.0) { - float phiSum = eSum * phiBarrel + eEndcap * phiRange.diff(phiEndcap,phiBarrel); - return phiRange.fix(phiSum/(eBarrel+eEndcap)); - } - else {// energy==0 case, should never happen - return phiRange.fix(0.5*(phiBarrel+phiEndcap)); + if (eSum != 0.0) { + float phiSum = eSum * phiBarrel + eEndcap * CaloPhiRange::diff(phiEndcap, phiBarrel); + return CaloPhiRange::fix(phiSum / (eBarrel + eEndcap)); } + // energy==0 case, should never happen + return CaloPhiRange::fix(0.5 * (phiBarrel + phiEndcap)); } if (haveBarrel) { return phiSample(barrelSample); @@ -731,7 +731,7 @@ namespace xAOD { if (haveEndcap) { return phiSample(endcapSample); } - + //Should never reach this point ... return -999; } @@ -750,44 +750,45 @@ namespace xAOD { #if __cplusplus < 201100 static std::vector< Accessor< std::vector< float > >* > allAcc; - if( ! allAcc.size() ) { - allAcc.push_back( &etaAcc ); - allAcc.push_back( &phiAcc ); - allAcc.push_back( &eAcc ); - allAcc.push_back( &emaxAcc ); - allAcc.push_back( &phimaxAcc ); - allAcc.push_back( &etamaxAcc ); - allAcc.push_back( &etasizeAcc ); - allAcc.push_back( &phisizeAcc ); + if (!allAcc.size()) { + allAcc.push_back(&etaAcc); + allAcc.push_back(&phiAcc); + allAcc.push_back(&eAcc); + allAcc.push_back(&emaxAcc); + allAcc.push_back(&phimaxAcc); + allAcc.push_back(&etamaxAcc); + allAcc.push_back(&etasizeAcc); + allAcc.push_back(&phisizeAcc); } std::vector< Accessor< std::vector< float > >* >::iterator acc_itr = allAcc.begin(); std::vector< Accessor< std::vector< float > >* >::iterator acc_end = allAcc.end(); - for( ; acc_itr != acc_end; ++acc_itr ) { - if( ( *acc_itr )->isAvailableWritable( *this ) ) { - ( **acc_itr )( *this ).clear(); - } + for (; acc_itr != acc_end; ++acc_itr) { + if ((*acc_itr)->isAvailableWritable(*this)) { + (**acc_itr)(*this).clear(); + } } #else static const std::array< const Accessor< std::vector< float > >*, 8 > allAcc = { { &etaAcc, &phiAcc, &eAcc, &emaxAcc, &phimaxAcc, &etamaxAcc, &etasizeAcc, &phisizeAcc } }; - for( auto a : allAcc ) { - if( a->isAvailableWritable( *this ) ) { - ( *a )( *this ).clear(); - } + for (auto a : allAcc) { + if (a->isAvailableWritable(*this)) { + (*a)(*this).clear(); + } } #endif // C++11 - return; - } + } bool CaloCluster_v1::retrieveMoment( MomentType type, double& value ) const { // Get the moment accessor: const Accessor< float >* acc = momentAccessorV1( type ); - if( ! acc ) return false; + if (!acc){ + return false; + } // Check if the moment is available: if( ! acc->isAvailable( *this ) ) { return false; @@ -800,8 +801,7 @@ namespace xAOD { void CaloCluster_v1::insertMoment( MomentType type, double value ) { ( *( momentAccessorV1( type ) ) )( *this ) = value; - return; - } + } /** for debugging only ... @@ -871,7 +871,9 @@ namespace xAOD { bool CaloCluster_v1::setLink(CaloClusterCellLinkContainer* cccl, IProxyDict* sg /*= nullptr*/) { - if (!m_cellLinks || !cccl) return false; + if (!m_cellLinks || !cccl){ + return false; + } cccl->push_back(m_cellLinks.release());//The links are now owned by the container const size_t idx=cccl->size()-1; //Use index for speed static const Accessor<ElementLink<CaloClusterCellLinkContainer> > accCellLinks("CellLink"); @@ -881,23 +883,32 @@ namespace xAOD { return true; } - const CaloClusterCellLink* CaloCluster_v1::getCellLinks() const { - if (m_cellLinks) return m_cellLinks.get(); + const CaloClusterCellLink* + CaloCluster_v1::getCellLinks() const + { + if (m_cellLinks) { + return m_cellLinks.get(); + } static const Accessor<ElementLink<CaloClusterCellLinkContainer> > accCellLinks("CellLink"); - if (!accCellLinks.isAvailable(*this)) return 0; + if (!accCellLinks.isAvailable(*this)){ + return nullptr; + } ElementLink<CaloClusterCellLinkContainer> el=accCellLinks(*this); - if (el.isValid()) + if (el.isValid()){ return *el; - else - return 0; + } + + return nullptr; } bool CaloCluster_v1::removeCell(const CaloCell* ptrToDelete) { //1. Get a ptr to the CaloClusterCellLink CaloClusterCellLink* cccl=getOwnCellLinks(); - if (!cccl) return false; //No link found (expected for TopoClusters in xAOD files) - //2. Remove cell + if (!cccl){ + return false; // No link found (expected for TopoClusters in xAOD files) + } + // 2. Remove cell return cccl->removeCell(ptrToDelete); } @@ -923,24 +934,26 @@ namespace xAOD { } // Return gracefully: - return; - } + } const CaloCluster_v1* CaloCluster_v1::getSisterCluster() const { static const Accessor< ElementLink< xAOD::CaloClusterContainer_v1 > > accSisterCluster("SisterCluster"); - if (!accSisterCluster.isAvailable(*this)) return 0; - ElementLink<CaloClusterContainer_v1> el=accSisterCluster(*this); - if (el.isValid()) + if (!accSisterCluster.isAvailable(*this)){ + return nullptr; + } + ElementLink<CaloClusterContainer_v1> el = accSisterCluster(*this); + if (el.isValid()) { return *el; - else - return 0; + } + return nullptr; } const ElementLink<xAOD::CaloClusterContainer_v1>& CaloCluster_v1::getSisterClusterLink() const { static const Accessor< ElementLink< xAOD::CaloClusterContainer_v1 > > accSisterCluster("SisterCluster"); static const ElementLink<xAOD::CaloClusterContainer_v1> empty; - if (!accSisterCluster.isAvailable(*this)) + if (!accSisterCluster.isAvailable(*this)){ return empty; + } return accSisterCluster(*this); } diff --git a/Event/xAOD/xAODCaloEvent/src/CaloClusterKineHelper.cxx b/Event/xAOD/xAODCaloEvent/src/CaloClusterKineHelper.cxx index d551adf0229e71f990e67295f1959b2a080cd661..592ab047a04854fc9a8630a0d3fe4bbca2ec741d 100644 --- a/Event/xAOD/xAODCaloEvent/src/CaloClusterKineHelper.cxx +++ b/Event/xAOD/xAODCaloEvent/src/CaloClusterKineHelper.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef SIMULATIONBASE @@ -300,8 +300,7 @@ void CaloClusterKineHelper::calculateKine(xAOD::CaloCluster* clu, const bool use clu->setPhimax(sam,accum.PhiMaxEnergyInSample[i]); } - return; -} + } #endif //not XAOD_ANALYSIS #endif //not SIMULATIONBASE diff --git a/Event/xAOD/xAODCaloEvent/xAODCaloEvent/versions/CaloCluster_v1.h b/Event/xAOD/xAODCaloEvent/xAODCaloEvent/versions/CaloCluster_v1.h index 1098f7967d9dbfb8889a7aeafdd328a9a3736481..44792973ed33fa1025856274762dc732b8d62517 100644 --- a/Event/xAOD/xAODCaloEvent/xAODCaloEvent/versions/CaloCluster_v1.h +++ b/Event/xAOD/xAODCaloEvent/xAODCaloEvent/versions/CaloCluster_v1.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: CaloCluster_v1.h 794609 2017-01-30 15:51:25Z menke $ @@ -654,8 +654,10 @@ namespace xAOD { * @return true if the link to the CaloClusterCellLinkContainer exists, false otherwise */ bool addCell(const unsigned index, const double weight) { - if (!m_cellLinks) return false; - return m_cellLinks->addCell(index,weight); + if (!m_cellLinks) { + return false; + } + return m_cellLinks->addCell(index, weight); } /**@brief Method to remove a cell to the cluster (slow!) (Beware: Kinematics not updated!) @@ -670,25 +672,26 @@ namespace xAOD { /**@brief size method (forwarded from CaloClusterCellLink obj) *@return The number of cells */ - size_t size() const {return getCellLinks()->size();} - - ///Iterator of the underlying CaloClusterCellLink (explicitly const version) - typedef CaloClusterCellLink::const_iterator const_cell_iterator; - //Fixme: Check ret-val of getCellLinks (might be NULL); - const_cell_iterator cell_cbegin() const { - const CaloClusterCellLink* links=getCellLinks(); - if (!links) - return CaloClusterCellLink::dummyIt; - else - return links->begin(); - } + size_t size() const { return getCellLinks()->size(); } + + /// Iterator of the underlying CaloClusterCellLink (explicitly const version) + typedef CaloClusterCellLink::const_iterator const_cell_iterator; + // Fixme: Check ret-val of getCellLinks (might be NULL); + const_cell_iterator cell_cbegin() const + { + const CaloClusterCellLink* links = getCellLinks(); + if (!links) { + return CaloClusterCellLink::dummyIt; + } + return links->begin(); + } const_cell_iterator cell_cend() const { const CaloClusterCellLink* links=getCellLinks(); - if (!links) + if (!links) { return CaloClusterCellLink::dummyIt; - else + } return getCellLinks()->end(); - } + } ///Iterator of the underlying CaloClusterCellLink (const version) const_cell_iterator cell_begin() const { return cell_cbegin(); } @@ -736,9 +739,10 @@ namespace xAOD { inline double CaloCluster_v1::et() const { - if (this->m()==0) + if (this->m() == 0) { return this->pt(); - else + } + return this->p4().Et(); } @@ -749,16 +753,17 @@ namespace xAOD { inline unsigned CaloCluster_v1::sampVarIdx(const CaloCluster_v1::CaloSample s) const { const uint32_t& pattern= m_samplingPattern; //std::cout << "Pattern=" << std::hex << pattern << std::dec << ", Sampling=" << s << std::endl; - if ((pattern & (0x1U << s))==0) + if ((pattern & (0x1U << s)) == 0) { return CaloSampling::Unknown; - else { - if (s==0) return 0; //shifting a 32-bit int by 32 bits is undefined behavior! - return __builtin_popcount(pattern << (32-s)); - //Explanation: Need to get the number of bit (=samples) before the sampling in question - //Shift to the left, so bits after the sampling in question fall off the 32bit integer - //Then use gcc builtin popcount to count the numbers of 1 in the rest - //AFAIK, this builtin is available for gcc, icc and clang (as well on ARM) } + if (s == 0) { + return 0; + } // shifting a 32-bit int by 32 bits is undefined behavior! + return __builtin_popcount(pattern << (32 - s)); + // Explanation: Need to get the number of bit (=samples) before the sampling in question + // Shift to the left, so bits after the sampling in question fall off the 32bit integer + // Then use gcc builtin popcount to count the numbers of 1 in the rest + // AFAIK, this builtin is available for gcc, icc and clang (as well on ARM) } diff --git a/Event/xAOD/xAODCaloEvent/xAODCaloEvent/versions/CaloTowerContainer_v1.h b/Event/xAOD/xAODCaloEvent/xAODCaloEvent/versions/CaloTowerContainer_v1.h index 7dcc69ccec15f3b1235375eb67fdb1ce14627ef0..6e519878789e6a0a17e609c08a62a8808c04fa34 100644 --- a/Event/xAOD/xAODCaloEvent/xAODCaloEvent/versions/CaloTowerContainer_v1.h +++ b/Event/xAOD/xAODCaloEvent/xAODCaloEvent/versions/CaloTowerContainer_v1.h @@ -1,7 +1,7 @@ // -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef XAODCALOEVENT_VERSIONS_CALOTOWERCONTAINER_V1_H @@ -156,9 +156,10 @@ inline double xAOD::CaloTowerContainer_v1::deltaPhi() const { return m_deltaPhi; inline const xAOD::CaloTower_v1* xAOD::CaloTowerContainer_v1::tower(double eta, double phi) const { int idx=index(eta,phi); - if (idx>0 && idx<(int)this->size()) + if (idx>0 && idx<(int)this->size()) { return (*this)[idx]; - else + } + return nullptr; } diff --git a/Event/xAOD/xAODEgamma/Root/EgammaAccessors_v1.cxx b/Event/xAOD/xAODEgamma/Root/EgammaAccessors_v1.cxx index 43765c553164448f62b3371ee45ad025be8540ca..4a7f7f574aef191ad3ae81bb77fdb64383acdf7e 100644 --- a/Event/xAOD/xAODEgamma/Root/EgammaAccessors_v1.cxx +++ b/Event/xAOD/xAODEgamma/Root/EgammaAccessors_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: EgammaAccessors_v1.cxx 741489 2016-04-20 01:30:34Z christos $ @@ -73,7 +73,7 @@ namespace xAOD { default: std::cerr << "xAOD::Egamma ERROR Unknown float ShowerShapeType (" << type << ") requested" << std::endl; - return 0; + return nullptr; } } @@ -92,7 +92,7 @@ namespace xAOD { default: std::cerr << "xAOD::Egamma ERROR Unknown char ElectronSelectionMenu (" << menu << ") requested" << std::endl; - return 0; + return nullptr; } } @@ -110,7 +110,7 @@ namespace xAOD { default: std::cerr << "xAOD::Egamma ERROR Unknown unsigned int ElectronSelectionisEM (" << isEM << ") requested" << std::endl; - return 0; + return nullptr; } } diff --git a/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx b/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx index 34a0d07c2c54f9a0c364729cf9a31b13001a1b3c..0d3506586a3d243b5d929ff76638815ee8f646de 100644 --- a/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx +++ b/Event/xAOD/xAODEgamma/Root/EgammaTruthxAODHelpers.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "xAODEgamma/EgammaTruthxAODHelpers.h" @@ -54,10 +54,10 @@ const xAOD::TruthParticle* xAOD::EgammaHelpers::getBkgElectronMother(const xAOD: const xAOD::TruthParticle* xAOD::EgammaHelpers::getBkgElectronMother(const xAOD::TruthParticle* truthel, const int barcodecut/*=0*/){ std::vector<const xAOD::TruthParticle*> vec = xAOD::EgammaHelpers::getBkgElectronLineage(truthel,barcodecut); - if(vec.size()>0){ + if(!vec.empty()){ return vec.back(); } - return 0; + return nullptr; } std::vector<const xAOD::TruthParticle*> diff --git a/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx b/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx index 2f92fb7928f51f8f8282ff81137616dab9e903c5..32ef4d44e6252e30783f2ca3e805401e63dd98cb 100644 --- a/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx +++ b/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: Egamma_v1$ @@ -189,7 +189,7 @@ const Egamma_v1* Egamma_v1::ambiguousObject() const{ if(acc.isAvailable(*this) && acc(*this).isValid()){ return (*acc(*this)); } - return 0; + return nullptr; } @@ -378,11 +378,11 @@ size_t Egamma_v1::nCaloClusters() const { const xAOD::CaloCluster* Egamma_v1::caloCluster( size_t index ) const { if( index >= nCaloClusters() ) { - return 0; + return nullptr; } const CLELVec_t& cls = caloClusterLinks(); if( ! cls[ index ].isValid() ) { - return 0; + return nullptr; } return *( cls[ index ] ); } @@ -423,7 +423,6 @@ bool Egamma_v1::passSelection(const xAOD::EgammaParameters::SelectionMenu menu void Egamma_v1::setPassSelection(bool value, const xAOD::EgammaParameters::SelectionMenu menu){ const SG::AuxElement::Accessor< char >* acc = selectionMenuAccessorV1( menu ); ( *acc )(*this)=value; - return; } bool Egamma_v1::selectionisEM(unsigned int& value, const xAOD::EgammaParameters::SelectionisEM isEM) const { @@ -447,7 +446,6 @@ unsigned int Egamma_v1::selectionisEM(const xAOD::EgammaParameters::SelectionisE void Egamma_v1::setSelectionisEM(unsigned int value, const xAOD::EgammaParameters::SelectionisEM isEM){ const SG::AuxElement::Accessor< unsigned int >* acc = selectionisEMAccessorV1( isEM ); ( *acc )(*this)=value; - return; } ///Then with strings (full flexibility when adding new menus dynamically) @@ -468,7 +466,6 @@ bool Egamma_v1::passSelection(const std::string& menu ) const { void Egamma_v1::setPassSelection(bool value, const std::string& menu){ const SG::AuxElement::Accessor< char > acc( menu ); acc(*this)=value; - return; } bool Egamma_v1::selectionisEM(unsigned int& value, const std::string& isEM) const{ @@ -488,7 +485,6 @@ unsigned int Egamma_v1::selectionisEM(const std::string& isEM) const{ void Egamma_v1::setSelectionisEM(unsigned int value, const std::string& isEM){ const SG::AuxElement::Accessor< unsigned int > acc( isEM ); acc(*this)=value; - return; } bool Egamma_v1::likelihoodValue(float& value, const std::string& LHValue/*=std::string("LHValue")*/) const{ @@ -508,7 +504,6 @@ float Egamma_v1::likelihoodValue(const std::string& LHValue/*=std::string("LHVal void Egamma_v1::setLikelihoodValue(float value, const std::string& LHValue/*=std::string("LHValue")*/){ const SG::AuxElement::Accessor<float> acc( LHValue); acc(*this)=value; - return; } } // namespace xAOD diff --git a/Event/xAOD/xAODEgamma/Root/EgammaxAODHelpers.cxx b/Event/xAOD/xAODEgamma/Root/EgammaxAODHelpers.cxx index a5a99bf85b65ba0bdb8c17bd694a581c7c83d314..07521ae53957bd19e3b99eba3d16d7be415a1156 100644 --- a/Event/xAOD/xAODEgamma/Root/EgammaxAODHelpers.cxx +++ b/Event/xAOD/xAODEgamma/Root/EgammaxAODHelpers.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "xAODEgamma/EgammaxAODHelpers.h" @@ -42,7 +42,7 @@ bool xAOD::EgammaHelpers::isBarrel(const xAOD::CaloCluster *cluster){ return cluster->inBarrel(); } // ================================================================== -const std::vector< ElementLink< xAOD::CaloClusterContainer > > xAOD::EgammaHelpers::getAssociatedTopoClustersLinks(const xAOD::CaloCluster *cluster){ +std::vector< ElementLink< xAOD::CaloClusterContainer > > xAOD::EgammaHelpers::getAssociatedTopoClustersLinks(const xAOD::CaloCluster *cluster){ static const SG::AuxElement::Accessor < std::vector< ElementLink< xAOD::CaloClusterContainer > > > caloClusterLinks("constituentClusterLinks"); std::vector< ElementLink< xAOD::CaloClusterContainer > > veclinks; @@ -52,21 +52,21 @@ const std::vector< ElementLink< xAOD::CaloClusterContainer > > xAOD::EgammaHelpe return veclinks; } // ================================================================== -const std::vector<const xAOD::CaloCluster*> xAOD::EgammaHelpers::getAssociatedTopoClusters(const xAOD::CaloCluster *cluster){ +std::vector<const xAOD::CaloCluster*> xAOD::EgammaHelpers::getAssociatedTopoClusters(const xAOD::CaloCluster *cluster){ std::vector< const xAOD::CaloCluster* > topoclusters; std::vector< ElementLink< xAOD::CaloClusterContainer > > veclinks = xAOD::EgammaHelpers::getAssociatedTopoClustersLinks(cluster); - for (auto i : veclinks){ + for (const auto& i : veclinks){ if(i.isValid()){ topoclusters.push_back(*i); } else{ - topoclusters.push_back(0); + topoclusters.push_back(nullptr); } } return topoclusters; } // ================================================================== -const std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticles(const xAOD::Egamma *eg, +std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticles(const xAOD::Egamma *eg, bool useBremAssoc /* = true */, bool allParticles /* = true */){ @@ -87,7 +87,7 @@ const std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticle return std::set<const xAOD::TrackParticle*>{}; } // ================================================================== -const std::vector<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticlesVec(const xAOD::Egamma *eg, +std::vector<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticlesVec(const xAOD::Egamma *eg, bool useBremAssoc /* = true */, bool allParticles /* = true */){ if (eg) { diff --git a/Event/xAOD/xAODEgamma/Root/ElectronAccessors_v1.cxx b/Event/xAOD/xAODEgamma/Root/ElectronAccessors_v1.cxx index c3a325786fb7c50ca75910069f375f75b8e18f82..16ff095e1305baf07b144ef0f2ac44da0b52a1b0 100644 --- a/Event/xAOD/xAODEgamma/Root/ElectronAccessors_v1.cxx +++ b/Event/xAOD/xAODEgamma/Root/ElectronAccessors_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: ElectronAccessors_v1.cxx 575466 2013-12-13 16:40:29Z amorley $ @@ -41,7 +41,7 @@ namespace xAOD { default: std::cerr << "xAOD::Electron ERROR Unknown float TrackCaloMatchType (" << type << ") requested" << std::endl; - return 0; + return nullptr; } } diff --git a/Event/xAOD/xAODEgamma/Root/Electron_v1.cxx b/Event/xAOD/xAODEgamma/Root/Electron_v1.cxx index 916fbf5aa273982dd5bebf50e8ae0fc27e867940..c1b509b23315b227f7afd8f8b7c1e6cad6734a3f 100644 --- a/Event/xAOD/xAODEgamma/Root/Electron_v1.cxx +++ b/Event/xAOD/xAODEgamma/Root/Electron_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: Electron_v1$ @@ -55,11 +55,11 @@ namespace xAOD { const xAOD::TrackParticle* Electron_v1::trackParticle( size_t index ) const { if( index >= nTrackParticles() ) { - return 0; + return nullptr; } const TPELVec_t& links = trackParticleLinks(); if( ! links[ index ].isValid() ) { - return 0; + return nullptr; } return *( links[ index ] ); } diff --git a/Event/xAOD/xAODEgamma/Root/ElectronxAODHelpers.cxx b/Event/xAOD/xAODEgamma/Root/ElectronxAODHelpers.cxx index 946db52c1e1a35ae2273cb5dcc68f31a8bae8d22..b2bb3c98f080b4b125054b71b87cf21b5235e93f 100644 --- a/Event/xAOD/xAODEgamma/Root/ElectronxAODHelpers.cxx +++ b/Event/xAOD/xAODEgamma/Root/ElectronxAODHelpers.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "xAODEgamma/ElectronxAODHelpers.h" @@ -16,14 +16,14 @@ const xAOD::TrackParticle* xAOD::EgammaHelpers::getOriginalTrackParticle(const x return getOriginalTrackParticleFromGSF(trkPar); } } - return 0; + return nullptr; } // ================================================================== const xAOD::TrackParticle* xAOD::EgammaHelpers::getOriginalTrackParticleFromGSF(const xAOD::TrackParticle* trkPar){ - if(! trkPar) {return 0;} + if(! trkPar) {return nullptr;} static const SG::AuxElement::Accessor<ElementLink<xAOD::TrackParticleContainer> > orig ("originalTrackParticle"); - if (!orig.isAvailable(*trkPar) || !orig(*trkPar).isValid()) {return 0;} + if (!orig.isAvailable(*trkPar) || !orig(*trkPar).isValid()) {return nullptr;} return (*orig(*trkPar)); } @@ -36,7 +36,7 @@ float xAOD::EgammaHelpers::getLastMeasurementQoverP(const xAOD::TrackParticle *t return -999 ; } // ================================================================== -const std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticles(const xAOD::Electron* el, +std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticles(const xAOD::Electron* el, bool useBremAssoc /* = true */, bool allParticles /* = true */){ std::set<const xAOD::TrackParticle*> tps; @@ -49,7 +49,7 @@ const std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticle return tps; } // ================================================================== -const std::vector<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticlesVec(const xAOD::Electron* el, +std::vector<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticlesVec(const xAOD::Electron* el, bool useBremAssoc /* = true */, bool allParticles /* = true */){ @@ -65,7 +65,8 @@ const std::vector<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParti // ================================================================== std::size_t xAOD::EgammaHelpers::numberOfSiHits(const xAOD::TrackParticle *tp){ if (!tp) return 0; - uint8_t dummy(0), nSiHits(0); + uint8_t dummy(0); + uint8_t nSiHits(0); if (tp->summaryValue(dummy, xAOD::numberOfPixelHits)){ nSiHits += dummy; } diff --git a/Event/xAOD/xAODEgamma/Root/PhotonAccessors_v1.cxx b/Event/xAOD/xAODEgamma/Root/PhotonAccessors_v1.cxx index 5ac9490800e71a93bfbff4792b5160499a97d50d..c925cf0f2356c756236628863e6a65dc251d92ee 100644 --- a/Event/xAOD/xAODEgamma/Root/PhotonAccessors_v1.cxx +++ b/Event/xAOD/xAODEgamma/Root/PhotonAccessors_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: PhotonAccessors_v1.cxx 741466 2016-04-19 20:21:49Z christos $ @@ -32,7 +32,7 @@ namespace xAOD { default: std::cerr << "xAOD::Photon ERROR Unknown float VertexCaloMatchType (" << type << ") requested" << std::endl; - return 0; + return nullptr; } } diff --git a/Event/xAOD/xAODEgamma/Root/Photon_v1.cxx b/Event/xAOD/xAODEgamma/Root/Photon_v1.cxx index 58a28431af83894c214f0530ef684f0bd60fd625..cfadcdee82f1719281c2744f26847c9dba7f9f10 100644 --- a/Event/xAOD/xAODEgamma/Root/Photon_v1.cxx +++ b/Event/xAOD/xAODEgamma/Root/Photon_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: Photon_v1.cxx 741489 2016-04-20 01:30:34Z christos $ @@ -46,11 +46,11 @@ namespace xAOD { const xAOD::Vertex* Photon_v1::vertex( size_t index ) const { if( index >= nVertices() ) { - return 0; + return nullptr; } const VxELVec_t& links = vertexLinks(); if( ! links[ index ].isValid() ) { - return 0; + return nullptr; } return *( links[ index ] ); } diff --git a/Event/xAOD/xAODEgamma/Root/PhotonxAODHelpers.cxx b/Event/xAOD/xAODEgamma/Root/PhotonxAODHelpers.cxx index a1631005e031f73863959ab6bc01c1c5a5fe492f..3e2d032d12fc3297b6f4f9d106c084f6ba11ceaa 100644 --- a/Event/xAOD/xAODEgamma/Root/PhotonxAODHelpers.cxx +++ b/Event/xAOD/xAODEgamma/Root/PhotonxAODHelpers.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "xAODEgamma/PhotonxAODHelpers.h" @@ -24,8 +24,8 @@ xAOD::EgammaParameters::ConversionType xAOD::EgammaHelpers::conversionType(const xAOD::EgammaParameters::ConversionType xAOD::EgammaHelpers::conversionType(const xAOD::Vertex *vx){ if (!vx) return xAOD::EgammaParameters::unconverted; - const TrackParticle *trk1 = ( vx->nTrackParticles() ? vx->trackParticle(0) : 0 ); - const TrackParticle *trk2 = ( vx->nTrackParticles() > 1 ? vx->trackParticle(1) : 0 ); + const TrackParticle *trk1 = ( vx->nTrackParticles() ? vx->trackParticle(0) : nullptr ); + const TrackParticle *trk2 = ( vx->nTrackParticles() > 1 ? vx->trackParticle(1) : nullptr ); uint8_t nSiHits1 = numberOfSiHits(trk1); uint8_t nSiHits2 = numberOfSiHits(trk2); @@ -37,7 +37,7 @@ xAOD::EgammaParameters::ConversionType xAOD::EgammaHelpers::conversionType(const if (nSiHits1 && nSiHits2){ return xAOD::EgammaParameters::doubleSi; } - else if (nSiHits1 || nSiHits2){ + if (nSiHits1 || nSiHits2){ return xAOD::EgammaParameters::doubleSiTRT; } else{ @@ -98,14 +98,14 @@ Amg::Vector3D xAOD::EgammaHelpers::momentumAtVertex(const xAOD::Vertex& vertex, accPy(vertex), accPz(vertex)); } - else if (debug){ + if (debug){ std::cout << "Vertex not decorated with momentum" << std::endl; } return Amg::Vector3D(0., 0., 0.); } // ================================================================== -const std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticles(const xAOD::Photon* ph, +std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticles(const xAOD::Photon* ph, bool useBremAssoc /* = true */){ std::set<const xAOD::TrackParticle*> tps; @@ -121,7 +121,7 @@ const std::set<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticle return tps; } // ================================================================== -const std::vector<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticlesVec(const xAOD::Photon* ph, +std::vector<const xAOD::TrackParticle*> xAOD::EgammaHelpers::getTrackParticlesVec(const xAOD::Photon* ph, bool useBremAssoc /* = true */){ std::vector<const xAOD::TrackParticle*> tps; if (!ph) return tps; diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/EgammaTruthxAODHelpers.h b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaTruthxAODHelpers.h index 590fdc990286c3fec13f92081252e038720f7f4e..f09ecd93b143cb41f8a6dabc3ad258c521173397 100644 --- a/Event/xAOD/xAODEgamma/xAODEgamma/EgammaTruthxAODHelpers.h +++ b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaTruthxAODHelpers.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: EgammaTruthxAODHelpers.h 768706 2016-08-18 23:55:25Z christos $ @@ -25,15 +25,15 @@ namespace xAOD { /// @brief Access to element link to object of type T stored in auxdata template<class T> const T* getLink(const xAOD::IParticle* particle, std::string name){ - if (!particle) return 0; + if (!particle) return nullptr; typedef ElementLink< DataVector<T> > Link_t; if (!particle->isAvailable< Link_t >(name) ) { - return 0; + return nullptr; } const Link_t link = particle->auxdata<Link_t>(name); if (!link.isValid()) { - return 0; + return nullptr; } return *link; } diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/EgammaxAODHelpers.h b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaxAODHelpers.h index 8681e432ffa339194816ce3a96eb20b10f87aed8..36d2df46a27b784bb32f03bb7a1f306d8c5a1d0c 100644 --- a/Event/xAOD/xAODEgamma/xAODEgamma/EgammaxAODHelpers.h +++ b/Event/xAOD/xAODEgamma/xAODEgamma/EgammaxAODHelpers.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: EgammaxAODHelpers.h 788453 2016-12-07 15:40:30Z christos $ @@ -46,24 +46,24 @@ namespace xAOD { bool isBarrel(const xAOD::CaloCluster *cluster); ///@brief Return a vector of all the elementlinks to the topo clusters associated with the egamma cluster - const std::vector< ElementLink< xAOD::CaloClusterContainer > > getAssociatedTopoClustersLinks(const xAOD::CaloCluster *cluster); + std::vector< ElementLink< xAOD::CaloClusterContainer > > getAssociatedTopoClustersLinks(const xAOD::CaloCluster *cluster); ///@brief Return a vector of all the topo clusters associated with the egamma cluster - const std::vector<const xAOD::CaloCluster*> getAssociatedTopoClusters(const xAOD::CaloCluster *cluster); + std::vector<const xAOD::CaloCluster*> getAssociatedTopoClusters(const xAOD::CaloCluster *cluster); ///@brief Return a list of all or only the best TrackParticle associated to the object. ///If useBremAssoc is set, get the original TrackParticle ///This is useful when a std::set of the original track Particles is required, which is mainly the case for the //isolation interface, ///as it will re-order the elements in pointer order and not best match. - const std::set<const xAOD::TrackParticle*> getTrackParticles(const xAOD::Egamma *eg, + std::set<const xAOD::TrackParticle*> getTrackParticles(const xAOD::Egamma *eg, bool useBremAssoc = true, bool allParticles = true); ///@brief Return a list of all or only the best TrackParticle associated to the object. ///If useBremAssoc is set, get the original TrackParticle ///This one returns a vector so as to be more "user friendly", as it retains the original ///best match ordering - const std::vector<const xAOD::TrackParticle*> getTrackParticlesVec(const xAOD::Egamma *eg, + std::vector<const xAOD::TrackParticle*> getTrackParticlesVec(const xAOD::Egamma *eg, bool useBremAssoc = true, bool allParticles = true); diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/ElectronxAODHelpers.h b/Event/xAOD/xAODEgamma/xAODEgamma/ElectronxAODHelpers.h index 451c2cec963600f2b8c240d1d08dfab7e9ddc9e6..2d9386fb4c0b1aff51f2e7731c97ce5834a0fa70 100644 --- a/Event/xAOD/xAODEgamma/xAODEgamma/ElectronxAODHelpers.h +++ b/Event/xAOD/xAODEgamma/xAODEgamma/ElectronxAODHelpers.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: ElectronxAODHelpers.h 768704 2016-08-18 23:43:08Z christos $ @@ -31,7 +31,7 @@ namespace xAOD { ///This is useful when a std::set of the original track Particles is required, which is mainly the case for the //isolation interface, ///as it will re-order the elements in pointer order and not best match. - const std::set<const xAOD::TrackParticle*> getTrackParticles(const xAOD::Electron* el, + std::set<const xAOD::TrackParticle*> getTrackParticles(const xAOD::Electron* el, bool useBremAssoc = true, bool allParticles = true); @@ -39,7 +39,7 @@ namespace xAOD { ///If useBremAssoc is set, get the original TrackParticle ///This one returns a vector so as to be more "user friendly",as it retains the original ///best match ordering - const std::vector<const xAOD::TrackParticle*> getTrackParticlesVec(const xAOD::Electron* el, + std::vector<const xAOD::TrackParticle*> getTrackParticlesVec(const xAOD::Electron* el, bool useBremAssoc = true, bool allParticles = true); diff --git a/Event/xAOD/xAODEgamma/xAODEgamma/PhotonxAODHelpers.h b/Event/xAOD/xAODEgamma/xAODEgamma/PhotonxAODHelpers.h index 7752e2ff310e13042a7c83c8df7f1950feb83e52..1e9d92c9a7f0a644fa32cf61d51f413aacb15669 100644 --- a/Event/xAOD/xAODEgamma/xAODEgamma/PhotonxAODHelpers.h +++ b/Event/xAOD/xAODEgamma/xAODEgamma/PhotonxAODHelpers.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef XAOD_PHOTONXAODHELPERS_H @@ -56,14 +56,14 @@ namespace xAOD { ///This is useful when a std::set of the original track Particles is required, which is mainly the case for the //isolation interface, ///as it will re-order the elements in pointer order and not best match. - const std::set<const xAOD::TrackParticle*> getTrackParticles(const xAOD::Photon* ph, + std::set<const xAOD::TrackParticle*> getTrackParticles(const xAOD::Photon* ph, bool useBremAssoc = true); ///@brief Return a list of all or only the best TrackParticle associated to the object. ///If useBremAssoc is set, get the original TrackParticle ///This one returns a vector so as to be more "user friendly",as it retains the original ///best match ordering - const std::vector<const xAOD::TrackParticle*> getTrackParticlesVec(const xAOD::Photon* ph, + std::vector<const xAOD::TrackParticle*> getTrackParticlesVec(const xAOD::Photon* ph, bool useBremAssoc = true); diff --git a/Event/xAOD/xAODEgammaCnv/src/GSFTrackParticleMapCnvAlg.cxx b/Event/xAOD/xAODEgammaCnv/src/GSFTrackParticleMapCnvAlg.cxx index 75439f434b82b8fceb05365cf772617db076ab8d..3107752ee42ef339164ec41665e372b0e57258ff 100644 --- a/Event/xAOD/xAODEgammaCnv/src/GSFTrackParticleMapCnvAlg.cxx +++ b/Event/xAOD/xAODEgammaCnv/src/GSFTrackParticleMapCnvAlg.cxx @@ -9,7 +9,7 @@ #include "Particle/TrackParticleContainer.h" #include "xAODTracking/TrackParticleContainer.h" #include "ParticleEvent/TrackParticleAssocs.h" - +#include "AthContainers/ConstDataVector.h" // Local include(s): #include "GSFTrackParticleMapCnvAlg.h" @@ -89,7 +89,7 @@ namespace xAODMaker { xAOD::TrackParticleContainer::const_iterator xaodEnd = xaodContainerGSF->end(); for ( ; aod != aodEnd && xaod != xaodEnd; ++aod, ++xaod){ - Rec::TrackParticleContainer associatedElems(SG::VIEW_ELEMENTS); + ConstDataVector<Rec::TrackParticleContainer> associatedElems(SG::VIEW_ELEMENTS); if ( !trkassocs->assocs(*aod, associatedElems) ){ ATH_MSG_WARNING("Missing link from GSF track particle to original TP"); diff --git a/Event/xAOD/xAODEventInfoCnv/python/xAODEventInfoCnvConfig.py b/Event/xAOD/xAODEventInfoCnv/python/xAODEventInfoCnvConfig.py index 8781e1415e1955cf1231334af001cfb17d8cfe17..6dfbf652b9f3c1cab38b1ee6edcb3eba968317a7 100644 --- a/Event/xAOD/xAODEventInfoCnv/python/xAODEventInfoCnvConfig.py +++ b/Event/xAOD/xAODEventInfoCnv/python/xAODEventInfoCnvConfig.py @@ -77,7 +77,15 @@ def EventInfoOverlayCfg(flags, **kwargs): # Check if running on legacy HITS if "EventInfo" not in flags.Input.Collections and "EventInfo" not in flags.Input.SecondaryCollections: - acc.merge(EventInfoCnvAlgCfg(flags, outputKey=flags.Overlay.SigPrefix+"EventInfo", **kwargs)) + acc.merge(EventInfoCnvAlgCfg(flags, + inputKey=flags.Overlay.SigPrefix+"McEventInfo", + outputKey=flags.Overlay.SigPrefix+"EventInfo", + **kwargs)) + # Re-map signal address + from SGComps.AddressRemappingConfig import AddressRemappingCfg + acc.merge(AddressRemappingCfg([ + "EventInfo#McEventInfo->" + flags.Overlay.SigPrefix + "McEventInfo", + ])) acc.merge(EventInfoOverlayAlgCfg(flags, **kwargs)) acc.merge(EventInfoOverlayOutputCfg(flags, **kwargs)) diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoOverlay.cxx b/Event/xAOD/xAODEventInfoCnv/src/EventInfoOverlay.cxx index 72f6644126fcad74b4c91e889cb62506f981a887..11c31828da5962c3ee9c246068ee1dc1e60790b3 100644 --- a/Event/xAOD/xAODEventInfoCnv/src/EventInfoOverlay.cxx +++ b/Event/xAOD/xAODEventInfoCnv/src/EventInfoOverlay.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /// @author Tadej Novak <tadej@cern.ch> @@ -80,10 +80,6 @@ StatusCode EventInfoOverlay::execute(const EventContext& ctx) const // MC+MC overlay should always be marked as simulation if (!m_dataOverlay.value()) { outputEvent->setEventTypeBitmask(xAOD::EventInfo::IS_SIMULATION); - } else { - // Overlay RDO files should be treated like data for reco - // purposes, so only set this for SimHit level pile-up. - outputEvent->setEventTypeBitmask(outputEvent->eventTypeBitmask() | xAOD::EventInfo::IS_SIMULATION); } // Propagate core event flags diff --git a/Event/xAOD/xAODTau/Root/DiTauJetAccessors_v1.h b/Event/xAOD/xAODTau/Root/DiTauJetAccessors_v1.h index e2c350716d1ff6fe6b9e9d304ee8c3bcf27783b6..4d29e0a03c5b2569543742548a5d0e74b0a8b178 100644 --- a/Event/xAOD/xAODTau/Root/DiTauJetAccessors_v1.h +++ b/Event/xAOD/xAODTau/Root/DiTauJetAccessors_v1.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: DiTauJetAccessors_v1.h 631921 2015-09-23 23:30:59Z dkirchme $ @@ -17,10 +17,10 @@ namespace xAOD { namespace xAODDiTau { - template <class T> SG::AuxElement::Accessor< T >* detailsAccessorV1( xAOD::DiTauJetParameters::Detail detail ); + template <class T> const SG::AuxElement::Accessor< T >* detailsAccessorV1( xAOD::DiTauJetParameters::Detail detail ); #include "DiTauJetAccessors_v1.icc" } } // namespace xAOD -#endif // XAODDITAU_TAUJETACCESSORS_V1_H \ No newline at end of file +#endif // XAODDITAU_TAUJETACCESSORS_V1_H diff --git a/Event/xAOD/xAODTau/Root/DiTauJetAccessors_v1.icc b/Event/xAOD/xAODTau/Root/DiTauJetAccessors_v1.icc index 907959d20ec5069b74cce9f32667f4a002e3cbe1..1a49fcadfc1381424900e891452969a895dbf5b4 100644 --- a/Event/xAOD/xAODTau/Root/DiTauJetAccessors_v1.icc +++ b/Event/xAOD/xAODTau/Root/DiTauJetAccessors_v1.icc @@ -12,19 +12,19 @@ // System include(s): #include <iostream> -#define DEFINE_DITAUJETPARAMETER_ACCESSOR(TYPE, NAME ) \ - case xAOD::DiTauJetParameters::NAME: \ +#define DEFINE_DITAUJETPARAMETER_ACCESSOR(TYPE, NAME ) \ + case xAOD::DiTauJetParameters::NAME: \ { \ - static SG::AuxElement::Accessor< TYPE > a( #NAME ); \ + static const SG::AuxElement::Accessor< TYPE > a( #NAME ); \ return &a; \ } \ break; - template <class T> SG::AuxElement::Accessor< T >* detailsAccessorV1( xAOD::DiTauJetParameters::Detail /*detail*/ ) { + template <class T> const SG::AuxElement::Accessor< T >* detailsAccessorV1( xAOD::DiTauJetParameters::Detail /*detail*/ ) { } - template <> SG::AuxElement::Accessor< float >* detailsAccessorV1<float>( xAOD::DiTauJetParameters::Detail detail ) { + template <> const SG::AuxElement::Accessor< float >* detailsAccessorV1<float>( xAOD::DiTauJetParameters::Detail detail ) { switch( detail ) { DEFINE_DITAUJETPARAMETER_ACCESSOR( float, TauJetVtxFraction ); @@ -41,7 +41,7 @@ break; } } - template <> SG::AuxElement::Accessor< int >* detailsAccessorV1<int>( xAOD::DiTauJetParameters::Detail detail ) { + template <> const SG::AuxElement::Accessor< int >* detailsAccessorV1<int>( xAOD::DiTauJetParameters::Detail detail ) { switch( detail ) { diff --git a/Event/xAOD/xAODTau/Root/DiTauJet_v1.cxx b/Event/xAOD/xAODTau/Root/DiTauJet_v1.cxx index 4f8b56b6f72b924a5b5711404b03bd23dbae4fed..3eadd077a0ee33d74fe455f3c9417962a16057e5 100644 --- a/Event/xAOD/xAODTau/Root/DiTauJet_v1.cxx +++ b/Event/xAOD/xAODTau/Root/DiTauJet_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: DiTauJet_v1.cxx 631921 2015-09-23 23:30:59Z dkirchme $ @@ -37,10 +37,10 @@ namespace xAOD { } void DiTauJet_v1::setP4(double pt, double eta, double phi, double m) { - static Accessor< float > acc1( "pt" ); - static Accessor< float > acc2( "eta" ); - static Accessor< float > acc3( "phi" ); - static Accessor< float > acc4( "m" ); + static const Accessor< float > acc1( "pt" ); + static const Accessor< float > acc2( "eta" ); + static const Accessor< float > acc3( "phi" ); + static const Accessor< float > acc4( "m" ); acc1( *this ) = pt; acc2( *this ) = eta; acc3( *this ) = phi; @@ -71,7 +71,7 @@ namespace xAOD { jetLink, setJetLink ) - static SG::AuxElement::Accessor< DiTauJet_v1::JetLink_t > jetAcc( "jetLink" ); + static const SG::AuxElement::Accessor< DiTauJet_v1::JetLink_t > jetAcc( "jetLink" ); const Jet* DiTauJet_v1::jet() const { return ( *jetAcc( *this ) ); @@ -90,7 +90,7 @@ namespace xAOD { float DiTauJet_v1::subjetPt(unsigned int numSubjet) const { - static Accessor< std::vector <float > > subjetPtAcc("subjet_pt"); + static const Accessor< std::vector <float > > subjetPtAcc("subjet_pt"); const std::vector<float>& vPt = subjetPtAcc(*this); if (vPt.size()<numSubjet+1) return -999.0; @@ -100,7 +100,7 @@ namespace xAOD { float DiTauJet_v1::subjetEta(unsigned int numSubjet) const { - static Accessor< std::vector <float > > subjetEtaAcc("subjet_eta"); + static const Accessor< std::vector <float > > subjetEtaAcc("subjet_eta"); const std::vector<float>& vEta = subjetEtaAcc(*this); if (vEta.size()<numSubjet+1) return -999.0; @@ -110,7 +110,7 @@ namespace xAOD { float DiTauJet_v1::subjetPhi(unsigned int numSubjet) const { - static Accessor< std::vector <float > > subjetPhiAcc("subjet_phi"); + static const Accessor< std::vector <float > > subjetPhiAcc("subjet_phi"); const std::vector<float>& vPhi = subjetPhiAcc(*this); if (vPhi.size()<numSubjet+1) return -999.0; @@ -120,7 +120,7 @@ namespace xAOD { float DiTauJet_v1::subjetE(unsigned int numSubjet) const { - static Accessor< std::vector <float > > subjetEAcc("subjet_e"); + static const Accessor< std::vector <float > > subjetEAcc("subjet_e"); const std::vector<float>& vE = subjetEAcc(*this); if (vE.size()<numSubjet+1) return -999.0; @@ -130,7 +130,7 @@ namespace xAOD { float DiTauJet_v1::nSubjets() const { - static Accessor < std::vector <float> > subjetPtAcc("subjet_pt"); + static const Accessor < std::vector <float> > subjetPtAcc("subjet_pt"); const std::vector<float>& vPt = subjetPtAcc(*this); return vPt.size(); } @@ -138,10 +138,10 @@ namespace xAOD { void DiTauJet_v1::setSubjetPtEtaPhiE(unsigned int numSubjet, float pt, float eta, float phi, float e) { - static Accessor< std::vector <float > > subjetPtAcc("subjet_pt"); - static Accessor< std::vector <float > > subjetEtaAcc("subjet_eta"); - static Accessor< std::vector <float > > subjetPhiAcc("subjet_phi"); - static Accessor< std::vector <float > > subjetEAcc("subjet_e"); + static const Accessor< std::vector <float > > subjetPtAcc("subjet_pt"); + static const Accessor< std::vector <float > > subjetEtaAcc("subjet_eta"); + static const Accessor< std::vector <float > > subjetPhiAcc("subjet_phi"); + static const Accessor< std::vector <float > > subjetEAcc("subjet_e"); std::vector<float>& vPt = subjetPtAcc(*this); std::vector<float>& vEta = subjetEtaAcc(*this); std::vector<float>& vPhi = subjetPhiAcc(*this); @@ -166,7 +166,7 @@ namespace xAOD { // ---------------------------------------------------------------------------- float DiTauJet_v1::fCore(unsigned int numSubjet) const { - static Accessor< std::vector <float > > fCoreAcc("subjet_f_core"); + static const Accessor< std::vector <float > > fCoreAcc("subjet_f_core"); const std::vector<float>& vec = fCoreAcc(*this); if (vec.size()<numSubjet+1) return -999.0; @@ -176,7 +176,7 @@ namespace xAOD { void DiTauJet_v1::setfCore(unsigned int numSubjet, float fCore) { - static Accessor< std::vector <float > > fCoreAcc("subjet_f_core"); + static const Accessor< std::vector <float > > fCoreAcc("subjet_f_core"); std::vector<float>& vec = fCoreAcc(*this); if (vec.size()<numSubjet+1) vec.resize(numSubjet+1); @@ -193,7 +193,7 @@ namespace xAOD { vertexLink, setVertexLink ) - static SG::AuxElement::Accessor< DiTauJet_v1::VertexLink_t > vertexAcc( "vertexLink" ); + static const SG::AuxElement::Accessor< DiTauJet_v1::VertexLink_t > vertexAcc( "vertexLink" ); const Vertex* DiTauJet_v1::vertex() const { return ( *vertexAcc( *this ) ); @@ -214,7 +214,7 @@ namespace xAOD { // secVertexLinks, // setSecVertexLinks ) - // static SG::AuxElement::Accessor< DiTauJet_v1::SecVertexLinks_t > secVtxAcc( "secVertexLinks" ); + // static const SG::AuxElement::Accessor< DiTauJet_v1::SecVertexLinks_t > secVtxAcc( "secVertexLinks" ); // const Vertex* DiTauJet_v1::secVertex( size_t i ) const { // return ( *secVtxAcc( *this )[ i ] ); @@ -248,7 +248,7 @@ namespace xAOD { trackLinks, setTrackLinks ) - static SG::AuxElement::Accessor< DiTauJet_v1::TrackParticleLinks_t > trackAcc( "trackLinks" ); + static const SG::AuxElement::Accessor< DiTauJet_v1::TrackParticleLinks_t > trackAcc( "trackLinks" ); const TrackParticle* DiTauJet_v1::track( size_t i ) const { return ( *trackAcc( *this )[ i ] ); @@ -280,7 +280,7 @@ namespace xAOD { isoTrackLinks, setIsoTrackLinks ) - static SG::AuxElement::Accessor< DiTauJet_v1::TrackParticleLinks_t > isoTrackAcc( "isoTrackLinks" ); + static const SG::AuxElement::Accessor< DiTauJet_v1::TrackParticleLinks_t > isoTrackAcc( "isoTrackLinks" ); const TrackParticle* DiTauJet_v1::isoTrack( size_t i ) const { return ( *isoTrackAcc( *this )[ i ] ); @@ -312,7 +312,7 @@ namespace xAOD { otherTrackLinks, setOtherTrackLinks ) - static SG::AuxElement::Accessor< DiTauJet_v1::TrackParticleLinks_t > otherTrackAcc( "otherTrackLinks" ); + static const SG::AuxElement::Accessor< DiTauJet_v1::TrackParticleLinks_t > otherTrackAcc( "otherTrackLinks" ); const TrackParticle* DiTauJet_v1::otherTrack( size_t i ) const { return ( *otherTrackAcc( *this )[ i ] ); @@ -343,7 +343,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool DiTauJet_v1::detail( DiTauJetParameters::Detail detail, int& value ) const { // Get the detail accessor: - Accessor< int >* acc = xAODDiTau::detailsAccessorV1<int>( detail ); + const Accessor< int >* acc = xAODDiTau::detailsAccessorV1<int>( detail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -357,7 +357,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool DiTauJet_v1::detail( DiTauJetParameters::Detail detail, float& value ) const { // Get the detail accessor: - Accessor< float >* acc = xAODDiTau::detailsAccessorV1<float>( detail ); + const Accessor< float >* acc = xAODDiTau::detailsAccessorV1<float>( detail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; diff --git a/Event/xAOD/xAODTau/Root/TauJetAccessors_v1.h b/Event/xAOD/xAODTau/Root/TauJetAccessors_v1.h index 505fe9e97fc137f09d739f366deb3b631bdd54d0..a8d577e7c25e1e27a21ee8167d9c771464b2860b 100644 --- a/Event/xAOD/xAODTau/Root/TauJetAccessors_v1.h +++ b/Event/xAOD/xAODTau/Root/TauJetAccessors_v1.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: TauJetAccessors_v1.h 587943 2014-03-17 12:43:37Z felixf $ @@ -22,11 +22,11 @@ namespace xAOD { /// @param idvar The id variable for which an Accessor should be returned /// @returns A pointer to an Accessor if successful, <code>0</code> if not /// - SG::AuxElement::Accessor< float >* discriminantAccessorV1( xAOD::TauJetParameters::TauID discriminant ); + const SG::AuxElement::Accessor< float >* discriminantAccessorV1( xAOD::TauJetParameters::TauID discriminant ); - template <class T> SG::AuxElement::Accessor< T >* panTauDetailsAccessorV1( xAOD::TauJetParameters::PanTauDetails detail ); + template <class T> const SG::AuxElement::Accessor< T >* panTauDetailsAccessorV1( xAOD::TauJetParameters::PanTauDetails detail ); - template <class T> SG::AuxElement::Accessor< T >* detailsAccessorV1( xAOD::TauJetParameters::Detail detail ); + template <class T> const SG::AuxElement::Accessor< T >* detailsAccessorV1( xAOD::TauJetParameters::Detail detail ); #include "TauJetAccessors_v1.icc" } diff --git a/Event/xAOD/xAODTau/Root/TauJetAccessors_v1.icc b/Event/xAOD/xAODTau/Root/TauJetAccessors_v1.icc index aa07b64e0834f0eb072b71b90aeac64ece45ebcd..7d5ec4543e0227a0a54eb00167c72f6e26082027 100644 --- a/Event/xAOD/xAODTau/Root/TauJetAccessors_v1.icc +++ b/Event/xAOD/xAODTau/Root/TauJetAccessors_v1.icc @@ -15,13 +15,13 @@ #define DEFINE_TAUJETPARAMETER_ACCESSOR(TYPE, NAME ) \ case xAOD::TauJetParameters::NAME: \ { \ - static SG::AuxElement::Accessor< TYPE > a( #NAME ); \ + static const SG::AuxElement::Accessor< TYPE > a( #NAME ); \ return &a; \ } \ break; - SG::AuxElement::Accessor< float >* discriminantAccessorV1( xAOD::TauJetParameters::TauID discriminant ) { + const SG::AuxElement::Accessor< float >* discriminantAccessorV1( xAOD::TauJetParameters::TauID discriminant ) { switch( discriminant ) { @@ -40,11 +40,11 @@ break; } } - template <class T> SG::AuxElement::Accessor< T >* + template <class T> const SG::AuxElement::Accessor< T >* panTauDetailsAccessorV1( xAOD::TauJetParameters::PanTauDetails /*detail*/ ) { } - template <> SG::AuxElement::Accessor< float >* panTauDetailsAccessorV1<float>( xAOD::TauJetParameters::PanTauDetails detail ) { + template <> const SG::AuxElement::Accessor< float >* panTauDetailsAccessorV1<float>( xAOD::TauJetParameters::PanTauDetails detail ) { switch( detail ) { @@ -93,7 +93,7 @@ break; } } - template <> SG::AuxElement::Accessor< int >* panTauDetailsAccessorV1<int>( xAOD::TauJetParameters::PanTauDetails detail ) { + template <> const SG::AuxElement::Accessor< int >* panTauDetailsAccessorV1<int>( xAOD::TauJetParameters::PanTauDetails detail ) { switch( detail ) { @@ -130,10 +130,10 @@ break; - template <class T> SG::AuxElement::Accessor< T >* detailsAccessorV1( xAOD::TauJetParameters::Detail /*detail*/ ) { + template <class T> const SG::AuxElement::Accessor< T >* detailsAccessorV1( xAOD::TauJetParameters::Detail /*detail*/ ) { } - template <> SG::AuxElement::Accessor< float >* detailsAccessorV1<float>( xAOD::TauJetParameters::Detail detail ) { + template <> const SG::AuxElement::Accessor< float >* detailsAccessorV1<float>( xAOD::TauJetParameters::Detail detail ) { switch( detail ) { @@ -214,7 +214,7 @@ break; } } - template <> SG::AuxElement::Accessor< int >* detailsAccessorV1<int>( xAOD::TauJetParameters::Detail detail ) { + template <> const SG::AuxElement::Accessor< int >* detailsAccessorV1<int>( xAOD::TauJetParameters::Detail detail ) { switch( detail ) { diff --git a/Event/xAOD/xAODTau/Root/TauJetAccessors_v2.h b/Event/xAOD/xAODTau/Root/TauJetAccessors_v2.h index f9b6e67e4fd732c1be3ef0da0592e3e78603f56b..700718043930f886dc542203aa4f439f914f010a 100644 --- a/Event/xAOD/xAODTau/Root/TauJetAccessors_v2.h +++ b/Event/xAOD/xAODTau/Root/TauJetAccessors_v2.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: TauJetAccessors_v2.h 631748 2014-11-28 09:58:13Z janus $ @@ -22,11 +22,11 @@ namespace xAOD { /// @param idvar The id variable for which an Accessor should be returned /// @returns A pointer to an Accessor if successful, <code>0</code> if not /// - SG::AuxElement::Accessor< float >* discriminantAccessorV2( xAOD::TauJetParameters::TauID discriminant ); + const SG::AuxElement::Accessor< float >* discriminantAccessorV2( xAOD::TauJetParameters::TauID discriminant ); - template <class T> SG::AuxElement::Accessor< T >* panTauDetailsAccessorV2( xAOD::TauJetParameters::PanTauDetails detail ); + template <class T> const SG::AuxElement::Accessor< T >* panTauDetailsAccessorV2( xAOD::TauJetParameters::PanTauDetails detail ); - template <class T> SG::AuxElement::Accessor< T >* detailsAccessorV2( xAOD::TauJetParameters::Detail detail ); + template <class T> const SG::AuxElement::Accessor< T >* detailsAccessorV2( xAOD::TauJetParameters::Detail detail ); #include "TauJetAccessors_v2.icc" } diff --git a/Event/xAOD/xAODTau/Root/TauJetAccessors_v2.icc b/Event/xAOD/xAODTau/Root/TauJetAccessors_v2.icc index d031457b88b75f40d8a4e1ee703c7c7e7c691dac..f07a3cdcaf4aee18c95ec4b22006fc362bbb0ac9 100644 --- a/Event/xAOD/xAODTau/Root/TauJetAccessors_v2.icc +++ b/Event/xAOD/xAODTau/Root/TauJetAccessors_v2.icc @@ -15,13 +15,13 @@ #define DEFINE_TAUJETPARAMETER_ACCESSOR(TYPE, NAME ) \ case xAOD::TauJetParameters::NAME: \ { \ - static SG::AuxElement::Accessor< TYPE > a( #NAME ); \ + static const SG::AuxElement::Accessor< TYPE > a( #NAME ); \ return &a; \ } \ break; - SG::AuxElement::Accessor< float >* discriminantAccessorV2( xAOD::TauJetParameters::TauID discriminant ) { + const SG::AuxElement::Accessor< float >* discriminantAccessorV2( xAOD::TauJetParameters::TauID discriminant ) { switch( discriminant ) { @@ -40,11 +40,11 @@ break; } } - template <class T> SG::AuxElement::Accessor< T >* + template <class T> const SG::AuxElement::Accessor< T >* panTauDetailsAccessorV2( xAOD::TauJetParameters::PanTauDetails /*detail*/ ) { } - template <> SG::AuxElement::Accessor< float >* panTauDetailsAccessorV2<float>( xAOD::TauJetParameters::PanTauDetails detail ) { + template <> const SG::AuxElement::Accessor< float >* panTauDetailsAccessorV2<float>( xAOD::TauJetParameters::PanTauDetails detail ) { switch( detail ) { @@ -91,7 +91,7 @@ break; } } - template <> SG::AuxElement::Accessor< int >* panTauDetailsAccessorV2<int>( xAOD::TauJetParameters::PanTauDetails detail ) { + template <> const SG::AuxElement::Accessor< int >* panTauDetailsAccessorV2<int>( xAOD::TauJetParameters::PanTauDetails detail ) { switch( detail ) { @@ -128,10 +128,10 @@ break; - template <class T> SG::AuxElement::Accessor< T >* detailsAccessorV2( xAOD::TauJetParameters::Detail /*detail*/ ) { + template <class T> const SG::AuxElement::Accessor< T >* detailsAccessorV2( xAOD::TauJetParameters::Detail /*detail*/ ) { } - template <> SG::AuxElement::Accessor< float >* detailsAccessorV2<float>( xAOD::TauJetParameters::Detail detail ) { + template <> const SG::AuxElement::Accessor< float >* detailsAccessorV2<float>( xAOD::TauJetParameters::Detail detail ) { switch( detail ) { @@ -225,7 +225,7 @@ break; } } - template <> SG::AuxElement::Accessor< int >* detailsAccessorV2<int>( xAOD::TauJetParameters::Detail detail ) { + template <> const SG::AuxElement::Accessor< int >* detailsAccessorV2<int>( xAOD::TauJetParameters::Detail detail ) { switch( detail ) { diff --git a/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.h b/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.h index a54464e392d9fc8e69178a95a94d4f470bb63378..829eeaeefe41fb8807d2f41d274263d212db80aa 100644 --- a/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.h +++ b/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: TauJetAccessors_v2.h 631748 2014-11-28 09:58:13Z janus $ @@ -24,14 +24,14 @@ namespace xAOD { /// @returns A pointer to an Accessor if successful, <code>0</code> if not /// #ifndef TAUTRACK_V1_ACCESSORS - SG::AuxElement::Accessor< float >* discriminantAccessorV3( xAOD::TauJetParameters::TauID discriminant ); + const SG::AuxElement::Accessor< float >* discriminantAccessorV3( xAOD::TauJetParameters::TauID discriminant ); - template <class T> SG::AuxElement::Accessor< T >* panTauDetailsAccessorV3( xAOD::TauJetParameters::PanTauDetails detail ); + template <class T> const SG::AuxElement::Accessor< T >* panTauDetailsAccessorV3( xAOD::TauJetParameters::PanTauDetails detail ); - template <class T> SG::AuxElement::Accessor< T >* detailsAccessorV3( xAOD::TauJetParameters::Detail detail ); + template <class T> const SG::AuxElement::Accessor< T >* detailsAccessorV3( xAOD::TauJetParameters::Detail detail ); #else - template <class T> SG::AuxElement::Accessor< T >* trackDetailsAccessorV3( xAOD::TauJetParameters::TrackDetail detail ); + template <class T> const SG::AuxElement::Accessor< T >* trackDetailsAccessorV3( xAOD::TauJetParameters::TrackDetail detail ); #endif #include "TauJetAccessors_v3.icc" diff --git a/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.icc b/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.icc index 0da4068479e6d8df361de9d223bf9e1d5c198129..7c47d7168287db43083e59bf1a8baf0fbfbf5676 100644 --- a/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.icc +++ b/Event/xAOD/xAODTau/Root/TauJetAccessors_v3.icc @@ -15,7 +15,7 @@ #define DEFINE_TAUJETPARAMETER_ACCESSOR(TYPE, NAME ) \ case xAOD::TauJetParameters::NAME: \ { \ - static SG::AuxElement::Accessor< TYPE > a( #NAME ); \ + static const SG::AuxElement::Accessor< TYPE > a( #NAME ); \ return &a; \ } \ break; @@ -23,7 +23,7 @@ break; #ifndef TAUTRACK_V1_ACCESSORS - SG::AuxElement::Accessor< float >* discriminantAccessorV3( xAOD::TauJetParameters::TauID discriminant ) { + const SG::AuxElement::Accessor< float >* discriminantAccessorV3( xAOD::TauJetParameters::TauID discriminant ) { switch( discriminant ) { @@ -45,11 +45,11 @@ break; } } - template <class T> SG::AuxElement::Accessor< T >* + template <class T> const SG::AuxElement::Accessor< T >* panTauDetailsAccessorV3( xAOD::TauJetParameters::PanTauDetails /*detail*/ ) { } - template <> SG::AuxElement::Accessor< float >* panTauDetailsAccessorV3<float>( xAOD::TauJetParameters::PanTauDetails detail ) { + template <> const SG::AuxElement::Accessor< float >* panTauDetailsAccessorV3<float>( xAOD::TauJetParameters::PanTauDetails detail ) { switch( detail ) { @@ -78,7 +78,7 @@ break; } } - template <> SG::AuxElement::Accessor< int >* panTauDetailsAccessorV3<int>( xAOD::TauJetParameters::PanTauDetails detail ) { + template <> const SG::AuxElement::Accessor< int >* panTauDetailsAccessorV3<int>( xAOD::TauJetParameters::PanTauDetails detail ) { switch( detail ) { @@ -104,10 +104,10 @@ break; - template <class T> SG::AuxElement::Accessor< T >* detailsAccessorV3( xAOD::TauJetParameters::Detail /*detail*/ ) { + template <class T> const SG::AuxElement::Accessor< T >* detailsAccessorV3( xAOD::TauJetParameters::Detail /*detail*/ ) { } - template <> SG::AuxElement::Accessor< float >* detailsAccessorV3<float>( xAOD::TauJetParameters::Detail detail ) { + template <> const SG::AuxElement::Accessor< float >* detailsAccessorV3<float>( xAOD::TauJetParameters::Detail detail ) { switch( detail ) { @@ -209,7 +209,7 @@ break; } } - template <> SG::AuxElement::Accessor< int >* detailsAccessorV3<int>( xAOD::TauJetParameters::Detail detail ) { + template <> const SG::AuxElement::Accessor< int >* detailsAccessorV3<int>( xAOD::TauJetParameters::Detail detail ) { switch( detail ) { @@ -232,7 +232,7 @@ break; } } - template <> SG::AuxElement::Accessor< ElementLink<IParticleContainer> >* detailsAccessorV3<ElementLink<IParticleContainer > >( xAOD::TauJetParameters::Detail detail ) { + template <> const SG::AuxElement::Accessor< ElementLink<IParticleContainer> >* detailsAccessorV3<ElementLink<IParticleContainer > >( xAOD::TauJetParameters::Detail detail ) { switch( detail ) { @@ -246,10 +246,10 @@ break; } #else - template <class T> SG::AuxElement::Accessor< T >* trackDetailsAccessorV3( xAOD::TauJetParameters::TrackDetail /*detail*/ ) { + template <class T> const SG::AuxElement::Accessor< T >* trackDetailsAccessorV3( xAOD::TauJetParameters::TrackDetail /*detail*/ ) { } - template <> SG::AuxElement::Accessor< float >* trackDetailsAccessorV3<float>( xAOD::TauJetParameters::TrackDetail detail ) { + template <> const SG::AuxElement::Accessor< float >* trackDetailsAccessorV3<float>( xAOD::TauJetParameters::TrackDetail detail ) { switch( detail ) { DEFINE_TAUJETPARAMETER_ACCESSOR( float, CaloSamplingEtaEM ); diff --git a/Event/xAOD/xAODTau/Root/TauJet_v1.cxx b/Event/xAOD/xAODTau/Root/TauJet_v1.cxx index 5011cfdbd2a9eefb5c59b4173a584c9fb3f4f967..a35b35408f4b1528c628ed43ac27f8c4978652b6 100644 --- a/Event/xAOD/xAODTau/Root/TauJet_v1.cxx +++ b/Event/xAOD/xAODTau/Root/TauJet_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: TauJet_v1.cxx 740338 2016-04-14 16:03:58Z griffith $ @@ -171,10 +171,10 @@ namespace xAOD { void TauJet_v1::setP4(double pt, double eta, double phi, double m) { - static Accessor< float > acc1( "pt" ); - static Accessor< float > acc2( "eta" ); - static Accessor< float > acc3( "phi" ); - static Accessor< float > acc4( "m" ); + static const Accessor< float > acc1( "pt" ); + static const Accessor< float > acc2( "eta" ); + static const Accessor< float > acc3( "phi" ); + static const Accessor< float > acc4( "m" ); acc1( *this )=pt; acc2( *this )=eta; acc3( *this )=phi; @@ -215,7 +215,7 @@ namespace xAOD { bool TauJet_v1::hasDiscriminant( TauJetParameters::TauID discID ) const { // Get the discriminant accessor: - Accessor< float >* acc = xAODTau::discriminantAccessorV1( discID ); + const Accessor< float >* acc = xAODTau::discriminantAccessorV1( discID ); if( ! acc ) return false; return true; } @@ -226,7 +226,7 @@ namespace xAOD { //------------------------------------------------------------------------- double TauJet_v1::discriminant( TauJetParameters::TauID discriminant ) const { // Get the discriminant accessor: - Accessor< float >* acc = xAODTau::discriminantAccessorV1( discriminant ); + const Accessor< float >* acc = xAODTau::discriminantAccessorV1( discriminant ); if( ! acc ) return -1111.0; // Retrieve the discriminant value: @@ -247,7 +247,7 @@ namespace xAOD { bool TauJet_v1::isTau( TauJetParameters::IsTauFlag flag ) const { - static Accessor< uint32_t > acc( "isTauFlags" ); + static const Accessor< uint32_t > acc( "isTauFlags" ); std::bitset<32> isTauFlags( acc( *this ) ); return isTauFlags[flag]; } @@ -255,7 +255,7 @@ namespace xAOD { void TauJet_v1::setIsTau( TauJetParameters::IsTauFlag flag, bool value ) { - static Accessor< uint32_t > acc( "isTauFlags" ); + static const Accessor< uint32_t > acc( "isTauFlags" ); std::bitset<32> isTauFlags( acc( *this ) ); isTauFlags[flag] = value; acc( *this ) = isTauFlags.to_ulong(); @@ -267,7 +267,7 @@ namespace xAOD { void TauJet_v1::setFlag( TauJetParameters::VetoFlags flag, bool value ) { - static Accessor< uint32_t > acc( "vetoFlags" ); + static const Accessor< uint32_t > acc( "vetoFlags" ); std::bitset<32> vetoFlags( acc( *this ) ); vetoFlags[flag] = value; acc( *this ) = vetoFlags.to_ulong(); @@ -276,7 +276,7 @@ namespace xAOD { bool TauJet_v1::flag( TauJetParameters::VetoFlags flag ) const { - static Accessor< uint32_t > acc( "vetoFlags" ); + static const Accessor< uint32_t > acc( "vetoFlags" ); std::bitset<32> vetoFlags( acc( *this ) ); return vetoFlags[flag]; } @@ -288,7 +288,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v1::detail( TauJetParameters::Detail detail, int& value ) const { // Get the detail accessor: - Accessor< int >* acc = xAODTau::detailsAccessorV1<int>( detail ); + const Accessor< int >* acc = xAODTau::detailsAccessorV1<int>( detail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -302,7 +302,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v1::detail( TauJetParameters::Detail detail, float& value ) const { // Get the detail accessor: - Accessor< float >* acc = xAODTau::detailsAccessorV1<float>( detail ); + const Accessor< float >* acc = xAODTau::detailsAccessorV1<float>( detail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -331,7 +331,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v1::panTauDetail( TauJetParameters::PanTauDetails panTauDetail, int& value ) const { // Get the panTauDetail accessor: - Accessor< int >* acc = xAODTau::panTauDetailsAccessorV1<int>( panTauDetail ); + const Accessor< int >* acc = xAODTau::panTauDetailsAccessorV1<int>( panTauDetail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -345,7 +345,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v1::panTauDetail( TauJetParameters::PanTauDetails panTauDetail, float& value ) const { // Get the panTauDetail accessor: - Accessor< float >* acc = xAODTau::panTauDetailsAccessorV1<float>( panTauDetail ); + const Accessor< float >* acc = xAODTau::panTauDetailsAccessorV1<float>( panTauDetail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -379,7 +379,7 @@ namespace xAOD { trackLinks, setTrackLinks ) - static SG::AuxElement::Accessor< TauJet_v1::TrackParticleLinks_t > trackAcc( "trackLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::TrackParticleLinks_t > trackAcc( "trackLinks" ); const TrackParticle* TauJet_v1::track( size_t i ) const { return ( *trackAcc( *this )[ i ] ); @@ -403,7 +403,7 @@ namespace xAOD { int TauJet_v1::trackFilterPass(unsigned int numTrack) const { - static Accessor< std::vector <int > > trackPassAcc("trackFilterPass"); + static const Accessor< std::vector <int > > trackPassAcc("trackFilterPass"); const std::vector<int>& vec=trackPassAcc(*this); if (vec.size()<numTrack+1) return -999; @@ -413,7 +413,7 @@ namespace xAOD { void TauJet_v1::setTrackFilterPass(unsigned int numTrack, int pass) { - static Accessor< std::vector <int > > trackPassAcc("trackFilterPass"); + static const Accessor< std::vector <int > > trackPassAcc("trackFilterPass"); std::vector<int>& vec=trackPassAcc(*this); if (vec.size()<numTrack+1) vec.resize(numTrack+1); @@ -432,7 +432,7 @@ namespace xAOD { float TauJet_v1::trackEtaStrip(unsigned int numTrack) const { - static Accessor< std::vector <float > > trackEtaStripAcc("trackEtaStrip"); + static const Accessor< std::vector <float > > trackEtaStripAcc("trackEtaStrip"); const std::vector<float>& vec=trackEtaStripAcc(*this); if (vec.size()<numTrack+1) return -999.0; @@ -442,7 +442,7 @@ namespace xAOD { void TauJet_v1::setTrackEtaStrip(unsigned int numTrack, float eta) { - static Accessor< std::vector <float > > trackEtaStripAcc("trackEtaStrip"); + static const Accessor< std::vector <float > > trackEtaStripAcc("trackEtaStrip"); std::vector<float>& vec=trackEtaStripAcc(*this); if (vec.size()<numTrack+1) vec.resize(numTrack+1); @@ -452,7 +452,7 @@ namespace xAOD { float TauJet_v1::trackPhiStrip(unsigned int numTrack) const { - static Accessor< std::vector <float > > trackPhiStripAcc("trackPhiStrip"); + static const Accessor< std::vector <float > > trackPhiStripAcc("trackPhiStrip"); const std::vector<float>& vec=trackPhiStripAcc(*this); if (vec.size()<numTrack+1) return -999.0; @@ -462,7 +462,7 @@ namespace xAOD { void TauJet_v1::setTrackPhiStrip(unsigned int numTrack, float phi) { - static Accessor< std::vector <float > > trackPhiStripAcc("trackPhiStrip"); + static const Accessor< std::vector <float > > trackPhiStripAcc("trackPhiStrip"); std::vector<float>& vec=trackPhiStripAcc(*this); if (vec.size()<numTrack+1) vec.resize(numTrack+1); @@ -477,7 +477,7 @@ namespace xAOD { conversionTrackLinks, setConversionTrackLinks ) - static SG::AuxElement::Accessor< TauJet_v1::TrackParticleLinks_t > convTrackAcc( "conversionTrackLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::TrackParticleLinks_t > convTrackAcc( "conversionTrackLinks" ); const TrackParticle* TauJet_v1::conversionTrack( size_t i ) const { return ( *convTrackAcc( *this )[ i ] ); @@ -504,7 +504,7 @@ namespace xAOD { wideTrackLinks, setWideTrackLinks ) - static SG::AuxElement::Accessor< TauJet_v1::TrackParticleLinks_t > wideTrackAcc( "wideTrackLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::TrackParticleLinks_t > wideTrackAcc( "wideTrackLinks" ); const TrackParticle* TauJet_v1::wideTrack( size_t i ) const { return ( *wideTrackAcc( *this )[ i ] ); @@ -531,7 +531,7 @@ namespace xAOD { otherTrackLinks, setOtherTrackLinks ) - static SG::AuxElement::Accessor< TauJet_v1::TrackParticleLinks_t > otherTrackAcc( "otherTrackLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::TrackParticleLinks_t > otherTrackAcc( "otherTrackLinks" ); const TrackParticle* TauJet_v1::otherTrack( size_t i ) const { return ( *otherTrackAcc( *this )[ i ] ); @@ -558,7 +558,7 @@ namespace xAOD { jetLink, setJetLink ) - static SG::AuxElement::Accessor< TauJet_v1::JetLink_t > jetAcc( "jetLink" ); + static const SG::AuxElement::Accessor< TauJet_v1::JetLink_t > jetAcc( "jetLink" ); const Jet* TauJet_v1::jet() const { return ( *jetAcc( *this ) ); @@ -579,7 +579,7 @@ namespace xAOD { vertexLink, setVertexLink ) - static SG::AuxElement::Accessor< TauJet_v1::VertexLink_t > vertexAcc( "vertexLink" ); + static const SG::AuxElement::Accessor< TauJet_v1::VertexLink_t > vertexAcc( "vertexLink" ); const Vertex* TauJet_v1::vertex() const { return ( *vertexAcc( *this ) ); @@ -600,7 +600,7 @@ namespace xAOD { secondaryVertexLink, setSecondaryVertexLink ) - static SG::AuxElement::Accessor< TauJet_v1::VertexLink_t > secondaryVertexAcc( "secondaryVertexLink" ); + static const SG::AuxElement::Accessor< TauJet_v1::VertexLink_t > secondaryVertexAcc( "secondaryVertexLink" ); const Vertex* TauJet_v1::secondaryVertex() const { return ( *secondaryVertexAcc( *this ) ); @@ -625,7 +625,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > hadronic_PFOAcc( "hadronic_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > hadronic_PFOAcc( "hadronic_PFOLinks" ); const PFO* TauJet_v1::hadronic_PFO( size_t i ) const { return ( *hadronic_PFOAcc( *this )[ i ] ); @@ -654,7 +654,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > shot_PFOAcc( "shot_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > shot_PFOAcc( "shot_PFOLinks" ); const PFO* TauJet_v1::shot_PFO( size_t i ) const { return ( *shot_PFOAcc( *this )[ i ] ); @@ -684,7 +684,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > charged_PFOAcc( "charged_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > charged_PFOAcc( "charged_PFOLinks" ); const PFO* TauJet_v1::charged_PFO( size_t i ) const { return ( *charged_PFOAcc( *this )[ i ] ); @@ -715,7 +715,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > neutral_PFOAcc( "neutral_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > neutral_PFOAcc( "neutral_PFOLinks" ); const PFO* TauJet_v1::neutral_PFO( size_t i ) const { return ( *neutral_PFOAcc( *this )[ i ] ); @@ -746,7 +746,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > pi0_PFOAcc( "pi0_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > pi0_PFOAcc( "pi0_PFOLinks" ); const PFO* TauJet_v1::pi0_PFO( size_t i ) const { return ( *pi0_PFOAcc( *this )[ i ] ); @@ -780,7 +780,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > cellBased_Charged_PFOAcc( "cellBased_Charged_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > cellBased_Charged_PFOAcc( "cellBased_Charged_PFOLinks" ); const PFO* TauJet_v1::cellBased_Charged_PFO( size_t i ) const { return ( *cellBased_Charged_PFOAcc( *this )[ i ] ); @@ -810,7 +810,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > cellBased_Neutral_PFOAcc( "cellBased_Neutral_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > cellBased_Neutral_PFOAcc( "cellBased_Neutral_PFOLinks" ); const PFO* TauJet_v1::cellBased_Neutral_PFO( size_t i ) const { return ( *cellBased_Neutral_PFOAcc( *this )[ i ] ); @@ -841,7 +841,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > cellBased_Pi0_PFOAcc( "cellBased_Pi0_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > cellBased_Pi0_PFOAcc( "cellBased_Pi0_PFOLinks" ); const PFO* TauJet_v1::cellBased_Pi0_PFO( size_t i ) const { return ( *cellBased_Pi0_PFOAcc( *this )[ i ] ); @@ -876,7 +876,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > eflowRec_Charged_PFOAcc( "eflowRec_Charged_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > eflowRec_Charged_PFOAcc( "eflowRec_Charged_PFOLinks" ); const PFO* TauJet_v1::eflowRec_Charged_PFO( size_t i ) const { return ( *eflowRec_Charged_PFOAcc( *this )[ i ] ); @@ -906,7 +906,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > eflowRec_Neutral_PFOAcc( "eflowRec_Neutral_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > eflowRec_Neutral_PFOAcc( "eflowRec_Neutral_PFOLinks" ); const PFO* TauJet_v1::eflowRec_Neutral_PFO( size_t i ) const { return ( *eflowRec_Neutral_PFOAcc( *this )[ i ] ); @@ -937,7 +937,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > eflowRec_Pi0_PFOAcc( "eflowRec_Pi0_PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v1::PFOLinks_t > eflowRec_Pi0_PFOAcc( "eflowRec_Pi0_PFOLinks" ); const PFO* TauJet_v1::eflowRec_Pi0_PFO( size_t i ) const { return ( *eflowRec_Pi0_PFOAcc( *this )[ i ] ); diff --git a/Event/xAOD/xAODTau/Root/TauJet_v2.cxx b/Event/xAOD/xAODTau/Root/TauJet_v2.cxx index a5e32170877aef69b5369903976bde4a792a03ef..1037067b302c0f6fda9f6d9a07df9bb6da8b9f59 100644 --- a/Event/xAOD/xAODTau/Root/TauJet_v2.cxx +++ b/Event/xAOD/xAODTau/Root/TauJet_v2.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: TauJet_v2.cxx 747258 2016-05-15 02:57:19Z griffith $ @@ -181,10 +181,10 @@ namespace xAOD { void TauJet_v2::setP4(double pt, double eta, double phi, double m) { - static Accessor< float > acc1( "pt" ); - static Accessor< float > acc2( "eta" ); - static Accessor< float > acc3( "phi" ); - static Accessor< float > acc4( "m" ); + static const Accessor< float > acc1( "pt" ); + static const Accessor< float > acc2( "eta" ); + static const Accessor< float > acc3( "phi" ); + static const Accessor< float > acc4( "m" ); acc1( *this )=pt; acc2( *this )=eta; acc3( *this )=phi; @@ -225,7 +225,7 @@ namespace xAOD { bool TauJet_v2::hasDiscriminant( TauJetParameters::TauID discID ) const { // Get the discriminant accessor: - Accessor< float >* acc = xAODTau::discriminantAccessorV2( discID ); + const Accessor< float >* acc = xAODTau::discriminantAccessorV2( discID ); if( ! acc ) return false; return true; } @@ -236,7 +236,7 @@ namespace xAOD { //------------------------------------------------------------------------- double TauJet_v2::discriminant( TauJetParameters::TauID discriminant ) const { // Get the discriminant accessor: - Accessor< float >* acc = xAODTau::discriminantAccessorV2( discriminant ); + const Accessor< float >* acc = xAODTau::discriminantAccessorV2( discriminant ); if( ! acc ) return -1111.0; // Retrieve the discriminant value: @@ -257,7 +257,7 @@ namespace xAOD { bool TauJet_v2::isTau( TauJetParameters::IsTauFlag flag ) const { - static Accessor< uint32_t > acc( "isTauFlags" ); + static const Accessor< uint32_t > acc( "isTauFlags" ); std::bitset<32> isTauFlags( acc( *this ) ); return isTauFlags[flag]; } @@ -265,7 +265,7 @@ namespace xAOD { void TauJet_v2::setIsTau( TauJetParameters::IsTauFlag flag, bool value ) { - static Accessor< uint32_t > acc( "isTauFlags" ); + static const Accessor< uint32_t > acc( "isTauFlags" ); std::bitset<32> isTauFlags( acc( *this ) ); isTauFlags[flag] = value; acc( *this ) = isTauFlags.to_ulong(); @@ -277,7 +277,7 @@ namespace xAOD { void TauJet_v2::setFlag( TauJetParameters::VetoFlags flag, bool value ) { - static Accessor< uint32_t > acc( "vetoFlags" ); + static const Accessor< uint32_t > acc( "vetoFlags" ); std::bitset<32> vetoFlags( acc( *this ) ); vetoFlags[flag] = value; acc( *this ) = vetoFlags.to_ulong(); @@ -286,7 +286,7 @@ namespace xAOD { bool TauJet_v2::flag( TauJetParameters::VetoFlags flag ) const { - static Accessor< uint32_t > acc( "vetoFlags" ); + static const Accessor< uint32_t > acc( "vetoFlags" ); std::bitset<32> vetoFlags( acc( *this ) ); return vetoFlags[flag]; } @@ -298,7 +298,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v2::detail( TauJetParameters::Detail detail, int& value ) const { // Get the detail accessor: - Accessor< int >* acc = xAODTau::detailsAccessorV2<int>( detail ); + const Accessor< int >* acc = xAODTau::detailsAccessorV2<int>( detail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -312,7 +312,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v2::detail( TauJetParameters::Detail detail, float& value ) const { // Get the detail accessor: - Accessor< float >* acc = xAODTau::detailsAccessorV2<float>( detail ); + const Accessor< float >* acc = xAODTau::detailsAccessorV2<float>( detail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -341,7 +341,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v2::panTauDetail( TauJetParameters::PanTauDetails panTauDetail, int& value ) const { // Get the panTauDetail accessor: - Accessor< int >* acc = xAODTau::panTauDetailsAccessorV2<int>( panTauDetail ); + const Accessor< int >* acc = xAODTau::panTauDetailsAccessorV2<int>( panTauDetail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -355,7 +355,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v2::panTauDetail( TauJetParameters::PanTauDetails panTauDetail, float& value ) const { // Get the panTauDetail accessor: - Accessor< float >* acc = xAODTau::panTauDetailsAccessorV2<float>( panTauDetail ); + const Accessor< float >* acc = xAODTau::panTauDetailsAccessorV2<float>( panTauDetail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -385,7 +385,7 @@ namespace xAOD { trackLinks, setTrackLinks ) - static SG::AuxElement::Accessor< TauJet_v2::TrackParticleLinks_t > trackAcc( "trackLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::TrackParticleLinks_t > trackAcc( "trackLinks" ); const TrackParticle* TauJet_v2::track( size_t i ) const { return ( *trackAcc( *this )[ i ] ); @@ -409,7 +409,7 @@ namespace xAOD { bool TauJet_v2::trackFlag(const TrackParticle* track, TauJetParameters::TauTrackFlag flag) const { - static Accessor< std::vector < uint8_t > > trackFlags("trackFlags"); + static const Accessor< std::vector < uint8_t > > trackFlags("trackFlags"); std::vector<uint8_t> vec = trackFlags(*this); unsigned int totalTracks = this->nTracks() + this->nWideTracks() + this->nOtherTracks(); while (vec.size() < totalTracks) { @@ -436,7 +436,7 @@ namespace xAOD { void TauJet_v2::setTrackFlag(const TrackParticle* track, TauJetParameters::TauTrackFlag flag, bool value) { - static Accessor< std::vector < uint8_t > > trackFlags("trackFlags"); + static const Accessor< std::vector < uint8_t > > trackFlags("trackFlags"); std::vector<uint8_t> vec = trackFlags(*this); unsigned int totalTracks = this->nTracks() + this->nWideTracks() + this->nOtherTracks(); while (vec.size() < totalTracks) { @@ -474,7 +474,7 @@ namespace xAOD { float TauJet_v2::trackEtaStrip(unsigned int numTrack) const { - static Accessor< std::vector <float > > trackEtaStripAcc("trackEtaStrip"); + static const Accessor< std::vector <float > > trackEtaStripAcc("trackEtaStrip"); const std::vector<float>& vec=trackEtaStripAcc(*this); if (vec.size()<numTrack+1) return -999.0; @@ -484,7 +484,7 @@ namespace xAOD { void TauJet_v2::setTrackEtaStrip(unsigned int numTrack, float eta) { - static Accessor< std::vector <float > > trackEtaStripAcc("trackEtaStrip"); + static const Accessor< std::vector <float > > trackEtaStripAcc("trackEtaStrip"); std::vector<float>& vec=trackEtaStripAcc(*this); if (vec.size()<numTrack+1) vec.resize(numTrack+1); @@ -494,7 +494,7 @@ namespace xAOD { float TauJet_v2::trackPhiStrip(unsigned int numTrack) const { - static Accessor< std::vector <float > > trackPhiStripAcc("trackPhiStrip"); + static const Accessor< std::vector <float > > trackPhiStripAcc("trackPhiStrip"); const std::vector<float>& vec=trackPhiStripAcc(*this); if (vec.size()<numTrack+1) return -999.0; @@ -504,7 +504,7 @@ namespace xAOD { void TauJet_v2::setTrackPhiStrip(unsigned int numTrack, float phi) { - static Accessor< std::vector <float > > trackPhiStripAcc("trackPhiStrip"); + static const Accessor< std::vector <float > > trackPhiStripAcc("trackPhiStrip"); std::vector<float>& vec=trackPhiStripAcc(*this); if (vec.size()<numTrack+1) vec.resize(numTrack+1); @@ -519,7 +519,7 @@ namespace xAOD { wideTrackLinks, setWideTrackLinks ) - static SG::AuxElement::Accessor< TauJet_v2::TrackParticleLinks_t > wideTrackAcc( "wideTrackLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::TrackParticleLinks_t > wideTrackAcc( "wideTrackLinks" ); const TrackParticle* TauJet_v2::wideTrack( size_t i ) const { return ( *wideTrackAcc( *this )[ i ] ); @@ -546,7 +546,7 @@ namespace xAOD { otherTrackLinks, setOtherTrackLinks ) - static SG::AuxElement::Accessor< TauJet_v2::TrackParticleLinks_t > otherTrackAcc( "otherTrackLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::TrackParticleLinks_t > otherTrackAcc( "otherTrackLinks" ); const TrackParticle* TauJet_v2::otherTrack( size_t i ) const { return ( *otherTrackAcc( *this )[ i ] ); @@ -573,7 +573,7 @@ namespace xAOD { jetLink, setJetLink ) - static SG::AuxElement::Accessor< TauJet_v2::JetLink_t > jetAcc( "jetLink" ); + static const SG::AuxElement::Accessor< TauJet_v2::JetLink_t > jetAcc( "jetLink" ); const Jet* TauJet_v2::jet() const { return ( *jetAcc( *this ) ); @@ -594,7 +594,7 @@ namespace xAOD { vertexLink, setVertexLink ) - static SG::AuxElement::Accessor< TauJet_v2::VertexLink_t > vertexAcc( "vertexLink" ); + static const SG::AuxElement::Accessor< TauJet_v2::VertexLink_t > vertexAcc( "vertexLink" ); const Vertex* TauJet_v2::vertex() const { return ( *vertexAcc( *this ) ); @@ -615,7 +615,7 @@ namespace xAOD { secondaryVertexLink, setSecondaryVertexLink ) - static SG::AuxElement::Accessor< TauJet_v2::VertexLink_t > secondaryVertexAcc( "secondaryVertexLink" ); + static const SG::AuxElement::Accessor< TauJet_v2::VertexLink_t > secondaryVertexAcc( "secondaryVertexLink" ); const Vertex* TauJet_v2::secondaryVertex() const { return ( *secondaryVertexAcc( *this ) ); @@ -640,7 +640,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > hadronicPFOAcc( "hadronicPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > hadronicPFOAcc( "hadronicPFOLinks" ); const PFO* TauJet_v2::hadronicPFO( size_t i ) const { return ( *hadronicPFOAcc( *this )[ i ] ); @@ -669,7 +669,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > shotPFOAcc( "shotPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > shotPFOAcc( "shotPFOLinks" ); const PFO* TauJet_v2::shotPFO( size_t i ) const { return ( *shotPFOAcc( *this )[ i ] ); @@ -699,7 +699,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > chargedPFOAcc( "chargedPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > chargedPFOAcc( "chargedPFOLinks" ); const PFO* TauJet_v2::chargedPFO( size_t i ) const { return ( *chargedPFOAcc( *this )[ i ] ); @@ -730,7 +730,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > neutralPFOAcc( "neutralPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > neutralPFOAcc( "neutralPFOLinks" ); const PFO* TauJet_v2::neutralPFO( size_t i ) const { return ( *neutralPFOAcc( *this )[ i ] ); @@ -761,7 +761,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > pi0PFOAcc( "pi0PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > pi0PFOAcc( "pi0PFOLinks" ); const PFO* TauJet_v2::pi0PFO( size_t i ) const { return ( *pi0PFOAcc( *this )[ i ] ); @@ -795,7 +795,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > protoChargedPFOAcc( "protoChargedPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > protoChargedPFOAcc( "protoChargedPFOLinks" ); const PFO* TauJet_v2::protoChargedPFO( size_t i ) const { return ( *protoChargedPFOAcc( *this )[ i ] ); @@ -825,7 +825,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > protoNeutralPFOAcc( "protoNeutralPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > protoNeutralPFOAcc( "protoNeutralPFOLinks" ); const PFO* TauJet_v2::protoNeutralPFO( size_t i ) const { return ( *protoNeutralPFOAcc( *this )[ i ] ); @@ -856,7 +856,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > protoPi0PFOAcc( "protoPi0PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v2::PFOLinks_t > protoPi0PFOAcc( "protoPi0PFOLinks" ); const PFO* TauJet_v2::protoPi0PFO( size_t i ) const { return ( *protoPi0PFOAcc( *this )[ i ] ); diff --git a/Event/xAOD/xAODTau/Root/TauJet_v3.cxx b/Event/xAOD/xAODTau/Root/TauJet_v3.cxx index 66b8a07b000cb624c05505bfc03e241ddcda4cf7..a465a61feee2a16cc3dd2575b592ff50d80f2b69 100644 --- a/Event/xAOD/xAODTau/Root/TauJet_v3.cxx +++ b/Event/xAOD/xAODTau/Root/TauJet_v3.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: TauJet_v3.cxx 725228 2016-02-19 22:59:42Z griffith $ @@ -188,10 +188,10 @@ namespace xAOD { void TauJet_v3::setP4(double pt, double eta, double phi, double m) { - static Accessor< float > acc1( "pt" ); - static Accessor< float > acc2( "eta" ); - static Accessor< float > acc3( "phi" ); - static Accessor< float > acc4( "m" ); + static const Accessor< float > acc1( "pt" ); + static const Accessor< float > acc2( "eta" ); + static const Accessor< float > acc3( "phi" ); + static const Accessor< float > acc4( "m" ); acc1( *this )=pt; acc2( *this )=eta; acc3( *this )=phi; @@ -260,7 +260,7 @@ namespace xAOD { bool TauJet_v3::hasDiscriminant( TauJetParameters::TauID discID ) const { // Get the discriminant accessor: - Accessor< float >* acc = xAODTau::discriminantAccessorV3( discID ); + const Accessor< float >* acc = xAODTau::discriminantAccessorV3( discID ); if( ! acc ) return false; return true; } @@ -271,7 +271,7 @@ namespace xAOD { //------------------------------------------------------------------------- double TauJet_v3::discriminant( TauJetParameters::TauID discriminant ) const { // Get the discriminant accessor: - Accessor< float >* acc = xAODTau::discriminantAccessorV3( discriminant ); + const Accessor< float >* acc = xAODTau::discriminantAccessorV3( discriminant ); if( ! acc ) return -1111.0; // Retrieve the discriminant value: @@ -292,7 +292,7 @@ namespace xAOD { bool TauJet_v3::isTau( TauJetParameters::IsTauFlag flag ) const { - static Accessor< uint32_t > acc( "isTauFlags" ); + static const Accessor< uint32_t > acc( "isTauFlags" ); std::bitset<32> isTauFlags( acc( *this ) ); return isTauFlags[flag]; } @@ -300,7 +300,7 @@ namespace xAOD { void TauJet_v3::setIsTau( TauJetParameters::IsTauFlag flag, bool value ) { - static Accessor< uint32_t > acc( "isTauFlags" ); + static const Accessor< uint32_t > acc( "isTauFlags" ); std::bitset<32> isTauFlags( acc( *this ) ); isTauFlags[flag] = value; acc( *this ) = isTauFlags.to_ulong(); @@ -313,7 +313,7 @@ namespace xAOD { // void TauJet_v3::setFlag( // TauJetParameters::VetoFlags flag, bool value ) // { - // static Accessor< uint32_t > acc( "vetoFlags" ); + // static const Accessor< uint32_t > acc( "vetoFlags" ); // std::bitset<32> vetoFlags( acc( *this ) ); // vetoFlags[flag] = value; // acc( *this ) = vetoFlags.to_ulong(); @@ -322,7 +322,7 @@ namespace xAOD { // bool TauJet_v3::flag( // TauJetParameters::VetoFlags flag ) const // { - // static Accessor< uint32_t > acc( "vetoFlags" ); + // static const Accessor< uint32_t > acc( "vetoFlags" ); // std::bitset<32> vetoFlags( acc( *this ) ); // return vetoFlags[flag]; // } @@ -334,7 +334,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v3::detail( TauJetParameters::Detail detail, int& value ) const { // Get the detail accessor: - Accessor< int >* acc = xAODTau::detailsAccessorV3<int>( detail ); + const Accessor< int >* acc = xAODTau::detailsAccessorV3<int>( detail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -348,7 +348,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v3::detail( TauJetParameters::Detail detail, float& value ) const { // Get the detail accessor: - Accessor< float >* acc = xAODTau::detailsAccessorV3<float>( detail ); + const Accessor< float >* acc = xAODTau::detailsAccessorV3<float>( detail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -363,7 +363,7 @@ namespace xAOD { bool TauJet_v3::detail( TauJetParameters::Detail detail, const IParticle* &value ) const { // Get the detail accessor: value=0; - Accessor< ElementLink<IParticleContainer> >* acc = xAODTau::detailsAccessorV3<ElementLink<IParticleContainer> >( detail ); + const Accessor< ElementLink<IParticleContainer> >* acc = xAODTau::detailsAccessorV3<ElementLink<IParticleContainer> >( detail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -409,7 +409,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v3::panTauDetail( TauJetParameters::PanTauDetails panTauDetail, int& value ) const { // Get the panTauDetail accessor: - Accessor< int >* acc = xAODTau::panTauDetailsAccessorV3<int>( panTauDetail ); + const Accessor< int >* acc = xAODTau::panTauDetailsAccessorV3<int>( panTauDetail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -423,7 +423,7 @@ namespace xAOD { //------------------------------------------------------------------------- bool TauJet_v3::panTauDetail( TauJetParameters::PanTauDetails panTauDetail, float& value ) const { // Get the panTauDetail accessor: - Accessor< float >* acc = xAODTau::panTauDetailsAccessorV3<float>( panTauDetail ); + const Accessor< float >* acc = xAODTau::panTauDetailsAccessorV3<float>( panTauDetail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -458,7 +458,7 @@ namespace xAOD { // tauTrackLinks, // setTauTrackLinks ) - static SG::AuxElement::Accessor< TauJet_v3::TauTrackLinks_t > tauTrackAcc( "tauTrackLinks" ); + static const SG::AuxElement::Accessor< TauJet_v3::TauTrackLinks_t > tauTrackAcc( "tauTrackLinks" ); const TauJet_v3::TauTrackLinks_t& TauJet_v3::allTauTrackLinks() const { return tauTrackAcc(*this); @@ -620,7 +620,7 @@ namespace xAOD { clusterLinks, setClusterLinks ) - static SG::AuxElement::Accessor< TauJet_v3::IParticleLinks_t > clusterAcc( "clusterLinks" ); + static const SG::AuxElement::Accessor< TauJet_v3::IParticleLinks_t > clusterAcc( "clusterLinks" ); const IParticle* TauJet_v3::cluster( size_t i) const { @@ -657,7 +657,7 @@ namespace xAOD { pi0Links, setPi0Links ) - static SG::AuxElement::Accessor< TauJet_v3::IParticleLinks_t > pi0Acc( "pi0Links" ); + static const SG::AuxElement::Accessor< TauJet_v3::IParticleLinks_t > pi0Acc( "pi0Links" ); const IParticle* TauJet_v3::pi0( size_t i) const { @@ -694,7 +694,7 @@ namespace xAOD { jetLink, setJetLink ) - static SG::AuxElement::Accessor< TauJet_v3::JetLink_t > jetAcc( "jetLink" ); + static const SG::AuxElement::Accessor< TauJet_v3::JetLink_t > jetAcc( "jetLink" ); const Jet* TauJet_v3::jet() const { return ( *jetAcc( *this ) ); @@ -715,7 +715,7 @@ namespace xAOD { vertexLink, setVertexLink ) - static SG::AuxElement::Accessor< TauJet_v3::VertexLink_t > vertexAcc( "vertexLink" ); + static const SG::AuxElement::Accessor< TauJet_v3::VertexLink_t > vertexAcc( "vertexLink" ); const Vertex* TauJet_v3::vertex() const { return ( *vertexAcc( *this ) ); @@ -736,7 +736,7 @@ namespace xAOD { secondaryVertexLink, setSecondaryVertexLink ) - static SG::AuxElement::Accessor< TauJet_v3::VertexLink_t > secondaryVertexAcc( "secondaryVertexLink" ); + static const SG::AuxElement::Accessor< TauJet_v3::VertexLink_t > secondaryVertexAcc( "secondaryVertexLink" ); const Vertex* TauJet_v3::secondaryVertex() const { return ( *secondaryVertexAcc( *this ) ); @@ -761,7 +761,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > hadronicPFOAcc( "hadronicPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > hadronicPFOAcc( "hadronicPFOLinks" ); const PFO* TauJet_v3::hadronicPFO( size_t i ) const { return ( *hadronicPFOAcc( *this )[ i ] ); @@ -790,7 +790,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > shotPFOAcc( "shotPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > shotPFOAcc( "shotPFOLinks" ); const PFO* TauJet_v3::shotPFO( size_t i ) const { return ( *shotPFOAcc( *this )[ i ] ); @@ -820,7 +820,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > chargedPFOAcc( "chargedPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > chargedPFOAcc( "chargedPFOLinks" ); const PFO* TauJet_v3::chargedPFO( size_t i ) const { return ( *chargedPFOAcc( *this )[ i ] ); @@ -851,7 +851,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > neutralPFOAcc( "neutralPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > neutralPFOAcc( "neutralPFOLinks" ); const PFO* TauJet_v3::neutralPFO( size_t i ) const { return ( *neutralPFOAcc( *this )[ i ] ); @@ -882,7 +882,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > pi0PFOAcc( "pi0PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > pi0PFOAcc( "pi0PFOLinks" ); const PFO* TauJet_v3::pi0PFO( size_t i ) const { return ( *pi0PFOAcc( *this )[ i ] ); @@ -916,7 +916,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > protoChargedPFOAcc( "protoChargedPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > protoChargedPFOAcc( "protoChargedPFOLinks" ); const PFO* TauJet_v3::protoChargedPFO( size_t i ) const { return ( *protoChargedPFOAcc( *this )[ i ] ); @@ -946,7 +946,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > protoNeutralPFOAcc( "protoNeutralPFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > protoNeutralPFOAcc( "protoNeutralPFOLinks" ); const PFO* TauJet_v3::protoNeutralPFO( size_t i ) const { return ( *protoNeutralPFOAcc( *this )[ i ] ); @@ -977,7 +977,7 @@ namespace xAOD { - static SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > protoPi0PFOAcc( "protoPi0PFOLinks" ); + static const SG::AuxElement::Accessor< TauJet_v3::PFOLinks_t > protoPi0PFOAcc( "protoPi0PFOLinks" ); const PFO* TauJet_v3::protoPi0PFO( size_t i ) const { return ( *protoPi0PFOAcc( *this )[ i ] ); diff --git a/Event/xAOD/xAODTau/Root/TauTrack_v1.cxx b/Event/xAOD/xAODTau/Root/TauTrack_v1.cxx index ff225b9f1f4d16bb56fbf6cd3fbdcd1a1548e61f..253665627e41915b6f35b6dceb91648d494704e9 100644 --- a/Event/xAOD/xAODTau/Root/TauTrack_v1.cxx +++ b/Event/xAOD/xAODTau/Root/TauTrack_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // EDM include(s): @@ -41,9 +41,9 @@ namespace xAOD { void TauTrack_v1::setP4(double pt, double eta, double phi, double /*m*/) { // Set the raw variables: - static Accessor< float > acc1( "pt" ); - static Accessor< float > acc2( "eta" ); - static Accessor< float > acc3( "phi" ); + static const Accessor< float > acc1( "pt" ); + static const Accessor< float > acc2( "eta" ); + static const Accessor< float > acc3( "phi" ); acc1( *this ) = pt; acc2( *this ) = eta; acc3( *this ) = phi; @@ -72,14 +72,14 @@ namespace xAOD { AUXSTORE_PRIMITIVE_SETTER_AND_GETTER( TauTrack_v1, TauTrack_v1::TrackFlagType, flagSet, setFlagSet) bool TauTrack_v1::flag(TauJetParameters::TauTrackFlag flag) const{ - static Accessor< TauTrack_v1::TrackFlagType > trackFlags("flagSet"); + static const Accessor< TauTrack_v1::TrackFlagType > trackFlags("flagSet"); TrackFlagType f(trackFlags(*this)); std::bitset<8*sizeof(TrackFlagType)> thisTracksFlags(f); return thisTracksFlags[flag]; } bool TauTrack_v1::flagWithMask(unsigned int flags) const{ - static Accessor< TauTrack_v1::TrackFlagType > trackFlags("flagSet"); + static const Accessor< TauTrack_v1::TrackFlagType > trackFlags("flagSet"); TrackFlagType f(trackFlags(*this)); // std::bitset<8*sizeof(TrackFlagType)> thisTracksFlags(f); // std::bitset<8*sizeof(TrackFlagType)> tracksFlags(flags); @@ -91,7 +91,7 @@ namespace xAOD { } void TauTrack_v1::setFlag(TauJetParameters::TauTrackFlag flag, bool value){ - static Accessor< TauTrack_v1::TrackFlagType > trackFlags("flagSet"); + static const Accessor< TauTrack_v1::TrackFlagType > trackFlags("flagSet"); TrackFlagType& f(trackFlags(*this)); std::bitset<8*sizeof(TrackFlagType)> thisTracksFlags(f); thisTracksFlags[flag] = value; @@ -146,7 +146,7 @@ namespace xAOD { bool TauTrack_v1::detail( TauJetParameters::TrackDetail detail, float& value ) const{ // Get the detail accessor: - Accessor< float >* acc = xAODTau::trackDetailsAccessorV3<float>( detail ); + const Accessor< float >* acc = xAODTau::trackDetailsAccessorV3<float>( detail ); if( ! acc ) return false; if( ! acc->isAvailable( *this ) ) return false; @@ -166,7 +166,7 @@ namespace xAOD { bdtScores, setBdtScores ) - static SG::AuxElement::Accessor< std::vector<float> > bdtScoreAcc( "bdtScores" ); + static const SG::AuxElement::Accessor< std::vector<float> > bdtScoreAcc( "bdtScores" ); float TauTrack_v1::bdtScore( size_t i) const { return bdtScoreAcc(*this).at(i); @@ -195,7 +195,7 @@ namespace xAOD { trackLinks, setTrackLinks ) - static SG::AuxElement::Accessor< TauTrack_v1::TrackParticleLinks_t > trackAcc( "trackLinks" ); + static const SG::AuxElement::Accessor< TauTrack_v1::TrackParticleLinks_t > trackAcc( "trackLinks" ); const TrackParticle* TauTrack_v1::track() const { return ( *trackAcc( *this )[0] ); diff --git a/Event/xAOD/xAODTau/xAODTau/ATLAS_CHECK_THREAD_SAFETY b/Event/xAOD/xAODTau/xAODTau/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..7db22f5e714eb47ccac746b3184027560a0ddd9c --- /dev/null +++ b/Event/xAOD/xAODTau/xAODTau/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Event/xAOD/xAODTau diff --git a/Event/xAOD/xAODTrigger/Root/TrigComposite_v1.cxx b/Event/xAOD/xAODTrigger/Root/TrigComposite_v1.cxx index 3d916bee953856ab315ffaf8a2ed195525ac06d1..7316fe5b5aafa5ad4a841ec27167a23cd49cec9d 100644 --- a/Event/xAOD/xAODTrigger/Root/TrigComposite_v1.cxx +++ b/Event/xAOD/xAODTrigger/Root/TrigComposite_v1.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -340,6 +340,19 @@ namespace xAOD { } } + bool TrigComposite_v1::typelessGetObjectLink( const std::string& name, uint32_t& key, uint32_t& clid, uint16_t& index ) const { + std::vector<std::string>::const_iterator it = std::find(linkColNames().begin(), linkColNames().end(), name); + if (it == linkColNames().end()) { + return false; + } + const size_t location = std::distance(linkColNames().begin(), it); + key = linkColKeys().at(location); + clid = linkColClids().at(location); + index = linkColIndices().at(location); + return true; + } + + bool TrigComposite_v1::isRemapped() const { static const Accessor< std::vector< uint32_t > > key_remap( "remap_linkColKeys" ); static const Accessor< std::vector< uint16_t > > index_remap( "remap_linkColIndices" ); diff --git a/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigComposite_v1.h b/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigComposite_v1.h index 635e92f0ab39ddada4fd68394af821592cad2e99..e21a11c301a25f183d8a328867a0c2e1bc54c744 100644 --- a/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigComposite_v1.h +++ b/Event/xAOD/xAODTrigger/xAODTrigger/versions/TrigComposite_v1.h @@ -1,7 +1,7 @@ // Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef XAODTRIGGER_VERSIONS_TRIGCOMPOSITE_V1_H @@ -129,6 +129,18 @@ namespace xAOD { const uint16_t beginIndex, const uint16_t endIndex = 0 ); + /// Fetches a single link without type. Note: Will not work for collections of links + /// @param[in] name Name of the stored link + /// @param[out] key Storegte key of the link-object's collection + /// @param[out] clid Type of the object's collection + /// @param[out] index Index within the collection of the link-object + /// @return True if a link was found + bool typelessGetObjectLink( const std::string& name, + uint32_t& key, + uint32_t& clid, + uint16_t& index ) const; + + /// Look up all links stored to objects of (container) type CONTAINER /// @return Vector of names to all links to objects template< class CONTAINER > diff --git a/Generators/EvgenJobTransforms/share/skeleton.GENtoEVGEN.py b/Generators/EvgenJobTransforms/share/skeleton.GENtoEVGEN.py index 44e0fcd2e5714f05f0b2789a450fb669273ded66..4e5b86541a0eebc2a0f0f990d6b2dc3d82709082 100644 --- a/Generators/EvgenJobTransforms/share/skeleton.GENtoEVGEN.py +++ b/Generators/EvgenJobTransforms/share/skeleton.GENtoEVGEN.py @@ -574,7 +574,7 @@ from PyJobTransformsCore.runargs import RunArguments runPars = RunArguments() runPars.minevents = evgenConfig.minevents runPars.maxeventsstrategy = evgenConfig.maxeventsstrategy -with open("config.pickle", 'w') as f: +with open("config.pickle", 'wb') as f: import pickle pickle.dump(runPars, f) diff --git a/Generators/EvgenProdTools/python/LogicalExpressionFilter.py b/Generators/EvgenProdTools/python/LogicalExpressionFilter.py index 1f378361f897062e19f6add295f2273cec054964..4602b6bfaae67bcbd53269ea06234949a048eb5c 100644 --- a/Generators/EvgenProdTools/python/LogicalExpressionFilter.py +++ b/Generators/EvgenProdTools/python/LogicalExpressionFilter.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ##============================================================================== ## Name: LogicalExpressionFilter.py @@ -24,7 +24,7 @@ from AthenaCommon.AlgSequence import AlgSequence from AthenaCommon.Logging import logging import tokenize -from cStringIO import StringIO +from io import StringIO class LogicalExpressionFilter( PyAthena.Alg ): _isLocked=False @@ -150,7 +150,7 @@ class LogicalExpressionFilter( PyAthena.Alg ): #execute command once to validate #response = bool(eval(self.cmd)) - except Exception, e: + except Exception as e: self.msg.fatal("%s is not a valid Python expression string. Exception: %s" % (self.Expression,e)) return StatusCode.Failure diff --git a/Generators/Herwig7_i/python/Herwig7Config.py b/Generators/Herwig7_i/python/Herwig7Config.py index 58905a9246f593f8ca91c7f0e4bf9a5307292af3..71723c4d65d5ae9c59e38bfa97973aff70e10cb6 100644 --- a/Generators/Herwig7_i/python/Herwig7Config.py +++ b/Generators/Herwig7_i/python/Herwig7Config.py @@ -3,7 +3,7 @@ ## \file Herwig7Config.py ## \brief Python convenience snippets providing re-usable bits of settings for use in the jobOptions -import Herwig7Utils as hw7Utils +from . import Herwig7Utils as hw7Utils ## Configuration base class for %Herwig7 class Hw7Config(object): diff --git a/Generators/Herwig7_i/python/Herwig7ConfigBuiltinME.py b/Generators/Herwig7_i/python/Herwig7ConfigBuiltinME.py index eb0942b173ccc5d177c01bcef4636c9b9d25f9e1..329d00e36c21f1952c6a212299ab000bf7fd32fb 100644 --- a/Generators/Herwig7_i/python/Herwig7ConfigBuiltinME.py +++ b/Generators/Herwig7_i/python/Herwig7ConfigBuiltinME.py @@ -4,9 +4,9 @@ ## \brief Configuration class for built-in / "old-style" matrix elements ## \author Daniel Rauch (daniel.rauch@desy.de) -import Herwig7Config as hw7Config -import Herwig7Control as hw7Control -import Herwig7Utils as hw7Utils +from . import Herwig7Config as hw7Config +from . import Herwig7Control as hw7Control +from . import Herwig7Utils as hw7Utils ## Configuration class for built-in / "old-style" matrix elements diff --git a/Generators/Herwig7_i/python/Herwig7Control.py b/Generators/Herwig7_i/python/Herwig7Control.py index c736c8e131ef7d42ebf671d20a2d90c37f9bd303..d03f2f44891b25d9fb2503ab426d72981da517be 100644 --- a/Generators/Herwig7_i/python/Herwig7Control.py +++ b/Generators/Herwig7_i/python/Herwig7Control.py @@ -11,9 +11,10 @@ ## in Herwig7_i/Herwig7.h and src/Herwig7.cxx. import datetime, os, shutil, subprocess, sys, time +import six -import Herwig7Config as hw7Config -import Herwig7Utils as hw7Utils +from . import Herwig7Config as hw7Config +from . import Herwig7Utils as hw7Utils # import Herwig7Defaults as HwDefaults from AthenaCommon import Logging @@ -355,7 +356,7 @@ def start_banner(): def get_software_versions(): - return(subprocess.check_output([herwig7_binary,'--version']).splitlines()) + return(six.ensure_str(subprocess.check_output([herwig7_binary,'--version'])).splitlines()) def get_infile_name(run_name="Herwig-Matchbox"): diff --git a/Generators/Herwig7_i/python/Herwig7Utils.py b/Generators/Herwig7_i/python/Herwig7Utils.py index 71a7b979cf1e317c211fc78d386e42ecca5687c8..1f021fbe2f48ca5ed0312542c3c2765d39aa9621 100644 --- a/Generators/Herwig7_i/python/Herwig7Utils.py +++ b/Generators/Herwig7_i/python/Herwig7Utils.py @@ -184,11 +184,11 @@ def humanize_bytes(bytes, precision=2): # http://code.activestate.com/recipes/577081-humanized-representation-of-a-number-of-bytes/ abbrevs = ( - (1<<50L, 'PiB'), - (1<<40L, 'TiB'), - (1<<30L, 'GiB'), - (1<<20L, 'MiB'), - (1<<10L, 'KiB'), + (1<<50, 'PiB'), + (1<<40, 'TiB'), + (1<<30, 'GiB'), + (1<<20, 'MiB'), + (1<<10, 'KiB'), (1, 'byte(s)') ) if bytes == 1: diff --git a/Generators/Herwig7_i/python/config.py b/Generators/Herwig7_i/python/config.py index 3e6a31008f77ea2ec01d43436393de0e7062b433..685404255741115345a191cbc13382a9b901b405 100644 --- a/Generators/Herwig7_i/python/config.py +++ b/Generators/Herwig7_i/python/config.py @@ -1,10 +1,12 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## \file Herwig7_i/python/config.py ## \brief Python functions that are usable in the Herwig 7 jobOptions ## \author Daniel Rauch (daniel.rauch@desy.de) ## +from __future__ import print_function + ## Choose symmetric collider energy def energy_cmds(sqrts): "Set sqrts(s) in GeV" @@ -486,4 +488,4 @@ if __name__ == "__main__": sqrts = 14000 if len(sys.argv) > 1: sqrts = float(sys.argv[1]) - print energy_cmds(sqrts) + print (energy_cmds(sqrts)) diff --git a/Generators/PowhegControl/python/DecoratorFactory.py b/Generators/PowhegControl/python/DecoratorFactory.py index 625f572413a4c445e95279f5f79705d16f4af4af..958a3304493d7e47e2e8b280a25b2dcf41ff0cfb 100644 --- a/Generators/PowhegControl/python/DecoratorFactory.py +++ b/Generators/PowhegControl/python/DecoratorFactory.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @PowhegControl PowhegDecorators # Powheg runcard decorators @@ -6,7 +6,7 @@ # Authors: James Robinson <james.robinson@cern.ch> #! /usr/bin/env python -from decorators import * +from .decorators import * def decorate( powheg_controller, decorator, **kwargs ) : ## Initialise correct decorator for Powheg configurable diff --git a/Generators/PowhegControl/python/PowhegConfig_base.py b/Generators/PowhegControl/python/PowhegConfig_base.py index deba27c5afa18080921672f7a6913dbce6a324e9..1f9a0c895003dc2a108ad21b57f7e5ed3a9cc93e 100644 --- a/Generators/PowhegControl/python/PowhegConfig_base.py +++ b/Generators/PowhegControl/python/PowhegConfig_base.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @PowhegControl PowhegConfig_base # PowhegControl base class for all Powheg processes @@ -9,10 +9,10 @@ #! /usr/bin/env python import glob, os, subprocess, time -import strategies +from . import strategies from AthenaCommon import Logging -from DecoratorFactory import decorate -from utility import IntegrationGridTester, LHEHandler, RepeatingTimer +from .DecoratorFactory import decorate +from .utility import IntegrationGridTester, LHEHandler, RepeatingTimer ## Base class for configurable objects in the jobOptions # @@ -126,11 +126,11 @@ class PowhegConfig_base(object) : # Print list of configurable parameters for users self.logger.info( '** User configurable parameters for this process **' ) self.logger.info( ': Option name : ATLAS default : Current : Description' ) - for configurable_list in sorted( self.configurable_parameters.values()+self.phantom_parameters.values(), key=lambda x: x[0].lower() ) : + for configurable_list in sorted( list(self.configurable_parameters.values())+list(self.phantom_parameters.values()), key=lambda x: x[0].lower() ) : self.logger.info( ': {0:<15} : {1:>13} : {2:>9} : {3}'.format( configurable_list[0], configurable_list[1], getattr(self, configurable_list[0]), configurable_list[2] ) ) # Add configurable parameters to fixed list - [ self.fix_parameter( non_configurable_name=configurable_list[0], default=configurable_list[1], desc=configurable_list[2] ) for configurable_list in self.configurable_parameters.values() ] + [ self.fix_parameter( non_configurable_name=configurable_list[0], default=configurable_list[1], desc=configurable_list[2] ) for configurable_list in list(self.configurable_parameters.values()) ] # Write out final runcard self.logger.info( 'Writing Powheg runcard to {0}'.format( self.run_card_path ) ) diff --git a/Generators/PowhegControl/python/__init__.py b/Generators/PowhegControl/python/__init__.py index e06b4129b413fdc2de78aa198115648a6fe12303..bd6fa95714e2e816c8cd997a7522d3307141defa 100644 --- a/Generators/PowhegControl/python/__init__.py +++ b/Generators/PowhegControl/python/__init__.py @@ -1,6 +1,6 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from PowhegConfig_base import * +from .PowhegConfig_base import * from .decorators import * from .processes import * from .utility import * diff --git a/Generators/PowhegControl/python/decorators/__init__.py b/Generators/PowhegControl/python/decorators/__init__.py index 612d917e415368919f78755fcced15b0529dfba1..de628eb3c0ffc6abcd2de6866297bfaac80343ac 100644 --- a/Generators/PowhegControl/python/decorators/__init__.py +++ b/Generators/PowhegControl/python/decorators/__init__.py @@ -1,49 +1,49 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from AnomalousCouplingDecorator import * -from BaseDecorator import * -from CKKWDecorator import * -from CKMDecorator import * -from DarkMatterDecorator import * -from DarkMatterPhiDecorator import * -from DibosonDecorator import * -from DibosonInterferenceDecorator import * -from ExtraTestsDecorator import * -from FakeVirtualDecorator import * -from FixedScaleDecorator import * -from HeavyQuarkDecorator import * -from HiggsDecayModeDecorator import * -from HiggsDecayPropertiesDecorator import * -from HiggsFixedWidthDecorator import * -from HiggsMassWindowDecorator import * -from HiggsPropertiesDecorator import * -from HPlusJetsDecorator import * -from HVJDecorator import * -from JacsingDecorator import * -from LeptonMassDecorator import * -from LHEv3Decorator import * -from MassWindowDecorator import * -from MiNLONLLDecorator import * -from NNLOReweightingDecorator import * -from RadiationParametrisationDecorator import * -from RunningScaleDecorator import * -from RunningScalesDecorator import * -from RunningWidthDecorator import * -from SecondGenerationQuarkMassDecorator import * -from SemileptonicDecorator import * -from Sin2ThetaWDecorator import * -from SingleTopDecorator import * -from SingleVectorBosonDecorator import * -from TopDecayBranchingDecorator import * -from TopDecayModeDecorator import * -from TopDecaySecondGenerationQuarkDecorator import * -from TopMassDecorator import * -from VectorBosonDecayDecorator import * -from V2Decorator import * -from VPlusJetsDecorator import * -from WIDDecorator import * -from WDecayModeDecorator import * -from WMassWindowDecorator import * -from WWDecayDecorator import * -from ZeroWidthDecorator import * -from ZMassWindowDecorator import * +from .AnomalousCouplingDecorator import * +from .BaseDecorator import * +from .CKKWDecorator import * +from .CKMDecorator import * +from .DarkMatterDecorator import * +from .DarkMatterPhiDecorator import * +from .DibosonDecorator import * +from .DibosonInterferenceDecorator import * +from .ExtraTestsDecorator import * +from .FakeVirtualDecorator import * +from .FixedScaleDecorator import * +from .HeavyQuarkDecorator import * +from .HiggsDecayModeDecorator import * +from .HiggsDecayPropertiesDecorator import * +from .HiggsFixedWidthDecorator import * +from .HiggsMassWindowDecorator import * +from .HiggsPropertiesDecorator import * +from .HPlusJetsDecorator import * +from .HVJDecorator import * +from .JacsingDecorator import * +from .LeptonMassDecorator import * +from .LHEv3Decorator import * +from .MassWindowDecorator import * +from .MiNLONLLDecorator import * +from .NNLOReweightingDecorator import * +from .RadiationParametrisationDecorator import * +from .RunningScaleDecorator import * +from .RunningScalesDecorator import * +from .RunningWidthDecorator import * +from .SecondGenerationQuarkMassDecorator import * +from .SemileptonicDecorator import * +from .Sin2ThetaWDecorator import * +from .SingleTopDecorator import * +from .SingleVectorBosonDecorator import * +from .TopDecayBranchingDecorator import * +from .TopDecayModeDecorator import * +from .TopDecaySecondGenerationQuarkDecorator import * +from .TopMassDecorator import * +from .VectorBosonDecayDecorator import * +from .V2Decorator import * +from .VPlusJetsDecorator import * +from .WIDDecorator import * +from .WDecayModeDecorator import * +from .WMassWindowDecorator import * +from .WWDecayDecorator import * +from .ZeroWidthDecorator import * +from .ZMassWindowDecorator import * diff --git a/Generators/PowhegControl/python/processes/__init__.py b/Generators/PowhegControl/python/processes/__init__.py index d427f555a73c0f111b47bb380569132c940c77aa..f8e165239568e88ffab72e6cede8a14ea501cd3f 100644 --- a/Generators/PowhegControl/python/processes/__init__.py +++ b/Generators/PowhegControl/python/processes/__init__.py @@ -1,30 +1,30 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from PowhegConfig_bb import * -from PowhegConfig_DMS_tloop import * -from PowhegConfig_DMV import * -from PowhegConfig_DMGG import * -from PowhegConfig_ggF_H import * -from PowhegConfig_ggF_HZ import * -from PowhegConfig_Hj import * -from PowhegConfig_Hjj import * -from PowhegConfig_HWj import * -from PowhegConfig_HZj import * -from PowhegConfig_jj import * -from PowhegConfig_jjj import * -from PowhegConfig_ssWWjj import * -from PowhegConfig_t_sch import * -from PowhegConfig_tt import * -from PowhegConfig_ttH import * -from PowhegConfig_ttj import * -from PowhegConfig_VBF_H import * -from PowhegConfig_VBF_ssWW import * -from PowhegConfig_W import * -from PowhegConfig_Wj import * -from PowhegConfig_Wt_DR import * -from PowhegConfig_Wt_DS import * -from PowhegConfig_WW import * -from PowhegConfig_WZ import * -from PowhegConfig_Z import * -from PowhegConfig_Zj import * -from PowhegConfig_ZZ import * +from .PowhegConfig_bb import * +from .PowhegConfig_DMS_tloop import * +from .PowhegConfig_DMV import * +from .PowhegConfig_DMGG import * +from .PowhegConfig_ggF_H import * +from .PowhegConfig_ggF_HZ import * +from .PowhegConfig_Hj import * +from .PowhegConfig_Hjj import * +from .PowhegConfig_HWj import * +from .PowhegConfig_HZj import * +from .PowhegConfig_jj import * +from .PowhegConfig_jjj import * +from .PowhegConfig_ssWWjj import * +from .PowhegConfig_t_sch import * +from .PowhegConfig_tt import * +from .PowhegConfig_ttH import * +from .PowhegConfig_ttj import * +from .PowhegConfig_VBF_H import * +from .PowhegConfig_VBF_ssWW import * +from .PowhegConfig_W import * +from .PowhegConfig_Wj import * +from .PowhegConfig_Wt_DR import * +from .PowhegConfig_Wt_DS import * +from .PowhegConfig_WW import * +from .PowhegConfig_WZ import * +from .PowhegConfig_Z import * +from .PowhegConfig_Zj import * +from .PowhegConfig_ZZ import * diff --git a/Generators/PowhegControl/python/strategies/AfterburnerReweighting.py b/Generators/PowhegControl/python/strategies/AfterburnerReweighting.py index 22a3ea9e975cae5a74787de4b96e4aec275afa89..1abc26ba4a1e52ee67d733d23a4186278efa5209 100644 --- a/Generators/PowhegControl/python/strategies/AfterburnerReweighting.py +++ b/Generators/PowhegControl/python/strategies/AfterburnerReweighting.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @PowhegControl AfterburnerReweighting # Reweight pre-generated Powheg events @@ -7,7 +7,7 @@ #! /usr/bin/env python import collections, os, shutil, subprocess, time -from GenerateSingleCore import * +from .GenerateSingleCore import * from ..utility import FileParser, RepeatingTimer ## Initialise and validate reweighting lists diff --git a/Generators/PowhegControl/python/strategies/__init__.py b/Generators/PowhegControl/python/strategies/__init__.py index 087c44fb813bf9af9575a7b06ec980b273284629..3e1a64de116bed898b47dee5ebe7b1cc3bb9c3ef 100644 --- a/Generators/PowhegControl/python/strategies/__init__.py +++ b/Generators/PowhegControl/python/strategies/__init__.py @@ -1,7 +1,7 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from AfterburnerNNLOReweighting import * -from AfterburnerReweighting import * -from GenerateSingleCore import * -from GenerateV1MultiCore import * -from GenerateV2MultiCore import * +from .AfterburnerNNLOReweighting import * +from .AfterburnerReweighting import * +from .GenerateSingleCore import * +from .GenerateV1MultiCore import * +from .GenerateV2MultiCore import * diff --git a/Generators/PowhegControl/python/utility/NonBlockingStreamReader.py b/Generators/PowhegControl/python/utility/NonBlockingStreamReader.py index bf42f6937d9822bbb3d2434ff98be489cdd35dc4..53d3d6b8184a886acac03b27be43a994ab22e6f2 100644 --- a/Generators/PowhegControl/python/utility/NonBlockingStreamReader.py +++ b/Generators/PowhegControl/python/utility/NonBlockingStreamReader.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @PowhegControl NonBlockingStreamReader # Read an output stream without blocking @@ -8,14 +8,14 @@ #! /usr/bin/env python import threading -import Queue +import queue class NonBlockingStreamReader(object) : ## Set up input stream, output queue and process to transfer between them def __init__(self, input_stream): self._stream = input_stream - self._queue = Queue.Queue() + self._queue = queue.Queue() self._running = True self._output_thread = threading.Thread( target=self.populate_queue, args=(self._stream, self._queue) ) @@ -34,7 +34,7 @@ class NonBlockingStreamReader(object) : def readline(self, timeout = None): try: return self._queue.get( block=(timeout is not None), timeout=timeout ).rstrip() - except Queue.Empty : + except queue.Empty : return None diff --git a/Generators/PowhegControl/python/utility/ProcessHandling.py b/Generators/PowhegControl/python/utility/ProcessHandling.py index 5d58558c95253ce9d5beb627aa076a3089721e8d..74030929da7028e6c415b0b959ea929ca3216e0b 100644 --- a/Generators/PowhegControl/python/utility/ProcessHandling.py +++ b/Generators/PowhegControl/python/utility/ProcessHandling.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @PowhegControl ProcessHandling # Utility classes to handle Powheg processes @@ -8,7 +8,7 @@ #! /usr/bin/env python import subprocess import time -from NonBlockingStreamReader import NonBlockingStreamReader +from .NonBlockingStreamReader import NonBlockingStreamReader ## A wrapper to handle multiple Powheg subprocesses class ProcessManager : diff --git a/Generators/PowhegControl/python/utility/RepeatingTimer.py b/Generators/PowhegControl/python/utility/RepeatingTimer.py index 7389c7f1723140aef4295fcacca2ce3bae3cb63b..e94db66bdb8d77236447ff17c9def82b8b32d256 100644 --- a/Generators/PowhegControl/python/utility/RepeatingTimer.py +++ b/Generators/PowhegControl/python/utility/RepeatingTimer.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @PowhegControl RepeatingTimer # Helper class to run repeating timer in additional thread @@ -8,9 +8,12 @@ #! /usr/bin/env python import threading +import six +BaseTimer = threading._Timer if six.PY2 else threading.Timer + ## Allow timing output in an additional thread. # From http://stackoverflow.com/questions/5429577/ -class RepeatingTimer(threading._Timer) : +class RepeatingTimer(BaseTimer) : ## Override Thread.run with desired behaviour def run(self): diff --git a/Generators/PowhegControl/python/utility/__init__.py b/Generators/PowhegControl/python/utility/__init__.py index b6934ac32aaf8eeffc0147eb5d20a8570ddbe64f..9c2314160216d40a29bb5262ef14ea07e80b6246 100644 --- a/Generators/PowhegControl/python/utility/__init__.py +++ b/Generators/PowhegControl/python/utility/__init__.py @@ -1,8 +1,8 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -from FileParser import * -from IntegrationGridTester import * -from LHEHandler import * -from NonBlockingStreamReader import * -from ProcessHandling import * -from RepeatingTimer import * +from .FileParser import * +from .IntegrationGridTester import * +from .LHEHandler import * +from .NonBlockingStreamReader import * +from .ProcessHandling import * +from .RepeatingTimer import * diff --git a/Generators/Pythia8B_i/src/Pythia8B_i.cxx b/Generators/Pythia8B_i/src/Pythia8B_i.cxx index 858abea24274f9ceb38d767c642d5b73d329b1e1..d68b4d71b497d36413cb56dbb00dc4921b2f145d 100644 --- a/Generators/Pythia8B_i/src/Pythia8B_i.cxx +++ b/Generators/Pythia8B_i/src/Pythia8B_i.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ====================================================================== @@ -98,6 +98,9 @@ StatusCode Pythia8B_i::genInitialize() { return RndmStatus; } + // Call the base class genInitialize() + ATH_CHECK (Pythia8_i::genInitialize()); + // This over-rides the genInitialize in the base class Pythia8_i, but then calls it // Sets the built-in UserHook called SuppressLowPT // FOR ONIA USE ONLY @@ -107,11 +110,7 @@ StatusCode Pythia8B_i::genInitialize() { Pythia8_i::m_pythia->setUserHooksPtr(m_SuppressSmallPT); } - // Call the base class genInitialize() - if (Pythia8_i::genInitialize().isSuccess()) { - return StatusCode::SUCCESS; - } else {return StatusCode::FAILURE;} - + return StatusCode::SUCCESS; } diff --git a/Generators/Pythia8_i/CMakeLists.txt b/Generators/Pythia8_i/CMakeLists.txt index 4b8090be9ead55e896e7c5470d13cde3cc26ba9c..cc9a664e23d97690f4bcad91b392b7254824e125 100644 --- a/Generators/Pythia8_i/CMakeLists.txt +++ b/Generators/Pythia8_i/CMakeLists.txt @@ -20,7 +20,8 @@ find_package( CLHEP ) find_package( Lhapdf ) find_package( Pythia8 ) -add_definitions(-DPY8VERSION=\"${PYTHIA8_VERSION}\") +# The _VERSION variable is unreliable. +add_definitions(-DPY8INCLUDE_DIR=\"${PYTHIA8_INCLUDE_DIR}\") # Remove the --as-needed linker flags: atlas_disable_as_needed() diff --git a/Generators/Pythia8_i/src/Pythia8_i.cxx b/Generators/Pythia8_i/src/Pythia8_i.cxx index 1e6605730f05536e405aae1d5e9747e6dba27d53..a8c9bb3fb73554836d54436f3f0992827c956002 100644 --- a/Generators/Pythia8_i/src/Pythia8_i.cxx +++ b/Generators/Pythia8_i/src/Pythia8_i.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "Pythia8_i/Pythia8_i.h" @@ -29,6 +29,25 @@ using boost::assign::operator+=; /** * author: James Monk (jmonk@cern.ch) */ + + +namespace { + +std::string py8version() +{ + static const std::string incdir (PY8INCLUDE_DIR); + std::string::size_type pos = incdir.find ("/pythia8/"); + if (pos == std::string::npos) return ""; + pos += 9; + std::string::size_type pos2 = incdir.find ("/", pos); + if (pos2 == std::string::npos) pos2 = incdir.size(); + return incdir.substr (pos, pos2-pos); +} + + +} + + //////////////////////////////////////////////////////////////////////////////// Pythia8_i::Pythia8_i(const string &name, ISvcLocator *pSvcLocator) : GenModule(name, pSvcLocator), @@ -98,7 +117,7 @@ StatusCode Pythia8_i::genInitialize() { std::string pythiaVersion = boost::lexical_cast<std::string>(m_version + 0.00000000001); pythiaVersion.erase(5); - std::string libVersion = "8." + std::string(PY8VERSION); + std::string libVersion = "8." + std::string(py8version()); if(pythiaVersion != libVersion){ ATH_MSG_ERROR("Version of Pythia in xmldoc (" + pythiaVersion + ") does not matched linked library version (" + libVersion + ")"); @@ -518,7 +537,7 @@ StatusCode Pythia8_i::genFinalize(){ xs *= 1000. * 1000.;//convert to nb std::cout << "MetaData: cross-section (nb)= " << xs <<std::endl; - std::cout << "MetaData: generator= Pythia 8." << PY8VERSION <<std::endl; + std::cout << "MetaData: generator= Pythia 8." << py8version() <<std::endl; if(m_doLHE3Weights || m_weightIDs.size()>1 ){ std::cout<<"MetaData: weights = "; @@ -562,31 +581,10 @@ string Pythia8_i::findValue(const string &command, const string &key){ //////////////////////////////////////////////////////////////////////////////// string Pythia8_i::xmlpath(){ - char *cmtpath = getenv("CMTPATH"); - char *cmtconfig = getenv("CMTCONFIG"); - string foundpath = ""; - if(cmtpath != 0 && cmtconfig != 0){ - - std::vector<string> cmtpaths; - boost::split(cmtpaths, cmtpath, boost::is_any_of(string(":"))); - - string installPath = "/InstallArea/" + string(cmtconfig) + "/share/Pythia8/xmldoc"; - - for(std::vector<string>::const_iterator path = cmtpaths.begin(); - path != cmtpaths.end() && foundpath == ""; ++path){ - string testPath = *path + installPath; - std::ifstream testFile(testPath.c_str()); - if(testFile.good()) foundpath = testPath; - testFile.close(); - } - - } else { - // If the CMT environment is missing, try to find the xmldoc directory - // using PathResolver: - foundpath = PathResolverFindCalibDirectory( "Pythia8/xmldoc" ); - } + // Try to find the xmldoc directory using PathResolver: + foundpath = PathResolverFindCalibDirectory( "Pythia8/xmldoc" ); return foundpath; } diff --git a/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT-select-PEB-stream.py b/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT-select-PEB-stream.py index 85351a2bc83532a289985271e151768dfeadb6bb..d2a1027dd58408f90d30f03a450a278553452ffa 100755 --- a/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT-select-PEB-stream.py +++ b/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT-select-PEB-stream.py @@ -168,7 +168,7 @@ def peb_writer(argv): beam_energy=dr.beamEnergy()) # decide what to write out - if streamType == 'physics' or streamType == 'express' or (len(tag.robs)==0 and len(tag.dets)==0): + if (len(tag.robs)==0 and len(tag.dets)==0): # write out the full event fragment pbev = eformat.write.FullEventFragment(e) logging.debug(' Write full event fragment ') diff --git a/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py b/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py index 3dadec1aac7ceda37569cd224d32cd583ef5ae93..9ee697a1589bce5431fd7c814976938e67f9d324 100755 --- a/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py +++ b/HLT/Trigger/TrigControl/TrigCommon/bin/athenaHLT.py @@ -282,10 +282,10 @@ def main(): ## Global options g = parser.add_argument_group('Options') g.add_argument('jobOptions', help='job options (or JSON) file') - g.add_argument('--file', '-f', action='append', required=True, help='input RAW file') + g.add_argument('--file', '--filesInput', '-f', action='append', required=True, help='input RAW file') g.add_argument('--save-output', '-o', metavar='FILE', help='output file name') - g.add_argument('--number-of-events', '-n', metavar='N', default=-1, help='processes N events (<=0 means all)') - g.add_argument('--skip-events', '-k', metavar='N', default=0, help='skip N first events') + g.add_argument('--number-of-events', '--evtMax', '-n', metavar='N', default=-1, help='processes N events (<=0 means all)') + g.add_argument('--skip-events', '--skipEvents', '-k', metavar='N', default=0, help='skip N first events') g.add_argument('--threads', metavar='N', type=int, default=1, help='number of threads') g.add_argument('--nprocs', metavar='N', type=int, default=1, help='number of children to fork') g.add_argument('--concurrent-events', metavar='N', type=int, help='number of concurrent events if different from --threads') diff --git a/HLT/Trigger/TrigControl/TrigPSC/share/TrigPSCPythonSetup.py b/HLT/Trigger/TrigControl/TrigPSC/share/TrigPSCPythonSetup.py index 85f6903cb994748cfe0fcebdb941b58217df2fbb..b4a4894b08d7d6a928a1b5a4a35ef12a487c2e90 100755 --- a/HLT/Trigger/TrigControl/TrigPSC/share/TrigPSCPythonSetup.py +++ b/HLT/Trigger/TrigControl/TrigPSC/share/TrigPSCPythonSetup.py @@ -97,8 +97,8 @@ else: print(" +------------------------------------------------+ ") print(" ---> Command = %s" % PscConfig.optmap['PRECOMMAND']) try: - exec PscConfig.optmap['PRECOMMAND'] - except Exception, e: + exec(PscConfig.optmap['PRECOMMAND']) + except Exception as e: if isinstance( e, IncludeError ): print(sys.exc_type, e) theApp._exitstate = ExitCodes.INCLUDE_ERROR @@ -120,7 +120,7 @@ else: ### run user jobOptions file ------------------------------------------------- try: include( "%s" % PscConfig.optmap['JOBOPTIONSPATH'] ) - except Exception, e: + except Exception as e: if isinstance(e,SystemExit): raise @@ -163,8 +163,8 @@ else: print(" +------------------------------------------------+ ") print(" ---> Command = ", PscConfig.optmap['POSTCOMMAND']) try: - exec PscConfig.optmap['POSTCOMMAND'] - except Exception, e: + exec(PscConfig.optmap['POSTCOMMAND']) + except Exception as e: if isinstance( e, IncludeError ): print(sys.exc_type, e) theApp._exitstate = ExitCodes.INCLUDE_ERROR diff --git a/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx b/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx index 02a6ce90aae39b77c291283239ce9b9cd902d72d..12f312530b117e5848ccc6c7a75fd1ed7b7d84c3 100644 --- a/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx +++ b/HLT/Trigger/TrigControl/TrigPSC/src/Psc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -174,8 +174,8 @@ bool psc::Psc::configure(const ptree& config) if ( ! Py_IsInitialized() ) { ERS_DEBUG(1,"Initializing Python interpreter"); - if (!PyEval_ThreadsInitialized()) PyEval_InitThreads(); Py_Initialize(); + if (!PyEval_ThreadsInitialized()) PyEval_InitThreads(); // check if ( ! Py_IsInitialized() ) { @@ -674,12 +674,17 @@ bool psc::Psc::prepareWorker (const boost::property_tree::ptree& args) { psc::Utils::ScopeTimer timer("Psc prepareWorker"); - /* Release the Python GIL (which we inherited from the mother) - to avoid dead-locking on the first call to Python. Only relevant - if Python is initialized and Python-based algorithms are used. */ - if ( PyEval_ThreadsInitialized() ) { - ERS_DEBUG(1, "Releasing Python GIL"); - PyEval_SaveThread(); + if ( Py_IsInitialized() ) { + ERS_DEBUG(1, "Post-fork initialization of Python interpreter"); + PyOS_AfterFork(); + + /* Release the Python GIL (which we inherited from the mother) + to avoid dead-locking on the first call to Python. Only relevant + if Python is initialized and Python-based algorithms are used. */ + if (PyEval_ThreadsInitialized()) { + ERS_DEBUG(1, "Releasing Python GIL"); + PyEval_SaveThread(); + } } ERS_LOG("Individualizing DF properties"); diff --git a/HLT/Trigger/TrigControl/TrigServices/python/TrigServicesConfig.py b/HLT/Trigger/TrigControl/TrigServices/python/TrigServicesConfig.py index 85689f6c8be3cd4bfe70a14892f00e0e93c410e5..3de6e1177203544c7d60fbf0e4894de129d2f919 100644 --- a/HLT/Trigger/TrigControl/TrigServices/python/TrigServicesConfig.py +++ b/HLT/Trigger/TrigControl/TrigServices/python/TrigServicesConfig.py @@ -3,7 +3,7 @@ # @file: TrigServicesConfig.py # @purpose: customized configurables -from TrigServicesConf import TrigCOOLUpdateHelper as _TrigCOOLUpdateHelper +from TrigServices.TrigServicesConf import TrigCOOLUpdateHelper as _TrigCOOLUpdateHelper from AthenaCommon.Logging import logging log = logging.getLogger('TrigCOOLUpdateHelper') @@ -88,7 +88,7 @@ def setupMessageSvc(): MessageSvc.statLevel = WARNING # online ROB data provider service -from TrigServicesConf import HltROBDataProviderSvc as _HltROBDataProviderSvc +from TrigServices.TrigServicesConf import HltROBDataProviderSvc as _HltROBDataProviderSvc class HltROBDataProviderSvc(_HltROBDataProviderSvc): __slots__ = () @@ -119,7 +119,7 @@ class HltROBDataProviderSvc(_HltROBDataProviderSvc): return # online event loop manager -from TrigServicesConf import HltEventLoopMgr as _HltEventLoopMgr +from TrigServices.TrigServicesConf import HltEventLoopMgr as _HltEventLoopMgr class HltEventLoopMgr(_HltEventLoopMgr): __slots__ = () diff --git a/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py b/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py index b44a16135944bdcea516abcaeefa49d4502837e1..1a606cb453fda6883c981c79ae6d89e4f0de5571 100644 --- a/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py +++ b/HLT/Trigger/TrigControl/TrigServices/python/TriggerUnixStandardSetup.py @@ -115,7 +115,7 @@ def setupCommonServices(): theApp.EvtSel = "EventSelector" # Online event loop manager - from TrigServicesConfig import HltEventLoopMgr + from TrigServices.TrigServicesConfig import HltEventLoopMgr loopMgr = HltEventLoopMgr("HltEventLoopMgr") loopMgr.WhiteboardSvc = "EventDataSvc" loopMgr.SchedulerSvc = AlgScheduler.getScheduler().getName() diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/CMakeLists.txt b/InnerDetector/InDetAlignTools/InDetAlignGenTools/CMakeLists.txt index 26fe369bb1888077a348e37e08521a32b548b053..df9bb4a114f85ba0ca78a555d32ff4264d947a94 100644 --- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/CMakeLists.txt +++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/CMakeLists.txt @@ -30,6 +30,7 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry Simulation/G4Sim/TrackRecord Tracking/TrkEvent/TrkMeasurementBase Tracking/TrkEvent/TrkParameters @@ -51,7 +52,7 @@ atlas_add_component( InDetAlignGenTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CORAL_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${CORAL_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives Identifier EventPrimitives InDetAlignTrkInfo InDetPrepRawData TrkEventPrimitives TrkEventUtils TrkTrack TrkExInterfaces TrkToolInterfaces AthenaKernel AthContainers AtlasDetDescr DetDescrConditions GaudiKernel InDetIdentifier InDetReadoutGeometry TrkMeasurementBase TrkParameters TrkPrepRawData TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces EventContainers ) + LINK_LIBRARIES ${CORAL_LIBRARIES} ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives Identifier EventPrimitives InDetAlignTrkInfo InDetPrepRawData TrkEventPrimitives TrkEventUtils TrkTrack TrkExInterfaces TrkToolInterfaces AthenaKernel AthContainers AtlasDetDescr DetDescrConditions GaudiKernel InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry TrkMeasurementBase TrkParameters TrkPrepRawData TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces EventContainers ) # Install files from the package: atlas_install_headers( InDetAlignGenTools ) diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx index f2d6b29996697f3dec90d49ac17cde53af1c0e83..8abf3af6ea34d638b2ba98ebf60bcc3cf0efee58 100755 --- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx +++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignDBTool.cxx @@ -25,7 +25,7 @@ #include "GeoPrimitives/CLHEPtoEigenConverter.h" #include "AthenaKernel/IAthenaOutputStreamTool.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElementCollection.h" #include "InDetReadoutGeometry/SiDetectorElement.h" diff --git a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignHitQualSelTool.cxx b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignHitQualSelTool.cxx index 97894fa7204c8112a738fde86249c24db14995d7..54fac90a210e089e05231286fb42b704c7e5e51a 100644 --- a/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignHitQualSelTool.cxx +++ b/InnerDetector/InDetAlignTools/InDetAlignGenTools/src/InDetAlignHitQualSelTool.cxx @@ -11,7 +11,7 @@ #include "Identifier/Identifier.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "AtlasDetDescr/AtlasDetectorID.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetIdentifier/SCT_ID.h" #include "InDetAlignGenTools/InDetAlignHitQualSelTool.h" diff --git a/InnerDetector/InDetAlignment/InDetAlignGeomTools/CMakeLists.txt b/InnerDetector/InDetAlignment/InDetAlignGeomTools/CMakeLists.txt index 420c094f73f4448c84e26c24dc0db6d56c2ed3b0..b092063133838f7e7687ea6574e15a6e104213c9 100644 --- a/InnerDetector/InDetAlignment/InDetAlignGeomTools/CMakeLists.txt +++ b/InnerDetector/InDetAlignment/InDetAlignGeomTools/CMakeLists.txt @@ -21,6 +21,7 @@ atlas_depends_on_subdirs( GaudiKernel InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry Tracking/TrkEvent/TrkRIO_OnTrack ) # External dependencies: @@ -38,4 +39,4 @@ atlas_add_library( InDetAlignGeomToolsLib atlas_add_component( InDetAlignGeomTools src/*.cxx src/components/*.cxx LINK_LIBRARIES GeoModelUtilities GaudiKernel InDetIdentifier - InDetReadoutGeometry TrkRIO_OnTrack InDetAlignGeomToolsLib ) + InDetReadoutGeometry PixelReadoutGeometry TrkRIO_OnTrack InDetAlignGeomToolsLib ) diff --git a/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/InDetGeometryManagerTool.cxx b/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/InDetGeometryManagerTool.cxx index d7cf8a777e96473b0c94ccab873e5f8151c178d5..9872cc5751997b8e5ba7ba2e37cc8c9e246aa38e 100644 --- a/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/InDetGeometryManagerTool.cxx +++ b/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/InDetGeometryManagerTool.cxx @@ -6,7 +6,7 @@ #include "InDetReadoutGeometry/TRT_DetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetIdentifier/TRT_ID.h" diff --git a/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/PixelGeometryManagerTool.cxx b/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/PixelGeometryManagerTool.cxx index 276a001d00d62c289be5b41e31bcbe53e0e5bff0..7d04636878c0ec544e930af78632297cbc9123a5 100644 --- a/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/PixelGeometryManagerTool.cxx +++ b/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/PixelGeometryManagerTool.cxx @@ -4,7 +4,7 @@ #include "AthContainers/DataVector.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetIdentifier/PixelID.h" diff --git a/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/SiGeometryManagerTool.cxx b/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/SiGeometryManagerTool.cxx index 884d151c34c9fdd36842652e82f7da17cab6eb61..b8e40b98aea30bb893833f4edd91bb5885b8119c 100644 --- a/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/SiGeometryManagerTool.cxx +++ b/InnerDetector/InDetAlignment/InDetAlignGeomTools/src/SiGeometryManagerTool.cxx @@ -5,7 +5,7 @@ #include "AthContainers/DataVector.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetIdentifier/SCT_ID.h" diff --git a/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx b/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx index 51332cca8959de4d683e0ef0ed94913185452e2b..2bfba3d0cc8c754197bca91dfcf94d8d524e9718 100644 --- a/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx +++ b/InnerDetector/InDetAlignment/InDetAlignNtupleTools/src/DetailedIDNtupleTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkEventPrimitives/FitQuality.h" @@ -308,7 +308,7 @@ namespace InDet { } if (originalPerigeeAtRef) { - std::auto_ptr<const Trk::Perigee > originalMeasPerAtRef(originalPerigeeAtRef); + std::unique_ptr<const Trk::Perigee > originalMeasPerAtRef(originalPerigeeAtRef); m_original_toRef_d0 = originalMeasPerAtRef->parameters()[Trk::d0]; m_original_toRef_z0 = originalMeasPerAtRef->parameters()[Trk::z0]; m_original_toRef_phi0 = originalMeasPerAtRef->parameters()[Trk::phi0]; @@ -328,7 +328,7 @@ namespace InDet { //post-eigen, can simply use the TrackParameters * returned by m_extrapolator->extrapolate? if (PerigeeAtRef) { - std::auto_ptr<const Trk::Perigee > MeasPerAtRef((PerigeeAtRef)); + std::unique_ptr<const Trk::Perigee > MeasPerAtRef((PerigeeAtRef)); m_toRef_d0 = MeasPerAtRef->parameters()[Trk::d0]; m_toRef_z0 = MeasPerAtRef->parameters()[Trk::z0]; m_toRef_phi0 = MeasPerAtRef->parameters()[Trk::phi0]; diff --git a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.cxx b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.cxx index bfcd4dc9eaed141e535d307270802df9ca14a5fa..d364e694928b014275a4e21eeb1c6bfb2438ed2b 100644 --- a/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.cxx +++ b/InnerDetector/InDetCalibAlgs/InDetBeamSpotFinder/src/InDetBeamSpotVertex.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "InDetBeamSpotVertex.h" @@ -7,6 +7,9 @@ #include "VxVertex/VxCandidate.h" #include "VxVertex/VxContainer.h" +#include <random> +#include <cmath> +#include <algorithm> using namespace InDet; @@ -18,7 +21,7 @@ namespace BeamSpot { double pdfxy(double *x, double *p); } -class SortDistToMedian: public std::binary_function <double, double, bool> +class SortDistToMedian { double m_median; @@ -272,35 +275,28 @@ InDetBeamSpotVertex::FitStatus InDetBeamSpotVertex::fit(std::vector< BeamSpot::V m_fitStatus = (llResult ? successful : failed); else m_fitStatus = (chi2Result ? successful : failed); - - for ( std::vector< BeamSpot::VrtHolder >::iterator it = - m_vertexData.begin(); - it != m_vertexData.end(); ++it) { - if ( it->valid ) m_nUsed++; - } - - if (msgLvl(MSG::INFO)) { - //display results - ATH_MSG_INFO( "Fit result was: " << ( m_fitStatus == successful ? "Successful" : "Failure") - << " using Vertex " << (m_getLLres ? "Log-likelihood":"Chi2") << " method" ); - ATH_MSG_INFO( "Number of vertices: " << m_vertexCount ); - ATH_MSG_INFO( "x(z=0) = " << getX(0.) << " +- " << getErrX(0) ); - ATH_MSG_INFO( "y(z=0) = " << getY(0.) << " +- " << getErrY(0) ); - ATH_MSG_INFO( "z = " << getZ() << " +- " << getErrZ() ); - double z = getZ(); - ATH_MSG_INFO( "x(z) = " << getX(z) << " +- " << getErrX(z) ); - ATH_MSG_INFO( "y(z) = " << getY(z) << " +- " << getErrY(z) ); - - ATH_MSG_INFO( "TiltX = " << getTiltX() << " +- " << getErrTiltX() ); - ATH_MSG_INFO( "TiltY = " << getTiltY() << " +- " << getErrTiltY() ); - - ATH_MSG_INFO( "SigmaX(z=0) = " << getSigmaX(0.) << " +- " << getErrSigmaX(0.) ); - ATH_MSG_INFO( "SigmaY(z=0) = " << getSigmaY(0.) << " +- " << getErrSigmaY(0.) ); - ATH_MSG_INFO( "SigmaZ = " << getSigmaZ() << " +- " << getErrSigmaZ() ); - - ATH_MSG_INFO( "rhoXY = " << getRhoXY() << " +- " << getErrRhoXY() ); - ATH_MSG_INFO( "K = " << getK() << " +- " << getErrK() ); - } + m_nUsed+=std::count_if(m_vertexData.begin(),m_vertexData.end(),[](const BeamSpot::VrtHolder & v){return v.valid;}); + + //display results + ATH_MSG_INFO( "Fit result was: " << ( m_fitStatus == successful ? "Successful" : "Failure") + << " using Vertex " << (m_getLLres ? "Log-likelihood":"Chi2") << " method" ); + ATH_MSG_INFO( "Number of vertices: " << m_vertexCount ); + ATH_MSG_INFO( "x(z=0) = " << getX(0.) << " +- " << getErrX(0) ); + ATH_MSG_INFO( "y(z=0) = " << getY(0.) << " +- " << getErrY(0) ); + ATH_MSG_INFO( "z = " << getZ() << " +- " << getErrZ() ); + double z = getZ(); + ATH_MSG_INFO( "x(z) = " << getX(z) << " +- " << getErrX(z) ); + ATH_MSG_INFO( "y(z) = " << getY(z) << " +- " << getErrY(z) ); + + ATH_MSG_INFO( "TiltX = " << getTiltX() << " +- " << getErrTiltX() ); + ATH_MSG_INFO( "TiltY = " << getTiltY() << " +- " << getErrTiltY() ); + + ATH_MSG_INFO( "SigmaX(z=0) = " << getSigmaX(0.) << " +- " << getErrSigmaX(0.) ); + ATH_MSG_INFO( "SigmaY(z=0) = " << getSigmaY(0.) << " +- " << getErrSigmaY(0.) ); + ATH_MSG_INFO( "SigmaZ = " << getSigmaZ() << " +- " << getErrSigmaZ() ); + + ATH_MSG_INFO( "rhoXY = " << getRhoXY() << " +- " << getErrRhoXY() ); + ATH_MSG_INFO( "K = " << getK() << " +- " << getErrK() ); return m_fitStatus; } @@ -420,8 +416,6 @@ bool InDetBeamSpotVertex::setOutput( TMinuit * minuit) { minuit->GetParameter(i, m_pLL(i+1) ,t); }//for - //double res[nPar]; - // double cov[m_NPARS * m_NPARS]; double * cov = new double[m_NPARS*m_NPARS]; minuit->mnemat(cov,m_NPARS); for (int i =0; i<m_NPARS; ++i) { @@ -499,7 +493,7 @@ bool InDetBeamSpotVertex::solveChi2() { m_p = m_V*m_x; // calculate parameter estimates m_zSolved = m_z / m_zErr; // weighted - m_zErrSolved = 1./sqrt(m_zErr); + m_zErrSolved = 1./std::sqrt(m_zErr); ATH_MSG_DEBUG( "Fit solved succesfully from " << m_vertexCount << " vertices"); @@ -599,13 +593,13 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { if (count) { meanx /= count; meanxSqr /=count; - rmsX = sqrt( fabs(meanxSqr - meanx*meanx)); + rmsX = std::sqrt( std::fabs(meanxSqr - meanx*meanx)); meany /= count; meanySqr /=count; - rmsY = sqrt( fabs(meanySqr - meany*meany)); + rmsY = std::sqrt( std::fabs(meanySqr - meany*meany)); meanz /=count; meanzSqr /=count; - rmsZ = sqrt( fabs(meanzSqr - meanz*meanz)); + rmsZ = std::sqrt( std::fabs(meanzSqr - meanz*meanz)); } if(m_setInitialRMS){ @@ -636,20 +630,12 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { it != m_vertexData.end(); ++it) { if (!it->valid) continue; int fail=0; - //if ( fabs( meanx - it->x ) > m_sigTr * rmsX ) fail += 1; - //if ( fabs( meany - it->y ) > m_sigTr * rmsY ) fail += 2; + if ( fabs( medianx - it->x ) > m_sigTr *rmsX) fail += 4; if ( fabs( mediany - it->y ) > m_sigTr *rmsY) fail += 8; if ( fabs( medianz - it->z ) > 10*rmsZ) fail += 16; - /* - if ( (meanx - it->x)*(meanx-it->x)/rmsX/rmsX + (meany-it->y)*(meany-it->y)/rmsY/rmsY > m_sigTr*m_sigTr) { - if (msgLvl(MSG::DEBUG)) ATH_MSG_DEBUG( "Vertex info: extended past radial extent: sig." - << sqrt((meanx - it->x)*(meanx-it->x)/rmsX/rmsX + (meany-it->y)*(meany-it->y)/rmsY/rmsY) << " > " - << sqrt( m_sigTr*m_sigTr ) << "." ); - // don't remove these vertices yet - } - */ + if ( (medianx - it->x)*(medianx-it->x)/rmsX/rmsX + (mediany-it->y)*(mediany-it->y)/rmsY/rmsY > m_sigTr*m_sigTr) { ATH_MSG_DEBUG( "Vertex info: extended past radial extent: sig." << sqrt((medianx - it->x)*(medianx-it->x)/rmsX/rmsX + (mediany-it->y)*(mediany-it->y)/rmsY/rmsY) << " > " @@ -667,7 +653,6 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { ); it->valid = false; - // it->outlierRemoved = true; ++failCount; } else { // still valid, so add into chi2 @@ -707,7 +692,7 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { chi2Cov.invert(invFail); chi2Pos = chi2Cov*chi2Pos; zpos = zpos / zerr; - zerr = 1./sqrt(zerr); + zerr = 1./std::sqrt(zerr); @@ -729,17 +714,10 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { m_zErrSolved = zerr; - /* TBD - if (goodChi2) { - if (msgLvl(MSG::DEBUG)) ) ATH_MSG_DEBUG( "Replacing original chi2 with new value" ); - - - } - */ + //Dubious - !!! TBD: move this into the general LL solve area and do it properly! - //m_init_sx = rmsX; - //m_init_sy = rmsY; + m_init_sz = rmsZ; // perform LL fit? @@ -802,12 +780,12 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { fail = 0; // reset the fail value variable // selections - if ( fabs(it->x - (xbar + it->z*ax)) > m_sigTr * rmsX) fail += 1; - if ( fabs(it->y - (ybar + it->z*ay)) > m_sigTr * rmsY) fail += 2; + if ( std::fabs(it->x - (xbar + it->z*ax)) > m_sigTr * rmsX) fail += 1; + if ( std::fabs(it->y - (ybar + it->z*ay)) > m_sigTr * rmsY) fail += 2; if ( it->vxx > m_maxVtxErTr*m_maxVtxErTr || it->vyy > m_maxVtxErTr*m_maxVtxErTr) fail += 4; - if ( fabs(it->z - meanz) > m_sigTr * rmsZ) fail += 8; + if ( std::fabs(it->z - meanz) > m_sigTr * rmsZ) fail += 8; // add all other selections above here: double increaseChi2(0); @@ -823,11 +801,7 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { b(1,1) = it->vxx + bsCov(1,1); b(2,2) = it->vyy + bsCov(2,2); b(2,1) = it->vxy + bsCov(2,1); - /* - b(1,1) = it->vxx; - b(2,2) = it->vyy; - b(2,1) = it->vxy; - */ + int failInv =0; b.invert(failInv); if (failInv) continue; @@ -885,7 +859,6 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { // if no vertices removed and ll fit still fails, then we continue to have a problem ... if (fCount == 0 && m_useLL && !llSolve && rCount !=0 ) { // if first iteration, we have another iteration later. - // if (msgLvl(MSG::WARNING)) ATH_MSG_WARNING( "In LL test MODE !!!!" ); ATH_MSG_WARNING( "No vertices removed and fit still fails - most likely final result will fail" ); // this is our 'last-ditch approach'. Split the collection of vertices into two 'random' sets and solve for each. @@ -893,12 +866,12 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { // if none, then really have to give up. No valid solution possible. // m_vertexData // key holder. - // - std::vector< BeamSpot::VrtHolder > vertexTemp; - // copy the original values - std::copy(m_vertexData.begin(),m_vertexData.end(), back_inserter(vertexTemp)) ; + // copy the original values + std::vector< BeamSpot::VrtHolder > vertexTemp(m_vertexData); // muddle up the original - std::random_shuffle(m_vertexData.begin(), m_vertexData.end()); + std::random_device rng; + std::mt19937 urng(rng()); + std::shuffle(m_vertexData.begin(), m_vertexData.end(), urng); // divide the sample into two std::vector< BeamSpot::VrtHolder > vertex1,vertex2; std::copy(m_vertexData.begin() + m_vertexData.size()/2, m_vertexData.end(), back_inserter(vertex2)) ; @@ -909,49 +882,47 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { ATH_MSG_DEBUG( "Attempting fit with vextex half: 1"); m_vertexData = vertex1; llSolve = solveLL(); - //m_getLLres = llSolve; // allow the log-likelihood accessor values to returned, if sucessful m_getLLres = true; ATH_MSG_WARNING( "Fit using \"vertex1\" " << ( llSolve ? "Successful": "Failed") ); if (llSolve) { goodFit1 = true; - if (msgLvl(MSG::DEBUG)) { - ATH_MSG_DEBUG( "x: " << getX(0) << " +- " << getErrX(0) ); - ATH_MSG_DEBUG( "y: " << getY(0) << " +- " << getErrY(0) ); - ATH_MSG_DEBUG( "z: " << getZ() << " +- " << getErrZ() ); - ATH_MSG_DEBUG( "sx: " << getSigmaX(0) << " +- " << getErrSigmaX(0) ); - ATH_MSG_DEBUG( "sy: " << getSigmaY(0) << " +- " << getErrSigmaY(0) ); - ATH_MSG_DEBUG( "sz: " << getSigmaZ() << " +- " << getErrSigmaZ() ); - ATH_MSG_DEBUG( "ax: " << getTiltX() << " +- " << getErrTiltX() ); - ATH_MSG_DEBUG( "ay: " << getTiltY() << " +- " << getErrTiltY() ); - ATH_MSG_DEBUG( "sxy:" << getSigmaXY(0) << " +- " << getErrSigmaXY(0) ); - ATH_MSG_DEBUG( "rh: " << getRhoXY() << " +- " << getErrRhoXY() ); - ATH_MSG_DEBUG( "k: " << getK() << " +- " << getErrK() ); - }// debug + + ATH_MSG_DEBUG( "x: " << getX(0) << " +- " << getErrX(0) ); + ATH_MSG_DEBUG( "y: " << getY(0) << " +- " << getErrY(0) ); + ATH_MSG_DEBUG( "z: " << getZ() << " +- " << getErrZ() ); + ATH_MSG_DEBUG( "sx: " << getSigmaX(0) << " +- " << getErrSigmaX(0) ); + ATH_MSG_DEBUG( "sy: " << getSigmaY(0) << " +- " << getErrSigmaY(0) ); + ATH_MSG_DEBUG( "sz: " << getSigmaZ() << " +- " << getErrSigmaZ() ); + ATH_MSG_DEBUG( "ax: " << getTiltX() << " +- " << getErrTiltX() ); + ATH_MSG_DEBUG( "ay: " << getTiltY() << " +- " << getErrTiltY() ); + ATH_MSG_DEBUG( "sxy:" << getSigmaXY(0) << " +- " << getErrSigmaXY(0) ); + ATH_MSG_DEBUG( "rh: " << getRhoXY() << " +- " << getErrRhoXY() ); + ATH_MSG_DEBUG( "k: " << getK() << " +- " << getErrK() ); + } // good fit ATH_MSG_DEBUG( "Attempting fit with vextex half: 2"); m_vertexData = vertex2; llSolve = solveLL(); - // m_getLLres = llSolve; // allow the log-likelihood accessor values to returned, if sucessful m_getLLres = true; ATH_MSG_WARNING( "Fit using \"vertex2\" " << ( llSolve ? "Successful": "Failed") ); if (llSolve) { goodFit2 = true; - if (msgLvl(MSG::DEBUG)) { - ATH_MSG_DEBUG( "x: " << getX(0) << " +- " << getErrX(0) ); - ATH_MSG_DEBUG( "y: " << getY(0) << " +- " << getErrY(0) ); - ATH_MSG_DEBUG( "z: " << getZ() << " +- " << getErrZ() ); - ATH_MSG_DEBUG( "sx: " << getSigmaX(0) << " +- " << getErrSigmaX(0) ); - ATH_MSG_DEBUG( "sy: " << getSigmaY(0) << " +- " << getErrSigmaY(0) ); - ATH_MSG_DEBUG( "sz: " << getSigmaZ() << " +- " << getErrSigmaZ() ); - ATH_MSG_DEBUG( "ax: " << getTiltX() << " +- " << getErrTiltX() ); - ATH_MSG_DEBUG( "ay: " << getTiltY() << " +- " << getErrTiltY() ); - ATH_MSG_DEBUG( "sxy:" << getSigmaXY(0) << " +- " << getErrSigmaXY(0) ); - ATH_MSG_DEBUG( "rh: " << getRhoXY() << " +- " << getErrRhoXY() ); - ATH_MSG_DEBUG( "k: " << getK() << " +- " << getErrK() ); - }// debug + + ATH_MSG_DEBUG( "x: " << getX(0) << " +- " << getErrX(0) ); + ATH_MSG_DEBUG( "y: " << getY(0) << " +- " << getErrY(0) ); + ATH_MSG_DEBUG( "z: " << getZ() << " +- " << getErrZ() ); + ATH_MSG_DEBUG( "sx: " << getSigmaX(0) << " +- " << getErrSigmaX(0) ); + ATH_MSG_DEBUG( "sy: " << getSigmaY(0) << " +- " << getErrSigmaY(0) ); + ATH_MSG_DEBUG( "sz: " << getSigmaZ() << " +- " << getErrSigmaZ() ); + ATH_MSG_DEBUG( "ax: " << getTiltX() << " +- " << getErrTiltX() ); + ATH_MSG_DEBUG( "ay: " << getTiltY() << " +- " << getErrTiltY() ); + ATH_MSG_DEBUG( "sxy:" << getSigmaXY(0) << " +- " << getErrSigmaXY(0) ); + ATH_MSG_DEBUG( "rh: " << getRhoXY() << " +- " << getErrRhoXY() ); + ATH_MSG_DEBUG( "k: " << getK() << " +- " << getErrK() ); + } @@ -969,10 +940,7 @@ bool InDetBeamSpotVertex::applyOutlierRemoval() { } else { m_vertexData = vertexTemp; // give up and go home... } - /* - // for test mode only - m_vertexData = vertexTemp; - */ + } // last solution @@ -1014,23 +982,23 @@ bool InDetBeamSpotVertex::successfulFit( TMinuit * minuit, if ( m_doFitSanityCheck) { double x(0), ex(0); minuit->GetParameter(6,x,ex); // rhoxy - if ( fabs(x) > m_rhoFail){ + if ( std::fabs(x) > m_rhoFail){ sanityPassed = false; ATH_MSG_DEBUG( "Fit Failed with rhoxy: " << x << " > " << m_rhoFail ); } minuit->GetParameter(4,x,ex); // sigma x - if ( fabs(x) < m_widthFail ){ + if ( std::fabs(x) < m_widthFail ){ sanityPassed = false; ATH_MSG_DEBUG( "Fit Failed with sigmaX:" << x << " > " << m_widthFail ); } minuit->GetParameter(5,x,ex); // sigma y - if ( fabs(x) < m_widthFail ){ + if ( std::fabs(x) < m_widthFail ){ sanityPassed = false; ATH_MSG_DEBUG( "Fit Failed with sigmaY: " << x << " > " <<m_widthFail ); } minuit->GetParameter(7,x,ex); // k - if ( fabs(x) < m_kMinFail || fabs(x) > m_kMaxFail ){ + if ( std::fabs(x) < m_kMinFail || std::fabs(x) > m_kMaxFail ){ sanityPassed = false; ATH_MSG_DEBUG( "Fit Failed with k: " << x << " > " << m_kMaxFail << ", or " << x << " < " << m_kMinFail ); @@ -1053,8 +1021,7 @@ bool InDetBeamSpotVertex::successfulFit( TMinuit * minuit, void BeamSpot::myFCN_LLsolver( Int_t &, Double_t *, Double_t &f, Double_t *par, Int_t) { -//void Beamspot::myFCN_LLsolver( Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag) { - const static double Pi = TMath::Pi(); + constexpr double Pi = M_PI; //par[*] //0, 1, 2, 3, 4, 5, 6, 7, 8 9 //X0, Y0, Ax. Ay, sx, sy, rhoxy, k z0 sigma(z) @@ -1114,27 +1081,7 @@ void BeamSpot::myFCN_LLsolver( Int_t &, Double_t *, Double_t &f, Double_t *par, }//myFCN double BeamSpot::pdfxy(double *, double *) { - /* - double x = xx[0]; - double y = yy[0]; - - double mux =p[0]; - double muy =p[1]; - double ax =p[2]; - double ay =p[3]; - double det = p[4]; - double covXX =p[5]; - double covYY =p[6]; - double covXY =p[7]; - - - double pxy = 1/(2*Pi*det)*exp( -0.5* ( ( x - mux -ax*z) * covXX * ( x - mux - ax*z) - + ( y - muy - ay*z) * covYY * ( y - muy - ay*z) - + 2*( x - mux - *z) * covXY * ( y - muy - ay*z) - ) - ); - return pxy; - */ + return 0; // TBD dlete } @@ -1143,83 +1090,7 @@ double BeamSpot::pdfxy(double *, double *) { void BeamSpot::myFCN_LLsolverNorm( Int_t &, Double_t *, Double_t & /*f*/, Double_t * /*par*/, Int_t) { } -/* -//void Beamspot::myFCN_LLsolver( Int_t &npar, Double_t *gin, Double_t &f, Double_t *par, Int_t iflag) { - const static double Pi = TMath::Pi(); - //par[*] - //0, 1, 2, 3, 4, 5, 6, 7, 8 9 - //X0, Y0, Ax. Ay, sx, sy, rhoxy, k z0 sigma(z) - - f = 0; - - typedef std::vector< BeamSpot::VrtHolder > Vertices; - Vertices::const_iterator vit = BeamSpot::vertexData->begin(); - - double temp =0; - double x=0,y=0,z=0; - double vxx,vyy, vxy; - double covXX,covYY,covXY; - double det,k2; - - // ln L = Sum[ ln(F) ] - for ( ; vit != vertexData->end(); ++vit) { - if (!vit->valid) continue; // don't use non-valid vertices - temp =0; - x = vit->x; - y = vit->y; - z = vit->z; - vxx = vit->vxx; - vxy = vit->vxy; - vyy = vit->vyy; - - - k2 = par[7]*par[7]; - - covXX = k2 *vxx + par[4]*par[4]; - covYY = k2 *vyy + par[5]*par[5]; - covXY = k2 *vxy + par[6] *par[4]* par[5]; - - det = covXX * covYY - covXY*covXY; - double recDet = 1./det; - - //temp = TMath::Log(2*Pi * sqrt(fabs(det))); - temp = 2*TMath::Log(2*Pi); - temp += TMath::Log(det); - - covXY = -covXY * recDet; - double t = covXX *recDet; - covXX = covYY *recDet; - covYY = t; - - }//for - - f=-f; -}//myFCN -*/ - /* - temp += ( - ( x - par[0] - par[2]*z) * covXX * ( x - par[0] - par[2]*z) - + ( y - par[1] - par[3]*z) * covYY * ( y - par[1] - par[3]*z) - + 2*( x - par[0] - par[2]*z) * covXY * ( y - par[1] - par[3]*z) - ); - - temp += TMath::Log( 2*Pi * par[9]*par[9] ) + ( z - par[8]) * (z-par[8]) / (par[9] * par[9] ); - */ - - // apply normalisations - - /* - double val[] = {x,y}; - double pval[] = { par[0],par[2],par[1],par[3],det, covXX, covYY, covXY }; - - Beamspot::transXY->SetParameters(pval); - double pxy = Beamspot::transXY( - double normxy = TMath::Integral( - - double pz = 1/sqrt(2*Pi*par[9]) * exp( -0.5*( ( z - par[8]) * (z-par[8]) / (par[9] * par[9] ))); - double normz = 0.5*TMath::Erf( BeamSpot::norm_zMin / (sqrt(2) * par[9] )); - */ @@ -1280,17 +1151,13 @@ std::map<std::string,double> InDetBeamSpotVertex::getCovMap() const { //This is the method that was used before to put the covariance matrix in the required order //We don't want to mess with this, because no one knows the original order - //static const int map[] = {0,0,6,-1,-1,-1,-1,2,-2,-2}; int map[] = {1,2,9,3,4,5,6,10,7,8}; if(m_fixInputK){ - // 1 2 3 4 5 6 7 8 9 10 - //int map2[] = {0,0,5,-1,-1,-1,-1,0,-2,-2}; int map2[] = {1,2,8,3,4,5,6,9,7,10}; for(int i=0; i < 10; ++i){ map[i] = map2[i]; } } else if (m_fixWidth) { - //int map2[] = {0,0,3,-1,-1,-5,-6,-1, -8,-5}; int map2[] = {1,2,6,3,4,8,9,7,10,5}; for(int i=0; i < 10; ++i){ map[i] = map2[i]; @@ -1323,14 +1190,7 @@ std::map<std::string,double> InDetBeamSpotVertex::getCovMap() const { "rhoXYErr","covRhoXYk", "kErr"}; - /* const std::string keyArr2[] = {"posXErr","covYX","covZX","covTiltXX","covTiltYX","covSxX","covSyX","covSzX", - "covRhoXYX","covkX","posYErr","covZY","covTiltXY","covTiltYY","covSxY","covSyY", - "covSzY","covRhoXYY","covkY","posZErr","covTiltXZ","covTiltYZ","covSxZ","covSyZ","covSzZ", - "covRhoXYZ","covkZ","tiltXErr","covTiltYTiltX","covSxTiltX","covSyTiltX","covSzTiltX","covRhoXYTiltX", - "covkTiltX","tiltYErr","covSxTiltY","covSyTiltY","covSzTiltY","covRhoXYTiltY","covkTiltY","sigmaXErr", - "covSySx","covSzSx","covRhoXYSx","covkSx","sigmaYErr","covSzSy","covRhoXYSy","covkSy","sigmaZErr","covRhoXYSz", - "covkSz","rhoXYErr","covkRhoXY","kErr"}; - */ + //Now that everything should be in the right order, it's simple to set the covariance matrix map correctly: diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt index 3e244d90c05a5bbca933c79d55ee0e2d456cbb5f..08adb040b5d16f0c40c6629551d16bb3d7b98625 100644 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/CMakeLists.txt @@ -24,6 +24,7 @@ atlas_depends_on_subdirs( InnerDetector/InDetConditions/InDetByteStreamErrors InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetDetDescr/PixelGeoModel InnerDetector/InDetRawEvent/InDetRawData Tools/PathResolver ) @@ -45,7 +46,7 @@ atlas_add_library( PixelCalibAlgsLib GaudiKernel InDetPrepRawData PRIVATE_LINK_LIBRARIES ${CORAL_LIBRARIES} AthenaPoolUtilities CoralDB DetDescrConditions Identifier EventInfo PixelConditionsData InDetIdentifier - InDetReadoutGeometry InDetRawData PathResolver PixelGeoModelLib ) + InDetReadoutGeometry PixelReadoutGeometry InDetRawData PathResolver PixelGeoModelLib ) atlas_add_component( PixelCalibAlgs src/components/*.cxx diff --git a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapDBWriter.cxx b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapDBWriter.cxx index 4c526508d1aa46b4d9894ec4f93c656116542216..cc254d89bfab71883ca5525d9b915b66d81023f3 100755 --- a/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapDBWriter.cxx +++ b/InnerDetector/InDetCalibAlgs/PixelCalibAlgs/src/PixMapDBWriter.cxx @@ -13,7 +13,7 @@ // geometry #include "InDetIdentifier/PixelID.h" #include "InDetReadoutGeometry/SiDetectorElement.h" // kazuki -#include "InDetReadoutGeometry/PixelModuleDesign.h" // kazuki +#include "PixelReadoutGeometry/PixelModuleDesign.h" // kazuki // ROOT #include "TFile.h" diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt index 21cf16a47fecc2f8df207238f9f249820aa8bffb..dfbddc4f122727a67de069511af741746ae34c2e 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/CMakeLists.txt @@ -28,6 +28,7 @@ atlas_depends_on_subdirs( DetectorDescription/DetDescrCond/DetDescrConditions InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDecr/PixelReadoutGeometry InnerDetector/InDetDetDescr/PixelCabling Tools/PathResolver Tracking/TrkDetDescr/TrkGeometry ) @@ -53,7 +54,7 @@ atlas_add_component( PixelConditionsAlgorithms LINK_LIBRARIES ${ROOT_LIBRARIES} ${CORAL_LIBRARIES} ${COOL_LIBRARIES} ${CLHEP_LIBRARIES} CommissionEvent AthenaBaseComps AthenaKernel AthenaPoolUtilities GaudiKernel PixelConditionsData SGTools StoreGateLib CoralDB - GeoModelUtilities Identifier InDetIdentifier InDetReadoutGeometry + GeoModelUtilities Identifier InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry PixelCablingLib PixelConditionsAlgorithmsLib PathResolver ) # Install files from the package: diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelAlignCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelAlignCondAlg.cxx index 712fecc36849c672ab57fc9ecae808190d1d0edd..400ff99d92cdf38cee8a4f9ee31352631645666a 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelAlignCondAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelAlignCondAlg.cxx @@ -4,7 +4,7 @@ #include "PixelAlignCondAlg.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include <memory> diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.cxx index 2038e9bb86ac7d4d8cf6f634ae1886c487cb2759..99fef85b8dac086a6a2eb859258467209b463fbb 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelChargeCalibCondAlg.cxx @@ -5,7 +5,7 @@ #include "PixelChargeCalibCondAlg.h" #include "Identifier/IdentifierHash.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "GaudiKernel/EventIDRange.h" #include <memory> #include <sstream> diff --git a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.cxx b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.cxx index 08424b9af6498972f35fbe061732ca6ed50a570c..ca5670ce979102c11dcbbca2bba99a16bebfb8e6 100644 --- a/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.cxx +++ b/InnerDetector/InDetConditions/PixelConditionsAlgorithms/src/PixelDetectorElementCondAlg.cxx @@ -4,7 +4,7 @@ #include "PixelDetectorElementCondAlg.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "TrkGeometry/Layer.h" #include "TrkSurfaces/Surface.h" diff --git a/InnerDetector/InDetConditions/PixelCoralClientUtils/src/CoralClient.cc b/InnerDetector/InDetConditions/PixelCoralClientUtils/src/CoralClient.cc index cb19d1873aabd88aa23b0a6343fb24e92ad10ee5..931b9a33667b99ba1e7fba0f09702b09aee65f9f 100644 --- a/InnerDetector/InDetConditions/PixelCoralClientUtils/src/CoralClient.cc +++ b/InnerDetector/InDetConditions/PixelCoralClientUtils/src/CoralClient.cc @@ -1000,7 +1000,7 @@ void PixCoralClient::getAnalysisResultsFromDB(std::vector<CAN::SerialNumber_t> a } // now define output columns - std::auto_ptr<coral::IQuery> query( m_session->nominalSchema().newQuery() ); + std::unique_ptr<coral::IQuery> query( m_session->nominalSchema().newQuery() ); if (!query.get()) { std::cerr << "ERROR [CoralClient::getAnalysisResultsFromDB] Failed to create queries for table " << *tName << "."<< std::endl; continue; @@ -1227,7 +1227,7 @@ int PixCoralClient::fillTable(long long fk, CAN::AnalysisResultList_t *results){ // pixel_row_2.extend<T>("VALUE"); extendAttributeList<T>(pixel_row_2); { - std::auto_ptr<coral::IBulkOperation> pixel_bulk_2(pixel_editor_2.bulkInsert(pixel_row_2,iter->second.size())); + std::unique_ptr<coral::IBulkOperation> pixel_bulk_2(pixel_editor_2.bulkInsert(pixel_row_2,iter->second.size())); for (typename std::map<std::string, T >::const_iterator val_iter=iter->second.begin(); val_iter != iter->second.end(); val_iter ++) { diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ConditionsParameters.h b/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ConditionsParameters.h index 82a887d11d9e65f18f346d16056e4ed1ac44cf4a..7646a00da736fa90e2a98f2f41086a132c3e8e60 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ConditionsParameters.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_ConditionsParameters.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -15,7 +15,7 @@ #include <string> namespace SCT_ConditionsData{ - enum NumberOfElements{SIDES_PER_MODULE=2, CHIPS_PER_SIDE=6, CHIPS_PER_MODULE=12, NUMBER_OF_MODULES=4088, STRIPS_PER_WAFER=768, NUMBER_OF_WAFERS=8176}; + enum NumberOfElements{SIDES_PER_MODULE=2, CHIPS_PER_SIDE=6, CHIPS_PER_MODULE=12, NUMBER_OF_MODULES=4088, STRIPS_PER_WAFER=768, NUMBER_OF_WAFERS=8176, STRIPS_PER_CHIP=STRIPS_PER_WAFER/CHIPS_PER_SIDE}; enum NumberOfCalibrationData{N_NPTGAIN=6, N_NOISEOCC=4}; enum MajorityParameters{HighAndLowVoltageOK=17, /* 17 = 0x11 -> majority state for both LV and HV. */ OVERALL=110, diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_MonitorCondData.h b/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_MonitorCondData.h index 72e619c8e673d38b1c2f63b50b2ac92402dbd99a..2d64837c3c1c532c04b28c3219fde80071f646dd 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_MonitorCondData.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsData/SCT_ConditionsData/SCT_MonitorCondData.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -14,8 +14,10 @@ // Include Athena stuff #include "AthenaKernel/CLASS_DEF.h" #include "Identifier/IdentifierHash.h" +#include "SCT_ConditionsData/SCT_ConditionsParameters.h" #include <array> +#include <bitset> #include <string> class SCT_MonitorCondData { @@ -36,11 +38,36 @@ public: // Clear m_defectListArray void clear(); + // Get the number of bad strips for a module + std::size_t nBadStripsForModule(const IdentifierHash& moduleHash) const; + // Get the number of bad strips for a wafer + std::size_t nBadStripsForWafer(const IdentifierHash& waferHash) const; + // Get the number of bad strips for the chip, where a strip locates + std::size_t nBadStripsForChip(const IdentifierHash& waferHash, const int strip) const; + // Check if a strip is bad + bool isBadStrip(const IdentifierHash& waferHash, const int strip) const; + private: - enum {N_MODULES=4088}; - // Store the relation between modules and defects (lists of bad strips). - std::array<std::string, N_MODULES> m_defectListArray; + void clearModule(const std::size_t moduleIndex); + void fillBadStrip(const std::size_t moduleIndex, const int strip); + // Store the relation between modules and defects (lists of bad strips). + std::array<std::string, SCT_ConditionsData::NUMBER_OF_MODULES> m_defectListArray; + std::array<std::array<std::array<std::bitset<SCT_ConditionsData::STRIPS_PER_CHIP>, + SCT_ConditionsData::CHIPS_PER_SIDE>, + SCT_ConditionsData::SIDES_PER_MODULE>, + SCT_ConditionsData::NUMBER_OF_MODULES> m_badStripArray; + std::array<std::array<std::array<std::size_t, + SCT_ConditionsData::CHIPS_PER_SIDE>, + SCT_ConditionsData::SIDES_PER_MODULE>, + SCT_ConditionsData::NUMBER_OF_MODULES> m_badChipArray; + std::array<std::array<std::size_t, + SCT_ConditionsData::SIDES_PER_MODULE>, + SCT_ConditionsData::NUMBER_OF_MODULES> m_badWaferArray; + std::array<std::size_t, + SCT_ConditionsData::NUMBER_OF_MODULES> m_badModuleArray; + + static const std::string s_separator; }; CLASS_DEF( SCT_MonitorCondData , 190515334 , 1 ) diff --git a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_MonitorCondData.cxx b/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_MonitorCondData.cxx index f66582efd67696800fa500f7fa5afd0e46e9b303..29dbf54a1031def972a86a2307fac882f28cbe61 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_MonitorCondData.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsData/src/SCT_MonitorCondData.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ //---------------------------------------------------------------------- @@ -8,8 +8,15 @@ #include "SCT_ConditionsData/SCT_MonitorCondData.h" +#include <iterator> #include <utility> +namespace { + bool doesNotHaveNumbers(const std::string& numberString) { + return (numberString.empty() or numberString.find_first_of("0123456789") == std::string::npos); + } +} + //---------------------------------------------------------------------- // Constructor SCT_MonitorCondData::SCT_MonitorCondData() @@ -21,7 +28,8 @@ SCT_MonitorCondData::SCT_MonitorCondData() // Check if a module has a defect (a list of bad strips). If it does not have defect return false. bool SCT_MonitorCondData::find(const IdentifierHash& hash, std::string& defectList) const { - std::string result{m_defectListArray[hash/2]}; + std::size_t moduleIndex{static_cast<std::size_t>(hash/SCT_ConditionsData::SIDES_PER_MODULE)}; + std::string result{m_defectListArray[moduleIndex]}; if (result.empty()) return false; defectList = result; return true; @@ -31,7 +39,43 @@ bool SCT_MonitorCondData::find(const IdentifierHash& hash, std::string& defectLi // Insert a new defect (a list of bad strips) for a module void SCT_MonitorCondData::insert(const IdentifierHash& hash, const std::string& defectList) { - m_defectListArray[hash/2] = defectList; + std::size_t moduleIndex{static_cast<std::size_t>(hash/SCT_ConditionsData::SIDES_PER_MODULE)}; + m_defectListArray[moduleIndex] = defectList; + + // Set all strips, chips, wafers and module itself of this module good. + clearModule(moduleIndex); + + if (doesNotHaveNumbers(defectList)) return; + + // Fill bad strips + std::istringstream is{defectList}; + std::istream_iterator<std::string> readString{is}; + std::istream_iterator<std::string> endOfString; //relies on default constructor to produce eof + for (; readString != endOfString; ++readString) { + const std::string& stringRange{*readString}; + std::string::size_type p{stringRange.find(s_separator)}; + if (p!=std::string::npos) { //its a range + std::string::size_type len1{p++}; + std::string::size_type len2{stringRange.size()-p}; + int min{std::stoi(stringRange.substr(0, len1))}; + int max{std::stoi(stringRange.substr(p, len2))}; + for (int strip{min}; strip<=max; strip++) { + fillBadStrip(moduleIndex, strip); + } + } else { //assume its a single number + int strip{std::stoi(*readString)}; + fillBadStrip(moduleIndex, strip); + } + } + + // Fill the number of defects in chips, wafers, module + for (std::size_t waferIndex{0}; waferIndex<SCT_ConditionsData::SIDES_PER_MODULE; waferIndex++) { + for (std::size_t chipIndex{0}; chipIndex<SCT_ConditionsData::CHIPS_PER_SIDE; chipIndex++) { + m_badChipArray[moduleIndex][waferIndex][chipIndex] = m_badStripArray[moduleIndex][waferIndex][chipIndex].count(); + m_badWaferArray[moduleIndex][waferIndex] += m_badChipArray[moduleIndex][waferIndex][chipIndex]; + } + m_badModuleArray[moduleIndex] += m_badWaferArray[moduleIndex][waferIndex]; + } } //---------------------------------------------------------------------- @@ -39,4 +83,84 @@ void SCT_MonitorCondData::insert(const IdentifierHash& hash, const std::string& void SCT_MonitorCondData::clear() { m_defectListArray.fill(""); + + for (std::size_t moduleIndex{0}; moduleIndex<SCT_ConditionsData::NUMBER_OF_MODULES; moduleIndex++) { + clearModule(moduleIndex); + } +} + +std::size_t SCT_MonitorCondData::nBadStripsForModule(const IdentifierHash& moduleHash) const +{ + std::size_t moduleIndex{static_cast<std::size_t>(moduleHash/SCT_ConditionsData::SIDES_PER_MODULE)}; + return m_badModuleArray[moduleIndex]; +} + +std::size_t SCT_MonitorCondData::nBadStripsForWafer(const IdentifierHash& waferHash) const +{ + std::size_t moduleIndex{static_cast<std::size_t>(waferHash/SCT_ConditionsData::SIDES_PER_MODULE)}; + std::size_t waferIndex{static_cast<std::size_t>(waferHash%SCT_ConditionsData::SIDES_PER_MODULE)}; + return m_badWaferArray[moduleIndex][waferIndex]; +} + +std::size_t SCT_MonitorCondData::nBadStripsForChip(const IdentifierHash& waferHash, const int strip) const +{ + // 0 <= strip < 768 + if (strip<0) return false; + if (strip>=SCT_ConditionsData::STRIPS_PER_WAFER) return false; + + // 0 to 4087 + std::size_t moduleIndex{static_cast<std::size_t>(waferHash/SCT_ConditionsData::SIDES_PER_MODULE)}; + // 0 to 1 + std::size_t waferIndex{static_cast<std::size_t>(waferHash%SCT_ConditionsData::SIDES_PER_MODULE)}; + // 0 to 5 + std::size_t chipIndex{static_cast<std::size_t>(strip/SCT_ConditionsData::STRIPS_PER_CHIP)}; + + return m_badChipArray[moduleIndex][waferIndex][chipIndex]; +} + +bool SCT_MonitorCondData::isBadStrip(const IdentifierHash& waferHash, const int strip) const +{ + // 0 <= strip < 768 + if (strip<0) return false; + if (strip>=SCT_ConditionsData::STRIPS_PER_WAFER) return false; + + // 0 to 4087 + std::size_t moduleIndex{static_cast<std::size_t>(waferHash/SCT_ConditionsData::SIDES_PER_MODULE)}; + // 0 to 1 + std::size_t waferIndex{static_cast<std::size_t>(waferHash%SCT_ConditionsData::SIDES_PER_MODULE)}; + // 0 to 5 + std::size_t chipIndex{static_cast<std::size_t>(strip/SCT_ConditionsData::STRIPS_PER_CHIP)}; + // 0 to 127 + std::size_t stripIndex{static_cast<std::size_t>(strip%SCT_ConditionsData::STRIPS_PER_CHIP)}; + + return m_badStripArray[moduleIndex][waferIndex][chipIndex].test(stripIndex); +} + +void SCT_MonitorCondData::clearModule(const std::size_t moduleIndex) { + // std::array is not automatically initialized. + for (std::size_t waferIndex{0}; waferIndex<SCT_ConditionsData::SIDES_PER_MODULE; waferIndex++) { + for (std::size_t chipIndex{0}; chipIndex<SCT_ConditionsData::CHIPS_PER_SIDE; chipIndex++) { + m_badStripArray[moduleIndex][waferIndex][chipIndex].reset(); + m_badChipArray[moduleIndex][waferIndex][chipIndex] = 0; + } + m_badWaferArray[moduleIndex][waferIndex] = 0; + } + m_badModuleArray[moduleIndex] = 0; } + +void SCT_MonitorCondData::fillBadStrip(const std::size_t moduleIndex, const int strip) { + // 0 <= strip < 1536 + if (strip<0) return; + if (strip>=SCT_ConditionsData::SIDES_PER_MODULE*SCT_ConditionsData::STRIPS_PER_WAFER) return; + + // 0 or 1 + std::size_t waferIndex{static_cast<std::size_t>(strip/SCT_ConditionsData::STRIPS_PER_WAFER)}; + // 0 to 5 + std::size_t chipIndex{static_cast<std::size_t>(strip/SCT_ConditionsData::STRIPS_PER_CHIP)%SCT_ConditionsData::CHIPS_PER_SIDE}; + // 0 to 127 + std::size_t stripIndex{static_cast<std::size_t>(strip%SCT_ConditionsData::STRIPS_PER_CHIP)}; + // Set the strip as bad + m_badStripArray[moduleIndex][waferIndex][chipIndex].set(stripIndex); +} + +const std::string SCT_MonitorCondData::s_separator{"-"}; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_FlaggedConditionTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_FlaggedConditionTool.cxx index 333d74c08f3f7a30a626817a0bdd195fccba6ca8..594999b14fc335de4d43d10364829bde88a073bb 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_FlaggedConditionTool.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_FlaggedConditionTool.cxx @@ -23,14 +23,6 @@ StatusCode SCT_FlaggedConditionTool::initialize() { return StatusCode::FAILURE; } - // A dirty fix of a configuration of InDetTrigInDetSCT_FlaggedConditionTool for InDetTrigInDetSCT_ConditionsSummaryTool - if (name().find("InDetTrigInDetSCT_FlaggedConditionTool")!=std::string::npos) { - if (m_badIds.key()=="SCT_FlaggedCondData") { - m_badIds = SG::ReadHandleKey<SCT_FlaggedCondData>("SCT_FlaggedCondData_TRIG"); - ATH_MSG_INFO("Key of SCT_FlaggedCondData is changed to SCT_FlaggedCondData_TRIG in " << name()); - } - } - ATH_CHECK(m_badIds.initialize()); return StatusCode::SUCCESS; diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_MonitorConditionsTool.cxx b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_MonitorConditionsTool.cxx index 57bd0ecda052bc0d5bc0360047c4f1a0918270c0..2574ab893bacea67f1974540b83b79acf0078e87 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_MonitorConditionsTool.cxx +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_MonitorConditionsTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -14,6 +14,8 @@ #include "SCT_MonitorConditionsTool.h" +#include "SCT_ConditionsData/SCT_ConditionsParameters.h" + #include "InDetIdentifier/SCT_ID.h" #include "StoreGate/ReadCondHandle.h" @@ -157,10 +159,10 @@ SCT_MonitorConditionsTool::badStrips(const Identifier& moduleId, std::set<Identi // Convert strip number to Identifier and add to list std::set<int>::const_iterator defectItr{defectList.begin()}, defectEnd{defectList.end()}; for (; defectItr!=defectEnd; ++defectItr) { - // Strips in the DB are numbered 0-767 (side 0) and 768-1536 (side 1). + // Strips in the DB are numbered 0-767 (side 0) and 768-1535 (side 1). // This is different from the usual online/offline numbering schemes - int side{(*defectItr) > 767 ? 1 : 0}; - int stripNum{side==1 ? (*defectItr) - 768 : (*defectItr)}; + int side{(*defectItr) > SCT_ConditionsData::STRIPS_PER_WAFER-1 ? 1 : 0}; + int stripNum{side==1 ? (*defectItr) - SCT_ConditionsData::STRIPS_PER_WAFER : (*defectItr)}; Identifier stripId{m_pHelper->strip_id(m_pHelper->barrel_ec(moduleId), m_pHelper->layer_disk(moduleId), m_pHelper->phi_module(moduleId), m_pHelper->eta_module(moduleId), @@ -219,14 +221,14 @@ SCT_MonitorConditionsTool::stripIsNoisy(const int strip, const std::string& defe bool SCT_MonitorConditionsTool::chipIsNoisy(int strip, const std::string& defectList) const { - return nDefect(strip,defectList)>=m_nhits_noisychip; + return nDefect(strip,defectList,true)>=m_nhits_noisychip; } /////////////////////////////////////////////////////////////////////////////////// bool SCT_MonitorConditionsTool::waferIsNoisy(const int strip, const std::string& defectList) const { - return nDefect(strip,defectList)>=m_nhits_noisywafer; + return nDefect(strip,defectList,false)>=m_nhits_noisywafer; } /////////////////////////////////////////////////////////////////////////////////// @@ -238,22 +240,22 @@ bool SCT_MonitorConditionsTool::moduleIsNoisy(const std::string& defectList) con /////////////////////////////////////////////////////////////////////////////////// bool -SCT_MonitorConditionsTool::inRange(const int theNumber, const std::string& stringRange) const { +SCT_MonitorConditionsTool::inRange(const int theStripNumber, const std::string& stringRange) const { std::string::size_type p{stringRange.find(s_separator)}; if (p != std::string::npos) { //its a range std::string::size_type len1{p++}, len2{stringRange.size()-p}; int min{std::stoi(stringRange.substr(0,len1))}; int max{std::stoi(stringRange.substr(p,len2))}; - return inRange(theNumber, min, max); + return inRange(theStripNumber, min, max); } else { //assume its a single number - return std::stoi(stringRange) == theNumber; + return std::stoi(stringRange) == theStripNumber; } } /////////////////////////////////////////////////////////////////////////////////// bool -SCT_MonitorConditionsTool::inList(const int theNumber, const std::string& theList) const { +SCT_MonitorConditionsTool::inList(const int theStripNumber, const std::string& theList) const { if (doesNotHaveNumbers(theList)) return false; std::istringstream is{theList}; @@ -261,7 +263,7 @@ SCT_MonitorConditionsTool::inList(const int theNumber, const std::string& theLis std::istream_iterator<std::string> endOfString; //relies on default constructor to produce eof bool answer{false}; for (;readString != endOfString; ++readString) { - answer = inRange(theNumber, *readString); + answer = inRange(theStripNumber, *readString); if (answer) break; } @@ -271,18 +273,35 @@ SCT_MonitorConditionsTool::inList(const int theNumber, const std::string& theLis /////////////////////////////////////////////////////////////////////////////////// int -SCT_MonitorConditionsTool::nBlock(const int theNumber, const std::string& stringRange) const { - const int one{1}; +SCT_MonitorConditionsTool::nBlock(const int theStripNumber, const std::string& stringRange, const bool chipLevel) const { + // Determine the first and last strip numbers to be checked. + // The range of theStripNumber is 0 to 1535(=1536-1). + int first{0}; + int last{0}; + if (chipLevel) { // Chip level + first = (theStripNumber/SCT_ConditionsData::STRIPS_PER_CHIP)*SCT_ConditionsData::STRIPS_PER_CHIP; + last = first + SCT_ConditionsData::STRIPS_PER_CHIP - 1; + } else { // Wafer level + first = (theStripNumber/SCT_ConditionsData::STRIPS_PER_WAFER)*SCT_ConditionsData::STRIPS_PER_WAFER; + last = first + SCT_ConditionsData::STRIPS_PER_WAFER - 1; + } + int ndefect{0}; std::string::size_type p{stringRange.find(s_separator)}; if (p!=std::string::npos) { //its a range std::string::size_type len1{p++}, len2{stringRange.size()-p}; - int min{std::stoi(stringRange.substr(0,len1))}; - int max{std::stoi(stringRange.substr(p,len2))}; - if (inRange(theNumber, min, max)) - ndefect = max-min+one; + const int min{std::stoi(stringRange.substr(0,len1))}; + const int max{std::stoi(stringRange.substr(p,len2))}; + // find the intersect of first-last and min-max + if (max < first) ndefect = 0; + else if (min > last) ndefect = 0; + else if (min <=first and max <=last) ndefect = max -first+1; + else if (min <=first and last< max) ndefect = last-first+1; + else if (first< min and max <=last) ndefect = max -min +1; + else/*if(first< min and last< max)*/ ndefect = last-min +1; } else { //assume its a single number - if (std::stoi(stringRange) == theNumber) ndefect = 0; + const int strip{std::stoi(stringRange)}; + if (first<=strip and strip<=last) ndefect = 1; } return ndefect; } @@ -290,14 +309,14 @@ SCT_MonitorConditionsTool::nBlock(const int theNumber, const std::string& string /////////////////////////////////////////////////////////////////////////////////// int -SCT_MonitorConditionsTool::nDefect(const int theNumber, const std::string& theList) const { +SCT_MonitorConditionsTool::nDefect(const int theStripNumber, const std::string& theList, const bool chipLevel) const { int sum{0}; if (doesNotHaveNumbers(theList)) return 0; std::istringstream is{theList}; std::istream_iterator<std::string> readString{is}; std::istream_iterator<std::string> endOfString; //relies on default constructor to produce eof for (;readString != endOfString; ++readString) { - sum += nBlock(theNumber, *readString); + sum += nBlock(theStripNumber, *readString, chipLevel); } return sum; } @@ -384,10 +403,9 @@ SCT_MonitorConditionsTool::expandList(const std::string& defectStr, std::set<int unsigned int SCT_MonitorConditionsTool::computeIstrip4moncond(const Identifier& elementId) const { - const unsigned int stripsPerSide{768}; unsigned int iiside{static_cast<unsigned int>(m_pHelper->side(elementId))}; unsigned int iistrip{static_cast<unsigned int>(m_pHelper->strip(elementId))}; - return stripsPerSide*iiside + iistrip; + return SCT_ConditionsData::STRIPS_PER_WAFER*iiside + iistrip; } /////////////////////////////////////////////////////////////////////////////////// diff --git a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_MonitorConditionsTool.h b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_MonitorConditionsTool.h index 4005ce20aef85a836f265e3dd203cbd4cd23b648..eca61af0e3461e3a9485833bbc01c63dbfca0180 100644 --- a/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_MonitorConditionsTool.h +++ b/InnerDetector/InDetConditions/SCT_ConditionsTools/src/SCT_MonitorConditionsTool.h @@ -1,7 +1,7 @@ // -*- C++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef SCT_MONITORCONDITIONSTOOL_SCT_MONITORCONDITIONSTOOL_H @@ -78,13 +78,13 @@ private: bool moduleIsNoisy(const std::string& defectList) const ; - bool inRange(const int theNumber, const std::string& stringRange) const; + bool inRange(const int theStripNumber, const std::string& stringRange) const; - bool inList(const int theNumber, const std::string& theList) const; + bool inList(const int theStripNumber, const std::string& theList) const; - int nBlock(const int theNumber, const std::string& stringRange) const; + int nBlock(const int theStripNumber, const std::string& stringRange, const bool chipLevel) const; - int nDefect(const int theNumber, const std::string& theList) const; + int nDefect(const int theStripNumber, const std::string& theList, const bool chipLevel) const; int nBlock(const std::string& stringRange) const; diff --git a/InnerDetector/InDetConditions/SiLorentzAngleTool/CMakeLists.txt b/InnerDetector/InDetConditions/SiLorentzAngleTool/CMakeLists.txt index 10122dac8cd6c21828985c17a5da317320b4061b..0f3000a5e012af26cc45444511df25ad43d559da 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleTool/CMakeLists.txt +++ b/InnerDetector/InDetConditions/SiLorentzAngleTool/CMakeLists.txt @@ -23,7 +23,8 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/Identifier InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetDetDescr/InDetIdentifier - InnerDetector/InDetDetDescr/InDetReadoutGeometry ) + InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry ) # External dependencies: find_package( Eigen ) @@ -33,7 +34,7 @@ atlas_add_component( SiLorentzAngleTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests GeoPrimitives GaudiKernel SiPropertiesToolLib MagFieldInterfaces AthenaPoolUtilities Identifier InDetIdentifier InDetReadoutGeometry ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel StoreGateLib SGtests GeoPrimitives GaudiKernel SiPropertiesToolLib MagFieldInterfaces AthenaPoolUtilities Identifier InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry) # Run tests: atlas_add_test( TestSCTLorentzAngle diff --git a/InnerDetector/InDetConditions/SiLorentzAngleTool/src/PixelSiLorentzAngleCondAlg.cxx b/InnerDetector/InDetConditions/SiLorentzAngleTool/src/PixelSiLorentzAngleCondAlg.cxx index bb6dc195d98919d3f409bd09ec9fe5a34e3d8b82..aae1d57a51ae6e2cd1abcae0a18dfed8896b5ae5 100644 --- a/InnerDetector/InDetConditions/SiLorentzAngleTool/src/PixelSiLorentzAngleCondAlg.cxx +++ b/InnerDetector/InDetConditions/SiLorentzAngleTool/src/PixelSiLorentzAngleCondAlg.cxx @@ -9,7 +9,7 @@ #include "MagFieldInterfaces/IMagFieldSvc.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "SiPropertiesTool/SiliconProperties.h" PixelSiLorentzAngleCondAlg::PixelSiLorentzAngleCondAlg(const std::string& name, ISvcLocator* pSvcLocator): diff --git a/InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/HTcalculator.h b/InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/HTcalculator.h index 0df1195eca650314db7048475fc9b3ca605eee9c..f04fb8a807f69b010496ce245ba7c6b84fa7bcd6 100644 --- a/InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/HTcalculator.h +++ b/InnerDetector/InDetConditions/TRT_ConditionsData/TRT_ConditionsData/HTcalculator.h @@ -28,11 +28,11 @@ class HTcalculator { public: - HTcalculator(); - virtual ~HTcalculator(); + HTcalculator()=default; + virtual ~HTcalculator()=default; void checkInitialization(); - float Limit( float prob); + float Limit( float prob) const; // set constants to hard coded defaults void setDefaultCalibrationConstants(); @@ -46,7 +46,6 @@ class HTcalculator { private: - bool m_HasBeenInitialized; static const int N_GAS = 3; static const int N_DET = 3; @@ -73,7 +72,6 @@ class HTcalculator { static const int SIZE_OF_HEADER = sizeof(float) * 4; static const int SIZE_OF_BLOB = sizeof(float) *( (N_PAR2*N_DET)); - bool m_datainplace; }; diff --git a/InnerDetector/InDetConditions/TRT_ConditionsData/src/HTcalculator.cxx b/InnerDetector/InDetConditions/TRT_ConditionsData/src/HTcalculator.cxx index 2c17caf63842de094d628c775d38bd27a4a706df..0dcafd48b9249602882673e3dc6e0f04d0c84c22 100644 --- a/InnerDetector/InDetConditions/TRT_ConditionsData/src/HTcalculator.cxx +++ b/InnerDetector/InDetConditions/TRT_ConditionsData/src/HTcalculator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TRT_ConditionsData/HTcalculator.h" #include "AthenaKernel/getMessageSvc.h" @@ -7,34 +7,11 @@ #include <iostream> -/*****************************************************************************\ -|*%%% Default Constructor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| -\*****************************************************************************/ - -HTcalculator::HTcalculator() -{ - m_datainplace = false; - m_HasBeenInitialized=0; -} - -/*****************************************************************************\ -|*%%% Default Destructor %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| -\*****************************************************************************/ - -HTcalculator::~HTcalculator(){ - //Nothing here yet -} - void HTcalculator::checkInitialization(){ - if( not m_HasBeenInitialized ) { - MsgStream log(Athena::getMessageSvc(),"HTcalculator"); - log << MSG::WARNING << "The HTcalculator is about to be used uninitialized - Loading default" << endmsg; - setDefaultCalibrationConstants(); - m_HasBeenInitialized=1; - } +//No op } -float HTcalculator::Limit(float prob){ +float HTcalculator::Limit(float prob) const{ if( prob > 1.0 ){ return 1.0; } @@ -55,7 +32,6 @@ float HTcalculator::getProbHT( int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkWire, float Occupancy, bool hasTrackPars = true ) const { - //FIXME: This setup the Troels constants. THIS OVERRIDES CURRENT DB!!! // setDefaultCalibrationConstants(); @@ -158,10 +134,12 @@ float HTcalculator::pHTvsPGOG(int TrtPart, int GasType, float p, float mass, flo StatusCode HTcalculator::ReadVectorDB( const CondAttrListVec* channel_values){ - MsgStream log(Athena::getMessageSvc(),"HTcalculator"); if ( channel_values->size() < 1){ - log << MSG::ERROR << " There are no Pid channels available!!" << endmsg; - return StatusCode::FAILURE; + MsgStream log(Athena::getMessageSvc(),"HTcalculator"); + log << MSG::WARNING << " There are no Pid channels available!!" << endmsg; + log << MSG::WARNING << "The HTcalculator is about to be used uninitialized - Loading default" << endmsg; + setDefaultCalibrationConstants(); + return StatusCode::SUCCESS; } CondAttrListVec::const_iterator first_channel = channel_values->begin(); @@ -519,7 +497,6 @@ StatusCode HTcalculator::ReadVectorDB( const CondAttrListVec* channel_values){ } } - m_HasBeenInitialized=1; return StatusCode::SUCCESS; } @@ -541,12 +518,9 @@ void HTcalculator::setDefaultCalibrationConstants(){ the addresses of the various arrays inside the HTBlob, and NEVER otherwise! \*****************************************************************************/ - //FIXME - if (m_datainplace) return; // Just to load 1 time MsgStream log(Athena::getMessageSvc(),"HTcalculator"); log << MSG::WARNING << " HT PID DB is NOT available. Set hard-coded PID calibration constants. Derived from Run1 Data Zee and Zmumu 50 ns." << endmsg; - m_HasBeenInitialized=1; // Expanding to a 2D fit (gamma,occupancy) for three types of gases: Xenon, Argon, Krypton: // ---------------------------------------------------------------------------------------- @@ -651,6 +625,5 @@ void HTcalculator::setDefaultCalibrationConstants(){ } - m_datainplace = true; } diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelDetectorManager.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelDetectorManager.h deleted file mode 100755 index 5954b00277dff9c645d7301236adb13d0dc87ece..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelDetectorManager.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelDectorManager.h -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef InDetReadoutGeometry_PixelDetectorManager_h -#define InDetReadoutGeometry_PixelDetectorManager_h 1 - -#include "GeoPrimitives/GeoPrimitives.h" -#include "GeoModelKernel/GeoVPhysVol.h" - -#include "InDetReadoutGeometry/SiDetectorManager.h" -#include "InDetReadoutGeometry/SiDetectorElementCollection.h" -#include "InDetReadoutGeometry/InDetDD_Defs.h" - -#include "InDetIdentifier/PixelID.h" - -#include <map> - -class StoreGateSvc; -class Identifier; -class IdentifierHash; -class GeoAlignableTransform; -class GeoVFullPhysVol; -class GeoVPhysVol; -class GeoVAlignmentStore; -class CondAttrListCollection; - -namespace InDetDD { - - class PixelModuleDesign; - class SiDetectorElement; - class ExtendedAlignableTransform; - - /** @class PixelDetectorManager - - Dedicated detector manager extending the functionality of the SiDetectorManager - with dedicated pixel information, access. - - @author: Grant Gorfine - - modified and maintained by Nick Styles & Andreas Salzburger - */ - - class PixelDetectorManager : public SiDetectorManager { - - public: - - /** Constructor */ - PixelDetectorManager(StoreGateSvc* detStore); - - /** Destructor */ - ~PixelDetectorManager(); - - /** Access to raw geometry: */ - virtual unsigned int getNumTreeTops() const override; - virtual PVConstLink getTreeTop(unsigned int i) const override; - - /** Add a Tree top: */ - void addTreeTop(PVLink); - - // - // Access Readout Elements - // - /** access to individual elements : via Identifier */ - virtual SiDetectorElement * getDetectorElement(const Identifier &id) const override; - - /** access to individual elements : via IdentifierHash */ - virtual SiDetectorElement * getDetectorElement(const IdentifierHash &idHash) const override; - - /** access to individual elements : via element identification */ - SiDetectorElement * getDetectorElement(int barrel_endcap, - int layer_wheel, - int phi_module, - int eta_module) const; - - /** access to whole collection via Iterators */ - virtual const SiDetectorElementCollection * getDetectorElementCollection() const override; - virtual SiDetectorElementCollection::const_iterator getDetectorElementBegin() const override; - virtual SiDetectorElementCollection::const_iterator getDetectorElementEnd() const override; - - /** Add elememts */ - virtual void addDetectorElement(SiDetectorElement * element) override; - - /** Add alignable transforms. No access to these, they will be changed by manager: */ - virtual void addAlignableTransform (int level, - const Identifier &id, - GeoAlignableTransform *xf, - const GeoVFullPhysVol * child); - - /** As above but does a dynamic_cast to GeoVFullPhysVol */ - virtual void addAlignableTransform (int level, - const Identifier &id, - GeoAlignableTransform *xf, - const GeoVPhysVol * child); - - // DEPRECATED - virtual void addAlignableTransform (int, - const Identifier &, - GeoAlignableTransform *) override {}; // For backward compatibility - - - /** Initialize the neighbours. This can only be done when all elements are built. */ - virtual void initNeighbours() override; - - /** Methods to query which manager we have */ - virtual bool isPixel() const override {return true;} - - /** Check identifier is for this detector */ - virtual bool identifierBelongs(const Identifier & id) const override; - - - /** Layers built. Deprecated. Recommend to access via numerology (see SiDetectorManager) - Warning: decodes in "human-readable", e.g. using 3 out of 3 pixel layers yiels 111, the laset two out of 3 in 110, etc. - */ - unsigned int getBarrelLayers() const ; - - /** Layers built. Deprecated. Recommend to access via numerology (see SiDetectorManager) - Warning: decodes in "human-readable", e.g. using 3 out of 3 pixel layers yiels 111, the laset two out of 3 in 110, etc. - */ - unsigned int getEndcapLayers() const; - - /** Access to module design, Casts to PixelModuleDesign */ - virtual const PixelModuleDesign * getPixelDesign(int i) const; - - /** Process new IBLDist DB folder **/ - bool processSpecialAlignment(const std::string &, InDetDD::AlignFolderType) const override; - - bool processSpecialAlignment(const std::string& key, - const CondAttrListCollection* obj=nullptr, - GeoVAlignmentStore* alignStore=nullptr) const override; - - /** Process new global DB folders for L1 and L2 **/ - virtual - bool processGlobalAlignment(const std::string &, int level, FrameType frame, - const CondAttrListCollection* obj, - GeoVAlignmentStore* alignStore) const override; - - private: - - /** implements the main alignment update for delta transforms in different frames, - it translates into the LocalDelta or GlobalDelta function of SiDetectorManager - */ - virtual bool setAlignableTransformDelta(int level, - const Identifier & id, - const Amg::Transform3D & delta, - FrameType frame, - GeoVAlignmentStore* alignStore) const override; - - - /** prevent copy and assignment */ - const PixelDetectorManager & operator=(const PixelDetectorManager &right); - PixelDetectorManager(const PixelDetectorManager &right); - - - virtual const PixelID * getIdHelper() const override; - - // data members - std::vector<PVLink> m_volume; - SiDetectorElementCollection m_elementCollection; - typedef std::map<Identifier, ExtendedAlignableTransform *> AlignableTransformMap; - std::vector< AlignableTransformMap > m_higherAlignableTransforms; - std::vector< ExtendedAlignableTransform *> m_alignableTransforms; - const PixelID* m_idHelper; - - // Helpful function for debugging of transforms - void printTransform(const Amg::Transform3D & tr) const; - - - /** This variable switches the how the local alignment corrections are applied - If true they will be calcualted on top of all of other corrections but in the default reference frame - If false they will be calcualted on top of all of other corrections but in the globally aligned reference frame - */ - bool m_isLogical; - - }; - -} // namespace InDetDD - -#ifndef GAUDI_NEUTRAL -#include "AthenaKernel/CLASS_DEF.h" -CLASS_DEF(InDetDD::PixelDetectorManager, 18429566, 1) - -#endif - -#endif - - - - - diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelDiodeMap.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelDiodeMap.h deleted file mode 100755 index 34e9ccea7aec268b3e00a6e3cdd1d0a976976a76..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelDiodeMap.h +++ /dev/null @@ -1,196 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelDiodeMap.h -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Pixel Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef INDETREADOUTGEOMETRY_PIXELDIODEMAP_H -#define INDETREADOUTGEOMETRY_PIXELDIODEMAP_H - -// STL classes -#include <list> -#include <memory> -#include <vector> - -// Data member classes -#include "InDetReadoutGeometry/PixelDiodeMatrix.h" - -// Input/output classes -#include "InDetReadoutGeometry/SiCellId.h" -#include "InDetReadoutGeometry/SiDiodesParameters.h" - -namespace InDetDD { - -class SiCellId; -class PixelDiodeMatrix; - - /** @class PixelDiodeMap - - Class used to describe the diode segmentation of a pixel module - - to get the position and size of a PixelDiode object - - to get a PixelDiode object containing a space point - - to get a PixelDiode object from a PixelModulePosition - - @author: David Calvet - - modified Davide Costanzo. Replace PixelModulePosition with SiCellId - - modified: Grant Gorfine, Andreas Salzburger - */ - - class PixelDiodeMap { - - public: - - /** Constructor from Diode matrix description */ - PixelDiodeMap(std::shared_ptr<const PixelDiodeMatrix> diodeMatrix); - - /** Copy constructor: */ - PixelDiodeMap(const PixelDiodeMap &map); - - /** Destructor */ - ~PixelDiodeMap(); - - /** Assignment operator */ - PixelDiodeMap &operator=(const PixelDiodeMap &map); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /** Get diodes parameters (position and size): */ - SiDiodesParameters parameters(const SiCellId & diodeId) const; - - /** cell id for a given local position */ - SiCellId cellIdOfPosition(const Amg::Vector2D & localPosition) const; - - /** Check if cellId is within range */ - SiCellId cellIdInRange(const SiCellId & cellId) const; - - /** Get the neighbouring PixelDiodes of a given PixelDiode: - Cell for which the neighbours must be found - List of cells which are neighbours of the given one */ - void neighboursOfCell(const SiCellId & cellId, - std::vector<SiCellId> &neighbours) const; - - /** Compute the intersection length of two diodes: - return: the intersection length when the two diodes are projected on one - of the two axis, or 0 in case of no intersection or problem - nput: the two diodes for which the intersection length is computed */ - double intersectionLength(const SiCellId &diode1, const SiCellId &diode2) const; - - // Global sensor size: - double leftColumn() const; - double rightColumn() const; - double leftRow() const; - double rightRow() const; - - double width() const; - double length() const; - - // Number of cells in each direction. - int phiDiodes() const; - int etaDiodes() const; - - // Total number of diodes: - int diodes() const; - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - /** Set general layout flag. This can be set to true to allow handling - of more complex layouts where cells are not lined up with each other - such as bricking. Probably never will be needed. */ - void setGeneralLayout() {m_generalLayout = true;} - - /////////////////////////////////////////////////////////////////// - // Private methods: - /////////////////////////////////////////////////////////////////// - private: - - /** Compute the intersection length along one direction: - return 0 if no intersection - x1,x2 are the centers - dx1,dx2 are the full lengths */ - double intersectionLength1D(const double x1,const double dx1, - const double x2,const double dx2) const; - - /** Slower method. Called by neighboursOfCell if m_generalLayout set. */ - void neighboursOfCellGeneral(const SiCellId & cellId, - std::vector<SiCellId> &neighbours) const; - - /** Slower method. Called by intersectionLength if m_generalLayout set. */ - double intersectionLengthGeneral(const SiCellId &diode1, - const SiCellId &diode2) const; - - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// - private: - std::shared_ptr<const PixelDiodeMatrix> m_matrix; //!< diode matrix - bool m_generalLayout; //!< Flag set to allow for dealing wth more general layouts. - }; - - /////////////////////////////////////////////////////////////////// - // Inline methods: - /////////////////////////////////////////////////////////////////// - - inline double PixelDiodeMap::length() const - { - return m_matrix->etaWidth(); - } - - inline double PixelDiodeMap::width() const - { - return m_matrix->phiWidth(); - } - - inline double PixelDiodeMap::leftColumn() const - { - return -0.5*length(); - } - - inline double PixelDiodeMap::rightColumn() const - { - return 0.5*length(); - } - - inline double PixelDiodeMap::leftRow() const - { - return -0.5*width(); - } - - inline double PixelDiodeMap::rightRow() const - { - return 0.5*width(); - } - - inline int PixelDiodeMap::diodes() const - { - return phiDiodes() * etaDiodes(); - } - - inline int PixelDiodeMap::phiDiodes() const - { - return m_matrix->phiCells(); - } - - inline int PixelDiodeMap::etaDiodes() const - { - return m_matrix->etaCells(); - } - - inline SiCellId PixelDiodeMap::cellIdInRange(const SiCellId & cellId) const - { - if (!cellId.isValid() || - cellId.phiIndex() <0 || cellId.phiIndex() >= phiDiodes() || - cellId.etaIndex() <0 || cellId.etaIndex() >= etaDiodes()) return SiCellId(); // Invalid - return cellId; - } - -} // namespace InDetDD - -#endif // INDETREADOUTGEOMETRY_PIXELDIODEMAP_H diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelDiodeMatrix.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelDiodeMatrix.h deleted file mode 100755 index 53ec66cc27b8574014b73d265b19d7d01478ff4e..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelDiodeMatrix.h +++ /dev/null @@ -1,202 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelDiodeMatrix.h -/////////////////////////////////////////////////////////////////// - -#ifndef INDETREADOUTGEOMETRY_PIXELDIODEMATRIX_H -#define INDETREADOUTGEOMETRY_PIXELDIODEMATRIX_H - -#include "InDetReadoutGeometry/SiCellId.h" -#include "GeoPrimitives/GeoPrimitives.h" -#include "TrkDetElementBase/TrkDetElementBase.h" - -#include <memory> - -namespace InDetDD { - - /** @class PixelDiodeMatrix - - Class used to describe the segmentation of the pixel and allow for conversion between cell id and position. - - The class PixelDiodeMatrix represents what it calls a cell. In the context - of this class a cell can either be just a simple cell as one would normally - think of a pixel cell (eg a 50x400um or 50x600um cell) or it can be a - container of multiple cells. To allow for different size cells and layout, - it contains a lower cell, an upper cell and multiple middle - cells. The middle cells are all the same (so all have the same size), but - the upper and lower cells can be different and can have different size or be left out - if they are not needed. The direction of replication is also specified (eta - or phi direction). The size of the cells in the direction orthoganal to the - replication direction must all be the same (there is no check for this though). - - To help understand the structure and its use, consider the current pixel - geometry. The pixel module has two cell sizes short and long cells. These - are refered to as normal and big bellow. The long cells are in the region - at the edge of the the FE chips in order to cover the gap between FE chips. - - The assembly of this structure is done when building the sensitive detector - in GeoModel in the class GeoPixelSiCrystal. - - - normalCell (short pixel cell) 50x400um - - bigCell (long pixel cell): 50x600um - - - singleChipRow (represents one row associated to a FE) - - Size: phiWidth = 50um, etaWidth = 600*2+400*16) um = 7.6 CLHEP::mm - - upper cell: bigCell - - middle cells: 16 x normalCell - - lower cell: bigcell - - direction: eta - - - singleRow (represents a row of cells covering the full length of the - module) - - Size: phiWidth = 50um, etaWidth = 8 * (600*2+400*16) um = 60.8 CLHEP::mm - - upper cell: none - - middle cells: 8 x singleChipRow - - lower cell: none - - direction: eta - - - fullMatrix (represents the full module) - - Size: phiWidth = 50 * 328 um = 16.4 CLHEP::mm, etaWidth = 60.8 CLHEP::mm - - upper cell: none - - middle cells: 328 x singleRow - - lower cell: non - - direction: phi - - Each cell knows its total size and total number of child cells in the phi and eta - direction. This is determined by totaling up these quantities - when the object is constructed. - - The structure allows for efficient navigation from cell number to - position and vice-versa. There are two main methods which allow for this navigation: - cellIdOfPosition() (from cell id to position) and positionOfCell() (from position to cell id). - - As it is assumed that child cells fill up completely its parent, there is - no range check in these methods. The methods are called from PixelDiodeMap - where it first checks that is within range of the top level cell (refered to - as the top level matrix). - - PixelDiodeMatrix might inherit std::shared_ptr but needs to return std::shared_ptr of this pointer. - To do this, std::enable_shared_from_this and shared_from_this() have to be used. - https://en.cppreference.com/w/cpp/memory/enable_shared_from_this - - See the description of these methods for more details. - - @image html pixeldiodematrix.gif - - @author Grant Gorfine - - modified & maintained: Nick Styles, Andreas Salzburger - **/ - - class PixelDiodeMatrix : public std::enable_shared_from_this<PixelDiodeMatrix> { - - public: - - enum Direction {phiDir, etaDir}; - - /// Destructor - ~PixelDiodeMatrix() = default; - - /// Construct method for just a single cell. - static std::shared_ptr<const PixelDiodeMatrix> construct(double phiWidth, double etaWidth); - - /** Construct method with multiple matrices. - There may be zero or one lower matrix (pointer can be 0). - Multiple (numCells) middle matrics (must pass a non zero pointer). - There may be zero or one upper matrix (pointer can be 0). - These must all have the same width and cells in the non replicating direction. */ - static std::shared_ptr<const PixelDiodeMatrix> construct(Direction direction, // phi or eta - std::shared_ptr<const PixelDiodeMatrix> lowerCell, - std::shared_ptr<const PixelDiodeMatrix> middleCells, - int numCells, - std::shared_ptr<const PixelDiodeMatrix> upperCells); - - /** Return cell Id corresponding to a relative position within the matrix. - The cellId is modified and returns the id relative to the passed cellId. - That is, it adds the relative cellId to the cellId passed to the function. - A pointer to the correspond cell is returned. This can be used to get the - size of the cell. */ - std::shared_ptr<const PixelDiodeMatrix> cellIdOfPosition(const Amg::Vector2D & position, SiCellId & cellId) const; - - /** Return position correspong to cell with relative id withing the matrix. - Returns the relative position added to the position passed in. - A pointer to the correspond cell is returned. This can be used to get the - size of the cell. */ - std::shared_ptr<const PixelDiodeMatrix> positionOfCell(const SiCellId & cellId, Amg::Vector2D & position) const; - - /** Width in phi (x) direction.*/ - double phiWidth() const; - - /** Width in eta (y) direction. */ - double etaWidth() const; - - /** Number of cells in phi (x) direction. */ - int phiCells() const; - - /** Number of cells in eta (y) direction. */ - int etaCells() const; - - /** Query wether the matrix is just a single cell. Mainly for internal use. */ - bool singleCell() const; - - private: - /** Hidden constructor */ - PixelDiodeMatrix() {}; - - /// Initialize for just a single cell. - void initialize(double phiWidth, double etaWidth); - - /** Initialize for multiple matrices. - There may be zero or one lower matrix (pointer can be 0). - Multiple (numCells) middle matrics (must pass a non zero pointer). - There may be zero or one upper matrix (pointer can be 0). - These must all have the same width and cells in the non replicating direction. */ - void initialize(Direction direction, // phi or eta - std::shared_ptr<const PixelDiodeMatrix> lowerCell, - std::shared_ptr<const PixelDiodeMatrix> middleCells, - int numCells, - std::shared_ptr<const PixelDiodeMatrix> upperCells); - - double m_phiWidth; - double m_etaWidth; - int m_phiCells; - int m_etaCells; - Direction m_direction; - int m_numCells; // number of MiddleCells along m_direction direction. - std::shared_ptr<const PixelDiodeMatrix> m_lowerCell; - std::shared_ptr<const PixelDiodeMatrix> m_middleCells; - std::shared_ptr<const PixelDiodeMatrix> m_upperCell; - bool m_singleCell; - - }; - - inline double PixelDiodeMatrix::phiWidth() const - { - return m_phiWidth; - } - - inline double PixelDiodeMatrix::etaWidth() const - { - return m_etaWidth; - } - - inline int PixelDiodeMatrix::phiCells() const - { - return m_phiCells; - } - - inline int PixelDiodeMatrix::etaCells() const - { - return m_etaCells; - } - - inline bool PixelDiodeMatrix::singleCell() const - { - return m_singleCell; - } - -} // end namespace - -#endif //INDETREADOUTGEOMETRY_PIXELDIODEMATRIX_H diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelModuleDesign.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelModuleDesign.h deleted file mode 100755 index 379d3e1ecf5f6e3e1561fadcc10cb4de5aaa627f..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelModuleDesign.h +++ /dev/null @@ -1,354 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelModuleDesign.h -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Pixel Detector software -/////////////////////////////////////////////////////////////////// - - -#ifndef INDETREADOUTGEOMETRY_PIXELMODULEDESIGN_H -#define INDETREADOUTGEOMETRY_PIXELMODULEDESIGN_H - -// Base class -#include "InDetReadoutGeometry/SiDetectorDesign.h" - -// Data member classes -#include "InDetReadoutGeometry/PixelDiodeMap.h" -#include "InDetReadoutGeometry/PixelReadoutScheme.h" - -// Other includes -#include "CxxUtils/CachedUniquePtr.h" -#include "InDetIdentifier/PixelID.h" - -#include <memory> - -namespace Trk{ - class RectangleBounds; - class SurfaceBounds; -} - -namespace InDetDD { - - class PixelDiodeMatrix; - - /** @class PixelModuleDesign - Class used to describe the design of a module - (diode segmentation and readout scheme) - - - to get the PixelReadoutCell connected to a PixelDiode - - to get the list of PixelDiodes connected to a PixelReadoutCell - - @author Alessandro Fornaini - - modified: Grant Gorfine, Nick Styles, Andreas Salzburger - */ - class PixelModuleDesign : public SiDetectorDesign { - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: - - /////////////////////////////////////////////////////////////////// - // Constructors/destructor: - /////////////////////////////////////////////////////////////////// - - /** Constructor with parameters: - local axis corresponding to eta direction - local axis corresponding to phi direction - local axis corresponding to depth direction - thickness of silicon sensor - number of circuits in one circuit column - number of circuits in one circuit row - number of cell columns per circuit - number of cell rows per circuit - number of diode columns connected to one circuit - number of diode rows connected to one circuit */ - - PixelModuleDesign(const double thickness, - const int circuitsPerColumn, - const int circuitsPerRow, - const int cellColumnsPerCircuit, - const int cellRowsPerCircuit, - const int diodeColumnsPerCircuit, - const int diodeRowsPerCircuit, - std::shared_ptr<const PixelDiodeMatrix> matrix, - InDetDD::CarrierType carrierType, - int readoutSide = -1, - bool is3D=false); - - // Destructor: - virtual ~PixelModuleDesign() = default; - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /** Returns distance to nearest detector active edge - +ve = inside - -ve = outside */ - virtual void distanceToDetectorEdge(const SiLocalPosition & localPosition, - double & etaDist, double & phiDist) const; - - /** readout or diode id -> position, size */ - virtual SiDiodesParameters parameters(const SiCellId & cellId) const; - virtual SiLocalPosition localPositionOfCell(const SiCellId & cellId) const; - - /** readout id -> id of connected diodes */ - virtual int numberOfConnectedCells(const SiReadoutCellId & readoutId) const; - virtual SiCellId connectedCell(const SiReadoutCellId & readoutId, int number) const; - - /** If cell is ganged return the other cell, otherwise return an invalid id. */ - virtual SiCellId gangedCell(const SiCellId & cellId) const; - - /** diode id -> readout id */ - virtual SiReadoutCellId readoutIdOfCell(const SiCellId & cellId) const; - - /** position -> id */ - virtual SiReadoutCellId readoutIdOfPosition(const SiLocalPosition & localPos) const; - virtual SiCellId cellIdOfPosition(const SiLocalPosition & localPos) const; - - /** Check if cell is in range. Returns the original cellId if it is in range, otherwise it returns an invalid id. */ - virtual SiCellId cellIdInRange(const SiCellId & cellId) const; - - /** Helper method for stereo angle computation */ - virtual HepGeom::Vector3D<double> phiMeasureSegment(const SiLocalPosition&) const; - - /** Special method for SCT (irrelevant here): */ - virtual std::pair<SiLocalPosition,SiLocalPosition> endsOfStrip(const SiLocalPosition &position) const; - - /** Given row and column index of a diode, return position of diode center - ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or - rawLocalPositionOfCell method in SiDetectorElement. - DEPRECATED */ - SiLocalPosition positionFromColumnRow(const int column, const int row) const; - - /** Get the neighbouring diodes of a given diode: - Cell for which the neighbours must be found - List of cells which are neighbours of the given one */ - virtual void neighboursOfCell(const SiCellId & cellId, - std::vector<SiCellId> &neighbours) const; - - /** Compute the intersection length of two diodes: - return: the intersection length when the two diodes are projected on one - of the two axis, or 0 in case of no intersection or problem - input: the two diodes for which the intersection length is computed */ - double intersectionLength(const SiCellId &diode1, const SiCellId &diode2) const; - - /** Global sensor size: */ - double sensorLeftColumn() const; - double sensorRightColumn() const; - double sensorLeftRow() const; - double sensorRightRow() const; - - /** Total number of diodes: */ - int numberOfDiodes() const; - - /** Total number of circuits:*/ - int numberOfCircuits() const; - - /** Number of cell columns per circuit:*/ - int columnsPerCircuit() const; - - /** Number of cell rows per circuit:*/ - int rowsPerCircuit() const; - - /** Number of cell columns per module:*/ - int columns() const; - - /** Number of cell rows per module:*/ - int rows() const; - - /** Method to calculate length of a module*/ - virtual double length() const; - - /** Method to calculate average width of a module*/ - virtual double width() const; - - /** Method to calculate minimum width of a module*/ - virtual double minWidth() const; - - /** Method to calculate maximum width of a module*/ - virtual double maxWidth() const; - - /** Pitch in phi direction*/ - virtual double phiPitch() const; - - /** Pitch in phi direction*/ - virtual double phiPitch(const SiLocalPosition & localPosition) const; - - /** Pitch in eta direction*/ - virtual double etaPitch() const; - - /** Method to calculate eta width from a column range*/ - double widthFromColumnRange(const int colMin, const int colMax) const; - - /** Method to calculate phi width from a row range*/ - double widthFromRowRange(const int rowMin, const int rowMax) const; - - /** Test if near bond gap within tolerances - Only relevant for SCT. Always returns false for pixels.*/ - virtual bool nearBondGap(const SiLocalPosition & localPosition, double etaTol) const; - - /** Return true if hit local direction is the same as readout direction.*/ - virtual bool swapHitPhiReadoutDirection() const; - virtual bool swapHitEtaReadoutDirection() const; - - /** Element boundary*/ - virtual const Trk::SurfaceBounds & bounds() const; - - virtual bool is3D() const; - - enum ReadoutTechnology{FEI3,FEI4,RD53}; - ReadoutTechnology getReadoutTechnology() const; - - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - - /** Add a new multiple connection for rows: - lower diode row for which the connection scheme is given - vector containing, for each diode, the readout cell row number - to which the corresponding diode is connected */ - void addMultipleRowConnection(const int lowerRow, - const std::vector<int> &connections); - - /** Indicate that it is a more complex layout where cells are not - lined up with each other. Eg bricking. Probably never will be needed. */ - void setGeneralLayout(); - - /////////////////////////////////////////////////////////////////// - // Private methods: - /////////////////////////////////////////////////////////////////// - private: - - PixelModuleDesign(); - - // Copy constructor: - PixelModuleDesign(const PixelModuleDesign &design); - - // Assignment operator: - PixelModuleDesign &operator=(const PixelModuleDesign &design); - - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// - private: - PixelDiodeMap m_diodeMap; - PixelReadoutScheme m_readoutScheme; - CxxUtils::CachedUniquePtr<Trk::RectangleBounds> m_bounds; - bool m_is3D; - - }; - - /////////////////////////////////////////////////////////////////// - // Inline methods: - /////////////////////////////////////////////////////////////////// - - inline void PixelModuleDesign::addMultipleRowConnection(const int lowerRow, - const std::vector<int> &connections) - { - m_readoutScheme.addMultipleRowConnection(lowerRow,connections); - } - - inline double PixelModuleDesign::sensorLeftColumn() const - { - return m_diodeMap.leftColumn(); - } - - inline double PixelModuleDesign::sensorRightColumn() const - { - return m_diodeMap.rightColumn(); - } - - inline double PixelModuleDesign::sensorLeftRow() const - { - return m_diodeMap.leftRow(); - } - - inline double PixelModuleDesign::sensorRightRow() const - { - return m_diodeMap.rightRow(); - } - - inline int PixelModuleDesign::numberOfDiodes() const - { - return m_diodeMap.diodes(); - } - - inline int PixelModuleDesign::numberOfCircuits() const - { - return m_readoutScheme.numberOfCircuits(); - } - - inline int PixelModuleDesign::columnsPerCircuit() const - { - return m_readoutScheme.columnsPerCircuit(); - } - - inline int PixelModuleDesign::rowsPerCircuit() const - { - return m_readoutScheme.rowsPerCircuit(); - } - - inline int PixelModuleDesign::columns() const - { - return m_readoutScheme.columns(); - } - - inline int PixelModuleDesign::rows() const - { - return m_readoutScheme.rows(); - } - - inline bool PixelModuleDesign::nearBondGap(const SiLocalPosition &, double) const - { - // No bond gap in pixel module - return false; - } - - inline bool PixelModuleDesign::swapHitPhiReadoutDirection() const - { - return true; - } - - inline bool PixelModuleDesign::swapHitEtaReadoutDirection() const - { - return true; - } - - - inline void PixelModuleDesign::neighboursOfCell(const SiCellId & cellId, - std::vector<SiCellId> &neighbours) const - { - return m_diodeMap.neighboursOfCell(cellId, neighbours); - } - - inline double PixelModuleDesign::intersectionLength(const SiCellId &diode1, - const SiCellId &diode2) const - { - return m_diodeMap.intersectionLength(diode1, diode2); - } - - - - inline bool PixelModuleDesign::is3D() const - { - return m_is3D; - } - - inline PixelModuleDesign::ReadoutTechnology PixelModuleDesign::getReadoutTechnology() const { - const int maxRow = m_readoutScheme.rowsPerCircuit(); - const int maxCol = m_readoutScheme.columnsPerCircuit(); - if (maxRow*maxCol>26000) { return FEI4; } - else { return FEI3; } - } - -} // namespace InDetDD - -#endif // INDETREADOUTGEOMETRY_PIXELMODULEDESIGN_H diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelMultipleConnection1D.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelMultipleConnection1D.h deleted file mode 100755 index 1e605eaceee7b482510f14fd19aeed0d05cedbcb..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelMultipleConnection1D.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelMultipleConnection1D.h -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Pixel Detector software -/////////////////////////////////////////////////////////////////// - - -#ifndef INDETREADOUTGEOMETRY_PIXELMULTIPLECONNECTION1D_H -#define INDETREADOUTGEOMETRY_PIXELMULTIPLECONNECTION1D_H - -#include <vector> - -namespace InDetDD { - - /** @class PixelMultipleConnection1D - - Class used to handle connection of multiple diodes to the same readout cell - - @author: David Calvet - @note: modifed by Grant Gorfine, Andreas Salzburger - */ - - class PixelMultipleConnection1D { - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: - - PixelMultipleConnection1D(); - - /** Constructor with parameters: - lower diode index for which the connection scheme is given - vector containing, for each diode, the readout cell number to which - the corresponding diode is connected */ - PixelMultipleConnection1D(const int lowerIndex, const std::vector<int> &connections); - - - void set(const int lowerIndex, const std::vector<int> &connections); - - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /** Check if the readout cell is in the range; Also for index of gangedCell. */ - bool outsideReadout(const int index) const; - - /** Check if the diode is in the range: */ - bool outsideDiode(const int cell) const; - - /** Return the number of diodes that are connected to this readout cell, Must check outsideReadout first. */ - int numberOfConnectedCells(const int index) const; - - /** Return the diode index corresponding the this readout. - number 0 will return the primary cell (ie diode index = readout cell index) - Must check outsideReadout first.*/ - int connectedCell(const int index, unsigned int number) const; - - /** Return readout cell id of this diode, Must check outsideDiode first. */ - int readoutOfDiode(const int index) const; - - /** If the diode is gnaged return the other diode. If the diode is not ganged return the same diode. - Must check outsideReadout first. */ - int gangedCell(const int index) const; - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// - private: - int m_lowerDiode; //!< lower diode index to which it applies - int m_upperDiode; //!< upper diode index to which it applies - int m_lowerReadout; //!< lower cell to which it applies - int m_upperReadout; //!< upper cell to which it applies - std::vector< std::vector<int> > m_readoutToDiode; //!< connection table readout -> diodes - std::vector<int> m_diodeToReadout; //!< connection table diode -> readout - std::vector<int> m_diodeGanged; //!< connection table diode -> other diode. - - /////////////////////////////////////////////////////////////////// - // Private methods: - /////////////////////////////////////////////////////////////////// - void debugPrintout(); - -}; - -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// - -inline bool PixelMultipleConnection1D::outsideReadout(const int readout) const -{ - return (readout<m_lowerReadout || readout>m_upperReadout); -} - - -inline bool PixelMultipleConnection1D::outsideDiode(const int diode) const -{ - return (diode<m_lowerDiode || diode>m_upperDiode); -} - - -inline int PixelMultipleConnection1D::numberOfConnectedCells(const int index) const -{ - return m_readoutToDiode[index - m_lowerReadout].size(); -} - -inline int PixelMultipleConnection1D::connectedCell(const int index, unsigned int number) const -{ - return m_readoutToDiode[index - m_lowerReadout][number]; -} - -inline int PixelMultipleConnection1D::readoutOfDiode(const int index) const -{ - return m_diodeToReadout[index - m_lowerDiode]; -} - -inline int PixelMultipleConnection1D::gangedCell(const int index) const -{ - return m_diodeGanged[index - m_lowerReadout]; -} - -} // namespace InDetDD - -#endif // INDETREADOUTGEOMETRY_PIXELMULTIPLECONNECTION1D_H diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelReadoutScheme.h b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelReadoutScheme.h deleted file mode 100755 index fb5762dd199fcfee98bdf338b24213e2dd6f39cc..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/InDetReadoutGeometry/PixelReadoutScheme.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelReadoutScheme.h -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Pixel Detector software -/////////////////////////////////////////////////////////////////// - -#ifndef INDETREADOUTGEOMETRY_PIXELREADOUTSCHEME_H -#define INDETREADOUTGEOMETRY_PIXELREADOUTSCHEME_H - -// Data member classes -#include "InDetReadoutGeometry/PixelMultipleConnection1D.h" - -// Input and output classes -#include "InDetReadoutGeometry/SiReadoutCellId.h" -#include "InDetReadoutGeometry/SiCellId.h" - -namespace InDetDD { - - /** @class PixelReadoutScheme - - Class used to describe the connection scheme of a diode matrix - to a set of readout circuits - - to get the readout cell connected to a diode - - to get the list of diodes connected to a readout cell - - @author David Calvet - - modified on 5/10/04 Davide Costanzo. Replace PixelModulePosition with SiCellId - - modified: Grant Gorfine, Andreas Salzburger - */ - - class PixelReadoutScheme { - - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// - public: - - /////////////////////////////////////////////////////////////////// - // Constructors/destructor: - /////////////////////////////////////////////////////////////////// - - /** Constructor with parameters: - - number of circuits in one circuit column - number of circuits in one circuit row - number of cell columns per circuit - number of cell rows per circuit - number of diode columns connected to one circuit - number of diode rows connected to one circuit */ - PixelReadoutScheme(const int circuitsPerColumn,const int circuitsPerRow, - const int cellColumnsPerCircuit, - const int cellRowsPerCircuit, - const int diodeColumnsPerCircuit, - const int diodeRowsPerCircuit); - - /** Destructor: */ - ~PixelReadoutScheme(); - - /////////////////////////////////////////////////////////////////// - // Const methods: - /////////////////////////////////////////////////////////////////// - - /** total number of circuits: */ - int numberOfCircuits() const; - - /** number of cell columns per circuit: */ - int columnsPerCircuit() const; - - /** number of cell rows per circuit:*/ - int rowsPerCircuit() const; - - /** number of cell columns per module:*/ - int columns() const; - - /** number of cell rows per module:*/ - int rows() const; - - /** number of cells connected to this readout.*/ - int numberOfConnectedCells(const SiReadoutCellId & readoutId) const; - - /** Cell ids of cell connected to this readout.*/ - SiCellId connectedCell(const SiReadoutCellId & readoutId, unsigned int number) const; - - /** Readout id of this diode.*/ - SiReadoutCellId readoutIdOfCell(const SiCellId & cellId) const; - - /** If cell is ganged return the other cell, otherwise return an invalid id.*/ - SiCellId gangedCell(const SiCellId & cellId) const; - - /////////////////////////////////////////////////////////////////// - // Non-const methods: - /////////////////////////////////////////////////////////////////// - - /** Add a new multiple connection for rows: - lower diode row for which the connection scheme is given - vector containing, for each diode, the readout cell row number - to which the corresponding diode is connected */ - void addMultipleRowConnection(const int lowerRow, const std::vector<int> &connections); - - /////////////////////////////////////////////////////////////////// - // Private methods: - /////////////////////////////////////////////////////////////////// - private: - - PixelReadoutScheme(); - - /////////////////////////////////////////////////////////////////// - // Private data: - /////////////////////////////////////////////////////////////////// - private: - PixelMultipleConnection1D m_rowConnections; //!< multiple connections for rows - int m_numberOfCircuits; //!< total number of circuits - int m_columnsPerCircuit; //!< number of cell columns per circuit - int m_rowsPerCircuit; //!< number of cell rows per circuit - int m_columns; //!< Number of columns - int m_rows; //!< Number of rows - -}; - -/////////////////////////////////////////////////////////////////// -// Inline methods: -/////////////////////////////////////////////////////////////////// -inline PixelReadoutScheme::~PixelReadoutScheme() -{} - -inline int PixelReadoutScheme::numberOfCircuits() const -{ - return m_numberOfCircuits; -} - -inline int PixelReadoutScheme::columnsPerCircuit() const -{ - return m_columnsPerCircuit; -} - -inline int PixelReadoutScheme::rowsPerCircuit() const -{ - return m_rowsPerCircuit; -} - -inline int PixelReadoutScheme::columns() const -{ - return m_columns; -} - -inline int PixelReadoutScheme::rows() const -{ - return m_rows; -} - -} // namespace InDetDD - -#endif // INDETREADOUTGEOMETRY_PIXELREADOUTSCHEME_H diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelDetectorManager.cxx b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelDetectorManager.cxx deleted file mode 100755 index b6152e76bd0e0b2f604c1abc74300c219091c138..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelDetectorManager.cxx +++ /dev/null @@ -1,684 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "DetDescrConditions/AlignableTransformContainer.h" -#include "DetDescrConditions/AlignableTransform.h" -#include "AthenaPoolUtilities/CondAttrListCollection.h" - -#include "InDetReadoutGeometry/PixelDetectorManager.h" -#include "InDetIdentifier/PixelID.h" -#include "Identifier/Identifier.h" -#include "Identifier/IdentifierHash.h" -#include "InDetReadoutGeometry/SiDetectorElementCollection.h" -#include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/ExtendedAlignableTransform.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "StoreGate/StoreGateSvc.h" - -#include "GeoModelKernel/GeoVAlignmentStore.h" -#include "AthenaBaseComps/AthMsgStreamMacros.h" -#include "GeoPrimitives/GeoPrimitivesHelpers.h" - -namespace InDetDD { - - const int FIRST_HIGHER_LEVEL = 1; - - - PixelDetectorManager::PixelDetectorManager(StoreGateSvc* detStore) - : SiDetectorManager(detStore, "Pixel"), - m_idHelper(0), - m_isLogical(false) // Change to true to change the definition of local module corrections - { - - // - // Initialized the Identifier helper. - // - - StatusCode sc = detStore->retrieve(m_idHelper,"PixelID"); - if (sc.isFailure() ) { - msg(MSG::ERROR) << "Could not retrieve Pixel id helper" << endmsg; - } - - // Initialize the collections. - if (m_idHelper) { - m_elementCollection.resize(m_idHelper->wafer_hash_max()); - m_alignableTransforms.resize(m_idHelper->wafer_hash_max()); - } - } - - - PixelDetectorManager::~PixelDetectorManager() - { - // Clean up - for (size_t i=0; i < m_volume.size(); i++) { - m_volume[i]->unref(); - } - - for (size_t j=0; j < m_higherAlignableTransforms.size(); j++){ - AlignableTransformMap::iterator iterMap; - for (iterMap = m_higherAlignableTransforms[j].begin(); - iterMap != m_higherAlignableTransforms[j].end(); - ++iterMap) { - delete iterMap->second; - } - } - - for (size_t k=0; k < m_alignableTransforms.size(); k++){ - delete m_alignableTransforms[k]; - } - } - - - - unsigned int PixelDetectorManager::getNumTreeTops() const - { - return m_volume.size(); - } - - PVConstLink PixelDetectorManager::getTreeTop(unsigned int i) const - { - return m_volume[i]; - } - - void PixelDetectorManager::addTreeTop(PVLink vol){ - vol->ref(); - m_volume.push_back(vol); - } - - - SiDetectorElement* PixelDetectorManager::getDetectorElement(const Identifier & id) const - { - // NB the id helpers implementation for getting a hash is not optimal. - // Essentially does a binary search. - // Make sure it is a wafer Id - Identifier waferId = id; -#ifndef __IDENTIFIER_64BIT__ - // pixel ids have special treatement. It is possible to distinguish between - // a wafer id and a pixel cell id by checking bit 32, which is set for a pixel cell id. - if (id.is_valid() && (id.get_compact() & 0x80000000)) { - waferId = m_idHelper->wafer_id(id); - } -#else - waferId = m_idHelper->wafer_id(id); -#endif /* __IDENTIFIER_64BIT__ */ - IdentifierHash idHash = m_idHelper->wafer_hash(waferId); - if (idHash.is_valid()) { - return m_elementCollection[idHash]; - } else { - return 0; - } - } - - - SiDetectorElement* PixelDetectorManager::getDetectorElement(const IdentifierHash & idHash) const - { - return m_elementCollection[idHash]; - } - - SiDetectorElement* PixelDetectorManager::getDetectorElement(int barrel_endcap, int layer_wheel, int phi_module, int eta_module) const - { - return getDetectorElement(m_idHelper->wafer_id(barrel_endcap, layer_wheel, phi_module, eta_module)); - } - - const SiDetectorElementCollection* PixelDetectorManager::getDetectorElementCollection() const - { - return &m_elementCollection; - } - - SiDetectorElementCollection::const_iterator PixelDetectorManager::getDetectorElementBegin() const - { - return m_elementCollection.begin(); - } - - SiDetectorElementCollection::const_iterator PixelDetectorManager::getDetectorElementEnd() const - { - return m_elementCollection.end(); - } - - - void PixelDetectorManager::addDetectorElement(SiDetectorElement * element) - { - IdentifierHash idHash = element->identifyHash(); - if (idHash >= m_elementCollection.size()) - throw std::runtime_error("PixelDetectorManager: Error adding detector element."); - m_elementCollection[idHash] = element; - } - - void PixelDetectorManager::initNeighbours() - { - SiDetectorElementCollection::iterator iter; - - // Loop over all elements and set the neighbours - for (iter = m_elementCollection.begin(); iter != m_elementCollection.end(); ++iter){ - - SiDetectorElement * element = *iter; - if (element) { - - IdentifierHash idHash = element->identifyHash(); - IdentifierHash idHashOther; - - int result; - // If no neighbour, result != 0 in which case we leave neighbour as null - result = m_idHelper->get_next_in_eta(idHash, idHashOther); - if (result==0) element->setNextInEta(m_elementCollection[idHashOther]); - - result = m_idHelper->get_prev_in_eta(idHash, idHashOther); - if (result==0) element->setPrevInEta(m_elementCollection[idHashOther]); - - result = m_idHelper->get_next_in_phi(idHash, idHashOther); - if (result==0) element->setNextInPhi(m_elementCollection[idHashOther]); - - result = m_idHelper->get_prev_in_phi(idHash, idHashOther); - if (result==0) element->setPrevInPhi(m_elementCollection[idHashOther]); - } - } - } - - - const PixelID* PixelDetectorManager::getIdHelper() const - { - return m_idHelper; - } - - unsigned int PixelDetectorManager::getBarrelLayers() const - { - unsigned int barrelLayers = 0; - for (int i = numerology().numLayers() - 1; i >= 0; --i) { - barrelLayers *= 10; - barrelLayers += numerology().useLayer(i); - } - return barrelLayers; - } - - unsigned int PixelDetectorManager::getEndcapLayers() const - { - unsigned int endcapLayers = 0; - for (int i = numerology().numDisks() - 1; i >= 0; --i) { - endcapLayers *= 10; - endcapLayers += numerology().useDisk(i); - } - return endcapLayers; - } - - - bool PixelDetectorManager::setAlignableTransformDelta(int level, - const Identifier & id, - const Amg::Transform3D & delta, - FrameType frame, - GeoVAlignmentStore* alignStore) const - { - - if (level == 0) { // At the element level - local shift - - // We retrieve it via a hashId. - IdentifierHash idHash = m_idHelper->wafer_hash(id); - if (!idHash.is_valid()) return false; - - if (frame == InDetDD::global) { - - return setAlignableTransformGlobalDelta(m_alignableTransforms[idHash], delta, alignStore); - - } else if (frame == InDetDD::local) { - - SiDetectorElement * element = m_elementCollection[idHash]; - if (!element) return false; - - // Its a local transform - //See header file for definition of m_isLogical - if( m_isLogical ){ - //Ensure cache is up to date and use the alignment corrected local to global transform - element->setCache(); - return setAlignableTransformLocalDelta(m_alignableTransforms[idHash], element->transform(), delta, alignStore); - } else - //Use default local to global transform - return setAlignableTransformLocalDelta(m_alignableTransforms[idHash], element->defTransform(), delta, alignStore); - } else { - // other not supported - msg(MSG::WARNING) << "Frames other than global or local are not supported." << endmsg; - return false; - } - - } else { // higher level - - if (frame != InDetDD::global) { - msg(MSG::WARNING) << "Non global shift at higher levels is not possible." << endmsg; - return false; - } - - int index = level - FIRST_HIGHER_LEVEL; // level 0 is treated separately. - if (index >= static_cast<int>(m_higherAlignableTransforms.size())) return false; - - // We retrieve it from a map. - AlignableTransformMap::const_iterator iter; - iter = m_higherAlignableTransforms[index].find(id); - if (iter == m_higherAlignableTransforms[index].end()) return false; - - // Its a global transform - return setAlignableTransformGlobalDelta(iter->second, delta, alignStore); - } - - } - - - void PixelDetectorManager::addAlignableTransform (int level, - const Identifier & id, - GeoAlignableTransform *transform, - const GeoVPhysVol * child) - { - if (m_idHelper) { - - const GeoVFullPhysVol * childFPV = dynamic_cast<const GeoVFullPhysVol *>(child); - if (!childFPV) { - msg(MSG::ERROR) << "Child of alignable transform is not a full physical volume" - << endmsg; - } else { - addAlignableTransform (level, id, transform, childFPV); - } - } - } - - void PixelDetectorManager::addAlignableTransform (int level, - const Identifier & id, - GeoAlignableTransform *transform, - const GeoVFullPhysVol * child) - { - if (m_idHelper) { - if (level == 0) { - IdentifierHash idHash = m_idHelper->wafer_hash(id); - if (idHash.is_valid()) { - m_alignableTransforms[idHash]= new ExtendedAlignableTransform(transform, child); - } - } else { - // Higher levels are saved in a map. NB the index is level-1 as level=0 is treated above. - int index = level - FIRST_HIGHER_LEVEL; - if (index >= static_cast<int>(m_higherAlignableTransforms.size())) m_higherAlignableTransforms.resize(index+1); - m_higherAlignableTransforms[index][id] = new ExtendedAlignableTransform(transform, child); - } - } - } - - bool PixelDetectorManager::identifierBelongs(const Identifier & id) const - { - return getIdHelper()->is_pixel(id); - } - - - - const PixelModuleDesign* PixelDetectorManager::getPixelDesign(int i) const - { - return dynamic_cast<const PixelModuleDesign *>(getDesign(i)); - } - - - - // The implementation of the new IBLDist DB; - // Specific for IBL -> maybe make it different function in future to be more general - bool PixelDetectorManager::processSpecialAlignment(const std::string & key, InDetDD::AlignFolderType alignfolderType) const - { - - bool alignmentChange = false; - - std::string alignfolder; - if (alignfolderType == InDetDD::static_run1) alignfolder = "/Indet/Align"; - if (alignfolderType == InDetDD::timedependent_run2) alignfolder = "/Indet/AlignL3"; - - if(msgLvl(MSG::INFO)) - msg(MSG::INFO) << "Processing IBLDist alignment container with key (" << - key << ") and alignment folder pointing to " << alignfolder << endmsg; - - int nstaves = 0; - if (numerology().numPhiModulesForLayer(0)<14) nstaves = 14; - else nstaves = numerology().numPhiModulesForLayer(0); - - std::vector<float> ibldist; - std::vector<float> iblbaseline; - ibldist.resize(nstaves); - iblbaseline.resize(nstaves); - - const CondAttrListCollection* atrlistcol=0; - if (StatusCode::SUCCESS==m_detStore->retrieve(atrlistcol,key)) { - // loop over objects in collection - for (CondAttrListCollection::const_iterator citr=atrlistcol->begin(); citr!=atrlistcol->end();++citr) { - - const coral::AttributeList& atrlist=citr->second; - ibldist[atrlist["stave"].data<int>()] = atrlist["mag"].data<float>(); - iblbaseline[atrlist["stave"].data<int>()] = atrlist["base"].data<float>(); - - msg(MSG::VERBOSE) << "IBLDist DB -- channel: " << citr->first - << " ,stave: " << atrlist["stave"].data<int>() - << " ,mag: " << atrlist["mag"].data<float>() - << " ,base: " << atrlist["base"].data<float>() << endmsg; - } - } - else { - if (msgLvl(MSG::INFO)) - msg(MSG::INFO) << "Cannot find IBLDist Container for key " - << key << " - no IBL bowing alignment " << endmsg; - return alignmentChange; - } - - /** - Matthias D. (Oct. 2016): - The idea of this first implementation is to get the AlignTransforms for IBL modules from their folder; - Calculate from the new DB entries the Tx displacement for this module; - Make a simple transfrom in local frame; - Add the Tx to the aligntransform; - Apply this new transform with the setAlignableTransformDelta() function; - This is non-optimal as it simply overrides the previous Delta (these are included in total Delta); - Possibly we could extend this in future to add tweak() functionality to GeoAlignableTransform? - **/ - - const AlignableTransformContainer* container; - if (StatusCode::SUCCESS!=m_detStore->retrieve(container, alignfolder)) { - msg(MSG::ERROR) << "Cannot find AlignableTransformContainer for key " - << key << " - no misalignment" << endmsg; - // This should not occur in normal situations so we force job to abort. - throw std::runtime_error("Unable to apply Inner Detector alignments"); - } - // Check if container is empty - this can occur if it is an invalid IOV. - if (container->empty()) { - msg(MSG::ERROR) << "AlignableTransformContainer for key " - << key << " is empty. Probably due to out of range IOV" << endmsg; - // This should not occur in normal situations so we force job to abort. - throw std::runtime_error("Unable to apply Inner Detector alignments."); - } - // loop over all the AlignableTransform objects in the collection - std::string IBLalignfolder = alignfolder; - IBLalignfolder.append("/PIXB1");// "/Indet/Align/PIXB1" - for (DataVector<AlignableTransform>::const_iterator pat=container->begin(); - pat!=container->end();++pat) { - if (!( (*pat)->tag()==IBLalignfolder && - numerology().numPhiModulesForLayer(0)==14 && - numerology().numLayers()==4) ){ // hard-coded to IBL for now; no other geometry should really apply this! - msg(MSG::DEBUG) << "IBLDist; ignoring collections " << (*pat)->tag() << endmsg; - } - else{ - const AlignableTransform* transformCollection = *pat; - for (AlignableTransform::AlignTransMem_citr trans_iter = transformCollection->begin(); - trans_iter != transformCollection->end(); - ++trans_iter) { - if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "IBLDist alignment for identifier " - << getIdHelper()->show_to_string(trans_iter->identify()) << endmsg; - } - - IdentifierHash idHash = getIdHelper()->wafer_hash(trans_iter->identify()); - if (!idHash.is_valid()){ - msg(MSG::WARNING) << "Invalid HashID for identifier " - << getIdHelper()->show_to_string(trans_iter->identify()) << endmsg; - msg(MSG::WARNING) << "No IBLDist corrections can be applied for invalid HashID's - exiting " << endmsg; - return false; - } - SiDetectorElement * sielem = m_elementCollection[idHash]; - //This should work as Bowing is in L3 frame, i.e. local module frame - Amg::Vector3D center = sielem->defTransform() * Amg::Vector3D{0, 0, 0}; - double z = center[2]; - const double y0y0 = 366.5*366.5; - - double bowx = ibldist[getIdHelper()->phi_module(trans_iter->identify())] * ( z*z - y0y0 ) / y0y0; - double basex= iblbaseline[getIdHelper()->phi_module(trans_iter->identify())]; - // This is in the module frame, as bowing corrections are directly L3 - - msg(MSG::DEBUG) << "Total IBL-module Tx shift (baseline+bowing): " << basex+bowx << endmsg; - if ( (basex+bowx)==0 ) continue; // make sure we ignore NULL corrections - - Amg::Transform3D shift = Amg::Translation3D(basex+bowx,0,0) * Amg::RotationMatrix3D::Identity(); - - const AlignableTransform* cpat = *pat; - AlignableTransform::AlignTransMem_citr this_trans=cpat->findIdent(trans_iter->identify()); - HepGeom::Transform3D newtrans = Amg::EigenTransformToCLHEP(shift)*this_trans->transform(); - - /** Verbose level debug section for transforms **/ - if (msgLvl(MSG::VERBOSE)) { - msg(MSG::VERBOSE) << "Bowing Transformation only:" << endmsg; - printTransform(shift); - msg(MSG::VERBOSE) << "Original alignable Transformation from StoreGate:" << endmsg; - printTransform(Amg::CLHEPTransformToEigen(this_trans->transform())); - msg(MSG::VERBOSE) << "Final mModified Transformation:" << endmsg; - printTransform(Amg::CLHEPTransformToEigen(newtrans)); - } - /** End of verbose level debug section **/ - - // Set the new transform; Will replace existing one with updated transform - bool status = setAlignableTransformDelta(0, - trans_iter->identify(), - Amg::CLHEPTransformToEigen(newtrans), - InDetDD::local, - nullptr); - - if (!status) { - if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "Cannot set AlignableTransform for identifier." - << getIdHelper()->show_to_string(trans_iter->identify()) - << " at level 0 for IBLDist bowing deformation " << endmsg; - } - } - - alignmentChange = (alignmentChange || status); - } - } - } - - return alignmentChange; - } - - bool PixelDetectorManager::processSpecialAlignment(const std::string& key, - const CondAttrListCollection* obj, - GeoVAlignmentStore* alignStore) const { - bool alignmentChange = false; - - ATH_MSG_INFO("Processing IBLDist alignment container with key " << key); - if(numerology().numLayers() != 4) { - // this doesn't appear to be Run 2, i.e. the IBL isn't there. Bailing - return alignmentChange; - } - - int nstaves = 0; - if (numerology().numPhiModulesForLayer(0) < 14) - nstaves = 14; - else - nstaves = numerology().numPhiModulesForLayer(0); - - std::vector<float> ibldist; - std::vector<float> iblbaseline; - ibldist.resize(nstaves); - iblbaseline.resize(nstaves); - - // loop over objects in collection - for (CondAttrListCollection::const_iterator citr = obj->begin(); - citr != obj->end(); ++citr) { - - const coral::AttributeList &atrlist = citr->second; - ibldist[atrlist["stave"].data<int>()] = atrlist["mag"].data<float>(); - iblbaseline[atrlist["stave"].data<int>()] = atrlist["base"].data<float>(); - - ATH_MSG_VERBOSE("IBLDist DB -- channel: " << citr->first - << ", stave: " << atrlist["stave"].data<int>() - << ", mag: " << atrlist["mag"].data<float>() - << ", base: " << atrlist["base"].data<float>()); - } - - /** - * Paul Gessinger (Jun 2019): For MT, we won't retrieve the underlying actual - * alignable transform container, since that's hard to come by. - * We loop over all detector elements, check if they match the - * detector elements we have IBL dist info for, retrieve the actual transform - * from the provided GeoAlignmentStore, and re-set it to the corrected - * value including IBL bowing. - * - * The calculation of the bowing is taken from the non-MT implementation above. - */ - - - for(const auto* detElem : *getDetectorElementCollection()) { - if(!detElem->isInnermostPixelLayer()) { - // skip non-IBL elements. This only works if the innermost pixel layer is in fact - // the IBL. That should be the case for Run2 until replacement of the ID. - continue; - } - std::string repr = getIdHelper()->show_to_string(detElem->identify()); - ATH_MSG_DEBUG("IBLDist alignment for identifier " << repr); - - - IdentifierHash idHash = getIdHelper()->wafer_hash(detElem->identify()); - if (!idHash.is_valid()) { - ATH_MSG_WARNING("Invalid HashID for identifier " << repr); - ATH_MSG_WARNING("No IBLDist corrections can be applied for " - "invalid HashID's - exiting "); - return false; - } - - // extract the stave number - int stave = getIdHelper()->phi_module(detElem->identify()); - - Amg::Vector3D center = detElem->defTransform() * Amg::Vector3D{0, 0, 0}; - double z = center[2]; - const double y0y0 = 366.5 * 366.5; - - double bowx = ibldist[stave] * (z * z - y0y0) / y0y0; - double basex = iblbaseline[stave]; - // This is in the module frame, as bowing corrections are directly L3 - - ATH_MSG_DEBUG("Total IBL-module Tx shift (baseline+bowing): " << basex + bowx); - - if ((basex + bowx) == 0) { - continue; // make sure we ignore NULL corrections - } - - Amg::Transform3D shift = Amg::Translation3D(basex + bowx, 0, 0) * - Amg::RotationMatrix3D::Identity(); - - // now we need to get the original alignment delta to apply this additional - // shift to - ExtendedAlignableTransform* eat = m_alignableTransforms[idHash]; - const GeoTrf::Transform3D* currentDelta = alignStore->getDelta(eat->alignableTransform()); - if (currentDelta == nullptr) { - ATH_MSG_ERROR("Have IBL Dist for element which does not have an alignment delta." - << " This indicates inconsistent alignment data"); - return false; - } - - HepGeom::Transform3D recoToHitTransform = detElem->recoToHitTransform(); - Amg::Transform3D r2h = Amg::CLHEPTransformToEigen(recoToHitTransform); - - ATH_MSG_VERBOSE("Previous delta for " << repr << ":\n" << currentDelta->matrix()); - ATH_MSG_VERBOSE("Bowing-only delta for " << repr << ":\n" << shift.matrix()); - Amg::Transform3D newDelta = shift * r2h.inverse() * (*currentDelta) * r2h; - - // We can probably just write it back to the geo alignment store. - // The IBL bowing is always at the module level, and that's the delta that - // we retrieved from the geo alignment store. - - bool status = setAlignableTransformDelta(0, - detElem->identify(), - newDelta, - InDetDD::local, - alignStore); - - - ATH_MSG_VERBOSE("New delta for " << repr << ":\n" - << alignStore->getDelta(eat->alignableTransform())->matrix()); - - alignmentChange |= status; - } - - return alignmentChange; - } - - // New global alignment folders - bool PixelDetectorManager::processGlobalAlignment(const std::string & key, int level, FrameType frame, const CondAttrListCollection* /*obj*/, GeoVAlignmentStore* alignStore) const - { - - bool alignmentChange = false; - - if(msgLvl(MSG::INFO)) - msg(MSG::INFO) << "Processing new global alignment containers with key " << key << " in the " << frame << " frame at level " << level << endmsg; - - Identifier ident=Identifier(); - const CondAttrListCollection* atrlistcol=0; - if (StatusCode::SUCCESS==m_detStore->retrieve(atrlistcol,key)) { - // loop over objects in collection - for (CondAttrListCollection::const_iterator citr=atrlistcol->begin(); citr!=atrlistcol->end();++citr) { - const coral::AttributeList& atrlist=citr->second; - // We are in the Pixel manager, therefore ignore all that is not Pixel Identifier - if (atrlist["det"].data<int>()!=1) continue; - - ident = getIdHelper()->wafer_id(atrlist["bec"].data<int>(), - atrlist["layer"].data<int>(), - atrlist["ring"].data<int>(), - atrlist["sector"].data<int>()); - - // Make sure we have valid HashID (This ONLY works here as the 0-modules exist) - // Precaution which does not work for e.g. SCT - if (!(getIdHelper()->wafer_hash(ident)).is_valid()){ - msg(MSG::WARNING) << "Invalid HashID for identifier " - << getIdHelper()->show_to_string(ident) << endmsg; - msg(MSG::WARNING) << "No global alignment corrections can be applied for invalid HashID's - exiting " << endmsg; - return false; - } - - // construct new transform - // Order of rotations is defined as around z, then y, then x. - Amg::Translation3D newtranslation(atrlist["Tx"].data<float>(),atrlist["Ty"].data<float>(),atrlist["Tz"].data<float>()); - Amg::Transform3D newtrans = newtranslation * Amg::RotationMatrix3D::Identity(); - newtrans *= Amg::AngleAxis3D(atrlist["Rz"].data<float>()*CLHEP::mrad, Amg::Vector3D(0.,0.,1.)); - newtrans *= Amg::AngleAxis3D(atrlist["Ry"].data<float>()*CLHEP::mrad, Amg::Vector3D(0.,1.,0.)); - newtrans *= Amg::AngleAxis3D(atrlist["Rx"].data<float>()*CLHEP::mrad, Amg::Vector3D(1.,0.,0.)); - - msg(MSG::DEBUG) << "New global DB -- channel: " << citr->first - << " ,det: " << atrlist["det"].data<int>() - << " ,bec: " << atrlist["bec"].data<int>() - << " ,layer: " << atrlist["layer"].data<int>() - << " ,ring: " << atrlist["ring"].data<int>() - << " ,sector: " << atrlist["sector"].data<int>() - << " ,Tx: " << atrlist["Tx"].data<float>() - << " ,Ty: " << atrlist["Ty"].data<float>() - << " ,Tz: " << atrlist["Tz"].data<float>() - << " ,Rx: " << atrlist["Rx"].data<float>() - << " ,Ry: " << atrlist["Ry"].data<float>() - << " ,Rz: " << atrlist["Rz"].data<float>() << endmsg; - - // Set the new transform; Will replace existing one with updated transform - bool status = setAlignableTransformDelta(level, - ident, - newtrans, - frame, - alignStore); - - if (!status) { - if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "Cannot set AlignableTransform for identifier." - << getIdHelper()->show_to_string(ident) - << " at level " << level << " for new global DB " << endmsg; - } - } - - alignmentChange = (alignmentChange || status); - } - } - else { - if (msgLvl(MSG::INFO)) - msg(MSG::INFO) << "Cannot find new global align Container for key " - << key << " - no new global alignment " << endmsg; - return alignmentChange; - } - return alignmentChange; - } - - - // Helpful function for debugging of transforms - void PixelDetectorManager::printTransform(const Amg::Transform3D & tr) const - { - msg(MSG::DEBUG) <<" - translation: "<<tr.translation().x()<<" "<<tr.translation().y()<<" "<<tr.translation().z() << endmsg; - msg(MSG::DEBUG) <<" - rotation:"<< endmsg; - msg(MSG::DEBUG) <<" "<<tr(0,0)<<" "<<tr(0,1)<<" "<<tr(0,2)<< endmsg; - msg(MSG::DEBUG) <<" "<<tr(1,0)<<" "<<tr(1,1)<<" "<<tr(1,2)<< endmsg; - msg(MSG::DEBUG) <<" "<<tr(2,0)<<" "<<tr(2,1)<<" "<<tr(2,2)<< endmsg; - return; - } - - -} // namespace InDetDD - - diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelDiodeMap.cxx b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelDiodeMap.cxx deleted file mode 100755 index 36abc6626cf4292ec38e4aca4670afaabb0f5aff..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelDiodeMap.cxx +++ /dev/null @@ -1,297 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelDiodeMap.cxx -// Implementation file for class PixelDiodeMap -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Pixel Detector software -/////////////////////////////////////////////////////////////////// -// Version 4.2 14/08/2001 David Calvet -// Modified: Grant Gorfine -/////////////////////////////////////////////////////////////////// - -#include "InDetReadoutGeometry/PixelDiodeMap.h" -#include "InDetReadoutGeometry/PixelDiodeMatrix.h" -#include "InDetReadoutGeometry/SiCellId.h" - -#include <cmath> -#include <algorithm> - -namespace InDetDD { - - - -// Implicit constructor: -PixelDiodeMap::PixelDiodeMap(std::shared_ptr<const PixelDiodeMatrix> matrix) : - m_matrix(matrix), - m_generalLayout(false) -{ -} - -PixelDiodeMap::~PixelDiodeMap() -{ -} - - - SiCellId PixelDiodeMap::cellIdOfPosition(const Amg::Vector2D & localPos) const -{ - using std::abs; - using Trk::distPhi; - using Trk::distEta; - - // Check that we are in the bounds of the top level matrix - // NB. edge is included in bounds. - - double halfWidth = 0.5*width(); - double halfLength = 0.5*length(); - if ( (abs(localPos[distPhi]) > halfWidth) || - (abs(localPos[distEta]) > halfLength) ) { - return SiCellId(); // Invalid Id. - } - - // position relative to bottom left corner. - Amg::Vector2D relativePos = localPos + Amg::Vector2D(halfWidth, halfLength); - - // The cellId returned will be added to this so we must start with 0,0. - SiCellId cellId(0,0); - - std::shared_ptr<const PixelDiodeMatrix> cell = m_matrix->cellIdOfPosition(relativePos, cellId); - - // return invalid Id if there was a problem (don't expect this to be the case). - if (cell==nullptr) { - return SiCellId(); // Invalid id. - } - - return cellId; - -} - - -// Get diodes parameters (position and size): -SiDiodesParameters -PixelDiodeMap::parameters(const SiCellId & cellId) const -{ - - // Check we are in range - - if (!cellId.isValid() || - (cellId.phiIndex() < 0) || - (cellId.phiIndex() >= m_matrix->phiCells()) || - (cellId.etaIndex() < 0) || - (cellId.etaIndex() >= m_matrix->etaCells())) { - return SiDiodesParameters(); - } - - double halfWidth = 0.5*width(); - double halfLength = 0.5*length(); - - // - // Position is relative to left bottom corner. - // - Amg::Vector2D position(-halfWidth, -halfLength); - std::shared_ptr<const PixelDiodeMatrix> cell = m_matrix->positionOfCell(cellId, position); - - if (cell) { - - // get size - Amg::Vector2D size(cell->phiWidth(), cell->etaWidth()); - - // return parameters - return SiDiodesParameters(position,size); - } - - // return something in case of failure. - return SiDiodesParameters(); -} - -void PixelDiodeMap::neighboursOfCell(const SiCellId & cellId, - std::vector<SiCellId> &neighbours) const -{ - neighbours.clear(); - - if (!cellId.isValid()) return; - - // If non regular layout revert to slower method - if (m_generalLayout) return neighboursOfCellGeneral(cellId, neighbours); - - neighbours.reserve(8); - // neighbours easily determined from cell number - // normally 8 neighbours 4 edge and 4 corners - - int phiIndex = cellId.phiIndex(); - int etaIndex = cellId.etaIndex(); - - // M = minus - // P = plus - int phiM = phiIndex-1; - int phiP = phiIndex+1; - int etaM = etaIndex-1; - int etaP = etaIndex+1; - - // -,0 - if (phiM >= 0) neighbours.push_back(SiCellId(phiM,etaIndex)); - // -,- - if (phiM >= 0 && etaM >= 0) neighbours.push_back(SiCellId(phiM,etaM)); - // 0,- - if (etaM >= 0) neighbours.push_back(SiCellId(phiIndex,etaM)); - // +,- - if (phiP < phiDiodes() && etaM >= 0) neighbours.push_back(SiCellId(phiP,etaM)); - // +,0 - if (phiP < phiDiodes()) neighbours.push_back(SiCellId(phiP,etaIndex)); - // -,+ - if (phiM >= 0 && etaP < etaDiodes()) neighbours.push_back(SiCellId(phiM,etaP)); - // 0,+ - if (etaP < etaDiodes()) neighbours.push_back(SiCellId(phiIndex,etaP)); - // +,+ - if (phiP < phiDiodes() && etaP < etaDiodes()) neighbours.push_back(SiCellId(phiP,etaP)); -} - -// Get the neighbouring PixelDiodes of a given PixelDiode: -// This will work for more complex layouts such as bricking. Probably never really needed but -// since the code was here I keep it available. -void PixelDiodeMap::neighboursOfCellGeneral(const SiCellId & cellId, - std::vector<SiCellId> &neighbours) const -{ - // extract the diode spatial parameters - const SiDiodesParameters params=parameters(cellId); - const SiLocalPosition diodeCenter=params.centre(); - const SiLocalPosition diodeSize=params.width(); - const double ¢erColumn=diodeCenter.xColumn(); - const double ¢erRow=diodeCenter.xRow(); - const double halfSizeColumn=diodeSize.xColumn()/2; - const double halfSizeRow=diodeSize.xRow()/2; - - // parameter - const double epsilon=0.01; - - // compute the points to check - const double left1=centerColumn-halfSizeColumn*(1+epsilon); - const double right1=centerColumn+halfSizeColumn*(1+epsilon); - const double left2=centerColumn-halfSizeColumn*(1-epsilon); - const double right2=centerColumn+halfSizeColumn*(1-epsilon); - const double top1=centerRow+halfSizeRow*(1+epsilon); - const double bot1=centerRow-halfSizeRow*(1+epsilon); - const double top2=centerRow+halfSizeRow*(1-epsilon); - const double bot2=centerRow-halfSizeRow*(1-epsilon); - - // build the list of positions to check - std::vector<SiLocalPosition> positions; - positions.reserve(12); - SiLocalPosition position; - position.xRow(bot1); position.xColumn(left2); positions.push_back(position); - position.xRow(bot1); position.xColumn(left1); positions.push_back(position); - position.xRow(bot2); position.xColumn(left1); positions.push_back(position); - position.xRow(top2); position.xColumn(left1); positions.push_back(position); - position.xRow(top1); position.xColumn(left1); positions.push_back(position); - position.xRow(top1); position.xColumn(left2); positions.push_back(position); - position.xRow(bot1); position.xColumn(right2); positions.push_back(position); - position.xRow(bot1); position.xColumn(right1); positions.push_back(position); - position.xRow(bot2); position.xColumn(right1); positions.push_back(position); - position.xRow(top2); position.xColumn(right1); positions.push_back(position); - position.xRow(top1); position.xColumn(right1); positions.push_back(position); - position.xRow(top1); position.xColumn(right2); positions.push_back(position); - - // build the list of neighbours - neighbours.reserve(8); - - // loop on all positions to check - for(std::vector<SiLocalPosition>::const_iterator p_position=positions.begin() ; - p_position!=positions.end() ; ++p_position) { - - // get the PixelDiode for this position - SiCellId cellId_neighb = cellIdOfPosition(*p_position); - - if (cellId.isValid()) { - // check if the diode is already in the list - //bool found=false; - std::vector<SiCellId>::const_iterator foundIter - = std::find(neighbours.begin(), neighbours.end(), cellId_neighb ); - - // If not found add this diode to the list - if (foundIter == neighbours.end()) neighbours.push_back(cellId_neighb); - - } - } -} - - -// Compute the intersection length of two diodes: -double PixelDiodeMap::intersectionLength(const SiCellId &diode1, - const SiCellId &diode2) const -{ - if(!diode1.isValid() || !diode2.isValid()) return 0; - // If non regular layout revert to slower method - if (m_generalLayout) return intersectionLengthGeneral(diode1, diode2); - - const SiLocalPosition size = parameters(diode1).width(); - - int phiIndexDelta = std::abs(diode1.phiIndex() - diode2.phiIndex()); - int etaIndexDelta = std::abs(diode1.etaIndex() - diode2.etaIndex()); - - // Intersection length is just the length or width of the diode depending on which neighbour. - if (phiIndexDelta == 1 && etaIndexDelta == 0) return size.xEta(); - if (phiIndexDelta == 0 && etaIndexDelta == 1) return size.xPhi(); - // Will return 0 if it is a corner neighbour or if its not a neighbour or if they are oth the same diode. - return 0; -} - -// Compute the intersection length of two diodes: -// This will work for more complex layouts such as bricking. Probably never really needed but -// since the code was here I keep it available. -double PixelDiodeMap::intersectionLengthGeneral(const SiCellId &diode1, - const SiCellId &diode2) const - -{ - const SiDiodesParameters params1=parameters(diode1); - const SiDiodesParameters params2=parameters(diode2); - const SiLocalPosition center1=params1.centre(); - const SiLocalPosition center2=params2.centre(); - const SiLocalPosition size1=params1.width(); - const SiLocalPosition size2=params2.width(); - - // compute intersection length on column direction - const double intersectionColumn=intersectionLength1D(center1.xColumn(), - size1.xColumn(), - center2.xColumn(), - size2.xColumn()); - // compute intersection length on row direction - const double intersectionRow=intersectionLength1D(center1.xRow(), - size1.xRow(), - center2.xRow(), - size2.xRow()); - - // return the real intersection - // (if both directions intersect, there is a problem) - if (intersectionColumn>0) { - if (intersectionRow>0) return 0; - return intersectionColumn; - } else { - return intersectionRow; - } -} - -// Compute the intersection length along one direction: -double PixelDiodeMap::intersectionLength1D(const double x1,const double dx1, - const double x2,const double dx2) const -{ - // compute distance between the two centers - double distance=std::abs(x1-x2); - - // compute theoretical intersection - double intersection=(dx1+dx2)/2-distance; - - // if intersection if negative, no intersection - if (intersection<-1e-10) return intersection; - else if (intersection<1e-10) return 0; - else { - // intersection cannot exceed size - if (intersection>dx1) intersection=dx1; - if (intersection>dx2) intersection=dx2; - return intersection; - } -} - -} // namespace InDetDD - diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelDiodeMatrix.cxx b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelDiodeMatrix.cxx deleted file mode 100755 index 9b663572257a59e7420e1b2d96a268bb2c0bf4be..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelDiodeMatrix.cxx +++ /dev/null @@ -1,338 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include "InDetReadoutGeometry/PixelDiodeMatrix.h" -#include "InDetReadoutGeometry/SiCellId.h" -#include "TrkEventPrimitives/ParamDefs.h" - -#include <cassert> - -namespace InDetDD { - -std::shared_ptr<const PixelDiodeMatrix> PixelDiodeMatrix::construct(double phiWidth, double etaWidth) -{ - class Helper : public PixelDiodeMatrix{}; - std::shared_ptr<PixelDiodeMatrix> ptr = std::make_shared<Helper>(); - ptr->initialize(phiWidth, etaWidth); - return ptr; -} - -void PixelDiodeMatrix::initialize(double phiWidth, double etaWidth) -{ - m_phiWidth = phiWidth; - m_etaWidth = etaWidth; - m_phiCells = 1; - m_etaCells = 1; - m_direction = phiDir; // Irrelevant - m_numCells = 0; - m_lowerCell = nullptr; - m_middleCells = nullptr; - m_upperCell = nullptr; - m_singleCell = true; -} - -std::shared_ptr<const PixelDiodeMatrix> PixelDiodeMatrix::construct(Direction direction, // phi or eta - std::shared_ptr<const PixelDiodeMatrix> lowerCell, - std::shared_ptr<const PixelDiodeMatrix> middleCells, - int numCells, - std::shared_ptr<const PixelDiodeMatrix> upperCell) -{ - class Helper : public PixelDiodeMatrix{}; - std::shared_ptr<PixelDiodeMatrix> ptr = std::make_shared<Helper>(); - ptr->initialize(direction, - lowerCell, - middleCells, - numCells, - upperCell); - return ptr; -} - -void PixelDiodeMatrix::initialize(Direction direction, // phi or eta - std::shared_ptr<const PixelDiodeMatrix> lowerCell, - std::shared_ptr<const PixelDiodeMatrix> middleCells, - int numCells, - std::shared_ptr<const PixelDiodeMatrix> upperCell) -{ - m_phiWidth = 0; - m_etaWidth = 0; - m_phiCells = 0; - m_etaCells = 0; - m_direction = direction; - m_numCells = numCells; - m_lowerCell = lowerCell; - m_middleCells = middleCells; - m_upperCell = upperCell; - m_singleCell = false; - - // middleCells must be non zero. - assert(m_middleCells); - - if (m_direction == phiDir) { - - // In eta direction widths must be all the same. - if (m_middleCells){ - m_etaWidth = m_middleCells->etaWidth(); - m_etaCells = m_middleCells->etaCells(); - } - // Check lower and upper are consistent - // TODO. - - if (m_lowerCell) { - m_phiWidth += m_lowerCell->phiWidth(); - m_phiCells += m_lowerCell->phiCells(); - } - - if (m_middleCells){ - m_phiWidth += m_numCells * m_middleCells->phiWidth(); - m_phiCells += m_numCells * m_middleCells->phiCells(); - } - - if (m_upperCell) { - m_phiWidth += m_upperCell->phiWidth(); - m_phiCells += m_upperCell->phiCells(); - } - - } else { // eta Direction - - // In phi direction widths must be all the same. - if (m_middleCells){ - m_phiWidth = m_middleCells->phiWidth(); - m_phiCells = m_middleCells->phiCells(); - } - // Check lower and upper are consistent - // TODO. - - if (m_lowerCell) { - m_etaWidth += m_lowerCell->etaWidth(); - m_etaCells += m_lowerCell->etaCells(); - } - - if (m_middleCells){ - m_etaWidth += m_numCells * m_middleCells->etaWidth(); - m_etaCells += m_numCells * m_middleCells->etaCells(); - } - - if (m_upperCell) { - m_etaWidth += m_upperCell->etaWidth(); - m_etaCells += m_upperCell->etaCells(); - } - - } - -} - -std::shared_ptr<const PixelDiodeMatrix> -PixelDiodeMatrix::cellIdOfPosition(const Amg::Vector2D & relPosition, SiCellId & cellId) const - - /// Description. - /// Overview of algoritm: - /// - /// - Before calling this method on the top level matrix the 2D position is - /// calculated relative to the bottom left corner. - /// - The method cellIdOfPosition is always called with the position relative to - /// bottom left of the cell and the cell id of bottom left child cell. - /// For the top level matrix this is the position (-halfWidth, -halfLength) and a starting - /// cell id of (0,0). - /// - It first checks if it is in the lower cell (if it exists). - /// - If not, it determines which cell by dividing the position relative to - /// the start of the cell array by the pitch in that direction. - /// - If it is beyond the range of the middle cells it is taken as being in - /// the upper cell. - /// - The cell number is added to the cellId that is passed to the method - /// - Once the cell is determined the function is called recursively until it - /// reaches a single cell. - /// - -{ - using Trk::distPhi; - using Trk::distEta; - - if (m_singleCell) { - return shared_from_this(); - } - - double relPosDir = 0; // Relative position along m_direction - int startIndex = 0; - double pitch = 0; - int middleCells = 0; - - if (m_direction == phiDir) { - - relPosDir = relPosition[distPhi]; - pitch = m_middleCells->phiWidth(); - middleCells = m_middleCells->phiCells(); - - if (m_lowerCell) { - if (relPosDir < m_lowerCell->phiWidth()) { - return m_lowerCell->cellIdOfPosition(relPosition, cellId); - } else { - relPosDir -= m_lowerCell->phiWidth(); - startIndex += m_lowerCell->phiCells(); - } - } - } else { // etaDir - - relPosDir = relPosition[distEta]; - pitch = m_middleCells->etaWidth(); - middleCells = m_middleCells->etaCells(); - - if (m_lowerCell) { - if (relPosDir < m_lowerCell->etaWidth()) { - return m_lowerCell->cellIdOfPosition(relPosition, cellId); - } else { - relPosDir -= m_lowerCell->etaWidth(); - startIndex += m_lowerCell->etaCells(); - } - } - } - - - int index = static_cast<int>((relPosDir) / pitch); - - if (index < 0) index = 0; // Make sure its in range (in case of rounding errors) - std::shared_ptr<const PixelDiodeMatrix> nextCell = nullptr; - - if (m_upperCell && (index >= m_numCells)) { - // We are in the upper cell. - index = m_numCells; - nextCell = m_upperCell; - } else { - // We are in the middle cells - // Make sure its in range (in case of rounding errors) - if (index >= m_numCells) index = m_numCells - 1; - nextCell = m_middleCells; - } - - - relPosDir -= index * pitch; - startIndex += index * middleCells; - - int newPhiIndex = cellId.phiIndex(); - int newEtaIndex = cellId.etaIndex(); - std::shared_ptr<const PixelDiodeMatrix> cell = nullptr; - - if (m_direction == phiDir) { - if (nextCell->singleCell()) { - newPhiIndex += startIndex; - cell = nextCell; - } else { - Amg::Vector2D newRelPos(relPosDir, relPosition[distEta]); - SiCellId relId(0,0); - cell = nextCell->cellIdOfPosition(newRelPos, relId); - newPhiIndex += startIndex + relId.phiIndex(); - newEtaIndex += relId.etaIndex(); - } - } else { - if (nextCell->singleCell()) { - newEtaIndex += startIndex; - cell = nextCell; - } else { - Amg::Vector2D newRelPos(relPosition[distPhi], relPosDir); - SiCellId relId(0,0); - cell = nextCell->cellIdOfPosition(newRelPos, relId); - newPhiIndex += relId.phiIndex(); - newEtaIndex += startIndex + relId.etaIndex(); - } - } - - cellId = SiCellId(newPhiIndex, newEtaIndex); - return cell; -} - - - -std::shared_ptr<const PixelDiodeMatrix> -PixelDiodeMatrix::positionOfCell(const SiCellId & cellId, Amg::Vector2D & position) const - - /// Description. - /// Overview of algoritm: - /// - /// - It starts with the position of the bottom left corner of the cell. - /// For the full matrix this is (-halfwidth,-halflength) - /// - It first checks if is in the lower cell (if it exists). - /// - If not it determines the bottom edge of the cell by multiplying the cell - /// number by the pitch. - /// - If it is beyond the range of the middle cells it is taken as being in - /// the upper cell. - /// - This position is then passed recursively to the same method until it - /// reaches a single cell. - /// - At the end the 2D position is then transformed to the position - /// relative to the module center. - -{ - using Trk::distPhi; - using Trk::distEta; - - if (m_singleCell) { - position[distPhi] += 0.5*m_phiWidth; - position[distEta] += 0.5*m_etaWidth; - return shared_from_this(); - } - - int relIndex = 0; // Relative index along m_direction - double pitch = 0; - int middleCells = 0; - double startPos = 0; - - if (m_direction == phiDir) { - - relIndex = cellId.phiIndex(); - pitch = m_middleCells->phiWidth(); - middleCells = m_middleCells->phiCells(); - - if (m_lowerCell) { - if (relIndex < m_lowerCell->phiCells()) { - return m_lowerCell->positionOfCell(cellId, position); - } else { - relIndex -= m_lowerCell->phiCells(); - startPos += m_lowerCell->phiWidth(); - } - } - - } else { // etaDir - - relIndex = cellId.etaIndex(); - pitch = m_middleCells->etaWidth(); - middleCells = m_middleCells->etaCells(); - - if (m_lowerCell) { - if (relIndex < m_lowerCell->etaCells()) { - return m_lowerCell->positionOfCell(cellId, position); - } else { - relIndex -= m_lowerCell->etaCells(); - startPos += m_lowerCell->etaWidth(); - } - } - } - - int index = relIndex / middleCells; - if (index > m_numCells) index = m_numCells; - relIndex -= index * middleCells; - startPos += index * pitch; - - std::shared_ptr<const PixelDiodeMatrix> nextCell = nullptr; - - if (m_upperCell && (index == m_numCells)) { - // We are in the upper cell. - nextCell = m_upperCell; - } else { - // We are in the middle cells - nextCell = m_middleCells; - } - - std::shared_ptr<const PixelDiodeMatrix> cell = nullptr; - if (m_direction == phiDir) { - SiCellId relId(relIndex,cellId.etaIndex()); - position[distPhi] += startPos; - cell = nextCell->positionOfCell(relId, position); - } else { - SiCellId relId(cellId.phiIndex(),relIndex); - position[distEta] += startPos; - cell = nextCell->positionOfCell(relId, position); - } - - return cell; -} - -} // end namespace diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelModuleDesign.cxx b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelModuleDesign.cxx deleted file mode 100755 index 3ff60a34d60939a5057d750fa4d2d473309bf2ab..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelModuleDesign.cxx +++ /dev/null @@ -1,245 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelModuleDesign.cxx -// Implementation file for class PixelModuleDesign -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Pixel Detector software -/////////////////////////////////////////////////////////////////// -// Version 1.9 18/03/2002 Alessandro Fornaini -// Modified: Grant Gorfine -/////////////////////////////////////////////////////////////////// - -#include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "Identifier/Identifier.h" -#include "InDetReadoutGeometry/SiCellId.h" -#include "InDetReadoutGeometry/SiReadoutCellId.h" -#include "TrkSurfaces/RectangleBounds.h" - -#include <cmath> - -namespace InDetDD { - -using std::abs; - -// Constructor with parameters: - -PixelModuleDesign::PixelModuleDesign(const double thickness, - const int circuitsPerColumn, - const int circuitsPerRow, - const int cellColumnsPerCircuit, - const int cellRowsPerCircuit, - const int diodeColumnsPerCircuit, - const int diodeRowsPerCircuit, - std::shared_ptr<const PixelDiodeMatrix> matrix, - InDetDD::CarrierType carrierType, - int readoutSide, - bool is3D) : - - SiDetectorDesign(thickness, - true, true, true, // phi,eta,depth axes symmetric - carrierType, - readoutSide), - m_diodeMap(matrix), - m_readoutScheme(circuitsPerColumn,circuitsPerRow, - cellColumnsPerCircuit,cellRowsPerCircuit, - diodeColumnsPerCircuit,diodeRowsPerCircuit), - m_bounds(), - m_is3D(is3D) -{ -} - -// Returns distance to nearest detector edge -// +ve = inside -// -ve = outside -void -PixelModuleDesign::distanceToDetectorEdge(const SiLocalPosition & localPosition, - double & etaDist, double & phiDist) const -{ - // This assume element is centered at 0,0 - // As the calculation is symmetric around 0,0 we only have to test it for one side. - double xEta = abs(localPosition.xEta()); - double xPhi = abs(localPosition.xPhi()); - - double xEtaEdge = 0.5*length(); - double xPhiEdge = 0.5*width(); - - // Distance to top/bottom - etaDist = xEtaEdge - xEta; - - // Distance to right/left edge - phiDist = xPhiEdge - xPhi; - -} - -SiDiodesParameters PixelModuleDesign::parameters(const SiCellId & cellId) const -{ - return m_diodeMap.parameters(cellId); -} - -SiLocalPosition PixelModuleDesign::localPositionOfCell(const SiCellId & cellId) const -{ - return m_diodeMap.parameters(cellId).centre(); -} - - -// Helper method for stereo angle computation -HepGeom::Vector3D<double> PixelModuleDesign::phiMeasureSegment(const SiLocalPosition&) const -{ - HepGeom::Vector3D<double> segment; - segment[etaAxis()]=1; - return segment; -} - -// Special method for SCT (irrelevant here): -std::pair<SiLocalPosition,SiLocalPosition> PixelModuleDesign::endsOfStrip(const SiLocalPosition &position) const -{ - return std::pair<SiLocalPosition,SiLocalPosition>(position,position); -} - - -// Methods to calculate length of a module -double PixelModuleDesign::length() const -{ - return m_diodeMap.length(); -} - -// Methods to calculate average width of a module -double PixelModuleDesign::width() const -{ - return m_diodeMap.width(); -} - -// Methods to calculate minimum width of a module -double PixelModuleDesign::minWidth() const -{ - return width(); -} - -// Methods to calculate maximum width of a module -double PixelModuleDesign::maxWidth() const -{ - return width(); -} - - -// Method to calculate eta width from a column range -double PixelModuleDesign::widthFromColumnRange(const int colMin, const int colMax) const -{ - SiCellId idMin(0, colMin); - SiCellId idMax(0, colMax); - - double minEta = parameters(idMin).xEtaMin(); - double maxEta = parameters(idMax).xEtaMax(); - - return fabs(maxEta-minEta); -} - -// Method to calculate phi width from a row range -double PixelModuleDesign::widthFromRowRange(const int rowMin, const int rowMax) const -{ - - SiCellId idMin(rowMin, 0); - SiCellId idMax(rowMax, 0); - double minPhi = parameters(idMin).xPhiMin(); - double maxPhi = parameters(idMax).xPhiMax(); - - return fabs(maxPhi-minPhi); -} - -// Pitch in phi direction -double -PixelModuleDesign::phiPitch() const -{ - // Average pitch. - return width() / rows(); -} - -// Pitch in phi direction -double -PixelModuleDesign::phiPitch(const SiLocalPosition &) const -{ - // Cheat since we know its constant. - return phiPitch(); -} - -// Pitch in eta direction -double -PixelModuleDesign::etaPitch() const -{ - // Average pitch - return length() / columns(); -} - -SiCellId PixelModuleDesign::cellIdOfPosition(const SiLocalPosition & localPosition) const -{ - return m_diodeMap.cellIdOfPosition(localPosition); -} - - -int PixelModuleDesign::numberOfConnectedCells(const SiReadoutCellId & readoutId) const -{ - return m_readoutScheme.numberOfConnectedCells(readoutId); -} - -SiCellId -PixelModuleDesign::connectedCell(const SiReadoutCellId & readoutId, int number) const -{ - return m_readoutScheme.connectedCell(readoutId, number); -} - -SiCellId -PixelModuleDesign::gangedCell(const SiCellId & cellId) const -{ - return m_readoutScheme.gangedCell(cellId); -} - -SiReadoutCellId -PixelModuleDesign::readoutIdOfCell(const SiCellId & cellId) const -{ - return m_readoutScheme.readoutIdOfCell(cellId); -} - - -SiReadoutCellId -PixelModuleDesign::readoutIdOfPosition(const SiLocalPosition & localPos) const -{ - return m_readoutScheme.readoutIdOfCell(m_diodeMap.cellIdOfPosition(localPos)); -} - -// Given row and column index of diode, returns position of diode center -// ALTERNATIVE/PREFERED way is to use localPositionOfCell(const SiCellId & cellId) or -// rawLocalPositionOfCell method in SiDetectorElement. -// DEPRECATED (but used in numerous places) -SiLocalPosition PixelModuleDesign::positionFromColumnRow(const int column, const int row) const -{ - return localPositionOfCell(SiCellId(row,column)); -} - - -const Trk::SurfaceBounds & -PixelModuleDesign::bounds() const -{ - // We create on demand as width and length are 0 when PixeModuleDesign first gets - // created. - if (not m_bounds) m_bounds.set(std::make_unique<Trk::RectangleBounds>(0.5*width(), 0.5*length())); - return *m_bounds; -} - - - -void PixelModuleDesign::setGeneralLayout() -{ - m_diodeMap.setGeneralLayout(); -} - -SiCellId -PixelModuleDesign::cellIdInRange(const SiCellId & cellId) const -{ - return m_diodeMap.cellIdInRange(cellId); -} - - -} // namespace InDetDD diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelMultipleConnection1D.cxx b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelMultipleConnection1D.cxx deleted file mode 100755 index d2f6d11c8158fc5019f44298828c640c14ebc7d5..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelMultipleConnection1D.cxx +++ /dev/null @@ -1,141 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelMultipleConnection1D.cxx -// Implementation file for class PixelMultipleConnection1D -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Pixel Detector software -/////////////////////////////////////////////////////////////////// -// Version 1.1 05/04/2001 David Calvet -// 06/02/2008 Grant Gorfine -/////////////////////////////////////////////////////////////////// - -#include "InDetReadoutGeometry/PixelMultipleConnection1D.h" -#include <iostream> - -namespace InDetDD { - -// Constructor with parameters: -PixelMultipleConnection1D::PixelMultipleConnection1D(const int lowerIndex, - const std::vector<int> &connections) - : m_lowerDiode(0), - m_upperDiode(-1), - m_lowerReadout(0), - m_upperReadout(-1) -{ - set(lowerIndex, connections); -} - -PixelMultipleConnection1D::PixelMultipleConnection1D() - : m_lowerDiode(0), - m_upperDiode(-1), - m_lowerReadout(0), - m_upperReadout(-1) -{} - -void -PixelMultipleConnection1D::set(const int lowerIndex, - const std::vector<int> &connections) -{ - - // extract lower and upper diode and readout cell numbers from connections vector - bool firstDiode = true; - bool firstReadout = true; - for(unsigned int index = 0; index < connections.size(); ++index) { - int readout = connections[index]; - int diode = lowerIndex + index; - if (firstDiode && readout != diode) { - m_lowerDiode = diode; - m_upperDiode = diode; - firstDiode = false; - } - if (firstReadout) { - m_lowerReadout=readout; - m_upperReadout=readout; - firstReadout = false; - } - if (readout<m_lowerReadout) m_lowerReadout=readout; - if (readout>m_upperReadout) m_upperReadout=readout; - if (readout != diode && diode < m_lowerDiode) m_lowerDiode = diode; - if (readout != diode && diode > m_upperDiode) m_upperDiode = diode; - } - - // Fource readout range to be include diode range (this is generally already the case) - if (m_lowerReadout > m_lowerDiode) m_lowerReadout = m_lowerDiode; - if (m_upperReadout < m_upperDiode) m_upperReadout = m_upperDiode; - - m_diodeToReadout.resize(m_upperDiode - m_lowerDiode + 1); - m_readoutToDiode.resize(m_upperReadout - m_lowerReadout + 1); - - // First fill primary cell. ie diode and readout the same. - for(unsigned int index = 0; index < connections.size(); ++index) { - int readout = connections[index]; - int diode = lowerIndex + index; - if (readout == diode) m_readoutToDiode[readout-m_lowerReadout].push_back(diode); - } - - - // Now the rest of readoutToDiode ie diode and readout not the same. - // Fill also diodeToReadout - for(unsigned int index = 0; index < connections.size(); ++index) { - int readout = connections[index]; - int diode = lowerIndex + index; - if (readout != diode) m_readoutToDiode[readout - m_lowerReadout].push_back(diode); - if (diode >= m_lowerDiode && diode <= m_upperDiode) m_diodeToReadout[diode - m_lowerDiode] = readout; - } - - // Created ganged map. If the diode is ganged it points to the other diode. - m_diodeGanged.resize(m_upperReadout - m_lowerReadout + 1); - for(int iDiode = m_lowerReadout; iDiode <= m_upperReadout; iDiode++) { - // Fill with the same index which indicates its not ganged. - m_diodeGanged[iDiode - m_lowerReadout] = iDiode; - int readout = iDiode; - if (!outsideDiode(iDiode)) readout = readoutOfDiode(iDiode); - if (numberOfConnectedCells(readout) >= 2) { - int cell0 = connectedCell(readout, 0); - int cell1 = connectedCell(readout, 1); - if (iDiode == cell0) { - m_diodeGanged[iDiode - m_lowerReadout] = cell1; - } else { - m_diodeGanged[iDiode - m_lowerReadout] = cell0; - } - } - } - - // For debugging only - //debugPrintout(); -} - -void PixelMultipleConnection1D::debugPrintout() -{ - // Debug printout - std::cout << "m_lowerDiode = " << m_lowerDiode << std::endl; - std::cout << "m_upperDiode = " << m_upperDiode << std::endl; - std::cout << "m_lowerReadout = " << m_lowerReadout << std::endl; - std::cout << "m_upperReadout = " << m_upperReadout << std::endl; - std::cout << "m_readoutToDiode: "; - for (unsigned int i = 0; i < m_readoutToDiode.size(); i++) { - std::cout << "(" << m_lowerReadout + i << ": "; - for (unsigned int j = 0; j < m_readoutToDiode[i].size(); j++) { - std::cout << m_readoutToDiode[i][j] << " "; - } - std::cout << ") "; - } - std::cout << std::endl; - - for (unsigned int i = 0; i < m_diodeToReadout.size(); i++) { - std::cout << "(" << m_lowerDiode + i << ": " << m_diodeToReadout[i] << ") "; - } - std::cout << std::endl; - - for (unsigned int i = 0; i < m_diodeGanged.size(); i++) { - std::cout << "(" << m_lowerReadout + i << ": " << m_diodeGanged[i] << ") "; - } - std::cout << std::endl; -} - - - -} // namespace InDetDD diff --git a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelReadoutScheme.cxx b/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelReadoutScheme.cxx deleted file mode 100755 index e0e80ff52f89927dfe7263b1590a45c40bba2ff8..0000000000000000000000000000000000000000 --- a/InnerDetector/InDetDetDescr/InDetReadoutGeometry/src/PixelReadoutScheme.cxx +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/////////////////////////////////////////////////////////////////// -// PixelReadoutScheme.cxx -// Implementation file for class PixelReadoutScheme -/////////////////////////////////////////////////////////////////// -// (c) ATLAS Pixel Detector software -/////////////////////////////////////////////////////////////////// -// Version 2.1 08/06/2001 David Calvet -// Modified: Grant Gorfine -/////////////////////////////////////////////////////////////////// - -#include "InDetReadoutGeometry/PixelReadoutScheme.h" -#include "InDetReadoutGeometry/SiCellId.h" -#include "InDetReadoutGeometry/SiReadoutCellId.h" - -namespace InDetDD { - -// Constructor with parameters: -PixelReadoutScheme::PixelReadoutScheme(const int circuitsPerColumn, - const int circuitsPerRow, - const int cellColumnsPerCircuit, - const int cellRowsPerCircuit, - const int diodeColumnsPerCircuit, - const int diodeRowsPerCircuit) : - m_numberOfCircuits(circuitsPerColumn*circuitsPerRow), - m_columnsPerCircuit(cellColumnsPerCircuit), - m_rowsPerCircuit(cellRowsPerCircuit), - m_columns(circuitsPerRow*diodeColumnsPerCircuit), - m_rows(circuitsPerColumn*diodeRowsPerCircuit) -{} - - - -// Number of cells connected to this readout. 2 means its ganged. -int -PixelReadoutScheme::numberOfConnectedCells(const SiReadoutCellId & readoutId) const -{ - if (!readoutId.isValid()) return 0; - - // Do quick check to see if it is outside ganged pixel range. - int phiIndex = readoutId.phiIndex(); - if (m_rowConnections.outsideReadout(phiIndex)) return 1; - - return m_rowConnections.numberOfConnectedCells(phiIndex); - -} - -// Id of diodes connected to this readout. 0 is the primary cell. -SiCellId -PixelReadoutScheme::connectedCell(const SiReadoutCellId & readoutId, unsigned int number) const -{ - if (!readoutId.isValid()) return SiCellId(); - - // Do quick check to see if it is outside ganged pixel range. - int phiIndex = readoutId.phiIndex(); - if (m_rowConnections.outsideReadout(phiIndex)) return readoutId; - - int numConnected = m_rowConnections.numberOfConnectedCells(phiIndex); - if (!numConnected || static_cast<int>(number) >= numConnected) return SiCellId(); - - int newPhiIndex = m_rowConnections.connectedCell(phiIndex, number); - return SiCellId(newPhiIndex, readoutId.etaIndex()); -} - -// Id of the readout cell for this diode. -SiReadoutCellId -PixelReadoutScheme::readoutIdOfCell(const SiCellId & cellId) const -{ - if (!cellId.isValid()) return SiReadoutCellId(); - - int phiIndex = cellId.phiIndex(); - int newPhiIndex = phiIndex; - if (!m_rowConnections.outsideDiode(phiIndex)) { - newPhiIndex = m_rowConnections.readoutOfDiode(phiIndex); - } - - return SiReadoutCellId(newPhiIndex, cellId.etaIndex()); - -} - -SiCellId -PixelReadoutScheme::gangedCell(const SiCellId & cellId) const -{ - if (!cellId.isValid()) return cellId; - int phiIndex = cellId.phiIndex(); - if (m_rowConnections.outsideReadout(phiIndex)) return SiCellId(); // Invalid ID - int newPhiIndex = m_rowConnections.gangedCell(phiIndex); - if (newPhiIndex == phiIndex) return SiCellId(); // Invalid ID - return SiCellId(newPhiIndex, cellId.etaIndex()); -} - - -void PixelReadoutScheme::addMultipleRowConnection(const int lowerIndex, - const std::vector<int> &connections) -{ - - m_rowConnections.set(lowerIndex, connections); -} - - -} // namespace InDetDD diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/CMakeLists.txt b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/CMakeLists.txt index e4b390a6e4742d2c66ee8172a6037b6b1f3940a0..1b561c027db13cfd996456356124ce99de900f7b 100644 --- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/CMakeLists.txt @@ -20,6 +20,7 @@ atlas_depends_on_subdirs( PUBLIC Control/StoreGate DetectorDescription/Identifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry Tracking/TrkDetDescr/TrkDetDescrGeoModelCnv Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkDetDescr/TrkVolumes ) @@ -35,7 +36,7 @@ atlas_add_component( InDetTrackingGeometry src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel InDetIdentifier TrkDetDescrInterfaces TrkDetDescrUtils TrkGeometry BeamPipeGeoModelLib StoreGateLib SGtests Identifier InDetReadoutGeometry TrkDetDescrGeoModelCnv TrkSurfaces TrkVolumes ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps GeoPrimitives GaudiKernel InDetIdentifier TrkDetDescrInterfaces TrkDetDescrUtils TrkGeometry BeamPipeGeoModelLib StoreGateLib SGtests Identifier InDetReadoutGeometry PixelReadoutGeometry TrkDetDescrGeoModelCnv TrkSurfaces TrkVolumes ) # Install files from the package: atlas_install_headers( InDetTrackingGeometry ) diff --git a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilder.cxx b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilder.cxx index cd902005d8617f072b5c7708d67c815177fd8637..0640fbd179101da48074ee46b1039aa66501903d 100755 --- a/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilder.cxx +++ b/InnerDetector/InDetDetDescr/InDetTrackingGeometry/src/SiLayerBuilder.cxx @@ -11,7 +11,7 @@ #include "InDetTrackingGeometry/SCT_OverlapDescriptor.h" #include "InDetTrackingGeometry/DiscOverlapDescriptor.h" //InDet include -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetReadoutGeometry/SiDetectorElementCollection.h" diff --git a/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt index 4139038bc62102a8046d710f618a57c3d972b537..efdd1badd177911159e64a526d0cd41c36a709bc 100644 --- a/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/PixelCabling/CMakeLists.txt @@ -16,6 +16,7 @@ atlas_depends_on_subdirs( Database/AthenaPOOL/AthenaPoolUtilities DetectorDescription/Identifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetConditions/PixelConditionsData Tools/PathResolver ) @@ -37,7 +38,7 @@ atlas_add_component( PixelCabling ${TDAQ-COMMON_INCLUDE_DIRS} LINK_LIBRARIES ${Boost_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} GaudiKernel AthenaBaseComps SGTools StoreGateLib - AthenaPoolUtilities Identifier InDetIdentifier InDetReadoutGeometry PixelConditionsData PathResolver PixelCablingLib ) + AthenaPoolUtilities Identifier InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry PixelConditionsData PathResolver PixelCablingLib ) atlas_add_test( PixelCablingConfigNew_test SCRIPT test/PixelCablingConfigNew_test.py diff --git a/InnerDetector/InDetDetDescr/PixelCabling/src/PixelCablingSvc.cxx b/InnerDetector/InDetDetDescr/PixelCabling/src/PixelCablingSvc.cxx index b30cbf1fa6991fa7f6605a95c7824effa9f1b501..ca140338787f75a194bfb802fa81ed10e915406b 100644 --- a/InnerDetector/InDetDetDescr/PixelCabling/src/PixelCablingSvc.cxx +++ b/InnerDetector/InDetDetDescr/PixelCabling/src/PixelCablingSvc.cxx @@ -9,8 +9,8 @@ #include "StoreGate/StoreGateSvc.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" //#define PIXEL_DEBUG diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/CMakeLists.txt b/InnerDetector/InDetDetDescr/PixelGeoModel/CMakeLists.txt index 297d88d2f87dbece4d030d69f96af108d09cc330..2b28e6a529e6a100909d6e0a0009d02eced8dabd 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/CMakeLists.txt +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/CMakeLists.txt @@ -18,6 +18,7 @@ atlas_depends_on_subdirs( GaudiKernel InnerDetector/InDetDetDescr/InDetGeoModelUtils InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDEscr/PixelReadoutGeometry PRIVATE Control/SGTools Control/StoreGate @@ -36,7 +37,7 @@ atlas_add_library( PixelGeoModelLib INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${EIGEN_LIBRARIES} ${GEOMODELCORE_LIBRARIES} AthenaBaseComps AthenaKernel GeoModelUtilities Identifier GaudiKernel InDetGeoModelUtils - InDetReadoutGeometry + InDetReadoutGeometry PixelReadoutGeometry PRIVATE_LINK_LIBRARIES SGTools StoreGateLib DetDescrConditions InDetIdentifier PRIVATE_DEFINITIONS "-DGEOTORUS=1" ) diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_Det.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_Det.cxx index a4cba5fd99db2a635cdbf03e01e6c664a4c4e37c..1e522728be356c668636bb826405935708f3e560 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_Det.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_Det.cxx @@ -12,7 +12,7 @@ #include "GeoModelKernel/GeoTrd.h" #include "GeoModelKernel/GeoTube.h" #include "GaudiKernel/SystemOfUnits.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include <iostream> diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_Module.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_Module.cxx index 08b0e16ef7bfacc2b0792554aa65c1d8edc7bffb..095ed9c37c9f2a47df6d477471257427f4b4f139 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_Module.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_Module.cxx @@ -13,11 +13,11 @@ #include "Identifier/Identifier.h" #include "InDetIdentifier/PixelID.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "InDetReadoutGeometry/PixelDiodeMatrix.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelDiodeMatrix.h" using namespace InDetDD; DBM_Module::DBM_Module() { diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_ModuleCage.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_ModuleCage.cxx index 1a9550c37dc3f62dbf03ebc26958b2ec78608df2..1e7d7e72dbf2f311aa8f8601446eb9094169fdbc 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_ModuleCage.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/DBM_ModuleCage.cxx @@ -16,7 +16,7 @@ #include "GeoModelKernel/GeoPhysVol.h" #include "GaudiKernel/SystemOfUnits.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" GeoVPhysVol* DBM_ModuleCage::Build() { diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelBarrel.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelBarrel.cxx index 27885db1d8c8a7cba1e8f63342e4be838dd54ef8..7d6a92e19ad58639efba9843d50a5cc13b46fbde 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelBarrel.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelBarrel.cxx @@ -18,7 +18,7 @@ #include "GeoModelKernel/GeoFullPhysVol.h" #include "GeoModelKernel/GeoMaterial.h" #include "GeoModelKernel/GeoAlignableTransform.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "Identifier/Identifier.h" #include "InDetGeoModelUtils/ExtraMaterial.h" #include "InDetIdentifier/PixelID.h" diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelDisk.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelDisk.cxx index b9c017461071c91075b871688adc500a0461b670..3af1f2193475cc4948d13a7b1b1c32e6f68a7130 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelDisk.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelDisk.cxx @@ -19,7 +19,7 @@ #include "GeoModelKernel/GeoAlignableTransform.h" #include "GaudiKernel/SystemOfUnits.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include <sstream> GeoPixelDisk::GeoPixelDisk() { diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelDiskSLHC.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelDiskSLHC.cxx index 13d094d8afe8209fc95f7132363418bcbb3cf85e..0957e94d223052c1228d37efa528923adeb9ade6 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelDiskSLHC.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelDiskSLHC.cxx @@ -18,7 +18,7 @@ #include "GeoModelKernel/GeoTransform.h" #include "GeoModelKernel/GeoAlignableTransform.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include <string> using std::string; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelEndCap.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelEndCap.cxx index 4279d0d89a2b84a19553f701e3afb29b5f4593f0..7b507a4be6868ae3037882326f79d1b3b30be860 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelEndCap.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelEndCap.cxx @@ -16,7 +16,7 @@ #include "GeoModelKernel/GeoMaterial.h" #include "GeoModelKernel/GeoTransform.h" #include "GeoModelKernel/GeoAlignableTransform.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "Identifier/Identifier.h" #include "InDetIdentifier/PixelID.h" #include "InDetGeoModelUtils/ExtraMaterial.h" diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelEnvelope.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelEnvelope.cxx index c936b78ada6120f71696e1e2fed348b57af77a25..ef5c33bd68065495472ddd3197284535dd626b2c 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelEnvelope.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelEnvelope.cxx @@ -30,7 +30,7 @@ #include "GeoModelInterfaces/IGeoSubDetTool.h" #include "GaudiKernel/StatusCode.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" GeoVPhysVol* GeoPixelEnvelope::Build( ) { // diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLadder.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLadder.cxx index 39c3e6ef0502d8bdff60b54a0a2888d216c88323..be2709df2055c678f5ecd7038f2f083b674a9918 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLadder.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLadder.cxx @@ -6,7 +6,7 @@ #include "GeoPixelStaveSupport.h" #include "GeoPixelModule.h" #include "GeoPixelSiCrystal.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "GeoModelKernel/GeoBox.h" #include "GeoModelKernel/GeoTubs.h" #include "GeoModelKernel/GeoTrap.h" diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLayer.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLayer.cxx index 80d2d00918bf5e795753fdbc2f2cd958ee3c723e..065d47493a67feeb1230a65ab3babecd5c0b25ec 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLayer.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelLayer.cxx @@ -15,7 +15,7 @@ #include "GeoPixelStaveRing.h" #include "InDetGeoModelUtils/ExtraMaterial.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "GeoModelKernel/GeoTube.h" #include "GeoModelKernel/GeoPara.h" diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelRingSLHC.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelRingSLHC.cxx index ca402ad4db54359b9d3fc8f70d7874a932975659..0dc6f969c79aa713ce087ee75ac2e6604f79b8c3 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelRingSLHC.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelRingSLHC.cxx @@ -18,7 +18,7 @@ #include "GeoModelKernel/GeoAlignableTransform.h" #include "GaudiKernel/SystemOfUnits.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" //#include <string> #include <sstream> //using std::string; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelSiCrystal.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelSiCrystal.cxx index 19134c98929849ae84b031898e42b3f7406eded6..4df506d766e26e01791397a78a9b52bd213207e3 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelSiCrystal.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/GeoPixelSiCrystal.cxx @@ -19,11 +19,11 @@ #include "GaudiKernel/SystemOfUnits.h" #include "Identifier/Identifier.h" #include "InDetIdentifier/PixelID.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "InDetReadoutGeometry/PixelDiodeMatrix.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelDiodeMatrix.h" #include "InDetReadoutGeometry/SiCommonItems.h" #include "InDetReadoutGeometry/InDetDD_Defs.h" diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/OraclePixGeoManager.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/OraclePixGeoManager.cxx index 75d39cf7c959745d66993bba4bebda4c8aaff47c..ffe2b8a8a565a1ac7bd3d756c6786da68dab1f29 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/OraclePixGeoManager.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/OraclePixGeoManager.cxx @@ -22,7 +22,7 @@ // // Get the pixelDD Manager from SG. // -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "RDBAccessSvc/IRDBAccessSvc.h" #include "RDBAccessSvc/IRDBRecord.h" #include "RDBAccessSvc/IRDBRecordset.h" diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorDC1DC2.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorDC1DC2.cxx index 535355c219734b3c9baf87db6a9c735b873857d1..e2031ab16df0614b13e5c7c7c185c39cc9d4403e 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorDC1DC2.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorDC1DC2.cxx @@ -9,9 +9,9 @@ #include "PixelDetectorDC1DC2.h" #include "InDetReadoutGeometry/InDetDD_Defs.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" -#include "InDetReadoutGeometry/PixelDiodeMatrix.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDiodeMatrix.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SiCommonItems.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetIdentifier/PixelID.h" diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.cxx index 444f063bb3243a2ba4eb921444acb8d7281129e7..b2e979b9888246909a53785ba4053cf2570e9a9a 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.cxx @@ -18,8 +18,8 @@ // InDetReadoutGeometry #include "InDetReadoutGeometry/SiCommonItems.h" #include "InDetReadoutGeometry/InDetDD_Defs.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "OraclePixGeoManager.h" #include "PixelGeoModelAthenaComps.h" diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.h b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.h index c66cb0c55098a226d8cda7f68183c9d2e62a6fb4..80258642bde1989a52d6bbb4b4f265e0573c46c3 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.h +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactory.h @@ -8,7 +8,7 @@ #include "InDetGeoModelUtils/InDetDetectorFactoryBase.h" // readout includes: -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/InDetDD_Defs.h" class PixelSwitches; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactoryDC2.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactoryDC2.cxx index 0d5797ba806d447cedd8fced3f90af87f6e5c5e9..efa19afbe19791b3ceb2379b726f2545fce2ccd5 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactoryDC2.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactoryDC2.cxx @@ -18,7 +18,7 @@ // InDetReadoutGeometry #include "InDetReadoutGeometry/SiCommonItems.h" #include "InDetReadoutGeometry/InDetDD_Defs.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "PixelGeoModelAthenaComps.h" diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactoryDC2.h b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactoryDC2.h index 1aa41365ff34422576986d51b2cc5e78fb95664b..e951ac7c3b8714a12d51d6b49a02b08fc8bc5620 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactoryDC2.h +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactoryDC2.h @@ -8,7 +8,7 @@ #include "InDetGeoModelUtils/InDetDetectorFactoryBase.h" // readout includes: -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" class PixelSwitches; class PixelGeoModelAthenaComps; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactorySR1.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactorySR1.cxx index f833a3103e9c97bfeba740e557e78a390ec3f5a4..f2bd5a297391688ed83948d379737b87babf5b52 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactorySR1.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactorySR1.cxx @@ -21,7 +21,7 @@ // InDetReadoutGeometry #include "InDetReadoutGeometry/SiCommonItems.h" #include "InDetReadoutGeometry/InDetDD_Defs.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "PixelGeoModelAthenaComps.h" #include "OraclePixGeoManager.h" diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactorySR1.h b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactorySR1.h index 8b2d2c720de36dc51bba5da9848607dd90535b6c..b0bc4ed6da8e3e5ea89e55b43d587357671193e9 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactorySR1.h +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorFactorySR1.h @@ -8,7 +8,7 @@ #include "InDetGeoModelUtils/InDetDetectorFactoryBase.h" // readout includes: -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" class PixelSwitches; diff --git a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorTool.cxx b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorTool.cxx index bf8cc2a2ec044fc170ed96c4528d76c42cde115c..1f18e34a51c6a6c6db9fcbcb10eabd8884489c81 100644 --- a/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorTool.cxx +++ b/InnerDetector/InDetDetDescr/PixelGeoModel/src/PixelDetectorTool.cxx @@ -10,7 +10,7 @@ #include "PixelGeometryManager.h" #include "PixelSwitches.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/InDetDD_Defs.h" #include "DetDescrConditions/AlignableTransformContainer.h" #include "PixelGeoModelAthenaComps.h" diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt index 6541b733160e697103c30317786feaf40f10d75c..240604940ba0874fc00d4183bd8bef768c0b7e94 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/FastSiDigitization/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/InDetCondTools InnerDetector/InDetConditions/PixelConditionsTools InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetRawEvent/InDetSimData InnerDetector/InDetRecEvent/InDetPrepRawData InnerDetector/InDetRecTools/SiClusterizationTool @@ -49,7 +50,7 @@ atlas_add_component( FastSiDigitization src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib EventPrimitives xAODEventInfo GaudiKernel InDetReadoutGeometry InDetSimData InDetPrepRawData SiClusterizationToolLib InDetSimEvent HitManagement ISF_FatrasDetDescrModel ISF_FatrasEvent TrkTruthData StoreGateLib SGtests Identifier GeneratorObjects InDetIdentifier TrkDetDescrInterfaces TrkDigEvent TrkGeometry TrkSurfaces TrkExUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps AthenaKernel PileUpToolsLib EventPrimitives xAODEventInfo GaudiKernel InDetReadoutGeometry PixelReadoutGeometry InDetSimData InDetPrepRawData SiClusterizationToolLib InDetSimEvent HitManagement ISF_FatrasDetDescrModel ISF_FatrasEvent TrkTruthData StoreGateLib SGtests Identifier GeneratorObjects InDetIdentifier TrkDetDescrInterfaces TrkDigEvent TrkGeometry TrkSurfaces TrkExUtils ) # Install files from the package: atlas_install_headers( FastSiDigitization ) diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx index d9485627b88ad768602ac38c0646e736e647bcad..745a4e0f9aeda1751f9d42f23ccbd68df17efed2 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/PixelFastDigitizationTool.cxx @@ -31,7 +31,7 @@ // Pile-up #include "InDetReadoutGeometry/SiDetectorDesign.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" // Fatras #include "InDetPrepRawData/PixelCluster.h" diff --git a/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx b/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx index 3ae0710d6dd7b90210243b9d63797c056a5fb61d..a711514b36c3365f521ac19f73b188c7fbc4522d 100644 --- a/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx +++ b/InnerDetector/InDetDigitization/FastSiDigitization/src/SiSmearedDigitizationTool.cxx @@ -36,7 +36,7 @@ #include "PileUpTools/PileUpMergeSvc.h" #include "InDetReadoutGeometry/SiDetectorDesign.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SCT_ModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_BarrelModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_ForwardModuleSideDesign.h" diff --git a/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt b/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt index 2f6ff6341d59c6614dd691a19b14efd7c2377644..08abafa159422dc92c656dd0de94f5c620a2b154 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt +++ b/InnerDetector/InDetDigitization/PixelDigitization/CMakeLists.txt @@ -23,6 +23,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/SiPropertiesTool InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetDigitization/SiDigitization InnerDetector/InDetRawEvent/InDetRawData @@ -41,7 +42,7 @@ atlas_add_component( PixelDigitization src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel CommissionEvent AthenaKernel PileUpToolsLib StoreGateLib SGtests Identifier GeneratorObjects PixelConditionsData SiPropertiesToolLib InDetIdentifier InDetReadoutGeometry SiDigitization InDetRawData InDetSimData InDetSimEvent HitManagement PathResolver ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel CommissionEvent AthenaKernel PileUpToolsLib StoreGateLib SGtests Identifier GeneratorObjects PixelConditionsData SiPropertiesToolLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SiDigitization InDetRawData InDetSimData InDetSimEvent HitManagement PathResolver ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.cxx index 7e1374262aa76191c1036669a7b7f98176482adc..9cf0b01b2fe80cd05da03fd26fce0f7cf0b20fb3 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.cxx @@ -9,7 +9,7 @@ #include "TMath.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetSimEvent/SiHit.h" #include "InDetIdentifier/PixelID.h" #include "GeneratorObjects/HepMcParticleLink.h" diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.h index 6ad91cff6d46800662b605ca01ca38b9bb846b59..c8c85adba0c97dc4561fefec764cc92b2058291f 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/EnergyDepositionTool.h @@ -20,7 +20,7 @@ #include "HitManagement/TimedHitPtr.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "SiDigitization/SiChargedDiodeCollection.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetIdentifier/PixelID.h" #include "PixelConditionsData/PixelDistortionData.h" diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h index 96324486591cf47848602bb7e30605840b6e2533..e588da71f560cd702dbb9b6830d7c0fa375a87af 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/FrontEndSimTool.h @@ -22,7 +22,7 @@ #include "InDetSimEvent/SiTotalCharge.h" #include "SiDigitization/SiHelper.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SiCellId.h" #include "PixelConditionsData/PixelModuleData.h" diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx index 9dd8e19b3b0abf091764625f073472b23ffaeded..dba1b3a1d6cd08aabc38837453874f1fc23ac188 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/RD53SimTool.cxx @@ -4,7 +4,7 @@ #include "RD53SimTool.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "SiDigitization/SiHelper.h" #include "InDetReadoutGeometry/SiReadoutCellId.h" diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.cxx index b1c474cc0758faab09f00936d55196562d5939fe..6d5f31b4b17b773b457c366f63b17e013ab6f494 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.cxx @@ -10,7 +10,7 @@ #include "TFile.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetSimEvent/SiHit.h" #include "InDetIdentifier/PixelID.h" #include "GeneratorObjects/HepMcParticleLink.h" diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.h b/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.h index d532ba445ae7984a799b806a8e454a9df9753d32..cf9729d43f3f01009c95cafa06c36f9c2119fecd 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/RadDamageUtil.h @@ -18,7 +18,7 @@ #include "GaudiKernel/Service.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "SiDigitization/SiChargedDiodeCollection.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "TH3.h" #include "TH2.h" diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSim3DTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSim3DTool.cxx index d7a0e4ad4e5f0eca7e3933c2c3622df09d57c5ea..f3a52c36b1502b33aad120c90ab2ab8c016e6d80 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSim3DTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSim3DTool.cxx @@ -4,7 +4,7 @@ #include "SensorSim3DTool.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetSimEvent/SiHit.h" #include "SiDigitization/SiSurfaceCharge.h" #include "InDetIdentifier/PixelID.h" diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx index 1340bc26eae39ad4d3356704774c51d79621c3eb..43c50767f4afc297aed9f3d07388a1db0422c3af 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimPlanarTool.cxx @@ -4,7 +4,7 @@ #include "SensorSimPlanarTool.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "SiDigitization/SiSurfaceCharge.h" #include "InDetSimEvent/SiHit.h" #include "InDetIdentifier/PixelID.h" diff --git a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h index 4274f21632325de8be259fd93cabd5bb0f1b3012..fbf423714cb48e5b3bec9ea9c2407e923b8fba17 100644 --- a/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h +++ b/InnerDetector/InDetDigitization/PixelDigitization/src/SensorSimTool.h @@ -20,7 +20,7 @@ #include "SiDigitization/SiChargedDiodeCollection.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "SiDigitization/SiChargedDiodeCollection.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "SiPropertiesTool/ISiPropertiesTool.h" static const InterfaceID IID_ISensorSimTool("SensorSimTool", 1, 0); diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt index 6bb05ebd06a84532d4900c55526a9a43ef43443f..768aa57f97071e3ea48737cedd39bcb7c4e1dc1b 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/CMakeLists.txt @@ -20,6 +20,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/TRT_ConditionsServices InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetRawEvent/InDetRawData InnerDetector/InDetRawEvent/InDetSimData @@ -39,7 +40,7 @@ atlas_add_component( InDetPrepRawDataToxAOD src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps StoreGateLib SGtests Identifier InDetByteStreamErrors PixelConditionsData xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry InDetRawData InDetSimData InDetPrepRawData InDetSimEvent TrkSurfaces TrkTruthData ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel AthenaBaseComps StoreGateLib SGtests Identifier InDetByteStreamErrors PixelConditionsData xAODTracking TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry InDetRawData InDetSimData InDetPrepRawData InDetSimEvent TrkSurfaces TrkTruthData ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py index 14fe90e39855ccb5962f0b669c59ac3ea046c9b9..b28100dc626e9f9fa8ee9706f28e5ed1dc6134d7 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/python/InDetDxAODJobProperties.py @@ -159,5 +159,19 @@ class DRAWZSelection(JobProperty): StoredValue = False jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(DRAWZSelection) +class SkimmingExpression(JobProperty): + """Event selection based on string input""" + statusOn = True + allowedTypes = ["string"] + StoredValue = "" + pass +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(SkimmingExpression) + +class PixelClusterThinningExpression(JobProperty): + """Pixel cluster thinning""" + statusOn = True + allowedTypes = ["string"] + StoredValue = "" +jobproperties.InDetDxAODJobPropertyContainer.add_JobProperty(PixelClusterThinningExpression) InDetDxAODFlags = jobproperties.InDetDxAODJobPropertyContainer diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py index ea12f87aee68e8bd23fb4163ae9ff470fea6129d..4693e3d6de2efcf027fe16b8c18a32a5dbc73331 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/share/InDetDxAOD.py @@ -48,6 +48,12 @@ printIdTrkDxAODConf = InDetDxAODFlags.PrintIdTrkDxAODConf() # True # Create split-tracks if running on cosmics makeSplitTracks = InDetDxAODFlags.MakeSplitCosmicTracks() and athCommonFlags.Beam.beamType() == 'cosmics' +# general skimming based on this string input +skimmingExpression = InDetDxAODFlags.SkimmingExpression() # *empty string* + +# thinning of pixel clusters +pixelClusterThinningExpression = InDetDxAODFlags.PixelClusterThinningExpression() # *empty string* + ## Autoconfiguration adjustements isIdTrkDxAODSimulation = False if (globalflags.DataSource == 'geant4'): @@ -313,6 +319,13 @@ if TrtZSel or TrtJSel: print JPSI_SkimmingTool +if skimmingExpression: + from DerivationFrameworkTools.DerivationFrameworkToolsConf import DerivationFramework__xAODStringSkimmingTool + stringSkimmingTool = DerivationFramework__xAODStringSkimmingTool(name = "stringSkimmingTool", + expression = skimmingExpression) + + ToolSvc += stringSkimmingTool + DRAW_ZMUMU_SkimmingTool=None if DRAWZSel: @@ -587,6 +600,8 @@ if TrtJSel: if DRAWZSel: skimmingTools.append(DRAW_ZMUMU_SkimmingTool) +if skimmingExpression: + skimmingTools.append(stringSkimmingTool) #minimumbiasTrig = '(L1_RD0_FILLED)' # @@ -612,6 +627,18 @@ IDTRKThinningTool = DerivationFramework__TrackParticleThinning(name = "IDTRKThin ToolSvc += IDTRKThinningTool thinningTools.append(IDTRKThinningTool) +if pixelClusterThinningExpression: + from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackMeasurementThinning + trackMeasurementThinningTool = DerivationFramework__TrackMeasurementThinning( + name = "TrackMeasurementThinningTool", + ThinningService = "IDTRKThinningSvc", + SelectionString = pixelClusterThinningExpression, + TrackMeasurementValidationKey = "PixelClusters", + ApplyAnd = False) + + ToolSvc += trackMeasurementThinningTool + thinningTools.append(trackMeasurementThinningTool) + #==================================================================== # Create the derivation Kernel and setup output stream #==================================================================== diff --git a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx index 5aa58695bc5f879c06a3b4738a8d6eda10910c96..5461e2e0d846604f01560f9f542e6d22e0945068 100644 --- a/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx +++ b/InnerDetector/InDetEventCnv/InDetPrepRawDataToxAOD/src/PixelPrepDataToxAOD.cxx @@ -17,7 +17,7 @@ #include "Identifier/Identifier.h" #include "InDetIdentifier/PixelID.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "TrkTruthData/PRD_MultiTruthCollection.h" diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/CMakeLists.txt b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/CMakeLists.txt index 9da2711c668c43a3287c81e27522abbbef8fa10c..cc2823f983d9c54cd05ba81a54a9e1976c5fc373 100644 --- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/CMakeLists.txt +++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/CMakeLists.txt @@ -23,6 +23,7 @@ atlas_depends_on_subdirs( InnerDetector/InDetConditions/InDetByteStreamErrors InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetConditions/PixelConditionsData Event/xAOD/xAODEventInfo @@ -43,6 +44,6 @@ atlas_add_component( PixelRawDataByteStreamCnv INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ByteStreamData GaudiKernel InDetRawData AthenaBaseComps AthContainers StoreGateLib - ByteStreamCnvSvcBaseLib InDetIdentifier InDetReadoutGeometry IRegionSelector + ByteStreamCnvSvcBaseLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry IRegionSelector xAODEventInfo TrigSteeringEvent InDetByteStreamErrors PixelConditionsData PixelRawDataByteStreamCnvLib ) diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRawContByteStreamTool.h b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRawContByteStreamTool.h index 50658db67b7fd154a51c5c532ee25e5fb4255bf2..2ddced4154f9cbbeb4fc92e3b3e53d297f7e2cdd 100644 --- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRawContByteStreamTool.h +++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRawContByteStreamTool.h @@ -26,7 +26,7 @@ #include "ByteStreamData/RawEvent.h" #include "InDetRawData/InDetRawDataCLASS_DEF.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "ByteStreamCnvSvcBase/FullEventAssembler.h" // needed, template class diff --git a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx index c6d10be114d995b6501f186c5bdbe943baf3d0ed..0d954116aed5feada4e270d62d2dc45f1bf11293 100644 --- a/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx +++ b/InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv/src/PixelRodDecoder.cxx @@ -6,7 +6,7 @@ #include "PixelCabling/IPixelCablingSvc.h" #include "InDetIdentifier/PixelID.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "ExtractCondensedIBLhits.h" #include "PixelByteStreamModuleMask.h" #include "eformat/SourceIdentifier.h" diff --git a/InnerDetector/InDetExample/InDetDetDescrExample/CMakeLists.txt b/InnerDetector/InDetExample/InDetDetDescrExample/CMakeLists.txt index 7547c76e7326cdcf6dbf27cdd2531078e6234fc9..23a8ffab4e9edb80465ef1f7266dc3deda228205 100644 --- a/InnerDetector/InDetExample/InDetDetDescrExample/CMakeLists.txt +++ b/InnerDetector/InDetExample/InDetDetDescrExample/CMakeLists.txt @@ -17,7 +17,8 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/InDetCondTools InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetDetDescr/InDetIdentifier - InnerDetector/InDetDetDescr/InDetReadoutGeometry ) + InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry ) # External dependencies: find_package( CLHEP ) @@ -28,7 +29,7 @@ atlas_add_component( InDetDetDescrExample src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GeoPrimitives Identifier RegionSelectorLib GaudiKernel InDetCondTools InDetIdentifier InDetReadoutGeometry ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GeoPrimitives Identifier RegionSelectorLib GaudiKernel InDetCondTools InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry) # Install files from the package: atlas_install_headers( InDetDetDescrExample ) diff --git a/InnerDetector/InDetExample/InDetDetDescrExample/src/InDetUpdateCaches.cxx b/InnerDetector/InDetExample/InDetDetDescrExample/src/InDetUpdateCaches.cxx index f2635c70bfe283be733e6e84d51241deb9f53494..b4210fc78c846b8e6175e6831e90aeb6bebd42e5 100755 --- a/InnerDetector/InDetExample/InDetDetDescrExample/src/InDetUpdateCaches.cxx +++ b/InnerDetector/InDetExample/InDetDetDescrExample/src/InDetUpdateCaches.cxx @@ -4,7 +4,7 @@ #include "InDetDetDescrExample/InDetUpdateCaches.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/TRT_DetectorManager.h" diff --git a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py index c60eb52f8cfffd0beaaa6b1ce30bf39f885cc27c..c587f22797b5e3365eae93a483e96d0990baeca1 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/InDetJobProperties.py @@ -1213,7 +1213,7 @@ class InDetJobProperties(JobPropertyContainer): from RecExConfig.RecFlags import rec if rec.doMonitoring(): self.checkThenSet(self.doMonitoringGlobal , True) - self.checkThenSet(self.doMonitoringPrimaryVertexingEnhanced , True) + #self.checkThenSet(self.doMonitoringPrimaryVertexingEnhanced , True) self.checkThenSet(self.doMonitoringPixel , True) self.checkThenSet(self.doMonitoringSCT , True) self.checkThenSet(self.doMonitoringTRT , True) diff --git a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py index 429ee6d4d12a76ad912b64b7ffd0842b692e5fa3..e79f4050362e2e208eef466e6bd625c382b30da6 100644 --- a/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py +++ b/InnerDetector/InDetExample/InDetRecExample/python/TrackingCommon.py @@ -247,7 +247,8 @@ def getPixelClusterNnCondAlg(**kwargs) : from IOVDbSvc.CondDB import conddb if not conddb.folderRequested('/PIXEL/PixelClustering/PixelClusNNCalib'): # COOL binding - conddb.addFolder("PIXEL_OFL","/PIXEL/PixelClustering/PixelClusNNCalib",className='CondAttrListCollection') + conddb.addFolderSplitOnline("PIXEL","/PIXEL/Onl/PixelClustering/PixelClusNNCalib", + "/PIXEL/PixelClustering/PixelClusNNCalib",className='CondAttrListCollection') kwargs=setDefaults(kwargs, NetworkNames = nn_names, diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py index fb74b58f7d1492c0a0dacb104b5516f1ebd97744..ac18a251d11b4394abb8e058cd1d3b4f4f44df6a 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecLoadTools.py @@ -633,8 +633,12 @@ if (InDetFlags.doVertexFinding() or InDetFlags.doVertexFindingForMonitoring()) o # --- load Configured Annealing Maker # from TrkVertexFitterUtils.TrkVertexFitterUtilsConf import Trk__DetAnnealingMaker - InDetAnnealingMaker = Trk__DetAnnealingMaker(name = "InDetAnnealingMaker", - SetOfTemperatures = [64.,16.,4.,2.,1.5,1.]) # not default + if(InDetFlags.primaryVertexSetup() == 'GaussAdaptiveMultiFinding'): + InDetAnnealingMaker = Trk__DetAnnealingMaker(name = "InDetAnnealingMaker", + SetOfTemperatures = [8.,4.,2.,1.4142136,1.2247449,1.]) # 'standard' annealing temps raised to 0.5 + else: + InDetAnnealingMaker = Trk__DetAnnealingMaker(name = "InDetAnnealingMaker", + SetOfTemperatures = [64.,16.,4.,2.,1.5,1.]) # not default ToolSvc += InDetAnnealingMaker if (InDetFlags.doPrintConfigurables()): printfunc (InDetAnnealingMaker) @@ -926,6 +930,7 @@ if (InDetFlags.doVertexFinding() or InDetFlags.doVertexFindingForMonitoring()) o TrackSelector = InDetTrackSelectorTool, useBeamConstraint = InDetFlags.useBeamConstraint(), selectiontype = 0, + TracksMaxZinterval = 3,#mm do3dSplitting = InDetFlags.doPrimaryVertex3DFinding()) elif InDetFlags.primaryVertexSetup() == 'DefaultVKalVrtFinding': diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py index d8532dabdbe612de92cdfd8735642073db5aa45d..9f136ae2883a7bbca6360757e9ac03578f05eafd 100644 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRecNtupleCreation.py @@ -21,19 +21,19 @@ if InDetFlags.doNtupleCreation(): ResidualNtupleHelper = Trk__ResidualValidationNtupleHelper( name = 'InDetResidualValHelper' ) ToolSvc += ResidualNtupleHelper if (InDetFlags.doPrintConfigurables()): - print ResidualNtupleHelper + print( ResidualNtupleHelper ) # from TrkValTools.TrkValToolsConf import Trk__HitPositionNtupleHelper HitPositionNtupleHelper = Trk__HitPositionNtupleHelper( name = 'InDetHitPosValHelper' ) ToolSvc += HitPositionNtupleHelper if (InDetFlags.doPrintConfigurables()): - print HitPositionNtupleHelper + print( HitPositionNtupleHelper ) # from TrkValTools.TrkValToolsConf import Trk__TrackPositionNtupleHelper TrackPositionNtupleHelper = Trk__TrackPositionNtupleHelper( name = 'InDetTrackPosValHelper' ) ToolSvc += TrackPositionNtupleHelper if (InDetFlags.doPrintConfigurables()): - print TrackPositionNtupleHelper + print( TrackPositionNtupleHelper ) PixelNtupleHelperToolsList = [] SCTNtupleHelperToolsList = [] @@ -54,7 +54,7 @@ if InDetFlags.doNtupleCreation(): InDetTrackInfoNtupleTool = Trk__TrackInformationNtupleTool(name="InDetTrackInfoNtupleTool") ToolSvc += InDetTrackInfoNtupleTool if InDetFlags.doPrintConfigurables(): - print InDetTrackInfoNtupleTool + print( InDetTrackInfoNtupleTool ) from TrkValTools.TrkValToolsConf import Trk__PerigeeParametersNtupleTool InDetPerigeeNtupleTool = Trk__PerigeeParametersNtupleTool \ @@ -63,7 +63,7 @@ if InDetFlags.doNtupleCreation(): ExtrapolatorTool = InDetExtrapolator) ToolSvc += InDetPerigeeNtupleTool if InDetFlags.doPrintConfigurables(): - print InDetPerigeeNtupleTool + print( InDetPerigeeNtupleTool ) from TrkValTools.TrkValToolsConf import Trk__MeasurementVectorNtupleTool InDetMeastsNtupleTool = Trk__MeasurementVectorNtupleTool(name = 'InDetMeastsNtupleTool', @@ -76,7 +76,7 @@ if InDetFlags.doNtupleCreation(): DoHoleSearch = True) ToolSvc += InDetMeastsNtupleTool if InDetFlags.doPrintConfigurables(): - print InDetMeastsNtupleTool + print( InDetMeastsNtupleTool ) # --- include track selection tool from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetTrackSelectorTool @@ -103,7 +103,7 @@ if InDetFlags.doNtupleCreation(): ToolSvc += TrkValTrackSelectorTool if (InDetFlags.doPrintConfigurables()): - print TrkValTrackSelectorTool + print( TrkValTrackSelectorTool ) # --- include track ntuple alg @@ -117,7 +117,7 @@ if InDetFlags.doNtupleCreation(): MaxZStartAll = 2000000) ToolSvc += TrkInDetReconstructableSelector if (InDetFlags.doPrintConfigurables()): - print TrkInDetReconstructableSelector + print( TrkInDetReconstructableSelector ) from TrkValAlgs.TrkValAlgsConf import Trk__TrackValidationNtupleWriter TrkValNtupleWriter = Trk__TrackValidationNtupleWriter(name = 'InDetValNtupleWriter', @@ -153,7 +153,7 @@ if InDetFlags.doNtupleCreation(): topSequence += TrkValNtupleWriter if (InDetFlags.doPrintConfigurables()): - print TrkValNtupleWriter + print( TrkValNtupleWriter ) # configure sub detector tracking independent ntuple trees @@ -167,7 +167,7 @@ if InDetFlags.doNtupleCreation(): SCT_ClusterContainer = InDetKeys.SCT_Clusters()) topSequence += SctNtupleWriter if (InDetFlags.doPrintConfigurables()): - print SctNtupleWriter + print( SctNtupleWriter ) # -------------------------------------------- @@ -180,7 +180,7 @@ if InDetFlags.doNtupleCreation(): MonteCarloCollection = InDetKeys.McEventCollection()) ToolSvc += InDetPriVxPurityTool if (InDetFlags.doPrintConfigurables()): - print InDetPriVxPurityTool + print( InDetPriVxPurityTool ) from TrkVertexFitterValidation.TrkVertexFitterValidationConf import Trk__PUVertexTest InDetVertexNTupleWriter = Trk__PUVertexTest(name = "InDetVertexNTupleWriter", @@ -195,7 +195,7 @@ if InDetFlags.doNtupleCreation(): TracksName = InDetKeys.Tracks()) topSequence += InDetVertexNTupleWriter if (InDetFlags.doPrintConfigurables()): - print InDetVertexNTupleWriter + print( InDetVertexNTupleWriter ) # -------------------------------------------- @@ -209,7 +209,7 @@ if InDetFlags.doNtupleCreation(): MonteCarloCollection = InDetKeys.McEventCollection()) topSequence += InDetConversionNTupleWriter if (InDetFlags.doPrintConfigurables()): - print InDetConversionNTupleWriter + print( InDetConversionNTupleWriter ) # -------------------------------------------- @@ -218,7 +218,7 @@ if InDetFlags.doNtupleCreation(): InDetV0Tools = Trk__V0Tools(name = "InDetV0Tools") ToolSvc += InDetV0Tools if (InDetFlags.doPrintConfigurables()): - print InDetV0Tools + print( InDetV0Tools ) from TrkVertexFitterValidation.TrkVertexFitterValidationConf import Trk__V0VertexTest InDetV0NTupleWriter = Trk__V0VertexTest(name = "InDetV0NTupleWriter", @@ -236,7 +236,7 @@ if InDetFlags.doNtupleCreation(): topSequence += InDetV0NTupleWriter if (InDetFlags.doPrintConfigurables()): - print InDetV0NTupleWriter + print( InDetV0NTupleWriter ) # --- and the setup @@ -280,7 +280,7 @@ if InDetFlags.doStandardPlots(): ToolSvc+=InDetTrackSelectorToolGood if (InDetFlags.doPrintConfigurables()): - print InDetTrackSelectorToolGood + print( InDetTrackSelectorToolGood ) # for track selection as done by b-tagging group InDetTrackSelectorToolBtag = InDet__InDetDetailedTrackSelectorTool(name = "InDetDetailedTrackSelectorToolBtag", @@ -301,7 +301,7 @@ if InDetFlags.doStandardPlots(): ToolSvc+=InDetTrackSelectorToolBtag if (InDetFlags.doPrintConfigurables()): - print InDetTrackSelectorToolBtag + print( InDetTrackSelectorToolBtag ) # --- add an AthenaMonManager algorithm to the list of algorithms to be ran from AthenaMonitoring.AthenaMonitoringConf import AthenaMonManager @@ -316,7 +316,7 @@ if InDetFlags.doStandardPlots(): topSequence += InDetTrackPerfMonManager if (InDetFlags.doPrintConfigurables()): - print InDetTrackPerfMonManager + print( InDetTrackPerfMonManager ) @@ -364,9 +364,9 @@ if InDetFlags.doStandardPlots(): # ToolSvc += InDetStandardPerformanceAll # if (InDetFlags.doPrintConfigurables()): -# print InDetStandardPerformanceAll +# print( InDetStandardPerformanceAll ) # if InDetFlags.doDBM(): -# print InDetStandardPerformanceDBM +# print( InDetStandardPerformanceDBM ) # InDetTrackPerfMonManager.AthenaMonTools += [ InDetStandardPerformanceAll ] @@ -386,7 +386,7 @@ if InDetFlags.doStandardPlots(): InDetStandardPerformancePseudoTracks.TruthParticleContainerName = "TruthEvent_PU" if (InDetFlags.doPrintConfigurables()): - print InDetStandardPerformancePseudoTracks + print( InDetStandardPerformancePseudoTracks ) InDetTrackPerfMonManager.AthenaMonTools += [ InDetStandardPerformancePseudoTracks ] # selected tracks passing good quality cuts @@ -404,7 +404,7 @@ if InDetFlags.doStandardPlots(): DoTruth = InDetFlags.doTruth()) if (InDetFlags.doPrintConfigurables()): - print InDetStandardPerformanceGood + print( InDetStandardPerformanceGood ) InDetTrackPerfMonManager.AthenaMonTools += [ InDetStandardPerformanceGood ] @@ -422,7 +422,7 @@ if InDetFlags.doStandardPlots(): DoTruth = InDetFlags.doTruth()) if (InDetFlags.doPrintConfigurables()): - print InDetStandardPerformanceBtag + print( InDetStandardPerformanceBtag ) InDetTrackPerfMonManager.AthenaMonTools += [ InDetStandardPerformanceBtag ] @@ -440,7 +440,7 @@ if InDetFlags.doStandardPlots(): DoTruth = InDetFlags.doTruth()) if (InDetFlags.doPrintConfigurables()): - print InDetStandardPerformanceGoodIPatRec + print( InDetStandardPerformanceGoodIPatRec ) InDetTrackPerfMonManager.AthenaMonTools += [ InDetStandardPerformanceGoodIPatRec ] @@ -466,7 +466,7 @@ if InDetFlags.doPhysValMon(): LumiBlock = 1) topSequence += InDetPhysValMonManager if (InDetFlags.doPrintConfigurables()): - print InDetPhysValMonManager + print( InDetPhysValMonManager ) from InDetPhysValMonitoring.InDetPhysValMonitoringConf import InDetPhysValMonitoringTool if InDetFlags.doDBMstandalone(): @@ -494,9 +494,9 @@ if InDetFlags.doPhysValMon(): #ToolSvc += InDetPhysValMonTool InDetPhysValMonManager.AthenaMonTools += [InDetPhysValMonTool] if (InDetFlags.doPrintConfigurables()): - print InDetPhysValMonTool + print( InDetPhysValMonTool ) # if InDetFlags.doDBM(): -# print InDetPhysValMonToolDBM +# print( InDetPhysValMonToolDBM ) #monitoring pile-up particles separately if splitReco is used (fast chain) if InDetFlags.doSplitReco(): InDetPhysValMonToolPU = InDetPhysValMonitoringTool (useTrackSelection = True, @@ -505,7 +505,7 @@ if InDetFlags.doPhysValMon(): #ToolSvc += InDetPhysValMonToolPU InDetPhysValMonManager.AthenaMonTools += [InDetPhysValMonToolPU] if (InDetFlags.doPrintConfigurables()): - print InDetPhysValMonToolPU + print( InDetPhysValMonToolPU ) # --- Setup the output histogram file(s) if not hasattr(ServiceMgr, 'THistSvc'): diff --git a/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_all.py b/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_all.py index 15e64943f20f7b0db156579efc622a30a013cd39..b254e3b35595d48e44d7b6e9176506965bb35122 100755 --- a/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_all.py +++ b/InnerDetector/InDetExample/InDetRecExample/share/InDetRec_all.py @@ -65,7 +65,8 @@ else: ServiceMgr.AthenaPoolCnvSvc.PoolAttributes += [ "TREE_BRANCH_OFFSETTAB_LEN ='100'" ] if 'athenaCommonFlags' in dir() and athenaCommonFlags.FilesInput(): ServiceMgr.EventSelector.InputCollections = athenaCommonFlags.FilesInput() - ServiceMgr.EventSelector.SkipEvents = athenaCommonFlags.SkipEvents() + if athenaCommonFlags.SkipEvents.statusOn: + ServiceMgr.EventSelector.SkipEvents = athenaCommonFlags.SkipEvents() # ---- Beam Spot service diff --git a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py index f1346ea98572223ff8eb6e6ae818c010032b604a..4791c98887d2602b1643cdb2c0910c299cc99c38 100644 --- a/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py +++ b/InnerDetector/InDetExample/InDetTrigRecExample/python/InDetTrigConfigConditions.py @@ -387,10 +387,9 @@ class SCT_ConditionsToolsSetup: summaryToolWoFlagged = sct_ConditionsSummaryToolSetupWithoutFlagged.getTool() condTools = [] for condToolHandle in self.summaryTool.ConditionsTools: - condTool = condToolHandle.typeAndName - if condTool not in condTools: - if condTool != self.flaggedTool.getFullName(): - condTools.append(condTool) + if condToolHandle not in condTools: + if not "SCT_FlaggedConditionTool" in condToolHandle.getFullName(): + condTools.append(condToolHandle) summaryToolWoFlagged.ConditionsTools = condTools if self._print: print (summaryToolWoFlagged) return summaryToolWoFlagged @@ -408,7 +407,7 @@ class SCT_ConditionsToolsSetup: # Otherwise, SCT_FlaggedCondData created by SCT_Clusterization if self._print: print (flaggedTool) if not (flaggedTool.getFullName() in self.summaryTool.ConditionsTools): - self.summaryTool.ConditionsTools+=[flaggedTool.getFullName()] + self.summaryTool.ConditionsTools+=[flaggedTool] return flaggedTool def initConfigTool(self, instanceName): diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt index 053dda0abbc2af4ce4eb75e9b14666a23c92f7e1..61d9cae0dc0f255ed3e9267f396e293aa02ca262 100644 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/CMakeLists.txt @@ -24,6 +24,7 @@ atlas_depends_on_subdirs( InnerDetector/InDetConditions/TRT_ConditionsServices InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetRecEvent/InDetPrepRawData InnerDetector/InDetRecEvent/InDetRIO_OnTrack InnerDetector/InDetRecTools/InDetTrackSelectionTool @@ -57,7 +58,7 @@ atlas_add_component( InDetAlignmentMonitoring LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} GaudiKernel CommissionEvent AthenaBaseComps AthenaMonitoringLib AthContainers AtlasDetDescr Identifier EventPrimitives xAODEventInfo xAODTracking - TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry + TRT_ConditionsServicesLib InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry InDetPrepRawData InDetRIO_OnTrack Particle LWHists TrkGeometry TrkSurfaces TrkEventPrimitives TrkParameters TrkParticleBase TrkPseudoMeasurementOnTrack TrkRIO_OnTrack TrkTrack TrkTrackSummary TrkTruthData VxVertex TrkExInterfaces diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx index 8e699315de35d8515542bdc84bb42d9c0d8ad767..7593c87b0e6d714db98844a27a858abc9f188304 100755 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonEfficiencies.cxx @@ -47,7 +47,7 @@ #include "TrackSelectionTool.h" #include "TrkPseudoMeasurementOnTrack/PseudoMeasurementOnTrack.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" // ********************************************************************* diff --git a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx index 20b43d5a33a95ab6182f4b8fa1845a80d7ad8c65..61a8fc53301c01044d5eaaa847c74685c0408373 100755 --- a/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx +++ b/InnerDetector/InDetMonitoring/InDetAlignmentMonitoring/src/IDAlignMonResiduals.cxx @@ -30,7 +30,7 @@ #include "InDetIdentifier/PixelID.h" #include "InDetIdentifier/SCT_ID.h" #include "InDetIdentifier/TRT_ID.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetRIO_OnTrack/SiClusterOnTrack.h" diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/CMakeLists.txt b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/CMakeLists.txt index 56efd5aff9e3e2dc8f2828cf771adbb10fa2da0f..137fe4c7a256b78c9e35359c7b97754396057252 100644 --- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/CMakeLists.txt +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/CMakeLists.txt @@ -28,6 +28,7 @@ atlas_depends_on_subdirs( InnerDetector/InDetConditions/SCT_ConditionsTools InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetDetDescr/PixelGeoModel InnerDetector/InDetRawEvent/InDetBCM_RawData InnerDetector/InDetRawEvent/InDetRawData @@ -59,7 +60,7 @@ atlas_add_component( InDetGlobalMonitoring LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} GaudiKernel CommissionEvent AthenaBaseComps AthenaMonitoringLib AtlasDetDescr IdDictDetDescr Identifier EventInfo EventPrimitives xAODJet xAODTracking - GeneratorObjects InDetIdentifier InDetReadoutGeometry InDetBCM_RawData + GeneratorObjects InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry InDetBCM_RawData InDetRawData InDetPrepRawData InDetRIO_OnTrack InDetByteStreamErrors LWHists TrkSurfaces TrkEventPrimitives TrkMeasurementBase TrkParameters TrkParticleBase TrkTrack TrkTrackSummary TrkTruthData VxVertex TrkExInterfaces TrkToolInterfaces diff --git a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalErrorMonTool.cxx b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalErrorMonTool.cxx index 5bf27087c53a79c7ac09a08772c77aee555abf37..a59d5a9827ad5e37b5b77342882b7f73774fd285 100755 --- a/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalErrorMonTool.cxx +++ b/InnerDetector/InDetMonitoring/InDetGlobalMonitoring/src/InDetGlobalErrorMonTool.cxx @@ -8,7 +8,7 @@ #include "InDetIdentifier/PixelID.h" #include "InDetIdentifier/SCT_ID.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "StoreGate/ReadCondHandle.h" diff --git a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx index b06d5cc75cff3e884ef7cf0a33f6d3bf40d73348..7c8050ae65475ece9cfc5c6e1853489525f2a3f1 100644 --- a/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx +++ b/InnerDetector/InDetMonitoring/TRT_Monitoring/src/TRT_Monitoring_Tool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TRT_Monitoring/TRT_Monitoring_Tool.h" @@ -2462,7 +2462,7 @@ StatusCode TRT_Monitoring_Tool::fillTRTTracks(const TrackCollection& trackCollec } for (; p_trk != trackCollection.end(); ++p_trk) { - const std::auto_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*p_trk))); + const std::unique_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*p_trk))); int nTRTHits = summary->get(Trk::numberOfTRTHits); if (nTRTHits < m_minTRThits) continue; @@ -3590,7 +3590,7 @@ StatusCode TRT_Monitoring_Tool::fillTRTEfficiency(const TrackCollection& combTra continue; } - const std::auto_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*track))); + const std::unique_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*track))); int n_trt_hits = summary->get(Trk::numberOfTRTHits); int n_sct_hits = summary->get(Trk::numberOfSCTHits); int n_pixel_hits = summary->get(Trk::numberOfPixelHits); @@ -3868,7 +3868,7 @@ StatusCode TRT_Monitoring_Tool::fillTRTHighThreshold(const TrackCollection& trac DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItBegin = trackStates->begin(); DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItEnd = trackStates->end(); - const std::auto_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*p_trk))); + const std::unique_ptr<const Trk::TrackSummary> summary(m_TrackSummaryTool->createSummary(*(*p_trk))); int trt_hits = summary->get(Trk::numberOfTRTHits); int sct_hits = summary->get(Trk::numberOfSCTHits); int pixel_hits = summary->get(Trk::numberOfPixelHits); diff --git a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx index d9677bb23d4602ee885451443dc60f979dc32e57..3bc515a2bfdedad3348706c29e55866f587e3264 100755 --- a/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx +++ b/InnerDetector/InDetRecTools/InDetPriVxFinderTool/src/InDetIterativePriVxFinderTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -186,7 +186,7 @@ InDetIterativePriVxFinderTool::findVertex(const TrackCollection* trackTES) } if (selectionPassed) { ElementLink<TrackCollection> link; - link.setElement(const_cast<Trk::Track*>(*itr)); + link.setElement(*itr); Trk::LinkToTrack* linkTT = new Trk::LinkToTrack(link); linkTT->setStorableObject(*trackTES); selectedTracks.push_back(linkTT); @@ -227,7 +227,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection if (selectionPassed) { ElementLink<Trk::TrackParticleBaseCollection> link; - link.setElement(const_cast<Trk::TrackParticleBase*>(*itr)); + link.setElement(*itr); Trk::LinkToTrackParticleBase* linkTT = new Trk::LinkToTrackParticleBase(link); linkTT->setStorableObject(*trackTES); selectedTracks.push_back(linkTT); @@ -279,7 +279,7 @@ InDetIterativePriVxFinderTool::findVertex(const Trk::TrackParticleBaseCollection if (selectionPassed) { ElementLink<xAOD::TrackParticleContainer> link; - link.setElement(const_cast<xAOD::TrackParticle*>(*itr)); + link.setElement(*itr); Trk::LinkToXAODTrackParticle* linkTT = new Trk::LinkToXAODTrackParticle(link); linkTT->setStorableObject(*trackParticles); selectedTracks.push_back(linkTT); diff --git a/InnerDetector/InDetRecTools/InDetTestBLayer/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetTestBLayer/CMakeLists.txt index fde6c436df05496b390780af4ba9d7ec408db2a8..6e4f3440df3a67fbeb36350b95ae02d864af1303 100644 --- a/InnerDetector/InDetRecTools/InDetTestBLayer/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetTestBLayer/CMakeLists.txt @@ -22,6 +22,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry Reconstruction/Particle Tracking/TrkDetDescr/TrkGeometry Tracking/TrkDetDescr/TrkSurfaces @@ -42,7 +43,7 @@ atlas_add_library( InDetTestBLayerLib PUBLIC_HEADERS InDetTestBLayer INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps GeoPrimitives Identifier EventPrimitives GaudiKernel InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkToolInterfaces - PRIVATE_LINK_LIBRARIES AtlasDetDescr IdDictDetDescr InDetIdentifier InDetReadoutGeometry Particle TrkGeometry TrkSurfaces TrkMeasurementBase TrkTrack TrkExInterfaces ) + PRIVATE_LINK_LIBRARIES AtlasDetDescr IdDictDetDescr InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry Particle TrkGeometry TrkSurfaces TrkMeasurementBase TrkTrack TrkExInterfaces ) atlas_add_component( InDetTestBLayer src/components/*.cxx diff --git a/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx b/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx index acf817cde250cce96c3072c4657d27a7770d328e..4fece2ade2f2ab4dc8147c1096e45b6868363fb4 100644 --- a/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTestBLayer/src/InDetTestBLayerTool.cxx @@ -6,7 +6,7 @@ #include "AthenaBaseComps/AthService.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetTestBLayer/InDetTestBLayerTool.h" #include "TrkTrack/Track.h" #include "TrkParameters/TrackParameters.h" diff --git a/InnerDetector/InDetRecTools/InDetTestPixelLayer/CMakeLists.txt b/InnerDetector/InDetRecTools/InDetTestPixelLayer/CMakeLists.txt index 6ae76a6b4be760f8e1ea699eb4fb52f8a8c66e6d..7ec5a4f22aef62ad0fa00e604c42c9c22b106a02 100644 --- a/InnerDetector/InDetRecTools/InDetTestPixelLayer/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/InDetTestPixelLayer/CMakeLists.txt @@ -22,6 +22,7 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/IdDictDetDescr InnerDetector/InDetConditions/InDetConditionsSummaryService InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry Tracking/TrkDetDescr/TrkGeometry Tracking/TrkDetDescr/TrkSurfaces Tracking/TrkEvent/TrkMeasurementBase @@ -43,7 +44,7 @@ atlas_add_library( InDetTestPixelLayerLib PUBLIC_HEADERS InDetTestPixelLayer INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier GaudiKernel InDetIdentifier InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkToolInterfaces - PRIVATE_LINK_LIBRARIES AtlasDetDescr IdDictDetDescr InDetReadoutGeometry TrkGeometry TrkSurfaces TrkMeasurementBase TrkParticleBase TrkTrack TrkTrackSummary TrkExInterfaces ) + PRIVATE_LINK_LIBRARIES AtlasDetDescr IdDictDetDescr InDetReadoutGeometry PixelReadoutGeometry TrkGeometry TrkSurfaces TrkMeasurementBase TrkParticleBase TrkTrack TrkTrackSummary TrkExInterfaces ) atlas_add_component( InDetTestPixelLayer src/components/*.cxx diff --git a/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx b/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx index a2bead4b97f4c00787272b72b998fc6468195ed6..be2efa06fac1e56f41311d7788f3471aa9c7ced3 100644 --- a/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTestPixelLayer/src/InDetTestPixelLayerTool.cxx @@ -6,7 +6,7 @@ #include "AthenaBaseComps/AthService.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetTestPixelLayer/InDetTestPixelLayerTool.h" #include "TrkTrack/Track.h" #include "TrkParameters/TrackParameters.h" diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/InDetTrackScoringTools/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..748b917f65ead08c4de1a336d9625f62025314f0 --- /dev/null +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +InnerDetector/InDetRecTools/InDetTrackScoringTools diff --git a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx index 29c4e346f68adfae5cdddffb8c9ff6dc3176194b..32efae3af46e82f23417106b1465812ed70c0853 100755 --- a/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx +++ b/InnerDetector/InDetRecTools/InDetTrackScoringTools/src/InDetTrtTrackScoringTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "InDetTrackScoringTools/InDetTrtTrackScoringTool.h" @@ -237,7 +237,7 @@ Trk::TrackScore InDet::InDetTrtTrackScoringTool::TRT_ambigScore( const Trk::Trac if ( iTRT_Hits > 0 && m_maxTrtRatio > 0) { // get expected number of TRT hits double nTrtExpected = 30.; - nTrtExpected = m_selectortool->minNumberDCs(const_cast<const Trk::TrackParameters*>(track.trackParameters()->front())); + nTrtExpected = m_selectortool->minNumberDCs(track.trackParameters()->front()); ATH_MSG_VERBOSE( "Expected number of TRT hits: " << nTrtExpected << " for eta: " << fabs(track.trackParameters()->front()->eta()) ); double ratio = iTRT_Hits / nTrtExpected; diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt index cb3dc94494d360942bec8d6eb200d4d21b7e7f0f..c8ff0c79709f264d597cbd897595860a2d02bd4f 100644 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/CMakeLists.txt @@ -27,6 +27,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/PixelConditionsData InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetDetDescr/PixelGeoModel InnerDetector/InDetRecTools/SiClusterizationTool Tracking/TrkDetDescr/TrkSurfaces ) @@ -39,7 +40,7 @@ atlas_add_component( SiClusterOnTrackTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry SiClusterizationToolLib TrkSurfaces TrkRIO_OnTrack PixelConditionsData TrkNeuralNetworkUtilsLib ) + LINK_LIBRARIES ${EIGEN_LIBRARIES} AthenaBaseComps AthenaPoolUtilities GeoPrimitives GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SiClusterizationToolLib TrkSurfaces TrkRIO_OnTrack PixelConditionsData TrkNeuralNetworkUtilsLib ) # Install files from the package: atlas_install_headers( SiClusterOnTrackTool ) diff --git a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx index 060e54e52daa2a4f017595a1858f5b911b828c94..e3af4bb65180e1222278efc641bdba72860fe4a8 100755 --- a/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterOnTrackTool/src/PixelClusterOnTrackTool.cxx @@ -13,7 +13,7 @@ /////////////////////////////////////////////////////////////////// #include "SiClusterOnTrackTool/PixelClusterOnTrackTool.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetIdentifier/PixelID.h" #include "TrkSurfaces/PlaneSurface.h" #include "SiClusterizationTool/NnClusterizationFactory.h" diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt index 1166c8a05b008b5a683fbdd8fa8c4e844464cdaf..832eb70fb5b75f5503e097fa08bf62ff04fcd5ef 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/CMakeLists.txt @@ -22,6 +22,7 @@ atlas_depends_on_subdirs( InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDEscr/PixelReadoutGeometry InnerDetector/InDetRawEvent/InDetRawData InnerDetector/InDetRecEvent/InDetPrepRawData InnerDetector/InDetRecTools/InDetRecToolInterfaces @@ -52,7 +53,7 @@ atlas_add_library( SiClusterizationToolLib PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel GeoPrimitives Identifier EventPrimitives GaudiKernel InDetSimData InDetIdentifier - InDetReadoutGeometry InDetRawData InDetPrepRawData InDetRecToolInterfaces + InDetReadoutGeometry PixelReadoutGeometry InDetRawData InDetPrepRawData InDetRecToolInterfaces TrkParameters TrkNeuralNetworkUtilsLib CxxUtils PixelConditionsData PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaPoolUtilities FileCatalog AtlasDetDescr TrkSurfaces TrkEventPrimitives VxVertex PixelGeoModelLib ) diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h index 3965b9b676bbb600a3822cd08309e25e509aa7a1..74d253213d2737a4981b74bf7b217002daff8d8c 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/SiClusterizationTool/MergedPixelsTool.h @@ -67,7 +67,7 @@ namespace InDet { std::array<int,4> CON; }; - auto pixel_less = [] (rowcolID const& id1,rowcolID const& id2) -> bool { + const auto pixel_less = [] (rowcolID const& id1,rowcolID const& id2) -> bool { if(id1.COL == id2.COL) return id1.ROW < id2.ROW; return id1.COL < id2.COL; diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx index 095c1d3962dc3d5c3b00ce87ed5b7aafb0b0fa7e..b1f17b0ddccf112ba681b811a4af5adb09e14a94 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/ClusterMakerTool.cxx @@ -15,7 +15,7 @@ #include "SiClusterizationTool/ClusterMakerTool.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetReadoutGeometry/SiLocalPosition.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetPrepRawData/PixelCluster.h" #include "InDetPrepRawData/SCT_Cluster.h" #include "InDetPrepRawData/SiWidth.h" diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx index 68ed5df4bb81210a127d30a8d826f7686b29193f..b45d27041ee7fc0cea0fafa8edc1a6dd2c956075 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/MergedPixelsTool.cxx @@ -15,7 +15,7 @@ #include "Identifier/IdentifierHash.h" #include "InDetRawData/InDetRawDataCollection.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetPrepRawData/SiWidth.h" #include "InDetPrepRawData/PixelClusterParts.h" #include "InDetPrepRawData/PixelCluster.h" diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx index b876e92d01d8fafe02a8b6bb83d80b6bca7859b1..531507c9380d4c67374b0f8da3157c4e549305e9 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/NnClusterizationFactory.cxx @@ -33,7 +33,7 @@ #include "InDetIdentifier/PixelID.h" #include "InDetPrepRawData/PixelCluster.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SiLocalPosition.h" #include "TrkEventPrimitives/ParamDefs.h" diff --git a/InnerDetector/InDetRecTools/SiClusterizationTool/src/PixelGangedAmbiguitiesFinder.cxx b/InnerDetector/InDetRecTools/SiClusterizationTool/src/PixelGangedAmbiguitiesFinder.cxx index 92b98c053dbd7710f0fccb8430493c30235439e6..d422b19340df23ad550cdf90401c9bd1039f9385 100644 --- a/InnerDetector/InDetRecTools/SiClusterizationTool/src/PixelGangedAmbiguitiesFinder.cxx +++ b/InnerDetector/InDetRecTools/SiClusterizationTool/src/PixelGangedAmbiguitiesFinder.cxx @@ -15,7 +15,7 @@ #include "InDetReadoutGeometry/SiCellId.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "GaudiKernel/SmartDataPtr.h" #include "GaudiKernel/MsgStream.h" diff --git a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/CMakeLists.txt b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/CMakeLists.txt index 89609dd5a8ce9870550ad85a209aa5df58a744e7..495f7ee43f4966c09c2bc7a1a38f1e07b3df4e15 100644 --- a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/CMakeLists.txt +++ b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/CMakeLists.txt @@ -11,6 +11,7 @@ atlas_depends_on_subdirs( PUBLIC Control/AthenaKernel GaudiKernel InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetRecTools/InDetRecToolInterfaces MagneticField/MagFieldInterfaces Tracking/TrkDetDescr/TrkGeometry @@ -25,7 +26,7 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_component( SiDetElementsRoadTool_xk src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel InDetReadoutGeometry InDetRecToolInterfaces MagFieldInterfaces TrkGeometry TrkSurfaces AthenaPoolUtilities EventInfo TrkPrepRawData TrkExInterfaces ) + LINK_LIBRARIES AthenaBaseComps AthenaKernel GaudiKernel InDetReadoutGeometry PixelReadoutGeometry InDetRecToolInterfaces MagFieldInterfaces TrkGeometry TrkSurfaces AthenaPoolUtilities EventInfo TrkPrepRawData TrkExInterfaces ) # Install files from the package: atlas_install_headers( SiDetElementsRoadTool_xk ) diff --git a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx index 6a026a6d006588c39a3d90f66e67972806b8c06d..ba4e1274fcab019e96d07a3e9dd99d55addb9bd9 100644 --- a/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx +++ b/InnerDetector/InDetRecTools/SiDetElementsRoadTool_xk/src/SiDetElementsRoadMaker_xk.cxx @@ -16,7 +16,7 @@ #include "SiDetElementsRoadUtils_xk.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "SiDetElementsRoadTool_xk/SiDetElementsComparison.h" #include "SiDetElementsRoadUtils_xk.h" #include "TrkPrepRawData/PrepRawData.h" diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/ATLAS_CHECK_THREAD_SAFETY b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..52eae7bcd56706d5e7b4f519e229b6873787a5ab --- /dev/null +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +InnerDetector/InDetRecTools/TRT_ElectronPidTools diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/BaseTRTPIDCalculator.h b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/BaseTRTPIDCalculator.h index 498b87bf5a14e388e7b7031f28f351fcd0cc697a..4caa3fd4f9d23b72085e49d85f8862cd36cf11d0 100644 --- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/BaseTRTPIDCalculator.h +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/TRT_ElectronPidTools/BaseTRTPIDCalculator.h @@ -66,23 +66,15 @@ namespace InDet // set constants to hard coded defaults virtual void setDefaultCalibrationConstants()=0; - MsgStream& msg (MSG::Level lvl) const { return m_msg << lvl; } - bool msgLvl (MSG::Level lvl) { return m_msg.get().level() <= lvl; } - public: void checkInitialization(); // Fill the data blob from a given pointer bool FillBlob(const unsigned char*); - - //print the blob of data to the screen very verbosely. - void PrintBlob(); // Limit the allowed PID value to lie between a lower and an upper limt float Limit(float prob); - private: - mutable Athena::MsgStreamMember m_msg; }; } diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/BaseTRTPIDCalculator.cxx b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/BaseTRTPIDCalculator.cxx index 34d0e0def5ead33804e930d71c3730b2bebee980..83852efd06bacb738a0766dd407674f48f2a2dc5 100644 --- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/BaseTRTPIDCalculator.cxx +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/BaseTRTPIDCalculator.cxx @@ -19,12 +19,6 @@ // Math functions: #include <cmath> -//STL includes -#include <sstream> - - - - /**************************************************************************** \ |*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| |*%%% BaseTRTPIDCalculator class %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| @@ -32,35 +26,19 @@ |*%%% is implemented here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| |*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*| \*****************************************************************************/ - -void InDet::BaseTRTPIDCalculator::PrintBlob(){ - //Print out the array values that should be entered into the database - ATH_MSG_DEBUG("Now printing the contents of the "<<my_name<<" Calibration Blob, "<<BLOB_SIZE<<" chars"); - ATH_MSG_DEBUG("[ "); - for(int i=0; i < BLOB_SIZE; i++) - ATH_MSG_DEBUG(int(Blob[i])<<", "); - ATH_MSG_DEBUG(" ]"); -} - bool InDet::BaseTRTPIDCalculator::FillBlob(const unsigned char* source){ //Copy the Coral Blob into a local array for(int i=0; i < BLOB_SIZE; i++){ Blob[i]=source[i]; } HasBeenInitialized=1; - return 1; } void InDet::BaseTRTPIDCalculator::checkInitialization(){ if( not HasBeenInitialized ) { - ATH_MSG_DEBUG("The "<<my_name<<"calculator is about to be used uninitialized"); - ATH_MSG_DEBUG("Loading default calibration into memory."); setDefaultCalibrationConstants(); HasBeenInitialized=1; - if (parent.msgLvl(MSG::DEBUG)) { - PrintBlob(); - } } } diff --git a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx index e859139b26b57be2f25799ef3469145de2ffe632..6a48d80715c1517e6b3a5d673ef977166be99282 100644 --- a/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx +++ b/InnerDetector/InDetRecTools/TRT_ElectronPidTools/src/TRT_ElectronPidToolRun2.cxx @@ -146,11 +146,11 @@ InDet::TRT_ElectronPidToolRun2::electronProbability(const Trk::Track& track) con // Get the probability calculator SG::ReadCondHandle<HTcalculator> readHandle{m_HTReadKey}; - HTcalculator* HTcalc = const_cast<HTcalculator*>(*readHandle); + const HTcalculator* HTcalc = (*readHandle); // make sure some calibration is available - if(HTcalc==nullptr) ATH_MSG_WARNING (" No Pid calibration from the DB."); - HTcalc->checkInitialization(); - + if(HTcalc==nullptr) { + ATH_MSG_WARNING (" No Pid calibration from the DB."); + } //Initialize the return vector std::vector<float> PIDvalues(5); diff --git a/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/TRT_SeededSpacePointFinderTool/TRT_SeededSpacePointFinder_ATL.h b/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/TRT_SeededSpacePointFinderTool/TRT_SeededSpacePointFinder_ATL.h index 7713c8d841813c38cebd6593a7a3ff03e50094dc..a5b1878c23188ae4f8ca6fc50698a958e55ba9f7 100755 --- a/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/TRT_SeededSpacePointFinderTool/TRT_SeededSpacePointFinder_ATL.h +++ b/InnerDetector/InDetRecTools/TRT_SeededSpacePointFinderTool/TRT_SeededSpacePointFinderTool/TRT_SeededSpacePointFinder_ATL.h @@ -43,8 +43,7 @@ class SiSpacePointsSeed; namespace InDet{ /** Sorting function according to space point radial position */ - class MyNewDataSortPredicate - : public std::binary_function<std::pair<const Trk::SpacePoint*,int>, std::pair<const Trk::SpacePoint*,int>, bool> { + class MyNewDataSortPredicate { public: bool operator()(std::pair<const Trk::SpacePoint*,int> sp1, std::pair<const Trk::SpacePoint*,int> sp2) const {return (sp1.first)->r() > (sp2.first)->r();} diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/CMakeLists.txt b/InnerDetector/InDetValidation/InDetPerformanceRTT/CMakeLists.txt index c689387483e5a2c9a4168d56932790e1a9d501cd..d0250a0efbfce7566a5dd9a35868b3c709e15aad 100644 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/CMakeLists.txt +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC Generators/GeneratorObjects InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry Tracking/TrkEvent/TrkTrack Tracking/TrkTools/TrkToolInterfaces PRIVATE @@ -40,7 +41,7 @@ atlas_add_component( InDetPerformanceRTT src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${HEPPDT_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} AthenaMonitoringLib StoreGateLib AtlasDetDescr xAODEventInfo GaudiKernel GeneratorObjects InDetIdentifier InDetReadoutGeometry TrkTrack TrkToolInterfaces SGtests GeoPrimitives IdDictDetDescr EventPrimitives InDetPrepRawData InDetRIO_OnTrack JetEvent TrkEventPrimitives TrkTrackSummary TrkTruthData ) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${HEPPDT_LIBRARIES} ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} AthenaMonitoringLib StoreGateLib AtlasDetDescr xAODEventInfo GaudiKernel GeneratorObjects InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry TrkTrack TrkToolInterfaces SGtests GeoPrimitives IdDictDetDescr EventPrimitives InDetPrepRawData InDetRIO_OnTrack JetEvent TrkEventPrimitives TrkTrackSummary TrkTruthData ) # Install files from the package: atlas_install_headers( InDetPerformanceRTT ) diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/IDStandardPerformance.h b/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/IDStandardPerformance.h index c2c139e16e9609c92590ccf1ff12f0b5276b93aa..c5241ac7f648e9293104db5f1319cdd14d932caf 100755 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/IDStandardPerformance.h +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/InDetPerformanceRTT/IDStandardPerformance.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef IDStandardPerformance_H @@ -802,7 +802,7 @@ class IDStandardPerformance : public ManagedMonitorToolBase void fillPixelTrackPullHistos(const Identifier& elementID , const Trk::TrackStateOnSurface* trackState - , const std::auto_ptr<const Trk::ResidualPull>& trackPull + , const std::unique_ptr<const Trk::ResidualPull>& trackPull , const InDetDD::SiDetectorElementCollection* elements); diff --git a/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx b/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx index 733a58f56d3a973f07c1a7af5c57b23d42d25308..11dc76f6b79beb56c45acda1f1e205cf1bc356f0 100755 --- a/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx +++ b/InnerDetector/InDetValidation/InDetPerformanceRTT/src/IDStandardPerformance.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ********************************************************************** @@ -28,7 +28,7 @@ #include "IdDictDetDescr/IdDictManager.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "TrkTruthData/TrackTruth.h" @@ -63,7 +63,7 @@ #include "EventPrimitives/EventPrimitivesHelpers.h" #include "GeoPrimitives/GeoPrimitivesHelpers.h" -using std::auto_ptr; +using std::unique_ptr; using std::string; #define STR(s) STR_EXP(s) @@ -2136,9 +2136,6 @@ IDStandardPerformance::MakeTrackPlots(const DataVector<Trk::Track>* trks, continue; } const Trk::TrackParameters* generatedTrackPerigee = m_truthToTrack->makePerigeeParameters(particle); - // auto_ptr<const Trk::TrackParameters> generatedTrackPerigee(m_truthToTrack->makePerigeeParameters(particle)); - // if (!generatedTrackPerigee.get()) msg(MSG::DEBUG) << "Unable to extrapolate genparticle to perigee!" << endmsg; - // else { if (generatedTrackPerigee){ zVertex+=generatedTrackPerigee->parameters()[Trk::z0]; nPrimaries++; @@ -3015,7 +3012,7 @@ IDStandardPerformance::MakeTrackPlots(const DataVector<Trk::Track>* trks, // V47: Create generated track perigee to cut on truth tracks float track_truth_d0 = 999.; float track_truth_phi = 999.; - auto_ptr<const Trk::TrackParameters> generatedTrackPerigee(m_truthToTrack->makePerigeeParameters(particle)); + unique_ptr<const Trk::TrackParameters> generatedTrackPerigee(m_truthToTrack->makePerigeeParameters(particle)); if (!generatedTrackPerigee.get()) msg(MSG::DEBUG) << "Unable to extrapolate genparticle to perigee!" << endmsg; else { track_truth_d0 = generatedTrackPerigee->parameters()[Trk::d0]; @@ -3648,7 +3645,7 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){ //Trk::Track& nonConstTrack = const_cast<Trk::Track&>(**trksItr); //m_trkSummaryTool->updateTrack(nonConstTrack); //Trk::TrackSummary* summary = new Trk::TrackSummary(*(nonConstTrack.trackSummary())); - auto_ptr<const Trk::TrackSummary> summary(m_trkSummaryTool->createSummary(**trksItr)); + unique_ptr<const Trk::TrackSummary> summary(m_trkSummaryTool->createSummary(**trksItr)); if (msgLvl(MSG::VERBOSE)) { msg() << "Analyze Hit Content using TrackSummary object" << endmsg; @@ -3732,7 +3729,7 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){ // to avoid crashes that sometimes occur for low pt tracks for the hole search tool if (msgLvl(MSG::VERBOSE)) msg() << "Calculate hit efficiencies and residuals for track : pT = " << trkpt << " eta = " << trketa<<endmsg; if (trkpt>0.8) { - auto_ptr<const Trk::Track> trackWithHoles(m_holeSearchTool->getTrackWithHoles(**trksItr)); + unique_ptr<const Trk::Track> trackWithHoles(m_holeSearchTool->getTrackWithHoles(**trksItr)); // Loop over all hits on track DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItr = trackWithHoles->trackStateOnSurfaces()->begin(); @@ -4064,7 +4061,7 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){ Trk::ResidualPull::ResidualType resType = m_isUnbiased ? Trk::ResidualPull::Unbiased : Trk::ResidualPull::Biased; - const auto_ptr<const Trk::ResidualPull> residualPull(m_residualPullCalculator->residualPull(hit, + const std::unique_ptr<const Trk::ResidualPull> residualPull(m_residualPullCalculator->residualPull(hit, trackParameters, resType)); if (m_idHelper->is_pixel(surfaceID)) { @@ -4205,7 +4202,7 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){ //get pixel hits for (; PixtrksItr != PixtrksItrE; ++PixtrksItr) { - auto_ptr<const Trk::Track> trackWithHoles(m_holeSearchTool->getTrackWithHoles(**PixtrksItr)); + unique_ptr<const Trk::Track> trackWithHoles(m_holeSearchTool->getTrackWithHoles(**PixtrksItr)); DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItr = trackWithHoles->trackStateOnSurfaces()->begin(); Identifier SurfaceID; @@ -4296,7 +4293,7 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){ //get SCT tracks for (; SCTtrksItr != SCTtrksItrE; ++SCTtrksItr) { - auto_ptr<const Trk::Track> trackWithHoles(m_holeSearchTool->getTrackWithHoles(**SCTtrksItr)); + unique_ptr<const Trk::Track> trackWithHoles(m_holeSearchTool->getTrackWithHoles(**SCTtrksItr)); DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItr = trackWithHoles->trackStateOnSurfaces()->begin(); Identifier SurfaceID; @@ -4392,7 +4389,7 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){ //get TRT tracks for (; TRTtrksItr != TRTtrksItrE; ++TRTtrksItr) { - auto_ptr<const Trk::Track> trackWithHoles(m_holeSearchTool->getTrackWithHoles(**TRTtrksItr)); + unique_ptr<const Trk::Track> trackWithHoles(m_holeSearchTool->getTrackWithHoles(**TRTtrksItr)); DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItr = trackWithHoles->trackStateOnSurfaces()->begin(); Identifier SurfaceID; @@ -4518,7 +4515,7 @@ void IDStandardPerformance::MakeHitPlots(const DataVector<Trk::Track>* trks){ - auto_ptr<const Trk::Track> trackWithHoles(m_holeSearchTool->getTrackWithHoles(**trksItr)); + unique_ptr<const Trk::Track> trackWithHoles(m_holeSearchTool->getTrackWithHoles(**trksItr)); DataVector<const Trk::TrackStateOnSurface>::const_iterator TSOSItr = trackWithHoles->trackStateOnSurfaces()->begin(); Identifier SurfaceID; const Trk::Perigee* startPerigee = (*trksItr)->perigeeParameters(); @@ -4808,7 +4805,7 @@ void IDStandardPerformance::SetSafeMinimumMaximum(TH1* h, float min, float max) void IDStandardPerformance::fillPixelTrackPullHistos(const Identifier& elementID , const Trk::TrackStateOnSurface* trackState - , const auto_ptr<const Trk::ResidualPull>& trackPull + , const std::unique_ptr<const Trk::ResidualPull>& trackPull , const InDetDD::SiDetectorElementCollection* elements) { if (not m_idHelper->is_pixel(elementID)) { diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py index 548eb79e08e07e09a84586f18613baf1668c1592..4acf38e25b51969ef0d0749260105a0d701576fa 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValJobProperties.py @@ -47,7 +47,7 @@ class InDetPhysValFlagsJobProperty(JobProperty): class doValidateDBMTracks(InDetPhysValFlagsJobProperty): statusOn = True allowedTypes = ['bool'] - StoredValue = True + StoredValue = False class doValidateGSFTracks(InDetPhysValFlagsJobProperty): statusOn = True diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py index 6baa14421efe264b4111eecd5c15d74547819df5..9d51b84a99c071653da7e249dba836a6ff21d2e6 100644 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/python/InDetPhysValMonitoringTool.py @@ -71,15 +71,18 @@ def getInDetPhysValMonitoringTool(**kwargs) : jetContainerName ='', FillTrackInJetPlots = False) - # hack to remove example phyval monitor + # hack to remove example physval monitor from RecExConfig.AutoConfiguration import IsInInputFile if not IsInInputFile('xAOD::JetContainer','AntiKt4EMTopoJets') : add_remover=True from RecExConfig.RecFlags import rec - for elm in rec.UserExecs : - if elm.find('removePhysValExample')>0 : - add_remover=False - break + try: + for elm in rec.UserExecs : + if elm.find('removePhysValExample')>0 : + add_remover=False + break + except: + pass if add_remover : rec.UserExecs += ['from InDetPhysValMonitoring.InDetPhysValMonitoringTool import removePhysValExample;removePhysValExample();'] diff --git a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarsimreco.sh b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarsimreco.sh index 2d8a5da22d0fda387b58216a0f8146cac15d2de9..dac9586ec6e7f52de119ad12c1772f7b73f173ee 100755 --- a/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarsimreco.sh +++ b/InnerDetector/InDetValidation/InDetPhysValMonitoring/test/test_ttbarsimreco.sh @@ -130,7 +130,7 @@ if [ $dorec -ne 0 ]; then InDetFlags.doSlimming.set_Value_and_Lock(False); rec.doTrigger.set_Value_and_Lock(False); \ from InDetPhysValMonitoring.InDetPhysValJobProperties import InDetPhysValFlags; \ InDetPhysValFlags.doValidateTightPrimaryTracks.set_Value_and_Lock(True); \ - InDetPhysValFlags.doValidateTracksInJets.set_Value_and_Lock(True); \ + InDetPhysValFlags.doValidateTracksInJets.set_Value_and_Lock(False); \ InDetPhysValFlags.doValidateGSFTracks.set_Value_and_Lock(False); \ rec.doDumpProperties=True; rec.doCalo=False; rec.doEgamma=False; \ rec.doForwardDet=False; rec.doInDet=True; rec.doJetMissingETTag=False; \ diff --git a/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx b/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx index 46d05289e7f0e860ebb160b240319f1dee3dd9fb..9d57d79fa5445e2884179a4354b707bbc5b0c9fa 100755 --- a/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx +++ b/InnerDetector/InDetValidation/InDetRecStatistics/src/InDetRecStatisticsAlg.cxx @@ -761,8 +761,10 @@ void InDet :: InDetRecStatisticsAlg :: printStatistics() { for (std::vector <class TrackStatHelper *>::const_iterator collection = m_SignalCounters.begin(); collection != m_SignalCounters.end(); collection++) { - out << "\n" << s_linestr2 << "\n"; - (*collection)->print(out); + if ((*collection)->key()=="CombinedInDetTracks"){ + out << "\n" << s_linestr2 << "\n"; + (*collection)->print(out); + } } if (m_UseTrackSummary) { @@ -814,8 +816,10 @@ void InDet :: InDetRecStatisticsAlg :: printStatistics() { for (std::vector <class TrackStatHelper *>::const_iterator collection = m_SignalCounters.begin(); collection != m_SignalCounters.end(); collection++) { - out << "\n" << s_linestr2 << "\n"; - (*collection)->printSecondary(out); + if ((*collection)->key()=="CombinedInDetTracks"){ + out << "\n" << s_linestr2 << "\n"; + (*collection)->printSecondary(out); + } } } } @@ -833,7 +837,9 @@ void InDet :: InDetRecStatisticsAlg ::printTrackSummary (MsgStream &out, enum et for (std::vector <class TrackStatHelper *>::const_iterator collection = m_SignalCounters.begin(); collection != m_SignalCounters.end(); collection++) { - printed = (*collection)->printTrackSummaryRegion(out, TRACK_ALL, eta_reg) || printed; + if ((*collection)->key()=="CombinedInDetTracks"){ + printed = (*collection)->printTrackSummaryRegion(out, TRACK_ALL, eta_reg) || printed; + } } if (printed) { out << "\n" @@ -843,7 +849,9 @@ void InDet :: InDetRecStatisticsAlg ::printTrackSummary (MsgStream &out, enum et for (std::vector <class TrackStatHelper *>::const_iterator collection = m_SignalCounters.begin(); collection != m_SignalCounters.end(); collection++) { - printed = (*collection)->printTrackSummaryRegion(out, TRACK_LOWTRUTHPROB, eta_reg) || printed; + if ((*collection)->key()=="CombinedInDetTracks"){ + printed = (*collection)->printTrackSummaryRegion(out, TRACK_LOWTRUTHPROB, eta_reg) || printed; + } } if (printed) { out << "\n" @@ -852,7 +860,9 @@ void InDet :: InDetRecStatisticsAlg ::printTrackSummary (MsgStream &out, enum et for (std::vector <class TrackStatHelper *>::const_iterator collection = m_SignalCounters.begin(); collection != m_SignalCounters.end(); collection++) { - (*collection)->printTrackSummaryRegion(out, TRACK_LOWTRUTHPROB2, eta_reg); + if ((*collection)->key()=="CombinedInDetTracks"){ + (*collection)->printTrackSummaryRegion(out, TRACK_LOWTRUTHPROB2, eta_reg); + } } } diff --git a/LArCalorimeter/LArCalibUtils/python/GetCoolChannelSelection.py b/LArCalorimeter/LArCalibUtils/python/GetCoolChannelSelection.py index f389910983687e0d4c8a50adb69383fe78de56ba..164c5e480d9ec16e370063a2864dcc82185e0140 100644 --- a/LArCalorimeter/LArCalibUtils/python/GetCoolChannelSelection.py +++ b/LArCalorimeter/LArCalibUtils/python/GetCoolChannelSelection.py @@ -1,10 +1,10 @@ # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - +from __future__ import print_function def GetCoolChannelSelection(partition, gain, withPS): if (gain<0 or gain>3): - print "ERROR Gain out of range: ", gain + print ("ERROR Gain out of range: ", gain) return "" AccList=[] PSList=[] @@ -15,7 +15,7 @@ def GetCoolChannelSelection(partition, gain, withPS): elif (gain==2): g=475 else: - print "ERROR Gain out of range: ", gain + print("ERROR Gain out of range: ", gain) return "" retString="" if (partition=="EMBA"): diff --git a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArShapeSubsetCnv_p2.cxx b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArShapeSubsetCnv_p2.cxx index 0c9921bc0127cf67d64678130fd69c971edbfc80..f4287b67afbbe547c4d79ede90af955b83c50359 100644 --- a/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArShapeSubsetCnv_p2.cxx +++ b/LArCalorimeter/LArCnv/LArCondTPCnv/src/LArShapeSubsetCnv_p2.cxx @@ -90,7 +90,16 @@ LArShapeSubsetCnv_p2::persToTrans(const LArShapePersType2* persObj, dataIndex += nPhases * nSamples; } else { - (*subsetIt).second[j].assign (LArShapeP2()); + if (timeIndex > 0) { + (*subsetIt).second[j].assign + (LArShapeP2(persObj->m_timeOffset[timeIndex-1], + persObj->m_timeBinWidth[timeIndex-1], + std::vector<std::vector<float> >(), + std::vector<std::vector<float> >())); + } + else { + (*subsetIt).second[j].assign (LArShapeP2()); + } } } } diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/python/TimeStampToRunLumi.py b/LArCalorimeter/LArExample/LArCalibProcessing/python/TimeStampToRunLumi.py index bac3fa8ae26e08479c72b315b6fb71e39832de81..35ae357c7d634d9e8e7382444b5b407a2f0dbde5 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/python/TimeStampToRunLumi.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/python/TimeStampToRunLumi.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration def TimeStampToRunLumi(tmstmp,guard=1,dbInstance="CONDBR2"): from PyCool import cool @@ -12,17 +12,17 @@ def TimeStampToRunLumi(tmstmp,guard=1,dbInstance="CONDBR2"): itr=folder.browseObjects(t1,t2,cool.ChannelSelection.all()) while itr.goToNext(): obj=itr.currentRef() - #print "Working on obj.until() =",asctime(localtime(obj.until()/1e9)) + #print ("Working on obj.until() =",asctime(localtime(obj.until()/1e9)) ) if obj.until()>tmstmp: pl=obj.payload() run=pl["Run"] lb=pl["LumiBlock"] - print "Found Run/Lumi [%i/%i] lasting from %s to %s" %\ - (run,lb,asctime(localtime(obj.since()/1e9)),asctime(localtime(obj.until()/1e9))) + print ("Found Run/Lumi [%i/%i] lasting from %s to %s" %\ + (run,lb,asctime(localtime(obj.since()/1e9)),asctime(localtime(obj.until()/1e9)))) itr.close() db.closeDatabase() return (run,lb) - print "WARNING: No run/lumi block found for time",asctime(localtime(tmstmp/1e9)),"in folder /TRIGGER/LUMI/LBTIME of DB COOLONL_TRIGGER/CONDBR2" + print ("WARNING: No run/lumi block found for time",asctime(localtime(tmstmp/1e9)),"in folder /TRIGGER/LUMI/LBTIME of DB COOLONL_TRIGGER/CONDBR2") itr.close() db.closeDatabase() return None diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/python/extractFolderInfo.py b/LArCalorimeter/LArExample/LArCalibProcessing/python/extractFolderInfo.py index 96d0f0c181bf75e7f7a5bc33302f485ab11a0859..450f8f078ada7cf05ab643a2b50f9efbf308638c 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/python/extractFolderInfo.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/python/extractFolderInfo.py @@ -1,6 +1,6 @@ #!/bin/env python -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from PyCool import cool @@ -8,13 +8,13 @@ def extractFolderInfo(dbname,globaltag="",checkFolders=[],runnumber=cool.Validit dbSvc = cool.DatabaseSvcFactory.databaseService() try: db= dbSvc.openDatabase(dbname) - except Exception,e: - print "Problems connecting to database:",e + except Exception as e: + print ("Problems connecting to database:",e) return None #Set up Channel Selection: sel=None - print selection + print (selection) ss=selection.split(",") for s in ss: if len(s)==0:continue @@ -25,14 +25,14 @@ def extractFolderInfo(dbname,globaltag="",checkFolders=[],runnumber=cool.Validit else: c1=cool.ChannelId(int(s[:idx])) c2=cool.ChannelId(int(s[1+idx:])) - #print "ExtractFolderInfo: Add channel range",c1,"to",c2 + #print ("ExtractFolderInfo: Add channel range",c1,"to",c2) if sel is None: sel=cool.ChannelSelection(c1,c2,cool.ChannelSelection.sinceBeforeChannel); else: sel.addRange(c1,c2); if sel is None: - print "ExtractFolderInfo: No COOL channel selection given, work on all channels" + print ("ExtractFolderInfo: No COOL channel selection given, work on all channels") sel=cool.ChannelSelection.all() @@ -52,7 +52,7 @@ def extractFolderInfo(dbname,globaltag="",checkFolders=[],runnumber=cool.Validit if not takeFolder: continue f=db.getFolder(fn) - print "Analyzing",fn + print ("Analyzing",fn) #Parse Folder description: #Model: #<timeStamp>run-lumi</timeStamp><symlinks>ILArAutoCorr</symlinks><key>LArAutoCorr</key><addrHeader><address_header service_type="71" clid="255786016" /></addrHeader><typeName>LArAutoCorrComplete</typeName> - @@ -61,7 +61,7 @@ def extractFolderInfo(dbname,globaltag="",checkFolders=[],runnumber=cool.Validit i1=descr.find("<typeName>")+len("<typeName>") i2=descr.find("</typeName>",i1) if (i1==-1 or i2==-1): - print "ERROR could not get typename of object stored in folder",fn + print ("ERROR could not get typename of object stored in folder",fn) continue typename=descr[i1:i2] @@ -69,7 +69,7 @@ def extractFolderInfo(dbname,globaltag="",checkFolders=[],runnumber=cool.Validit i1=descr.find("<key>")+len("<key>") i2=descr.find("</key>",i1) if (i1==-1 or i2==-1): - print "ERROR could not get SG key of object stored in folder",fn + print ("ERROR could not get SG key of object stored in folder",fn) continue key=descr[i1:i2] @@ -83,7 +83,7 @@ def extractFolderInfo(dbname,globaltag="",checkFolders=[],runnumber=cool.Validit try: tagList=[f.resolveTag(globaltag)] except Exception: - print "Hierachical tag", globaltag,"not defined in folder",fn + print ("Hierachical tag", globaltag,"not defined in folder",fn) return None for t in tagList: @@ -96,7 +96,7 @@ def extractFolderInfo(dbname,globaltag="",checkFolders=[],runnumber=cool.Validit #payload=obj.payload() since=obj.since()>>32 until=obj.until()>>32 - #print fn,t,since,until + #print (fn,t,since,until) if minIOV>since: minIOV=since if maxIOV<until: maxIOV=until itr.close() @@ -113,4 +113,4 @@ def extractFolderInfo(dbname,globaltag="",checkFolders=[],runnumber=cool.Validit #x=extractFolderInfo("sqlite://;schema=/scratch/wlampl/DBwrites/Sep13AllCalo_v2/freshConstants.db;dbname=COMP200") #for i in x: -# print i +# print (i) diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/python/extractOFCFlavor.py b/LArCalorimeter/LArExample/LArCalibProcessing/python/extractOFCFlavor.py index c779f5262f40e145ed37a650d5a6f98cfa21831c..12049a70df4eed9f9f44c02909d00785440bc4fc 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/python/extractOFCFlavor.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/python/extractOFCFlavor.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #!/bin/env python from PyCool import cool @@ -13,8 +13,8 @@ def getOFCFlavor(): dbSvc = cool.DatabaseSvcFactory.databaseService() try: db= dbSvc.openDatabase("COOLONL_LAR/CONDBR2") - except Exception,e: - print "ERROR: Problems connecting to database:",e + except Exception as e: + print ("ERROR: Problems connecting to database:",e) return None if db.existsFolder(onlineOFCFolder): @@ -23,13 +23,13 @@ def getOFCFlavor(): currObj=pFldr.findObject(cool.ValidityKeyMax-1,0) #Check only high gain pl=currObj.payload() curr_nsamples=pl["nSamples"] - except Exception,e: - print "Failed to extract data from online OFC folder" - print e + except Exception as e: + print ("Failed to extract data from online OFC folder") + print (e) curr_nsamples=None pass else: - print "ERROR: Folder",onlineOFCFolder,"doesn't exist!" + print ("ERROR: Folder",onlineOFCFolder,"doesn't exist!") curr_nsamples=None pass @@ -47,9 +47,9 @@ def getOFCFlavor(): try: pFldr=db.getFolder(offlineOFCFolder) ofctaglist=pFldr.listTags() - except Exception,e: - print "Failed to extract data from offline database" - print e + except Exception as e: + print ("Failed to extract data from offline database") + print (e) pass for t in ofctaglist: @@ -61,20 +61,20 @@ def getOFCFlavor(): try: currentOFCOption=(offlineOFCFolder,pFldr.resolveTag("LARCALIB-RUN2-00")) except: - print "Could not resolve global tag in folder ",offlineOFCFolder + print ("Could not resolve global tag in folder ",offlineOFCFolder) pass pass pass #end if "%isamples1phase pass #end if curr_nsamples is not None: else: - print "Folder",offlineOFCFolder,"does not exist" + print ("Folder",offlineOFCFolder,"does not exist") pass pass - print "Current number of samples:", curr_nsamples + print ("Current number of samples:", curr_nsamples) - print "OFC flavor for production [%s]: " % currentOFCOption[1] + print ("OFC flavor for production [%s]: " % currentOFCOption[1]) if "mu" in currentOFCOption[1]: return 20 @@ -89,9 +89,9 @@ if __name__=="__main__": ofcForOnline=getOFCFlavor() if ofcForOnline is None: - print "Failed to get OFC/Shapes for online database" + print ("Failed to get OFC/Shapes for online database") else: - print "Mu: ",ofcForOnline + print ("Mu: ",ofcForOnline) diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/GetInputFiles.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/GetInputFiles.py index 8dcf81997fedb111f3fc345d035e956c0c5f3cb6..18ce75a273884fa046f3a976b4434f4e2ad18a66 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/GetInputFiles.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/GetInputFiles.py @@ -1,7 +1,7 @@ from os import popen def GetInputFiles(inputPath,filePattern): - print "Searching for files with pattern '",filePattern,"' in ",inputPath + printfunc ("Searching for files with pattern '",filePattern,"' in ",inputPath) fileList=[] if (inputPath[0:8]=='/castor/'): cmd='nsls' @@ -19,7 +19,7 @@ def GetInputFiles(inputPath,filePattern): fileList+=['root://eosatlas.cern.ch/'+inputPath+'/'+f] else: fileList+=[inputPath+'/'+f] - print "Found ",len(fileList), " files" + printfunc ("Found ",len(fileList), " files") return fileList diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ApplyShapeResiduals_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ApplyShapeResiduals_jobOptions.py index d27957b6d232d43bfb8c6ab8b9a0db0a6bfe68f9..4a8c5c0fea29f4f3547ec33f4d43f5da24248537 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ApplyShapeResiduals_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ApplyShapeResiduals_jobOptions.py @@ -29,7 +29,7 @@ if os.environ.has_key("CALIBMERGE_PEEKRUN"): else: peekrun=2147483647 -print "Peeking input database at run",peekrun +printfunc ("Peeking input database at run",peekrun) if not "ShapeFolder" in dir(): ShapeFolder="/LAR/ElecCalibOfl/Shape/RTM/5samples1phase" @@ -44,7 +44,7 @@ else: shapeResidualTag="" folderInfo=extractFolderInfo(inputDB,checkFolders=[ShapeFolder,],runnumber=peekrun) -print folderInfo +printfunc (folderInfo) import AthenaCommon.AtlasUnixGeneratorJob #use MC event selector @@ -64,12 +64,12 @@ svcMgr.PoolSvc.FileOpen="update" runNoForFileName=2147483647 if len(folderInfo)==0: - print "ERROR, No input shape found in input db",inputDB,"folder",ShapeFolder + printfunc ("ERROR, No input shape found in input db",inputDB,"folder",ShapeFolder) sys.exit(-1) pass if len(folderInfo)>1: - print "WARNING, More than one input shape object found in input db",inputDB,"folder",ShapeFolder + printfunc ("WARNING, More than one input shape object found in input db",inputDB,"folder",ShapeFolder) pass f=folderInfo[0] @@ -79,7 +79,7 @@ key=f[2] tag=f[3] since=f[4] until=f[5] -print "Working on folder",fn,"IOV:",since,"-",until +printfunc ("Working on folder",fn,"IOV:",since,"-",until) tagTokens=tag.split('-') tagTokens[0]+="corr" @@ -100,8 +100,8 @@ svcMgr.EventSelector.RunNumber = peekrun if "OutputFile" not in dir(): OutputFile="LArConditionsRec_"+str(runNoForFileName)+".pool.root" -print outObjects -print outTags +printfunc (outObjects) +printfunc (outTags) from LArCalibTools.LArCalibToolsConf import LArBlockCorrections topSequence+=LArBlockCorrections() diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CaliWaveMerger_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CaliWaveMerger_jobOptions.py index 3da6905ce19bcc18811ec80bac877c07033b6bfd..112be1dae9ddf1e64b351e07ae2cd040c10acab6 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CaliWaveMerger_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_CaliWaveMerger_jobOptions.py @@ -9,11 +9,11 @@ ########################################################################### if not 'PoolFileList' in dir(): - print "Please provide a PoolFileList!" + printfunc ("Please provide a PoolFileList!") theApp.exit() if not 'ContainerKeyList' in dir(): - print "Please provide a ContainerKeyList!" + printfunc ("Please provide a ContainerKeyList!") theApp.exit() if not 'PoolFileDir' in dir(): diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DelayXtalk_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DelayXtalk_jobOptions.py index f1b483550a06de72026a6aa4c7e041dda7a37716..ebca655d996c1649e3b2f36f1bc64d13e166f2cb 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DelayXtalk_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DelayXtalk_jobOptions.py @@ -1,4 +1,7 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess + ########################################################################### # @@ -180,7 +183,7 @@ if not 'PedRunNumber' in dir(): PedRunNumber = "1005020_1005021_1005022" if not 'InputPedPoolFileDir' in dir(): - InputPedPoolFileDir = commands.getoutput("pwd") + InputPedPoolFileDir = subprocess.getoutput("pwd") if not 'InputPedPoolFileName' in dir(): InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber)+"_"+Partition.replace("*","") + ".pool.root" @@ -191,10 +194,10 @@ if not 'LArCalibFolderOutputTag' in dir(): LArCalibFolderOutputTag = LArCalib_Flags.tagSuffix if not 'OutputCaliWaveRootFileDir' in dir(): - OutputCaliWaveRootFileDir = commands.getoutput("pwd") + OutputCaliWaveRootFileDir = subprocess.getoutput("pwd") if not 'OutputCaliWavePoolFileDir' in dir(): - OutputCaliWavePoolFileDir = commands.getoutput("pwd") + OutputCaliWavePoolFileDir = subprocess.getoutput("pwd") if not 'OutputDB' in dir(): OutputDB = LArCalib_Flags.OutputDB @@ -354,7 +357,7 @@ if ( len(PoolFileList)>0 ): PartitionPulsed = SubDet + Side # Partition should be BarrelA or BarrelC or EndcapA or EndcapC if not (PartitionPulsed=="BarrelA" or PartitionPulsed=="BarrelC" or PartitionPulsed=="EndcapA" or PartitionPulsed=="EndcapC"): - print "[Xtalk JobOptions] Error: PartitionPulsed="+PartitionPulsed+". It should be BarrelA or BarrelC or EndcapA or EndcapC" + printfunc ("[Xtalk JobOptions] Error: PartitionPulsed="+PartitionPulsed+". It should be BarrelA or BarrelC or EndcapA or EndcapC") theApp.exit(-1) from LArCalibUtils.LArCalibUtilsConf import LArCaliWaveBuilderXtalk @@ -374,7 +377,7 @@ LArCaliWaveBuilderXtalk.FeedthroughPul = FeedthroughPul # Used to check calibra LArCaliWaveBuilderXtalk.CutOnSample = CutOnSample # Cut on the number of read samples (usualy 32) to save memory if 'Ramp' in FullFileName: # for ramp runs : only one step (ie. no delay) - print "[Xtalk JobOptions] Ramp run detected: set LArCaliWaveBuilderXtalk.NSteps to 1" + printfunc ("[Xtalk JobOptions] Ramp run detected: set LArCaliWaveBuilderXtalk.NSteps to 1") LArCaliWaveBuilderXtalk.NSteps = 1 topSequence+=LArCaliWaveBuilderXtalk diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py index 001f622a700bad4426facb5b3fef7223c02888da..36b4e78a1013e4c2e5ab149e9a4e5880581a480c 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_Cali_jobOptions.py @@ -6,7 +6,9 @@ # - usePatt - if <0 all patterns, if <0,15> or <0,13> if EMEC, fill only those pattern # - numPatt - either 16 for EMB or 14 for EMEC (with standard configuration) -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -218,14 +220,14 @@ if not 'ReadPedFromCOOL' in dir(): ReadPedFromCOOL = True if not 'InputPedPoolFileDir' in dir(): - InputPedPoolFileDir = commands.getoutput("pwd") + InputPedPoolFileDir = subprocess.getoutput("pwd") ## AutoCorr if not 'ReadAutoCorrFromCOOL' in dir(): ReadAutoCorrFromCOOL = True if not 'InputAutoCorrPoolDir' in dir(): - InputAutoCorrPoolDir = commands.getoutput("pwd") + InputAutoCorrPoolDir = subprocess.getoutput("pwd") ## Output if 'dbname' in dir(): @@ -249,10 +251,10 @@ if doOFC and not 'LArCalibOFCFolderOutputTag' in dir(): del rs #Close database if not 'OutputRootFileDir' in dir(): - OutputRootFileDir = commands.getoutput("pwd") + OutputRootFileDir = subprocess.getoutput("pwd") if not 'OutputPoolFileDir' in dir(): - OutputPoolFileDir = commands.getoutput("pwd") + OutputPoolFileDir = subprocess.getoutput("pwd") if not 'OutputDB' in dir(): OutputDB = LArCalib_Flags.OutputDB @@ -600,7 +602,7 @@ except: #except: # iovtemp=1283145454 -#print "Setting timestamp for run ",RunNumberList[0]," to ",iovtemp +#printfunc ("Setting timestamp for run ",RunNumberList[0]," to ",iovtemp) #svcMgr.IOVDbSvc.forceTimestamp = 1283145454 #svcMgr.IOVDbSvc.forceTimestamp = iovtemp diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_splitter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_splitter_jobOptions.py index cf14e0cab36853e24ad6e2980b76c998540b6622..00ddca51be42780557d793694b74bb10686bd0da 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_splitter_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_OFC_splitter_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -154,7 +156,7 @@ if not 'PedRunNumber' in dir(): PedRunNumber = "1005020_1005021_1005022" if not 'InputPedPoolFileDir' in dir(): - InputPedPoolFileDir = commands.getoutput("pwd") + InputPedPoolFileDir = subprocess.getoutput("pwd") if not 'InputPedPoolFileName' in dir(): InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber)+"_"+Partition.replace("*","") + ".pool.root" @@ -165,10 +167,10 @@ if not 'LArCalibFolderOutputTag' in dir(): LArCalibFolderOutputTag = '-UPD3-00' if not 'OutputCaliWaveRootFileDir' in dir(): - OutputCaliWaveRootFileDir = commands.getoutput("pwd") + OutputCaliWaveRootFileDir = subprocess.getoutput("pwd") if not 'OutputCaliWavePoolFileDir' in dir(): - OutputCaliWavePoolFileDir = commands.getoutput("pwd") + OutputCaliWavePoolFileDir = subprocess.getoutput("pwd") if not 'OutputDB' in dir(): OutputDB = LArCalib_Flags.OutputDB @@ -310,13 +312,13 @@ if not 'ReadAutoCorrFromCOOL' in dir(): ########################################################################### if not 'OutputOFCRootFileDir' in dir(): - OutputOFCRootFileDir = commands.getoutput("pwd") + OutputOFCRootFileDir = subprocess.getoutput("pwd") if not 'OutputOFCPoolFileDir' in dir(): - OutputOFCPoolFileDir = commands.getoutput("pwd") + OutputOFCPoolFileDir = subprocess.getoutput("pwd") if not 'OutputShapePoolFileDir' in dir(): - OutputShapePoolFileDir = commands.getoutput("pwd") + OutputShapePoolFileDir = subprocess.getoutput("pwd") OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","") diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_jobOptions.py index 12a3f04cacdb7e095ab3a37bb910e5fd8f4b9ca9..55e57ea4d299dd096d22440b614bde7f5d630f9c 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -146,7 +148,7 @@ if not 'PedRunNumber' in dir(): PedRunNumber = "1005020_1005021_1005022" if not 'InputPedPoolFileDir' in dir(): - InputPedPoolFileDir = commands.getoutput("pwd") + InputPedPoolFileDir = subprocess.getoutput("pwd") if not 'InputPedPoolFileName' in dir(): InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber)+"_"+Partition.replace("*","") + ".pool.root" @@ -160,10 +162,10 @@ if not 'LArCalibFolderOutputTag' in dir(): if not 'OutputCaliWaveRootFileDir' in dir(): - OutputCaliWaveRootFileDir = commands.getoutput("pwd") + OutputCaliWaveRootFileDir = subprocess.getoutput("pwd") if not 'OutputCaliWavePoolFileDir' in dir(): - OutputCaliWavePoolFileDir = commands.getoutput("pwd") + OutputCaliWavePoolFileDir = subprocess.getoutput("pwd") if not 'OutputDB' in dir(): OutputDB = LArCalib_Flags.OutputDB diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_splitter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_splitter_jobOptions.py index ca4fcb137928582e5dae728c551639a46ecd3f43..2169546e74664be818a4656d41552e7080301d91 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_splitter_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Delay_splitter_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -154,7 +156,7 @@ if not 'PedRunNumber' in dir(): PedRunNumber = "1005020_1005021_1005022" if not 'InputPedPoolFileDir' in dir(): - InputPedPoolFileDir = commands.getoutput("pwd") + InputPedPoolFileDir = subprocess.getoutput("pwd") if not 'InputPedPoolFileName' in dir(): InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber)+"_"+Partition.replace("*","") + ".pool.root" @@ -166,10 +168,10 @@ if not 'LArCalibFolderOutputTag' in dir(): LArCalibFolderOutputTag = rs.getFolderTagSuffix(LArCalib_Flags.LArCaliWaveFolder) if not 'OutputCaliWaveRootFileDir' in dir(): - OutputCaliWaveRootFileDir = commands.getoutput("pwd") + OutputCaliWaveRootFileDir = subprocess.getoutput("pwd") if not 'OutputCaliWavePoolFileDir' in dir(): - OutputCaliWavePoolFileDir = commands.getoutput("pwd") + OutputCaliWavePoolFileDir = subprocess.getoutput("pwd") if not 'OutputDB' in dir(): OutputDB = LArCalib_Flags.OutputDB diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DigitAccumulator_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DigitAccumulator_jobOptions.py index 155e8cb5721a0007f35d3edc6561ea5ef1844e1c..75772be30e5b4c0b5e9c1df43e03dafe87ecbdf8 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DigitAccumulator_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_DigitAccumulator_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ############################################################################### # @@ -58,7 +60,7 @@ if not 'GainListAccum' in dir(): for i in GainList: newKey=i+KeyOutputAccum GainListAccum.append(newKey) - print "GainListAccum = ",GainListAccum + printfunc ("GainListAccum = ",GainListAccum) if not 'GroupingType' in dir(): GroupingType = "ExtendedSubDetector" @@ -135,16 +137,16 @@ if not 'DBConnectionCOOL' in dir(): DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=CONDBR2;" if not 'OutputPedAutoCorrRootFileDir' in dir(): - OutputPedAutoCorrRootFileDir = commands.getoutput("pwd") + OutputPedAutoCorrRootFileDir = subprocess.getoutput("pwd") if not 'OutputPedPoolFileDir' in dir(): - OutputPedPoolFileDir = commands.getoutput("pwd") + OutputPedPoolFileDir = subprocess.getoutput("pwd") if not 'PedLArCalibFolderTag' in dir(): PedLArCalibFolderTag = LArCalib_Flags.tagSuffix if not 'OutputAutoCorrPoolFileDir' in dir(): - OutputAutoCorrPoolFileDir = commands.getoutput("pwd") + OutputAutoCorrPoolFileDir = subprocess.getoutput("pwd") if not 'OutputDB' in dir(): OutputDB = LArCalib_Flags.OutputDB @@ -333,7 +335,7 @@ if ( WriteNtuple ) : topSequence += NtupleDSP - print NtupleDSP + printfunc (NtupleDSP) if Accumulator : from LArCalibTools.LArCalibToolsConf import LArAccumulatedDigits2Ntuple @@ -345,7 +347,7 @@ if ( WriteNtuple ) : topSequence += NtupleOff - print NtupleOff + printfunc (NtupleOff) theApp.HistogramPersistency = "ROOT" from GaudiSvc.GaudiSvcConf import NTupleSvc diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge.py index 4f38f2a99c70bb10ea669b7fc26a3f5c68c52bfa..aa060d9e91556229071d274587f2242b8aef59c5 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge.py @@ -29,7 +29,7 @@ if os.environ.has_key("CALIBMERGE_PEEKRUN"): else: peekrun=2147483647 -print "Peeking input database at run",peekrun +printfunc ("Peeking input database at run",peekrun) folderInfo=extractFolderInfo(inputDB,runnumber=peekrun) @@ -91,13 +91,13 @@ for f in folderInfo: tag=f[3] since=f[4] until=f[5] - print "Working on folder",fn,"Tag",tag,"Type",type,"Key",key#,"IOV:",since,"-",until + printfunc ("Working on folder",fn,"Tag",tag,"Type",type,"Key",key#,"IOV:",since,"-",until) if sgKeys.has_key(type): if key in sgKeys[type]: - print "StoreGate key",key,"appeared multiple times for type",type, + printfunc ("StoreGate key",key,"appeared multiple times for type",type,) key=key+str(len(sgKeys[type])) - print "Changed to",key + printfunc ("Changed to",key) pass sgKeys[type].append(key) pass @@ -132,26 +132,26 @@ svcMgr.EventSelector.RunNumber = peekrun OutputFileRec="LArConditionsRec_"+str(runNoForFileName)+".pool.root" if os.access(OutputFileRec,os.F_OK): - print "File",OutputFileRec,"exists already, removing ...." + printfunc ("File",OutputFileRec,"exists already, removing ....") os.remove(OutputFileRec) OutputFileCalib="LArConditionsCalib_"+str(runNoForFileName)+".pool.root" if os.access(OutputFileCalib,os.F_OK): - print "File",OutputFileCalib,"exists already, removing ...." + printfunc ("File",OutputFileCalib,"exists already, removing ....") os.remove(OutputFileCalib) -print svcMgr.IOVDbSvc.Folders +printfunc (svcMgr.IOVDbSvc.Folders) -print "============ Reco =============" -print outObjectsRec -print outTagsRec -print "============ Calib =============" -print outObjectsCalib -print outTagsCalib +printfunc ("============ Reco =============") +printfunc (outObjectsRec) +printfunc (outTagsRec) +printfunc ("============ Calib =============") +printfunc (outObjectsCalib) +printfunc (outTagsCalib) if len(outObjectsRec)==0 and len(outObjectsCalib)==0: - print "Nothing to do, exiting" + printfunc ("Nothing to do, exiting") sys.exit(0) from LArCalibTools.LArCalibToolsConf import LArBlockCorrections diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge_SV.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge_SV.py index f5e0a9e5da12b5bafa073de6bc125bbdb1c14980..7b78cf859a7ca6f7d5d34c1d469dcc29129ab310 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge_SV.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_ConditionsMerge_SV.py @@ -71,15 +71,15 @@ svcMgr.EventSelector.RunNumber = 2147483647 OutputFileOFC="LArConditionsOFC_"+str(runNoForFileName)+".pool.root" if os.access(OutputFileOFC,os.F_OK): - print "File",OutputFileOFC,"exists already, removing ...." + printfunc ("File",OutputFileOFC,"exists already, removing ....") os.remove(OutputFileOFC) -print svcMgr.IOVDbSvc.Folders +printfunc (svcMgr.IOVDbSvc.Folders) -print "============ Single bin OFC =============" -print outObjectsOFC -print outTagsOFC +printfunc ("============ Single bin OFC =============") +printfunc (outObjectsOFC) +printfunc (outTagsOFC) from LArCalibTools.LArCalibToolsConf import LArBlockCorrections topSequence+=LArBlockCorrections() diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_HVCorr.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_HVCorr.py index 68bc4bdce8eb196f31f787daf73067d8b683ce47..513f2969f5608d761669a39810c8ae43e8247aea 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_HVCorr.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Example_HVCorr.py @@ -20,14 +20,14 @@ if "TimeStamp" not in dir(): ts=strptime(date+'/UTC','%Y-%m-%d:%H:%M:%S/%Z') TimeStamp=int(timegm(ts))*1000000000L except ValueError: - print "ERROR in time specification, use e.g. 2007-05-25:14:01:00" + printfunc ("ERROR in time specification, use e.g. 2007-05-25:14:01:00") from LArCalibProcessing.TimeStampToRunLumi import TimeStampToRunLumi rlb=TimeStampToRunLumi(TimeStamp,dbInstance="CONDBR2") if rlb is None: - print "WARNING: Failed to convert time",TimeStamp,"into a run/lumi number" + printfunc ("WARNING: Failed to convert time",TimeStamp,"into a run/lumi number") RunNumber=999999 LumiBlock=0 else: @@ -35,14 +35,14 @@ else: LumiBlock=rlb[1] -print "---> Working on run",RunNumber,"LB",LumiBlock,"Timestamp:",TimeStamp +printfunc ("---> Working on run",RunNumber,"LB",LumiBlock,"Timestamp:",TimeStamp) timediff=int(time()-(TimeStamp/1000000000L)) if timediff<0: - print "ERROR: Timestamp in the future???" + printfunc ("ERROR: Timestamp in the future???") else: (days,remainder)=divmod(timediff,24*60*60) (hours,seconds)=divmod(remainder,60*60) - print "---> Timestamp is %i days %i hours and %i minutes ago" % (days,hours,int(seconds/60)) + printfunc ("---> Timestamp is %i days %i hours and %i minutes ago" % (days,hours,int(seconds/60))) pass diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Flags.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Flags.py index 0ae2db4dfedca93461ef5e01040780972442644a..91bc8f8f83ad5991dbefb4864ff5524323718ca9 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Flags.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Flags.py @@ -67,7 +67,7 @@ class LArCalib_Flags: def LArCalibFolderTag(folder,tag): - return join(split(folder, '/'),'') + tag + return ''.join(folder.split('/')) + tag class FolderTagResover: @@ -87,7 +87,7 @@ class FolderTagResover: return folder.resolveTag(globalTag) except: # new folder, should "create a tag" - return join(split(foldername, '/'),'') + '-UPD3-00' + return ''.join(foldername.split('/')) + '-UPD3-00' def getFolderTagSuffix(self,foldername,globalTag=LArCalib_Flags.globalFlagDB): diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MCPileupAutoCorr_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MCPileupAutoCorr_jobOptions.py index 3c7c8445681d95bdcaae64b91b9d1057c0091b18..9458fc0afb845611ccc51b63b5417baddf815521 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MCPileupAutoCorr_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_MCPileupAutoCorr_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess if not "SuperCells" in dir(): SuperCells=False @@ -95,10 +97,10 @@ if not 'DBConnectionCOOL' in dir(): DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=CONDBR2;" if not 'OutputPedAutoCorrRootFileDir' in dir(): - OutputPedAutoCorrRootFileDir = commands.getoutput("pwd") + OutputPedAutoCorrRootFileDir = subprocess.getoutput("pwd") if not 'OutputPedAutoCorrPoolFileDir' in dir(): - OutputPedAutoCorrPoolFileDir = commands.getoutput("pwd") + OutputPedAutoCorrPoolFileDir = subprocess.getoutput("pwd") if not 'ACLArCalibFolderTag' in dir(): rs=FolderTagResover() @@ -246,7 +248,7 @@ if SuperCells: #times= cursor.fetchall() #d=times[0][1] #iovtemp=int(time.mktime(d.timetuple())) -##print "Setting timestamp for run ",RunNumberList[0]," to ",iovtemp +##print ("Setting timestamp for run ",RunNumberList[0]," to ",iovtemp) ##svcMgr.IOVDbSvc.forceTimestamp = 1283145454 #svcMgr.IOVDbSvc.forceTimestamp = iovtemp @@ -281,8 +283,8 @@ if SuperCells: # Will for now use a local db for SC coefficients InputDBLocalCalib = "sqlite://;schema=localCalibConstants.db;dbname=CONDBR2" - print "LAr conf flags FEB gain threshold" - print larCondFlags.useLArFEBGainThresholds() + printfunc ("LAr conf flags FEB gain threshold") + printfunc (larCondFlags.useLArFEBGainThresholds()) conddb.addFolder("","<dbConnection>"+InputDB+"</dbConnection>/LAR/ElecCalibOflSC/Pedestals/Pedestal") conddb.addFolder("","<dbConnection>"+InputDB+"</dbConnection>/LAR/ElecCalibOflSC/Ramps/RampLinea") diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Merge.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Merge.py index 0a8d567498be849317dd2afb408048a4f040d1a5..9fcf7f0aa3fde1dc21f32eeb774f5529589f0a5b 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Merge.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Merge.py @@ -74,9 +74,9 @@ for f in folderInfo: tag=f[3] since=f[4] until=f[5] - print "Working on folder",fn,"IOV:",since,"-",until + printfunc ("Working on folder",fn,"IOV:",since,"-",until) #if since == 0: - # print "ERROR: Found IOV begin = 0" + # printfunc ("ERROR: Found IOV begin = 0") #sys.exit(-1) if 'OFC' in fn and not 'mu_20' in tag: continue @@ -93,14 +93,14 @@ svcMgr.EventSelector.RunNumber = 2147483647 OutputFileRec=fileName+"_"+str(runNoForFileName)+".pool.root" if os.access(OutputFileRec,os.F_OK): - print "File",OutputFileRec,"exists already, removing ...." + printfunc ("File",OutputFileRec,"exists already, removing ....") os.remove(OutputFileRec) -print svcMgr.IOVDbSvc.Folders +printfunc (svcMgr.IOVDbSvc.Folders) -print "============ Output objects =============" -print outObjects -print outTags +printfunc ("============ Output objects =============") +printfunc (outObjects) +printfunc (outTags) from LArCalibTools.LArCalibToolsConf import LArBlockCorrections topSequence+=LArBlockCorrections() diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_jobOptions.py index ee28cc620e18b0cd2c5a486d08c85adb40d4e41c..a38c21e096bec70c6f9dcde235b9ac834b544ffe 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_jobOptions.py @@ -1,5 +1,7 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -36,7 +38,7 @@ if not 'ReadAutoCorrFromCOOL' in dir(): ReadAutoCorrFromCOOL = True if not 'InputAutoCorrPoolDir' in dir(): - InputAutoCorrPoolDir = commands.getoutput("pwd") + InputAutoCorrPoolDir = subprocess.getoutput("pwd") if not 'InputAutoCorrPoolFileName' in dir(): InputAutoCorrPoolFileName = "LArAutoCorr.pool.root" @@ -47,7 +49,7 @@ if not 'ReadCaliWaveFromCOOL' in dir(): ReadCaliWaveFromCOOL = True if not 'InputCaliWavePoolDir' in dir(): - InputCaliWavePoolDir = commands.getoutput("pwd") + InputCaliWavePoolDir = subprocess.getoutput("pwd") if not 'InputCaliWavePoolFileName' in dir(): InputCaliWavePoolFileName = "LArCaliWave.pool.root" @@ -134,13 +136,13 @@ if not 'DBConnectionCOOL' in dir(): DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=CONDBR2;" if not 'OutputOFCRootFileDir' in dir(): - OutputOFCRootFileDir = commands.getoutput("pwd") + OutputOFCRootFileDir = subprocess.getoutput("pwd") if not 'OutputOFCPoolFileDir' in dir(): - OutputOFCPoolFileDir = commands.getoutput("pwd") + OutputOFCPoolFileDir = subprocess.getoutput("pwd") if not 'OutputShapePoolFileDir' in dir(): - OutputShapePoolFileDir = commands.getoutput("pwd") + OutputShapePoolFileDir = subprocess.getoutput("pwd") OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","") diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_splitter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_splitter_jobOptions.py index 0890c2b22f2f9c93b5d0fefd6004f5795b91ea75..fd058f5c376845b66f0b701a5f756e64b80b9a25 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_splitter_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Cali_splitter_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -45,7 +47,7 @@ if not 'ReadAutoCorrFromCOOL' in dir(): ReadAutoCorrFromCOOL = True if not 'InputAutoCorrPoolDir' in dir(): - InputAutoCorrPoolDir = commands.getoutput("pwd") + InputAutoCorrPoolDir = subprocess.getoutput("pwd") if not 'InputAutoCorrPoolFileName' in dir(): InputAutoCorrPoolFileName = "LArAutoCorr.pool.root" @@ -56,7 +58,7 @@ if not 'ReadCaliWaveFromCOOL' in dir(): ReadCaliWaveFromCOOL = True if not 'InputCaliWavePoolDir' in dir(): - InputCaliWavePoolDir = commands.getoutput("pwd") + InputCaliWavePoolDir = subprocess.getoutput("pwd") if not 'InputCaliWavePoolFileName' in dir(): InputCaliWavePoolFileName = "LArCaliWave.pool.root" @@ -164,13 +166,13 @@ if not 'DBConnectionCOOL' in dir(): DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=CONDBR2" if not 'OutputOFCRootFileDir' in dir(): - OutputOFCRootFileDir = commands.getoutput("pwd") + OutputOFCRootFileDir = subprocess.getoutput("pwd") if not 'OutputOFCPoolFileDir' in dir(): - OutputOFCPoolFileDir = commands.getoutput("pwd") + OutputOFCPoolFileDir = subprocess.getoutput("pwd") if not 'OutputShapePoolFileDir' in dir(): - OutputShapePoolFileDir = commands.getoutput("pwd") + OutputShapePoolFileDir = subprocess.getoutput("pwd") OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","") diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_Run2.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_Run2.py index 956cb5180cb94ea0ed31d8803d84e3a1005754c2..8cb8f6853ec311e5fdf20a54f606f7948c4c86f7 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_Run2.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_Run2.py @@ -106,12 +106,12 @@ if not 'IOVBegin' in dir(): from LArCalibProcessing.extractFolderInfo import * folderinfo=extractFolderInfo(dbname=InputDBConnectionPhysWave,checkFolders=[LArCalib_Flags.LArPhysWaveFolder,], selection="3:7,9:13,15:19,21:25,27:31,33:37") #Exclude FCAL channels that have infinete IOV - print folderinfo + printfunc (folderinfo) if len(folderinfo)==1: IOVBegin=folderinfo[0][4] - print "IOVStart taken from input PhysWave:", IOVBegin + printfunc ("IOVStart taken from input PhysWave:", IOVBegin) else: - print "Failed to extract IOV start of input PhysWave" + printfunc ("Failed to extract IOV start of input PhysWave") pass pass diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_TwoFolders_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_TwoFolders_jobOptions.py index cbc1e30f12389376de48675d1ec1c9dd2a4a664e..84156dad2ec713830f711ae6eff9e01dc7d76a06 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_TwoFolders_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_TwoFolders_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -78,7 +80,7 @@ if not 'ReadAutoCorrFromCOOL' in dir(): ReadAutoCorrFromCOOL = True if not 'InputAutoCorrPoolDir' in dir(): - InputAutoCorrPoolDir = commands.getoutput("pwd") + InputAutoCorrPoolDir = subprocess.getoutput("pwd") if not 'InputAutoCorrPoolFileName' in dir(): InputAutoCorrPoolFileName = "LArAutoCorr.pool.root" @@ -89,7 +91,7 @@ if not 'ReadPhysWaveFromCOOL' in dir(): ReadPhysWaveFromCOOL = True if not 'InputPhysWavePoolDir' in dir(): - InputPhysWavePoolDir = commands.getoutput("pwd") + InputPhysWavePoolDir = subprocess.getoutput("pwd") if not 'InputPhysWavePoolFileName' in dir(): InputPhysWavePoolFileName = "LArPhysWave.pool.root" @@ -100,7 +102,7 @@ if not 'ReadPhysCaliTdiffFromCOOL' in dir(): ReadPhysCaliTdiffFromCOOL = True if not 'InputPhysCaliTdiffPoolDir' in dir(): - InputPhysCaliTdiffPoolDir = commands.getoutput("pwd") + InputPhysCaliTdiffPoolDir = subprocess.getoutput("pwd") if not 'InputPhysCaliTdiffPoolFileName' in dir(): InputPhysCaliTdiffPoolFileName = "LArPhysCaliTdiff.pool.root" @@ -226,10 +228,10 @@ if not 'IOVEnd' in dir(): IOVEnd = LArCalib_Flags.IOVEnd if not 'OutputOFCRootFileDir' in dir(): - OutputOFCRootFileDir = commands.getoutput("pwd") + OutputOFCRootFileDir = subprocess.getoutput("pwd") if not 'OutputPoolFileDir' in dir(): - OutputPoolFileDir = commands.getoutput("pwd") + OutputPoolFileDir = subprocess.getoutput("pwd") OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","") OFCFileTag += "_"+str(Nsamples)+"samples" diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_WithPileup_TwoFolders_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_WithPileup_TwoFolders_jobOptions.py index 278b71610042dfff62c6c9cf634c72e632a06d4a..53790aba82ef84e418a0a90ffaea157ba43fc528 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_WithPileup_TwoFolders_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_WithPileup_TwoFolders_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -83,7 +85,7 @@ if not 'ReadAutoCorrFromCOOL' in dir(): ReadAutoCorrFromCOOL = True if not 'InputAutoCorrPoolDir' in dir(): - InputAutoCorrPoolDir = commands.getoutput("pwd") + InputAutoCorrPoolDir = subprocess.getoutput("pwd") if not 'InputAutoCorrPoolFileName' in dir(): InputAutoCorrPoolFileName = "LArAutoCorr.pool.root" @@ -94,7 +96,7 @@ if not 'ReadPhysWaveFromCOOL' in dir(): ReadPhysWaveFromCOOL = True if not 'InputPhysWavePoolDir' in dir(): - InputPhysWavePoolDir = commands.getoutput("pwd") + InputPhysWavePoolDir = subprocess.getoutput("pwd") if not 'InputPhysWavePoolFileName' in dir(): InputPhysWavePoolFileName = "LArPhysWave.pool.root" @@ -105,7 +107,7 @@ if not 'ReadPhysCaliTdiffFromCOOL' in dir(): ReadPhysCaliTdiffFromCOOL = True if not 'InputPhysCaliTdiffPoolDir' in dir(): - InputPhysCaliTdiffPoolDir = commands.getoutput("pwd") + InputPhysCaliTdiffPoolDir = subprocess.getoutput("pwd") if not 'InputPhysCaliTdiffPoolFileName' in dir(): InputPhysCaliTdiffPoolFileName = "LArPhysCaliTdiff.pool.root" @@ -243,10 +245,10 @@ if not 'IOVEnd' in dir(): IOVEnd = LArCalib_Flags.IOVEnd if not 'OutputOFCRootFileDir' in dir(): - OutputOFCRootFileDir = commands.getoutput("pwd") + OutputOFCRootFileDir = subprocess.getoutput("pwd") if not 'OutputPoolFileDir' in dir(): - OutputPoolFileDir = commands.getoutput("pwd") + OutputPoolFileDir = subprocess.getoutput("pwd") OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","") OFCFileTag += "_"+str(Nsamples)+"samples" diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_jobOptions.py index 5eb73a5d9c60143869495ee11218874838ce9386..0102f295a4ac718d314e52f26427cbbed146d455 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_OFC_Phys_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -76,7 +78,7 @@ if not 'ReadAutoCorrFromCOOL' in dir(): ReadAutoCorrFromCOOL = True if not 'InputAutoCorrPoolDir' in dir(): - InputAutoCorrPoolDir = commands.getoutput("pwd") + InputAutoCorrPoolDir = subprocess.getoutput("pwd") if not 'InputAutoCorrPoolFileName' in dir(): InputAutoCorrPoolFileName = "LArAutoCorr.pool.root" @@ -87,7 +89,7 @@ if not 'ReadPhysWaveFromCOOL' in dir(): ReadPhysWaveFromCOOL = True if not 'InputPhysWavePoolDir' in dir(): - InputPhysWavePoolDir = commands.getoutput("pwd") + InputPhysWavePoolDir = subprocess.getoutput("pwd") if not 'InputPhysWavePoolFileName' in dir(): InputPhysWavePoolFileName = "LArPhysWave.pool.root" @@ -165,10 +167,10 @@ if not 'IOVEnd' in dir(): IOVEnd = LArCalib_Flags.IOVEnd if not 'OutputOFCRootFileDir' in dir(): - OutputOFCRootFileDir = commands.getoutput("pwd") + OutputOFCRootFileDir = subprocess.getoutput("pwd") if not 'OutputPoolFileDir' in dir(): - OutputPoolFileDir = commands.getoutput("pwd") + OutputPoolFileDir = subprocess.getoutput("pwd") OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","") diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Patching_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Patching_jobOptions.py index a4d712ab882713eed3afe8dbaa27ca03981a7968..f69d62fba1cd8966b31def05c9c402646b881f41 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Patching_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Patching_jobOptions.py @@ -48,7 +48,7 @@ for obj in Objects: #if (p.startswith("EC") or p.startswith("HEC") or p.startswith("FCAL")): doCW=True if (p.startswith("HEC") or p.startswith("FCAL")): doCW=True if doCW and doCWxtalk: - print "ERROR: Can't do CaliWave patching for partitions",Partitions,"in one go." + printfunc ("ERROR: Can't do CaliWave patching for partitions",Partitions,"in one go.") sys.exit(-1) inputFolders=[] @@ -70,10 +70,10 @@ ccs="<channelSelection>"+sel+"</channelSelection>" from LArCalibProcessing.extractFolderInfo import * folderInfo=extractFolderInfo(InputDB,globaltag,inputFolders,Runnumber,sel) if folderInfo is None: - print "Failed to inspect database",InputDB + printfunc ("Failed to inspect database",InputDB) sys.exit(-1) -print folderInfo +printfunc (folderInfo) import AthenaCommon.AtlasUnixGeneratorJob #use MC event selector ## get a handle to the default top-level algorithm sequence @@ -126,7 +126,7 @@ IOVend=0 OutputObjectSpec=[] OutputTagSpec=[] -print folderInfo +printfunc (folderInfo) for f in folderInfo: fn=f[0] @@ -135,7 +135,7 @@ for f in folderInfo: tag=f[3] since=f[4] until=f[5] - print "Working on folder",fn,"IOV:",since,"-",until + printfunc ("Working on folder",fn,"IOV:",since,"-",until) OutputObjectSpec+=["#".join((type,key,fn))] OutputTagSpec+=[tag] if since<IOVstart: IOVstart=since @@ -143,7 +143,7 @@ for f in folderInfo: conddb.addFolder("",fn+"<key>"+key+"Input</key><tag>"+tag+"</tag><db>"+InputDB+"</db>"+ccs) -print OutputObjectSpec +printfunc (OutputObjectSpec) i=0 diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py index 95ebf4ee9deaac1abf87463df55d91afa7a02262..0dffa8fcc190b096523e51c1bdc3db148eae14e6 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PedestalAutoCorr_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ############################################################################### # @@ -165,10 +167,10 @@ if not 'DBConnectionCOOL' in dir(): DBConnectionCOOL = "oracle://ATLAS_COOLPROD;schema=ATLAS_COOLOFL_LAR;dbname=CONDBR2;" if not 'OutputPedAutoCorrRootFileDir' in dir(): - OutputPedAutoCorrRootFileDir = commands.getoutput("pwd") + OutputPedAutoCorrRootFileDir = subprocess.getoutput("pwd") if not 'OutputPedAutoCorrPoolFileDir' in dir(): - OutputPedAutoCorrPoolFileDir = commands.getoutput("pwd") + OutputPedAutoCorrPoolFileDir = subprocess.getoutput("pwd") if not 'PedLArCalibFolderTag' in dir(): rs=FolderTagResover() @@ -428,7 +430,7 @@ except: #except: # iovtemp=1284030331 -#print "Setting timestamp for run ",RunNumberList[0]," to ",iovtemp +#printfunc ("Setting timestamp for run ",RunNumberList[0]," to ",iovtemp) #svcMgr.IOVDbSvc.forceTimestamp = 1283145454 #svcMgr.IOVDbSvc.forceTimestamp = iovtemp @@ -716,4 +718,4 @@ svcMgr.ChronoStatSvc.OutputLevel = INFO ########################################################################### #svcMgr.IOVDbSvc.OutputLevel = DEBUG -print condSeq +printfunc (condSeq) diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictorAndShifter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictorAndShifter_jobOptions.py index ea42b008c0361478de6a33701d858cc04e900ec5..621132258808c7c3a1980ffd2f00311926889b2e 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictorAndShifter_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictorAndShifter_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -41,7 +43,7 @@ if not 'ReadHECPhysWaveFromCOOL' in dir(): ReadHECPhysWaveFromCOOL = True if not 'InputHECPhysWavePoolFileDir' in dir(): - InputHECMapPoolFileDir = commands.getoutput("pwd") + InputHECMapPoolFileDir = subprocess.getoutput("pwd") if not 'InputHECPhysWavePoolFileName' in dir(): InputHECPhysWavePoolFileName = "LArHECPhysWave.pool.root" @@ -51,7 +53,7 @@ if not 'ReadCaliWaveFromCOOL' in dir(): ReadCaliWaveFromCOOL = True if not 'InputCaliWavePoolDir' in dir(): - InputCaliWavePoolDir = commands.getoutput("pwd") + InputCaliWavePoolDir = subprocess.getoutput("pwd") if not 'InputCaliWavePoolFileName' in dir(): InputCaliWavePoolFileName = "LArCaliWave.pool.root" @@ -61,7 +63,7 @@ if not 'ReadPulseParamsFromCOOL' in dir(): ReadPulseParamsFromCOOL = True if not 'InputPulseParamsPoolDir' in dir(): - InputPulseParamsPoolDir = commands.getoutput("pwd") + InputPulseParamsPoolDir = subprocess.getoutput("pwd") if not 'InputPulseParamsPoolFileName' in dir(): InputPulseParamsPoolFileName = "LArCaliPulseParamsVsCalib_AllBoards.pool.root" @@ -71,7 +73,7 @@ if not 'ReadDetCellParamsFromCOOL' in dir(): ReadDetCellParamsFromCOOL = True if not 'InputDetCellParamsPoolDir' in dir(): - InputDetCellParamsPoolDir = commands.getoutput("pwd") + InputDetCellParamsPoolDir = subprocess.getoutput("pwd") if not 'InputDetCellParamsPoolFileName' in dir(): InputDetCellParamsPoolFileName = "detector_EMECA_C_v1.pool.root" @@ -81,7 +83,7 @@ if not 'ReadDTimeFromCOOL' in dir(): ReadDTimeFromCOOL = True if not 'InputDTimePoolDir' in dir(): - InputDTimePoolDir = commands.getoutput("pwd") + InputDTimePoolDir = subprocess.getoutput("pwd") if not 'InputDTimePoolFileName' in dir(): InputDTimePoolFileName = "tdrift_EMECA_C_v1.pool.root" @@ -269,13 +271,13 @@ if not 'IOVEnd' in dir(): IOVEnd = LArCalib_Flags.IOVEnd if not 'OutputPhysWaveRootFileDir' in dir(): - OutputPhysWaveRootFileDir= commands.getoutput("pwd") + OutputPhysWaveRootFileDir= subprocess.getoutput("pwd") if not 'OutputPhysWavePoolFileDir' in dir(): - OutputPhysWavePoolFileDir= commands.getoutput("pwd") + OutputPhysWavePoolFileDir= subprocess.getoutput("pwd") if not 'OutputMphysOverMcalPoolFileDir' in dir(): - OutputMphysOverMcalPoolFileDir= commands.getoutput("pwd") + OutputMphysOverMcalPoolFileDir= subprocess.getoutput("pwd") PhysWaveFileTag = str(RunNumber)+"_"+Partition.replace("*","") diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictor_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictor_jobOptions.py index ded42de6a8b47ddb8ac66270c7eedfa028d4c08e..3d4d42067ee187700da30747428d21412db430be 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictor_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWavePredictor_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -36,7 +38,7 @@ if not 'CaliWaveLArCalibFolderTag' in dir(): CaliWaveLArCalibFolderTag = LArCalib_Flags.tagSuffix if not 'InputCaliWavePoolDir' in dir(): - InputCaliWavePoolDir = commands.getoutput("pwd") + InputCaliWavePoolDir = subprocess.getoutput("pwd") if not 'InputCaliWavePoolFileName' in dir(): InputCaliWavePoolFileName = "LArCaliWave.pool.root" @@ -136,13 +138,13 @@ if not 'IOVEnd' in dir(): IOVEnd = LArCalib_Flags.IOVEnd if not 'OutputPhysWaveRootFileDir' in dir(): - OutputPhysWaveRootFileDir= commands.getoutput("pwd") + OutputPhysWaveRootFileDir= subprocess.getoutput("pwd") if not 'OutputPhysWavePoolFileDir' in dir(): - OutputPhysWavePoolFileDir= commands.getoutput("pwd") + OutputPhysWavePoolFileDir= subprocess.getoutput("pwd") if not 'OutputMphysOverMcalPoolFileDir' in dir(): - OutputMphysOverMcalPoolFileDir= commands.getoutput("pwd") + OutputMphysOverMcalPoolFileDir= subprocess.getoutput("pwd") PhysWaveFileTag = str(RunNumber)+"_"+Partition.replace("*","") @@ -256,7 +258,7 @@ else: if 'InputCaliWavePoolFileName' in dir(): PoolFileList += [ InputCaliWavePoolDir+"/"+InputCaliWavePoolFileName ] else: - print "No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL." + printfunc ("No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL.") theApp.exit(-1) if ( len(PoolFileList)>0 ): diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWaveShifter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWaveShifter_jobOptions.py index 728489e4546d49dd1cb16fa39cbb6d7af263e8f0..b6d4d79be3e9a023786bd8cee9e422b3baab3b4f 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWaveShifter_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PhysWaveShifter_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -36,7 +38,7 @@ if not 'PhysWaveLArCalibFolderTag' in dir(): PhysWaveLArCalibFolderTag = LArCalib_Flags.tagSuffix if not 'InputPhysWavePoolDir' in dir(): - InputPhysWavePoolDir = commands.getoutput("pwd") + InputPhysWavePoolDir = subprocess.getoutput("pwd") if not 'InputPhysWavePoolFileName' in dir(): InputPhysWavePoolFileName = "LArPhysWave.pool.root" @@ -84,7 +86,7 @@ if not 'IOVEnd' in dir(): IOVEnd = LArCalib_Flags.IOVEnd if not 'OutputPhysWaveRootFileDir' in dir(): - OutputPhysWaveRootFileDir = commands.getoutput("pwd") + OutputPhysWaveRootFileDir = subprocess.getoutput("pwd") PhysWaveFileTag = "Shifted_"+str(RunNumber)+"_"+Partition.replace("*","") @@ -189,7 +191,7 @@ else: if 'InputPhysWavePoolFileName' in dir(): PoolFileList += [ InputPhysWavePoolDir+"/"+InputPhysWavePoolFileName ] else: - print "No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL." + printfunc ("No PoolFileList found! Please list the POOL files containing CaliWave or read from COOL.") theApp.exit(-1) if ( len(PoolFileList)>0 ): diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase.py index 88e51cd94bbbda92fb745f78121475832f2e72aa..9822ef9d43e82ddc348a3ff12174173d22968cd1 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -35,7 +37,7 @@ if not 'ReadOFCFromCOOL' in dir(): ReadOFCFromCOOL = True if not 'InputPoolDir' in dir(): - InputPoolDir = commands.getoutput("pwd") + InputPoolDir = subprocess.getoutput("pwd") if not 'InputPoolFileName' in dir(): InputPoolFileName = "LArOFCShapePhys.pool.root" @@ -45,7 +47,7 @@ if not 'ReadShapeFromCOOL' in dir(): ReadShapeFromCOOL = True if not 'InputShapePoolDir' in dir(): - InputShapePoolDir = commands.getoutput("pwd") + InputShapePoolDir = subprocess.getoutput("pwd") ## COOL Channel selection @@ -109,10 +111,10 @@ if not 'IOVEnd' in dir(): IOVEnd = LArCalib_Flags.IOVEnd if not 'OutputOFCRootFileDir' in dir(): - OutputOFCRootFileDir = commands.getoutput("pwd") + OutputOFCRootFileDir = subprocess.getoutput("pwd") if not 'OutputPoolFileDir' in dir(): - OutputPoolFileDir = commands.getoutput("pwd") + OutputPoolFileDir = subprocess.getoutput("pwd") OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","") diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase_WithPileup.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase_WithPileup.py index 1d5f7c979c182b402e097c6ec775d93fa902423c..e276bcc7869bc27f4ad8ae87bebeac30d31c5095 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase_WithPileup.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_PickOFCOnePhase_WithPileup.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -39,7 +41,7 @@ if not 'ReadOFCFromCOOL' in dir(): ReadOFCFromCOOL = True if not 'InputPoolDir' in dir(): - InputPoolDir = commands.getoutput("pwd") + InputPoolDir = subprocess.getoutput("pwd") if not 'InputPoolFileName' in dir(): InputPoolFileName = "LArOFCShapePhys.pool.root" @@ -49,7 +51,7 @@ if not 'ReadShapeFromCOOL' in dir(): ReadShapeFromCOOL = True if not 'InputShapePoolDir' in dir(): - InputShapePoolDir = commands.getoutput("pwd") + InputShapePoolDir = subprocess.getoutput("pwd") ## COOL Channel selection @@ -124,10 +126,10 @@ if not 'IOVEnd' in dir(): IOVEnd = LArCalib_Flags.IOVEnd if not 'OutputOFCRootFileDir' in dir(): - OutputOFCRootFileDir = commands.getoutput("pwd") + OutputOFCRootFileDir = subprocess.getoutput("pwd") if not 'OutputPoolFileDir' in dir(): - OutputPoolFileDir = commands.getoutput("pwd") + OutputPoolFileDir = subprocess.getoutput("pwd") OFCFileTag = str(RunNumber)+"_"+Partition.replace("*","") diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RTMParams_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RTMParams_jobOptions.py index da204c60c046a2caa0a751b713e3d667c7f9c656..3b72307fb6f78dd3e02dbe292d8d843cb9152076 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RTMParams_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RTMParams_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -57,7 +59,7 @@ if not 'ReadCaliWaveFromCOOL' in dir(): ReadCaliWaveFromCOOL = True if not 'InputCaliWavePoolDir' in dir(): - InputCaliWavePoolDir = commands.getoutput("pwd") + InputCaliWavePoolDir = subprocess.getoutput("pwd") if not 'InputCaliWavePoolFileName' in dir(): InputCaliWavePoolFileName = "LArCaliWave.pool.root" @@ -73,7 +75,7 @@ if not 'InputCaliPulseParamsFolder' in dir(): if not 'InputCaliPulseParamsPoolDir' in dir(): - InputCaliPulseParamsPoolDir = commands.getoutput("pwd") + InputCaliPulseParamsPoolDir = subprocess.getoutput("pwd") if not 'InputCaliPulseParamsPoolFileName' in dir(): InputPulseParamsPoolFileName = "LArCaliPulseParamsVsCalib_AllBoards.pool.root" @@ -88,7 +90,7 @@ if not 'InputDetCellParamsFolder' in dir(): if SuperCells: InputDetCellParamsFolder = "/LAR/ElecCalibOflSC/DetCellParams/RTM" if not 'InputDetCellParamsPoolDir' in dir(): - InputDetCellParamsPoolDir = commands.getoutput("pwd") + InputDetCellParamsPoolDir = subprocess.getoutput("pwd") if not 'InputDetCellParamsPoolFileName' in dir(): InputDetCellParamsPoolFileName = "LArDetCellParams.pool.root" @@ -295,10 +297,10 @@ if not 'IOVEnd' in dir(): IOVEnd = LArCalib_Flags.IOVEnd if not 'OutputParamsRootFileDir' in dir(): - OutputParamsRootFileDir= commands.getoutput("pwd") + OutputParamsRootFileDir= subprocess.getoutput("pwd") if not 'OutputParamsPoolFileDir' in dir(): - OutputParamsPoolFileDir= commands.getoutput("pwd") + OutputParamsPoolFileDir= subprocess.getoutput("pwd") if not 'RTMFileTag' in dir(): RTMFileTag = "DefaultExtraction_"+str(RunNumber)+"_"+Partition.replace("*","") diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py index 24ddb22d07005ba2dc389258426e1ebb29c7307f..88a3f8f6efbbb199ae71b5465d7fbf3dd946cd6a 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -163,7 +165,7 @@ if not 'ReadHECMapFromCOOL' in dir(): ReadHECMapFromCOOL = True if not 'InputHECMapPoolFileDir' in dir(): - InputHECMapPoolFileDir = commands.getoutput("pwd") + InputHECMapPoolFileDir = subprocess.getoutput("pwd") if not 'InputHECMapPoolFileName' in dir(): InputHECMapPoolFileName = "LArHECMap.pool.root" @@ -179,7 +181,7 @@ if not 'PedRunNumber' in dir(): PedRunNumber = "1005020_1005021_1005022" if not 'InputPedPoolFileDir' in dir(): - InputPedPoolFileDir = commands.getoutput("pwd") + InputPedPoolFileDir = subprocess.getoutput("pwd") if not 'InputPedPoolFileName' in dir(): InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber) +"_"+Partition.replace("*","")+ ".pool.root" @@ -195,7 +197,7 @@ if not 'OFCRunNumber' in dir(): OFCRunNumber = "30950" if not 'InputOFCPoolFileDir' in dir(): - InputOFCPoolFileDir = commands.getoutput("pwd") + InputOFCPoolFileDir = subprocess.getoutput("pwd") if not 'InputOFCPoolFileName' in dir(): if PeakOF : @@ -222,10 +224,10 @@ if not 'LArCaliOFCFolderTag' in dir(): del rs if not 'OutputRampRootFileDir' in dir(): - OutputRampRootFileDir = commands.getoutput("pwd") + OutputRampRootFileDir = subprocess.getoutput("pwd") if not 'OutputRampPoolFileDir' in dir(): - OutputRampPoolFileDir = commands.getoutput("pwd") + OutputRampPoolFileDir = subprocess.getoutput("pwd") if not 'OutputDB' in dir(): OutputDB = LArCalib_Flags.OutputDB diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_splitter_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_splitter_jobOptions.py index dad32cc668f00699899db9fd8b90883ce9a015b0..9f5566aac260c61ac10d6c9df1cf1edeebb47ce2 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_splitter_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_Ramp_splitter_jobOptions.py @@ -1,4 +1,6 @@ -import commands +from future import standard_library +standard_library.install_aliases() +import subprocess ########################################################################### # @@ -151,7 +153,7 @@ if not 'ReadHECMapFromCOOL' in dir(): ReadHECMapFromCOOL = True if not 'InputHECMapPoolFileDir' in dir(): - InputHECMapPoolFileDir = commands.getoutput("pwd") + InputHECMapPoolFileDir = subprocess.getoutput("pwd") if not 'InputHECMapPoolFileName' in dir(): InputHECMapPoolFileName = "LArHECMap.pool.root" @@ -167,7 +169,7 @@ if not 'PedRunNumber' in dir(): PedRunNumber = "1005020_1005021_1005022" if not 'InputPedPoolFileDir' in dir(): - InputPedPoolFileDir = commands.getoutput("pwd") + InputPedPoolFileDir = subprocess.getoutput("pwd") if not 'InputPedPoolFileName' in dir(): InputPedPoolFileName = "LArPedestal_" + str(PedRunNumber) +"_"+Partition.replace("*","")+ ".pool.root" @@ -183,7 +185,7 @@ if not 'OFCRunNumber' in dir(): OFCRunNumber = "30950" if not 'InputOFCPoolFileDir' in dir(): - InputOFCPoolFileDir = commands.getoutput("pwd") + InputOFCPoolFileDir = subprocess.getoutput("pwd") if not 'InputOFCPoolFileName' in dir(): if PeakOF : @@ -197,10 +199,10 @@ if not 'LArCalibFolderOutputTag' in dir(): LArCalibFolderOutputTag = rs.getFolderTagSuffix(LArCalib_Flags.LArRampFolder) if not 'OutputRampRootFileDir' in dir(): - OutputRampRootFileDir = commands.getoutput("pwd") + OutputRampRootFileDir = subprocess.getoutput("pwd") if not 'OutputRampPoolFileDir' in dir(): - OutputRampPoolFileDir = commands.getoutput("pwd") + OutputRampPoolFileDir = subprocess.getoutput("pwd") if not 'OutputDB' in dir(): OutputDB = LArCalib_Flags.OutputDB diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RecomputeOFCs.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RecomputeOFCs.py index 9c39f805eb1ea019f5bf6ff1c4caa1766eb0f1ae..d654a248ec500c6d89b9c11028b3f2d4a6145e5b 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RecomputeOFCs.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_RecomputeOFCs.py @@ -77,8 +77,8 @@ LArExtendedSubDetGrouping = LArExtendedSubDetGrouping() GroupingType="ExtendedSubDetector" selection = LArExtendedSubDetGrouping.getChannelSelection(partition,gain) ChannelSelection='<channelSelection>'+selection+'</channelSelection>' -print ChannelSelection -print "CoolChannel Selection for ", partition, " and ",gain, " gain. " +printfunc (ChannelSelection) +printfunc ("CoolChannel Selection for ", partition, " and ",gain, " gain. ") #svcMgr.PoolSvc.ReadCatalog+=["prfile:poolcond/PoolCat_comcond_castor.xml" ] diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ToCoolInline.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ToCoolInline.py index 850414aa7c24a0ccc0299e2aae1c4569b25872c7..b09c5bcceda74f1fe38b9068b0bde370f54c61fe 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ToCoolInline.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArCalib_ToCoolInline.py @@ -41,7 +41,7 @@ outputDB="sqlite://;schema="+sqliteOut+";dbname="+dbname #folderInfo=extractFolderInfo(inputDB) if os.access(sqliteOut,os.F_OK): - print "File",sqliteOut,"exists already, removing ...." + printfunc ("File",sqliteOut,"exists already, removing ....") os.remove(sqliteOut) diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArHVCool2Ntuple_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArHVCool2Ntuple_jobOptions.py index 279d93697fd3fc846dea4f1ea5c1954c01d5cc6d..21d92e826edcc9bf2c3b0f005bdc49723542c5a5 100755 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/LArHVCool2Ntuple_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/LArHVCool2Ntuple_jobOptions.py @@ -15,14 +15,14 @@ if "TimeStamp" not in dir(): ts=strptime(date+'/UTC','%Y-%m-%d:%H:%M:%S/%Z') TimeStamp=int(timegm(ts))*1000000000L except ValueError: - print "ERROR in time specification, use e.g. 2007-05-25:14:01:00" + printfunc ("ERROR in time specification, use e.g. 2007-05-25:14:01:00") from LArCalibProcessing.TimeStampToRunLumi import TimeStampToRunLumi rlb=TimeStampToRunLumi(TimeStamp) if rlb is None: - print "WARNING: Failed to convert time",TimeStamp,"into a run/lumi number" + printfunc ("WARNING: Failed to convert time",TimeStamp,"into a run/lumi number") myRunNumber=999999 myLumiBlock=0 else: @@ -33,7 +33,7 @@ if "RunNumber" in dir(): myRunNumber=RunNumber myLumiBlock=0 -print "Working on run",myRunNumber,"LB",myLumiBlock,"Timestamp:",TimeStamp +printfunc ("Working on run",myRunNumber,"LB",myLumiBlock,"Timestamp:",TimeStamp) if "GlobalTag" not in dir(): GlobalTag = 'CONDBR2-BLKPA-2015-05' diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_AutoCorrPhys_jobOptions.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_AutoCorrPhys_jobOptions.py index 11593af9b261208cec2d38b5d21f90a57cf10a55..4d78633374968942fe9d90aa20312eb3119d6ae3 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_AutoCorrPhys_jobOptions.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/TopOptsExample_AutoCorrPhys_jobOptions.py @@ -1,4 +1,3 @@ -import commands #input bytestream files diff --git a/LArCalorimeter/LArExample/LArCalibProcessing/share/UseLArExtendedSubDetGrouping.py b/LArCalorimeter/LArExample/LArCalibProcessing/share/UseLArExtendedSubDetGrouping.py index ba65915ac08a87398b5682a7892ff8ea82b71297..c53de5f4e2505543f72498aefc0a9589becd514d 100644 --- a/LArCalorimeter/LArExample/LArCalibProcessing/share/UseLArExtendedSubDetGrouping.py +++ b/LArCalorimeter/LArExample/LArCalibProcessing/share/UseLArExtendedSubDetGrouping.py @@ -1,4 +1,4 @@ -print 'LArExtendedSubDetGrouping' +printfunc ('LArExtendedSubDetGrouping') from LArConditionsCommon.LArExtendedSubDetGrouping import LArExtendedSubDetGrouping LArExtendedSubDetGrouping = LArExtendedSubDetGrouping() @@ -27,33 +27,33 @@ if (int(RunNumberFlag)<100000) : ## EMB + EMBPS A 64 (32+32) if ( Partition=='EB-EMBA' and ( GainList[0]=="HIGH" or GainList[0]=="MEDIUM" ) ) : partition =['EMBAPS','EMBA'] - print 'EMBA+EMBAPS partition' + printfunc ('EMBA+EMBAPS partition') elif ( Partition=='EB-EMBC' and ( GainList[0]=="HIGH" or GainList[0]=="MEDIUM" ) ) : partition =['EMBCPS','EMBC'] - print 'EMBC+EMBCPS partition' + printfunc ('EMBC+EMBCPS partition') elif ( Partition=='EB-EMBA' and GainList[0]=="LOW" ) : partition =['EMBA'] - print 'EMBA partition' + printfunc ('EMBA partition') elif ( Partition=='EB-EMBC' and GainList[0]=="LOW" ) : partition =['EMBC'] - print 'EMBC partition' + printfunc ('EMBC partition') else : ## EMB A+C if ( Partition=='EB-EMBA' and ( PartitionTypeGeneric!='EMBPS' ) ) : partition =['EMBA'] - print 'EMBA partition' + printfunc ('EMBA partition') elif ( Partition=='EB-EMBC' and ( PartitionTypeGeneric!='EMBPS' ) ) : partition =['EMBC'] - print 'EMBC partition' + printfunc ('EMBC partition') ## EMBPS A+C if ( Partition=='EB-EMBA' and ( PartitionTypeGeneric=='EMBPS' ) ) : partition =['EMBAPS'] - print 'EMBAPS partition' + printfunc ('EMBAPS partition') elif ( Partition=='EB-EMBC' and ( PartitionTypeGeneric=='EMBPS' ) ) : partition =['EMBCPS'] - print 'EMBCPS partition' + printfunc ('EMBCPS partition') ## EMEC + PS A 44 @@ -72,8 +72,8 @@ elif ( PartitionType=='FCAL') : selection = LArExtendedSubDetGrouping.getChannelSelection(partition,gain) ChannelSelection='<channelSelection>'+selection+'</channelSelection>' -print ChannelSelection -print "CoolChannel Selection for ", partition, " and ",gain, " gain. " +printfunc (ChannelSelection) +printfunc ("CoolChannel Selection for ", partition, " and ",gain, " gain. ") diff --git a/LArCalorimeter/LArExample/LArConditionsCommon/python/LArExtendedSubDetGrouping.py b/LArCalorimeter/LArExample/LArConditionsCommon/python/LArExtendedSubDetGrouping.py index 52a3e92719d5fd9ca60c333e16565c1d491306f1..f58d7016eeb756da169308fc7ad987a393d38c43 100644 --- a/LArCalorimeter/LArExample/LArConditionsCommon/python/LArExtendedSubDetGrouping.py +++ b/LArCalorimeter/LArExample/LArConditionsCommon/python/LArExtendedSubDetGrouping.py @@ -1,6 +1,8 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function +import six + class LArExtendedSubDetGrouping: def __init__(self): @@ -75,7 +77,7 @@ class LArExtendedSubDetGrouping: #Lookup-dict indexed by channel (partition is the payload) self._revLookup=dict() - for (p, chs) in self._partitions.iteritems(): + for (p, chs) in six.iteritems (self._partitions): for c in chs: self._revLookup[c]=p @@ -111,7 +113,7 @@ class LArExtendedSubDetGrouping: extPart+=[p] for p in extPart: - if self._partitions.has_key(p): + if p in self._partitions: for g in gains: print (self._partitions[p]) chans+=[self._partitions[p][g]] @@ -210,7 +212,7 @@ class LArExtendedSubDetGrouping: print( " ") partCounter=dict() - for (p, chs) in self._partitions.iteritems(): + for (p, chs) in six.iteritems (self._partitions): partCounter[p]=counterElem(len(chs),p) for c in chans: diff --git a/LArCalorimeter/LArMonTools/python/evolutionBadChannels.py b/LArCalorimeter/LArMonTools/python/evolutionBadChannels.py index a490d69885e24d8dce4d49955aebbce0f9d07e97..311d5284025a38ced2f0b205f744878b5d560e3a 100644 --- a/LArCalorimeter/LArMonTools/python/evolutionBadChannels.py +++ b/LArCalorimeter/LArMonTools/python/evolutionBadChannels.py @@ -1,6 +1,8 @@ #!/usr/bin env python -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from __future__ import print_function # ====================================================================== def extractBad(histo,sp,hi,bin): @@ -116,7 +118,7 @@ for index in range(0,nbOfRun): nameFile = "/castor/cern.ch/grid/atlas/tzero/prod1/perm/data10_7TeV/physics_CosmicCalo/0%d/data10_7TeV.00%d.physics_CosmicCalo.merge.HIST.x%d_m%d/data10_7TeV.00%d.physics_CosmicCalo.merge.HIST.x%d_m%d._0001.1"%(runNumber[index],runNumber[index],tagxf[index],tagm[index],runNumber[index],tagxf[index],tagm[index]) if tag == "UPD4": nameFile = "/castor/cern.ch/grid/atlas/tzero/prod1/perm/data10_7TeV/physics_CosmicCalo/0%d/data10_7TeV.00%d.physics_CosmicCalo.merge.HIST.f%d_m%d/data10_7TeV.00%d.physics_CosmicCalo.merge.HIST.f%d_m%d._0001.1"%(runNumber[index],runNumber[index],tagxf[index],tagm[index],runNumber[index],tagxf[index],tagm[index]) - print nameFile + print (nameFile) myfile = TRFIOFile(nameFile) emba = gDirectory.Get("run_%d/LAr/Coverage/BadChannels/DBBadChannelsBarrelA"%(runNumber[index])) @@ -128,11 +130,11 @@ for index in range(0,nbOfRun): ecc = gDirectory.Get("run_%d/LAr/Coverage/BadChannels/DBBadChannelsEndcapC"%(runNumber[index])) extractBad(ecc,sporadic,highNoise,index) - print "**EMB : sporadicBurst=",sporadic[0][index]," - highNoise=",highNoise[0][index] - print "**EMB PS: sporadicBurst=",sporadic[1][index]," - highNoise=",highNoise[1][index] - print "**EMEC : sporadicBurst=",sporadic[2][index]," - highNoise=",highNoise[2][index] - print "**FCAL : sporadicBurst=",sporadic[3][index]," - highNoise=",highNoise[3][index] - print "**HEC : sporadicBurst=",sporadic[4][index]," - highNoise=",highNoise[4][index] + print ("**EMB : sporadicBurst=",sporadic[0][index]," - highNoise=",highNoise[0][index]) + print ("**EMB PS: sporadicBurst=",sporadic[1][index]," - highNoise=",highNoise[1][index]) + print ("**EMEC : sporadicBurst=",sporadic[2][index]," - highNoise=",highNoise[2][index]) + print ("**FCAL : sporadicBurst=",sporadic[3][index]," - highNoise=",highNoise[3][index]) + print ("**HEC : sporadicBurst=",sporadic[4][index]," - highNoise=",highNoise[4][index]) #Create 1 TGraph for each errorType/run diff --git a/LArCalorimeter/LArMonTools/share/LArRawChannelMonTool_jobOptions.py b/LArCalorimeter/LArMonTools/share/LArRawChannelMonTool_jobOptions.py index 131007dafa4e79ccadcfed437fc320f1e283cc5f..214f9c2cd6c24df164ef477d83c01c050f6553b4 100755 --- a/LArCalorimeter/LArMonTools/share/LArRawChannelMonTool_jobOptions.py +++ b/LArCalorimeter/LArMonTools/share/LArRawChannelMonTool_jobOptions.py @@ -14,7 +14,6 @@ LArRawChannelMonTool_TrigToolName = "Trig::TrigDecisionTool/TrigDecisionTool" LArRawChannelMonTool_TriggerChain = "L1_RD0_EMPTY" #"L1_RD0_FILLED" # --- LArRawChannelMon configuration --- -ToolSvc += GetAtlasReadyFilterTool() from LArMonTools.LArMonToolsConf import LArRawChannelMonTool LArRawChannelMon = LArRawChannelMonTool( # --- set up mon tool --- diff --git a/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx b/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx index 9a384f6b0594c431325c24ddd04e890b3b7524ea..4014369b537810a8b5ad5904a6bad84099d3227d 100644 --- a/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx +++ b/LArCalorimeter/LArMonTools/src/LArRawChannelMonTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "LArRawChannelMonTool.h" @@ -101,6 +101,7 @@ LArRawChannelMonTool::LArRawChannelMonTool( const std::string & type, , m_calo_id_mgr_ptr( 0 ) , m_cable_service_tool ( "LArCablingLegacyService" ) , m_masking_tool ( "BadLArRawChannelMask" ) + , m_filterAtlasReady_tools (this) , m_atlas_ready( false ) , m_lar_online_id_str_helper_ptr ( 0 ) , m_has_lar_raw_channels( false ) diff --git a/LArCalorimeter/LArRawConditions/src/LArCompactSubset.cxx b/LArCalorimeter/LArRawConditions/src/LArCompactSubset.cxx index 6373fcc8210066b5a1e2ac58271548bcfe908ec6..ed032835e56261cde21a51ed10e7017d434280e2 100644 --- a/LArCalorimeter/LArRawConditions/src/LArCompactSubset.cxx +++ b/LArCalorimeter/LArRawConditions/src/LArCompactSubset.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id$ @@ -151,7 +151,7 @@ void LArCompactSubsetVector::setTimings (unsigned int /*chan*/, float timeOffset, float timeBinWidth) { - if (m_timeOffset == 0 && m_timeBinWidth == 0) { + if (m_data.empty()) { m_timeOffset = timeOffset; m_timeBinWidth = timeBinWidth; } diff --git a/LArCalorimeter/LArTest/LArCalibTest/python/HECNoiseD3PDMaker.py b/LArCalorimeter/LArTest/LArCalibTest/python/HECNoiseD3PDMaker.py index 16494cafe96603da0b0f147ee4177862cf54b063..c19fa00d222d626e003a34cbf838f8e5f582a1b8 100644 --- a/LArCalorimeter/LArTest/LArCalibTest/python/HECNoiseD3PDMaker.py +++ b/LArCalorimeter/LArTest/LArCalibTest/python/HECNoiseD3PDMaker.py @@ -7,6 +7,7 @@ # # this python alg creates a D3PD and fills it # +from __future__ import print_function import AthenaPython.PyAthena as PyAthena from ROOT import TFile, TTree from array import array @@ -43,11 +44,11 @@ class HECNoiseD3PDMaker(PyAthena.Alg): 'L1_TAU8_FIRSTEMPTY']) def initialize(self): - print "==> initializing ", self.name - print "MinDigitADC: ", self.MinDigitADC - print "MaxDeltaT: ", self.MaxDeltaT - print "NtupleFileName: ", self.NtupleFileName - print "TriggerLines: ", self.TriggerLines + print ("==> initializing ", self.name) + print ("MinDigitADC: ", self.MinDigitADC) + print ("MaxDeltaT: ", self.MaxDeltaT) + print ("NtupleFileName: ", self.NtupleFileName) + print ("TriggerLines: ", self.TriggerLines) # self.sg = PyAthena.py_svc("StoreGateSvc") self.det = PyAthena.StoreGate.pointer("DetectorStore") @@ -202,7 +203,7 @@ class HECNoiseD3PDMaker(PyAthena.Alg): self.t[0] = 0.0 self.iQuality[0] = 0 if rcell.ID() != oid: - print "Cell iHash does not match ..." + print ("Cell iHash does not match ...") pass else: self.e[0] = rcell.e() @@ -220,10 +221,10 @@ class HECNoiseD3PDMaker(PyAthena.Alg): pass pass if foundLowCell: - print 'Event passed HECNoise Filter' + print ('Event passed HECNoise Filter') return True pass - print 'Event failed HECNoise Filter' + print ('Event failed HECNoise Filter') self.setFilterPassed(False) return True diff --git a/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py b/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py index 7ebdd2b1c8b156ae58fa5b8867926adb9664789e..5a426d637ccf3b0d55178a7c60221283b222c399 100644 --- a/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py +++ b/MagneticField/MagFieldServices/python/MagFieldServicesConfig.py @@ -5,37 +5,9 @@ # inspired by https://svnweb.cern.ch/trac/atlasoff/browser/MuonSpectrometer/MuonCnv/MuonCnvExample/trunk/python/MuonCalibConfig.py -from AthenaCommon.Logging import logging from AthenaConfiguration.ComponentFactory import CompFactory -logging.getLogger().info("Importing %s", __name__) - -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -from AthenaCommon.GlobalFlags import GlobalFlags -from AthenaCommon import CfgMgr from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator -MagField__AtlasFieldSvc=CompFactory.MagField__AtlasFieldSvc - -#-------------------------------------------------------------- - -def AtlasFieldSvc(name="AtlasFieldSvc",**kwargs): - if athenaCommonFlags.isOnline(): - kwargs.setdefault( "UseDCS", False ) - kwargs.setdefault( "UseSoleCurrent", 7730 ) - kwargs.setdefault( "UseToroCurrent", 20400 ) - else: - kwargs.setdefault( "UseDCS", True ) - - return CfgMgr.MagField__AtlasFieldSvc(name,**kwargs) - -def H8FieldSvc(name="H8FieldSvc",**kwargs): - return CfgMgr.MagField__H8FieldSvc(name,**kwargs) -def GetFieldSvc(name="AtlasFieldSvc",**kwargs): - if GlobalFlags.DetGeo == 'ctbh8': - return H8FieldSvc(name, **kwargs) - else: - return AtlasFieldSvc(name, **kwargs) - # The magneticfields is going to need a big update for MT, so this is all temporary. Ed def MagneticFieldSvcCfg(flags, **kwargs): result=ComponentAccumulator() @@ -62,7 +34,9 @@ def MagneticFieldSvcCfg(flags, **kwargs): kwargs.setdefault( "UseToroCurrent", 20400 ) else: kwargs.setdefault( "UseDCS", True ) - mag_field_svc = MagField__AtlasFieldSvc("AtlasFieldSvc",**kwargs) + + + mag_field_svc = CompFactory.MagField__AtlasFieldSvc("AtlasFieldSvc",**kwargs) result.addService(mag_field_svc,primary=True) return result diff --git a/MagneticField/MagFieldServices/python/MagFieldServicesConfigDb.py b/MagneticField/MagFieldServices/python/MagFieldServicesConfigDb.py index a8aafa8e7578b99c28fd12d94fc6cd9b830d81ed..5b8323b4e3c28e743fa018b8897bde6c71638a71 100644 --- a/MagneticField/MagFieldServices/python/MagFieldServicesConfigDb.py +++ b/MagneticField/MagFieldServices/python/MagFieldServicesConfigDb.py @@ -4,4 +4,4 @@ # Valerio Ippolito - Harvard University from AthenaCommon.CfgGetter import addService -addService('MagFieldServices.MagFieldServicesConfig.GetFieldSvc', 'AtlasFieldSvc') +addService('MagFieldServices.MagFieldServicesSetup.GetFieldSvc', 'AtlasFieldSvc') diff --git a/MagneticField/MagFieldServices/python/MagFieldServicesSetup.py b/MagneticField/MagFieldServices/python/MagFieldServicesSetup.py new file mode 100644 index 0000000000000000000000000000000000000000..1d3521c7c0cedc02033f5a60c7b3146849526662 --- /dev/null +++ b/MagneticField/MagFieldServices/python/MagFieldServicesSetup.py @@ -0,0 +1,35 @@ +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + +# JobOption fragment to set up the AtlasFieldSvc +# Valerio Ippolito - Harvard University + +# inspired by https://svnweb.cern.ch/trac/atlasoff/browser/MuonSpectrometer/MuonCnv/MuonCnvExample/trunk/python/MuonCalibConfig.py + +from AthenaCommon.Logging import logging +logging.getLogger().info("Importing %s", __name__) + +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +from AthenaCommon.GlobalFlags import GlobalFlags +from AthenaCommon import CfgMgr +MagField__AtlasFieldSvc=CfgMgr.MagField__AtlasFieldSvc + +#-------------------------------------------------------------- + +def AtlasFieldSvc(name="AtlasFieldSvc",**kwargs): + if athenaCommonFlags.isOnline(): + kwargs.setdefault( "UseDCS", False ) + kwargs.setdefault( "UseSoleCurrent", 7730 ) + kwargs.setdefault( "UseToroCurrent", 20400 ) + else: + kwargs.setdefault( "UseDCS", True ) + + return CfgMgr.MagField__AtlasFieldSvc(name,**kwargs) + +def H8FieldSvc(name="H8FieldSvc",**kwargs): + return CfgMgr.MagField__H8FieldSvc(name,**kwargs) + +def GetFieldSvc(name="AtlasFieldSvc",**kwargs): + if GlobalFlags.DetGeo == 'ctbh8': + return H8FieldSvc(name, **kwargs) + else: + return AtlasFieldSvc(name, **kwargs) diff --git a/MuonSpectrometer/MuonCablings/RPCcablingInterface/CMakeLists.txt b/MuonSpectrometer/MuonCablings/RPCcablingInterface/CMakeLists.txt index 57153656db2d631d84229595b8e018bfb32983a4..1e0c62080b5031218a78b7e57acb2ed29d8e2fa1 100644 --- a/MuonSpectrometer/MuonCablings/RPCcablingInterface/CMakeLists.txt +++ b/MuonSpectrometer/MuonCablings/RPCcablingInterface/CMakeLists.txt @@ -12,8 +12,8 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel MuonSpectrometer/MuonCablings/MuonCablingTools MuonSpectrometer/MuonIdHelpers - PRIVATE MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling + PRIVATE Control/StoreGate ) # Component(s) in the package: diff --git a/MuonSpectrometer/MuonCalib/MuonCalibIdentifier/MuonCalibIdentifier/MdtTubeInChamberHashTable.h b/MuonSpectrometer/MuonCalib/MuonCalibIdentifier/MuonCalibIdentifier/MdtTubeInChamberHashTable.h index 1d949b450f04c6a860197d632a8e9fd7d871f7aa..2231d352eb9bf3275271d3cca5598983bbf741e8 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibIdentifier/MuonCalibIdentifier/MdtTubeInChamberHashTable.h +++ b/MuonSpectrometer/MuonCalib/MuonCalibIdentifier/MuonCalibIdentifier/MdtTubeInChamberHashTable.h @@ -26,13 +26,6 @@ class MdtTubeInChamberHashTable { public: - /** 'less' helper class for binary search on global offset */ - struct lessGlobalOffset : - public std::binary_function<MdtTubeInChamberHashTable,unsigned int, bool> { - bool operator()( const MdtTubeInChamberHashTable& table, unsigned int offset ) { - return table.m_globalHashOffset < offset; - } - }; /** constructor */ MdtTubeInChamberHashTable( const MdtTubeInChamberHashTableType* type, const MdtChamberId& chamberId ); diff --git a/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx b/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx index 914aad132c4be5747aa2ff4ce475cbc2fcd20ff0..5f97c431908e0a818491846e0742f0c3a1b5323c 100644 --- a/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx +++ b/MuonSpectrometer/MuonCalib/MuonCalibPatRec/src/MuonSegmentToCalibSegment.cxx @@ -330,19 +330,15 @@ namespace MuonCalib { Identifier MuonSegmentToCalibSegment::getChId( const Muon::MuonSegment& seg ) const { - const std::vector<const Trk::RIO_OnTrack*>& rots = seg.containedROTs(); - if( rots.empty() ) { + if( seg.numberOfContainedROTs()==0 ) { ATH_MSG_DEBUG( " Oops, segment without hits!!! " ); return Identifier(); } - std::vector<const Trk::RIO_OnTrack*>::const_iterator rit = rots.begin(); - std::vector<const Trk::RIO_OnTrack*>::const_iterator rit_end = rots.end(); - - for( ; rit!=rit_end;++rit ){ + for(unsigned int irot=0;irot<seg.numberOfContainedROTs();irot++){ // use pointer to rot - const Trk::RIO_OnTrack* rot = *rit; + const Trk::RIO_OnTrack* rot = seg.rioOnTrack(irot); if( m_idHelperSvc->mdtIdHelper().is_mdt( rot->identify() ) ){ return rot->identify(); @@ -352,7 +348,7 @@ namespace MuonCalib { } // if we get here the segment did not contain any csc or mdt hits, in which case we return the identifier of the first rot - return rots.front()->identify(); + return seg.rioOnTrack(0)->identify(); } Amg::Transform3D MuonSegmentToCalibSegment::getGlobalToStation( const Identifier& id, const MuonGM::MuonDetectorManager* MuonDetMgr ) const diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h index fcbf3f86d9fec04268053696946efa00b7551b39..e7e4be4887922a5dc0891ea93d1cfab86210f58f 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolCore.h @@ -63,9 +63,9 @@ namespace Muon { protected: /// private method for the decoding RDO --> PrepRawData - StatusCode decode(const CscRawDataContainer* rdo, IdentifierHash givenIdh, + virtual StatusCode decode(const CscRawDataContainer* rdo, IdentifierHash givenIdh, std::vector<IdentifierHash>& decodedIdhs); - StatusCode decode(const CscRawDataContainer* rdo, + virtual StatusCode decode(const CscRawDataContainer* rdo, std::vector<IdentifierHash>& decodedIdhs); virtual StatusCode decode( const std::vector<uint32_t>& ) {return StatusCode::FAILURE;} diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx index eda8f1c5fc9655d9e950df5c03dfc2c3edab8932..3ef1e0e9f0bb7c9f971dfd187cd1200c17d14577 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.cxx @@ -32,6 +32,7 @@ using namespace Muon; CscRdoToCscPrepDataToolMT::CscRdoToCscPrepDataToolMT (const std::string& type, const std::string& name, const IInterface* parent) : CscRdoToCscPrepDataToolCore(type, name, parent) { + declareProperty("CscStripPrdContainerCacheKey", m_prdContainerCacheKey, "Optional external cache for the CSC RDO container"); } CscRdoToCscPrepDataToolMT::~CscRdoToCscPrepDataToolMT(){} @@ -39,6 +40,7 @@ CscRdoToCscPrepDataToolMT::~CscRdoToCscPrepDataToolMT(){} StatusCode CscRdoToCscPrepDataToolMT::initialize(){ ATH_MSG_VERBOSE("Starting init"); ATH_CHECK( CscRdoToCscPrepDataToolCore::initialize() ); + ATH_CHECK( m_prdContainerCacheKey.initialize( !m_prdContainerCacheKey.key().empty() ) ); ATH_MSG_DEBUG("initialize() successful in " << name()); return StatusCode::SUCCESS; } @@ -56,16 +58,39 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(std::vector<IdentifierHash>& givenI // clear output vector of selected data collections containing data decodedIdhs.clear(); - /// record the container in storeGate + /// Recording the PRD container in StoreGate SG::WriteHandle< Muon::CscStripPrepDataContainer > outputHandle (m_outputCollectionKey); - StatusCode status = outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(m_muonMgr->cscIdHelper()->module_hash_max())); - if (status.isFailure() || !outputHandle.isValid() ) { - ATH_MSG_FATAL("Could not record container of CSC PrepData Container at " << m_outputCollectionKey.key()); - return StatusCode::FAILURE; + // Caching of PRD container + const bool externalCachePRD = !m_prdContainerCacheKey.key().empty(); + if (!externalCachePRD) { + // without the cache we just record the container + StatusCode status = outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(m_muonMgr->cscIdHelper()->module_hash_max())); + if (status.isFailure() || !outputHandle.isValid() ) { + ATH_MSG_FATAL("Could not record container of CSC PrepData Container at " << m_outputCollectionKey.key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Created container " << m_outputCollectionKey.key()); } + else { + // use the cache to get the container + SG::UpdateHandle<CscStripPrepDataCollection_Cache> update(m_prdContainerCacheKey); + if (!update.isValid()){ + ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key()); + return StatusCode::FAILURE; + } + StatusCode status = outputHandle.record(std::make_unique<Muon::CscStripPrepDataContainer>(update.ptr())); + if (status.isFailure() || !outputHandle.isValid() ) { + ATH_MSG_FATAL("Could not record container of CSC PrepData Container using cache " + << m_prdContainerCacheKey.key() << " - " <<m_outputCollectionKey.key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Created container using cache for " << m_prdContainerCacheKey.key()); + } + // Pass the container from the handle m_outputCollection = outputHandle.ptr(); + if (sizeVectorRequested == 0) { m_fullEventDone=true; ATH_MSG_DEBUG ( "decoding the entire event " ); @@ -91,14 +116,14 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(std::vector<IdentifierHash>& givenI if (sizeVectorRequested) { // seeded decoding for (unsigned int i=0; i<sizeVectorRequested; ++i) { - if (decode(rdoContainer, givenIdhs[i],decodedIdhs).isFailure()) { + if (CscRdoToCscPrepDataToolMT::decode(rdoContainer, givenIdhs[i],decodedIdhs).isFailure()) { ATH_MSG_ERROR ( "Unable to decode CSC RDO " << i << "th into CSC PrepRawData" ); return StatusCode::FAILURE; } } } else { // unseeded decoding - if (decode(rdoContainer, decodedIdhs).isFailure()) { + if (CscRdoToCscPrepDataToolMT::decode(rdoContainer, decodedIdhs).isFailure()) { ATH_MSG_ERROR ( "Unable to decode CSC RDO " ); return StatusCode::FAILURE; } @@ -106,3 +131,381 @@ StatusCode CscRdoToCscPrepDataToolMT::decode(std::vector<IdentifierHash>& givenI return StatusCode::SUCCESS; } + +StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoContainer, IdentifierHash givenHashId, std::vector<IdentifierHash>& decodedIdhs) { + + + //typedef CscRawDataContainer::const_iterator collection_iterator; + + IdContext cscContext = m_muonIdHelperTool->cscIdHelper().module_context(); + + // if CSC decoding is switched off stop here + if( !m_decodeData ) { + ATH_MSG_DEBUG ( "Stored empty container; Decoding CSC RDO into CSC PrepRawData is switched off" ); + return StatusCode::SUCCESS; + } + + //These collections can be empty for the trigger + if(!m_outputCollection || m_outputCollection->size()==0){ + ATH_MSG_DEBUG("Stored empty collection."); + return StatusCode::SUCCESS; + } + + ATH_MSG_DEBUG ( "Decoding CSC RDO into CSC PrepRawData" ); + /// create the CSC RDO decoder + //********************************************** + // retrieve specific collection for the givenID + uint16_t idColl = 0xffff; + m_cabling->hash2CollectionId(givenHashId,idColl); + CscRawDataContainer::const_iterator it_coll = rdoContainer->indexFind(idColl); + if (rdoContainer->end() == it_coll) { + ATH_MSG_DEBUG ( "Specific CSC RDO collection retrieving failed for collection hash = " << idColl ); + return StatusCode::SUCCESS; + } + + const CscRawDataCollection * rawCollection = *it_coll; + ATH_MSG_DEBUG ( "Retrieved " << rawCollection->size() << " CSC RDOs."); + //************************************************ + IdentifierHash cscHashId; + + unsigned int samplingTime = rawCollection->rate(); + unsigned int numSamples = rawCollection->numSamples(); + bool samplingPhase = rawCollection->samplingPhase(); + std::vector<float> charges; + charges.reserve(4); + std::vector<uint16_t> samples; + samples.reserve(4); + + if ( int(samplingTime) != int(m_cscCalibTool->getSamplingTime())) { + ATH_MSG_WARNING ( " CSC sampling time from Collection is NOT consistant to calibTool parameter!!!!!!! " ); + } + + /** for each Rdo, loop over RawData, converter RawData to PrepRawData + retrieve/create PrepRawData collection, and insert PrepRawData into collection */ + CscRawDataCollection::const_iterator itD = rawCollection->begin(); + CscRawDataCollection::const_iterator itD_e = rawCollection->end(); + + // Each RDO Collection goes into a PRD Collection, but we need to know what hash the PRD container is + // and this is determined by the stationID, no the RDO hash ID + ATH_MSG_DEBUG("CSC RDO ID " << rawCollection->identify() << " with hashID " << rawCollection->identifyHash() ); + // Just use the first iterator entry as stationID does not change between data inside a single container + Identifier stationId = m_cscRdoDecoderTool->stationIdentifier( (const CscRawData *)(*itD) ); + if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { + ATH_MSG_WARNING ( "Unable to get CSC digiti collection hash id " + << "context begin_index = " << cscContext.begin_index() + << " context end_index = " << cscContext.end_index() + << " the identifier is " ); + stationId.show(); + } + ATH_MSG_DEBUG("Create CSC PRD Collection with hash " << cscHashId << " (givenHashId is " << givenHashId << ")"); + std::unique_ptr<CscStripPrepDataCollection> collection = nullptr; + CscStripPrepDataContainer::IDC_WriteHandle lock = m_outputCollection->getWriteHandle( cscHashId ); + // Note that if the hash check above works, we should never reach this step where the lock is present + if( lock.alreadyPresent() ) { + ATH_MSG_DEBUG ( "CSC PRD collection already exist with collection hash = " << cscHashId << " collection filling is skipped!"); + decodedIdhs.push_back(givenHashId); + return StatusCode::SUCCESS; + } + else{ + ATH_MSG_DEBUG ( "CSC PRD collection does not exist - creating a new one with hash = " << cscHashId ); + collection = std::make_unique<CscStripPrepDataCollection>( cscHashId ); + collection->setIdentifier(stationId); + } + + for (; itD!=itD_e; ++itD) { + const CscRawData * data = (*itD); + uint16_t width = data->width(); + uint16_t totalSamples = (data->samples()).size(); + uint32_t hashOffset = data->hashId(); + + ATH_MSG_DEBUG ( " Size of online cluster in this RawData: " + << " Width = " << width << " Samples = " << totalSamples + << " stationId : " << stationId << " hashOffset : " << hashOffset); + + for (unsigned int j=0; j<width; ++j) { + const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(data, j); + ATH_MSG_DEBUG ( " LOOP over width " << j << " " << channelId ); + + const CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(channelId); + //calculate local positions on the strip planes + if ( !descriptor ) { + ATH_MSG_WARNING ( "Invalid descriptor for " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + << " Skipping channel " ); + continue; + } else if (!descriptor->containsId(channelId)) { + ATH_MSG_WARNING ("Identifier from the cabling service <" + <<m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + <<"> inconsistent with the geometry of detector element <" + <<m_muonIdHelperTool->cscIdHelper().show_to_string(descriptor->identify()) + <<"> =>>ignore this hit"); + continue; + } + + float timeOfFirstSample = 0.0; + bool extractSamples = data->samples(j, numSamples, samples); + if (!extractSamples) { + ATH_MSG_WARNING ( "Unable to extract samples for strip " << j + << " Online Cluster width = " << width + << " for number of Samples = " << numSamples + << " continuing ..." ); + continue; + } + + // uint32_t stripHash = hashOffset+j; + IdentifierHash stripHash; + if (m_muonIdHelperTool->cscIdHelper().get_channel_hash(channelId, stripHash)) { + ATH_MSG_WARNING ( "Unable to get CSC strip hash id"); + channelId.show(); + } + + bool adctocharge = m_cscCalibTool->adcToCharge(samples, stripHash, charges); + if ( !adctocharge ) { + ATH_MSG_WARNING ( " CSC conversion ADC to Charge failed " + << "CSC PrepData not build ... skipping " ); + continue; + } + if ( samples.size() >=4 ) + ATH_MSG_DEBUG ( "ADC: " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + << " " << samples[0] << " " << samples[1] << " " << samples[2] << " " << samples[3] + << " Charges: " + << " " << charges[0] << " " << charges[1] << " " << charges[2] << " " << charges[3] ); + + int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(channelId); + + Amg::Vector2D localWirePos1( descriptor->xCoordinateInTrackingFrame(channelId ),0.); + + int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(channelId); + float stripWidth = descriptor->cathodeReadoutPitch( chamberLayer, measuresPhi ); + double errPos = stripWidth / sqrt(12.0); + + AmgSymMatrix(2) covariance; + covariance.setIdentity(); + covariance *= errPos*errPos; + Amg::MatrixX * errClusterPos = new Amg::MatrixX(covariance); + + /** new CscStripPrepRawData */ + CscStripPrepData * newPrepData = new CscStripPrepData(channelId, + cscHashId, + localWirePos1, + errClusterPos, + descriptor, + charges, + timeOfFirstSample, + samplingTime); + + if (samplingPhase) newPrepData->set_samplingPhase(); + newPrepData->setHashAndIndex(collection->identifyHash(), collection->size()); + collection->push_back(newPrepData); + + } + } + // Record the container + StatusCode status_lock = lock.addOrDelete(std::move( collection ) ); + if (status_lock.isFailure()) { + ATH_MSG_ERROR ( "Could not insert CscStripPrepdataCollection into CscStripPrepdataContainer..." ); + return StatusCode::FAILURE; + } + else{ + decodedIdhs.push_back(cscHashId); + } + return StatusCode::SUCCESS; +} + +//************** Process for all in case of Offline +StatusCode CscRdoToCscPrepDataToolMT::decode(const CscRawDataContainer* rdoContainer, std::vector<IdentifierHash>& decodedIdhs) +{ + + typedef CscRawDataContainer::const_iterator collection_iterator; + + IdContext cscContext = m_muonIdHelperTool->cscIdHelper().module_context(); + + // if CSC decoding is switched off stop here + if( !m_decodeData ) { + ATH_MSG_DEBUG ( "Stored empty container. " + << "Decoding CSC RDO into CSC PrepRawData is switched off" ); + return StatusCode::SUCCESS; + } + ATH_MSG_DEBUG ( "Decoding CSC RDO into CSC PrepRawData" ); + + collection_iterator rdoColl = rdoContainer->begin(); + collection_iterator lastRdoColl = rdoContainer->end(); + std::vector<float> charges; + charges.reserve(4); + std::vector<uint16_t> samples; + samples.reserve(4); + + Identifier oldId; + IdentifierHash cscHashId; + Identifier stationId; + for (; rdoColl!=lastRdoColl; ++rdoColl) { + if ( (*rdoColl)->size() > 0 ) { + ATH_MSG_DEBUG ( " Number of RawData in this rdo " << (*rdoColl)->size() ); + + const CscRawDataCollection* cscCollection = *rdoColl; + unsigned int samplingTime = cscCollection->rate(); + unsigned int numSamples = cscCollection->numSamples(); + bool samplingPhase = cscCollection->samplingPhase(); + + if ( int(samplingTime) != int(m_cscCalibTool->getSamplingTime())) { + ATH_MSG_WARNING ( " CSC sampling time from Collection is NOT consistant to calibTool parameter!!!!!!! " ); + } + /** for each Rdo, loop over RawData, converter RawData to PrepRawData + retrieve/create PrepRawData collection, and insert PrepRawData into collection */ + CscRawDataCollection::const_iterator itD = cscCollection->begin(); + CscRawDataCollection::const_iterator itD_e = cscCollection->end(); + + // Each RDO Collection goes into a PRD Collection, but we need to know what hash the PRD container is + // and this is determined by the stationID, no the RDO hash ID + ATH_MSG_DEBUG("CSC RDO ID " << (*rdoColl)->identify() << " with hashID " << (*rdoColl)->identifyHash() ); + // Just use the first iterator entry as stationID does not change between data inside a single container + Identifier stationId = m_cscRdoDecoderTool->stationIdentifier( (const CscRawData *)(*itD) ); + if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { + ATH_MSG_WARNING ( "Unable to get CSC digiti collection hash id " + << "context begin_index = " << cscContext.begin_index() + << " context end_index = " << cscContext.end_index() + << " the identifier is " ); + stationId.show(); + } + + ATH_MSG_DEBUG("Create CSC PRD Collection with hash " << cscHashId); + std::unique_ptr<CscStripPrepDataCollection> collection = nullptr; + CscStripPrepDataContainer::IDC_WriteHandle lock = m_outputCollection->getWriteHandle( cscHashId ); + if( lock.alreadyPresent() ) { + ATH_MSG_DEBUG ( "CSC PRD collection already exist with collection hash = " << cscHashId << " collection filling is skipped!"); + continue; + } + else{ + ATH_MSG_DEBUG ( "CSC PRD collection does not exist - creating a new one with hash = " << cscHashId ); + collection = std::make_unique<CscStripPrepDataCollection>( cscHashId ); + collection->setIdentifier(stationId); + } + + // This loops over the RDO data, decodes and puts into the PRD collection + for (; itD!=itD_e; ++itD) { + const CscRawData * data = (*itD); + uint16_t width = data->width(); + uint16_t totalSamples = (data->samples()).size(); + uint32_t hashOffset = data->hashId(); + + ATH_MSG_DEBUG ( "DecodeAll*Size of online cluster in this RawData: " + << " Width = " << width << " Samples = " << totalSamples + << " stationId : " << stationId << " hashOffset : " << hashOffset); + + for (unsigned int j=0; j<width; ++j) { + const Identifier channelId = m_cscRdoDecoderTool->channelIdentifier(data, j); + ATH_MSG_DEBUG ( "DecodeAll**LOOP over width " << j << " " << channelId ); + + const CscReadoutElement * descriptor = m_muonMgr->getCscReadoutElement(channelId); + //calculate local positions on the strip planes + if ( !descriptor ) { + ATH_MSG_WARNING ( "Invalid descriptor for " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + << " Skipping channel " ); + continue; + } + else if (!descriptor->containsId(channelId)) { + ATH_MSG_WARNING ("Identifier from the cabling service <" + <<m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) + <<"> inconsistent with the geometry of detector element <" + <<m_muonIdHelperTool->cscIdHelper().show_to_string(descriptor->identify()) + <<"> =>>ignore this hit"); + continue; + } + + float timeOfFirstSample = 0.0; + bool extractSamples = data->samples(j, numSamples, samples); + if (!extractSamples) { + ATH_MSG_WARNING ( "Unable to extract samples for strip " << j + << " Online Cluster width = " << width + << " for number of Samples = " << numSamples + << " continuing ..." ); + continue; + } + + + // uint32_t stripHash = hashOffset+j; + IdentifierHash stripHash; + if (m_muonIdHelperTool->cscIdHelper().get_channel_hash(channelId, stripHash)) { + ATH_MSG_WARNING ( "Unable to get CSC strip hash id"); + channelId.show(); + } + + + Identifier channelIdFromHash; + m_muonIdHelperTool->cscIdHelper().get_id(stripHash, channelIdFromHash, &cscContext); + + + bool adctocharge = m_cscCalibTool->adcToCharge(samples, stripHash, charges); + if ( !adctocharge ) { + ATH_MSG_WARNING ( " CSC conversion ADC to Charge failed " + << "CSC PrepData not build ... skipping " ); + continue; + } + if ( samples.size() >=4 ) + ATH_MSG_DEBUG ( "DecodeAll*** ADC: " << m_muonIdHelperTool->cscIdHelper().show_to_string(channelId) << " " + << (int) stripHash << " " + << m_muonIdHelperTool->cscIdHelper().show_to_string(channelIdFromHash) + << " " << samples[0] << " " << samples[1] << " " << samples[2] << " " << samples[3] + << " Charges: " + << " " << charges[0] << " " << charges[1] << " " << charges[2] << " " << charges[3] ); + if (m_muonIdHelperTool->cscIdHelper().get_hash(stationId, cscHashId, &cscContext)) { + ATH_MSG_WARNING ( "Unable to get CSC hash id from CSC RDO collection " + << "context begin_index = " << cscContext.begin_index() + << " context end_index = " << cscContext.end_index() + << " the identifier is " ); + stationId.show(); + } + + // Check if this strip is already decoded.. Then we don't have to decode it again + bool IsThisStripDecoded =0; + for ( CscStripPrepDataCollection::const_iterator idig=collection->begin(); + idig!=collection->end(); ++idig ) { + const CscStripPrepData& dig = **idig; + Identifier did = dig.identify(); + if (did ==channelId) { + IsThisStripDecoded =1; + break; + } + } + if (IsThisStripDecoded) continue; + + int measuresPhi = m_muonIdHelperTool->cscIdHelper().measuresPhi(channelId); + + Amg::Vector2D localWirePos1( descriptor->xCoordinateInTrackingFrame(channelId ),0.); + + + int chamberLayer = m_muonIdHelperTool->cscIdHelper().chamberLayer(channelId); + float stripWidth = descriptor->cathodeReadoutPitch( chamberLayer, measuresPhi ); + double errPos = stripWidth / sqrt(12.0); + + AmgSymMatrix(2) covariance; + covariance.setIdentity(); + covariance *= errPos*errPos; + Amg::MatrixX * errClusterPos = new Amg::MatrixX(covariance); + + /** new CscPrepRawData */ + CscStripPrepData * newPrepData = new CscStripPrepData( channelId, + cscHashId, + localWirePos1, + errClusterPos, + descriptor, + charges, + timeOfFirstSample, + samplingTime); + + if (samplingPhase) newPrepData->set_samplingPhase(); + newPrepData->setHashAndIndex(collection->identifyHash(), collection->size()); + collection->push_back(newPrepData); + + } + } + // Record the container after looping through all the RDO data in this RDO collection + StatusCode status_lock = lock.addOrDelete(std::move( collection ) ); + if (status_lock.isFailure()) { + ATH_MSG_ERROR ( "Could not insert CscStripPrepdataCollection into CscStripPrepdataContainer..." ); + return StatusCode::FAILURE; + } + decodedIdhs.push_back(cscHashId); + } + } + return StatusCode::SUCCESS; +} \ No newline at end of file diff --git a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.h b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.h index 88c4ba2e7b4ae79ad104332d942c28752c500d69..aacbf864131ce7eb712b55cf7b449dba699b6079 100644 --- a/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonCSC_CnvTools/src/CscRdoToCscPrepDataToolMT.h @@ -6,6 +6,7 @@ #define MUONCSC_CNVTOOLS_CSCRDOTOCSCPREPDATATOOLMT_H #include "CscRdoToCscPrepDataToolCore.h" +#include "MuonPrepRawData/MuonPrepDataCollection_Cache.h" #include <string> @@ -40,6 +41,14 @@ namespace Muon { using CscRdoToCscPrepDataToolCore::decode; virtual StatusCode decode(std::vector<IdentifierHash>& givenIdhs, std::vector<IdentifierHash>& decodedIdhs) override; + virtual StatusCode decode(const CscRawDataContainer* rdoContainer, IdentifierHash givenHashId, std::vector<IdentifierHash>& decodedIdhs) override; + virtual StatusCode decode(const CscRawDataContainer* rdoContainer, std::vector<IdentifierHash>& decodedIdhs) override; + + + + private: + /// This is the key for the cache for the CSC PRD containers, can be empty + SG::UpdateHandleKey<CscStripPrepDataCollection_Cache> m_prdContainerCacheKey ; }; } #endif /// MUONCSC_CNVTOOL_CSCRDOTOCSCPREPDATA_H diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/CMakeLists.txt index 586366eb529273c4aafd28c23b8f9e9ec46285c9..2cfa3cf3e0466d22a6cf29a10a7b850f4e44d324 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/CMakeLists.txt @@ -44,6 +44,7 @@ atlas_depends_on_subdirs( Event/EventPrimitives InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixellReadoutGeometry MuonSpectrometer/MuonDetDescr/MuonAGDDDescription MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers @@ -123,7 +124,7 @@ foreach( name CscMcDataCnv_p1_test CscSimDataCnv_p1_test SOURCES test/${name}.cxx LINK_LIBRARIES ${GEOMODELCORE_LIBRARIES} GaudiKernel TrkSurfaces TrkEventTPCnv TestTools StoreGateLib TPTools AGDDKernel AtlasDetDescr - IdDict IdDictDetDescr IdDictParser InDetIdentifier InDetReadoutGeometry + IdDict IdDictDetDescr IdDictParser InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry MuonAGDDDescription MuonReadoutGeometry MuonIdHelpersLib TrkEventPrimitives TrkPseudoMeasurementOnTrack MuonEventTPCnv AthenaKernel LOG_IGNORE_PATTERN "MultiRange built successfully|element hash max" diff --git a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/make_dd.icc b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/make_dd.icc index 265dfe3e4ecc7dad256893cb64d3080514368fb5..c1589ca24c6767593ca47f4559161d3efe9e49c8 100644 --- a/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/make_dd.icc +++ b/MuonSpectrometer/MuonCnv/MuonEventTPCnv/test/make_dd.icc @@ -18,7 +18,7 @@ #include "MuonReadoutGeometry/TgcReadoutElement.h" #include "MuonReadoutGeometry/sTgcReadoutElement.h" #include "MuonReadoutGeometry/MMReadoutElement.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/TRT_DetectorManager.h" #include "IdDictDetDescr/IdDictManager.h" diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx index c384bb51b6a9b2e0d35e7ba355e14be678e86579..d52bc13d1e9ad217b002e34126d37e123a6e01cc 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.cxx @@ -54,7 +54,6 @@ Muon::MdtRdoToPrepDataToolCore::MdtRdoToPrepDataToolCore(const std::string& t, // template for property decalration declareProperty("CalibratePrepData", m_calibratePrepData = true ); declareProperty("DecodeData", m_decodeData = true ); - declareProperty("SortPrepData", m_sortPrepData = false ); // + TWIN TUBE declareProperty("UseTwin", m_useTwin = true); @@ -224,69 +223,75 @@ void Muon::MdtRdoToPrepDataToolCore::processRDOContainer( std::vector<Identifier const MdtCsmContainer* rdoContainer = getRdoContainer(); if(!rdoContainer) { return; - } - // unseeded mode - for (MdtCsmContainer::const_iterator rdoColli = rdoContainer->begin(); rdoColli!=rdoContainer->end(); ++rdoColli) { - - auto rdoColl = *rdoColli; - if (rdoColl->empty()) continue; - ATH_MSG_DEBUG("A new csm here with " << rdoColl->size() <<" amt hits inside "); - if(processCsm(rdoColl, idWithDataVect).isFailure()) { - ATH_MSG_DEBUG("processCsm returns a bad StatusCode - keep going for new data collections in this event"); - } - } - // finally sort the collections - if (m_sortPrepData) { - for( auto it = m_mdtPrepDataContainer->begin();it != m_mdtPrepDataContainer->end(); ++it) { - sortMdtPrdCollection(*it); - } - } -} + } -void Muon::MdtRdoToPrepDataToolCore::sortMdtPrdCollection( const Muon::MdtPrepDataCollection* col ){ - // this method is using nasty const_casts - we should get rid of them if possible - if(!col) return; - const_cast<Muon::MdtPrepDataCollection*>(col)->sort([]( const Muon::MdtPrepData* prd1, const Muon::MdtPrepData* prd2 ) { - return prd1->identify() < prd2->identify(); - }); - // need to modify indices saved within the sorted PrepData objects - for (unsigned short index=0; index < col->size(); ++index) { - const_cast<IdentContIndex*>( &(col->at(index)->getHashAndIndex()) )->setObjIndex(index); + // It is more practical to loop through all the hashes rather than all RDO elements + // as we benefit from handling the 2 RDO to 1 PRD special case + for(unsigned int iHash = 0; iHash < m_muonIdHelperTool->mdtIdHelper().module_hash_max(); iHash++){ + handlePRDHash( IdentifierHash(iHash), *rdoContainer, idWithDataVect); } + } bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const MdtCsmContainer& rdoContainer, std::vector<IdentifierHash>& idWithDataVect ) { - // if in prep data the chamber already exists ... do nothing - if( m_mdtPrepDataContainer->indexFind(hash) != m_mdtPrepDataContainer->end() ){ + // Check PRD container for the hash, if it exists, we already decoded fully + if( m_mdtPrepDataContainer->tryAddFromCache(hash) ){ + ATH_MSG_DEBUG("RDO hash " << hash << " already decoded and inside PRD container cache"); return true; } + IdentifierHash rdoHash = hash; // before BMEs were installed, RDOs were indexed by offline hashes (same as PRD) if (m_BMEpresent) { // after BMEs were installed, the RDOs are indexed by the detectorElement hash of a multilayer Identifier elementId; IdContext tmp_context = m_muonIdHelperTool->mdtIdHelper().module_context(); m_muonIdHelperTool->mdtIdHelper().get_id(hash, elementId, &tmp_context); + Identifier multilayerId = m_muonIdHelperTool->mdtIdHelper().multilayerID(elementId, 1); //first multilayer IdentifierHash multilayerHash; m_muonIdHelperTool->mdtIdHelper().get_detectorElement_hash(multilayerId, multilayerHash); rdoHash = multilayerHash; - - // process CSM if data was found - MdtCsmContainer::const_iterator rdoColli = rdoContainer.indexFind(rdoHash); - if( rdoColli != rdoContainer.end() ) { - if ( processCsm(*rdoColli, idWithDataVect).isFailure() ) { - ATH_MSG_WARNING("processCsm failed for RDO id " << (unsigned long long)((*rdoColli)->identify().get_compact())); - return false; - } - } else ATH_MSG_DEBUG("handlePRDHash: hash id " << (unsigned int)(hash) << " not found in RDO container"); - + // for BMEs there are 2 CSMs per chamber, registered with the hashes of the 2 multilayers - // we've processed only one now, now time for the second + // If this is BMEid then we handle two RDO at once, else just one if (m_muonIdHelperTool->mdtIdHelper().stationName(elementId) == m_BMEid) { - multilayerId = m_muonIdHelperTool->mdtIdHelper().multilayerID(elementId, 2); //second multilayer - m_muonIdHelperTool->mdtIdHelper().get_detectorElement_hash(multilayerId, multilayerHash); - rdoHash = multilayerHash; - + Identifier multilayerId2 = m_muonIdHelperTool->mdtIdHelper().multilayerID(elementId, 2); //second multilayer + IdentifierHash multilayerHash2; + m_muonIdHelperTool->mdtIdHelper().get_detectorElement_hash(multilayerId2, multilayerHash2); + IdentifierHash rdoHash2 = multilayerHash2; + // Retrieve the two RDO + MdtCsmContainer::const_iterator rdoColli = rdoContainer.indexFind(rdoHash); + MdtCsmContainer::const_iterator rdoColli2 = rdoContainer.indexFind(rdoHash2); + if( rdoColli != rdoContainer.end() && rdoColli2 != rdoContainer.end() ) { + // Handle both at once + if(processCsm(*rdoColli, idWithDataVect, *rdoColli2).isFailure()){ + ATH_MSG_WARNING("processCsm failed for RDO id " + << (unsigned long long)((*rdoColli)->identify().get_compact()) << " and " + << (unsigned long long)((*rdoColli2)->identify().get_compact())); + return false; + } + } + else if(rdoColli != rdoContainer.end()){ + // Handle just one + ATH_MSG_WARNING("Only one RDO container was found for hash " << hash << " despite BME - Missing " << rdoHash2 ); + if ( processCsm(*rdoColli, idWithDataVect).isFailure() ) { + ATH_MSG_WARNING("processCsm failed for RDO id " << (unsigned long long)((*rdoColli)->identify().get_compact())); + return false; + } + } + else if(rdoColli2 != rdoContainer.end()){ + // Handle just one + ATH_MSG_WARNING("Only one RDO container was found for hash " << hash << " despite BME - Missing " << rdoHash ); + if ( processCsm(*rdoColli2, idWithDataVect).isFailure() ) { + ATH_MSG_WARNING("processCsm failed for RDO id " << (unsigned long long)((*rdoColli)->identify().get_compact())); + return false; + } + } + else{ + ATH_MSG_WARNING("handlePRDHash: hash id " << hash << " not found in RDO container, and is BME - Missing " << rdoHash << " " << rdoHash2); + } + } // End of m_BMEpresent + else{ // process CSM if data was found MdtCsmContainer::const_iterator rdoColli = rdoContainer.indexFind(rdoHash); if( rdoColli != rdoContainer.end() ) { @@ -295,8 +300,7 @@ bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const M return false; } } else ATH_MSG_DEBUG("handlePRDHash: hash id " << (unsigned int)(hash) << " not found in RDO container"); - - } + } } else { // using pre-BME data // process CSM if data was found MdtCsmContainer::const_iterator rdoColli = rdoContainer.indexFind(rdoHash); @@ -307,14 +311,7 @@ bool Muon::MdtRdoToPrepDataToolCore::handlePRDHash( IdentifierHash hash, const M } } else ATH_MSG_DEBUG("handlePRDHash: hash id " << (unsigned int)(hash) << " not found in RDO container"); } - - // sort hits in the collection - if (m_sortPrepData) { - auto it = m_mdtPrepDataContainer->indexFind(hash); - if( it != m_mdtPrepDataContainer->end() ) { - sortMdtPrdCollection(*it); - } - } + return true; } @@ -457,7 +454,7 @@ void Muon::MdtRdoToPrepDataToolCore::printPrepData( ) } -StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std::vector<IdentifierHash>& idWithDataVect) { +StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std::vector<IdentifierHash>& idWithDataVect, const MdtCsm *rdoColl2 ) { // first handle the case of twin tubes if(m_useTwin){ @@ -473,21 +470,39 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std ATH_MSG_DEBUG(" ***************** Start of processCsm"); + // Make some checks if we are in special circumstances + if(rdoColl2){ + Identifier elementId1 = m_muonIdHelperTool->mdtIdHelper().parentID(rdoColl->identify()); + Identifier elementId2 = m_muonIdHelperTool->mdtIdHelper().parentID(rdoColl2->identify()); + IdContext mdtContext = m_muonIdHelperTool->mdtIdHelper().module_context(); + IdentifierHash hash1, hash2; + m_muonIdHelperTool->mdtIdHelper().get_hash(elementId1, hash1, &mdtContext); + m_muonIdHelperTool->mdtIdHelper().get_hash(elementId2, hash2, &mdtContext); + ATH_MSG_DEBUG("Special case with 2 RDO going into 1 PRD - ID1 " << elementId1 + << " ID2 " << elementId2 << " hash 1 " << hash1 << " hash 2 " << hash2 ); + // These should have the same PRD MDT hash otherwise we need to understand why we are here + if(hash1 != hash2){ + ATH_MSG_ERROR("Hash1 and Hash2 are different for special case : " << hash1 << " " << hash2); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG(" Number of AmtHit in this Csm (1) " << rdoColl->size() <<" CSM id is "<<m_idHelper->toString(elementId1)); + ATH_MSG_DEBUG(" Number of AmtHit in this Csm (2) " << rdoColl2->size() <<" CSM id is "<<m_idHelper->toString(elementId2)); + } + /// MDT hit context //IdContext hitContext = m_muonIdHelperTool->mdtIdHelper().channel_context(); Identifier elementId = m_muonIdHelperTool->mdtIdHelper().parentID(rdoColl->identify()); - + // prepare the special case of two chamber connected to the same CSM // create objects but do not initialize them bool doubleCsmFound = false; bool doubleCsm = false; Identifier secondElementId; - MdtPrepDataCollection* secondDriftCircleColl = NULL; IdentifierHash secondMdtHashId; - ATH_MSG_DEBUG(" Number of AmtHit in this Csm " - << rdoColl->size() <<" CSM id is "<<m_idHelper->toString(elementId)); + if(!rdoColl2) + ATH_MSG_DEBUG(" Number of AmtHit in this Csm " << rdoColl->size() <<" CSM id is "<<m_idHelper->toString(elementId)); uint16_t subdetId = rdoColl->SubDetId(); uint16_t mrodId = rdoColl->MrodId(); @@ -508,34 +523,21 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std } ATH_MSG_VERBOSE("HashId = "<<(int)mdtHashId); - MdtPrepDataCollection * driftCircleColl = NULL; + std::unique_ptr<MdtPrepDataCollection> driftCircleColl = nullptr; + std::unique_ptr<MdtPrepDataCollection> secondDriftCircleColl = nullptr; - if ( m_mdtPrepDataContainer->indexFind(mdtHashId) != m_mdtPrepDataContainer->end() ) { - // for elevator chambers there are 2 CSMs to be filled in the same collection - if ( m_muonIdHelperTool->mdtIdHelper().stationName(elementId) == m_BMEid && m_BMEpresent) { - driftCircleColl = const_cast<MdtPrepDataCollection*>(&(**m_mdtPrepDataContainer->indexFind(mdtHashId))); - ATH_MSG_DEBUG("In ProcessCSM - collection already contained in IDC, but BME! Taking it."); - } - else { - ATH_MSG_DEBUG("In ProcessCSM - collection already contained in IDC"); - return StatusCode::FAILURE; - } + // Check the IDC cache (no write handles here) + if( m_mdtPrepDataContainer->tryAddFromCache(mdtHashId) ){ + // The collection is in the container so we should not process anything (true for elevator chambers) + ATH_MSG_DEBUG("In ProcessCSM - collection already contained in IDC " << elementId << " " << mdtHashId); + // But instead of returning, we will process in case this RDO has two possible PRD and we only decoded one } - // create new collection + add it if there's nothing yet (also for the first CSM of a elevator chambers) - else { - driftCircleColl = new MdtPrepDataCollection(mdtHashId); + // Create new collection + else{ + driftCircleColl.reset( new MdtPrepDataCollection( mdtHashId ) ); idWithDataVect.push_back(mdtHashId); driftCircleColl->setIdentifier(elementId); - ATH_MSG_DEBUG("A new MdtPrepDataCollection here with hashId " << (unsigned int)mdtHashId); - //MdtPrepDataContainer::KEY key = m_mdtPrepDataContainer->key(elementId); - - if (StatusCode::SUCCESS != m_mdtPrepDataContainer->addCollection(driftCircleColl, mdtHashId)) { - ATH_MSG_DEBUG("In ProcessCSM - Couldn't record in the Container MDT Drift Circle Collection with hashID = " - << (int)mdtHashId <<" ext. id = " - << m_idHelper->toString(elementId)); - return StatusCode::FAILURE; - } - ATH_MSG_DEBUG("MdtPrepDataCollection added to the container"); + ATH_MSG_DEBUG("Created MdtPrepDataCollection (not found in cache) " << mdtHashId); } // for each Csm, loop over AmtHit, converter AmtHit to digit @@ -544,7 +546,7 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std MdtCsm::const_iterator itD_e = rdoColl->end(); int mc = 0; - for (; itD!=itD_e; ++itD) { + for (; itD!=itD_e; ) { mc++; const MdtAmtHit * amtHit = (*itD); @@ -617,22 +619,16 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std } ATH_MSG_VERBOSE("HashId = "<<(int) secondMdtHashId); - if (m_mdtPrepDataContainer->indexFind(secondMdtHashId)!=m_mdtPrepDataContainer->end()) { + // If we got to here we need to inspect the cache and create or nullptr + if( m_mdtPrepDataContainer->tryAddFromCache(secondMdtHashId) ){ ATH_MSG_DEBUG("In ProcessCSM - collection already contained in IDC"); - return StatusCode::FAILURE; + // Proceed with the nullptr } - - secondDriftCircleColl = new MdtPrepDataCollection(secondMdtHashId); - idWithDataVect.push_back(secondMdtHashId); - secondDriftCircleColl->setIdentifier(secondElementId); - - ATH_MSG_DEBUG("A new MdtPrepDataCollection here with hashId " << (unsigned int)secondMdtHashId); - - if (StatusCode::SUCCESS != m_mdtPrepDataContainer->addCollection(secondDriftCircleColl, secondMdtHashId)) { - ATH_MSG_DEBUG("In ProcessCSM - Couldn't record in the Container MDT Drift Circle Collection with hashID = " - << (int)secondMdtHashId <<" ext. id = " - << m_idHelper->toString(secondElementId)); - return StatusCode::FAILURE; + else{ + secondDriftCircleColl.reset( new MdtPrepDataCollection(secondMdtHashId) ); + idWithDataVect.push_back(secondMdtHashId); + secondDriftCircleColl->setIdentifier(secondElementId); + ATH_MSG_DEBUG("Created second MdtPrepDataCollection (not found in cache) " << secondMdtHashId); } } } @@ -684,29 +680,73 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsm(const MdtCsm *rdoColl, std IdentifierHash hashId; if ( (!doubleCsmFound) || (!doubleCsm) ) { - collectionToBeUpdated = driftCircleColl; + collectionToBeUpdated = driftCircleColl.get(); hashId = mdtHashId; } else { - collectionToBeUpdated = secondDriftCircleColl; + collectionToBeUpdated = secondDriftCircleColl.get(); hashId = secondMdtHashId; } - MdtPrepData* newPrepData = new MdtPrepData(channelId, - hashId, - driftRadius, - cov, - descriptor, - newDigit->tdc(), - newDigit->adc(), - digitStatus); - - newPrepData->setHashAndIndex(collectionToBeUpdated->identifyHash(), collectionToBeUpdated->size()); - collectionToBeUpdated->push_back(newPrepData); + // We can make the MdtPrepData, but only if our collection is being used (ie not null) + if(collectionToBeUpdated){ + MdtPrepData* newPrepData = new MdtPrepData(channelId, + hashId, + driftRadius, + cov, + descriptor, + newDigit->tdc(), + newDigit->adc(), + digitStatus); + + newPrepData->setHashAndIndex(collectionToBeUpdated->identifyHash(), collectionToBeUpdated->size()); + collectionToBeUpdated->push_back(newPrepData); + } delete newDigit; + // Special case when we need to process two RDO for one PRD in a single pass + ++itD; + // Check if we have two containers + if(rdoColl2){ + // Check finished the first collection (second pass is handled by for-loop end condition) + if(itD == rdoColl->end()){ + ATH_MSG_DEBUG("RDO collection 1 is processed - Iterators moving to RDO collection 2"); + // Update our iterators and continue processing + itD = rdoColl2->begin(); + itD_e = rdoColl2->end(); + mc = 0; // for logging + } + } } + // At the end, we finally tell the cache we will be putting collections into it + if(driftCircleColl){ + MdtPrepDataContainer::IDC_WriteHandle lock = m_mdtPrepDataContainer->getWriteHandle( mdtHashId ); + if( !lock.alreadyPresent() ){ + StatusCode status_lock = lock.addOrDelete(std::move( driftCircleColl )); + if (status_lock.isFailure()) { + ATH_MSG_ERROR ( "Could not insert MdtCsmPrepdataCollection into MdtCsmPrepdataContainer..." ); + return StatusCode::FAILURE; + } + } + else{ + ATH_MSG_DEBUG("MdtCsmPrepdataCollection already inside MdtCsmPrepdataContainer " << mdtHashId); + } + } + if(secondDriftCircleColl){ + MdtPrepDataContainer::IDC_WriteHandle lock = m_mdtPrepDataContainer->getWriteHandle( secondMdtHashId ); + if( !lock.alreadyPresent() ){ + StatusCode status_lock = lock.addOrDelete(std::move( secondDriftCircleColl )); + if (status_lock.isFailure()) { + ATH_MSG_ERROR ( "Could not insert MdtCsmPrepdataCollection into MdtCsmPrepdataContainer..." ); + return StatusCode::FAILURE; + } + } + else{ + ATH_MSG_DEBUG("MdtCsmPrepdataCollection already inside MdtCsmPrepdataContainer " << secondMdtHashId); + } + } + return StatusCode::SUCCESS; } @@ -742,24 +782,17 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, } ATH_MSG_VERBOSE("HashId = "<<(int)mdtHashId); - if (m_mdtPrepDataContainer->indexFind(mdtHashId)!=m_mdtPrepDataContainer->end()) { - ATH_MSG_DEBUG("In ProcessCSM - collection already contained in IDC"); - return StatusCode::FAILURE; - } - - MdtPrepDataCollection * driftCircleColl = new MdtPrepDataCollection(mdtHashId); + // Check the IDC cache (no write handles here) + MdtPrepDataContainer::IDC_WriteHandle lock = m_mdtPrepDataContainer->getWriteHandle( mdtHashId ); + if( lock.alreadyPresent() ){ + ATH_MSG_DEBUG("MdtPrepDataCollection already contained in IDC " << elementId << " " << mdtHashId); + return StatusCode::SUCCESS; + } + + std::unique_ptr<MdtPrepDataCollection> driftCircleColl ( new MdtPrepDataCollection( mdtHashId ) ); idWithDataVect.push_back(mdtHashId); driftCircleColl->setIdentifier(elementId); - ATH_MSG_DEBUG("A new MdtPrepDataCollection here with hashId " << (unsigned int)mdtHashId); - //MdtPrepDataContainer::KEY key = m_mdtPrepDataContainer->key(elementId); - - if (StatusCode::SUCCESS != m_mdtPrepDataContainer->addCollection(driftCircleColl, mdtHashId)) { - ATH_MSG_DEBUG("In ProcessCSMtwin - Couldn't record in the Container MDT Drift Circle Collection with hashID = " - << (int)mdtHashId <<" ext. id = " - << m_idHelper->toString(elementId)); - return StatusCode::FAILURE; - } - ATH_MSG_DEBUG("MdtPrepDataCollection added to the container"); + ATH_MSG_DEBUG("Created MdtPrepDataCollection (not found in cache) " << mdtHashId); // for each Csm, loop over AmtHit, converter AmtHit to digit // retrieve/create digit collection, and insert digit into collection @@ -1235,9 +1268,15 @@ StatusCode Muon::MdtRdoToPrepDataToolCore::processCsmTwin(const MdtCsm *rdoColl, } - } // end for( iter_map = mdtDigitColl.begin(); iter_map != mdtDigitColl.end(); iter_map++ ) { - + } // end for( iter_map = mdtDigitColl.begin(); iter_map != mdtDigitColl.end(); iter_map++ ) + // Finished decoding RDO to PRD, so now we record the collection in the container + StatusCode status_lock = lock.addOrDelete(std::move( driftCircleColl )); + if (status_lock.isFailure()) { + ATH_MSG_ERROR ( "Could not insert MdtCsmPrepdataCollection into MdtCsmPrepdataContainer..." ); + return StatusCode::FAILURE; + } + return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h index 798dbb313362f787ba9f126e396570f3597724de..444b22d278f1a8cd2310c0ff9142a622b09e322a 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolCore.h @@ -78,12 +78,12 @@ namespace Muon //new decode method for Rob based readout StatusCode decode( const std::vector<uint32_t>& robIds ) override; - StatusCode processCsm(const MdtCsm *rdoColl, std::vector<IdentifierHash>& idWithDataVect); + virtual StatusCode processCsm(const MdtCsm *rdoColl, std::vector<IdentifierHash>& idWithDataVect, const MdtCsm *rdoColl2 = nullptr); Muon::MdtDriftCircleStatus getMdtDriftRadius(const MdtDigit * digit, double& radius, double& errRadius, const MuonGM::MdtReadoutElement * descriptor); // + TWIN TUBE - StatusCode processCsmTwin(const MdtCsm *rdoColll, std::vector<IdentifierHash>& idWithDataVect); + virtual StatusCode processCsmTwin(const MdtCsm *rdoColll, std::vector<IdentifierHash>& idWithDataVect); // method to get the twin tube 2nd coordinate Muon::MdtDriftCircleStatus getMdtTwinPosition(const MdtDigit * prompt_digit, const MdtDigit * twin_digit, double& radius, double& errRadius, @@ -113,7 +113,6 @@ namespace Muon const MdtCsmContainer* getRdoContainer(); void processPRDHashes( const std::vector<IdentifierHash>& chamberHashInRobs, std::vector<IdentifierHash>& idWithDataVect ); bool handlePRDHash( IdentifierHash hash, const MdtCsmContainer& rdoContainer, std::vector<IdentifierHash>& idWithDataVect ); - void sortMdtPrdCollection( const Muon::MdtPrepDataCollection* col ); /// Muon Detector Descriptor const MuonGM::MuonDetectorManager * m_muonMgr; diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.cxx index 0d1831eba5b4a75701e69b21e08d3ef835db9ad4..940390f0f237fd8ab186802890fc1bfb410b4a45 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.cxx @@ -14,6 +14,7 @@ Muon::MdtRdoToPrepDataToolMT::MdtRdoToPrepDataToolMT(const std::string& t, const AthAlgTool(t,n,p), MdtRdoToPrepDataToolCore(t,n,p) { + declareProperty("MdtPrdContainerCacheKey", m_prdContainerCacheKey, "Optional external cache for the MDT PRD container"); } Muon::MdtRdoToPrepDataToolMT::~MdtRdoToPrepDataToolMT() @@ -24,6 +25,7 @@ StatusCode Muon::MdtRdoToPrepDataToolMT::initialize() { ATH_MSG_VERBOSE("Starting init"); ATH_CHECK( MdtRdoToPrepDataToolCore::initialize() ); + ATH_CHECK( m_prdContainerCacheKey.initialize( !m_prdContainerCacheKey.key().empty() ) ); ATH_MSG_DEBUG("initialize() successful in " << name()); return StatusCode::SUCCESS; } @@ -35,16 +37,37 @@ StatusCode Muon::MdtRdoToPrepDataToolMT::finalize() Muon::MdtRdoToPrepDataToolMT::SetupMdtPrepDataContainerStatus Muon::MdtRdoToPrepDataToolMT::setupMdtPrepDataContainer() { - // MT version of this method always adds container. Caching will be added later. m_fullEventDone=false; SG::WriteHandle< Muon::MdtPrepDataContainer >handle(m_mdtPrepDataContainerKey); - StatusCode status = handle.record(std::make_unique<Muon::MdtPrepDataContainer>(m_muonIdHelperTool->mdtIdHelper().module_hash_max())); - if (status.isFailure() || !handle.isValid() ) { - ATH_MSG_FATAL("Could not record container of MDT PrepData Container at " << m_mdtPrepDataContainerKey.key()); - return FAILED; + // Caching of PRD container + const bool externalCachePRD = !m_prdContainerCacheKey.key().empty(); + if (!externalCachePRD) { + // without the cache we just record the container + StatusCode status = handle.record(std::make_unique<Muon::MdtPrepDataContainer>(m_muonIdHelperTool->mdtIdHelper().module_hash_max())); + if (status.isFailure() || !handle.isValid() ) { + ATH_MSG_FATAL("Could not record container of MDT PrepData Container at " << m_mdtPrepDataContainerKey.key()); + return FAILED; + } + ATH_MSG_DEBUG("Created container " << m_mdtPrepDataContainerKey.key()); + } + else { + // use the cache to get the container + SG::UpdateHandle<MdtPrepDataCollection_Cache> update(m_prdContainerCacheKey); + if (!update.isValid()){ + ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key()); + return FAILED; + } + StatusCode status = handle.record(std::make_unique<Muon::MdtPrepDataContainer>(update.ptr())); + if (status.isFailure() || !handle.isValid() ) { + ATH_MSG_FATAL("Could not record container of MDT PrepData Container using cache " + << m_prdContainerCacheKey.key() << " - " <<m_mdtPrepDataContainerKey.key()); + return FAILED; + } + ATH_MSG_DEBUG("Created container using cache for " << m_prdContainerCacheKey.key()); } + // Pass the container from the handle m_mdtPrepDataContainer = handle.ptr(); return ADDED; } \ No newline at end of file diff --git a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.h b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.h index e7aa05e8868ddf88e6e22bb9b43402d3eef72c6f..645d933bad0097c9019edd183c004f65ba5b38e2 100644 --- a/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonMDT_CnvTools/src/MdtRdoToPrepDataToolMT.h @@ -10,6 +10,7 @@ #define MUONMdtRdoToPrepDataToolMT_H #include "MdtRdoToPrepDataToolCore.h" +#include "MuonPrepRawData/MuonPrepDataCollection_Cache.h" namespace Muon { @@ -41,6 +42,10 @@ namespace Muon protected: virtual SetupMdtPrepDataContainerStatus setupMdtPrepDataContainer() override; + + private: + /// This is the key for the cache for the MDT PRD containers, can be empty + SG::UpdateHandleKey<MdtPrepDataCollection_Cache> m_prdContainerCacheKey ; }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolMT.cxx index 74063d8425e8ccf60a8f89589e4c0de802fd3f88..753cd4c2b7150e9babc780b3a3d4b58ffe40b521 100644 --- a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolMT.cxx @@ -3,7 +3,7 @@ */ /////////////////////////////////////////////////////////////////// -// MdtRdoToPrepDataTool.cxx, (c) ATLAS Detector software +// MMRdoToPrepDataTool.cxx, (c) ATLAS Detector software /////////////////////////////////////////////////////////////////// #include "MmRdoToPrepDataToolMT.h" @@ -16,6 +16,7 @@ Muon::MmRdoToPrepDataToolMT::MmRdoToPrepDataToolMT(const std::string& t, AthAlgTool(t,n,p), MmRdoToPrepDataToolCore(t,n,p) { + declareProperty("MmPrdContainterCacheKey", m_prdContainerCacheKey, "Optional external cache for the MM PRD container"); } @@ -27,6 +28,7 @@ StatusCode Muon::MmRdoToPrepDataToolMT::initialize() { ATH_MSG_VERBOSE("Starting init"); ATH_CHECK( MmRdoToPrepDataToolCore::initialize() ); + ATH_CHECK( m_prdContainerCacheKey.initialize( !m_prdContainerCacheKey.key().empty() ) ); ATH_MSG_DEBUG("initialize() successful in " << name()); return StatusCode::SUCCESS; } @@ -40,12 +42,35 @@ Muon::MmRdoToPrepDataToolCore::SetupMM_PrepDataContainerStatus Muon::MmRdoToPrep { // MT version of this method always adds container. Caching will be added later. SG::WriteHandle< Muon::MMPrepDataContainer > handle(m_mmPrepDataContainerKey); - StatusCode status = handle.record(std::make_unique<Muon::MMPrepDataContainer>(m_muonIdHelperTool->mmIdHelper().module_hash_max())); - - if (status.isFailure() || !handle.isValid() ) { - ATH_MSG_FATAL("Could not record container of MicroMega PrepData Container at " << m_mmPrepDataContainerKey.key()); - return FAILED; + + // Caching of PRD container + const bool externalCachePRD = !m_prdContainerCacheKey.key().empty(); + if (!externalCachePRD) { + // without the cache we just record the container + StatusCode status = handle.record(std::make_unique<Muon::MMPrepDataContainer>(m_muonIdHelperTool->mmIdHelper().module_hash_max())); + if (status.isFailure() || !handle.isValid() ) { + ATH_MSG_FATAL("Could not record container of MicroMega PrepData Container at " << m_mmPrepDataContainerKey.key()); + return FAILED; + } + ATH_MSG_DEBUG("Created container " << m_mmPrepDataContainerKey.key()); + } + else { + // use the cache to get the container + SG::UpdateHandle<MMPrepDataCollection_Cache> update(m_prdContainerCacheKey); + if (!update.isValid()){ + ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key()); + return FAILED; + } + StatusCode status = handle.record(std::make_unique<Muon::MMPrepDataContainer>(update.ptr())); + if (status.isFailure() || !handle.isValid() ) { + ATH_MSG_FATAL("Could not record container of MicroMega PrepData Container using cache " + << m_prdContainerCacheKey.key() << " - " <<m_mmPrepDataContainerKey.key()); + return FAILED; + } + ATH_MSG_DEBUG("Created container using cache for " << m_prdContainerCacheKey.key()); } + // Pass the container from the handle m_mmPrepDataContainer = handle.ptr(); + return ADDED; } diff --git a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolMT.h b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolMT.h index 354e811e6bf8aae336b47f3f6a055a1729cb49b8..9a48d4b1925f83c9eb700194e56087336014fcea 100644 --- a/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonMM_CnvTools/src/MmRdoToPrepDataToolMT.h @@ -21,6 +21,8 @@ #include "MuonRDO/MM_RawDataContainer.h" #include "MuonIdHelpers/MuonIdHelperTool.h" + +#include "MuonPrepRawData/MuonPrepDataCollection_Cache.h" #include <string> #include <vector> @@ -58,6 +60,10 @@ namespace Muon protected: virtual SetupMM_PrepDataContainerStatus setupMM_PrepDataContainer() override; + + private: + /// This is the key for the cache for the MM PRD containers, can be empty + SG::UpdateHandleKey<MMPrepDataCollection_Cache> m_prdContainerCacheKey ; }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.cxx index 09d90db716f397cb81ccd94e1d125896bc6fced8..83ac5691e8896ea741a7fcc8e39e46c2e066fae6 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.cxx @@ -14,6 +14,8 @@ Muon::RpcRdoToPrepDataToolMT::RpcRdoToPrepDataToolMT( const std::string& type, c : AthAlgTool( type, name, parent ), RpcRdoToPrepDataToolCore( type, name, parent ) { + declareProperty("RpcPrdContainerCacheKey", m_prdContainerCacheKey, "Optional external cache for the RPC RDO container"); + declareProperty("RpcCoinContainerCacheKey", m_coinContainerCacheKey, "Optional external cache for the RPC Trigger Coin container"); } Muon::RpcRdoToPrepDataToolMT::~RpcRdoToPrepDataToolMT() @@ -24,6 +26,8 @@ StatusCode Muon::RpcRdoToPrepDataToolMT::initialize() { ATH_MSG_VERBOSE("Starting init"); ATH_CHECK( RpcRdoToPrepDataToolCore::initialize() ); + ATH_CHECK( m_prdContainerCacheKey.initialize( !m_prdContainerCacheKey.key().empty() ) ); + ATH_CHECK( m_coinContainerCacheKey.initialize( !m_coinContainerCacheKey.key().empty() ) ); ATH_MSG_DEBUG("initialize() successful in " << name()); return StatusCode::SUCCESS; } @@ -35,55 +39,75 @@ StatusCode Muon::RpcRdoToPrepDataToolMT::finalize() StatusCode Muon::RpcRdoToPrepDataToolMT::manageOutputContainers(bool& firstTimeInTheEvent) { - // MT version of this method always adds container. Caching will be added later. + // Redundant + firstTimeInTheEvent = false; + + // RPC PRD SG::WriteHandle< Muon::RpcPrepDataContainer > rpcPrepDataHandle(m_rpcPrepDataContainerKey); - if(!rpcPrepDataHandle.isPresent()) { - firstTimeInTheEvent = true; + // Caching of PRD container + const bool externalCachePRD = !m_prdContainerCacheKey.key().empty(); + if (!externalCachePRD) { + // without the cache we just record the container StatusCode status = rpcPrepDataHandle.record(std::make_unique<Muon::RpcPrepDataContainer>(m_muonIdHelperTool->rpcIdHelper().module_hash_max())); - - if (status.isFailure() || !rpcPrepDataHandle.isValid() ) { + if (status.isFailure() || !rpcPrepDataHandle.isValid() ) { ATH_MSG_FATAL("Could not record container of RPC PrepData Container at " << m_rpcPrepDataContainerKey.key()); return status; - } else { - m_rpcPrepDataContainer = rpcPrepDataHandle.ptr(); - ATH_MSG_DEBUG("RPC PrepData Container recorded in StoreGate with key " << m_rpcPrepDataContainerKey.key() << ", " << rpcPrepDataHandle.key()); } + ATH_MSG_DEBUG("Created container " << m_prdContainerCacheKey.key()); + } + else { + // use the cache to get the container + SG::UpdateHandle<RpcPrepDataCollection_Cache> update(m_prdContainerCacheKey); + if (!update.isValid()){ + ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key()); + return StatusCode::FAILURE; + } + StatusCode status = rpcPrepDataHandle.record(std::make_unique<Muon::RpcPrepDataContainer>(update.ptr())); + if (status.isFailure() || !rpcPrepDataHandle.isValid() ) { + ATH_MSG_FATAL("Could not record container of RPC PrepData Container using cache " + << m_prdContainerCacheKey.key() << " - " << m_rpcPrepDataContainerKey.key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Created container using cache for " << m_prdContainerCacheKey.key()); + } + // Pass the container from the handle + m_rpcPrepDataContainer = rpcPrepDataHandle.ptr(); - if (m_producePRDfromTriggerWords){ - /// create an empty RPC trigger hit container for filling - SG::WriteHandle< Muon::RpcCoinDataContainer > rpcCoinDataHandle(m_rpcCoinDataContainerKey); - status = rpcCoinDataHandle.record(std::make_unique<Muon::RpcCoinDataContainer>(m_muonIdHelperTool->rpcIdHelper().module_hash_max())); - - if (status.isFailure() || !rpcCoinDataHandle.isValid() ) { + // Cache for the RPC trigger coin + if(m_producePRDfromTriggerWords){ + // RPC Trigger Coin + SG::WriteHandle< Muon::RpcCoinDataContainer > rpcCoinDataHandle(m_rpcCoinDataContainerKey); + // Caching of trigger coin container + const bool externalCacheTriggerCoin = !m_coinContainerCacheKey.key().empty(); + if(!externalCacheTriggerCoin){ + StatusCode status = rpcCoinDataHandle.record(std::make_unique<Muon::RpcCoinDataContainer>(m_muonIdHelperTool->rpcIdHelper().module_hash_max())); + if (status.isFailure() || !rpcCoinDataHandle.isValid() ) { ATH_MSG_FATAL("Could not record container of RPC TrigCoinData Container at " << m_rpcCoinDataContainerKey.key()); return status; - } else { - m_rpcCoinDataContainer = rpcCoinDataHandle.ptr(); - ATH_MSG_DEBUG("RPC TrigCoinData Container recorded in StoreGate with key " << m_rpcCoinDataContainerKey.key()); - } - ATH_MSG_VERBOSE(" RpcCoinDataContainer created"); - } - m_decodedOfflineHashIds.clear(); - m_decodedRobIds.clear(); - - } - else{ - const Muon::RpcPrepDataContainer* rpcPrepDataContainer_c; - ATH_CHECK( evtStore()->retrieve (rpcPrepDataContainer_c, m_rpcPrepDataContainerKey.key()) ); - m_rpcPrepDataContainer = const_cast<Muon::RpcPrepDataContainer*> (rpcPrepDataContainer_c); - ATH_MSG_DEBUG("RPC PrepData Container is already in StoreGate "); - if (m_producePRDfromTriggerWords){ - SG::WriteHandle< Muon::RpcCoinDataContainer > rpcCoinDataHandle(m_rpcCoinDataContainerKey); - if (!rpcCoinDataHandle.isPresent()) { - ATH_MSG_FATAL("Muon::RpcPrepDataContainer found while Muon::RpcCoinDataContainer not found in Event Store"); + } + // Clean if it was created + m_decodedOfflineHashIds.clear(); + m_decodedRobIds.clear(); + } + else{ + // use the cache to get the container + SG::UpdateHandle<RpcCoinDataCollection_Cache> update(m_coinContainerCacheKey); + if (!update.isValid()){ + ATH_MSG_FATAL("Invalid UpdateHandle " << m_coinContainerCacheKey.key()); return StatusCode::FAILURE; } - const Muon::RpcCoinDataContainer* rpcCoinDataContainer_c; - ATH_CHECK( evtStore()->retrieve (rpcCoinDataContainer_c, m_rpcCoinDataContainerKey.key()) ); - m_rpcCoinDataContainer = const_cast<Muon::RpcCoinDataContainer*> (rpcCoinDataContainer_c); - ATH_MSG_DEBUG("RPC CoinData Container is already in StoreGate "); + StatusCode status = rpcCoinDataHandle.record(std::make_unique<Muon::RpcCoinDataContainer>(update.ptr())); + if (status.isFailure() || !rpcCoinDataHandle.isValid() ) { + ATH_MSG_FATAL("Could not record container of RPC TrigCoinData Container using cache " + << m_coinContainerCacheKey.key() << " - " << m_rpcCoinDataContainerKey.key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Created container using cache for " << m_rpcCoinDataContainerKey.key()); } + // Pass the container from the handle + m_rpcCoinDataContainer = rpcCoinDataHandle.ptr(); } + return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.h b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.h index ffb2ac146bb9f077ce44966828b73e3a64950dbd..aac8ca04b1ce23935e11fca448741d5c55b0d087 100755 --- a/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonRPC_CnvTools/src/RpcRdoToPrepDataToolMT.h @@ -6,6 +6,8 @@ #define MUONRDOTOPREPDATA_RPCRDOTOPREPDATATOOLMT_H #include "RpcRdoToPrepDataToolCore.h" +#include "MuonPrepRawData/MuonPrepDataCollection_Cache.h" +#include "MuonTrigCoinData/MuonTrigCoinData_Cache.h" namespace Muon { @@ -18,6 +20,11 @@ public: protected: virtual StatusCode manageOutputContainers(bool& firstTimeInTheEvent) override; + +private: + /// This is the key for the cache for the RPC PRD containers, can be empty + SG::UpdateHandleKey<RpcPrepDataCollection_Cache> m_prdContainerCacheKey ; + SG::UpdateHandleKey<RpcCoinDataCollection_Cache> m_coinContainerCacheKey ; }; } diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/CMakeLists.txt b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/CMakeLists.txt index 932a66cb317543859ecbff890859b9eb158049af..dc23846f25f384693a1886b5f270052b4875e153 100644 --- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/CMakeLists.txt +++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/CMakeLists.txt @@ -16,13 +16,14 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/Identifier Trigger/TrigEvent/TrigSteeringEvent DetectorDescription/IRegionSelector - MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData) + MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData + MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData) # Component(s) in the package: atlas_add_component( MuonRdoToPrepData src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps GaudiKernel StoreGateLib SGtests Identifier TrigSteeringEvent IRegionSelector MuonPrepRawData AthViews) + LINK_LIBRARIES AthenaBaseComps GaudiKernel StoreGateLib SGtests Identifier TrigSteeringEvent IRegionSelector MuonPrepRawData MuonTrigCoinData AthViews) # Install files from the package: atlas_install_headers( MuonRdoToPrepData ) diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.cxx b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.cxx index 2b017caee850d686323a2bb9ea259045158ba379..7f5c6973c300dc7cca79d4a9833a319e12e6b2dd 100644 --- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.cxx +++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.cxx @@ -22,7 +22,9 @@ MuonPRDCacheCreator::MuonPRDCacheCreator(const std::string &name,ISvcLocator *pS m_RpcCacheKey(""), m_TgcCacheKey(""), m_sTgcCacheKey(""), - m_MmCacheKey("") + m_MmCacheKey(""), + m_RpcCoinCacheKey(""), + m_TgcCoinCacheKey("") { declareProperty("CscCacheKey", m_CscCacheKey); declareProperty("CscStripCacheKey", m_CscStripCacheKey); @@ -31,6 +33,8 @@ MuonPRDCacheCreator::MuonPRDCacheCreator(const std::string &name,ISvcLocator *pS declareProperty("TgcCacheKey", m_TgcCacheKey); declareProperty("sTgcCacheKey", m_sTgcCacheKey); declareProperty("MmCacheKey", m_MmCacheKey); + declareProperty("RpcCoinCacheKey", m_RpcCoinCacheKey); + declareProperty("TgcCoinCacheKey", m_TgcCoinCacheKey); declareProperty("DisableViewWarning", m_disableWarning); } @@ -46,6 +50,8 @@ StatusCode MuonPRDCacheCreator::initialize() { ATH_CHECK( m_TgcCacheKey.initialize( !m_TgcCacheKey.key().empty() )); ATH_CHECK( m_sTgcCacheKey.initialize( !m_sTgcCacheKey.key().empty() )); ATH_CHECK( m_MmCacheKey.initialize( !m_MmCacheKey.key().empty() )); + ATH_CHECK( m_RpcCoinCacheKey.initialize( !m_RpcCoinCacheKey.key().empty() )); + ATH_CHECK( m_TgcCoinCacheKey.initialize( !m_TgcCoinCacheKey.key().empty() )); // Retrieve ID tools ATH_CHECK( m_muonIdHelperTool.retrieve() ); @@ -55,7 +61,7 @@ StatusCode MuonPRDCacheCreator::initialize() { bool MuonPRDCacheCreator::isInsideView(const EventContext& context) const { - const IProxyDict* proxy = context.getExtension<Atlas::ExtendedEventContext>().proxy(); + const IProxyDict* proxy = Atlas::getExtendedEventContext(context).proxy(); const SG::View* view = dynamic_cast<const SG::View*>(proxy); return view != nullptr; } @@ -70,29 +76,58 @@ StatusCode MuonPRDCacheCreator::execute (const EventContext& ctx) const { m_disableWarning = true; //only check once } - // Create all the cache containers + // Create all the cache containers (if the tools are available) // CSC - ATH_CHECK(createContainer(m_CscCacheKey, m_muonIdHelperTool->cscIdHelper().module_hash_max(), ctx)); - ATH_CHECK(createContainer(m_CscStripCacheKey, m_muonIdHelperTool->cscIdHelper().module_hash_max(), ctx)); + if( m_muonIdHelperTool->hasCscIdHelper() ){ + ATH_CHECK(createContainer(m_CscCacheKey, m_muonIdHelperTool->cscIdHelper().module_hash_max(), ctx)); + ATH_CHECK(createContainer(m_CscStripCacheKey, m_muonIdHelperTool->cscIdHelper().module_hash_max(), ctx)); + } + if( !m_muonIdHelperTool->hasCscIdHelper() && !m_CscCacheKey.key().empty() ){ + ATH_MSG_WARNING("CSC ID Helper is not available and CSC PRD cache was requested. This will not be created"); + } + // MDT - auto maxHashMDTs = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BME") != -1 ? m_muonIdHelperTool->mdtIdHelper().detectorElement_hash_max() : m_muonIdHelperTool->mdtIdHelper().module_hash_max(); - ATH_CHECK(createContainer(m_MdtCacheKey, maxHashMDTs, ctx)); + if( m_muonIdHelperTool->hasMdtIdHelper() ){ + auto maxHashMDTs = m_muonIdHelperTool->mdtIdHelper().stationNameIndex("BME") != -1 ? m_muonIdHelperTool->mdtIdHelper().detectorElement_hash_max() : m_muonIdHelperTool->mdtIdHelper().module_hash_max(); + ATH_CHECK(createContainer(m_MdtCacheKey, maxHashMDTs, ctx)); + } + if( !m_muonIdHelperTool->hasMdtIdHelper() && !m_MdtCacheKey.key().empty() ){ + ATH_MSG_WARNING("MDT ID Helper is not available and MDT PRD cache was requested. This will not be created"); + } + // RPC - ATH_CHECK(createContainer(m_RpcCacheKey, m_muonIdHelperTool->rpcIdHelper().module_hash_max(), ctx)); + if( m_muonIdHelperTool->hasRpcIdHelper() ){ + ATH_CHECK(createContainer(m_RpcCacheKey, m_muonIdHelperTool->rpcIdHelper().module_hash_max(), ctx)); + ATH_CHECK(createContainer(m_RpcCoinCacheKey, m_muonIdHelperTool->rpcIdHelper().module_hash_max(), ctx)); + } + if( !m_muonIdHelperTool->hasRpcIdHelper() && !m_RpcCacheKey.key().empty() ){ + ATH_MSG_WARNING("RPC ID Helper is not available and RPC PRD cache was requested. This will not be created"); + } + // TGC - ATH_CHECK(createContainer(m_TgcCacheKey, m_muonIdHelperTool->tgcIdHelper().module_hash_max(), ctx)); + if( m_muonIdHelperTool->hasTgcIdHelper() ){ + ATH_CHECK(createContainer(m_TgcCacheKey, m_muonIdHelperTool->tgcIdHelper().module_hash_max(), ctx)); + ATH_CHECK(createContainer(m_TgcCoinCacheKey, m_muonIdHelperTool->tgcIdHelper().module_hash_max(), ctx)); + } + if( !m_muonIdHelperTool->hasTgcIdHelper() && !m_TgcCacheKey.key().empty() ){ + ATH_MSG_WARNING("TGC ID Helper is not available and TGC PRD cache was requested. This will not be created"); + } + // NSW STGC - ATH_CHECK(createContainer(m_sTgcCacheKey, m_muonIdHelperTool->stgcIdHelper().module_hash_max(), ctx)); + if( m_muonIdHelperTool->hasSTgcIdHelper() ){ + ATH_CHECK(createContainer(m_sTgcCacheKey, m_muonIdHelperTool->stgcIdHelper().module_hash_max(), ctx)); + } + if( !m_muonIdHelperTool->hasSTgcIdHelper() && !m_sTgcCacheKey.key().empty() ){ + ATH_MSG_WARNING("STGC ID Helper is not available and STGC PRD cache was requested. This will not be created"); + } + // NSW MM - ATH_CHECK(createContainer(m_MmCacheKey, m_muonIdHelperTool->mmIdHelper().module_hash_max(), ctx)); - - ATH_MSG_DEBUG("Created cache container " << m_CscCacheKey ); - ATH_MSG_DEBUG("Created cache container " << m_CscStripCacheKey ); - ATH_MSG_DEBUG("Created cache container " << m_MdtCacheKey ); - ATH_MSG_DEBUG("Created cache container " << m_RpcCacheKey ); - ATH_MSG_DEBUG("Created cache container " << m_TgcCacheKey ); - ATH_MSG_DEBUG("Created cache container " << m_sTgcCacheKey ); - ATH_MSG_DEBUG("Created cache container " << m_MmCacheKey ); + if( m_muonIdHelperTool->hasMmIdHelper() ){ + ATH_CHECK(createContainer(m_MmCacheKey, m_muonIdHelperTool->mmIdHelper().module_hash_max(), ctx)); + } + if( !m_muonIdHelperTool->hasMmIdHelper() && !m_MmCacheKey.key().empty() ){ + ATH_MSG_WARNING("MM ID Helper is not available and MM PRD cache was requested. This will not be created"); + } return StatusCode::SUCCESS; } diff --git a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.h b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.h index 1a80c0937d02d1b573e80943e247a4330b81a5b0..41b3b48b9a68a7116d834c27400e4e492a7faabc 100644 --- a/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.h +++ b/MuonSpectrometer/MuonCnv/MuonRdoToPrepData/src/MuonPRDCacheCreator.h @@ -8,6 +8,7 @@ #include "GaudiKernel/ToolHandle.h" #include "MuonPrepRawData/MuonPrepDataCollection_Cache.h" +#include "MuonTrigCoinData/MuonTrigCoinData_Cache.h" #include "MuonIdHelpers/MuonIdHelperTool.h" @@ -39,6 +40,9 @@ protected: SG::WriteHandleKey<TgcPrepDataCollection_Cache> m_TgcCacheKey; SG::WriteHandleKey<sTgcPrepDataCollection_Cache> m_sTgcCacheKey; SG::WriteHandleKey<MMPrepDataCollection_Cache> m_MmCacheKey; + SG::WriteHandleKey<RpcCoinDataCollection_Cache> m_RpcCoinCacheKey; + SG::WriteHandleKey<TgcCoinDataCollection_Cache> m_TgcCoinCacheKey; + ToolHandle<Muon::MuonIdHelperTool> m_muonIdHelperTool{this, "idHelper", "Muon::MuonIdHelperTool/MuonIdHelperTool", "Handle to the MuonIdHelperTool"}; diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx index c0f744e0ecb67a7492a6c1ed6fc54a878aa7f63d..07091726e84d15cadc7a71c3975880a8b9c1e90d 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.cxx @@ -17,6 +17,7 @@ Muon::sTgcRdoToPrepDataToolMT::sTgcRdoToPrepDataToolMT(const std::string& t, AthAlgTool(t,n,p), sTgcRdoToPrepDataToolCore(t,n,p) { + declareProperty("sTgcPrdContainterCacheKey", m_prdContainerCacheKey, "Optional external cache for the sTGC PRD container"); } Muon::sTgcRdoToPrepDataToolMT::~sTgcRdoToPrepDataToolMT() @@ -27,6 +28,7 @@ StatusCode Muon::sTgcRdoToPrepDataToolMT::initialize() { ATH_MSG_VERBOSE("Starting init"); ATH_CHECK( sTgcRdoToPrepDataToolCore::initialize() ); + ATH_CHECK( m_prdContainerCacheKey.initialize( !m_prdContainerCacheKey.key().empty() ) ); ATH_MSG_DEBUG("initialize() successful in " << name()); return StatusCode::SUCCESS; } @@ -38,20 +40,39 @@ StatusCode Muon::sTgcRdoToPrepDataToolMT::finalize() Muon::sTgcRdoToPrepDataToolCore::SetupSTGC_PrepDataContainerStatus Muon::sTgcRdoToPrepDataToolMT::setupSTGC_PrepDataContainer() { + m_fullEventDone = false; - if(!evtStore()->contains<Muon::sTgcPrepDataContainer>(m_stgcPrepDataContainerKey.key())){ - m_fullEventDone=false; - - SG::WriteHandle< Muon::sTgcPrepDataContainer > handle(m_stgcPrepDataContainerKey); + SG::WriteHandle< Muon::sTgcPrepDataContainer > handle(m_stgcPrepDataContainerKey); + + // Caching of PRD container + const bool externalCachePRD = !m_prdContainerCacheKey.key().empty(); + if (!externalCachePRD) { + // without the cache we just record the container StatusCode status = handle.record(std::make_unique<Muon::sTgcPrepDataContainer>(m_muonIdHelperTool->stgcIdHelper().module_hash_max())); - if (status.isFailure() || !handle.isValid() ) { - ATH_MSG_FATAL("Could not record container of STGC PrepData Container at " << m_stgcPrepDataContainerKey.key()); + ATH_MSG_FATAL("Could not record container of sTGC PrepData Container at " << m_stgcPrepDataContainerKey.key()); return FAILED; } - m_stgcPrepDataContainer = handle.ptr(); - return ADDED; - + ATH_MSG_DEBUG("Created container " << m_stgcPrepDataContainerKey.key()); + } + else { + // use the cache to get the container + SG::UpdateHandle<sTgcPrepDataCollection_Cache> update(m_prdContainerCacheKey); + if (!update.isValid()){ + ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKey.key()); + return FAILED; + } + StatusCode status = handle.record(std::make_unique<Muon::sTgcPrepDataContainer>(update.ptr())); + if (status.isFailure() || !handle.isValid() ) { + ATH_MSG_FATAL("Could not record container of sTGC PrepData Container using cache " + << m_prdContainerCacheKey.key() << " - " <<m_stgcPrepDataContainerKey.key()); + return FAILED; + } + ATH_MSG_DEBUG("Created container using cache for " << m_stgcPrepDataContainerKey.key()); } - return ALREADYCONTAINED; + // Pass the container from the handle + m_stgcPrepDataContainer = handle.ptr(); + + return ADDED; + } diff --git a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.h b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.h index 786cd133730f47e773bc56adfaa8ea5b818a4afd..c78bca2c8b66b3253219e55931e8165f95a94843 100644 --- a/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonSTGC_CnvTools/src/sTgcRdoToPrepDataToolMT.h @@ -18,6 +18,7 @@ #include "MuonRDO/STGC_RawDataContainer.h" #include "MuonPrepRawData/sTgcPrepDataContainer.h" #include "MuonIdHelpers/MuonIdHelperTool.h" +#include "MuonPrepRawData/MuonPrepDataCollection_Cache.h" class AtlasDetectorID; class Identifier; @@ -55,6 +56,10 @@ namespace Muon protected: virtual SetupSTGC_PrepDataContainerStatus setupSTGC_PrepDataContainer() override; + + private: + /// This is the key for the cache for the sTGC PRD containers, can be empty + SG::UpdateHandleKey<sTgcPrepDataCollection_Cache> m_prdContainerCacheKey ; }; } // end of namespace diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.cxx b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.cxx index d8f629fbe5c2b8971b6d3e4a194a31e635f74ebf..24f53ab5cb67c5361d8feebe7df546e88e601bde 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.cxx +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.cxx @@ -14,8 +14,16 @@ Muon::TgcRdoToPrepDataToolMT::TgcRdoToPrepDataToolMT(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t, n, p), - TgcRdoToPrepDataToolCore(t, n, p) + TgcRdoToPrepDataToolCore(t, n, p), + m_prdContainerCacheKeys{"","","",""}, + m_coinContainerCacheKeys{"","",""}, + m_prdContainerCacheKeyStr(""), + m_coinContainerCacheKeyStr("") + { + // Declare the cache name as a string because we build the keys in initialise same as done for the containers + declareProperty("TgcPrdContainerCacheKey", m_prdContainerCacheKeyStr, "Optional external cache for the TGC PRD container"); + declareProperty("TgcCoinContainerCacheKey", m_coinContainerCacheKeyStr, "Optional external cache for the TGC Trigger Coin container"); } Muon::TgcRdoToPrepDataToolMT::~TgcRdoToPrepDataToolMT() @@ -26,6 +34,33 @@ StatusCode Muon::TgcRdoToPrepDataToolMT::initialize() { ATH_MSG_VERBOSE("Starting init"); ATH_CHECK( TgcRdoToPrepDataToolCore::initialize() ); + + // Build names for the keys same as done for output containers + if(m_prdContainerCacheKeyStr != ""){ + for(int ibc=0; ibc<NBC+1; ibc++) { + int bcTag=ibc+1; + std::ostringstream location; + location << m_prdContainerCacheKeyStr << (bcTag==TgcDigit::BC_PREVIOUS ? "PriorBC" : "") + << (bcTag==TgcDigit::BC_NEXT ? "NextBC" : "") << (bcTag==(NBC+1) ? "AllBCs" : ""); + m_prdContainerCacheKeys.at(ibc) = location.str(); + ATH_MSG_INFO( location.str() ); + } + } + + if(m_prdContainerCacheKeyStr != ""){ + for(int ibc=0; ibc<NBC; ibc++) { + int bcTag=ibc+1; + std::ostringstream location; + location << m_coinContainerCacheKeyStr << (bcTag==TgcDigit::BC_PREVIOUS ? "PriorBC" : "") + << (bcTag==TgcDigit::BC_NEXT ? "NextBC" : ""); + m_coinContainerCacheKeys.at(ibc) = location.str(); + ATH_MSG_INFO( location.str() ); + } + } + + // Only initialise if we passed in the cache name + ATH_CHECK( m_prdContainerCacheKeys.initialize( m_prdContainerCacheKeyStr != "" ) ); + ATH_CHECK( m_coinContainerCacheKeys.initialize( m_prdContainerCacheKeyStr != "" ) ); ATH_MSG_DEBUG("initialize() successful in " << name()); return StatusCode::SUCCESS; } @@ -35,10 +70,8 @@ StatusCode Muon::TgcRdoToPrepDataToolMT::finalize() return TgcRdoToPrepDataToolCore::finalize(); } -StatusCode Muon::TgcRdoToPrepDataToolMT::decode(std::vector<IdentifierHash>& requestedIdHashVect, - std::vector<IdentifierHash>& selectedIdHashVect) +StatusCode Muon::TgcRdoToPrepDataToolMT::decode(std::vector<IdentifierHash>& requestedIdHashVect, std::vector<IdentifierHash>& selectedIdHashVect) { - // MT version of this method always adds containers. Caching will be added later. int sizeVectorRequested = requestedIdHashVect.size(); ATH_MSG_DEBUG("decode for " << sizeVectorRequested << " offline collections called"); @@ -46,67 +79,97 @@ StatusCode Muon::TgcRdoToPrepDataToolMT::decode(std::vector<IdentifierHash>& req // clear output vector of selected data collections containing data selectedIdHashVect.clear(); + // This seems redundant in the MT setup bool nothingToDo[NBC+1]; - for(int ibc=0; ibc<NBC+1; ibc++) nothingToDo[ibc] = false; - + for(int ibc=0; ibc<NBC+1; ibc++){ + nothingToDo[ibc] = false; + } + bool nothingToDoForAllBC = true; + for(int ibc=0; ibc<NBC; ibc++) { + if(!nothingToDo[ibc]) nothingToDoForAllBC = false; + } + // --- if(!m_tgcCabling) { StatusCode status = getCabling(); if(!status.isSuccess()) return status; } + // initialize with false - does not need to be inside IBC loop + std::fill(m_decodedOnlineId.begin(), m_decodedOnlineId.end(), false); + /// clean up containers for Hits - for(int ibc=0; ibc<NBC+1; ibc++) { - // initialize with false - std::fill(m_decodedOnlineId.begin(), m_decodedOnlineId.end(), false); + for(int ibc=0; ibc<NBC+1; ibc++) { + // PRD SG::WriteHandle<TgcPrepDataContainer> handle(m_outputprepdataKeys[ibc]); - - // record the container in storeGate - handle = std::unique_ptr<TgcPrepDataContainer> (new TgcPrepDataContainer(m_muonIdHelperTool->tgcIdHelper().module_hash_max())); - // cache the pointer, storegate retains ownership - m_tgcPrepDataContainer[ibc] = handle.ptr(); - if(!handle.isValid()) { - ATH_MSG_FATAL("Could not record container of TGC PrepRawData at " << m_outputprepdataKeys[ibc].key()); - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG("TGC PrepData Container recorded in StoreGate with key " << m_outputprepdataKeys[ibc].key()); + // Caching of PRD container + const bool externalCachePRD = !m_prdContainerCacheKeys[ibc].key().empty(); + if (!externalCachePRD) { + // without the cache we just record the container + StatusCode status = handle.record(std::make_unique<Muon::TgcPrepDataContainer>(m_muonIdHelperTool->tgcIdHelper().module_hash_max())); + if (status.isFailure() || !handle.isValid() ) { + ATH_MSG_FATAL("Could not record container of TGC PrepRawData at " << m_outputprepdataKeys[ibc].key()); + return StatusCode::FAILURE;; + } + ATH_MSG_DEBUG("Created container " << m_outputprepdataKeys[ibc].key()); + } + else { + // use the cache to get the container + SG::UpdateHandle<TgcPrepDataCollection_Cache> update(m_prdContainerCacheKeys[ibc]); + if (!update.isValid()){ + ATH_MSG_FATAL("Invalid UpdateHandle " << m_prdContainerCacheKeys[ibc].key()); + return StatusCode::FAILURE; + } + StatusCode status = handle.record(std::make_unique<Muon::TgcPrepDataContainer>(update.ptr())); + if (status.isFailure() || !handle.isValid() ) { + ATH_MSG_FATAL("Could not record container of TGC PrepData Container using cache " + << m_prdContainerCacheKeys[ibc].key() << " - " <<m_outputprepdataKeys[ibc].key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Created container using cache for " << m_prdContainerCacheKeys[ibc].key()); } - + //true: un-seeded mode (no need to decode this event after this execution) //false: seeded mode (still need to decode this event even after this execution) m_fullEventDone[ibc] = sizeVectorRequested==0; - m_decodedRdoCollVec.clear(); // The information of decoded RDO in the previous event is cleared. + // Pass the container from the handle + m_tgcPrepDataContainer[ibc] = handle.ptr(); } - - // If at least one BC has to do something, nothingToDoForAllBC should be false. - bool nothingToDoForAllBC = true; - for(int ibc=0; ibc<NBC; ibc++) { - if(!nothingToDo[ibc]) nothingToDoForAllBC = false; - } - - /*if(nothingToDoForAllBC) { - ATH_MSG_DEBUG("Whole events at all " << NBC << " BCs have already been decoded; nothing to do"); - return StatusCode::SUCCESS; - }*/ - + /// clean up containers for Coincidence for(int ibc=0; ibc<NBC; ibc++) { - // this happens the first time in the event ! - SG::WriteHandle<TgcCoinDataContainer> handle(m_outputCoinKeys[ibc]); - - // record the container in storeGate - handle = std::unique_ptr<TgcCoinDataContainer> (new TgcCoinDataContainer(m_muonIdHelperTool->tgcIdHelper().module_hash_max())); - - // cache the pointer, storegate retains ownership - m_tgcCoinDataContainer[ibc] = handle.ptr(); - if(!handle.isValid()) { - ATH_MSG_FATAL("Could not record container of TGC CoinData at " << m_outputCoinKeys[ibc].key()); - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG("TGC CoinData Container recorded in StoreGate with key " << m_outputCoinKeys[ibc].key()); + // PRD + SG::WriteHandle<TgcCoinDataContainer> handle(m_outputCoinKeys[ibc]); + // Caching of PRD container + const bool externalCacheCoin = !m_coinContainerCacheKeys[ibc].key().empty(); + if (!externalCacheCoin) { + // without the cache we just record the container + StatusCode status = handle.record(std::make_unique<Muon::TgcCoinDataContainer>(m_muonIdHelperTool->tgcIdHelper().module_hash_max())); + if (status.isFailure() || !handle.isValid() ) { + ATH_MSG_FATAL("Could not record container of TGC CoinData at " << m_outputCoinKeys[ibc].key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Created container " << m_outputCoinKeys[ibc].key()); + } + else { + // use the cache to get the container + SG::UpdateHandle<TgcCoinDataCollection_Cache> update(m_coinContainerCacheKeys[ibc]); + if (!update.isValid()){ + ATH_MSG_FATAL("Invalid UpdateHandle " << m_coinContainerCacheKeys[ibc].key()); + return StatusCode::FAILURE; + } + StatusCode status = handle.record(std::make_unique<Muon::TgcCoinDataContainer>(update.ptr())); + if (status.isFailure() || !handle.isValid() ) { + ATH_MSG_FATAL("Could not record container of TGC CoinData Container using cache " + << m_coinContainerCacheKeys[ibc].key() << " - " <<m_outputCoinKeys[ibc].key()); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG("Created container using cache for " << m_coinContainerCacheKeys[ibc].key()); } + // Pass the container from the handle + m_tgcCoinDataContainer[ibc] = handle.ptr(); } if(!nothingToDoForAllBC) { // If still need to do something diff --git a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.h b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.h index ef08a36cd1df8a1677fe53478c7277665f62e6f2..1ba0b34d1f09fe4a95d8c212a27cd45d5ebed5b5 100644 --- a/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.h +++ b/MuonSpectrometer/MuonCnv/MuonTGC_CnvTools/src/TgcRdoToPrepDataToolMT.h @@ -9,10 +9,21 @@ #define MUONTGC_CNVTOOLS_TGCRDOTOPREPDATATOOLMT_H #include "TgcRdoToPrepDataToolCore.h" +#include "MuonPrepRawData/MuonPrepDataCollection_Cache.h" +#include "MuonTrigCoinData/MuonTrigCoinData_Cache.h" +#include "StoreGate/HandleKeyArray.h" +#include "StoreGate/UpdateHandleKey.h" +#include "StoreGate/UpdateHandle.h" namespace Muon { + + // Typedef the two update handle arrays that can be used to match handle key functionality used in Core + // Requested to not use StoreGate template for UpdateHandleKeyArray + typedef SG::HandleKeyArray<SG::UpdateHandle<TgcPrepDataCollection_Cache>, SG::UpdateHandleKey<TgcPrepDataCollection_Cache>, Gaudi::DataHandle::Reader > TgcPrdUpdateHandles; + typedef SG::HandleKeyArray<SG::UpdateHandle<TgcCoinDataCollection_Cache>, SG::UpdateHandleKey<TgcCoinDataCollection_Cache>, Gaudi::DataHandle::Reader > TgcCoinUpdateHandles; + /** @class TgcRdoToPrepDataToolMT * This is the algorithm that convert TGCRdo To TGCPrepdata as a tool. * @@ -38,6 +49,16 @@ namespace Muon using TgcRdoToPrepDataToolCore::decode; // To prevent the decode below from hiding the superclass decode methods virtual StatusCode decode(std::vector<IdentifierHash>& idVect, std::vector<IdentifierHash>& idWithDataVect) override; + + private: + /// This is the key for the cache for the TGC PRD containers, can be empty + TgcPrdUpdateHandles m_prdContainerCacheKeys ; + TgcCoinUpdateHandles m_coinContainerCacheKeys ; + // TgcPrepRawData container key for current BC + std::string m_prdContainerCacheKeyStr; + // TgcCoinData container key for current BC + std::string m_coinContainerCacheKeyStr; + }; } // end of namespace diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h index 4a4277c88fd728d1c43bd384d5ddaeaaa6e7b3e9..c6b60a87b6a48d470d8da83adbdfeed65a3f85f8 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/RPC_CondCabling/RpcCablingCondAlg.h @@ -55,7 +55,7 @@ class RpcCablingCondAlg: public AthAlgorithm { StatusCode loadParameters(const CondAttrListCollection* readCdoMap); StatusCode ReadConf(); - StatusCode buildRDOmap(EventIDRange range_map_schema); + StatusCode buildRDOmap(RpcCablingCondData* writeCdo); std::list<Identifier> give_strip_id (unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int PADId, @@ -85,10 +85,10 @@ class RpcCablingCondAlg: public AthAlgorithm { ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; - SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_map_schema{this, "ReadKey", "/RPC/CABLING/MAP_SCHEMA", "Key of input muon rpc map schema condition data"}; - SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_map_schema_corr{this, "ReadKey", "/RPC/CABLING/MAP_SCHEMA_CORR", "Key of input muon rpc map correction schema condition data"}; - SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_cm_thr_eta{this, "ReadKey", "/RPC/TRIGGER/CM_THR_ETA", "Key of input muon rpc trigger eta condition data"}; - SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_cm_thr_phi{this, "ReadKey", "/RPC/TRIGGER/CM_THR_PHI", "Key of input muon rpc trigger phi condition data"}; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_map_schema{this, "ReadKeySchema", "/RPC/CABLING/MAP_SCHEMA", "Key of input muon rpc map schema condition data"}; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_map_schema_corr{this, "ReadKeySchemaCorr", "/RPC/CABLING/MAP_SCHEMA_CORR", "Key of input muon rpc map correction schema condition data"}; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_cm_thr_eta{this, "ReadKeyThrEta", "/RPC/TRIGGER/CM_THR_ETA", "Key of input muon rpc trigger eta condition data"}; + SG::ReadCondHandleKey<CondAttrListCollection> m_readKey_cm_thr_phi{this, "ReadKeyThrPhi", "/RPC/TRIGGER/CM_THR_PHI", "Key of input muon rpc trigger phi condition data"}; SG::WriteCondHandleKey<RpcCablingCondData> m_writeKey{this, "WriteKey", "RpcCablingCondData", "Key of output RPC cabling condition data"}; diff --git a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx index 75316d0b8f723b5b938455283072c4e76deadbdc..085992f6df20bb9b6581ed8c78a4b08397087126 100644 --- a/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx +++ b/MuonSpectrometer/MuonConditions/MuonCondCabling/RPC_CondCabling/src/RpcCablingCondAlg.cxx @@ -43,6 +43,16 @@ StatusCode RpcCablingCondAlg::execute() { ATH_MSG_DEBUG( "executing" << name() ); + // Write CondHandle + SG::WriteCondHandle<RpcCablingCondData> writeHandle{m_writeKey}; + 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; + } + // define the write condDataObj. Will only read in the 4 different cond objects + std::unique_ptr<RpcCablingCondData> writeCdo{std::make_unique<RpcCablingCondData>()}; // Read CondHandle @@ -114,7 +124,15 @@ StatusCode RpcCablingCondAlg::execute() ATH_CHECK(loadParameters(readCdoMap)); ATH_CHECK(ReadConf()); - ATH_CHECK(buildRDOmap(range_map_schema)); + ATH_CHECK(buildRDOmap(writeCdo.get())); + + if (writeHandle.record( range_map_schema, std::move(writeCdo)).isFailure()) + { + ATH_MSG_FATAL("Could not record RpcCondCablingData " << writeHandle.key() << " with EventRange " << range_map_schema << " into Conditions Store"); + return StatusCode::SUCCESS; + } + + ATH_MSG_INFO("recorded new " << writeHandle.key() << " with range " << range_map_schema ); return StatusCode::SUCCESS; } @@ -255,22 +273,10 @@ StatusCode RpcCablingCondAlg::ReadConf() // build and init the map for the PAD RDO -StatusCode RpcCablingCondAlg::buildRDOmap(EventIDRange range_map_schema) +StatusCode RpcCablingCondAlg::buildRDOmap(RpcCablingCondData* writeCdo) { ATH_MSG_DEBUG("RpcCablingCondAlg--- buildRDOmap"); - // Write CondHandle - SG::WriteCondHandle<RpcCablingCondData> writeHandle{m_writeKey}; - 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; - } - // define the write condDataObj. Will only read in the 4 different cond objects - std::unique_ptr<RpcCablingCondData> writeCdo{std::make_unique<RpcCablingCondData>()}; - - for (int sector = 0; sector < 64; ++sector) { unsigned int nRDOentries=0; @@ -541,14 +547,6 @@ StatusCode RpcCablingCondAlg::buildRDOmap(EventIDRange range_map_schema) ATH_MSG_DEBUG("Could not read any HashID"); return StatusCode::FAILURE; } - if (writeHandle.record( range_map_schema, std::move(writeCdo)).isFailure()) - { - ATH_MSG_FATAL("Could not record RpcCondCablingData " << writeHandle.key() << " with EventRange " << range_map_schema << " into Conditions Store"); - return StatusCode::SUCCESS; - } - - - ATH_MSG_INFO("recorded new " << writeHandle.key() << " with range " << range_map_schema ); return StatusCode::SUCCESS; diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RpcCoolStrSvc.h b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RpcCoolStrSvc.h index a441547d89e88c8694dd9140b79c9301225f9ba0..2175b433230045cadd6b4ba6428043fb6d9f90a8 100755 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RpcCoolStrSvc.h +++ b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/MuonCondSvc/RpcCoolStrSvc.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef MUONCONDSVC_RPCCOOLSTRSVC_H @@ -132,4 +132,4 @@ namespace MuonCalib { } -#endif // MUONCONDSVC_CSCCOOLSTRSVC_H +#endif diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/python/CscCondDB.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/python/CscCondDB.py deleted file mode 100644 index 47e7dee02e4e8fdd89b25489e5cc86e3dec721ca..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/python/CscCondDB.py +++ /dev/null @@ -1,372 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -#Author Caleb Parnell-Lampen lampen@physics.arizona.edu -#Clarification: Aside from providing a centralized location for the folder names, -#most of what is below is just a convenience, and more specific folder setups can -#be done by interfacing directly with conddb in the user's joboptions. - -from MuonCondSvc import CscCoolFolders - -class CscCondDB: - "Class to hold configuration information for cscCondDbSvc" - - def __init__(self): - - from AthenaCommon.Logging import logging - - from AthenaCommon.AthenaCommonFlags import athenaCommonFlags - - self.athenaCommonFlags = athenaCommonFlags - - self.msg = logging.getLogger('CscCondDBSvcConfigurator') - self.msg.debug("Configuring the CscCoolStrSvc for CSC conditions DB access") - - from AthenaCommon.AppMgr import ServiceMgr as svcMgr - from MuonCondSvc.MuonCondSvcConf import MuonCalib__CscCoolStrSvc - - self.CscCoolStrSvc = MuonCalib__CscCoolStrSvc() - svcMgr += self.CscCoolStrSvc - - self.FolderSuffix = "" - #svcMgr += MuonCalib__CscCoolStrSvc(name = "CscCoolStrSvc") - - #self.CscCoolStrSvc = svcMgr.MuonCalib__CscCoolStrSvc - - self.newFolder = False - - self.forceFoldersToOnline = False - #self.gainFolder = "GAIN" - #self.pslopeFolder = "PSLOPE" - #self.runSlopeFolder = "RSLOPE" - #self.pedFolder = "PED" - #self.tholdFolder = "THOLD" - #self.peaktFolder = "PEAKT" - #self.widthFolder = "WIDTH" - #self.sat1Folder = "SAT1" - #self.sat2Folder = "SAT2" - #self.noiseFolder = "NOISE" - #self.rmsFolder = "RMS" - #self.f001Folder = "FTHOLD" - #self.statusFolder = "STAT" - - #used folders - self.pslopeFolder = CscCoolFolders.pslope - self.pedFolder = CscCoolFolders.ped - self.noiseFolder = CscCoolFolders.noise - self.rmsFolder = CscCoolFolders.rms - self.f001Folder = CscCoolFolders.f001 - self.statusFolder = CscCoolFolders.status - self.t0baseFolder = CscCoolFolders.t0base - self.t0phaseFolder = CscCoolFolders.t0phase - - - #Unused folders - self.gainFolder = "GAIN" - self.runSlopeFolder = "RSLOPE" - self.tholdFolder = "THOLD" - self.peaktFolder = "PEAKT" - self.widthFolder = "WIDTH" - self.sat1Folder = "SAT1" - self.sat2Folder = "SAT2" - - from IOVDbSvc.CondDB import conddb - self.conddb = conddb - - self.useLocal = False - - def SetupForNewFolder(self): - self.msg.info("Setting up to write new folder") - self.CscCoolStrSvc.DoCaching = False - self.CscCoolStrSvc.DoMerge = False - self.newFolder = True; - - def SetupForWritingOnlineFromOffline(self): - self.forceFoldersToOnline = True - - - #uselocal file called mycool.db - def useLocalFile(self,uselocal=True): - self.useLocal = uselocal - - def setFolderSuffix(self,suffix): - self.FolderSuffix = suffix - - #Add a parameter - def addPar(self,name,key,dataType,cat,default,folder,database,override=""): - if(self.CscCoolStrSvc.ParNames.count(name) != 0): - self.msg.debug("tried to add a parameter twice. Ignoring seconde attempt." ) - return; - - self.msg.debug("Adding parameter " + name + " (" + database + ")" ) - self.CscCoolStrSvc.ParNames.append(name) - self.CscCoolStrSvc.ParSGKeys.append(key) - self.CscCoolStrSvc.ParDataTypes.append(dataType) - self.CscCoolStrSvc.ParCats.append(cat) - self.CscCoolStrSvc.ParDefaults.append(default) - if(self.athenaCommonFlags.isOnline() or self.forceFoldersToOnline): - self.CscCoolStrSvc.ParFolders.append('/CSC/ONL/' + folder) - else: - self.CscCoolStrSvc.ParFolders.append('/CSC/' + folder) - - fullSuffix = " <key>" + key + "</key> " + self.FolderSuffix - - oflFolderString = '/CSC/' + folder + fullSuffix - onlFolderString = '/CSC/ONL/' + folder + fullSuffix - - #If we're setup for new folders, don't load the folder from the database - #We were just interested in setting CscCoolStrSvc appropriately above - if(self.newFolder == True): - return; - - if(self.useLocal): - #assume when local, the folder will be in offline location. - #Maybe add more options in future - self.conddb.addFolder("LOCAL", oflFolderString) - elif(database == 'CSC'): - #self.conddb.addFolderSplitMC(database, folderString, folderString) - self.conddb.addFolderSplitOnline(database,onlFolderString,oflFolderString) - elif(database == 'CSC_OFL'): - self.conddb.addFolder(database, oflFolderString); - else: - self.msg.fatal("Failed to recognize database: " + database + " for parameter " + name) - return; - - #override default tag - if(override): - if(self.useLocal): - #assume when local, the folder will be in offline location. - #Maybe add more options in future - overfolder = oflFolderString.split()[0] #Get folder without suffix - elif(database == 'CSC'): - #self.conddb.addFolderSplitMC(database, folderString, folderString) - if(self.athenaCommonFlags.isOnline()): - overfolder = onlFolderString.split()[0] #Get folder without suffix - else: - overfolder = oflFolderString.split()[0] #Get folder without suffix - elif(database == 'CSC_OFL'): - overfolder = oflFolderString.split()[0] #Get folder without suffix - else: - self.msg.fatal("Failed to recognize database: " + database + " for parameter " + name) - return; - - self.msg.info("Overriding folder for " + name + "(" + overfolder + ") to " + override ) - self.conddb.addOverride(overfolder,override) - - - - - #Register a few useful collections of folders. Provided as a convenience. - def addAllFolders(self): - # set dbConnection string - # usually this should be used as default. If one of the folders isn't - # found by IOVDbSvc, one can use one of the more specific functions - #self.addGainFolder() - self.addPSlopeFolder() - #self.addTholdFolder() - #self.addRSlopeFolder() - self.addPedFolder() - #self.addPeaktFolder() - #self.addWidthFolder() - #self.addSat1Folder() - #self.addSat2Folder() - #self.addPeakcFolder() - #self.addSampleTimeRatioFolder() - #self.addOccupancyFolder() - self.addT0BaseFolder() - self.addT0PhaseFolder() - self.addF001Folder() - self.addRmsFolder() - self.addNoiseFolder() - self.addStatusFolder() - - def addPedFolders(self): - # initializes pedestals and noise only - self.addNoiseFolder() - self.addPedFolder() - - def addPulseShapeFolders(self): - #intializes bipolar pulse shape info - self.addWidthFolder() - self.addPeaktFolder() - - #Single folder registration - def addGainFolder(self): - #initialize single folder - self.msg.error("The Gain folder is retired. Please contact Caleb Lampen <lampen@gmail.com if it is needed.") - #name = "gain" - #key = "CSC_GAIN" - #dataType = "float" - #cat = "CHANNEL" - #default = "58000" - #folder = self.gainFolder - #database = "CSC_OFL" - #self.addPar(name,key, dataType, cat, default, folder, database, override): - - def addPSlopeFolder(self,override=""): - #initialize single folder - name = "pslope" - key = "CSC_PSLOPE" - dataType = "float" - cat = "CHANNEL" - default = "0.189" - folder = self.pslopeFolder - database = "CSC" - self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addRSlopeFolder(self,override=""): - self.msg.error("The rslope folder is retired. Please contact Caleb Lampen <lampen@gmail.com if it is needed.") - #name = "rslope" - #key = "CSC_RSLOPE" - #dataType = "float" - #cat = "CHANNEL" - #default = "0.189" - #folder = self.runSlopeFolder - #database = "CSC_OFL" - #self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addPedFolder(self,override=""): - name = "ped" - key = "CSC_PED" - dataType = "float" - cat = "CHANNEL" - default = "2048" - folder = self.pedFolder - database = "CSC" - self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addT0BaseFolder(self,override=""): - name = "t0base" - key = "CSC_T0BASE" - dataType = "float" - cat = "CHANNEL" - default = "0" - folder = self.t0baseFolder - database = "CSC_OFL" #Offline only - self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addT0PhaseFolder(self,override=""): - name = "t0phase" - key = "CSC_T0PHASE" - #dataType = "float" - dataType = "bool" - cat = "ASM" - default = "0" - folder = self.t0phaseFolder - database = "CSC_OFL" #Offline only - self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addTholdFolder(self,override=""): - self.msg.error("The thold folder is retired. Please contact Caleb Lampen <lampen[AT SPAMNOT]physics{ dOT} arizona |DOT|edu> if it is needed.") - #name = "thold" - #key = "CSC_THOLD" - #dataType = "float" - #cat = "CHANNEL" - #default = "2058.85" - #folder = self.tholdFolder - #database = "CSC_OFL" - #self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addPeaktFolder(self,override=""): - self.msg.error("The peakt folder is retired. Please contact Caleb Lampen <lampen@gmail.com if it is needed.") - #name = "peakt" - #key = "CSC_PEAKT" - #dataType = "float" - #cat = "CHANNEL" - #default = "46.824" - #folder = self.peaktFolder - #database = "CSC_OFL" - #self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addWidthFolder(self,override=""): - self.msg.error("The peakt folder is retired. Please contact Caleb Lampen <lampen@gmail.com if it is needed.") - #name = "width" - #key = "CSC_WIDTH" - #dataType = "float" - #cat = "CHANNEL" - #default = "14.4" - #folder = self.widthFolder - #database = "CSC_OFL" - #self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addSat1Folder(self,override=""): - self.msg.error("The peakt folder is retired. Please contact Caleb Lampen <lampen@gmail.com if it is needed.") - #name = "sat1" - #key = "CSC_SAT1" - #dataType = "float" - #cat = "CHANNEL" - #default = "22.26" - #folder = self.sat1Folder - #database = "CSC_OFL" - #self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addSat2Folder(self,override=""): - self.msg.error("The peakt folder is retired. Please contact Caleb Lampen <lampen@gmail.com if it is needed.") - #name = "sat2" - #key = "CSC_SAT2" - #dataType = "float" - #cat = "CHANNEL" - #default = "1789.0" - #folder = self.sat2Folder - #database = "CSC_OFL" - #self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addNoiseFolder(self,override=""): - name = "noise" - key = "CSC_NOISE" - dataType = "float" - cat = "CHANNEL" - default = "3.5" - folder = self.noiseFolder - database = "CSC" - self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addRmsFolder(self,override=""): - name = "rms" - key = "CSC_RMS" - dataType = "float" - cat = "CHANNEL" - default = "2.56" - folder = self.rmsFolder - database = "CSC" - self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addFtholdFolder(self,override=""): - self.addF001Folder(override) - - def addF001Folder(self,override=""): - name = "f001" - key = "CSC_FTHOLD" - dataType = "float" - cat = "CHANNEL" - default = "0" - folder = self.f001Folder - database = "CSC" - self.addPar(name,key, dataType, cat, default, folder, database, override) - - def addStatusFolder(self,override=""): - name = "status" - key = "CSC_STAT" - dataType = "uint32_t" - cat = "CHANNEL" - default = "0" - folder = self.statusFolder - database = "CSC" - self.addPar(name,key, dataType, cat, default, folder, database, override) - - def overrideBaseTag(self,tag): - #Thie is simply a wrapper for the conddb's override tag - try: - self.conddb.addOverride('/CSC',tag) - except: - self.msg.error("Error while trying to use tag") - - - def forcePreCache(self,preCache= True): - #Set to true if you want to force CscCoolStrSvc to cache - #on startup. Use if initialized in CBNT_initialize(). - self.CscCoolStrSvc.preCache = preCache - - def setOutputLevel(self, outputLevel): - self.CscCoolStrSvc.OutputLevel= outputLevel - -cscCondDB = CscCondDB() diff --git a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/share/CscCoolStrSvc_read_jobOptions.py b/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/share/CscCoolStrSvc_read_jobOptions.py deleted file mode 100644 index c371ae326fb26cb9ba69502365d452efd76770f0..0000000000000000000000000000000000000000 --- a/MuonSpectrometer/MuonConditions/MuonCondGeneral/MuonCondSvc/share/CscCoolStrSvc_read_jobOptions.py +++ /dev/null @@ -1,99 +0,0 @@ -include.block ( "MuonCondSvc/CscCoolStrSvc_read_jobOptions.py" ) -############################################################### -# author Caleb Lampen lampen@physics.arizona.edu -# -#CscCoolStrSvc_read_jobOptions.py -#Sets up the IOVDbSvc to read from the Cathode Strip Chambers' -#conditions folders. (In this file CSC = Cathode Strip Chambers) -#============================================================== - -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -#This file is no longer needed since the move to configurables -#, and is retained for backwards compatibility only. Now to -#setup the Csc conditions database service, simply add the line: - -msg = logging.getLogger('CscCoolStrSvc_read_jobOptions.py') -print "MuonCondSvc/CscCoolStrSvc_read_jobOptions.py is old. It only initializes the database" -print "for reading pedestals and noise. If you want other parameters, you should import the module directly" -print "and add the database folders you want as described in the CscCoolAccess twiki page" -from MuonCondSvc.CscCondDB import cscCondDB -cscCondDB.addPedFolders() -#To your joboptions. -# -#The instructions below are still essentially correct, although -#it would be best to use the configurable methods for IOVDbSvc -#where applicable. See the CoolIOVDbSvcConfigurable Twiki page -#for details. -#!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -#Setup instructions -#Here is what must be specified in joboptions prior to including this file - -# -#Much of the setup is automatically handled by most reconstruction topoptions. I've sorted -#It roughly most to least likely that its handled in some file you're already including. Also -#check MuonCondCool/cscCoolTest.py and MuonCondCool/cscCondCoolRead.py for examples. -#If you need more help, or you think something is missing form these instructions, -#please email me at lampen@physics.arizona.edu. -# -#Database selection -# The CscCondDB.CSC_ONL string (used in conddb.addFolder), which specifies the database (CMCP200, COMP200, or OFLP200) -# is setup automatically in CondDBSetup.py. GlobalFlags.DetGeo and GlobalFlags.DataSource -# must be set for this to work. They are usually set in reconstruction joboptions, however -# in some situations you may want to set it yourself. To do this, add the follwing lines -# in your joboptions before including reconstruction files that set it for you: -# from AthenaCommon.GlobalFlags import GlobalFlags -# GlobalFlags.DetGeo.set_commis() #For commssionging databases (CMCP200 or COMP200) -# GlobalFlags.DetGeo.set_atlas() #For production databases (OFLP200) -# GlobalFlags.DataSource.set_data() #Set for COMP200, otherwise with set_commis you get COMP200 -#Geometry -# Make sure you have set up your Geometry correctly setup up, with the -# proper geometry tag. For example, DetDescrVersion = "ATLAS-Comm-01-00-00 -# for commisioning data. Tags are recorded in the AtlasGeomDBTags -#IOVDbSvc.GlobalTag -# You must set a database global tag with the line IOVDbSvc.GlobalTag = 'tagname'. Check the -# twiki page AtlasGeomDBTags to find which database tags go with which DetDescrVersion tags. -# I believe this is the tag least likely to be set up previously in the reconstruction joboptions -# For example: -# IOVDbSvc.globalTag = 'OFLCOND-CSC-00-00-00' #For production database -# -#Finally, if you want to access the cosmic data (4-chamber setup), you add the following line to your -#joboptions. This one specifically is requesting the S01-S05-S02-S04-00 setup as specified in the -#CscPreCommissioning twiki page. -# IOVDbSvc.OverrideTags += ["<prefix>/CSC</prefix> <tag>Csc-cosmic-S01-S05-S02-S04-00</tag>"] -# -####################################################################################################### - -#Define cool foldernames. These need to be given to both -##CoolStrSvc and IovDbSvc -#pulseGainFolder = "/CSC/PGAIN" -#pedFolder = "/CSC/PED" -#peaktFolder = "/CSC/PEAKT" -#sat1Folder = "/CSC/SAT1" -#sat2Folder = "/CSC/SAT2" -#noiseFolder = "/CSC/NOISE" -#pulseStatFolder ="/CSC/PSTAT" -#runGainFolder ="/CSC/RGAIN" -#runStatFolder ="/CSC/RSTAT" - - -################ -# specify the COOL datatbase connection string -#include("IOVDbSvc/IOVDbSvc_jobOptions.py") -#IOVDbSvc = Service ( "IOVDbSvc" ) -#from IOVDbSvc.CondDB import conddb -################ -# set dbConnection string -#IOVDbSvc.dbConnection = "impl=cool;techno=oracle;devdb10:CSCNEW:ATLAS_MUON_CSC" -#IOVDbSvc.dbConnection = "impl=cool;techno=logical;schema=ATLAS_COOLONL_CSC;X:OFLP200" -#IOVDbSvc.dbConnection = "impl=cool;techno=logical;schema=COOLONL_CSC;X:OFLP200" -#conddb.addFolder("CSC",pulseGainFolder) -#conddb.addFolder("CSC",pedFolder) -#conddb.addFolder("CSC",peaktFolder) -#conddb.addFolder("CSC",sat1Folder) -#conddb.addFolder("CSC",sat2Folder) -#conddb.addFolder("CSC",noiseFolder) -#conddb.addFolder("CSC",pulseStatFolder) -#conddb.addFolder("CSC",runGainFolder) -#conddb.addFolder("CSC",runStatFolder) - diff --git a/MuonSpectrometer/MuonConfig/python/MuonCalibConfig.py b/MuonSpectrometer/MuonConfig/python/MuonCalibConfig.py index 26dc50a9108816718f8ba82e21c69166f5aaf254..76498e383568d2f4477f92c15f3c2a4f3f133523 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonCalibConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonCalibConfig.py @@ -4,7 +4,6 @@ from MuonConfig.MuonCondAlgConfig import CscCondDbAlgCfg from AthenaConfiguration.ComponentFactory import CompFactory -MuonCalib__CscCoolStrSvc=CompFactory.MuonCalib__CscCoolStrSvc from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from IOVDbSvc.IOVDbSvcConfig import addFoldersSplitOnline from MagFieldServices.MagFieldServicesConfig import MagneticFieldSvcCfg diff --git a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py index b688aec495bfb6e214571d182deaf34476fbd48d..b5ab1035dca0335afb6d99d9f3e281f40ec0f3c1 100644 --- a/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py +++ b/MuonSpectrometer/MuonConfig/python/MuonRdoDecodeConfig.py @@ -6,12 +6,15 @@ from AthenaCommon.Constants import DEBUG, INFO ## Small class to hold the names for cache containers, should help to avoid copy / paste errors class MuonPrdCacheNames(object): - MdtCache = "MdtPrdCache" - CscCache = "CscPrdCache" - RpcCache = "RpcPrdCache" - TgcCache = "TgcPrdCache" - sTgcCache = "sTgcPrdCache" - MmCache = "MmPrdCache" + MdtCache = "MdtPrdCache" + CscCache = "CscPrdCache" + CscStripCache = "CscStripPrdCache" + RpcCache = "RpcPrdCache" + TgcCache = "TgcPrdCache" + sTgcCache = "sTgcPrdCache" + MmCache = "MmPrdCache" + RpcCoinCache = "RpcCoinCache" + TgcCoinCache = "TgcCoinCache" ## This configuration function creates the IdentifiableCaches for PRD # @@ -21,12 +24,18 @@ def MuonPrdCacheCfg(): acc = ComponentAccumulator() MuonPRDCacheCreator=CompFactory.MuonPRDCacheCreator - cacheCreator = MuonPRDCacheCreator(MdtCacheKey = MuonPrdCacheNames.MdtCache, - CscCacheKey = MuonPrdCacheNames.CscCache, - RpcCacheKey = MuonPrdCacheNames.RpcCache, - TgcCacheKey = MuonPrdCacheNames.TgcCache, - sTgcCacheKey = MuonPrdCacheNames.sTgcCache, - MmCacheKey = MuonPrdCacheNames.MmCache) + cacheCreator = MuonPRDCacheCreator(CscStripCacheKey = MuonPrdCacheNames.CscStripCache, + MdtCacheKey = MuonPrdCacheNames.MdtCache, + CscCacheKey = MuonPrdCacheNames.CscCache, + RpcCacheKey = MuonPrdCacheNames.RpcCache, + TgcCacheKey = MuonPrdCacheNames.TgcCache, + sTgcCacheKey = MuonPrdCacheNames.sTgcCache, + MmCacheKey = MuonPrdCacheNames.MmCache, + TgcCoinCacheKey = MuonPrdCacheNames.TgcCoinCache, + RpcCoinCacheKey = MuonPrdCacheNames.RpcCoinCache, + ) + + cacheCreator.OutputLevel = DEBUG acc.addEventAlgo( cacheCreator, primary=True ) return acc diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h index 2b46a25e68d00bd4b7153fc4b57ed73a4ab8d489..f1575b0f4187f3074a72907aea4b5ffc77266bda 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/MMReadoutElement.h @@ -17,6 +17,8 @@ class StoreGateSvc; +class BLinePar; + namespace Trk{ class RectangleBounds; class PlaneSurface; @@ -123,7 +125,13 @@ namespace MuonGM { inline double getALine_rotz() const; inline double getALine_rott() const; inline bool has_ALines() const; + inline bool has_BLines() const; void setDelta(double, double, double, double, double, double); //input: translations, rotations + void setBLinePar(BLinePar* bLine) const; + inline void clearBLinePar() const; + inline const BLinePar* getBLinePar() const { return m_BLinePar;} + void clearBLineCache() const; + void fillBLineCache() const; private: @@ -146,13 +154,19 @@ namespace MuonGM { double m_rott; bool m_hasALines; + bool m_hasBLines; HepGeom::Transform3D* m_delta; + + mutable BLinePar* m_BLinePar; // transforms (RE->layer) Amg::Transform3D m_Xlg[4]; }; + void MMReadoutElement::clearBLinePar() const + { m_BLinePar = 0;} + double MMReadoutElement::getALine_rots() const { return m_rots;} @@ -165,6 +179,9 @@ namespace MuonGM { bool MMReadoutElement::has_ALines() const { return m_hasALines;} + bool MMReadoutElement::has_BLines() const + { return m_hasBLines;} + inline int MMReadoutElement::surfaceHash( const Identifier& id ) const { return surfaceHash(manager()->mmIdHelper()->gasGap(id),0); } diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h index 864b315e1c8283f48a592ba4e2c0ba78875c870e..10e2767b92715c9b0b85bbd0c172edf13a869751 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/MuonReadoutGeometry/sTgcReadoutElement.h @@ -20,6 +20,7 @@ #include "MuonIdHelpers/sTgcIdHelper.h" +class BLinePar; namespace Trk{ class PlaneSurface; @@ -147,7 +148,12 @@ namespace MuonGM { inline double getALine_rotz() const; inline double getALine_rott() const; inline bool has_ALines() const; + inline bool has_BLines() const; void setDelta(double, double, double, double, double, double); + void setBLinePar(BLinePar* bLine) const; + inline void clearBLinePar() const; + void clearBLineCache() const; + void fillBLineCache() const; private: @@ -169,6 +175,7 @@ namespace MuonGM { double m_rott; bool m_hasALines; + bool m_hasBLines; HepGeom::Transform3D* m_delta; @@ -184,10 +191,15 @@ namespace MuonGM { std::vector<double> m_PadminHalfY; std::vector<double> m_PadmaxHalfY; + mutable BLinePar* m_BLinePar; + // transforms (RE->layer) Amg::Transform3D m_Xlg[4]; }; + void sTgcReadoutElement::clearBLinePar() const + { m_BLinePar = 0;} + double sTgcReadoutElement::getALine_rots() const { return m_rots;} @@ -200,6 +212,9 @@ namespace MuonGM { bool sTgcReadoutElement::has_ALines() const { return m_hasALines;} + bool sTgcReadoutElement::has_BLines() const + { return m_hasBLines;} + inline int sTgcReadoutElement::surfaceHash( const Identifier& id ) const { return surfaceHash(manager()->stgcIdHelper()->gasGap(id),manager()->stgcIdHelper()->channelType(id)); } diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx index a103767d1aabf50d5de6b2a86589e8bdc98b8d8d..e8a3c8083f0eb65c234192cea219a37aadc94ef8 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MMReadoutElement.cxx @@ -25,6 +25,7 @@ //#include "StoreGate/DataHandle.h" #include "MuonAGDDDescription/MMDetectorDescription.h" #include "MuonAGDDDescription/MMDetectorHelper.h" +#include "MuonAlignmentData/BLinePar.h" #define MMReadout_verbose false @@ -34,13 +35,15 @@ namespace MuonGM { MMReadoutElement::MMReadoutElement(GeoVFullPhysVol* pv, std::string stName, int zi, int fi, int mL, bool is_mirrored, MuonDetectorManager* mgr) - : MuonClusterReadoutElement(pv, stName, zi, fi, is_mirrored, mgr) + : MuonClusterReadoutElement(pv, stName, zi, fi, is_mirrored, mgr), + m_BLinePar(0) { m_rots = 0.; m_rotz = 0.; m_rott = 0.; m_hasALines = false; + m_hasBLines = false; m_delta = NULL; m_ml = mL; @@ -358,4 +361,11 @@ namespace MuonGM { } } + void MMReadoutElement::setBLinePar(BLinePar* bLine) const + { + (*m_Log)<<MSG::DEBUG<<"Setting B-line for "<<getStationName().substr(0,3)<<" at eta/phi "<<getStationEta()<<"/"<<getStationPhi()<<endmsg; + + m_BLinePar = bLine; + } + } // namespace MuonGM diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx index a5a64ed1d531ab29439a42b03b1829bba568780a..b8c9821fed4f3486ac847c848925a0ff288fad14 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/MuonDetectorManager.cxx @@ -1453,15 +1453,16 @@ const RpcReadoutElement* MuonDetectorManager::getRpcRElement_fromIdFields(int i1 } const RpcReadoutElement* MuonDetectorManager::getRpcReadoutElement(int i1, int i2, int i3, int i4, int i5)const { - MsgStream log(m_msgSvc, "MGM::MuonDetectorManager"); if (i1<0 || i1 >= NRpcStatType) { + MsgStream log(m_msgSvc, "MGM::MuonDetectorManager"); log<<MSG::ERROR<<"ERROR MuonDetectorManager::getRpcReadoutElement stNameindex out of range " <<i1<<" 0-"<<NRpcStatType-1<<endmsg; throw; } if (i2<0 || i2 >= NRpcStatEta) { + MsgStream log(m_msgSvc, "MGM::MuonDetectorManager"); log<<MSG::ERROR<<"ERROR MuonDetectorManager::getRpcReadoutElement stEtaindex out of range " <<i2<<" 0-"<<NRpcStatEta-1<<endmsg; return 0; @@ -1469,18 +1470,21 @@ const RpcReadoutElement* MuonDetectorManager::getRpcReadoutElement(int i1, int i } if (i3<0 || i3 >= NRpcStatPhi) { + MsgStream log(m_msgSvc, "MGM::MuonDetectorManager"); log<<MSG::ERROR<<"ERROR MuonDetectorManager::getRpcReadoutElement stPhiindex out of range " <<i3<<" 0-"<<NRpcStatPhi-1<<endmsg; throw; } if (i4 < 0 || i4 >= NDoubletR) { + MsgStream log(m_msgSvc, "MGM::MuonDetectorManager"); log<<MSG::ERROR<<"ERROR MuonDetectorManager::getRpcReadoutElement dbr_index out of range " <<i4<<" 0-" <<NDoubletR-1<<endmsg; throw; } if (i5 < 0 || i5 >= NDoubletZ) { + MsgStream log(m_msgSvc, "MGM::MuonDetectorManager"); log<<MSG::ERROR<<"ERROR MuonDetectorManager::getRpcReadoutElement dbz_index out of range " <<i5<<" 0-" <<NDoubletZ-1<<endmsg; return 0; diff --git a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx index 090f56455856ef6637572914c532fb3e9fe47206..35a1a1e22f2a161dca953c79b9c5d796ace44f7e 100644 --- a/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx +++ b/MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry/src/sTgcReadoutElement.cxx @@ -38,16 +38,18 @@ namespace MuonGM { sTgcReadoutElement::sTgcReadoutElement(GeoVFullPhysVol* pv, std::string stName, int zi, int fi, int mL, bool is_mirrored, MuonDetectorManager* mgr) - : MuonClusterReadoutElement(pv, stName, zi, fi, is_mirrored, mgr) + : MuonClusterReadoutElement(pv, stName, zi, fi, is_mirrored, mgr), + m_BLinePar(0) { m_rots = 0.; m_rotz = 0.; m_rott = 0.; m_hasALines = false; + m_hasBLines = false; m_delta = NULL; m_ml = mL; - + // get the setting of the caching flag from the manager setCachingFlag(mgr->cachingFlag()); @@ -527,6 +529,14 @@ namespace MuonGM { } } + void sTgcReadoutElement::setBLinePar(BLinePar* bLine) const + { + + (*m_Log)<<MSG::DEBUG<<"Setting B-line for "<<getStationName().substr(0,3)<<" at eta/phi "<<getStationEta()<<"/"<<getStationPhi()<<endmsg; + + m_BLinePar = bLine; + } + } // namespace MuonGM diff --git a/MuonSpectrometer/MuonDigitization/CSC_Digitization/share/LocalCscCalibTool_jobOptions.py b/MuonSpectrometer/MuonDigitization/CSC_Digitization/share/LocalCscCalibTool_jobOptions.py index 8ebdc00321f7b3fedff3f98e0a90ee1f8da18fc3..4c47c169828c9ef3744d8bc387d5630b04913a41 100644 --- a/MuonSpectrometer/MuonDigitization/CSC_Digitization/share/LocalCscCalibTool_jobOptions.py +++ b/MuonSpectrometer/MuonDigitization/CSC_Digitization/share/LocalCscCalibTool_jobOptions.py @@ -1,26 +1,5 @@ include.block( "CscCalibTools/CscCalibTool_jobOptions.py" ) -# Access to the CSC calibration database -#include ( "MuonCondSvc/CscCoolStrSvc_read_jobOptions.py" ) - -from MuonCondSvc.CscCondDB import cscCondDB - -#cscCondDB.addPedFolder() #<--- Adds pedestal and noise folders -#cscCondDB.addNoiseFolder() #<--- Adds pedestal and noise folders -#cscCondDB.addPSlopeFolder() #<--- Adds pedestal and noise folders -cscCondDB.addStatusFolder() #<--- Adds pedestal and noise folders -#cscCondDB.addRmsFolder() #<--- Adds pedestal and noise folders -#cscCondDB.addF001Folder() - -#cscCondDB.addT0BaseFolder() -#cscCondDB.addT0PhaseFolder() - - - - -#cscCondDB.addPedFolders() #<--- Adds pedestal and noise folders -#cscCondDB.addAllFolders() - from AthenaCommon.AppMgr import ToolSvc from CscCalibTools.CscCalibToolsConf import \ diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.cxx index b331d6cfd0757b273add6ae39f2a0544a3ebfdf7..2c5d546484201fabd8e112664c6f6a0760889ea1 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.cxx @@ -6,7 +6,8 @@ #include "MuonReadoutGeometry/MuonDetectorManager.h" #include "MuonIdHelpers/MmIdHelper.h" -#include "GaudiKernel/MsgStream.h" +#include "GaudiKernel/MsgStream.h" +#include <cmath> namespace{ template <class T> @@ -16,6 +17,10 @@ std::string printVec(std::vector<T> vec){ return outstream.str(); } +// Parametrization of the strip error after the projection +constexpr double stripErrorSlope = 0.2; +constexpr double stripErrorIntercept = 0.15; + } @@ -35,9 +40,12 @@ Muon::ProjectionMMClusterBuilderTool::ProjectionMMClusterBuilderTool(const std:: declareProperty("vDrift",m_vDrift = 0.048); declareProperty("tmin", m_tmin=30); declareProperty("tmax", m_tmax=130); + declareProperty("tOffset", m_tOffset=10.); declareProperty("corr_p0",m_p0=2.48741e-01); declareProperty("corr_p1",m_p1=-4.54356e-01); declareProperty("corr_p2",m_p2=3.77574e-01); + declareProperty("t0",m_t0=100); + declareProperty("minClusterSize",m_minClusterSize=2); } @@ -86,9 +94,9 @@ for(const auto& prdsOfLayer : prdsPerLayer){ double distToIp=prd.globalPosition().norm(); double tof=distToIp/299.792; // divide by speed of light in mm/ns //determine angle to IP for debug reasons - double globalR=TMath::Sqrt(pow(prd.globalPosition().x(),2)+pow(prd.globalPosition().y(),2)); + double globalR=std::sqrt(std::pow(prd.globalPosition().x(),2)+std::pow(prd.globalPosition().y(),2)); double Tan=globalR/prd.globalPosition().z(); - double angleToIp=TMath::ATan(Tan)/(180./M_PI); + double angleToIp=std::atan(Tan)/(180./M_PI); ATH_MSG_DEBUG("Hit channel: "<< m_mmIdHelper->channel(id_prd) <<" time "<< prd.time() << " localPosX "<< prd.localPosition().x() << " tof "<<tof <<" angleToIp " << angleToIp<<" gas_gap "<< m_mmIdHelper->gasGap(id_prd) << " multiplet " << m_mmIdHelper->multilayer(id_prd) << " stationname " <<m_mmIdHelper->stationName(id_prd) << " stationPhi " <<m_mmIdHelper->stationPhi(id_prd) << " stationEta "<<m_mmIdHelper->stationEta(id_prd)); } @@ -112,7 +120,7 @@ for(const auto& prdsOfLayer : prdsPerLayer){ ATH_MSG_DEBUG("idx_selected"<<printVec(idx_selected)); ATH_MSG_DEBUG("did fine scan and selected strips: "<< idx_selected.size() << " Status code: " << sc); - if(sc.isFailure()) break; //returns FAILURE if less then three strips in a cluster + if(sc.isFailure()){ATH_MSG_DEBUG("Fine scan failed"); break;} //returns FAILURE if less then three strips in a cluster sc = doPositionCalculation(v_posxc,v_cor,idx_selected,xmean,xerr,qtot,prdsOfLayer); ATH_MSG_DEBUG("calculated positions "<<sc); if(sc.isFailure()) break; @@ -121,7 +129,7 @@ for(const auto& prdsOfLayer : prdsPerLayer){ if(sc.isFailure()) break; ATH_MSG_DEBUG("Remaining good strips "<< flag.size()-std::accumulate(flag.begin(),flag.end(),0)); - if(flag.size()-std::accumulate(flag.begin(),flag.end(),0)<3){ + if(flag.size()-std::accumulate(flag.begin(),flag.end(),0)<m_minClusterSize){ ATH_MSG_DEBUG("Remaining good strips break: "<< flag.size()-std::accumulate(flag.begin(),flag.end(),0)); break; // break if less then three strips are left for clustering } @@ -139,14 +147,18 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::calculateCorrection( const std::vector<Muon::MMPrepData> &prdsOfLayer,std::vector<double>& v_posxc,std::vector<double>& v_cor){ for(const auto& prd : prdsOfLayer){ double posx = prd.localPosition().x(); - double posz = prd.globalPosition().z(); - double tm = prd.time()-prd.globalPosition().norm()/299.792; + double posz = std::fabs(prd.globalPosition().z()); // use std::fabs of z to not break symetrie for A and C side + double tm = prd.time()-prd.globalPosition().norm()/299.792-m_t0; + //std::printf("Time after tof: %.2f tmin: %.1f tmax: %.1f \n",tm,m_tmin,m_tmax); if(tm<m_tmin) tm=m_tmin; if(tm>m_tmax) tm=m_tmax; - double globalR=TMath::Sqrt(pow(prd.globalPosition().x(),2) + pow(prd.globalPosition().y(),2)); - double cor=m_vDrift*(tm-m_tmin-10)*(1.0*globalR/posz); - ATH_MSG_DEBUG("globalR: "<< globalR << " Time: " << tm-m_tmin-10 << "globalZ: " << posz << " R/Z: "<<1.0*globalR/posz); - v_cor.push_back(cor); + double globalR=std::sqrt(std::pow(prd.globalPosition().x(),2) + std::pow(prd.globalPosition().y(),2)); + double cor=m_vDrift*(tm-m_tmin-m_tOffset)*(1.0*globalR/posz); + //cor*=(m_mmIdHelper->gasGap(prd.identify())%2==1? 1:-1);//correct for the local drift time directions. Gas gap 2 and 4 have "negativ" time, therefore correction is applied negative + + ATH_MSG_DEBUG("globalR: "<< globalR << " Time: " << tm-m_tmin-m_tOffset << "globalZ: " << posz << " R/Z: "<<1.0*globalR/posz); + + v_cor.push_back(cor); // v_posxc.push_back(posx + cor); } return StatusCode::SUCCESS; @@ -159,15 +171,15 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::doFineScan(std::vector<int>& fl double stepSize = 0.1; double nSteps = (xmax-xmin)/stepSize; - int maxGoodStrips=0; + uint maxGoodStrips=0; double bestPos=-99999; for(int i_step=0;i_step<nSteps;i_step++){ double testPos=xmin+stepSize*i_step; - int nGoodStrips = 0; + uint nGoodStrips = 0; for(size_t i_strip=0; i_strip<v_posxc.size(); i_strip++){ if(flag.at(i_strip)==1) continue; double sigma=getSigma(v_cor.at(i_strip)); - if(fabs(testPos-v_posxc.at(i_strip)) < 3*sigma) nGoodStrips++; + if(std::fabs(testPos-v_posxc.at(i_strip)) < 3*sigma) nGoodStrips++; } if(nGoodStrips>maxGoodStrips){ maxGoodStrips=nGoodStrips; @@ -176,11 +188,11 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::doFineScan(std::vector<int>& fl } } ATH_MSG_DEBUG("maxGoodStrips: "<< maxGoodStrips<<" best Pos: "<< bestPos); - if(maxGoodStrips<3) return StatusCode::FAILURE; + if(maxGoodStrips<m_minClusterSize) return StatusCode::FAILURE; for (size_t i_strip=0;i_strip<v_posxc.size();i_strip++){ if(flag.at(i_strip)==1) continue; double sigma=getSigma(v_cor.at(i_strip)); - if(fabs(bestPos-v_posxc.at(i_strip)) < 3*sigma){ + if(std::fabs(bestPos-v_posxc.at(i_strip)) < 3*sigma){ idx_selected.push_back(i_strip); flag.at(i_strip)=1; } @@ -199,11 +211,12 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::doPositionCalculation(std::vec for(const auto& idx:idx_selected){ double qrat = prdsOfLayer.at(idx).charge()/qtot; v_posxc.at(idx) -= m_p0/(m_p1-qrat) +m_p2; - numerator+=v_posxc.at(idx)/pow(getSigma(v_cor.at(idx)),2); - denominator+=pow(getSigma(v_cor.at(idx)),-2); + numerator+=v_posxc.at(idx)/std::pow(getSigma(v_cor.at(idx)),2); + denominator+=std::pow(getSigma(v_cor.at(idx)),-2); } xmean=numerator/denominator; - xmeanErr=TMath::Sqrt(denominator); + xmeanErr=1./std::sqrt(denominator); + ATH_MSG_DEBUG("do Position Calculation mean: "<< xmean <<" err: "<< xmeanErr); return StatusCode::SUCCESS; } @@ -224,7 +237,7 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::writeNewPrd(std::vector<Muon::M double meanTime=0; for(const auto& id_goodStrip:idx_selected){ stripsOfCluster.push_back(prdsOfLayer.at(id_goodStrip).identify()); - stripsOfClusterDriftTime.push_back(int(prdsOfLayer.at(id_goodStrip).time()-prdsOfLayer.at(id_goodStrip).globalPosition().norm()/299.792)); + stripsOfClusterDriftTime.push_back(int(prdsOfLayer.at(id_goodStrip).time()-prdsOfLayer.at(id_goodStrip).globalPosition().norm()/299.792-m_t0)); stripsOfClusterCharge.push_back(int(prdsOfLayer.at(id_goodStrip).charge())); stripsOfClusterStripNumber.push_back(m_mmIdHelper->channel(prdsOfLayer.at(id_goodStrip).identify())); @@ -244,10 +257,16 @@ StatusCode Muon::ProjectionMMClusterBuilderTool::writeNewPrd(std::vector<Muon::M clustersVect.push_back(prdN); ATH_MSG_VERBOSE("pushedBack prdN"); + ATH_MSG_VERBOSE("pushedBack PRDs: stationEta: "<< m_mmIdHelper->stationEta(prdN->identify()) + <<" stationPhi "<< m_mmIdHelper->stationPhi(prdN->identify()) + <<" stationName "<< m_mmIdHelper->stationName(prdN->identify()) + << " gasGap "<< m_mmIdHelper->gasGap(prdN->identify()) + <<" multiplet "<<m_mmIdHelper->multilayer(prdN->identify()) + <<" channel "<< m_mmIdHelper->channel(prdN->identify())); return StatusCode::SUCCESS; } double Muon::ProjectionMMClusterBuilderTool::getSigma(double correction){ - return 0.15+0.2*fabs(correction); + return stripErrorIntercept+stripErrorSlope*std::fabs(correction); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.h b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.h index ad64742f0c98183899e271a935bdd658911627d0..4d4b903ecde7a3d0a3f6dc0b0798db4cbae09328 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.h +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MMClusterization/src/ProjectionMMClusterBuilderTool.h @@ -11,9 +11,6 @@ #include <numeric> -#include "TMath.h" - - class MmIdHelper; namespace MuonGM @@ -22,7 +19,7 @@ namespace MuonGM } // -// Simple clusterization tool for MicroMegas +// fixed angle projection cluster builder tool for MicroMegas // namespace Muon { @@ -49,9 +46,13 @@ namespace Muon const MuonGM::MuonDetectorManager* m_muonMgr; const MmIdHelper* m_mmIdHelper; - double m_vDrift,m_tmin,m_tmax; + double m_vDrift,m_tmin,m_tmax,m_tOffset; double m_p0,m_p1,m_p2; //correction factors for charge dependence + int m_t0; + + uint m_minClusterSize; + StatusCode calculateCorrection(const std::vector<Muon::MMPrepData> &prdsOfLayer,std::vector<double>& v_posxc,std::vector<double>& v_cor); StatusCode doFineScan(std::vector<int>& flag,const std::vector<double>& v_posxc, const std::vector<double>& v_cor, std::vector<int>& idx_selected); diff --git a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx index cddcea80976364b8b208dcd7fbec8a741c387663..ec6a13a4eb0ae7f816a4dc95cdf22f26213afc74 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonDataPrep/MuonTGMeasAssocAlg/src/MuonTGMeasAssocAlg.cxx @@ -431,7 +431,8 @@ StatusCode Muon::MuonTGMeasAssocAlg::storeSegments() { if (detVols->size() ) detVol = detVols->front(); if (!detVols->size() ) { ATH_MSG_ERROR( "missing station?" << segment->globalPosition() ); - std::vector<const Trk::RIO_OnTrack*> rots = segment->containedROTs(); + std::vector<const Trk::RIO_OnTrack*> rots; + for(unsigned int irot=0;irot<segment->numberOfContainedROTs();irot++) rots.push_back(segment->rioOnTrack(irot)); if ( rots.size() > 0 ) { Identifier id = rots[0]->identify(); Amg::Vector3D pos(0., 0., 0.); @@ -475,10 +476,7 @@ StatusCode Muon::MuonTGMeasAssocAlg::storeSegments() { // new std::vector<const Trk::RIO_OnTrack*>(segment->containedROTs()), // new Trk::FitQuality( *(segment->fitQuality())) ); DataVector<const Trk::MeasurementBase>* meas= new DataVector<const Trk::MeasurementBase>; - if (segment->containedROTs().size()) { - const std::vector<const Trk::RIO_OnTrack*> rots=segment->containedROTs(); - for (unsigned int im=0;im<rots.size();im++) meas->push_back(rots[im]); - } + for(unsigned int irot=0;irot<segment->numberOfContainedROTs();irot++) meas->push_back(segment->rioOnTrack(irot)); Trk::LocalDirection dir; plane->globalToLocalDirection(layPar->momentum(),dir); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataContainer.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataContainer.h index 01d8e691f6163f794df700f9ecb3d2f687108ceb..985fd62d1779abe1aeb56111260b82b9d724f784 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataContainer.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataContainer.h @@ -53,7 +53,7 @@ public: MuonPrepDataContainer(unsigned int max); // Constructor with IdentifiableCache object - MuonPrepDataContainer(EventContainers::IdentifiableCache< Muon::MuonPrepDataCollection <CollectionT> >* cache); + MuonPrepDataContainer(EventContainers::IdentifiableCache<CollectionT> * cache); // Destructor: virtual ~MuonPrepDataContainer(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataContainer.icc b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataContainer.icc index b872fac33a51c01614f16c3331c523dd5ce82a6d..454e660fd8ef6703d9fe5a6828a7eb9824f83da0 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataContainer.icc +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataContainer.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -27,7 +27,7 @@ MuonPrepDataContainer< CollectionT>::MuonPrepDataContainer(unsigned int max) : template< class CollectionT> // Constructor with IdentifiableCache: -MuonPrepDataContainer<CollectionT>::MuonPrepDataContainer(EventContainers::IdentifiableCache< Muon::MuonPrepDataCollection <CollectionT> >* cache): +MuonPrepDataContainer<CollectionT>::MuonPrepDataContainer(EventContainers::IdentifiableCache<CollectionT> * cache): IdentifiableContainer<CollectionT>(cache) {} diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataDict.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataDict.h index 15d9f0fb09d6ea4de002ed3c934c545c504366ea..9aa34a47310dfea49bef98cdce9c6398f7ab9277 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataDict.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/MuonPrepDataDict.h @@ -21,6 +21,7 @@ #include "MuonPrepRawData/sTgcPrepDataContainer.h" #include "MuonPrepRawData/MMPrepDataContainer.h" #include "AthLinks/ElementLink.h" +#include "MuonPrepRawData/MuonPrepDataCollection_Cache.h" #define EXPAND_DLV(T, suffix) \ ::DataLinkVector< Muon::MuonPrepDataCollection< T > > m_dummy_dlv_ ## suffix ; \ diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/selection.xml b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/selection.xml index 65dce4844e6a755e6965554b2960d93de325508e..bde3225fac24afea29a4d6b9aa492345119930d6 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/selection.xml +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonPrepRawData/MuonPrepRawData/selection.xml @@ -156,5 +156,14 @@ <class name="ElementLink<Muon::MMPrepDataContainer>"/> <class name="ElementLink<Muon::MMPrepDataContainer>::Base"/> + <!-- Caches --> + <class name="CscPrepDataCollection_Cache"/> + <class name="CscStripPrepDataCollection_Cache"/> + <class name="MdtPrepDataCollection_Cache"/> + <class name="RpcPrepDataCollection_Cache"/> + <class name="TgcPrepDataCollection_Cache"/> + <class name="sTgcPrepDataCollection_Cache"/> + <class name="MMPrepDataCollection_Cache"/> + </lcgdict> diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h index 73fdc1b9d6e11c6bb566601ae0f4540f85e6015b..f7b9a3f56cd6c1f47ce325a5b33807a5917b942b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/MuonSegment/MuonSegment.h @@ -104,11 +104,6 @@ namespace Muon { /** number of RIO_OnTracks */ unsigned int numberOfContainedROTs() const; - /** returns the vector of Trk::RIO_OnTrack objects - - specific for this TrackSegment: Trk::RIO_OnTrack (generic) - */ - const std::vector<const Trk::RIO_OnTrack*>& containedROTs() const; - /** returns the RIO_OnTrack (also known as ROT) objects depending on the integer*/ const Trk::RIO_OnTrack* rioOnTrack(unsigned int) const; @@ -132,21 +127,11 @@ namespace Muon { Trk::LocalDirection m_localDirection; /** The plane surface to which the segment parameters are expressed to */ - mutable const Trk::PlaneSurface* m_associatedSurface; - - /** The cached vector of contained (generic) Trk::RIO_OnTrack objects. - The pointers are not deleted, since the actual objects belong to the base class */ - mutable std::vector<const Trk::RIO_OnTrack*>* m_cachedRots; - - /** private method to clear the Trk::RIO_OnTrack vector */ - void clearRotVector(); + const Trk::PlaneSurface* m_associatedSurface; /** private method to clear the Trk::MeasurementBase vector */ void clearMeasVector(); - /** private method to copy all Trk::RIO_OnTrack pointers in m_cachedRots to m_containedMeasurements */ - void copyMeasurementsToROTs() const; - protected: /**returns some information about this RIO_OnTrack/TrackSegment. It should be overloaded by any child classes*/ @@ -180,23 +165,17 @@ namespace Muon { return new MuonSegment(*this); } - inline const std::vector<const Trk::RIO_OnTrack*>& MuonSegment::containedROTs() const - { - if (0==m_cachedRots) copyMeasurementsToROTs(); - return (*m_cachedRots); - } - inline const Trk::RIO_OnTrack* MuonSegment::rioOnTrack(unsigned int indx) const { - if (0==m_cachedRots) copyMeasurementsToROTs(); - if (indx<numberOfContainedROTs()) - return (*m_cachedRots)[indx]; - return 0; + if (indx<containedMeasurements().size()){ + const Trk::RIO_OnTrack* rot=dynamic_cast<const Trk::RIO_OnTrack*>(containedMeasurements()[indx]); + return rot; + } + else return 0; } inline unsigned int MuonSegment::numberOfContainedROTs() const { - if (0==m_cachedRots) copyMeasurementsToROTs(); - return m_cachedRots->size(); + return containedMeasurements().size(); } inline void MuonSegment::setT0Error(float t0, float t0Error){ diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/src/MuonSegment.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/src/MuonSegment.cxx index 4a2d0ef72a3d5b84172539628ff605777644bfde..5daadeab5b3de3cdb544a4146022bc8983081770 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/src/MuonSegment.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonSegment/src/MuonSegment.cxx @@ -26,8 +26,7 @@ SpaceTimePointBase(kNoValue,kNoValue,1.), m_globalPosition( ), m_globalDirection( ), m_localDirection( ), -m_associatedSurface( 0 ), -m_cachedRots( 0 ) +m_associatedSurface( 0 ) {} MuonSegment::MuonSegment(const MuonSegment& seg) @@ -37,14 +36,10 @@ SpaceTimePointBase(seg), m_globalPosition( seg.m_globalPosition ), m_globalDirection( seg.m_globalDirection ), m_localDirection ( seg.m_localDirection ), -m_associatedSurface( 0 ), -m_cachedRots( 0 ) +m_associatedSurface( 0 ) { m_associatedSurface = (seg.m_associatedSurface->associatedDetectorElement()) ? seg.m_associatedSurface : seg.m_associatedSurface->clone(); - - // create vector of contained Rots and fill it - copyMeasurementsToROTs(); } MuonSegment& MuonSegment::operator=(const MuonSegment& seg) @@ -60,9 +55,6 @@ MuonSegment& MuonSegment::operator=(const MuonSegment& seg) if (0!=m_associatedSurface && 0==m_associatedSurface->associatedDetectorElement()) delete m_associatedSurface; m_associatedSurface = (seg.m_associatedSurface->associatedDetectorElement()) ? seg.m_associatedSurface : seg.m_associatedSurface->clone(); - // clear rots - clearRotVector(); - copyMeasurementsToROTs(); } return (*this); } @@ -79,12 +71,10 @@ MuonSegment::MuonSegment( const Trk::LocalParameters& locpars, m_globalPosition(), m_globalDirection(), m_localDirection(), - m_associatedSurface( psf ), - m_cachedRots(0) + m_associatedSurface( psf ) { recalculateCache(); psf->globalToLocalDirection(m_globalDirection,m_localDirection); - copyMeasurementsToROTs(); } @@ -101,8 +91,7 @@ MuonSegment::MuonSegment( const Amg::Vector2D& locSegPos, m_globalPosition( ), m_globalDirection(), m_localDirection(locSegDir), - m_associatedSurface( psf ), - m_cachedRots( 0 ) + m_associatedSurface( psf ) { psf->localToGlobalDirection(locSegDir,m_globalDirection); @@ -117,20 +106,13 @@ MuonSegment::MuonSegment( const Amg::Vector2D& locSegPos, pars.push_back( Trk::DefinedParameter( phi, Trk::phi) ); pars.push_back( Trk::DefinedParameter( theta, Trk::theta) ); m_localParams = Trk::LocalParameters( pars ); - copyMeasurementsToROTs(); } MuonSegment::~MuonSegment() { if ( 0!=m_associatedSurface && !m_associatedSurface->associatedDetectorElement()) delete m_associatedSurface; - clearRotVector(); } -void MuonSegment::clearRotVector() -{ - delete m_cachedRots; -} - void MuonSegment::recalculateCache(){ CxxUtils::sincos scphi(m_localParams[Trk::phi]); @@ -147,20 +129,6 @@ void MuonSegment::recalculateCache(){ m_associatedSurface->localToGlobal(lpos, m_globalPosition, m_globalPosition); } -void MuonSegment::copyMeasurementsToROTs() const -{ - if (! hasContainedMeasurements() ) return; -// std::cout<<"copyMeasurementsToROTs :"<<this<<" with measurements: "<<containedMeasurements().size()<<std::endl; - m_cachedRots = new std::vector<const Trk::RIO_OnTrack*>; - m_cachedRots->reserve(containedMeasurements().size()); - for (const Trk::MeasurementBase* m : containedMeasurements()) { - // cast to RIO_OnTrack - const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(m); - if( rot ) m_cachedRots->push_back(rot); - } - //std::cout<<"copyMeasurementsToROTs :"<<this<<" with rots: "<<m_cachedRots->size()<<std::endl; -} - MsgStream& MuonSegment::dump( MsgStream& out ) const { out << "Muon::MuonSegment " << std::endl; @@ -177,10 +145,10 @@ MsgStream& MuonSegment::dump( MsgStream& out ) const out << " - t0 (error) : "<<time()<<"("<<errorTime()<<")"<<std::endl; out << " - it contains : " << numberOfContainedROTs() << " RIO_OnTrack object" << std::endl; unsigned int numRoT=1; - std::vector<const Trk::RIO_OnTrack*>::const_iterator rotIter = m_cachedRots->begin(); - std::vector<const Trk::RIO_OnTrack*>::const_iterator rotEnd = m_cachedRots->end(); - for (; rotIter!=rotEnd; ++rotIter) - out << "RoT "<<numRoT++<<std::endl<<**rotIter<<std::endl; + for (const Trk::MeasurementBase* m : containedMeasurements()) { + const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(m); + out << "RoT "<<numRoT++<<std::endl<<*rot<<std::endl; + } return out; } @@ -200,10 +168,10 @@ std::ostream& MuonSegment::dump( std::ostream& out ) const out << " - t0 (error) : "<<time()<<"("<<errorTime()<<")"<<std::endl; out << " - it contains : " << numberOfContainedROTs() << " RIO_OnTrack object" << std::endl; unsigned int numRoT=1; - std::vector<const Trk::RIO_OnTrack*>::const_iterator rotIter = m_cachedRots->begin(); - std::vector<const Trk::RIO_OnTrack*>::const_iterator rotEnd = m_cachedRots->end(); - for (; rotIter!=rotEnd; ++rotIter) - out << "RoT "<<numRoT++<<std::endl<<**rotIter<<std::endl; + for (const Trk::MeasurementBase* m : containedMeasurements()) { + const Trk::RIO_OnTrack* rot = dynamic_cast<const Trk::RIO_OnTrack*>(m); + out << "RoT "<<numRoT++<<std::endl<<*rot<<std::endl; + } return out; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataContainer.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataContainer.h index e95ceb62c1aafaac3eb141b3f835024e28b84dad..0f5b7315927dc2f2521514216eda2b9bd37a24ce 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataContainer.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataContainer.h @@ -41,6 +41,9 @@ public: // Constructor with parameters: MuonCoinDataContainer(unsigned int max); + + // Constructor with cache + MuonCoinDataContainer(EventContainers::IdentifiableCache<CollectionT> * cache); // Destructor: virtual ~MuonCoinDataContainer(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataContainer.icc b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataContainer.icc index 81678d6b295c98824800adc8bc4245a90d737f29..43cbd8895d24a830a3f88fc3dc71d72c80c300f8 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataContainer.icc +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataContainer.icc @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -16,6 +16,12 @@ MuonCoinDataContainer< CollectionT>::MuonCoinDataContainer(unsigned int max) : IdentifiableContainer<CollectionT>(max) {} +template< class CollectionT> +// Constructor with parameters: +MuonCoinDataContainer< CollectionT>::MuonCoinDataContainer(EventContainers::IdentifiableCache<CollectionT> * cache) : + IdentifiableContainer<CollectionT>(cache) +{} + template< class CollectionT> // Destructor MuonCoinDataContainer< CollectionT>::~MuonCoinDataContainer() diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataDict.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataDict.h index 9345d3f56b0c6b1e22870cd8a2bbcd0f95d33faa..e72395f5f34450e83141f18c5628336548f5c415 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataDict.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonCoinDataDict.h @@ -10,6 +10,7 @@ #include "MuonTrigCoinData/TgcCoinDataContainer.h" #include "MuonTrigCoinData/RpcCoinData.h" #include "MuonTrigCoinData/RpcCoinDataContainer.h" +#include "MuonTrigCoinData/MuonTrigCoinData_Cache.h" namespace tmpMuonTrigCoinData { @@ -23,6 +24,8 @@ namespace tmpMuonTrigCoinData std::vector<Muon::MuonCoinDataCollection<Muon::TgcCoinData>* > dummy2Tgc; DataVector<Muon::MuonCoinDataCollection<Muon::RpcCoinData> > dummy1Rpc; std::vector<Muon::MuonCoinDataCollection<Muon::RpcCoinData>* > dummy2Rpc; + + }; } diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonTrigCoinData_Cache.h b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonTrigCoinData_Cache.h new file mode 100644 index 0000000000000000000000000000000000000000..f84d3c52550d60b7ef57b7f862319081c5a25076 --- /dev/null +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/MuonTrigCoinData_Cache.h @@ -0,0 +1,17 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#pragma once + +#include "EventContainers/IdentifiableCache.h" + +#include "MuonTrigCoinData/RpcCoinDataCollection.h" +#include "MuonTrigCoinData/TgcCoinDataCollection.h" + +// Typedef the different templates which are likely to be used later on +typedef EventContainers::IdentifiableCache <Muon::RpcCoinDataCollection> RpcCoinDataCollection_Cache; +typedef EventContainers::IdentifiableCache <Muon::TgcCoinDataCollection> TgcCoinDataCollection_Cache; + +CLASS_DEF( RpcCoinDataCollection_Cache, 1162490086, 1 ) +CLASS_DEF( TgcCoinDataCollection_Cache, 1080713821, 1 ) diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/selection.xml b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/selection.xml index 6027d95d85b3a37b139ce456b98a59e9d3adb3d4..2e5a89112ddd3855f0bbcd6888cc4a8ca874d6f9 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/selection.xml +++ b/MuonSpectrometer/MuonReconstruction/MuonRecEvent/MuonTrigCoinData/MuonTrigCoinData/selection.xml @@ -34,4 +34,7 @@ <field name="m_last" transient="true" /> <field name="m_vect" transient="true" /> </class> + + <class name="RpcCoinDataCollection_Cache" /> + <class name="TgcCoinDataCollection_Cache" /> </lcgdict> diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonHolesOnTrackTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonHolesOnTrackTool.cxx index 79aa75193ff6019d56ccf6a4413f50e9e343c12f..93b2fcfa804374afc7668732399d772cecde9b51 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonHolesOnTrackTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTGRecTools/src/MuonHolesOnTrackTool.cxx @@ -282,7 +282,7 @@ const Trk::Track* Muon::MuonHolesOnTrackTool::getTrackWithHoles(const Trk::Track DataVector<const Trk::TrackStateOnSurface>::iterator hit = holes->begin(); DataVector<const Trk::TrackStateOnSurface>::iterator hend = holes->end(); // order function for this track already defined ? - sort( hit, hend, fOrd ); + std::sort( hit, hend, fOrd ); // create track return new Trk::Track(input_track.info(),holes, new Trk::FitQuality(*(input_track.fitQuality()))); } @@ -431,7 +431,7 @@ const Trk::Track* Muon::MuonHolesOnTrackTool::getTrackWithHolesAndOutliers(const DataVector<const Trk::TrackStateOnSurface>::iterator hit = holes->begin(); DataVector<const Trk::TrackStateOnSurface>::iterator hend = holes->end(); - sort( hit, hend, fOrd ); + std::sort( hit, hend, fOrd ); // create track return new Trk::Track(input_track.info(),holes, new Trk::FitQuality(*(input_track.fitQuality()))); @@ -505,7 +505,7 @@ const Trk::TrackParameters* Muon::MuonHolesOnTrackTool::getMSEntry(const Track* std::vector<const Trk::TrackStateOnSurface*>::iterator it = ntSoS.begin(); std::vector<const Trk::TrackStateOnSurface*>::iterator it_end = ntSoS.end(); - sort(it,it_end,fOrd); + std::sort(it,it_end,fOrd); orderedTSoS = new DataVector<const Trk::TrackStateOnSurface>; diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthSummaryTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthSummaryTool.cxx index f408462561ca87e78fddb6e7595f1bf88a10fb0d..02f2345c4784233836d765be5c1a42f6203ddf1e 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthSummaryTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonRecTools/MuonTruthTools/src/MuonTruthSummaryTool.cxx @@ -151,13 +151,13 @@ namespace Muon { std::scoped_lock lock(m_mutex); if( m_truthHits.empty() ) return "Event without truth hits"; if( m_truthDataPerLevel.empty() ) return "No hits added"; - ATH_MSG_DEBUG( "Have " << m_truthHits.size() << " truth hits and "<< m_truthDataPerLevel.size()<<" levels filled." ); + std::ostringstream sout; + sout << "Have " << m_truthHits.size() << " truth hits and "<< m_truthDataPerLevel.size()<<" levels filled." <<std::endl; std::unordered_set<Identifier, IdentifierHash> truthHits; for( auto it = m_truthHits.begin();it!=m_truthHits.end();++it ) truthHits.insert(it->first); m_truthHitsTotal+=truthHits.size(); - std::ostringstream sout; sout << " Summarizing: truth hits " << truthHits.size() << " levels filled " << m_truthDataPerLevel.size()<<std::endl; for (auto& pair : m_truthDataPerLevel) { m_level=pair.first-1; @@ -180,8 +180,10 @@ namespace Muon { std::ostringstream sout; if( truth.size() != found.size() ){ sout << " Some truth hits not found: truth " << truth.size() << " found " << found.size() << std::endl; + std::set<Identifier> truthset(truth.begin(), truth.end()); + std::set<Identifier> foundset(found.begin(), found.end()); std::vector<Identifier> result(truth.size()-found.size()); - std::vector<Identifier>::iterator pos = std::set_difference(truth.begin(),truth.end(),found.begin(),found.end(),result.begin()); + std::vector<Identifier>::iterator pos = std::set_difference(truthset.begin(),truthset.end(),foundset.begin(),foundset.end(),result.begin()); result.resize(pos-result.begin()); int nmm = 0; std::map<Identifier, unsigned int> chambers; // Store counts per chamber Id diff --git a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLayerHough/MuonLayerHough/Hit.h b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLayerHough/MuonLayerHough/Hit.h index 18944c44b6e7205eda4408bb99d42bde776a7ca7..bf5633d8139336244b02ffda9f19dda55dbc2037 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLayerHough/MuonLayerHough/Hit.h +++ b/MuonSpectrometer/MuonReconstruction/MuonRecUtils/MuonLayerHough/MuonLayerHough/Hit.h @@ -169,7 +169,7 @@ namespace MuonHough { }; /// struct to sort the hits - struct SortHitsPerLayer : public std::binary_function<class Hit, class Hit, bool> { + struct SortHitsPerLayer { bool operator()(const Hit& hit1, const Hit& hit2 ) const { return compare(hit1.ymin, hit2.ymin, hit1.layer, hit2.layer, hit1.debugInfo(), hit2.debugInfo() ); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentFinder.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentFinder.h index ac237ed6b669db3fad0464f3b85f46b873f43a58..2761ce9186f6f4a9d7043d9b0313d2bbb398a700 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentFinder.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/CscSegmentMakers/ICscSegmentFinder.h @@ -128,7 +128,7 @@ public: typedef std::vector<Segment> Segments; - struct sortByNunspoilAndChsq : public std::binary_function<class Segment, class Segment, bool> + struct sortByNunspoilAndChsq { bool operator()(const Segment& seg1, const Segment& seg2 ) { diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx index 7e21a13e33a16ad092993ec6c7a8357ab4c9e6e4..51321a2d9e91b93bdef59c9ff6db14060150adb7 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.cxx @@ -1,9 +1,8 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "Csc2dSegmentMaker.h" -#include "CscSegmentMakers/ICscSegmentUtilTool.h" #include <sstream> #include <cmath> @@ -15,7 +14,6 @@ #include "MuonRIO_OnTrack/CscClusterOnTrack.h" #include "MuonRIO_OnTrack/MdtDriftCircleOnTrack.h" -#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" #include "MuonIdHelpers/MuonIdHelperTool.h" #include "TrkEventPrimitives/FitQuality.h" @@ -25,8 +23,6 @@ #include "TrkSegment/Segment.h" #include "TrkRoad/TrackRoad.h" -#include "MuonRecHelperTools/MuonEDMPrinterTool.h" - #include "MuonCondInterface/ICSCConditionsSvc.h" using Muon::CscPrepDataContainer; @@ -44,12 +40,6 @@ using Muon::MdtDriftCircleOnTrack; namespace { -/*std::string station_name(int station) { - if ( station == 1 ) return "CSS"; - if ( station == 2 ) return "CSL"; - return "UNKNOWN_STATION"; -}*/ - std::string measphi_name(bool measphi) { if ( measphi ) return "phi"; return "eta"; @@ -77,27 +67,16 @@ Csc2dSegmentMaker(const std::string& type, const std::string& aname, const IInte : AthAlgTool(type, aname, parent), m_segmentTool("CscSegmentUtilTool/CscSegmentUtilTool", this), m_cscClusterOnTrackCreator("Muon::CscClusterOnTrackCreator/CscClusterOnTrackCreator", this), - m_idHelper("Muon::MuonIdHelperTool/MuonIdHelperTool"), m_printer("Muon::MuonEDMPrinterTool/MuonEDMPrinterTool") - //m_cscCoolStrSvc("MuonCalib::CscCoolStrSvc", aname) - //m_cscCondSvc("CSCCondSummarySvc",name()) { declareInterface<ICscSegmentFinder>(this); declareProperty("segmentTool", m_segmentTool); declareProperty("cscRotCreator", m_cscClusterOnTrackCreator); - declareProperty("IdHelper", m_idHelper); declareProperty("cscdig_sg_inkey", m_cscdig_sg_inkey = "CSC_Measurements"); } //****************************************************************************** -// Destructor. - -Csc2dSegmentMaker::~Csc2dSegmentMaker() { -} - -//****************************************************************************** - StatusCode Csc2dSegmentMaker::initialize(){ ATH_MSG_DEBUG ( "Initializing " << name() ); @@ -115,22 +94,7 @@ StatusCode Csc2dSegmentMaker::initialize(){ ATH_MSG_ERROR ( "Unable to retrieve " << m_cscClusterOnTrackCreator ); return StatusCode::FAILURE; } - if ( m_idHelper.retrieve().isFailure() ) { - ATH_MSG_ERROR ( "Unable to retrieve CscSegmentUtilTool " << m_idHelper ); - return StatusCode::FAILURE; - } - /* - if ( m_cscCoolStrSvc.retrieve().isFailure() ) { - ATH_MSG_FATAL ( "Unable to retrieve pointer to the CSC COLL Conditions Service" ); - return StatusCode::FAILURE; - } - */ - /* - if (m_cscCondSvc.retrieve().isFailure()) { - ATH_MSG_ERROR("Could not get ICSConditionsSvc"); - return StatusCode::FAILURE; - } - */ + return StatusCode::SUCCESS; } @@ -255,16 +219,6 @@ MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepD return 0; } -// // create CscClusterOnTrack and pass to segment finder. -// Trk::LocalPosition lpos = pclu->localPosition(); - -// Trk::DefinedParameter locPar(lpos.x(),Trk::locX); -// Trk::LocalParameters* ppars = new Trk::LocalParameters(locPar); -// Trk::ErrorMatrix* pcerr = new Trk::ErrorMatrix(pclu->localErrorMatrix()); - - // Trk::ParamDefs icor = Trk::loc1; - // double positionAlongStrip = lpos.get(icor); // should be carefully estimated - const Muon::MuonClusterOnTrack* clu = m_cscClusterOnTrackCreator->createRIO_OnTrack(*pclu,pclu->globalPosition()); const Muon::CscClusterOnTrack* ptclu = dynamic_cast<const Muon::CscClusterOnTrack*>(clu); if( !ptclu ){ @@ -273,7 +227,6 @@ MuonSegmentCombination* Csc2dSegmentMaker::findSegmentCombination(const CscPrepD continue; } Amg::Vector3D lpos = gToLocal*ptclu->globalPosition(); -// std::cout << " " << m_idHelper->toString(ptclu->identify()) << " lpos " << lpos << " locPos " << pclu->localPosition() << std::endl; if ( measphi ) { phi_id = id; phi_clus[iwlay-1].push_back(Cluster(lpos,ptclu,measphi)); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h index 3eaae8e34293d8fb2762885a0f65cd7326094287..a017a26c1a60262e13d356fdeaadcc1576a6ca67 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/Csc2dSegmentMaker.h @@ -1,8 +1,7 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// Csc2dSegmentMaker.h #ifndef Csc2dSegmentMaker_H #define Csc2dSegmentMaker_H @@ -14,33 +13,13 @@ // for each combination. #include "AthenaBaseComps/AthAlgTool.h" -#include "GaudiKernel/ToolHandle.h" // separately... +#include "GaudiKernel/ToolHandle.h" #include "GaudiKernel/ServiceHandle.h" #include "MuonIdHelpers/IMuonIdHelperSvc.h" -#include "Identifier/Identifier.h" #include "CscSegmentMakers/ICscSegmentFinder.h" -//#include "MuonCondInterface/CscICoolStrSvc.h" -// MuonSegmentCombination(Collection).h included -// and "MuonPrepRawData/CscPrepDataContainer.h" - -class ICscClusterFitter; -class ICscStripFitter; -class ICscSegmentUtilTool; -class ICSCConditionsSvc; - - -namespace Muon { - class IMuonClusterOnTrackCreator; - class MdtDriftCircleOnTrack; - class MuonClusterOnTrack; - class MuonSegment; - class MuonIdHelperTool; - class IMuonClusterOnTrackCreator; - class MuonEDMPrinterTool; -} -namespace Track{ - class RIO_OnTrack; -} +#include "MuonRecToolInterfaces/IMuonClusterOnTrackCreator.h" +#include "MuonRecHelperTools/MuonEDMPrinterTool.h" +#include "CscSegmentMakers/ICscSegmentUtilTool.h" class Csc2dSegmentMaker : virtual public ICscSegmentFinder, public AthAlgTool { @@ -50,7 +29,7 @@ public: // methods Csc2dSegmentMaker(const std::string&, const std::string&, const IInterface*); // Destructor. - ~Csc2dSegmentMaker(); + ~Csc2dSegmentMaker()=default; // Initialization. StatusCode initialize(); @@ -69,17 +48,13 @@ private: // methods private: // data // Output container. - // MuonSegmentCombinationCollection* m_psegs; ServiceHandle<Muon::IMuonIdHelperSvc> m_idHelperSvc {this, "MuonIdHelperSvc", "Muon::MuonIdHelperSvc/MuonIdHelperSvc"}; std::string m_cscdig_sg_inkey; ToolHandle<ICscSegmentUtilTool> m_segmentTool; ToolHandle<Muon::IMuonClusterOnTrackCreator> m_cscClusterOnTrackCreator; - ToolHandle<Muon::MuonIdHelperTool> m_idHelper; ToolHandle<Muon::MuonEDMPrinterTool> m_printer; - //ServiceHandle<MuonCalib::CscICoolStrSvc> m_cscCoolStrSvc; - //ServiceHandle<ICSCConditionsSvc> m_cscCondSvc; //CSC conditions }; diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx index b08921b545d57e415814220fc48ee719e16f1b70..ea5d9804e2d181f1a4b8727199e8db03f244a752 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerAlgs/CscSegmentMakers/src/CscSegmentUtilTool.cxx @@ -1032,7 +1032,8 @@ build_segment(const ICscSegmentFinder::Segment& seg, bool measphi, Identifier ch // Loop over collections in the container. ICscSegmentFinder::MbaseList* prios_new = new ICscSegmentFinder::MbaseList; ICscSegmentFinder::TrkClusters fitclus; - const ICscSegmentFinder::RioList& oldrios = pseg_ref->containedROTs(); + ICscSegmentFinder::RioList oldrios; + for(unsigned int irot=0;irot<pseg_ref->numberOfContainedROTs();irot++) oldrios.push_back(pseg_ref->rioOnTrack(irot)); int cnt =0; for ( ICscSegmentFinder::RioList::size_type irio=0; irio<prios->size(); ++irio ) { @@ -1848,8 +1849,8 @@ get4dMuonSegmentCombination( const MuonSegmentCombination* insegs ) const { const MuonSegment& rsg = **irsg; unsigned int nMinRIOs=3; if(insegs->use2LayerSegments(1)) nMinRIOs=2; - if ( rsg.containedROTs().size()<nMinRIOs){ - ATH_MSG_DEBUG("only "<<rsg.containedROTs().size()<<", RIO's, insufficient to build the 4d segment from a single eta segment"); + if ( rsg.numberOfContainedROTs()<nMinRIOs){ + ATH_MSG_DEBUG("only "<<rsg.numberOfContainedROTs()<<", RIO's, insufficient to build the 4d segment from a single eta segment"); continue; } std::unique_ptr<MuonSegment> pseg(new MuonSegment(rsg)); @@ -1862,8 +1863,8 @@ get4dMuonSegmentCombination( const MuonSegmentCombination* insegs ) const { const MuonSegment& psg = **ipsg; unsigned int nMinRIOs=3; if(insegs->use2LayerSegments(0)) nMinRIOs=2; - if ( psg.containedROTs().size()<nMinRIOs){ - ATH_MSG_DEBUG("only "<<psg.containedROTs().size()<<", RIO's, insufficient to build the 4d segment from a single phi segment"); + if ( psg.numberOfContainedROTs()<nMinRIOs){ + ATH_MSG_DEBUG("only "<<psg.numberOfContainedROTs()<<", RIO's, insufficient to build the 4d segment from a single phi segment"); continue; } std::unique_ptr<MuonSegment> pseg(new MuonSegment(psg)); @@ -1920,7 +1921,8 @@ make_4dMuonSegment(const MuonSegment& rsg, const MuonSegment& psg, bool use2LayS const Amg::MatrixX& rcov = rsg.localCovariance(); const Trk::PlaneSurface& etasrf = rsg.associatedSurface(); - const ICscSegmentFinder::RioList& etarios = rsg.containedROTs(); + ICscSegmentFinder::RioList etarios; + for(unsigned int irot=0;irot<rsg.numberOfContainedROTs();irot++) etarios.push_back(rsg.rioOnTrack(irot)); const Trk::FitQuality& rfq = *rsg.fitQuality(); const Trk::FitQuality& phifq = *psg.fitQuality(); @@ -1928,7 +1930,8 @@ make_4dMuonSegment(const MuonSegment& rsg, const MuonSegment& psg, bool use2LayS double phidir = psg.localDirection().angleXZ(); const Amg::MatrixX& phicov = psg.localCovariance(); const Trk::PlaneSurface& phisrf = psg.associatedSurface(); - const ICscSegmentFinder::RioList& phirios = psg.containedROTs(); + ICscSegmentFinder::RioList phirios; + for(unsigned int irot=0;irot<psg.numberOfContainedROTs();irot++) phirios.push_back(psg.rioOnTrack(irot)); // Fit quality. double chsq = rfq.chiSquared() + phifq.chiSquared(); @@ -2371,8 +2374,10 @@ double CscSegmentUtilTool:: matchLikelihood(const MuonSegment& rsg, const MuonSegment& psg) const { // Loop over eta and phi segments. - const ICscSegmentFinder::RioList& etarios = rsg.containedROTs(); - const ICscSegmentFinder::RioList& phirios = psg.containedROTs(); + ICscSegmentFinder::RioList etarios; + for(unsigned int irot=0;irot<rsg.numberOfContainedROTs();irot++) etarios.push_back(rsg.rioOnTrack(irot)); + ICscSegmentFinder::RioList phirios; + for(unsigned int irot=0;irot<psg.numberOfContainedROTs();irot++) etarios.push_back(psg.rioOnTrack(irot)); int maxeta = etarios.size(); int maxphi = phirios.size(); diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx index ce85bab95505672ee823eae2617d2434d64f85b2..bf9fc34e16a12b91862c59d43b18cdc1a2ccb98b 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/DCMathSegmentMaker.cxx @@ -1849,13 +1849,13 @@ namespace Muon { }; template<class T> - struct SortIdDataVec : public std::binary_function<const IdDataVec<T>&,const IdDataVec<T>&,bool> { + struct SortIdDataVec { bool operator()(const IdDataVec<T>& d1, const IdDataVec<T>& d2 ){ return d1.id < d2.id; } }; - struct SortClByPull : public std::binary_function<const std::pair<double,DCMathSegmentMaker::Cluster2D>&,const std::pair<double,DCMathSegmentMaker::Cluster2D>&,bool> { + struct SortClByPull { bool operator()(const std::pair<double,DCMathSegmentMaker::Cluster2D>& d1, const std::pair<double,DCMathSegmentMaker::Cluster2D>& d2 ){ return fabs(d1.first) < fabs(d2.first); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx index 72d7e5b38a3005f9acb012267ef8a90e00cfb478..8edff6311fd96ff2434ab5ad91682ba175b6fe86 100755 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/DCMathSegmentMaker/src/MuonClusterSegmentFinderTool.cxx @@ -327,7 +327,7 @@ namespace Muon { double phi = seeds[i].second.phi(); double theta = (*sit)->globalDirection().theta(); double qoverp=0; - Trk::PerigeeSurface persurf((*sit)->containedROTs().front()->globalPosition()); + Trk::PerigeeSurface persurf((*sit)->rioOnTrack(0)->globalPosition()); startpar = new Trk::Perigee(0,0,phi,theta,qoverp,persurf); seed3D = seeds[i]; } @@ -358,13 +358,12 @@ namespace Muon { //interleave the phi hits std::vector<const Trk::MeasurementBase*> vec2; - const std::vector<const Trk::RIO_OnTrack*> etaHits = (*sit)->containedROTs(); + unsigned int netas = (*sit)->numberOfContainedROTs(); bool useEtaHitsRedone = false; - if(etaHitsRedone.size()>etaHits.size()) { - ATH_MSG_VERBOSE(" Found additional eta hits " << etaHitsRedone.size() - etaHits.size()); + if(etaHitsRedone.size()>netas) { + ATH_MSG_VERBOSE(" Found additional eta hits " << etaHitsRedone.size() - netas); useEtaHitsRedone = true; } - unsigned int netas = etaHits.size(); if(useEtaHitsRedone) netas = etaHitsRedone.size(); if(m_ipConstraint) vec2.reserve(phiHits.size()+netas+1); else vec2.reserve(phiHits.size()+netas); @@ -382,18 +381,18 @@ namespace Muon { } unsigned int iEta(0),iPhi(0); - ATH_MSG_VERBOSE( "There are " << etaHits.size() << " & " << phiHits.size() << " eta and phi hits" ); + ATH_MSG_VERBOSE( "There are " << (*sit)->numberOfContainedROTs() << " & " << phiHits.size() << " eta and phi hits" ); while(true) { float phiZ(999999.),etaZ(999999.); if(iPhi < phiHits.size()) phiZ = fabs(phiHits[iPhi]->globalPosition().z()); - if(iEta < etaHits.size()) etaZ = fabs(etaHits[iEta]->globalPosition().z()); + if(iEta < (*sit)->numberOfContainedROTs()) etaZ = fabs((*sit)->rioOnTrack(iEta)->globalPosition().z()); if( phiZ < etaZ ) { vec2.push_back(phiHits[iPhi]); iPhi++; } else { if(!useEtaHitsRedone) { - vec2.push_back(etaHits[iEta]); + vec2.push_back((*sit)->rioOnTrack(iEta)); } else { vec2.push_back(etaHitsRedone[iEta]); } @@ -611,61 +610,30 @@ namespace Muon { for(std::vector<std::vector<const Muon::MuonClusterOnTrack*> >::const_iterator cvecIt=clusters.begin(); cvecIt!=clusters.end(); ++cvecIt) { const Muon::MuonClusterOnTrack* rio = 0; double bestDist(9999.); - double bestTimeDist(9999.); - if (m_idHelperTool->isMM((*((*cvecIt).begin()))->identify())) { // MM specific algorithm - for(std::vector< const Muon::MuonClusterOnTrack* >::const_iterator cit=(*cvecIt).begin(); cit!=(*cvecIt).end(); ++cit) { - double tdrift = (dynamic_cast<const MMPrepData *>((*cit)->prepRawData()))->time(); - double dist = clusterDistanceToSeed( *cit, seed); - double timedist = std::abs(clusterDistanceToSeed( *cit, seed)) + std::abs(tdrift*0.015); // std::abs(tdrift*0.015) is an ad hoc penalty factor, to be optimised when time resolution is known - double error = Amg::error((*cit)->localCovariance(),Trk::locX); - if (!tight) error += 15.; - ATH_MSG_VERBOSE(" lay " << layer << " tdrift " << tdrift << " dist " << dist << " timedist " << timedist << " pull " << dist/error - << " cut " << m_maxClustDist << " " << m_idHelperTool->toString((*cit)->identify()) ); - if( std::abs(dist/error) < m_maxClustDist) { - if(std::abs(timedist) < bestTimeDist) { - bestTimeDist = std::abs(timedist); - bestDist = dist; - } - } - } - if(bestDist<9999.) { // check if at least one cluster present close to seed - ATH_MSG_VERBOSE(" Best distance " << bestDist); - ATH_MSG_VERBOSE(" Looking for RIOs from mTPC around the best distance"); - for(std::vector< const Muon::MuonClusterOnTrack* >::const_iterator cit=(*cvecIt).begin(); cit!=(*cvecIt).end(); ++cit) { - double dist = clusterDistanceToSeed( *cit, seed); - double window = std::abs(2.*5.*0.047 * ((*cit)->globalPosition().perp() / (*cit)->globalPosition().z())); // all hits in the range [bestDist-window;bestDist-window] will be accepted; 2-safety factor; 5-time resolution; 0.047-drift velocity; (hardcoded values to be removed once time resolution model is known) - double error = Amg::error((*cit)->localCovariance(),Trk::locX); - if (!tight) error += 15.; - ATH_MSG_VERBOSE(" Current RIO : distance " << dist << " window " << window << " to be attached " << ( (std::abs(std::abs(dist)-bestDist) < window) && (std::abs(dist/error) < m_maxClustDist) ) ); - if( (std::abs(dist-bestDist) < window) && (std::abs(dist/error) < m_maxClustDist) ) { - rios.push_back( (*cit) ); - ATH_MSG_VERBOSE(" adding " << dist << " " << m_idHelperTool->toString((*cit)->identify()) ); - } - } - } - } else { // algorithm for all the technoligies but MM - for(std::vector< const Muon::MuonClusterOnTrack* >::const_iterator cit=(*cvecIt).begin(); cit!=(*cvecIt).end(); ++cit) { - double dist = clusterDistanceToSeed( *cit, seed); - double error = Amg::error((*cit)->localCovariance(),Trk::locX); - ATH_MSG_VERBOSE(" lay " << layer << " dist " << dist << " pull " << dist/error - << " cut " << m_maxClustDist << " " << m_idHelperTool->toString((*cit)->identify()) ); - if( std::abs(dist/error) < m_maxClustDist) { - if(std::abs(dist) < bestDist) { - bestDist = std::abs(dist); - rio = (*cit); - } - } - } - if(rio) { - ATH_MSG_VERBOSE(" adding " << bestDist << " " << m_idHelperTool->toString(rio->identify()) ); - rios.push_back( rio ); - } + + for(std::vector< const Muon::MuonClusterOnTrack* >::const_iterator cit=(*cvecIt).begin(); cit!=(*cvecIt).end(); ++cit) { + double dist = clusterDistanceToSeed( *cit, seed); + double error = Amg::error((*cit)->localCovariance(),Trk::locX); + if (!tight && m_idHelperTool->isMM((*cit)->identify())) error += 15.; + + ATH_MSG_VERBOSE(" lay " << layer << " dist " << dist << " pull " << dist/error + << " cut " << m_maxClustDist << " " << m_idHelperTool->toString((*cit)->identify()) ); + if( std::abs(dist/error) < m_maxClustDist) { + if(std::abs(dist) < bestDist) { + bestDist = std::abs(dist); + rio = (*cit); + } + } + } + if(rio) { + ATH_MSG_VERBOSE(" adding " << bestDist << " " << m_idHelperTool->toString(rio->identify()) ); + rios.push_back( rio ); } ++layer; - } - ATH_MSG_VERBOSE(" getClustersOnSegment: returning hits " << rios.size() ); - return rios; - } + } + ATH_MSG_VERBOSE(" getClustersOnSegment: returning hits " << rios.size() ); + return rios; + } Amg::Vector3D MuonClusterSegmentFinderTool::intersectPlane( const Trk::PlaneSurface& surf, const Amg::Vector3D& pos, diff --git a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx index a957cc4b190984e31bd4a00578acdc438d1e893b..87184d35ce3c75708abd2ef7b84548232c02b6be 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx +++ b/MuonSpectrometer/MuonReconstruction/MuonSegmentMakers/MuonSegmentMakerTools/MuonSegmentOverlapRemovalTools/src/MuonSegmentCombinationCleanerTool.cxx @@ -501,7 +501,7 @@ namespace Muon { for (;ipsg!=ipsg_end;++ipsg){ MuonSegment* seg=(*ipsg).get(); - if( seg->containedROTs().size() > 3 ) { + if( seg->numberOfContainedROTs() > 3 ) { summary.stationsGood.insert(stIndex); } diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerUtils/MuonTrackMakerUtils/SortMeasurementsByPosition.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerUtils/MuonTrackMakerUtils/SortMeasurementsByPosition.h index ebd02a1af6b26c60157eae364a0d4fd0bf9fec2d..43ec2def0dcce0798c64e57ac11aeb55d2ae17ec 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerUtils/MuonTrackMakerUtils/SortMeasurementsByPosition.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerUtils/MuonTrackMakerUtils/SortMeasurementsByPosition.h @@ -129,7 +129,7 @@ namespace Muon { - class SortMeasurementsByPosition : public std::binary_function<const Trk::MeasurementBase*,const Trk::MeasurementBase*,bool> { + class SortMeasurementsByPosition { public: SortMeasurementsByPosition(bool hasEndcap=true) : @@ -143,12 +143,6 @@ namespace Muon { double d1 = m_isEndcap ? fabs(m1->globalPosition().z()) : fabs(m1->globalPosition().perp()); double d2 = m_isEndcap ? fabs(m2->globalPosition().z()) : fabs(m2->globalPosition().perp()); bool result = d1 < d2; -/* bool result2 = fabs(m1->globalPosition().perp()) < fabs(m2->globalPosition().perp()); */ -/* if( m_isEndcap ) result2 = fabs(m1->globalPosition().z()) < fabs(m2->globalPosition().z()); */ - -/* std::cout << " meas 1 " << meas1 << " d " << d1 << " meas2 " << meas2 << " d " << d2 */ -/* << " result " << result << " result2 " << result2 << std::endl; */ -/* if( result != result2 ) std::cout << " ERROR these number should be the same!!! " << std::endl; */ return result; } private: diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerUtils/MuonTrackMakerUtils/TrackStateOnSurfaceComparisonFunction.h b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerUtils/MuonTrackMakerUtils/TrackStateOnSurfaceComparisonFunction.h index 874f3c827738693674e0c37520db9e180ee89cd8..afcd86070c29b3f17ab7b18f3e7ed34d4b5b6ba4 100644 --- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerUtils/MuonTrackMakerUtils/TrackStateOnSurfaceComparisonFunction.h +++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerUtils/MuonTrackMakerUtils/TrackStateOnSurfaceComparisonFunction.h @@ -34,13 +34,11 @@ namespace Muon { - /** Class inheriting from std::binary_function to provide a - * comparison function, or relational definition, for + /** + * Class implementing a comparison function, or relational definition, for * sorting TrackStateOnSurface objects */ - class TrackStateOnSurfaceComparisonFunction - : public std::binary_function<const Trk::TrackStateOnSurface*, - const Trk::TrackStateOnSurface*, bool> { + class TrackStateOnSurfaceComparisonFunction { public: /** Constructor with the fallback direction to use for ordering */ diff --git a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx index 6f4a188ef1fd86fa9284b83a208472a607235583..7c951ba40259bfde1efd9f9508f885b1c15fd44c 100755 --- a/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx +++ b/MuonSpectrometer/MuonTruthAlgs/src/DetailedMuonPatternTruthBuilder.cxx @@ -580,15 +580,12 @@ Amg::Vector3D DetailedMuonPatternTruthBuilder::getPRDTruthPosition(const Muon::M std::map< const Trk::TrkDetElementBase*, std::pair< std::list<const Trk::PrepRawData*>,std::list<const Trk::PrepRawData*> > > clustersPerDetEl; // Loop over containedROTs in segment - const std::vector<const Trk::RIO_OnTrack*>& cROTv = segment.containedROTs(); - for(unsigned int i_cROTv = 0; i_cROTv < cROTv.size(); i_cROTv++) { - if(cROTv.size() == 0) { - ATH_MSG_WARNING("Error, cROTv size is zero"); - continue; - } + for(unsigned int i_cROTv = 0; i_cROTv < segment.numberOfContainedROTs(); i_cROTv++) { + + const Trk::RIO_OnTrack* rot=segment.rioOnTrack(i_cROTv); // get the PrepRawData from the ROT - const Trk::PrepRawData* prd = cROTv.at(i_cROTv)->prepRawData(); + const Trk::PrepRawData* prd = rot->prepRawData(); Identifier id = prd->identify(); @@ -1092,12 +1089,11 @@ void DetailedMuonPatternTruthBuilder::addDetailedTrackTruthFromSegment(std::vect std::set<Muon::MuonStationIndex::ChIndex> chIndices; // Loop over containedROTs in segment - const std::vector<const Trk::RIO_OnTrack*>& cROTv = segment.containedROTs(); - for(unsigned int i_cROTv = 0; i_cROTv < cROTv.size(); i_cROTv++) { - if(cROTv.size() == 0) continue; + for(unsigned int i_cROTv = 0; i_cROTv < segment.numberOfContainedROTs(); i_cROTv++) { + const Trk::RIO_OnTrack* rot=segment.rioOnTrack(i_cROTv); // get the PrepRawData from the ROT - const Trk::PrepRawData* prd = cROTv.at(i_cROTv)->prepRawData(); + const Trk::PrepRawData* prd = rot->prepRawData(); Identifier id = prd->identify(); chIndices.insert(m_idHelperSvc->chamberIndex(id)); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/python/MuonDQAMonitoringConfig.py b/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/python/MuonDQAMonitoringConfig.py index b1ce89c981d9a2eaeaf7631e142b3f6bd936b45d..063a00194a3c04c23e3339aae0f8f6d034757434 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/python/MuonDQAMonitoringConfig.py +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonDQAMonitoring/python/MuonDQAMonitoringConfig.py @@ -11,12 +11,12 @@ def MuonDQAMonitoringConfig(flags): # do not run in RAW->ESD, or AOD-only if flags.DQ.Environment not in ('tier0Raw', 'AOD'): from MdtRawDataMonitoring.MDTMonitorAlgorithm import MdtMonitoringConfig + from RpcRawDataMonitoring.RpcMonitorAlgorithm import RpcMonitoringConfig result.merge(MdtMonitoringConfig(flags)) + result.merge(RpcMonitoringConfig(flags)) from TgcRawDataMonitoring.TgcRawDataMonitorAlgorithm import TgcRawDataMonitoringConfig - from RpcRawDataMonitoring.RpcMonitorAlgorithm import RpcMonitoringConfig result.merge(TgcRawDataMonitoringConfig(flags)) - result.merge(RpcMonitoringConfig(flags)) return result diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx index 842fb4109f371d9aa996c791eef44c7def91209c..70a24a6dabaf4300631d31279e252045bd734f93 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataMonAlg.cxx @@ -1186,7 +1186,7 @@ StatusCode MdtRawDataMonAlg::handleEvent_effCalc(const Trk::SegmentCollection* s ATH_MSG_DEBUG("no pointer to segment!!!"); break; } - if(segment->containedROTs().size() < m_nb_hits || segment->containedROTs().size() <= 0 || segment->fitQuality()->chiSquared() / segment->fitQuality()->doubleNumberDoF() > m_chi2_cut) { + if(segment->numberOfContainedROTs() < m_nb_hits || segment->numberOfContainedROTs() <= 0 || segment->fitQuality()->chiSquared() / segment->fitQuality()->doubleNumberDoF() > m_chi2_cut) { continue; } @@ -1198,11 +1198,8 @@ StatusCode MdtRawDataMonAlg::handleEvent_effCalc(const Trk::SegmentCollection* s std::vector<float> ROTs_DR; std::vector<float> ROTs_DRerr; std::vector<float> ROTs_DT; - const std::vector<const Trk::RIO_OnTrack*>& rots = segment->containedROTs(); - std::vector<const Trk::RIO_OnTrack*>::const_iterator rit = rots.begin(); - std::vector<const Trk::RIO_OnTrack*>::const_iterator rit_end = rots.end(); - for( ; rit!=rit_end;++rit ) { - const Trk::RIO_OnTrack* rot = *rit; + for(unsigned int irot=0;irot<segment->numberOfContainedROTs();irot++){ + const Trk::RIO_OnTrack* rot = segment->rioOnTrack(irot); const Muon::MdtDriftCircleOnTrack* mrot = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(rot); if(mrot) { diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx index 4b4a0172554e9a153df89d9e6059d96b321959a1..60f96da35c5f41cd97a1b7e25e3cae2055027e26 100755 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtRawDataMonitoring/src/MdtRawDataValAlg.cxx @@ -2037,7 +2037,7 @@ StatusCode MdtRawDataValAlg::handleEvent_effCalc(const Trk::SegmentCollection* s ATH_MSG_DEBUG("no pointer to segment!!!"); break; } - if(segment->containedROTs().size() < m_nb_hits || segment->containedROTs().size() <= 0 || segment->fitQuality()->chiSquared() / segment->fitQuality()->doubleNumberDoF() > m_chi2_cut) { + if(segment->numberOfContainedROTs() < m_nb_hits || segment->numberOfContainedROTs() <= 0 || segment->fitQuality()->chiSquared() / segment->fitQuality()->doubleNumberDoF() > m_chi2_cut) { continue; } @@ -2049,11 +2049,8 @@ StatusCode MdtRawDataValAlg::handleEvent_effCalc(const Trk::SegmentCollection* s std::vector<float> ROTs_DR; std::vector<float> ROTs_DRerr; std::vector<float> ROTs_DT; - const std::vector<const Trk::RIO_OnTrack*>& rots = segment->containedROTs(); - std::vector<const Trk::RIO_OnTrack*>::const_iterator rit = rots.begin(); - std::vector<const Trk::RIO_OnTrack*>::const_iterator rit_end = rots.end(); - for( ; rit!=rit_end;++rit ) { - const Trk::RIO_OnTrack* rot = *rit; + for(unsigned int irot=0;irot<segment->numberOfContainedROTs();irot++){ + const Trk::RIO_OnTrack* rot = segment->rioOnTrack(irot); const Muon::MdtDriftCircleOnTrack* mrot = dynamic_cast<const Muon::MdtDriftCircleOnTrack*>(rot); if(mrot) { diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_maptgchits.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_maptgchits.cxx index a801840bf0a9a5dab92e693dfa5039663a954290..51617e9f21bcd6cdb68fb7b6d71cd47c9efde592 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_maptgchits.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/MdtVsTgcRawData_maptgchits.cxx @@ -62,6 +62,7 @@ MdtVsTgcRawDataValAlg::maphists(const xAOD::MuonSegmentContainer *newsegment, for(unsigned int i=0;i<segm->numberOfContainedROTs();++i){ // Get station information const Trk::RIO_OnTrack* rio = segm->rioOnTrack(i); + if(!rio) continue; Identifier id = rio->identify(); stationName = int(m_muonIdHelperTool->mdtIdHelper().stationName(id)); // Flag Segments with ROTs in the MDT & Endcap diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_MidstationMatching.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_MidstationMatching.cxx index b4ffe1d1bb4f842ff270954ec159dfc5e5ca14b2..c88223692275d44812845ee684c81ba2c43cee1c 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_MidstationMatching.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_MidstationMatching.cxx @@ -108,6 +108,7 @@ MdtVsTgcRawDataValAlg::MidstationOnlyCheck(vector<const Muon::MuonSegment*> (&so // Loop through contained ROTs and identify used stations for(unsigned int iROT=0; iROT<segm0->numberOfContainedROTs(); ++iROT) { const Trk::RIO_OnTrack* rio = segm0->rioOnTrack(iROT); + if(!rio) continue; Identifier id = rio->identify(); stationName = int(m_muonIdHelperTool->mdtIdHelper().stationName(id)); @@ -160,6 +161,7 @@ MdtVsTgcRawDataValAlg::MidstationOnlyCheck(vector<const Muon::MuonSegment*> (&so // Loop through contained ROTs and identify used stations for(unsigned int iROT=0; iROT<segm1->numberOfContainedROTs(); ++iROT){ const Trk::RIO_OnTrack* rio = segm1->rioOnTrack(iROT); + if(!rio) continue; Identifier id = rio->identify(); stationName = int(m_muonIdHelperTool->mdtIdHelper().stationName(id)); bool isStrip = m_muonIdHelperTool->tgcIdHelper().isStrip(id); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_SegmDQ.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_SegmDQ.cxx index 9c4104ce6071e339bb63528e3e6586554cbeba77..81020bb2b582e05091dfb35531d3df502b11ad4c 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_SegmDQ.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_SegmDQ.cxx @@ -81,6 +81,10 @@ MdtVsTgcRawDataValAlg::DQCheckMDTSegments(vector<const Muon::MuonSegment*> (&sor // Loop through contained ROTs and identify used stations for(unsigned int iROT=0; iROT<segm->numberOfContainedROTs(); ++iROT) { const Trk::RIO_OnTrack* rio = segm->rioOnTrack(iROT); + if(!rio){ + ATH_MSG_DEBUG("no RIO"); + continue; + } Identifier id = rio->identify(); stationName = int(m_muonIdHelperTool->mdtIdHelper().stationName(id)); int isStrip = m_muonIdHelperTool->tgcIdHelper().isStrip(id); diff --git a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_SegmSorting.cxx b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_SegmSorting.cxx index 06fc1832703fdb4530b302e47fd9fb8d6e620f07..258910db5a647cd90a9228364036afed4f89f997 100644 --- a/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_SegmSorting.cxx +++ b/MuonSpectrometer/MuonValidation/MuonDQA/MuonRawDataMonitoring/MdtVsTgcRawDataMonitoring/src/functions/MdtVsTgcRawData_SegmSorting.cxx @@ -57,6 +57,10 @@ MdtVsTgcRawDataValAlg::SortMDTSegments(const xAOD::MuonSegmentContainer *newsegm // Loop through contained ROTs and identify used stations for(unsigned int iROT=0; iROT<segm->numberOfContainedROTs(); ++iROT){ const Trk::RIO_OnTrack* rio = segm->rioOnTrack(iROT); + if(!rio){ + ATH_MSG_DEBUG("No RIO"); + continue; + } Identifier id = rio->identify(); // Identify MDT Endcap Segments diff --git a/PhysicsAnalysis/AnalysisCommon/HDF5Utils/HDF5Utils/Writer.h b/PhysicsAnalysis/AnalysisCommon/HDF5Utils/HDF5Utils/Writer.h index 18b67d998cb2734ad26e49528c6049898cffe154..2b4bdd3af56f44d670a82c85ad5606fbddebccfb 100644 --- a/PhysicsAnalysis/AnalysisCommon/HDF5Utils/HDF5Utils/Writer.h +++ b/PhysicsAnalysis/AnalysisCommon/HDF5Utils/HDF5Utils/Writer.h @@ -470,7 +470,9 @@ namespace H5Utils { // write out hsize_t n_buffer_pts = m_buffer.size() / m_consumers.size(); - assert(m_file_space.getSelectNpoints() == n_buffer_pts); + assert(m_file_space.getSelectNpoints() >= 0); + assert(static_cast<hsize_t>(m_file_space.getSelectNpoints()) + == n_buffer_pts); H5::DataSpace mem_space(1, &n_buffer_pts); m_ds.write(m_buffer.data(), m_par.type, mem_space, m_file_space); m_offset += buffer_size; diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/CMakeLists.txt b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/CMakeLists.txt index c818ad45d0eabdf353fca703f621a2c1c1e91337..0d398909f7dffa7e4c1c056402425d94546c876b 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/CMakeLists.txt +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/CMakeLists.txt @@ -15,7 +15,8 @@ atlas_depends_on_subdirs( PUBLIC Event/FourMom Event/NavFourMom Reconstruction/Particle - Tracking/TrkEvent/VxVertex ) + Tracking/TrkEvent/VxVertex + Control/CxxUtils) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) @@ -27,7 +28,7 @@ atlas_add_library( ParticleEvent PUBLIC_HEADERS ParticleEvent INCLUDE_DIRS ${Boost_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} AthContainers AthLinks Navigation AthenaKernel EventKernel FourMom NavFourMom Particle VxVertex + LINK_LIBRARIES ${Boost_LIBRARIES} AthContainers AthLinks Navigation AthenaKernel EventKernel FourMom NavFourMom Particle VxVertex CxxUtils PRIVATE_LINK_LIBRARIES ${ROOT_LIBRARIES} ) atlas_add_dictionary( ParticleEventDict diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ATLAS_CHECK_THREAD_SAFETY b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..b68d3c60e08c55dd426f6e453bd9463b8ad69abd --- /dev/null +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +PhysicsAnalysis/AnalysisCommon/ParticleEvent diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/INav4MomToTrackParticleAssocs.h b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/INav4MomToTrackParticleAssocs.h index 5b55c790018a77003571288197e9b82503c710b3..065e80733a8d9e07659d1ee2ce6ee99faa502370 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/INav4MomToTrackParticleAssocs.h +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/INav4MomToTrackParticleAssocs.h @@ -15,7 +15,7 @@ #include "AthLinks/AssociationMap.h" #include "AthLinks/DataLink.h" - +#include "AthContainers/ConstDataVector.h" // EventKernel includes #include "EventKernel/INavigable4Momentum.h" @@ -60,7 +60,7 @@ public: * to the given \param object */ bool assocs( const INavigable4Momentum* object, - Rec::TrackParticleContainer& assocs ) const; + ConstDataVector<Rec::TrackParticleContainer>& associatedElems ) const; /** Retrieve all the associated-to ElementLinks_to_objects which have * been associated to the given \param objectLink diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/Lib/Base.h b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/Lib/Base.h index 507a6148c8d2e01e6e92dae311bcfc7f56624046..0ab8b89156621c56f1850ebe41f5c20cbc7723b2 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/Lib/Base.h +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/Lib/Base.h @@ -297,8 +297,7 @@ Base::set_origin( const VxContainer* theContainer, const Trk::VxCandidate * vertex ) { m_origin = ElementLink< VxContainer > - ( const_cast<Trk::VxCandidate*> (vertex), - *theContainer ); + ((vertex),*theContainer ); } inline diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleBase.h b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleBase.h index f1b259fbc660df3d5a52a08aea120156d143ed77..f5117f28810aceaea628b647b3bd36220a7859d0 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleBase.h +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleBase.h @@ -85,7 +85,7 @@ inline void ParticleBase::set_origin(const VxContainer* const theContainer, int } inline void ParticleBase::set_origin(const VxContainer* theContainer, const Trk::VxCandidate * vertex ) { - m_origin.toContainedElement(*theContainer, const_cast<Trk::VxCandidate*> (vertex)); + m_origin.toContainedElement(*theContainer, vertex); } inline void ParticleBase::set_origin(const ElementLink<VxContainer>& origin) { diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleShallowClone.h b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleShallowClone.h index 775678b0a07a4bfe2383cccddb3b92fb60171e1b..9d81fc0cd6a4d1a1f4247a4ef08d98b2b63cf9b4 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleShallowClone.h +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleShallowClone.h @@ -411,8 +411,7 @@ void Analysis::ParticleShallowClone::set_origin( const VxContainer* theContainer const Trk::VxCandidate * vertex ) { m_originLink = ElementLink< VxContainer > - ( const_cast<Trk::VxCandidate*> (vertex), - *theContainer ); + ( vertex,*theContainer ); return; } diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleSigStateImpl.h b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleSigStateImpl.h index 3858cb2fd7b566440bb16b68642196bebda12fa6..961c005ca96443a9445f24e2e950001722893d17 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleSigStateImpl.h +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/ParticleSigStateImpl.h @@ -33,12 +33,12 @@ // ParticleEvent includes #include "ParticleEvent/Lib/Base.h" - +#include "CxxUtils/checker_macros.h" template< class INavigable_t, class I4Momentum_t, class IParticle_t = ParticleEvent::Base > -class ParticleSigStateImpl : public IParticle, public ISignalState +class ATLAS_NOT_THREAD_SAFE ParticleSigStateImpl : public IParticle, public ISignalState { /////////////////////////////////////////////////////////////////// diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/TrackParticleAssocs.h b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/TrackParticleAssocs.h index f7d6c6a969474083008afe6f0c318a22d2810ea9..ae10b32abd364026c5ae61d563a120d7446ff661 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/TrackParticleAssocs.h +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/ParticleEvent/TrackParticleAssocs.h @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // TrackParticleAssocs.h @@ -15,7 +15,8 @@ #include "AthLinks/AssociationMap.h" #include "AthLinks/DataLink.h" - +#include "AthContainers/ConstDataVector.h" + // TrackParticleIncludes #include "Particle/TrackParticleContainer.h" #include "Particle/TrackParticle.h" @@ -53,7 +54,7 @@ public: * to the given \param object */ bool assocs( const Rec::TrackParticle* object, - Rec::TrackParticleContainer& assocs ) const; + ConstDataVector<Rec::TrackParticleContainer>& associatedElems ) const; /** Reimplement the method from the base class to not shaddow it */ bool getAssociations(const AssociationMap< Rec::TrackParticleContainer, diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/src/INav4MomToTrackParticleAssocs.cxx b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/src/INav4MomToTrackParticleAssocs.cxx index 0224e29313d626c0f72184e4657c0015b8e9ba1e..d661c1036e40bcc49b4b81c146b2583f37f665be 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/src/INav4MomToTrackParticleAssocs.cxx +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/src/INav4MomToTrackParticleAssocs.cxx @@ -47,7 +47,7 @@ INav4MomToTrackParticleAssocs& INav4MomToTrackParticleAssocs::operator=(const IN /////////////////////////////////////////////////////////////////// bool INav4MomToTrackParticleAssocs::assocs( const INavigable4Momentum* object, - Rec::TrackParticleContainer& associatedElems ) const + ConstDataVector<Rec::TrackParticleContainer>& associatedElems ) const { // Make a sanity check against a null pointer if ( 0 == object ) { return false; } @@ -75,7 +75,7 @@ bool INav4MomToTrackParticleAssocs::assocs( const INavigable4Momentum* object, itr != endAssocs; ++itr ) { - associatedElems.push_back( const_cast<Rec::TrackParticle*>(*itr) ); + associatedElems.push_back(*itr); } return true; diff --git a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/src/TrackParticleAssocs.cxx b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/src/TrackParticleAssocs.cxx index c0effebcc4ffac3a4b58ef8031d73c37749e0486..c9da6ab12514bf653749e30dcb9b1e9f17de1bad 100644 --- a/PhysicsAnalysis/AnalysisCommon/ParticleEvent/src/TrackParticleAssocs.cxx +++ b/PhysicsAnalysis/AnalysisCommon/ParticleEvent/src/TrackParticleAssocs.cxx @@ -45,7 +45,7 @@ TrackParticleAssocs& TrackParticleAssocs::operator=(const TrackParticleAssocs& r /////////////////////////////////////////////////////////////////// bool TrackParticleAssocs::assocs( const Rec::TrackParticle* object, - Rec::TrackParticleContainer& associatedElems ) const + ConstDataVector<Rec::TrackParticleContainer>& associatedElems ) const { if ( 0 == object ) { return false; diff --git a/PhysicsAnalysis/AssociationBuilder/AssociationComps/src/IOverlapFilter.h b/PhysicsAnalysis/AssociationBuilder/AssociationComps/src/IOverlapFilter.h index 0f1c73540177ad0839a74a1e09ca747d97c5dec4..4b01c6a7b5e8beb47c54bcee03efe4f2f7011c63 100755 --- a/PhysicsAnalysis/AssociationBuilder/AssociationComps/src/IOverlapFilter.h +++ b/PhysicsAnalysis/AssociationBuilder/AssociationComps/src/IOverlapFilter.h @@ -11,9 +11,6 @@ #ifndef ASSOCIATIONCOMPS_IOVERLAPFILTER_H #define ASSOCIATIONCOMPS_IOVERLAPFILTER_H -// STL includes -#include <functional> - // EventKernel includes #include "EventKernel/INavigable4Momentum.h" @@ -21,12 +18,7 @@ namespace AssociationComps { -class IOverlapFilter : public std::binary_function< - const INavigable4Momentum*, - const INavigable4Momentum*, - bool - > -{ +class IOverlapFilter { /////////////////////////////////////////////////////////////////// // Public methods: diff --git a/PhysicsAnalysis/AssociationBuilder/AssociationKernel/AssociationKernel/IOverlapTool.h b/PhysicsAnalysis/AssociationBuilder/AssociationKernel/AssociationKernel/IOverlapTool.h index 2ad3fcf8591b8a168afc77ae2dd670d1d2f01fec..d6622dbd89918fed41d610fa87463959de0dc720 100755 --- a/PhysicsAnalysis/AssociationBuilder/AssociationKernel/AssociationKernel/IOverlapTool.h +++ b/PhysicsAnalysis/AssociationBuilder/AssociationKernel/AssociationKernel/IOverlapTool.h @@ -23,7 +23,6 @@ // STL includes #include <list> -#include <functional> // FrameWork includes #include "GaudiKernel/IAlgTool.h" @@ -46,17 +45,6 @@ class IOverlapTool : virtual public IAlgTool, virtual public IProperty { - /////////////////////////////////////////////////////////////////// - // Private typedefs: - /////////////////////////////////////////////////////////////////// - protected: - typedef std::binary_function<const INavigable4Momentum&, // first argument - const INavigable4Momentum&, // second argument - bool // result type - > OverlapFilter_t; - /////////////////////////////////////////////////////////////////// - // Public methods: - /////////////////////////////////////////////////////////////////// public: /** Destructor: diff --git a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx index ec03dace8a74feb2cfaf3858c842c0c31dda86dc..0cb6ef9ca20a0ab2a8200f891752da5554f6caf9 100644 --- a/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx +++ b/PhysicsAnalysis/D3PDMaker/MuonD3PDMaker/src/MuonSegmentT0FillerTool.cxx @@ -77,11 +77,10 @@ void MuonSegmentT0FillerTool::MuonboyT0CSCSegment(const Muon::MuonSegment* pMuon float Alternative_t0 = 0. ; float Alternative_t0sqr = 0. ; float Alternative_t0Error = 0. ; - const std::vector<const Trk::RIO_OnTrack*> pRIOSet = pMuonSegment->containedROTs(); - std::vector<const Trk::RIO_OnTrack*>::const_iterator pRIO_OnTrackIter = pRIOSet.begin(); - for (; pRIO_OnTrackIter!=pRIOSet.end(); ++pRIO_OnTrackIter){ - if ( (*pRIO_OnTrackIter) ){ - const Trk::PrepRawData* pPrepRawData =(*pRIO_OnTrackIter)->prepRawData () ; + for(unsigned int irot=0;irot<pMuonSegment->numberOfContainedROTs();irot++){ + const Trk::RIO_OnTrack* pRIO_OnTrack=pMuonSegment->rioOnTrack(irot); + if ( (pRIO_OnTrack) ){ + const Trk::PrepRawData* pPrepRawData =(pRIO_OnTrack)->prepRawData () ; if ( pPrepRawData ){ const Muon::CscPrepData* pPrepData = dynamic_cast<const Muon::CscPrepData*>(pPrepRawData); if ( pPrepData ){ diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/python/egammaTimeCorrConfig.py b/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/python/egammaTimeCorrConfig.py deleted file mode 100644 index fa9d632c450976650aa83be9f45fb2205e4f2c6a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/python/egammaTimeCorrConfig.py +++ /dev/null @@ -1,69 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -# $Id$ -# -# @file egammaD3PDAnalysis/python/egammaTimeCorrConfig.py -# @author Nikiforos K. Nikiforou <nikiforo@cern.ch> modified from egammaIsIsoConfig.py by scott snyder <snyder@bnl.gov> -# @date Jun, 2012 -# @brief Configure egammaTimeCorrAlg to fill UserData. -# - - -from D3PDMakerConfig.D3PDMakerFlags import D3PDMakerFlags -from D3PDMakerCoreComps.resolveSGKey import resolveSGKey -from AthenaCommon.AlgSequence import AlgSequence -import D3PDMakerCoreComps -import egammaD3PDAnalysis - - -def egammaTimeCorrConfig \ - (seq = AlgSequence(D3PDMakerFlags.PreD3PDAlgSeqName()), - prefix = '', - sgkey = D3PDMakerFlags.ElectronSGKey(), - typeName = 'DataVector<xAOD::Electron_v1>', - allowMissing = False): - """Configure egammaTimeCorrAlg for D3PD making. - - SEQ is the Gaudi sequence to which the algorithm should be added. - Default is that given by PreD3PDAlgSeqName. - - PREFIX is a prefix to add to the name of the algorithm scheduled. - - SGKEY/TYPENAME is the StoreGate key of the input electron container - and the name of its type. - - If ALLOWMISSING is true, don't fail if the SG key doesn't exist. - """ - - if (not D3PDMakerFlags.MakeEgammaUserData() or - D3PDMakerFlags.HaveEgammaUserData()): - return - - DVGetter = D3PDMakerCoreComps.SGDataVectorGetterTool - resolved_sgkey = resolveSGKey (typeName, sgkey) - auxprefix = (D3PDMakerFlags.EgammaUserDataPrefix() + '_' + - resolved_sgkey + '_') - - algName = 'egammaTimeCorrAlg' + resolved_sgkey - if not hasattr (seq, algName): - - from IOVDbSvc.CondDB import conddb - - conddb.addFolder("LAR_OFL","/LAR/TimeCorrectionOfl/NonRunCon <tag>LARTimeCorrectionOflNonRunCon-00</tag>",force=True) - conddb.addFolder("LAR_OFL","/LAR/TimeCorrectionOfl/RunCon <tag>LARTimeCorrectionOflRunCon-00</tag>",force=True) - - from CaloClusterCorrection.CaloClusterTimeTool import GetCaloClusterTimeTool - myCaloClusterTimeTool=GetCaloClusterTimeTool("caloClusterTimeTool", "/LAR/TimeCorrectionOfl/NonRunCon","/LAR/TimeCorrectionOfl/RunCon") - - seq += egammaD3PDAnalysis.egammaTimeCorrAlg \ - (algName, - Getter = DVGetter - (prefix + 'egammaTimeCorrGetter', - TypeName = typeName, - SGKey = sgkey), - AllowMissing = allowMissing, - AuxPrefix = auxprefix, - CaloClusterTimeTool = myCaloClusterTimeTool, - ) - - return diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/src/components/egammaD3PDAnalysis_entries.cxx b/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/src/components/egammaD3PDAnalysis_entries.cxx index 561f9579218815f648fe1d1fba93f928ee66c578..51a82d7f0521ce5cf3ad10f72b97010051faa418 100644 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/src/components/egammaD3PDAnalysis_entries.cxx +++ b/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/src/components/egammaD3PDAnalysis_entries.cxx @@ -11,7 +11,6 @@ #include "../egammaMaxECellAlg.h" #include "../egammaSumCellsGainAlg.h" #include "../egammaNbCellsGainAlg.h" -#include "../egammaTimeCorrAlg.h" @@ -30,5 +29,4 @@ DECLARE_COMPONENT( D3PD::PhotonTruthTool ) DECLARE_COMPONENT( D3PD::egammaMaxECellAlg ) DECLARE_COMPONENT( D3PD::egammaSumCellsGainAlg ) DECLARE_COMPONENT( D3PD::egammaNbCellsGainAlg ) -DECLARE_COMPONENT( D3PD::egammaTimeCorrAlg ) diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/src/egammaTimeCorrAlg.cxx b/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/src/egammaTimeCorrAlg.cxx deleted file mode 100644 index 1c1229217ad8b271f513d45c33f4600576a4e6cd..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/src/egammaTimeCorrAlg.cxx +++ /dev/null @@ -1,107 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: egammaTimeCorrAlg.cxx 775880 2016-09-29 15:35:25Z ssnyder $ -/** -* @file egammaD3PDAnalysis/src/egammaTimeCorrAlg.cxx -* @author Nikiforos K. Nikiforou <nikiforo@cern.ch> adapted from various tools by Scott Snyder -* @date Apr, 2012 -* @brief Calculate corrected time for an egamma object and store in UserData. -*/ - - -#include "egammaTimeCorrAlg.h" -#include "D3PDMakerInterfaces/ICollectionGetterTool.h" -#include "xAODEgamma/Egamma.h" -#include "AthenaKernel/errorcheck.h" - - -namespace D3PD { - - -egammaTimeCorrAlg::egammaTimeCorrAlg (const std::string& name, - ISvcLocator* svcloc): - AthAlgorithm (name, svcloc), - m_getter (this), - m_caloClusterTimeTool("",this) -{ - declareProperty ("AuxPrefix", m_auxPrefix, - "Prefix to add to aux data items."); - declareProperty ("AllowMissing", m_allowMissing = false, - "If true, don't complain if input objects are missing."); - declareProperty ("Getter", m_getter, - "Getter instance for the input egamma objects."); - declareProperty("VertexContainerName", m_vertexContainerName="VxPrimaryCandidate"); - declareProperty("CaloClusterTimeTool", m_caloClusterTimeTool, "a private tool for caloTime correction"); -} - - -/** -* @brief Standard Gaudi @c initialize method. -*/ -StatusCode egammaTimeCorrAlg::initialize() -{ - CHECK( AthAlgorithm::initialize() ); - CHECK( m_caloClusterTimeTool.retrieve() ); - CHECK( m_getter.retrieve() ); - CHECK( m_getter->configureD3PD<xAOD::Egamma>() ); - return StatusCode::SUCCESS; -} - - -/** -* @brief Standard Gaudi @c execute method. -*/ -StatusCode egammaTimeCorrAlg::execute() -{ - StatusCode sc = StatusCode::SUCCESS; - - float vtx_z=0.0; - - const VxContainer* vertexCont(0); - sc = evtStore()->retrieve(vertexCont,m_vertexContainerName); - if (sc.isFailure() || !vertexCont || vertexCont->size()<1) { - ATH_MSG_ERROR(" Can't retrieve VertexContainer!" ); - return sc; - } - - const Trk::VxCandidate* Vtx = *(vertexCont->begin()); - vtx_z = Vtx->recVertex().position().z(); - -#define DECOR(TYPE,N) xAOD::Egamma::Decorator<TYPE> N (m_auxPrefix + #N) - DECOR(float, raw_cl_time); - DECOR(float, corr_cl_time); - DECOR(float, corr_cl_time_err); - DECOR(unsigned int, corr_cl_time_flags); -#undef DECOR - - CHECK( m_getter->reset (m_allowMissing) ); - while (const xAOD::Egamma* eg = m_getter->next<xAOD::Egamma>()) - { - raw_cl_time(*eg) = -9898.9; - corr_cl_time(*eg) = -9898.9; - corr_cl_time_err(*eg) = 9898.9; - corr_cl_time_flags(*eg) = ~0U; - - const xAOD::CaloCluster *cluster = eg->caloCluster(); - if(cluster) { - raw_cl_time(*eg) = cluster->time(); - - if(cluster->getCellLinks() && !m_caloClusterTimeTool.empty()) { - m_caloClusterTimeTool->makeClusterTimeCorrection - (vtx_z, cluster, - corr_cl_time(*eg), - corr_cl_time_err(*eg), - corr_cl_time_flags(*eg)); - - } - } - m_getter->releaseElement (eg); - } - - return StatusCode::SUCCESS; -} - - -} // namespace D3PD diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/src/egammaTimeCorrAlg.h b/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/src/egammaTimeCorrAlg.h deleted file mode 100644 index 85379ff790da972b8cfc6451d00bd1c2620c924a..0000000000000000000000000000000000000000 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDAnalysis/src/egammaTimeCorrAlg.h +++ /dev/null @@ -1,83 +0,0 @@ -// This file's extension implies that it's C, but it's really -*- C++ -*-. - -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -// $Id: egammaTimeCorrAlg.h 604352 2014-07-01 04:52:11Z ssnyder $ -/** - * @file egammaD3PDAnalysis/src/egammaTimeCorrAlg.h - * @author Nikiforos K. Nikiforou <nikiforo@cern.ch> adapted from various tools by Scott Snyder - * @date Apr, 2012 - * @brief Calculate corrected time for an egamma object and store in UserData. - */ - - -#ifndef EGAMMAD3PDANALYSIS_EGAMMATIMECORRALG_H -#define EGAMMAD3PDANALYSIS_EGAMMATIMECORRALG_H - - -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ToolHandle.h" - -#include "VxVertex/VxContainer.h" -#include "VxVertex/RecVertex.h" - -#include "CaloInterface/ICaloClusterTimeTool.h" - -#include <vector> -#include <string> - - -namespace D3PD { - - -class ICollectionGetterTool; - - -/** - * @brief Calculate corrected time for an egamma object and store in UserData. - */ -class egammaTimeCorrAlg - : public AthAlgorithm -{ -public: - /** - * @brief Standard Gaudi algorithm constructor. - * @param name The algorithm name. - * @param svcloc The service locator. - */ - egammaTimeCorrAlg (const std::string& name, - ISvcLocator* svcloc); - - - /// Standard Gaudi @c initialize method. - virtual StatusCode initialize(); - - - /// Standard Gaudi @c execute method. - virtual StatusCode execute(); - - -private: - /// Property: Prefix to add to aux data items. - std::string m_auxPrefix; - - /// Property: Vertex container name (to correct for TOF difference). - std::string m_vertexContainerName; - - /// Property: Getter for input egamma objects. - ToolHandle<ICollectionGetterTool> m_getter; - - /// Property: If true, don't complain if input objects are missing. - bool m_allowMissing; - - /// Property: Cluster Time corrector tool - ToolHandle<ICaloClusterTimeTool> m_caloClusterTimeTool; -}; - - -} // namespace D3PD - - -#endif // not EGAMMAD3PDANALYSIS_EGAMMATIMECORRALG_H diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/ElectronD3PDObject.py b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/ElectronD3PDObject.py index bde16dc96641b38b65094ab86a6e2ed55a0edf82..70032fc0ce29104ac7b354e043f3a9f462e7a874 100644 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/ElectronD3PDObject.py +++ b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/ElectronD3PDObject.py @@ -64,18 +64,6 @@ ElectronD3PDObject.defineBlock ( D3PDMakerCoreComps.AuxDataFillerTool, Vars = ['OQ']) -defineBlockAndAlg \ - (ElectronD3PDObject, - 999, 'TimeCorr', - D3PDMakerCoreComps.AuxDataFillerTool, - 'egammaTimeCorrConfig', - AuxPrefix = auxprefix, - Vars = ['corr_cl_time #Corrected cluster time', - 'corr_cl_time_err #Corrected cluster time error', - 'corr_cl_time_flags #Time correction flags', - 'raw_cl_time #Raw cluster time', - ]) - defineBlockAndAlg \ (ElectronD3PDObject, 999, 'MaxEcell', diff --git a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/PhotonD3PDObject.py b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/PhotonD3PDObject.py index 3496221ca02d9cff304caf99c600bcd60b6547a0..7ff696c52cc4314e7ccdad478ae5ac204931efe2 100644 --- a/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/PhotonD3PDObject.py +++ b/PhysicsAnalysis/D3PDMaker/egammaD3PDMaker/python/PhotonD3PDObject.py @@ -69,17 +69,6 @@ PhotonD3PDObject.defineBlock (0, 'Conversion0', egammaD3PDMaker.egammaConversion0FillerTool, ) -defineBlockAndAlg \ - (PhotonD3PDObject, - 999, 'TimeCorr', - D3PDMakerCoreComps.AuxDataFillerTool, - 'egammaTimeCorrConfig', - AuxPrefix = auxprefix, - Vars = ['corr_cl_time #Corrected cluster time', - 'corr_cl_time_err #Corrected cluster time error', - 'corr_cl_time_flags #Time correction flags', - 'raw_cl_time #Raw cluster time', - ]) defineBlockAndAlg \ (PhotonD3PDObject, 999, 'MaxEcell', diff --git a/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithmAthenaDict.h b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithmAthenaDict.h new file mode 100644 index 0000000000000000000000000000000000000000..c2f3e6ae19ca605d4da253768ecedc0003249042 --- /dev/null +++ b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/AnaAlgorithmAthenaDict.h @@ -0,0 +1,10 @@ +#ifndef ANA_ALGORITHM__ANA_ALGORITHM_ATHENA_DICT_H +#define ANA_ALGORITHM__ANA_ALGORITHM_ATHENA_DICT_H + +#ifdef __GNUC__ +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + +#include "AnaAlgorithm/AnaAlgorithm.h" + +#endif diff --git a/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/selection_athena.xml b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/selection_athena.xml new file mode 100644 index 0000000000000000000000000000000000000000..83f35af08b32cbc2d7b2f98d58202986300f5568 --- /dev/null +++ b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/AnaAlgorithm/selection_athena.xml @@ -0,0 +1,5 @@ +<lcgdict> + + <class name="EL::AnaAlgorithm" /> + +</lcgdict> diff --git a/PhysicsAnalysis/D3PDTools/AnaAlgorithm/CMakeLists.txt b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/CMakeLists.txt index 788be60be9282d5bf8fef1043997a8a001472f8d..3a7047280e002d79b378f42158a2c947f533ae28 100644 --- a/PhysicsAnalysis/D3PDTools/AnaAlgorithm/CMakeLists.txt +++ b/PhysicsAnalysis/D3PDTools/AnaAlgorithm/CMakeLists.txt @@ -43,10 +43,17 @@ else() endif() # Dictionary for the package's types: +if( XAOD_STANDALONE ) atlas_add_dictionary( AnaAlgorithmDict AnaAlgorithm/AnaAlgorithmDict.h AnaAlgorithm/selection.xml LINK_LIBRARIES AnaAlgorithmLib ) +else() +atlas_add_dictionary( AnaAlgorithmDict + AnaAlgorithm/AnaAlgorithmAthenaDict.h + AnaAlgorithm/selection_athena.xml + LINK_LIBRARIES AnaAlgorithmLib ) +endif() # Install files from the package: if( XAOD_STANDALONE ) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM1.py index bec99c9de9f2ec1a4da3b5977871214ef93c7280..57efe7216104524c98cb1a30532851fc573c9420 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM1.py @@ -205,7 +205,7 @@ thinningTools=[] # Tracks associated with Jets from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning EGAM1JetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM1JetLCTPThinningTool", - ThinningService = "EGAM1ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", ApplyAnd = True) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM6.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM6.py index 74a5b2e3a7ecb8a600063cb76b02b4d8a89fa337..36d71eb37e8199173b20b641494e7307eb7ee6b6 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM6.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM6.py @@ -200,7 +200,7 @@ thinningTools=[] # Tracks associated with Jets from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning EGAM6JetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM6JetLCTPThinningTool", - ThinningService = "EGAM6ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", ApplyAnd = True) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM8.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM8.py index 3e8c4f05794d4c69a05a269138a35350df9bd301..30d3187ee7c8a892a3db63563cba08424621a212 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM8.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkEGamma/share/EGAM8.py @@ -134,7 +134,7 @@ thinningTools=[] # Tracks associated with Jets from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning EGAM8JetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EGAM8JetLCTPThinningTool", - ThinningService = "EGAM8ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", ApplyAnd = True) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT11.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT11.py index e49f7e13b0ba2f98c93673367530854731f78850..fbe64307b07949dc2a546baf7bc2e90d34a7ea02 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT11.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT11.py @@ -64,7 +64,7 @@ thinningTools.append(EXOT11MuonTPThinningTool) #Tracks associated with Jets from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning EXOT11AKt4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT11AKt4JetTPThinningTool", - ThinningService = "EXOT11ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", SelectionString = "AntiKt4LCTopoJets.pt > 15*GeV && abs(AntiKt4LCTopoJets.eta) < 2.8", InDetTrackParticlesKey = "InDetTrackParticles") @@ -72,7 +72,7 @@ ToolSvc += EXOT11AKt4JetTPThinningTool thinningTools.append(EXOT11AKt4JetTPThinningTool) EXOT11AKt10JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT11AKt10JetTPThinningTool", - ThinningService = "EXOT11ThinningSvc", + StreamName = streamName, JetKey = "AntiKt10LCTopoJets", SelectionString = "AntiKt10LCTopoJets.pt > 200*GeV && abs(AntiKt10LCTopoJets.eta) < 2.8", InDetTrackParticlesKey = "InDetTrackParticles") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT12.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT12.py index 8fd88f0eaef850742bbfcb36dbf9fd48005af61e..db4d778d48d0d8d5773edaa1b3edf0c6e4f2256f 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT12.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT12.py @@ -64,7 +64,7 @@ thinningTools.append(EXOT12MuonTPThinningTool) #Tracks associated with Jets from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning EXOT12AKt4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT12AKt4JetTPThinningTool", - ThinningService = "EXOT12ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", SelectionString = "AntiKt4LCTopoJets.pt > 15*GeV && abs(AntiKt4LCTopoJets.eta) < 2.8", InDetTrackParticlesKey = "InDetTrackParticles") @@ -72,7 +72,7 @@ ToolSvc += EXOT12AKt4JetTPThinningTool thinningTools.append(EXOT12AKt4JetTPThinningTool) EXOT12AKt10JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT12AKt10JetTPThinningTool", - ThinningService = "EXOT12ThinningSvc", + StreamName = streamName, JetKey = "AntiKt10LCTopoJets", SelectionString = "AntiKt10LCTopoJets.pt > 200*GeV && abs(AntiKt10LCTopoJets.eta) < 2.8", InDetTrackParticlesKey = "InDetTrackParticles") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT16.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT16.py index c338c00a4f178b30a395011b9c2464bcbcd1c84d..b23138fa945e9f2cdda2d89c262f1b15e0b28841 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT16.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT16.py @@ -198,7 +198,7 @@ thinningTools=[] # Tracks associated with jets (for e-in-jet OR) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning EXOT16JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT16JetTPThinningTool", - ThinningService = "EXOT16ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", SelectionString = "AntiKt4LCTopoJets.pt > 15*GeV && AntiKt4LCTopoJets.eta > -2.8 && AntiKt4LCTopoJets.eta < 2.8", InDetTrackParticlesKey = "InDetTrackParticles") @@ -206,7 +206,7 @@ ToolSvc += EXOT16JetTPThinningTool thinningTools.append(EXOT16JetTPThinningTool) ##EXOT16CA15JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "EXOT16CA15JetTPThinningTool", -## ThinningService = "EXOT16ThinningSvc", +## StreamName = streamName, ## JetKey = "CamKt15LCTopoJets", ## SelectionString = "CamKt15LCTopoJets.pt > 150*GeV && CamKt15LCTopoJets.eta > -2.7 && CamKt15LCTopoJets.eta < 2.7", ## InDetTrackParticlesKey = "InDetTrackParticles") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT3.py index 1255b1a88a31bb1d4c081c4de7cfa77f51ecd583..9be35ec7b4f635f964398cda81513217186cd9e0 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT3.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT3.py @@ -51,7 +51,7 @@ from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFram #ToolSvc += EXOT3MetTPThinningTool # #EXOT3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT3JetTPThinningTool", -# ThinningService = "EXOT3ThinningSvc", +# StreamName = streamName, # JetKey = "AntiKt4LCTopoJets", # InDetTrackParticlesKey = "InDetTrackParticles") #ToolSvc += EXOT3JetTPThinningTool @@ -94,7 +94,7 @@ thinningTools.append(EXOT3PhotonTPThinningTool) #Tracks associated with Jets from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning EXOT3AKt4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT3AKt4JetTPThinningTool", - ThinningService = "EXOT3ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", SelectionString = "AntiKt4LCTopoJets.pt > 15*GeV && abs(AntiKt4LCTopoJets.eta) < 2.8", InDetTrackParticlesKey = "InDetTrackParticles") @@ -102,7 +102,7 @@ ToolSvc += EXOT3AKt4JetTPThinningTool thinningTools.append(EXOT3AKt4JetTPThinningTool) EXOT3AKt10JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT3AKt10JetTPThinningTool", - ThinningService = "EXOT3ThinningSvc", + StreamName = streamName, JetKey = "AntiKt10LCTopoJets", SelectionString = "AntiKt10LCTopoJets.pt > 150*GeV && abs(AntiKt10LCTopoJets.eta) < 2.8", InDetTrackParticlesKey = "InDetTrackParticles") @@ -110,7 +110,7 @@ ToolSvc += EXOT3AKt10JetTPThinningTool thinningTools.append(EXOT3AKt10JetTPThinningTool) EXOT3AKt10JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT3Cam12JetTPThinningTool", - ThinningService = "EXOT3ThinningSvc", + StreamName = streamName, JetKey = "CamKt12LCTopoJets", SelectionString = "CamKt12LCTopoJets.pt > 150*GeV && abs(CamKt12LCTopoJets.eta) < 2.8", InDetTrackParticlesKey = "InDetTrackParticles") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT4.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT4.py index 9328121c7beeef3c8abe45f141e4fb7fa9712d6f..4f6bd57a76f2e3653c377f823ed211930f92ff07 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT4.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT4.py @@ -88,7 +88,7 @@ thinningTools=[] # Tracks associated with jets (for e-in-jet OR) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning EXOT4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT4JetTPThinningTool", - ThinningService = "EXOT4ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", SelectionString = "AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 15*GeV && AntiKt4EMTopoJets.DFCommonJets_Calib_eta > -2.8 && AntiKt4EMTopoJets.DFCommonJets_Calib_eta < 2.8", InDetTrackParticlesKey = "InDetTrackParticles") @@ -96,7 +96,7 @@ ToolSvc += EXOT4JetTPThinningTool thinningTools.append(EXOT4JetTPThinningTool) EXOT4CA15JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "EXOT4CA15JetTPThinningTool", - ThinningService = "EXOT4ThinningSvc", + StreamName = streamName, JetKey = "CamKt15LCTopoJets", SelectionString = "CamKt15LCTopoJets.pt > 150*GeV && CamKt15LCTopoJets.eta > -2.7 && CamKt15LCTopoJets.eta < 2.7", InDetTrackParticlesKey = "InDetTrackParticles") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT5.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT5.py index d018d3086579d4b5b8609bc91416f7c766897a41..077cdebe745221610bce374c3fd8997bc7ab1eaf 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT5.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT5.py @@ -83,7 +83,7 @@ thinningTools.append(EXOT5TauTPThinningTool) # Keep tracks associated with jets #EXOT5JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( #name = 'EXOT5JetTPThinningTool', - #ThinningService = EXOT5ThinningHelper.ThinningSvc(), + #StreamName = streamName, #JetKey = 'AntiKt4EMTopoJets', #InDetTrackParticlesKey = 'InDetTrackParticles', #SelectionString = 'AntiKt4EMTopoJets.pt > 20*GeV') diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT6.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT6.py index 8ce0a2359235ad03dcafcf5105e42a479f4e8aa7..9e45511dccd507d6b5d4304070c06f91fab7db45 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT6.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT6.py @@ -42,7 +42,7 @@ from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFram #ToolSvc += EXOT6MetTPThinningTool # #EXOT6JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "EXOT6JetTPThinningTool", -# ThinningService = "EXOT6ThinningSvc", +# StreamName = streamName, # JetKey = "AntiKt4LCTopoJets", # InDetTrackParticlesKey = "InDetTrackParticles") #ToolSvc += EXOT6JetTPThinningTool diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT7.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT7.py index 1dfb8aa81140515ae36614f8ba20e6273a48bd0b..58d2f329ce050a6b66ab20ed0cf33e14de8765d4 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT7.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT7.py @@ -149,7 +149,7 @@ thinningTools=[] # Tracks associated with jets (for e-in-jet OR) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning EXOT7JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "EXOT7JetTPThinningTool", - ThinningService = "EXOT7ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", SelectionString = "AntiKt4LCTopoJets.pt > 15*GeV && AntiKt4LCTopoJets.eta > -2.8 && AntiKt4LCTopoJets.eta < 2.8", InDetTrackParticlesKey = "InDetTrackParticles") @@ -158,7 +158,7 @@ thinningTools.append(EXOT7JetTPThinningTool) # for HTT EXOT7CA8JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "EXOT7CA8JetTPThinningTool", - ThinningService = "EXOT7ThinningSvc", + StreamName = streamName, JetKey = "CamKt8LCTopoJets", SelectionString = "CamKt8LCTopoJets.pt > 150*GeV && CamKt8LCTopoJets.eta > -2.7 && CamKt8LCTopoJets.eta < 2.7", InDetTrackParticlesKey = "InDetTrackParticles") @@ -166,7 +166,7 @@ ToolSvc += EXOT7CA8JetTPThinningTool thinningTools.append(EXOT7CA8JetTPThinningTool) EXOT7CA15JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "EXOT7CA15JetTPThinningTool", - ThinningService = "EXOT7ThinningSvc", + StreamName = streamName, JetKey = "CamKt15LCTopoJets", SelectionString = "CamKt15LCTopoJets.pt > 150*GeV && CamKt15LCTopoJets.eta > -2.7 && CamKt15LCTopoJets.eta < 2.7", InDetTrackParticlesKey = "InDetTrackParticles") @@ -174,7 +174,7 @@ ToolSvc += EXOT7CA15JetTPThinningTool thinningTools.append(EXOT7CA15JetTPThinningTool) EXOT7Ak10JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "EXOT7Ak10JetTPThinningTool", - ThinningService = "EXOT7ThinningSvc", + StreamName = streamName, JetKey = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", SelectionString = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt > 150*GeV && AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.eta > -2.7 && AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.eta < 2.7", InDetTrackParticlesKey = "InDetTrackParticles") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT8.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT8.py index 0e99f53fcf99f294b9fdd02aeb4e703166e06394..6c832b95d42f551ee34fbfe22896ea6d6c058082 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT8.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkExotics/share/EXOT8.py @@ -65,7 +65,7 @@ thinningTools.append(EXOT8ElectronTPThinningTool) ######################################### from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning EXOT8Ak4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "EXOT8Ak4JetTPThinningTool", - ThinningService = "EXOT8ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", SelectionString = "AntiKt4LCTopoJets.pt > 50*GeV && AntiKt4LCTopoJets.eta > -2.7 && AntiKt4LCTopoJets.eta < 2.7", InDetTrackParticlesKey = "InDetTrackParticles") @@ -76,7 +76,7 @@ thinningTools.append(EXOT8Ak4JetTPThinningTool) # Tracks associated with large-R jets (0.2) ############################################ EXOT8Ak10r2JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "EXOT8Ak10r2JetTPThinningTool", - ThinningService = "EXOT8ThinningSvc", + StreamName = streamName, JetKey = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", SelectionString = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.DFCommonJets_Calib_pt > 200*GeV && AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.DFCommonJets_Calib_eta > -2.7 && AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.DFCommonJets_Calib_eta < 2.7", InDetTrackParticlesKey = "InDetTrackParticles") diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxThinning.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxThinning.py index 8361e0fe189458fa344cbd2679e265f3c669f7d9..512b09244962001fc5d5d69c69f4e7b774e51091 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxThinning.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/python/HIGG4DxThinning.py @@ -29,7 +29,7 @@ def setup(HIGG4DxName, streamName, HIGG4DxThinningSvc, ToolSvc): #jets and tracks from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG4DxJetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = HIGG4DxName+"JetTPThinningTool", - ThinningService = HIGG4DxThinningSvc, + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", SelectionString = "AntiKt4EMTopoJets.pt > 18*GeV", InDetTrackParticlesKey = "InDetTrackParticles", @@ -38,7 +38,7 @@ def setup(HIGG4DxName, streamName, HIGG4DxThinningSvc, ToolSvc): thinningTools.append(HIGG4DxJetTPThinningTool) HIGG4DxJetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = HIGG4DxName+"JetLCTPThinningTool", - ThinningService = HIGG4DxThinningSvc, + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", SelectionString = "AntiKt4LCTopoJets.pt > 18*GeV", InDetTrackParticlesKey = "InDetTrackParticles", @@ -50,7 +50,7 @@ def setup(HIGG4DxName, streamName, HIGG4DxThinningSvc, ToolSvc): if HIGG4DxName in ['HIGG4D2', 'HIGG4D3']: from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG4DxJetTrackThinningTool1 = DerivationFramework__JetTrackParticleThinning( name = HIGG4DxName+"JetTrackThinningTool1", - ThinningService = HIGG4DxThinningSvc, + StreamName = streamName, JetKey = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", SelectionString = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt > 150*GeV", InDetTrackParticlesKey = "InDetTrackParticles", @@ -61,7 +61,7 @@ def setup(HIGG4DxName, streamName, HIGG4DxThinningSvc, ToolSvc): if HIGG4DxName in ['HIGG4D2', 'HIGG4D3']: from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG4DxJetTrackThinningTool2 = DerivationFramework__JetTrackParticleThinning( name = HIGG4DxName+"JetTrackThinningTool2", - ThinningService = HIGG4DxThinningSvc, + StreamName = streamName, JetKey = "AntiKt2PV0TrackJets", SelectionString = "AntiKt2PV0TrackJets.pt > 6*GeV", InDetTrackParticlesKey = "InDetTrackParticles", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D1.py index cc6b0c6d8c7e20b46d7a8e84f13e6a5abd8e5c5d..e5a6f2336e9ffb561435e9cf0420fedc64fcf985 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D1.py @@ -82,32 +82,23 @@ print SkimmingToolHIGG1D1 thinningTools=[] # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -HIGG1D1MetTPThinningTool = DerivationFramework__TrackParticleThinning( name = "HIGG1D1MetTPThinningTool", - ThinningService = "HIGG1D1ThinningSvc", - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += HIGG1D1MetTPThinningTool -print HIGG1D1MetTPThinningTool -#thinningTools.append(HIGG1D1MetTPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG1D1JetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG1D1JetLCTPThinningTool", - ThinningService = "HIGG1D1ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += HIGG1D1JetLCTPThinningTool print HIGG1D1JetLCTPThinningTool #thinningTools.append(HIGG1D1JetLCTPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG1D1JetEMTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG1D1JetEMTPThinningTool", - ThinningService = "HIGG1D1ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += HIGG1D1JetEMTPThinningTool print HIGG1D1JetEMTPThinningTool #thinningTools.append(HIGG1D1JetEMTPThinningTool) @@ -143,8 +134,9 @@ print HIGG1D1PhotonTPThinningTool #thinningTools.append(HIGG1D1PhotonTPThinningTool) # Tracks themselves +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning HIGG1D1TPThinningTool = DerivationFramework__TrackParticleThinning( name = "HIGG1D1TPThinningTool", - ThinningService = "HIGG1D1ThinningSvc", + StreamName = streamName, SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += HIGG1D1TPThinningTool diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D2.py index a6b60fea6e9377d2d0b9bf2591b77315814345a2..c8079eda6ee4e7ae1f91242e1a098e73fdc78f89 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D2.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG1D2.py @@ -101,32 +101,23 @@ print "HIGG1D2 skimming tool:", HIGG1D2SkimmingTool thinningTools=[] # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -HIGG1D2MetTPThinningTool = DerivationFramework__TrackParticleThinning( name = "HIGG1D2MetTPThinningTool", - ThinningService = "HIGG1D2ThinningSvc", - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += HIGG1D2MetTPThinningTool -print HIGG1D2MetTPThinningTool -#thinningTools.append(HIGG1D2MetTPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG1D2JetLCTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG1D2JetLCTPThinningTool", - ThinningService = "HIGG1D2ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += HIGG1D2JetLCTPThinningTool print HIGG1D2JetLCTPThinningTool #thinningTools.append(HIGG1D2JetLCTPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG1D2JetEMTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG1D2JetEMTPThinningTool", - ThinningService = "HIGG1D2ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += HIGG1D2JetEMTPThinningTool print HIGG1D2JetEMTPThinningTool #thinningTools.append(HIGG1D2JetEMTPThinningTool) @@ -162,8 +153,9 @@ print HIGG1D2PhotonTPThinningTool #thinningTools.append(HIGG1D2PhotonTPThinningTool) # Tracks themselves +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning HIGG1D2TPThinningTool = DerivationFramework__TrackParticleThinning( name = "HIGG1D2TPThinningTool", - ThinningService = "HIGG1D2ThinningSvc", + StreamName = streamName, SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += HIGG1D2TPThinningTool diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D1.py index 633449a78f99f703489e18c600826c11eaf24c34..791f5084f925b23837d8c94ec22292ece356578b 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D1.py @@ -36,21 +36,13 @@ HIGG2D1ThinningHelper.AppendToStream(HIGG2D1Stream) # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -HIGG2D1TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG2D1TPThinningTool", - ThinningService = HIGG2D1ThinningHelper.ThinningSvc(), - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += HIGG2D1TPThinningTool -thinningTools.append(HIGG2D1TPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG2D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D1JetTPThinningTool", - ThinningService = HIGG2D1ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += HIGG2D1JetTPThinningTool thinningTools.append(HIGG2D1JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D2.py index 519bb343b056a80b4b49e857c358ca93ef175543..2b758e461e3350d2883da3aef3b105993ba621df 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D2.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D2.py @@ -36,21 +36,13 @@ HIGG2D2ThinningHelper.AppendToStream(HIGG2D2Stream) # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -HIGG2D2TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG2D2TPThinningTool", - ThinningService = HIGG2D2ThinningHelper.ThinningSvc(), - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += HIGG2D2TPThinningTool -thinningTools.append(HIGG2D2TPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG2D2JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D2JetTPThinningTool", - ThinningService = HIGG2D2ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += HIGG2D2JetTPThinningTool thinningTools.append(HIGG2D2JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D3.py index 4d01c146ee5cb8d50af341332646b6f12097b7b8..49860fbc2a0d8e06abb63d53da3b230ec48d9c8d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D3.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D3.py @@ -36,21 +36,13 @@ HIGG2D3ThinningHelper.AppendToStream(HIGG2D3Stream) # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -HIGG2D3TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG2D3TPThinningTool", - ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += HIGG2D3TPThinningTool -thinningTools.append(HIGG2D3TPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG2D3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D3JetTPThinningTool", - ThinningService = HIGG2D3ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += HIGG2D3JetTPThinningTool thinningTools.append(HIGG2D3JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D4.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D4.py index b7fb060b9133b15b9cf370100f1d66dc641ff1ba..6b70cd7b360a5c8e86c041b7205a8ad4431d64a7 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D4.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D4.py @@ -38,7 +38,7 @@ HIGG2D4ThinningHelper.AppendToStream(HIGG2D4Stream) # thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" # from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning # HIGG2D4TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG2D4TPThinningTool", -# ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), +# StreamName = streamName, # SelectionString = thinning_expression, # InDetTrackParticlesKey = "InDetTrackParticles", # ApplyAnd = True) @@ -48,14 +48,14 @@ HIGG2D4ThinningHelper.AppendToStream(HIGG2D4Stream) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG2D4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D4JetTPThinningTool", - ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += HIGG2D4JetTPThinningTool thinningTools.append(HIGG2D4JetTPThinningTool) HIGG2D4JetTPThinningTool2 = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D4JetTPThinningTool2", - ThinningService = HIGG2D4ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += HIGG2D4JetTPThinningTool2 diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D5.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D5.py index 3c475645b20bf25e4ddcbff1aece130817b0a511..94054189ea1f41b7e3664078f392667d622113fb 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D5.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG2D5.py @@ -194,21 +194,13 @@ HIGG2D5ThinningHelper.AppendToStream(HIGG2D5Stream) # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -HIGG2D5TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG2D5TPThinningTool", - ThinningService = HIGG2D5ThinningHelper.ThinningSvc(), - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += HIGG2D5TPThinningTool -thinningTools.append(HIGG2D5TPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG2D5JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG2D5JetTPThinningTool", - ThinningService = HIGG2D5ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += HIGG2D5JetTPThinningTool thinningTools.append(HIGG2D5JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D1.py index 02912bed3db0337b04d852acf76c50b0e4245ff3..1ec0b99a02905fa3257cca0c633c08d04502ae74 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D1.py @@ -35,21 +35,13 @@ thinningTools=[] # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -HIGG3D1MetTPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG3D1MetTPThinningTool", - ThinningService = HIGG3D1ThinningHelper.ThinningSvc(), - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += HIGG3D1MetTPThinningTool -thinningTools.append(HIGG3D1MetTPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG3D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG3D1JetTPThinningTool", - ThinningService = HIGG3D1ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += HIGG3D1JetTPThinningTool thinningTools.append(HIGG3D1JetTPThinningTool) @@ -73,6 +65,7 @@ ToolSvc += HIGG3D1ElectronTPThinningTool thinningTools.append(HIGG3D1ElectronTPThinningTool) # Tracks themselves +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning HIGG3D1TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG3D1TPThinningTool", ThinningService = HIGG3D1ThinningHelper.ThinningSvc(), SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D3.py index a612b41ad973adb5dcf1c829f869d2cd05e36cde..a53a3dd2487bec370c69da626ed5e2e4be96ecaf 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D3.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG3D3.py @@ -98,10 +98,9 @@ thinningTools=[] # MET/Jet tracks from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG3D3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG3D3JetTPThinningTool", - ThinningService = HIGG3D3ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += HIGG3D3JetTPThinningTool thinningTools.append(HIGG3D3JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D1.py index a12c6843f6512af78f4ce6c7b6171c3f91f500b8..dd74212d2878093f01e3a8bdb06d5ca0b08ed193 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D1.py @@ -73,7 +73,7 @@ if globalflags.DataSource()=='geant4': from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG5D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG5D1JetTPThinningTool", - ThinningService = HIGG5D1ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += HIGG5D1JetTPThinningTool diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D2.py index 458878c747745c16574627e13b78ba99cbb2a480..edc8785d1c581c8f3c6a050d36da93a9ea9e2daf 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D2.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D2.py @@ -73,7 +73,7 @@ if globalflags.DataSource()=='geant4': from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG5D2JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG5D2JetTPThinningTool", - ThinningService = HIGG5D2ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += HIGG5D2JetTPThinningTool diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D3.py index 01627ac9cacfa5c0d402b19c4adc6bec8e6a8515..03d298f724db7d4b7593782d0773550299b66e90 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D3.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG5D3.py @@ -62,10 +62,9 @@ if (is_MC) : # MET/Jet tracks from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG5D3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG5D3JetTPThinningTool", - ThinningService = HIGG5D3ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += HIGG5D3JetTPThinningTool thinningTools.append(HIGG5D3JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D1.py index db44f33818851ad766e10d3f50bd98a97abf8ba9..9413e9f57ba4597d6206250a5d88e74659bfc144 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D1.py @@ -150,25 +150,16 @@ thinningTools=[] # GenericTrackParticleThinning #==================================================================== thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -HIGG6D1GenTPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG6D1GenTPThinningTool", - ThinningService = "HIGG6D1ThinningSvc", - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -thinningTools.append(HIGG6D1GenTPThinningTool) -ToolSvc += HIGG6D1GenTPThinningTool - #==================================================================== # JetTrackParticleThinning #==================================================================== from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG6D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG6D1JetTPThinningTool", - ThinningService = "HIGG6D1ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) thinningTools.append(HIGG6D1JetTPThinningTool) @@ -219,6 +210,7 @@ ToolSvc += HIGG6D1ElectronTPThinningTool #==================================================================== # Tracks themselves #==================================================================== +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning HIGG6D1TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG6D1TPThinningTool", ThinningService = "HIGG6D1ThinningSvc", SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D2.py index e26532eca39188fa2a2e45ef176d88add364b163..28c5cbaa561b591ef30528d308aa68ca886e890d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D2.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG6D2.py @@ -148,24 +148,17 @@ thinningTools=[] # GenericTrackParticleThinning #==================================================================== thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -HIGG6D2GenTPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG6D2GenTPThinningTool", - ThinningService = "HIGG6D2ThinningSvc", - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -thinningTools.append(HIGG6D2GenTPThinningTool) -ToolSvc += HIGG6D2GenTPThinningTool + #==================================================================== # JetTrackParticleThinning #==================================================================== from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG6D2JetTPThinningTool = DerivationFramework__JetTrackParticleThinning(name = "HIGG6D2JetTPThinningTool", - ThinningService = "HIGG6D2ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) thinningTools.append(HIGG6D2JetTPThinningTool) @@ -217,6 +210,7 @@ ToolSvc += HIGG6D2ElectronTPThinningTool #==================================================================== # Tracks themselves #==================================================================== +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning HIGG6D2TPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG6D2TPThinningTool", ThinningService = "HIGG6D2ThinningSvc", SelectionString = "abs( DFCommonInDetTrackZ0AtPV * sin(InDetTrackParticles.theta)) < 3.0", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG8D1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG8D1.py index b8814f4551bc59c45623d863ade198602ad90986..79d2d8ba590e814caf4adb2d6293521f904e39c0 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG8D1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkHiggs/share/HIGG8D1.py @@ -84,22 +84,14 @@ HIGG8D1ThinningHelper.AppendToStream( HIGG8D1Stream ) # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -HIGG8D1MetTPThinningTool = DerivationFramework__TrackParticleThinning(name = "HIGG8D1MetTPThinningTool", - ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), #"HIGG8D1ThinningSvc - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += HIGG8D1MetTPThinningTool -thinningTools.append(HIGG8D1MetTPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning HIGG8D1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "HIGG8D1JetTPThinningTool", - ThinningService = HIGG8D1ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += HIGG8D1JetTPThinningTool thinningTools.append(HIGG8D1JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/JetTrackParticleThinning.h b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/JetTrackParticleThinning.h index 0a0226a5c983d6632995b78c784d5055040e95ff..ec4b428acca0af95f7236d574fbbc154af2e1443 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/JetTrackParticleThinning.h +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/DerivationFrameworkInDet/JetTrackParticleThinning.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -10,33 +10,41 @@ #define DERIVATIONFRAMEWORK_JETTRACKPARTICLETHINNING_H #include <string> +#include <atomic> #include "AthenaBaseComps/AthAlgTool.h" #include "DerivationFrameworkInterfaces/IThinningTool.h" #include "GaudiKernel/ToolHandle.h" +#include "xAODTracking/TrackParticleContainer.h" +#include "StoreGate/ThinningHandleKey.h" namespace ExpressionParsing { class ExpressionParser; } -class IThinningSvc; - namespace DerivationFramework { - class JetTrackParticleThinning : public AthAlgTool, public IThinningTool { + class JetTrackParticleThinning : public extends<AthAlgTool, IThinningTool> { public: JetTrackParticleThinning(const std::string& t, const std::string& n, const IInterface* p); - ~JetTrackParticleThinning(); - StatusCode initialize(); - StatusCode finalize(); - virtual StatusCode doThinning() const; + virtual ~JetTrackParticleThinning(); + virtual StatusCode initialize() override; + virtual StatusCode finalize() override; + virtual StatusCode doThinning() const override; private: - ServiceHandle<IThinningSvc> m_thinningSvc; - mutable unsigned int m_ntot, m_npass; - std::string m_jetSGKey, m_inDetSGKey, m_selectionString; - bool m_and; - ExpressionParsing::ExpressionParser *m_parser; + mutable std::atomic<unsigned int> m_ntot, m_npass; + std::string m_jetSGKey; + StringProperty m_streamName + { this, "StreamName", "", "Name of the stream being thinned" }; + SG::ThinningHandleKey<xAOD::TrackParticleContainer> m_inDetSGKey + { this, "InDetTrackParticlesKey", "InDetTrackParticles", "" }; + StringProperty m_selectionString + { this, "SelectionString", "", "" }; + StringProperty m_trackSelectionString + { this, "TrackSelectionString", "", "" }; + std::unique_ptr<ExpressionParsing::ExpressionParser> m_parser; + std::unique_ptr<ExpressionParsing::ExpressionParser> m_trackParser; }; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/JetTrackParticleThinning.cxx b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/JetTrackParticleThinning.cxx index aae2743c9ea85c8503876f3f4aefdb470f524132..d04b0fe7788732511a641e554200ce57cdd4968c 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/JetTrackParticleThinning.cxx +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkInDet/src/JetTrackParticleThinning.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ///////////////////////////////////////////////////////////////// @@ -10,13 +10,14 @@ // which removes all ID tracks which do not pass a user-defined cut #include "DerivationFrameworkInDet/JetTrackParticleThinning.h" -#include "AthenaKernel/IThinningSvc.h" #include "ExpressionEvaluation/ExpressionParser.h" #include "ExpressionEvaluation/SGxAODProxyLoader.h" #include "ExpressionEvaluation/SGNTUPProxyLoader.h" #include "ExpressionEvaluation/MultipleProxyLoader.h" #include "xAODJet/JetContainer.h" #include "xAODTracking/TrackParticleContainer.h" +#include "StoreGate/ThinningHandle.h" +#include "GaudiKernel/ThreadLocalContext.h" #include <vector> #include <string> @@ -24,22 +25,12 @@ DerivationFramework::JetTrackParticleThinning::JetTrackParticleThinning(const std::string& t, const std::string& n, const IInterface* p ) : -AthAlgTool(t,n,p), -m_thinningSvc("ThinningSvc",n), +base_class(t,n,p), m_ntot(0), m_npass(0), -m_jetSGKey(""), -m_inDetSGKey("InDetTrackParticles"), -m_selectionString(""), -m_and(false), -m_parser(0) +m_jetSGKey("") { - declareInterface<DerivationFramework::IThinningTool>(this); - declareProperty("ThinningService", m_thinningSvc); declareProperty("JetKey", m_jetSGKey); - declareProperty("InDetTrackParticlesKey", m_inDetSGKey); - declareProperty("SelectionString", m_selectionString); - declareProperty("ApplyAnd", m_and); } // Destructor @@ -51,10 +42,8 @@ StatusCode DerivationFramework::JetTrackParticleThinning::initialize() { // Decide which collections need to be checked for ID TrackParticles ATH_MSG_VERBOSE("initialize() ..."); - if (m_inDetSGKey=="") { - ATH_MSG_FATAL("No inner detector track collection provided for thinning."); - return StatusCode::FAILURE; - } else {ATH_MSG_INFO("Using " << m_inDetSGKey << "as the source collection for inner detector track particles");} + ATH_CHECK( m_inDetSGKey.initialize (m_streamName) ); + ATH_MSG_INFO("Using " << m_inDetSGKey << "as the source collection for inner detector track particles"); if (m_jetSGKey=="") { ATH_MSG_FATAL("No jet collection provided for thinning."); return StatusCode::FAILURE; @@ -65,9 +54,17 @@ StatusCode DerivationFramework::JetTrackParticleThinning::initialize() ExpressionParsing::MultipleProxyLoader *proxyLoaders = new ExpressionParsing::MultipleProxyLoader(); proxyLoaders->push_back(new ExpressionParsing::SGxAODProxyLoader(evtStore())); proxyLoaders->push_back(new ExpressionParsing::SGNTUPProxyLoader(evtStore())); - m_parser = new ExpressionParsing::ExpressionParser(proxyLoaders); + m_parser = std::make_unique<ExpressionParsing::ExpressionParser>(proxyLoaders); m_parser->loadExpression(m_selectionString); } + + if (m_trackSelectionString!="") { + ExpressionParsing::MultipleProxyLoader *proxyLoaders = new ExpressionParsing::MultipleProxyLoader(); + proxyLoaders->push_back(new ExpressionParsing::SGxAODProxyLoader(evtStore())); + proxyLoaders->push_back(new ExpressionParsing::SGNTUPProxyLoader(evtStore())); + m_trackParser = std::make_unique<ExpressionParsing::ExpressionParser>(proxyLoaders); + m_trackParser->loadExpression(m_trackSelectionString); + } return StatusCode::SUCCESS; } @@ -75,23 +72,17 @@ StatusCode DerivationFramework::JetTrackParticleThinning::finalize() { ATH_MSG_VERBOSE("finalize() ..."); ATH_MSG_INFO("Processed "<< m_ntot <<" tracks, "<< m_npass<< " were retained "); - if (m_selectionString!="") { - delete m_parser; - m_parser = 0; - } return StatusCode::SUCCESS; } // The thinning itself StatusCode DerivationFramework::JetTrackParticleThinning::doThinning() const { + const EventContext& ctx = Gaudi::Hive::currentContext(); // Retrieve main TrackParticle collection - const xAOD::TrackParticleContainer* importedTrackParticles; - if (evtStore()->retrieve(importedTrackParticles,m_inDetSGKey).isFailure()) { - ATH_MSG_ERROR("No TrackParticle collection with name " << m_inDetSGKey << " found in StoreGate!"); - return StatusCode::FAILURE; - } + SG::ThinningHandle<xAOD::TrackParticleContainer> importedTrackParticles + (m_inDetSGKey, ctx); // Check the event contains tracks unsigned int nTracks = importedTrackParticles->size(); @@ -153,6 +144,22 @@ StatusCode DerivationFramework::JetTrackParticleThinning::doThinning() const } } } + + // Apply a track selection string. + if (m_trackParser) { + std::vector<int> entries = m_trackParser->evaluateAsVector(); + unsigned int nEntries = entries.size(); + // check the sizes are compatible + if (nTracks != nEntries ) { + ATH_MSG_ERROR("Sizes incompatible! Are you sure your track selection string used tracks??"); + return StatusCode::FAILURE; + } else { + // identify which jets to keep for the thinning check + for (unsigned int i=0; i<nEntries; ++i) { + if (!entries[i]) mask[i] = false; + } + } + } // Count up the mask contents for (unsigned int i=0; i<nTracks; ++i) { @@ -160,18 +167,7 @@ StatusCode DerivationFramework::JetTrackParticleThinning::doThinning() const } // Execute the thinning service based on the mask. Finish. - if (m_and) { - if (m_thinningSvc->filter(*importedTrackParticles, mask, IThinningSvc::Operator::And).isFailure()) { - ATH_MSG_ERROR("Application of thinning service failed! "); - return StatusCode::FAILURE; - } - } - if (!m_and) { - if (m_thinningSvc->filter(*importedTrackParticles, mask, IThinningSvc::Operator::Or).isFailure()) { - ATH_MSG_ERROR("Application of thinning service failed! "); - return StatusCode::FAILURE; - } - } + importedTrackParticles.keep (mask); return StatusCode::SUCCESS; } diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM6.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM6.py index 567e778c04056ecf925e49cb26d8e36e21934602..f1d39c442b8d6f80c46c4a30a00645bdb05f3f7d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM6.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkJetEtMiss/share/JETM6.py @@ -78,36 +78,29 @@ ToolSvc += JETM6OfflineSkimmingTool thinningTools = [] # thinning_expression = "InDetTrackParticles.pt > 0.5*GeV" -# from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -# JETM6TPThinningTool = DerivationFramework__TrackParticleThinning( name = "JETM6ThinningTool", -# ThinningService = "JETM6ThinningSvc", -# SelectionString = thinning_expression, -# InDetTrackParticlesKey = "InDetTrackParticles") # from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning # JETM6JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "JETM6Akt4JetTPThinningTool", -# ThinningService = "JETM6ThinningSvc", +# StreamName = streamName, # JetKey = "AntiKt4EMTopoJets", # InDetTrackParticlesKey = "InDetTrackParticles", -# ApplyAnd = True) +# TrackSelectionString = thinning_expression) # ToolSvc += JETM6JetTPThinningTool # thinningTools.append(JETM6JetTPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning JETM6Akt4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "JETM6Akt4JetTPThinningTool", - ThinningService = "JETM6ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = False) + InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += JETM6Akt4JetTPThinningTool thinningTools.append(JETM6Akt4JetTPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning JETM6Akt10JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "JETM6Akt10JetTPThinningTool", - ThinningService = "JETM6ThinningSvc", + StreamName = streamName, JetKey = "AntiKt10LCTopoJets", - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = False) + InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += JETM6Akt10JetTPThinningTool thinningTools.append(JETM6Akt10JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM2.py index 989f078b64f8c3ffe8209aba1fa3690c8b078606..f75c11b3770c661cea75d91dc60e79f66550ca89 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM2.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM2.py @@ -73,11 +73,10 @@ ToolSvc += STDM2TPThinningTool # Tracks associated with Jets from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning STDM2JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "STDM2JetTPThinningTool", - ThinningService = "STDM2ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - SelectionString = "AntiKt4LCTopoJets.pt > 15*GeV", - ApplyAnd = False) + SelectionString = "AntiKt4LCTopoJets.pt > 15*GeV") ToolSvc += STDM2JetTPThinningTool # All Track within a cone DeltaR=0.6 around Electrons diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM3.py index 8a21894c8f385348499afa8ff4b93b9dbc34fa79..e192446a4a68df1d23585b3e4a91fae7bf831278 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM3.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM3.py @@ -51,11 +51,10 @@ STDM3ThinningHelper.AppendToStream( STDM3Stream ) # Tracks associated with Jets from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning STDM3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "STDM3JetTPThinningTool", - ThinningService = STDM3ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", # SelectionString = "AntiKt4EMTopoJets.pt > 10*GeV", - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += STDM3JetTPThinningTool thinningTools.append(STDM3JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM4.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM4.py index 506fdf225d9cac5e2459a1c0202c6d77f07ece60..fc936d870edf15d2490f7a154cddefb2dffe476f 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM4.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM4.py @@ -48,11 +48,10 @@ STDM4ThinningHelper.AppendToStream( STDM4Stream ) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning STDM4JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "STDM4JetTPThinningTool", - ThinningService = STDM4ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", SelectionString = "AntiKt4EMTopoJets.pt > 10*GeV", - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += STDM4JetTPThinningTool thinningTools.append(STDM4JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM5.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM5.py index 35248ec1b7b4c12bc78cb510f5fca156bff66c8a..7fb3a922335f74c7f4e7f9f0c6535d5ee98c3894 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM5.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSM/share/STDM5.py @@ -48,11 +48,10 @@ STDM5ThinningHelper.AppendToStream( STDM5Stream ) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning STDM5JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "STDM5JetTPThinningTool", - ThinningService = STDM5ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", SelectionString = "AntiKt4EMTopoJets.pt > 15*GeV", - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + InDetTrackParticlesKey = "InDetTrackParticles") ToolSvc += STDM5JetTPThinningTool diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY5.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY5.py index eedb0fe9fe2bb3ebb86b1081d972ae682bd66e69..85862f3324c9a4b0da7397b035fab9f7d96c66b3 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY5.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY5.py @@ -49,25 +49,18 @@ SUSY5ThinningHelper.AppendToStream( SUSY5Stream ) # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -SUSY5MetTPThinningTool = DerivationFramework__TrackParticleThinning( name = "SUSY5MetTPThinningTool", - ThinningService = SUSY5ThinningHelper.ThinningSvc(), - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += SUSY5MetTPThinningTool -thinningTools.append(SUSY5MetTPThinningTool) from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning SUSY5JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "SUSY5JetTPThinningTool", - ThinningService = SUSY5ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += SUSY5JetTPThinningTool thinningTools.append(SUSY5JetTPThinningTool) # TrackParticles directly +from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning SUSY5TPThinningTool = DerivationFramework__TrackParticleThinning(name = "SUSY5TPThinningTool", ThinningService = SUSY5ThinningHelper.ThinningSvc(), SelectionString = "InDetTrackParticles.pt > 10*GeV", diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY8.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY8.py index e73296e9141c562f4ff6ba8e8f2b3e0beb7985af..e2c2a93a6a5094176d2c46a8f315775233ed921a 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY8.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkSUSY/share/SUSY8.py @@ -62,22 +62,14 @@ ToolSvc += SUSY8SkimmingTool #====================================================================\ thinning_expression = "(InDetTrackParticles.pt > 10.0*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (abs(DFCommonInDetTrackZ0AtPV) < 10.0)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -SUSY8MetTPThinningTool = DerivationFramework__TrackParticleThinning( name = "SUSY8MetTPThinningTool", - ThinningService = SUSY8ThinningHelper.ThinningSvc(), - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += SUSY8MetTPThinningTool -thinningTools.append(SUSY8MetTPThinningTool) # TrackParticles associated with jets from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning SUSY8JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "SUSY8JetTPThinningTool", - ThinningService = SUSY8ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += SUSY8JetTPThinningTool thinningTools.append(SUSY8JetTPThinningTool) diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP1.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP1.py index 3c999ca95db19bffa3bcca52609bb4c2af1e28aa..ecf672d06cd109d6dc2351be68dfebbed56c6d05 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP1.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP1.py @@ -32,22 +32,14 @@ TAUP1ThinningHelper.AppendToStream( TAUP1Stream ) # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -TAUP1MetTPThinningTool = DerivationFramework__TrackParticleThinning( - name = "TAUP1MetTPThinningTool", - ThinningService = TAUP1ThinningHelper.ThinningSvc(), - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += TAUP1MetTPThinningTool from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning TAUP1JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "TAUP1JetTPThinningTool", - ThinningService = TAUP1ThinningHelper.ThinningSvc(), + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += TAUP1JetTPThinningTool from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP2.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP2.py index 3987cbabf31fee5e6db84f0309ad2bb6f56925de..e6b1ae4daa72d67fc71cf402d6759374baea5934 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP2.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP2.py @@ -32,22 +32,14 @@ TAUP2Stream.AcceptAlgs(["TAUP2Kernel"]) # # # MET/Jet tracks # thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -# from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -# TAUP2MetTPThinningTool = DerivationFramework__TrackParticleThinning( -# name = "TAUP2MetTPThinningTool", -# ThinningService = TAUP2ThinningHelper.ThinningSvc(), -# SelectionString = thinning_expression, -# InDetTrackParticlesKey = "InDetTrackParticles", -# ApplyAnd = True) -# ToolSvc += TAUP2MetTPThinningTool # # from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning # TAUP2JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( # name = "TAUP2JetTPThinningTool", -# ThinningService = TAUP2ThinningHelper.ThinningSvc(), +# StreamName = streamName, # JetKey = "AntiKt4LCTopoJets", # InDetTrackParticlesKey = "InDetTrackParticles", -# ApplyAnd = True) +# TrackSelectionString = thinning_expression) # ToolSvc += TAUP2JetTPThinningTool # # # Tracks associated with electrons diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP3.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP3.py index 26f94eb119f0dea171cdd49e7e1bd844038e097d..d91d9b93e76ad3fda455d921a741bc0b51290aff 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP3.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTau/share/TAUP3.py @@ -36,22 +36,14 @@ svcMgr += createThinningSvc( # ========================================================================================================================== # MET/Jet tracks thinning_expression = "(InDetTrackParticles.pt > 0.5*GeV) && (InDetTrackParticles.numberOfPixelHits > 0) && (InDetTrackParticles.numberOfSCTHits > 5) && (abs(DFCommonInDetTrackZ0AtPV) < 1.5)" -from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__TrackParticleThinning -TAUP3MetTPThinningTool = DerivationFramework__TrackParticleThinning( - name = "TAUP3MetTPThinningTool", - ThinningService = "TAUP3ThinningSvc", - SelectionString = thinning_expression, - InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) -ToolSvc += TAUP3MetTPThinningTool from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning TAUP3JetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = "TAUP3JetTPThinningTool", - ThinningService = "TAUP3ThinningSvc", + StreamName = streamName, JetKey = "AntiKt4LCTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - ApplyAnd = True) + TrackSelectionString = thinning_expression) ToolSvc += TAUP3JetTPThinningTool from DerivationFrameworkCalo.DerivationFrameworkCaloConf import DerivationFramework__CaloClusterThinning diff --git a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/python/TOPQCommonThinning.py b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/python/TOPQCommonThinning.py index b97dfba33bdd7f99912f1ef8cdc19fd83d71b3e2..0fade4736df1629448066ffe4415a9e7eaab486d 100644 --- a/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/python/TOPQCommonThinning.py +++ b/PhysicsAnalysis/DerivationFramework/DerivationFrameworkTop/python/TOPQCommonThinning.py @@ -72,11 +72,10 @@ def setup(TOPQname, streamName, TOPQThinningSvc, ToolSvc): from DerivationFrameworkInDet.DerivationFrameworkInDetConf import DerivationFramework__JetTrackParticleThinning TOPQJetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = TOPQname + "JetTPThinningTool", - ThinningService = TOPQThinningSvc, + StreamName = streamName, JetKey = "AntiKt4EMTopoJets", InDetTrackParticlesKey = "InDetTrackParticles", - SelectionString = "(AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 20*GeV)", - ApplyAnd = False) + SelectionString = "(AntiKt4EMTopoJets.DFCommonJets_Calib_pt > 20*GeV)") ToolSvc += TOPQJetTPThinningTool thinningTools.append(TOPQJetTPThinningTool) @@ -97,11 +96,10 @@ def setup(TOPQname, streamName, TOPQThinningSvc, ToolSvc): TOPQLargeJetTPThinningTool = DerivationFramework__JetTrackParticleThinning( name = TOPQname + "LargeJetTPThinningTool", - ThinningService = TOPQThinningSvc, + StreamName = streamName, JetKey = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets", InDetTrackParticlesKey = "InDetTrackParticles", - SelectionString = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt>25*GeV", - ApplyAnd = False) + SelectionString = "AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets.pt>25*GeV") ToolSvc += TOPQLargeJetTPThinningTool thinningTools.append(TOPQLargeJetTPThinningTool) diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/CMakeLists.txt b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/CMakeLists.txt index 1e4ec5abe1f4e1beb359128c3675869375232f88..c2f3a743292e4d9e2554a909f27cda5b4fb69693 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/CMakeLists.txt +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/CMakeLists.txt @@ -41,6 +41,8 @@ atlas_add_library( FlavorTagDiscriminants Root/DL2Tool.cxx Root/customGetter.cxx Root/FlipTagEnums.cxx + Root/HbbTag.cxx + Root/HbbGraphConfig.cxx INCLUDE_DIRS ${LWTNN_INCLUDE_DIRS} PUBLIC_HEADERS FlavorTagDiscriminants LINK_LIBRARIES AsgTools xAODBase xAODJet xAODMuon xAODEventInfo PathResolver diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbConstants.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbConstants.h new file mode 100644 index 0000000000000000000000000000000000000000..86f510191884b273674e72182d7e865f07eaffa8 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbConstants.h @@ -0,0 +1,23 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// Note: please don't include any ROOT in here (i.e. xAOD::Jet or +// anything from the EDM), it's not a stable dependency (in particular +// the TString overloads change between releases). + +#ifndef HBB_CONSTANTS_H +#define HBB_CONSTANTS_H + +namespace FlavorTagDiscriminants { + + namespace hbb_key { + // these must be specified correctly in the neural network inputs + const std::string pt = "pt"; // should be in MeV + const std::string eta = "eta"; + const std::string subjet = "subjet"; + const std::string fatjet = "fatjet"; + } +} + +#endif diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbGraphConfig.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbGraphConfig.h new file mode 100644 index 0000000000000000000000000000000000000000..e6adb68f30cb44dad809b22ba9a12254fceea08f --- /dev/null +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbGraphConfig.h @@ -0,0 +1,34 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// Note: please don't include any ROOT in here (i.e. xAOD::Jet or +// anything from the EDM), it's not a stable dependency (in particular +// the TString overloads change between releases). + +#ifndef HBB_CONFIG_H +#define HBB_CONFIG_H + +#include <set> +#include <map> +#include <string> + +namespace lwt { + class GraphConfig; +} + +namespace FlavorTagDiscriminants { + + struct HbbGraphConfig + { + std::set<std::string> subjet; + std::set<std::string> fatjet; + int n_subjets; + std::map<std::string, std::map<std::string,double>> defaults; + }; + HbbGraphConfig getHbbGraphConfig(const lwt::GraphConfig& cfg); + +} + +#endif + diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbTag.h b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbTag.h new file mode 100644 index 0000000000000000000000000000000000000000..cfbcc57cea0a29c36d25e90893a96e7599dfbda3 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/FlavorTagDiscriminants/HbbTag.h @@ -0,0 +1,58 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef HBB_TAG_H +#define HBB_TAG_H + +namespace lwt { + class LightweightGraph; +} + +#include "xAODJet/JetContainer.h" + +#include <functional> +#include <memory> +#include <map> + +namespace FlavorTagDiscriminants { + + struct HbbTagConfig + { + std::string input_file_path; + std::string subjet_link_name; + double min_subjet_pt = 7e3; + }; + + class HbbTag + { + public: + HbbTag(const HbbTagConfig& config); + void decorate(const xAOD::Jet& jet) const; + + private: + // reading stuff + using JetLink = ElementLink<xAOD::JetContainer>; + SG::AuxElement::ConstAccessor<JetLink> m_parent_link; + using PartLink = std::vector<ElementLink<xAOD::IParticleContainer>>; + SG::AuxElement::ConstAccessor<PartLink> m_subjet_link_getter; + using Pg = std::function<std::pair<std::string, double>(const xAOD::Jet&)>; + std::vector<Pg> m_fat_jet_getters; + std::vector<Pg> m_subjet_getters; + size_t m_n_subjets; + double m_min_subjet_pt; + + // calculating stuff + std::unique_ptr<lwt::LightweightGraph> m_graph; + std::map<std::string, std::map<std::string,double>> m_defaults; + + // writeing stuff + template <typename T> + using Decorator = SG::AuxElement::Decorator<T>; + using NodeWriter = std::vector<std::pair<std::string, Decorator<float>>>; + std::vector<std::pair<std::string, NodeWriter>> m_outputs; + }; + +} + +#endif diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/README.md b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/README.md index 345507c8c01127b6c1e328ec8b3a6d0b76088462..ebd50b7534b0f6870d67c8f5712b7646d1ee9920 100644 --- a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/README.md +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/README.md @@ -53,6 +53,16 @@ There are several user-level tools here: - `FLIP_SIGN`: Save all IP, flip sign of z0 and d0. Use Flip/Neg versions of other taggers (as above). + +### Hbb Tagging ### + +Some components of Hbb tagging also live here. These include: + + - `HbbTag`: Similar to DL2, but for large-R jets. Uses high-level + flavor tagging inputs. It also uses `HbbGraphConfig` and + `HbbConstants`. + + ### Other Files ### There are also several tools that you _probably_ don't have to touch: diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbGraphConfig.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbGraphConfig.cxx new file mode 100644 index 0000000000000000000000000000000000000000..a45e8c3255c6566eb94f1b9b0cdfd653a81184ca --- /dev/null +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbGraphConfig.cxx @@ -0,0 +1,68 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// Note: please don't include any ROOT in here (i.e. xAOD::Jet or +// anything from the EDM), it's not a stable dependency (in particular +// the TString overloads change between releases). + +#include "FlavorTagDiscriminants/HbbGraphConfig.h" +#include "FlavorTagDiscriminants/HbbConstants.h" + +#include "lwtnn/lightweight_network_config.hh" + +#include <regex> + +namespace { + std::string formatSet(const std::set<std::string>& s) { + std::string out("{"); + for (const std::string& var: s) { + out.append(var); + if (var != *s.rbegin()) out.append(", "); + } + out.append("}"); + return out; + } +} + +namespace FlavorTagDiscriminants { + HbbGraphConfig getHbbGraphConfig(const lwt::GraphConfig& graph_cfg){ + namespace hk = FlavorTagDiscriminants::hbb_key; + HbbGraphConfig k; + k.n_subjets = 0; + std::regex subjet_match(hk::subjet + "[0-9]+"); + std::string first_match; + for (const auto& node: graph_cfg.inputs) { + for (const auto& var: node.variables) { + const std::string& name = var.name; + k.defaults[node.name][name] = node.defaults.at(name); + } + if (node.name == hk::fatjet) { + for (const auto& var: node.variables) { + k.fatjet.insert(var.name); + } + } else if (std::regex_match(node.name, subjet_match)) { + std::set<std::string> subjet_set; + for (const auto& var: node.variables) { + subjet_set.insert(var.name); + } + if (k.n_subjets == 0) { + k.subjet = subjet_set; + first_match = node.name; + } else if (k.subjet != subjet_set) { + std::string error = "mismatch in subjet keys: we expect the same" + " variables to be read from each subjet. "; + error.append("first subjet (" + first_match + ") " + + formatSet(k.subjet) + ", match " + + std::to_string(k.n_subjets) + + ", (" + node.name + ") " + formatSet(subjet_set)); + throw std::runtime_error(error); + } + k.n_subjets++; + } else { + throw std::runtime_error("no way to match '" + node.name + "'"); + } + } + return k; + } +} diff --git a/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbTag.cxx b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbTag.cxx new file mode 100644 index 0000000000000000000000000000000000000000..46277cf34ceae32af9af120f6ba1ee862fad138f --- /dev/null +++ b/PhysicsAnalysis/JetTagging/FlavorTagDiscriminants/Root/HbbTag.cxx @@ -0,0 +1,172 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +#include "FlavorTagDiscriminants/HbbTag.h" +#include "FlavorTagDiscriminants/HbbConstants.h" +#include "FlavorTagDiscriminants/HbbGraphConfig.h" + +// EDM includes +#include "xAODJet/Jet.h" + +// atlas utilities +#include "PathResolver/PathResolver.h" + +// external libraries +#include "lwtnn/LightweightGraph.hh" +#include "lwtnn/parse_json.hh" + +// c++ core +#include <set> +#include <fstream> + +namespace { + + template <typename T> + class BTagPairGetter + { + public: + BTagPairGetter(const std::string& key); + std::pair<std::string, double> operator()(const xAOD::Jet& jet); + private: + std::string m_key; + SG::AuxElement::ConstAccessor<T> m_getter; + }; + + using Pg = std::function<std::pair<std::string, double>(const xAOD::Jet&)>; + Pg makePairGetter(const std::string& key); + + void requireOverwrite(std::map<std::string, double>& target, + const std::pair<std::string, double>& value); + + +} + +namespace FlavorTagDiscriminants { + + HbbTag::HbbTag(const HbbTagConfig& config): + m_parent_link("Parent"), + m_subjet_link_getter(config.subjet_link_name), + m_n_subjets(0), + m_min_subjet_pt(config.min_subjet_pt) + { + // setup NN + std::string nn_path = PathResolverFindCalibFile(config.input_file_path); + if (nn_path.size() == 0) { + throw std::runtime_error( + "no file found at '" + config.input_file_path + "'"); + } + std::ifstream input_stream(nn_path); + lwt::GraphConfig graph_cfg = lwt::parse_json_graph(input_stream); + m_graph.reset(new lwt::LightweightGraph(graph_cfg)); + + // setup large-R jet getters and defaults + HbbGraphConfig keys = getHbbGraphConfig(graph_cfg); + // add the getters + for (const std::string& key: keys.fatjet) { + m_fat_jet_getters.push_back(makePairGetter(key)); + } + for (const std::string& key: keys.subjet) { + m_subjet_getters.push_back(makePairGetter(key)); + } + m_defaults = keys.defaults; + m_n_subjets = keys.n_subjets; + + // setup outputs + for (const auto& output: graph_cfg.outputs) { + const std::string& node_name = output.first; + const lwt::OutputNodeConfig& node = output.second; + NodeWriter node_writer; + for (const std::string& varname: node.labels) { + std::string write_name = node_name + "_" + varname; + node_writer.emplace_back(varname, write_name); + } + m_outputs.emplace_back(node_name, node_writer); + } + } + + void HbbTag::decorate(const xAOD::Jet& jet) const { + namespace hk = hbb_key; + std::map<std::string, std::map<std::string, double>> inputs = m_defaults; + for (const auto& getter: m_fat_jet_getters) { + requireOverwrite(inputs.at(hk::fatjet),getter(jet)); + } + + std::vector<const xAOD::IParticle*> subjets; + const xAOD::Jet* parent = *m_parent_link(jet); + if (!parent) throw std::runtime_error("can't resolve parent jet"); + for (const auto& link: m_subjet_link_getter(*parent)) { + const xAOD::IParticle* subjet = *link; + if (!subjet) throw std::runtime_error("can't resolve subjet link"); + if (subjet->pt() >= m_min_subjet_pt) { + subjets.push_back(subjet); + } + } + std::sort(subjets.begin(), subjets.end(), + [](auto* a, auto* b) { return a->pt() > b->pt(); }); + + size_t n_jets = std::min(subjets.size(), m_n_subjets); + for (size_t jet_n = 0; jet_n < n_jets; jet_n++) { + const auto* subjet = dynamic_cast<const xAOD::Jet*>(subjets.at(jet_n)); + if (!subjet) throw std::runtime_error("IParticle is not a Jet"); + std::string subjet_name = hk::subjet + std::to_string(jet_n); + for (const auto& getter: m_subjet_getters) { + requireOverwrite(inputs.at(subjet_name),getter(*subjet)); + } + } + + // calculate and write + for (const auto& node: m_outputs) { + const auto& result = m_graph->compute(inputs, {}, node.first); + for (const auto& var_writer: node.second) { + var_writer.second(jet) = result.at(var_writer.first); + } + } + + } + +} + + +namespace { + // implemenation + template <typename T> + BTagPairGetter<T>::BTagPairGetter(const std::string& key): + m_key(key), m_getter(key) + { + } + template <typename T> + std::pair<std::string, double> + BTagPairGetter<T>::operator()(const xAOD::Jet& jet) { + const xAOD::BTagging* btag = jet.btagging(); + if (!btag) throw std::runtime_error("can't find btagging object"); + return {m_key, m_getter(*btag)}; + } + + + Pg makePairGetter(const std::string& key) { + namespace hk = FlavorTagDiscriminants::hbb_key; + if (key == hk::pt) { + return [](const xAOD::Jet& j) -> std::pair<std::string, double> { + return {hk::pt, j.pt()}; + }; + } else if (key == hk::eta) { + return [](const xAOD::Jet& j) -> std::pair<std::string, double> { + return {hk::eta, j.eta()}; + }; + } else { + // for now we assume everything we read from b-tagging is a double, + // this is only true for DL1 scores. + return BTagPairGetter<double>(key); + } + } + + void requireOverwrite(std::map<std::string, double>& target, + const std::pair<std::string, double>& value) { + const auto itr = target.find(value.first); + if (itr == target.end()) { + throw std::logic_error("can't fine a default value for " + value.first); + } + itr->second = value.second; + } + +} diff --git a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/CMakeLists.txt b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/CMakeLists.txt index 61e557115ca9671a370a814ac7806e975c0ea388..c2e83642b6d699a57710bc6373b2f56e6e678182 100644 --- a/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/CMakeLists.txt +++ b/PhysicsAnalysis/MuonID/MuonIDAnalysis/MuonMomentumCorrections/CMakeLists.txt @@ -22,6 +22,7 @@ atlas_depends_on_subdirs( PhysicsAnalysis/Interfaces/MuonAnalysisInterfaces PhysicsAnalysis/Interfaces/AsgAnalysisInterfaces PRIVATE + PhysicsAnalysis/MuonID/MuonSelectorTools Event/xAOD/xAODBase Event/xAOD/xAODCore Event/xAOD/xAODEventInfo @@ -56,8 +57,8 @@ atlas_add_dictionary( MuonMomentumCorrectionsDict # Executable(s) in the package: atlas_add_executable( MCAST_Tester util/MCAST_Tester.cxx - INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} xAODRootAccess + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} xAODRootAccess xAODEventInfo xAODMuon xAODCore PATInterfaces xAODCore AsgTools AsgAnalysisInterfaces MuonSelectorToolsLib MuonMomentumCorrectionsLib MuonAnalysisInterfacesLib) diff --git a/Projects/AthSimulation/package_filters.txt b/Projects/AthSimulation/package_filters.txt index a1e406d22c9a2718ef5ba6a4003d3f50bdae1f44..8ffa36e97924f0993b514d800d4fba071430220f 100644 --- a/Projects/AthSimulation/package_filters.txt +++ b/Projects/AthSimulation/package_filters.txt @@ -180,6 +180,9 @@ + InnerDetector/InDetDetDescr/InDetIdDictFiles + InnerDetector/InDetDetDescr/InDetIdentifier + InnerDetector/InDetDetDescr/InDetReadoutGeometry ++ InnerDetector/InDetDetDescr/PixelReadoutGeometry ++ InnerDetector/InDetDetDescr/SCT_ReadoutGeometry ++ InnerDetector/InDetDetDescr/TRT_ReadoutGeometry + InnerDetector/InDetDetDescr/InDetServMatGeoModel + InnerDetector/InDetDetDescr/PixelGeoModel + InnerDetector/InDetDetDescr/SCT_GeoModel diff --git a/Reconstruction/EventShapes/EventShapeAthenaPool/src/EventShapeStoreCnv.cxx b/Reconstruction/EventShapes/EventShapeAthenaPool/src/EventShapeStoreCnv.cxx index 16898ba5348c0dcea04129041b51a87d66cec15b..5b8deedfa48cab535f9de0d9c9ef104996bb7c88 100644 --- a/Reconstruction/EventShapes/EventShapeAthenaPool/src/EventShapeStoreCnv.cxx +++ b/Reconstruction/EventShapes/EventShapeAthenaPool/src/EventShapeStoreCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -24,7 +24,7 @@ EventShapeStore* EventShapeStoreCnv::createTransient() { EventShapeStoreCnv_p1 TPconverter; // using auto_ptr ensures deletion of the persistent object - std::auto_ptr<EventShapeStore_p1> shapestore( poolReadObject< EventShapeStore_p1 >() ); + std::unique_ptr<EventShapeStore_p1> shapestore( poolReadObject< EventShapeStore_p1 >() ); MsgStream report( msgSvc(), "EventShapeStoreCnv" ); report << MSG::INFO << "Reading EventShapeStore_p1" << endmsg; return TPconverter.createTransient( shapestore.get(), report ); diff --git a/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx b/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx index 3b8d9d6acc7ba69cca24881a573d35910b5673d3..30da1c159a6e5ae03259ff3ca756850afe249831 100644 --- a/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx +++ b/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx @@ -1,7 +1,7 @@ ///////////////////////// -*- C++ -*- ///////////////////////////// /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // JetCalibrationTool.cxx @@ -38,6 +38,7 @@ JetCalibrationTool::JetCalibrationTool(const std::string& name) declareProperty( "OriginScale", m_originScale = "JetOriginConstitScaleMomentum"); declareProperty( "CalibArea", m_calibAreaTag = "00-04-82"); declareProperty( "rhkRhoKey", m_rhkRhoKey); + declareProperty( "PrimaryVerticesContainerName", m_rhkPV = "PrimaryVertices"); declareProperty( "GSCDepth", m_gscDepth); } @@ -350,50 +351,6 @@ StatusCode JetCalibrationTool::applyCalibration(xAOD::JetContainer& jets) const // Private/Protected Methods /////////////// -/* -StatusCode JetCalibrationTool::initializeEvent() { - - m_eventObj = 0; - m_vertices = 0; - - //ATH_MSG_INFO(" Retrieving event information for the pile up corrections\n"); - if ( evtStore()->retrieve(m_eventObj,"EventInfo").isFailure() || !m_eventObj ) { - ATH_MSG_ERROR(" JetCalibrationTool::initializeEvent : Failed to retrieve event information. Aborting."); - return StatusCode::FAILURE; - } - if ( evtStore()->retrieve(m_vertices,"PrimaryVertices").isFailure() || !m_vertices ) { - ATH_MSG_ERROR(" JetCalibrationTool::initializeEvent : Failed to retrieve primary vertices. Aborting."); - return StatusCode::FAILURE; - } - //ATH_MSG_INFO(" Event information successfully retrieved.\n\n"); - - //Check if the input jets are coming from data or MC - //if ( m_eventObj->eventType( xAOD::EventInfo::IS_SIMULATION ) ) { - // m_isData = false; // controls mu scaling in the pile up correction, no scaling for data - //} - - int eventNPV = 0; - xAOD::VertexContainer::const_iterator vtx_itr = m_vertices->begin(); - xAOD::VertexContainer::const_iterator vtx_end = m_vertices->end(); - for ( ; vtx_itr != vtx_end; ++vtx_itr ) - if ( (*vtx_itr)->nTrackParticles() >= 2 ) ++eventNPV; - - m_jetEventInfo.NPV = eventNPV; - m_jetEventInfo.mu = m_eventObj->averageInteractionsPerCrossing(); - - //Test code for EventShape EDM - //If xAODEventShape can't be retrieved from evtStore, default to hard-coded value (12GeV) - const xAOD::EventShape * eventShape; - std::string rhoKey = m_jetScale == EM ? "EMTopoEventShape" : "LCTopoEventShape"; - if ( evtStore()->retrieve(eventShape, rhoKey).isFailure() || !eventShape ) - m_jetEventInfo.rho = 12000.; - else - if ( !eventShape->getDensity( xAOD::EventShape::DensityForJetsR4, m_jetEventInfo.rho ) ) return StatusCode::FAILURE; - - return StatusCode::SUCCESS; -} -*/ - StatusCode JetCalibrationTool::initializeEvent(JetEventInfo& jetEventInfo) const { // Check if the tool was initialized diff --git a/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py b/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py index bbb25889e44f87e93d0506963f17ca4037128504..0f648579744d2f7d87ce176aa735576f050b3770 100644 --- a/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py +++ b/Reconstruction/Jet/JetCalibTools/python/JetCalibToolsConfig.py @@ -83,7 +83,7 @@ hasInSitu = ["AntiKt4LCTopo", "AntiKt4EMTopo", "AntiKt4EMPFlow", "TrigAntiKt4EMT # added to the tool name to ensure uniqueness. # Due to the hackiness of DualUseConfig public tool handling, we need to pass # an AlgSequence... -def getJetCalibTool(jetcollection, context, data_type, calibseq = "", rhoname = "", gscdepth = "auto"): +def getJetCalibTool(jetcollection, context, data_type, calibseq = "", rhoname = "", pvname = "PrimaryVertices", gscdepth = "auto"): # In principle we could autoconfigure if not data_type in ['data','mc','afii']: jetcaliblog.error("JetCalibConfig accepts data_type values: 'data', 'mc', 'afii'") @@ -118,7 +118,7 @@ def getJetCalibTool(jetcollection, context, data_type, calibseq = "", rhoname = # We should revert this later on, set up now for validation purposes if context == "T0": _data_type = "data" - return defineJetCalibTool(jetcollection, _configfile, calibarea, _calibseq, _data_type, rhoname, gscdepth) + return defineJetCalibTool(jetcollection, _configfile, calibarea, _calibseq, _data_type, rhoname, pvname, gscdepth) except KeyError as e: jetcaliblog.error("Context '{0}' not found for jet collection '{1}'".format(context,jetcollection)) jetcaliblog.error("Options are '{0}".format(','.join(jetcontexts.keys()))) @@ -126,7 +126,7 @@ def getJetCalibTool(jetcollection, context, data_type, calibseq = "", rhoname = return None # This method actually sets up the tool -def defineJetCalibTool(jetcollection, configfile, calibarea, calibseq, data_type, rhoname, gscdepth): +def defineJetCalibTool(jetcollection, configfile, calibarea, calibseq, data_type, rhoname, pvname, gscdepth): # Abbreviate the calib sequence calibseqshort = ''.join([ step[0] for step in calibseq.split('_') ]) toolname = "jetcalib_{0}_{1}".format(jetcollection,calibseqshort) @@ -138,6 +138,7 @@ def defineJetCalibTool(jetcollection, configfile, calibarea, calibseq, data_type CalibSequence = calibseq, IsData = (data_type == "data"), RhoKey = rhoname, + PrimaryVerticesContainerName = pvname, GSCDepth = gscdepth ) return jct @@ -145,7 +146,7 @@ def defineJetCalibTool(jetcollection, configfile, calibarea, calibseq, data_type # This method extends the basic config getter to specify the requisite jet # moments or other inputs def getJetCalibToolPrereqs(modspec,jetdef): - calibcontext, data_type, calibseq, rhoname, gscdepth = getCalibSpecsFromString(modspec) + calibcontext, data_type, calibseq, rhoname, pvname, gscdepth = getCalibSpecsFromString(modspec) if calibseq=="": cfg, calibarea, calibseq = calibcontexts[jetdef.basename][calibcontext] # For now, only dependent on calibseq -- can ignore Insitu, which is @@ -166,16 +167,18 @@ def getJetCalibToolPrereqs(modspec,jetdef): def getCalibSpecsFromString(modspec): calibseq = "" rhoname = "auto" + pvname = "PrimaryVertices" gscdepth = "auto" calibspecs = modspec.split(':') # Probably want data_type to come from elsewhere calibcontext, data_type = calibspecs[:2] if len(calibspecs)>2: calibseq = calibspecs[2] if len(calibspecs)>3: rhoname = calibspecs[3] - if len(calibspecs)>4: gscdepth = calibspecs[4] - return calibcontext, data_type, calibseq, rhoname, gscdepth + if len(calibspecs)>4: pvname = calibspecs[4] + if len(calibspecs)>5: gscdepth = calibspecs[5] + return calibcontext, data_type, calibseq, rhoname, pvname, gscdepth # This method instantiates the JetCalibTool given the input mod specification def getJetCalibToolFromString(modspec,jetdef): - calibcontext, data_type, calibseq, rhoname, gscdepth = getCalibSpecsFromString(modspec) - return getJetCalibTool(jetdef.basename,calibcontext,data_type,calibseq,rhoname,gscdepth) + calibcontext, data_type, calibseq, rhoname, pvname, gscdepth = getCalibSpecsFromString(modspec) + return getJetCalibTool(jetdef.basename,calibcontext,data_type,calibseq,rhoname,pvname,gscdepth) diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetCaloQualityTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetCaloQualityTool.h index 94ddbc0543c9dd052a58bfc2ef8372f33c0bccbb..34a34260d264d5c5f18288aabc8e507e323d108c 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetCaloQualityTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetCaloQualityTool.h @@ -1,7 +1,7 @@ // this file is -*- C++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /** @@ -25,30 +25,37 @@ #ifndef JETREC_JETCALOQUALITYTOOL_H #define JETREC_JETCALOQUALITYTOOL_H -#include "JetRec/JetModifierBase.h" - +#include "AsgTools/AsgTool.h" +#include "JetInterface/IJetDecorator.h" #include "JetUtils/JetCaloCalculations.h" +#include "StoreGate/WriteDecorHandleKeyArray.h" #include <vector> #include <string> -class JetCaloQualityTool: public JetModifierBase { +class JetCaloQualityTool: public asg::AsgTool, + virtual public IJetDecorator { ASG_TOOL_CLASS0(JetCaloQualityTool) public: JetCaloQualityTool(const std::string & name); - virtual int modifyJet(xAOD::Jet& ) const ; + virtual StatusCode decorate(const xAOD::JetContainer& jets) const override; - virtual StatusCode initialize(); + virtual StatusCode initialize() override; protected: - /// Names of calo quantities to compute and to add as attributes - std::vector<std::string> m_calculationNames; - /// Time cuts for Out-of-time calo quantities. - std::vector <double> m_timingTimeCuts; + Gaudi::Property<std::vector<std::string> > m_calculationNames{this, "Calculations", {}, + "Name of calo quantities to compute and add as decorations"}; + Gaudi::Property<std::vector<double> > m_timingTimeCuts{this, "TimingCuts", {}, + "Time cuts for out-of-time calo quantities"}; + Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", + "SG key of input jet container"}; + + SG::WriteDecorHandleKeyArray<xAOD::JetContainer> m_writeDecorKeys{this, "OutputDecorKeys", {}, + "SG keys for output decorations (not to be configured manually!)"}; /// This objects holds a list of cluster-based calculators jet::JetCaloCalculations m_jetCalculations; @@ -56,7 +63,6 @@ public: // internal pointer to m_jetCalculations (this pointer is also used in the cell-based derived tool) jet::JetCaloCalculations * m_calcProcessor; - bool m_doFracSamplingMax; // internal }; #endif diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetECPSFractionTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetECPSFractionTool.h index c54cf78214f5c4a878bdaf14d48f91dc0f508f62..e341c78e4b8a5be40db1aeecaa0e7040a985aed5 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetECPSFractionTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetECPSFractionTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // JetECPSFractionTool.h @@ -21,27 +21,37 @@ /// ECPSFraction: Fraction of jet energy in the ECPS /// -#include "JetRec/JetModifierBase.h" +#include "AsgTools/AsgTool.h" +#include "StoreGate/WriteDecorHandleKey.h" +#include "JetInterface/IJetDecorator.h" + +class JetECPSFractionTool : public asg::AsgTool, + virtual public IJetDecorator{ + ASG_TOOL_CLASS(JetECPSFractionTool, IJetDecorator) -class JetECPSFractionTool : public JetModifierBase { - ASG_TOOL_CLASS(JetECPSFractionTool, IJetModifier) - public: // Constructor from tool name. JetECPSFractionTool(std::string myname); - // Inherited method to modify a jet. - // Calls width and puts the result on the jet. - int modifyJet(xAOD::Jet& jet) const; + // Inherited method to decorate a jet. + virtual StatusCode decorate(const xAOD::JetContainer& jets) const override; + + // Inherited from AsgTool + virtual StatusCode initialize() override; // Local method to calculate and return the energy fraction. double energyFraction(const xAOD::Jet& jet) const; private: - // Properties. - double m_fraclimit; + Gaudi::Property<double> m_fraclimit{this, "ECPSFractionThreshold", 0.8, + "Threshold for identifying a cluser as ECPS"}; + Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", + "SG key for input jet container"}; + + SG::WriteDecorHandleKey<xAOD::JetContainer> m_fracKey{this, "ECPSFractionDecorKey", "ECPSFraction", + "Name for output ECPS fraction decoration"}; }; diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetLArHVTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetLArHVTool.h index 2f75f0ca085816eebf238e7d69714c2fc9463e9c..928ec6670cd32a00664afc22f07b2b1178d06f8f 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetLArHVTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetLArHVTool.h @@ -1,7 +1,7 @@ // this file is -*- C++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -17,23 +17,32 @@ #ifndef JETMOMENTTOOLS_JETLARHVTOOL_H #define JETMOMENTTOOLS_JETLARHVTOOL_H -#include "JetRec/JetModifierBase.h" #include "AsgTools/ToolHandle.h" +#include "AsgTools/AsgTool.h" +#include "StoreGate/WriteDecorHandleKey.h" +#include "JetInterface/IJetDecorator.h" -class JetLArHVTool: public JetModifierBase { +class JetLArHVTool: public asg::AsgTool, + virtual public IJetDecorator{ ASG_TOOL_CLASS0(JetLArHVTool) public: JetLArHVTool(const std::string & name); - virtual int modifyJet(xAOD::Jet& ) const ; - - virtual StatusCode initialize(); + virtual StatusCode decorate(const xAOD::JetContainer& jets) const override; + + virtual StatusCode initialize() override; private: + Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", + "SG key for the input jet container"}; + SG::WriteDecorHandleKey<xAOD::JetContainer> m_fracKey{this, "EnergyFracDecorKey", "LArBadHVEnergyFrac", + "SG key for energy fraction decoration (not including jet container name)"}; + SG::WriteDecorHandleKey<xAOD::JetContainer> m_nCellKey{this, "NCellDecorKey", "LArBadHVNCell", + "SG key for nCell decoration (not including jet container name)"}; }; #endif diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiMomentsTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiMomentsTool.h index 2310dec2b53113269b7d2ba0eb67a32d48292c94..90a11066acf8aa7f792ed7ea04ba7734556854e1 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiMomentsTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetVoronoiMomentsTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // JetVoronoiMomentsTool.h @@ -17,35 +17,45 @@ /// #include <string> -#include "JetRec/JetModifierBase.h" -#include "xAODJet/Jet.h" +#include "AsgTools/AsgTool.h" +#include "StoreGate/WriteDecorHandleKey.h" +#include "JetInterface/IJetDecorator.h" namespace JetVoronoiDiagramHelpers{ struct Diagram; } -class JetVoronoiMomentsTool : public JetModifierBase { -ASG_TOOL_CLASS(JetVoronoiMomentsTool,IJetModifier) +class JetVoronoiMomentsTool : public asg::AsgTool, + virtual public IJetDecorator { +ASG_TOOL_CLASS(JetVoronoiMomentsTool,IJetDecorator) public: // Constructor from tool name JetVoronoiMomentsTool(const std::string& name); - // Inherited methods to modify a jet container - virtual StatusCode modify(xAOD::JetContainer& jets) const; - virtual int modifyJet(xAOD::Jet& jet) const; + // Inherited from AsgTool via IJetDecorator + virtual StatusCode initialize() override; + + // Inherited method to decorate a jet container + virtual StatusCode decorate(const xAOD::JetContainer& jets) const override; private: // parameters - float m_x_min; - float m_x_max; - float m_y_min; - float m_y_max; - - int modifyJet(xAOD::Jet& jet, const JetVoronoiDiagramHelpers::Diagram & voro) const; - + Gaudi::Property<float> m_x_min{this, "AreaXmin", -10, + "Minimum x-value for Voronoi diagram"}; + Gaudi::Property<float> m_x_max{this, "AreaXmax", 10, + "Maximum x-value for Voronoi diagram"}; + Gaudi::Property<float> m_y_min{this, "AreaYmin", -4, + "Minimum y-value for Voronoi diagram"}; + Gaudi::Property<float> m_y_max{this, "AreaYmax", 4, + "Maximum y-value for Voronoi diagram"}; + Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", + "SG key for the input jet container"}; + + SG::WriteDecorHandleKey<xAOD::JetContainer> m_voronoiAreaKey{this, "VoronoiAreaKey", "VoronoiArea", + "SG key for Voronoi area decoration (not including jet container name)"}; }; #endif diff --git a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetWidthTool.h b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetWidthTool.h index a768a18daf6bafdaa9bf18dc72239ac8a3cb4ddf..8b4df942064856c73c433492b47a449919981c4a 100644 --- a/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetWidthTool.h +++ b/Reconstruction/Jet/JetMomentTools/JetMomentTools/JetWidthTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // JetWidthTool.h @@ -12,28 +12,40 @@ /// /// Tool to calculate the jet width. -#include "JetRec/JetModifierBase.h" +#include "JetInterface/IJetDecorator.h" +#include "AsgTools/AsgTool.h" #include "AsgTools/ToolHandle.h" +#include "StoreGate/WriteDecorHandleKey.h" #include "PFlowUtils/IWeightPFOTool.h" -class JetWidthTool : public JetModifierBase { - ASG_TOOL_CLASS(JetWidthTool, IJetModifier) - +class JetWidthTool : public asg::AsgTool, + virtual public IJetDecorator { + ASG_TOOL_CLASS(JetWidthTool, IJetDecorator) + public: // Constructor from tool name. JetWidthTool(std::string myname); - // Inherited method to modify a jet. - // Calls width and puts the result on the jet. - virtual int modifyJet(xAOD::Jet& jet) const; + virtual StatusCode initialize() override; + + // Inherited method to decorate a jet container. + // Calls width and puts the result on the jets. + virtual StatusCode decorate(const xAOD::JetContainer& jets) const override; // Local method to calculate and return the width. - //double width(const xAOD::Jet& jet) const; - double width(const xAOD::Jet& jet, double& widthEta, double& widthPhi) const; + float width(const xAOD::Jet& jet, float& widthEta, float& widthPhi) const; private: + + Gaudi::Property<std::string> m_jetContainerName{this, "JetContainer", "", + "SG key for the input jet container"}; + + SG::WriteDecorHandleKey<xAOD::JetContainer> m_widthKey{this, "WidthKey", "Width", + "SG key for width decoration (not including jet container name)"}; + SG::WriteDecorHandleKey<xAOD::JetContainer> m_widthPhiKey{this, "WidthPhiKey", "WidthPhi", + "SG key for width phi decoration (not including jet container name)"}; }; #endif diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetCaloQualityTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetCaloQualityTool.cxx index 2d4b5bea816c0cc91fef94d3800b2e90111157b2..fff60c74d56b5907b4e951e285605527e55ef9b3 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetCaloQualityTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetCaloQualityTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -7,6 +7,7 @@ #include "JetMomentTools/JetCaloQualityTool.h" #include "xAODJet/JetAccessorMap.h" +#include "StoreGate/WriteDecorHandle.h" #include <iostream> @@ -16,50 +17,69 @@ using namespace jet; JetCaloQualityTool::JetCaloQualityTool(const std::string& name) - : JetModifierBase(name) + : asg::AsgTool(name) { - - - declareProperty("TimingCuts", m_timingTimeCuts); - declareProperty("Calculations", m_calculationNames); + declareInterface<IJetDecorator>(this); } -int JetCaloQualityTool::modifyJet( xAOD::Jet& jet ) const +StatusCode JetCaloQualityTool::decorate(const xAOD::JetContainer& jets) const { - if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Inside process() method" << endmsg; - - if(m_doFracSamplingMax==true) - { - // Special case : we want to store more than 1 value (max sampling AND its index). - // AND there's no code available for direct cell access. - // So we just use a direct function instead of a calculator for now. + if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Inside decorate() method" << endmsg; + + //bool checkedContainer = false; + const size_t nDecorations = m_writeDecorKeys.size(); + if(m_doFracSamplingMax==true){ + // Special case : we want to store more than 1 value (max sampling AND its index). + // AND there's no code available for direct cell access. + // So we just use a direct function instead of a calculator for now. + + // We specifically put these in last earlier + SG::WriteDecorHandle<xAOD::JetContainer, float> maxHandle(m_writeDecorKeys.at(nDecorations-2)); + SG::WriteDecorHandle<xAOD::JetContainer, int> samplingHandle(m_writeDecorKeys.at(nDecorations-1)); + + for(const xAOD::Jet* jet : jets){ int sampling=-1; - double fracSamplingMax=JetCaloQualityUtils::fracSamplingMax(&jet,sampling); + double fracSamplingMax=JetCaloQualityUtils::fracSamplingMax(jet,sampling); ATH_MSG_VERBOSE("Setting " << xAOD::JetAttribute::FracSamplingMax << " to " << fracSamplingMax); - jet.setAttribute<float>(xAOD::JetAttribute::FracSamplingMax,fracSamplingMax ); - jet.setAttribute<int>(xAOD::JetAttribute::FracSamplingMaxIndex,sampling ); + maxHandle(*jet) = fracSamplingMax; + samplingHandle(*jet) = sampling; } - + } + // Do all other calculations - std::vector<double> results = m_calcProcessor->process(&jet); - - // store them in the jet - for(size_t i=0;i < m_calcProcessor->numCalculators();i++) { - const JetCaloCalculator* calc = m_calcProcessor->at(i); - ATH_MSG_DEBUG( calc->name() << " -> "<<results[i] ); - jet.setAttribute<float>( calc->name(), results[i] ); + for(const xAOD::Jet* jet : jets){ + + std::vector<double> results = m_calcProcessor->process(jet); + + // store them in the jet + for(size_t i=0;i < m_calcProcessor->numCalculators();i++) { + // We inserted WriteDecorKeys in the same order as calculators + SG::WriteDecorHandle<xAOD::JetContainer, float> decHandle(m_writeDecorKeys.at(i)); + + const JetCaloCalculator* calc = m_calcProcessor->at(i); + ATH_MSG_DEBUG( calc->name() << " -> "<<results[i] ); + decHandle(*jet) = results[i]; + } } - - return 1; + return StatusCode::SUCCESS; } StatusCode JetCaloQualityTool::initialize() { ATH_MSG_DEBUG( "Inside initialize() method" ); + if(!m_writeDecorKeys.empty()){ + ATH_MSG_ERROR("OutputDecorKeys should not be configured manually!"); + return StatusCode::FAILURE; + } + if(m_jetContainerName.empty()){ + ATH_MSG_ERROR("JetCaloQualityTool needs to have its input jet container name configured!"); + return StatusCode::FAILURE; + } + // In this tool we're using the cluster-based calculators // (this is different in the cell-based calculation tool). m_calcProcessor = & m_jetCalculations; @@ -100,10 +120,13 @@ StatusCode JetCaloQualityTool::initialize() { } else if (calcN == "FracSamplingMax") { m_doFracSamplingMax = true; // no calculator, as this is a special case. } - }// end loop over m_calculationNames - + // Set the DecorHandleKeys with the correct strings + for(size_t i=0; i < m_jetCalculations.numCalculators(); i++){ + m_writeDecorKeys.emplace_back(m_jetContainerName + "." + m_jetCalculations.at(i)->name()); + } + // Define OOT calculators. for( double & timeCut : m_timingTimeCuts){ @@ -115,8 +138,17 @@ StatusCode JetCaloQualityTool::initialize() { c->setName(s.str()); c->timecut = timeCut; m_jetCalculations.addCalculator( c ); + m_writeDecorKeys.emplace_back(m_jetContainerName + "." + s.str()); } + // Add these last so m_jetCalculations and m_writeDecorKeys have corresponding indices + if (m_doFracSamplingMax){ + m_writeDecorKeys.emplace_back(m_jetContainerName + ".FracSamplingMax"); + m_writeDecorKeys.emplace_back(m_jetContainerName + ".FracSamplingMaxIndex"); + } + + ATH_CHECK(m_writeDecorKeys.initialize()); + return StatusCode::SUCCESS; } diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetECPSFractionTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetECPSFractionTool.cxx index 9ad518155d8a5d6c6e439aa439b3efb9e2481626..3a317b528928979150f484ad8e13d005206b92bd 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetECPSFractionTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetECPSFractionTool.cxx @@ -1,9 +1,10 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // JetECPSFractionTool.cxx +#include "StoreGate/WriteDecorHandle.h" #include "JetMomentTools/JetECPSFractionTool.h" #include "xAODCaloEvent/CaloCluster.h" #include "xAODPFlow/PFO.h" @@ -20,16 +21,35 @@ using xAOD::JetFourMom_t; //********************************************************************** JetECPSFractionTool::JetECPSFractionTool(std::string myname) -: JetModifierBase(myname) { - declareProperty("ECPSFractionThreshold", m_fraclimit =0.8); +: asg::AsgTool(myname) { + + declareInterface<IJetDecorator>(this); } +//********************************************************************** + +StatusCode JetECPSFractionTool::initialize(){ + + if(m_jetContainerName.empty()){ + ATH_MSG_ERROR("JetECPSFractionTool needs to have its input jet container name configured!"); + return StatusCode::FAILURE; + } + + // Prepend jet collection name + m_fracKey = m_jetContainerName + "." + m_fracKey.key(); + + ATH_CHECK(m_fracKey.initialize()); + return StatusCode::SUCCESS; +} //********************************************************************** -int JetECPSFractionTool::modifyJet(xAOD::Jet& jet) const { - jet.setAttribute("ECPSFraction", energyFraction(jet)); - return 0; +StatusCode JetECPSFractionTool::decorate(const xAOD::JetContainer& jets) const { + + SG::WriteDecorHandle<xAOD::JetContainer, float> fracHandle(m_fracKey); + + for(const xAOD::Jet* jet : jets) fracHandle(*jet) = energyFraction(*jet); + return StatusCode::SUCCESS; } //********************************************************************** diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetLArHVTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetLArHVTool.cxx index 59707dfe6c1128ec5580ddfe58e452c9c06fdf93..41cfeec79ae3fbfe7851a1eb4ebbb64da4f80a4d 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetLArHVTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetLArHVTool.cxx @@ -1,46 +1,65 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#include "StoreGate/WriteDecorHandle.h" #include "JetUtils/JetDistances.h" #include "JetMomentTools/JetLArHVTool.h" #include "xAODCaloEvent/CaloCluster.h" JetLArHVTool::JetLArHVTool(const std::string& name) - : JetModifierBase(name) + : asg::AsgTool(name) { + declareInterface<IJetDecorator>(this); } StatusCode JetLArHVTool::initialize() { + if(m_fracKey.key().at(0) == '.' || m_nCellKey.key().at(0) == '.'){ + ATH_MSG_ERROR("JetLArHVTool needs to have its input jet container name configured!"); + return StatusCode::FAILURE; + } + + // Prepend jet container name + m_fracKey = m_jetContainerName + "." + m_fracKey.key(); + m_nCellKey = m_jetContainerName + "." + m_nCellKey.key(); + + ATH_CHECK(m_fracKey.initialize()); + ATH_CHECK(m_nCellKey.initialize()); return StatusCode::SUCCESS; } -int JetLArHVTool::modifyJet( xAOD::Jet& jet ) const +StatusCode JetLArHVTool::decorate(const xAOD::JetContainer& jets) const { - double energyHVaff=0; - int numCellsHVaff=0; - - // loop over raw constituents. Look for clusters - size_t num = jet.numConstituents(); - for(size_t i=0;i<num;i++) { - const xAOD::CaloCluster * cl = dynamic_cast<const xAOD::CaloCluster *>(jet.rawConstituent(i)); - if( !cl) continue; - - double m; - if(cl->retrieveMoment(xAOD::CaloCluster::ENG_BAD_HV_CELLS,m) ) energyHVaff += m; - if(cl->retrieveMoment(xAOD::CaloCluster::N_BAD_HV_CELLS, m) ) numCellsHVaff += m; - } - double emE = jet.jetP4(xAOD::JetEMScaleMomentum).E(); - // set the attributes - jet.setAttribute<float>("LArBadHVEnergyFrac", energyHVaff / emE); - jet.setAttribute<int>("LArBadHVNCell", numCellsHVaff); - - return 0; + SG::WriteDecorHandle<xAOD::JetContainer, float> fracHandle(m_fracKey); + SG::WriteDecorHandle<xAOD::JetContainer, int> nCellHandle(m_nCellKey); + + for(const xAOD::Jet* jet : jets){ + + double energyHVaff=0; + int numCellsHVaff=0; + + // loop over raw constituents. Look for clusters + size_t num = jet->numConstituents(); + for(size_t i=0;i<num;i++) { + const xAOD::CaloCluster * cl = dynamic_cast<const xAOD::CaloCluster *>(jet->rawConstituent(i)); + if( !cl) continue; + + double m; + if(cl->retrieveMoment(xAOD::CaloCluster::ENG_BAD_HV_CELLS,m) ) energyHVaff += m; + if(cl->retrieveMoment(xAOD::CaloCluster::N_BAD_HV_CELLS, m) ) numCellsHVaff += m; + } + + double emE = jet->jetP4(xAOD::JetEMScaleMomentum).E(); + // set the attributes + fracHandle(*jet) = energyHVaff / emE; + nCellHandle(*jet) = numCellsHVaff; + } + return StatusCode::SUCCESS; } diff --git a/Reconstruction/Jet/JetMomentTools/Root/JetWidthTool.cxx b/Reconstruction/Jet/JetMomentTools/Root/JetWidthTool.cxx index 823c17576ab0a8b65b75444ca4d378f538a3774d..d18ec0d813ad5d582e1590d8ca43417b9ebce4e3 100644 --- a/Reconstruction/Jet/JetMomentTools/Root/JetWidthTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/Root/JetWidthTool.cxx @@ -1,11 +1,11 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // JetWidthTool.cxx #include "JetMomentTools/JetWidthTool.h" - +#include "StoreGate/WriteDecorHandle.h" #include "xAODJet/JetConstituentVector.h" #include "JetUtils/JetDistances.h" #include "PFlowUtils/IWeightPFOTool.h" @@ -13,52 +13,47 @@ //********************************************************************** JetWidthTool::JetWidthTool(std::string myname) - : JetModifierBase(myname) + : asg::AsgTool(myname) { + declareInterface<IJetDecorator>(this); } //********************************************************************** -int JetWidthTool::modifyJet(xAOD::Jet& jet) const { +StatusCode JetWidthTool::initialize(){ + + if(m_jetContainerName.empty()){ + ATH_MSG_ERROR("JetWidthTool needs to have its input jet container name configured!"); + return StatusCode::FAILURE; + } + + // Prepend jet container name + m_widthKey = m_jetContainerName + "." + m_widthKey.key(); + m_widthPhiKey = m_jetContainerName + "." + m_widthPhiKey.key(); - double widthEta = 0, widthPhi = 0; - //jet.setAttribute("Width", width(jet)); - jet.setAttribute("Width", width(jet,widthEta,widthPhi)); - //jet.setAttribute("WidthEta",widthEta); - jet.setAttribute("WidthPhi",widthPhi); - return 0; + ATH_CHECK(m_widthKey.initialize()); + ATH_CHECK(m_widthPhiKey.initialize()); + return StatusCode::SUCCESS; } //********************************************************************** -//double JetWidthTool::width(const xAOD::Jet& jet) const { -// -// // Get the constituents of the jet -// const xAOD::JetConstituentVector constituents = jet.getConstituents(); -// xAOD::JetConstituentVector::iterator iter = constituents.begin(); -// xAOD::JetConstituentVector::iterator iEnd = constituents.end(); -// -// // TODO: Switch to using helper function once JetUtils has been updated -// // Set the width -// // jetWidth = JetKinematics::ptWeightedWidth(iter,iEnd,&jet); -// -// // Calculate the pt weighted width -// const double jetEta = jet.eta(); -// const double jetPhi = jet.phi(); -// double weightedWidth = 0; -// double ptSum = 0; -// -// for ( ; iter != iEnd; ++iter) { -// const double dR = jet::JetDistances::deltaR(jetEta, jetPhi, iter->eta(), iter->phi() ); -// const double pt = iter->pt(); -// weightedWidth += dR * pt; -// ptSum += pt; -// } -// -// return ptSum > 0 ? weightedWidth/ptSum : -1; -//} - -double JetWidthTool::width(const xAOD::Jet& jet, double& widthEta, double& widthPhi) const { +StatusCode JetWidthTool::decorate(const xAOD::JetContainer& jets) const { + + SG::WriteDecorHandle<xAOD::JetContainer, float> widthHandle(m_widthKey); + SG::WriteDecorHandle<xAOD::JetContainer, float> widthPhiHandle(m_widthPhiKey); + + for(const xAOD::Jet* jet : jets){ + float widthEta = 0, widthPhi = 0; + widthHandle(*jet) = width(*jet,widthEta,widthPhi); + widthPhiHandle(*jet) = widthPhi; + } + return StatusCode::SUCCESS; +} + +//********************************************************************** + +float JetWidthTool::width(const xAOD::Jet& jet, float& widthEta, float& widthPhi) const { // Get the constituents of the jet // TODO: Switch to using helper function once JetUtils has been updated @@ -66,19 +61,19 @@ double JetWidthTool::width(const xAOD::Jet& jet, double& widthEta, double& width // jetWidth = JetKinematics::ptWeightedWidth(iter,iEnd,&jet); // Calculate the pt weighted width - const double jetEta = jet.eta(); - const double jetPhi = jet.phi(); - double weightedWidth = 0; - double weightedWidthEta = 0; - double weightedWidthPhi = 0; - double ptSum = 0; + const float jetEta = jet.eta(); + const float jetPhi = jet.phi(); + float weightedWidth = 0; + float weightedWidthEta = 0; + float weightedWidthPhi = 0; + float ptSum = 0; const xAOD::JetConstituentVector constituents = jet.getConstituents(); for (const auto& constituent : constituents) { - const double dR = jet::JetDistances::deltaR(jetEta, jetPhi, constituent->eta(), constituent->phi() ); - const double dEta = fabs(jet::JetDistances::deltaEta(jetEta, constituent->eta() )); - const double dPhi = fabs(jet::JetDistances::deltaPhi(jetPhi, constituent->phi() )); - const double pt = constituent->pt(); + const float dR = jet::JetDistances::deltaR(jetEta, jetPhi, constituent->eta(), constituent->phi() ); + const float dEta = fabs(jet::JetDistances::deltaEta(jetEta, constituent->eta() )); + const float dPhi = fabs(jet::JetDistances::deltaPhi(jetPhi, constituent->phi() )); + const float pt = constituent->pt(); weightedWidth += dR * pt; weightedWidthEta += dEta * pt; @@ -92,5 +87,3 @@ double JetWidthTool::width(const xAOD::Jet& jet, double& widthEta, double& width return ptSum > 0 ? weightedWidth/ptSum : -1; } - -//********************************************************************** diff --git a/Reconstruction/Jet/JetMomentTools/src/JetVoronoiMomentsTool.cxx b/Reconstruction/Jet/JetMomentTools/src/JetVoronoiMomentsTool.cxx index 439da17b1a3a2d074964818b968928f32185948e..cfd83cac24b8a01e5fe2d8979944190ef592abb3 100644 --- a/Reconstruction/Jet/JetMomentTools/src/JetVoronoiMomentsTool.cxx +++ b/Reconstruction/Jet/JetMomentTools/src/JetVoronoiMomentsTool.cxx @@ -1,8 +1,9 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#include "StoreGate/WriteDecorHandle.h" #include "JetMomentTools/JetVoronoiMomentsTool.h" // helpers @@ -19,24 +20,29 @@ using JetVoronoiDiagramHelpers::Diagram; JetVoronoiMomentsTool::JetVoronoiMomentsTool(const std::string& name) - : JetModifierBase(name) - //, m_voronoitool("") - , m_x_min(-10.) - , m_x_max( 10.) - , m_y_min(-4. ) - , m_y_max( 4. ) - //, m_jetcontainer ("") - //, m_scaleIntFloat (1e3) + : asg::AsgTool(name) { - declareProperty("AreaXmin",m_x_min); - declareProperty("AreaXmax",m_x_max); - declareProperty("AreaYmin",m_y_min); - declareProperty("AreaYmax",m_y_max); - //declareProperty("JetContainerName",m_jetcontainer); + declareInterface<IJetDecorator>(this); +} + +StatusCode JetVoronoiMomentsTool::initialize() { + + if(m_jetContainerName.empty()){ + ATH_MSG_ERROR("JetVoronoiMomentsTool needs to have its input jet container name configured!"); + return StatusCode::FAILURE; + } + + // Prepend jet collection name + m_voronoiAreaKey = m_jetContainerName + "." + m_voronoiAreaKey.key(); + ATH_CHECK(m_voronoiAreaKey.initialize()); + return StatusCode::SUCCESS; } -StatusCode JetVoronoiMomentsTool::modify(xAOD::JetContainer& jets) const { +StatusCode JetVoronoiMomentsTool::decorate(const xAOD::JetContainer& jets) const { + + SG::WriteDecorHandle<xAOD::JetContainer, float> outputHandle(m_voronoiAreaKey); + // setup diagram class Diagram voro ("VoronoiDiagram"); voro.m_x_min = m_x_min; @@ -52,21 +58,9 @@ StatusCode JetVoronoiMomentsTool::modify(xAOD::JetContainer& jets) const { if ( voro.createVoronoiDiagram().isFailure() ) { ATH_MSG_WARNING("Could not calculate Voronoi diagram"); } - for ( xAOD::Jet *jet : jets ) modifyJet(*jet,voro); + // decorate the jets + for (const xAOD::Jet *jet : jets ){ + outputHandle(*jet) = voro.getCellArea(jet->eta(), jet->phi()); + } return StatusCode::SUCCESS; } - -int JetVoronoiMomentsTool::modifyJet(xAOD::Jet&) const { - ATH_MSG_WARNING("Don't use this function. We need to compare space with other jets."); - return 0; -} - -int JetVoronoiMomentsTool::modifyJet(xAOD::Jet& jet, const Diagram & voro) const { - // Collate info - float VoronoiArea = voro.getCellArea(jet.eta(), jet.phi() ); - // Set info - jet.setAttribute( "VoronoiArea" , VoronoiArea ); - return 0; -} - - diff --git a/Reconstruction/Jet/JetMonitoring/CMakeLists.txt b/Reconstruction/Jet/JetMonitoring/CMakeLists.txt index ab37d63c4b4214c54bfa78d866561cfa361710cd..6ef9d0c3051a5653820c291991c68ca7d1969c24 100644 --- a/Reconstruction/Jet/JetMonitoring/CMakeLists.txt +++ b/Reconstruction/Jet/JetMonitoring/CMakeLists.txt @@ -18,6 +18,7 @@ atlas_depends_on_subdirs( PUBLIC Control/AthContainers Trigger/TrigAnalysis/TrigDecisionTool Reconstruction/Jet/JetUtils + Event/FourMomUtils ) # External dependencies: @@ -29,7 +30,7 @@ atlas_add_component( JetMonitoring Root/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODHIEvent xAODJet GaudiKernel JetInterface AthContainers AthenaMonitoringLib JetUtils ) + LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODHIEvent xAODJet GaudiKernel JetInterface AthContainers AthenaMonitoringLib JetUtils FourMomUtils) # Install files from the package: atlas_install_headers( JetMonitoring ) diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoLeadingJetsRelations.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoLeadingJetsRelations.h index d5ad44fe7dbab88009ee2a04743deec0ff36ba87..7f293fde12e3cacb8f8c589191920b0d300d2d89 100644 --- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoLeadingJetsRelations.h +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoLeadingJetsRelations.h @@ -1,7 +1,6 @@ - // this file is -*- C++ -*- /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef JETHISTOLEADINGJETSRELATIONS_H @@ -13,22 +12,11 @@ #include "JetMonitoring/JetHistoVarTool.h" //////////////////////////////////////////////////// -/// \class JetHistoAttributeFiller -/// -/// A IJetHistoFiller implementation in charge of filling 1 1D or 2D histogram. -/// The histogram is filled according to 1 (or 2 if 2D histo, or 3 if TProfile2D) -// "jet variables" for each jet in the JetContainer passed to the processJetContainer() -/// function. -/// -/// The tool does not directly fill histograms but uses Monitored::Scalar and Monitored::Group -/// as is requested by the monitoring framewok. +/// \class Jethistoleadingjetsrelations /// -/// The variables are specified by means of IJetHistoVarTool which are just configurable version -/// of the JetVariable class. -/// The IJetHistoVarTool are set via the properterties VarX, VarY and VarZ -/// The Monitoring Group is specified by the Group property -/// -/// The tool support plotting variables of type float,int ,vector<float> and vector<int>. +/// A IJetHistoFiller implementation in charge of calculating +/// angular variables between leading and subleading jets in an event. +/// If njet<2, no variable are calculated (and thus no histo entry filled). /// class JetHistoLeadingJetsRelations : public AthAlgTool, virtual public IJetHistoFiller { public: @@ -45,11 +33,6 @@ private: Gaudi::Property<std::string> m_group {this,"Group", "undefined"}; - // ToolHandle<IJetHistoVarTool> m_var; - //ToolHandle<IJetHistoVarTool> m_varY; - //ToolHandle<IJetHistoVarTool> m_varZ; - - //int m_nVar=1; }; #endif diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoResponseAndEff.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoResponseAndEff.h new file mode 100644 index 0000000000000000000000000000000000000000..79eff0b76275ffa96f897bdc2725c81a1cb9fa2a --- /dev/null +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetHistoResponseAndEff.h @@ -0,0 +1,35 @@ +// this file is -*- C++ -*- +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef JETHISTORESPNSEEFFICIENCY_H +#define JETHISTORESPNSEEFFICIENCY_H + +#include "AthenaBaseComps/AthAlgTool.h" + +#include "JetMonitoring/IJetHistoFiller.h" + +//////////////////////////////////////////////////// +/// \class Jethistoleadingjetsrelations +/// +/// A IJetHistoFiller implementation in charge of efficiency and pT response +/// between the jets being monitored and truth jets (or any reference jets) +/// +class JetHistoResponseAndEff : public AthAlgTool, virtual public IJetHistoFiller { +public: + JetHistoResponseAndEff( const std::string& type, const std::string & name ,const IInterface* parent); + virtual ~JetHistoResponseAndEff(){} + + virtual StatusCode initialize() ; + virtual StatusCode processJetContainer(const JetMonitoringAlg& parentAlg, const xAOD::JetContainer & jets, const EventContext& ctx) const; + +private: + + Gaudi::Property<std::string> m_group {this,"Group", "undefined"}; + Gaudi::Property<float> m_energyScale {this, "EnergyScale", 1.}; + SG::ReadHandleKey<xAOD::JetContainer> m_refContainerKey; + + +}; +#endif diff --git a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py index d4b2866ae8bb2c856750e2e2cf1e6ed37fbbd36c..32b7917f7fb6169dcccb909ad1f1433d2e4e4c0e 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringConfig.py @@ -30,6 +30,7 @@ from __future__ import print_function ## See python/JetMonitoringExample.py for usage of the system import six +from AthenaCommon import SystemOfUnits class ConfigDict(dict): """A python dictionnary extended so that each entry in the dict can also be accessed as @@ -190,7 +191,7 @@ class VarSpec(ToolSpec): def __init__(self, Name , Type='float', Index=-1, Scale=1): # by default we allow only the properties of a JetHistoVarTool if Name.endswith(':GeV'): - Scale=0.001 + Scale=1./SystemOfUnits.GeV Name = Name[:-4] diff --git a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringHistos.py b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringHistos.py index 8766d4d3de2bfcf8f3b0cbabbf03aee7e4f0f4a5..0acde657ae3431c2dfbf54bcc63515bea4965a5f 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringHistos.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringHistos.py @@ -27,12 +27,6 @@ def commonMonitoringTool(container, refcontainer="", pathSuffix=''): # Draw a set of histo for a particular jet selection : selectionAndHistos( "leadingjet" , [ "basickinematics", ] ), selectionAndHistos( "subleadingjet" , [ "basickinematics"] ), - selectionAndHistos( "20000<pt<500000" , [ "allkinematics", "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", "AverageLArQF", "N90Constituents", "SumPtTrkPt500[0]", "FracSamplingMax"], "highpt_20_500" ), - selectionAndHistos( "500000<pt<1000000" , [ "allkinematics", "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", "AverageLArQF", "N90Constituents", "SumPtTrkPt500[0]", "FracSamplingMax"], "highpt_500_1000" ), - selectionAndHistos( "1000000<pt<2000000" , [ "allkinematics", "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", "AverageLArQF", "N90Constituents", "SumPtTrkPt500[0]", "FracSamplingMax"], "highpt_1000_2000" ), - selectionAndHistos( "2000000<pt<8000000" , [ "allkinematics", "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", "AverageLArQF", "N90Constituents", "SumPtTrkPt500[0]", "FracSamplingMax"], "highpt_2000_8000" ), - selectionAndHistos( "LooseBadJets" , [ "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", JetKinematicHistos("kinematics",PlotOccupancy=True, PlotAveragePt=True, PlotAverageE=True, PlotNJet=True)]), - selectionAndHistos( "1.0<eta<1.4" , [ "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", JetKinematicHistos("kinematicsTileGap",PlotOccupancy=True, PlotAveragePt=True, PlotAverageE=True, PlotNJet=True)], "eta_1_14" ), jhm.Width, @@ -94,6 +88,14 @@ def commonMonitoringTool(container, refcontainer="", pathSuffix=''): jhm.TileGap1, jhm.TileGap2, jhm.TileGap3, + + + selectionAndHistos( "20000<pt<500000" , [ "allkinematics", "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", "AverageLArQF", "N90Constituents", "SumPtTrkPt500[0]", "FracSamplingMax"], "highpt_20_500" ), + selectionAndHistos( "500000<pt<1000000" , [ "allkinematics", "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", "AverageLArQF", "N90Constituents", "SumPtTrkPt500[0]", "FracSamplingMax"], "highpt_500_1000" ), + selectionAndHistos( "1000000<pt<2000000" , [ "allkinematics", "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", "AverageLArQF", "N90Constituents", "SumPtTrkPt500[0]", "FracSamplingMax"], "highpt_1000_2000" ), + selectionAndHistos( "2000000<pt<8000000" , [ "allkinematics", "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", "AverageLArQF", "N90Constituents", "SumPtTrkPt500[0]", "FracSamplingMax"], "highpt_2000_8000" ), + selectionAndHistos( "LooseBadJets" , [ "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", JetKinematicHistos("kinematics",PlotOccupancy=True, PlotAveragePt=True, PlotAverageE=True, PlotNJet=True)]), + selectionAndHistos( "1.0<eta<1.4" , [ "ptN", "Timing", "EMFrac", "HECFrac", "LArQuality", JetKinematicHistos("kinematicsTileGap",PlotOccupancy=True, PlotAveragePt=True, PlotAverageE=True, PlotNJet=True)], "eta_1_14" ), ] if jetFlags.useTracks: @@ -113,7 +115,8 @@ def commonMonitoringTool(container, refcontainer="", pathSuffix=''): # efficiency filler.HistoTools += [jhm.effresponse,] filler.HistoTools['effresponse'].RefContainer = refcontainer - + elif "PFlow" in container: + pass #filler.OutputLevel =2 return filler @@ -136,6 +139,7 @@ def commonMonitoringTool_LB(container, refcontainer="", pathSuffix=''): athenaMonTool = JetMonitoringTool(HistoTools = [ commonMonitoringTool( "AntiKt4LCTopoJets" ), # if truth is present, we could add : , "AntiKt4TruthJets" , commonMonitoringTool( "AntiKt4EMTopoJets" ), commonMonitoringTool( "AntiKt10LCTopoJets" ), + commonMonitoringTool( "AntiKt4EMPFlowJets" ), ], IntervalType = 6,) # 6 is 'Interval_t::run' interval if monitorTracks : diff --git a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringStandard.py b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringStandard.py index 802efba4ee32353ede4c950f23c2f0ec9f5aacb4..6a8d9200a3048abb869f782dd6ef6be3a0f13ac1 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetMonitoringStandard.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetMonitoringStandard.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # '''@file JetMonitoringExample.py @@ -8,86 +8,125 @@ @brief Main python configuration for the Run III Jet Monitoring ''' +from __future__ import print_function +from JetMonitoring.JetMonitoringConfig import JetMonAlgSpec, HistoSpec, SelectSpec, ToolSpec -def jetMonAntiKt4LCTopo(): - '''Sets-up AntiKt4 monitoring.''' +# ********************************************* +# Define a list of histograms we want to draw for all jet containers. +# Write this list as a list of Jet histo specifications. Read comments below for details on specifications +commonHistoSpecs = [ + # Specification can be simple string. + # in this case they are aliases to standard spec has defined in JetStandardHistoSpecs.knownHistos + "pt", + "highpt", + "m", + "eta", + + "leadingJetsRel", - # Declare a configuration dictionnary for a JetContainer - from JetMonitoring.JetMonitoringConfig import JetMonAlgSpec, HistoSpec, SelectSpec, ToolSpec - - # we use a specialized dictionnary (JetMonAlgSpec) which will be translated into the final C++ tool - ak4conf = JetMonAlgSpec( - "ak4lcMon", - JetContainerName = "AntiKt4LCTopoJets", - # TriggerChain = '' , --> no trigger filter yet. - ) + # or we can directly add our custom histo specification in the form of a HistoSpec + # (HistoSpec is nothing more than a specialized python dictionnary) + HistoSpec('HECFrac', (50,-0.1,1.4), title="HEC E fraction;HEC frac;" ), + # the basic call is : HistoSpec( variable, histobins, title='histotile;xtitle,ytitle') - # Now start filling the histo spec list - ak4conf.appendHistos( - # This python list can be filled with various type of entries : - # We can give aliases of standard spec : - "pt", - "highpt", - "m", - "eta", - - "leadingJetsRel", - + # 2D histos, by concatenating 1D histo speficications : + "pt;m", + "pt;eta", - # or we can directly add our custom histo specification in the form of a HistoSpec : - HistoSpec('HECFrac', (50,-0.1,1.4), title="HEC E fraction;HEC frac;" ), - # the basic call is : HistoSpec( variable, histobins, title='histotile;xtitle,ytitle') - - # 2D histos - "pt;m", - "pt;eta", + # TProfile2D : just use 3 variables. For now the sytem will automatically + # interpret it as a TProfile2D (the 3rd variable being profiled) + "phi;eta;e", # --> Average Energy vs pt and eta + # Histograms build from a selection of filtered jets. + # Use a SelectSpec dictionary to define the selection, and the histo to be drawn from it. + SelectSpec( 'central', # the name of the selection + '|eta|<0.5', # selection expression. The form 'min<var<max' is automatically interpreted. - # TProfile2D : just use 3 variables. For now the sytem will automatically - # interpret it as a TProfile2D (the 3rd variable being profiled) - "phi;eta;e", # --> Average Energy vs pt and eta + FillerTools = [ + "pt", + "m", + "eta", + ] ), - - # Histograms build from a selection of filtered jets. - SelectSpec( 'central', # the name of the selection - '|eta|<0.5', # selection expression. The form 'min<var<max' is automatically interpreted. - - FillerTools = [ - "pt", - "m", - "eta", - ] ), - - # another selection : only sub-leading jets - SelectSpec( 'subleading', - '', # no selection on variables - SelectedIndex=1, # force 2nd (sub-leading) jet (we would set 0 for leading jets) - path='standardHistos', # force the path where the histos are saved in the final ROOT file - FillerTools = [ - "pt", - "m", - ] ), - - - SelectSpec( 'highJVF', - '0.3<JVF[0]', # JVF is a vector<float> for each jets. Here we cut on the 0th entry of this vector - FillerTools = [ - "pt", - ] ), - # Selecting jets passing the LooseBad selection from the JetCleaningTool. - SelectSpec( 'LooseBadJets', - 'LooseBad', # this is not in the form 'min<x<max', so it will be assumed 'LooseBad' is an entry existing in JetStandardHistoSpecs.knownSelector - FillerTools = [ - "pt", - ] ), + # another selection : only leading jets + SelectSpec( 'leading', + '', # no selection on variables + SelectedIndex=0, # force 1st (leading) jet (we would set 1 for sub-leading jets) + path='standardHistos', # force the path where the histos are saved in the final ROOT file + FillerTools = [ + "pt", + "m", + ] ), + + + SelectSpec( 'highJVF', + '0.3<JVF[0]', # JVF is a vector<float> for each jets. Here we cut on the 0th entry of this vector + FillerTools = [ + "pt", + ] ), + # Selecting jets passing the LooseBad selection from the JetCleaningTool. + SelectSpec( 'LooseBadJets', + 'LooseBad', # this is not in the form 'min<x<max', so it will be assumed 'LooseBad' is an entry existing in JetStandardHistoSpecs.knownSelector + FillerTools = [ + "pt", + ] ), + + ] + + +topoHistosSpec = [ + # histos common to all topo jets + # to be filled ... +] + +pflowHistosSpec = [ + # histos common to all PFlow jets + # to be filled ... +] + +def jetMonAlgConfig( jetName, truthJetName='', trigger=''): + """returns a specification of a JetMonitoringAlg (in the form of a JetMonAlgSpec dictionnary). + """ + + # we use a specialized dictionnary (JetMonAlgSpec) which will be translated into the final C++ tool + jetAlgConfig = JetMonAlgSpec( + jetName+"MonAlg", + JetContainerName = jetName, + TriggerChain = trigger , ) - return ak4conf + + # the list of histos specifications + histoSpecs = [] + + # then add pre-defined lists as defined above : + histoSpecs += commonHistoSpecs + + if 'Topo' in jetName: + histoSpecs += topoHistosSpec + if 'PFlow' in jetName: + histoSpecs += pflowHistosSpec + + + if truthJetName != "" : + # then add histos showing efficiency and pT responses vs True + from JetMonitoring.JetStandardHistoSpecs import responseAndEffSpecMap + if truthJetName not in responseAndEffSpecMap: + print( "ERROR !! can't schedule a JetHistoResponseAndEff for truth container : ",truthJetName, ". No specification available" ) + return None + + histoSpecs +=[ responseAndEffSpecMap[truthJetName] ] + + # finally all all histos specs to our JetMonitoringAlg specification : + jetAlgConfig.appendHistos( * histoSpecs) + + return jetAlgConfig + @@ -96,13 +135,23 @@ def jetMonAntiKt4LCTopo(): def standardJetMonitoring(inputFlags): """Standard jet monitoring function to be inserted from top-level algs. returns an a component accumulator as given by AthMonitorCfgHelper.result() - Details of what goes into jet monitoring will be implemented by dedicated functions such as jetMonAntiKt4LCTopo(). + Details of what goes into jet monitoring is implemented by dedicated functions such as jetMonAlgConfig(). """ from AthenaMonitoring import AthMonitorCfgHelper helper = AthMonitorCfgHelper(inputFlags,'JetMonitoring') - ak4conf = jetMonAntiKt4LCTopo() - ak4conf.toAlg(helper) # adds the ak4conf as a JEtMonitoringAlg to the helper + + # create a list of JetMonitoringAlg specifications + jetAlgConfs = [ + # use the helper function defined above : + jetMonAlgConfig( "AntiKt4LCTopoJets", ), + #jetMonAlgConfig( "AntiKt4LCTopoJets", truthJetName="AntiKt4TruthJets"), #How can we make sure truth jets are available ?? + jetMonAlgConfig( "AntiKt4EMPFlowJets"), + ] + + # schedule each JetMonitoringAlg by invoking the toAlg() methods of the config specification + for conf in jetAlgConfs: + conf.toAlg(helper) # adds the conf as a JetMonitoringAlg to the helper return helper.result() # the AthMonitorCfgHelper returns an accumulator to be used by the general configuration system. diff --git a/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py b/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py index c116f87fa80282b079b953e879d3f9725cbc2480..9829876d4148ed1511713afabef5a946ba913848 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetStandardHistoSpecs.py @@ -1,6 +1,6 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +from AthenaCommon import SystemOfUnits from JetMonitoring.JetMonitoringConfig import HistoSpec, VarSpec, ConfigDict, ToolSpec # *********************************************** @@ -220,6 +220,35 @@ _knownHistos += [ + +# -- JetHistoResponseAndEff specification +# this tools allows to plot a fixed set of efficiency and response histos vs truth (or any other reference container). +# The python helper defining the histograms using the monitoring framework : +def defineHistoForRespAndEff(conf, parentAlg, monhelper , path): + # create a monitoring group with the histo path starting from the parentAlg + group = monhelper.addGroup(parentAlg, conf.Group, 'Jets/'+parentAlg.JetContainerName) + path = 'standardHistos' + # define the histogram + group.defineHistogram('passDr1,refPt;efficiencyR1',title='Passing deltaR<0.1', type="TEfficiency", path=path, xbins=100 , xmin=0, xmax=4000. ,) + group.defineHistogram('passDr2,refPt;efficiencyR2',title='Passing deltaR<0.2', type="TEfficiency", path=path, xbins=100 , xmin=0, xmax=4000. ,) + group.defineHistogram('passDr3,refPt;efficiencyR3',title='Passing deltaR<0.3', type="TEfficiency", path=path, xbins=100 , xmin=0, xmax=4000. ,) + group.defineHistogram('relDiff',title='pT relative Diff', type="TH1F", path=path, xbins=100 , xmin=-2, xmax=2. ,) + group.defineHistogram('refEta,relDiff',title='pT relative Diff vs Eta', type="TH2F", path=path, xbins=60 , xmin=-5, xmax=5., ybins=60 , ymin=-2, ymax=2. ,) + group.defineHistogram('refPt,relDiff',title='pT relative Diff vs pT', type="TH2F", path=path, xbins=60 , xmin=0, xmax=5000., ybins=60 , ymin=-2, ymax=2. ,) + +_knownHistos += [ + ToolSpec('JetHistoResponseAndEff', 'respVsAntiKt4Truth', defineHistoFunc=defineHistoForRespAndEff, Group='AntiK4TruthRespGroup', RefContainerName="AntiKt4TruthJets", EnergyScale=1./SystemOfUnits.GeV), + ToolSpec('JetHistoResponseAndEff', 'respVsAntiKt10TruthTrim', defineHistoFunc=defineHistoForRespAndEff, Group='AntiK10TruthTrimRespGroup', RefContainerName="AntiKt10TruthTrimmedPtFrac5SmallR20Jets", EnergyScale=1./SystemOfUnits.GeV), +] +# purely for convenience we add a map of JetContainer name -> JetHistoResponseAndEff spec +responseAndEffSpecMap = dict( + AntiKt4TruthJets = 'respVsAntiKt4Truth', + AntiKt10TruthTrimmedPtFrac5SmallR20Jets = 'respVsAntiKt10TruthTrim', + ) + + + + # -- knownHistos = ConfigDict( ) # convert the list into a dictionnary indexed by spec name diff --git a/Reconstruction/Jet/JetMonitoring/src/JetHistoLeadingJetsRelations.cxx b/Reconstruction/Jet/JetMonitoring/src/JetHistoLeadingJetsRelations.cxx index 2e0ff060e4aa7e6b59a56be69fcb5d7d05b5a7dd..86fe348ce3cb8f830fa6104aff8d9431af57bf70 100644 --- a/Reconstruction/Jet/JetMonitoring/src/JetHistoLeadingJetsRelations.cxx +++ b/Reconstruction/Jet/JetMonitoring/src/JetHistoLeadingJetsRelations.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "AthenaMonitoringKernel/GenericMonitoringTool.h" @@ -10,43 +10,14 @@ JetHistoLeadingJetsRelations::JetHistoLeadingJetsRelations( const std::string& type, const std::string & name ,const IInterface* parent): AthAlgTool( type, name, parent ) - // IJetHIstoFiller() - // , m_varX(this) - // , m_varY(this) - // , m_varZ(this) { declareInterface<IJetHistoFiller>(this); - - // declareProperty("VarX",m_varX); - // declareProperty("VarY",m_varY); - // declareProperty("VarZ",m_varZ); } StatusCode JetHistoLeadingJetsRelations::initialize() { - // ATH_MSG_INFO(" initialize " << m_varX.isEnabled()); - - // ATH_CHECK(m_varX.retrieve() ); - - /* - m_nVar = 1; - if( ! m_varY.isEnabled() ){ - ATH_MSG_INFO( "Filling 1 var X=("<< m_varX->describe() << ")"); - }else { // has Y variable - ATH_CHECK(m_varY.retrieve() ); - m_nVar = 2; - if ( ! m_varZ.isEnabled()) { - ATH_MSG_INFO( "Filling 2 vars X=("<< m_varX->describe() << ") Y=("<<m_varY->describe() << ")"); - }else{ - ATH_CHECK(m_varZ.retrieve() ); - m_nVar = 3; - ATH_MSG_INFO( "Filling 3 vars X=("<< m_varX->describe() << ") Y=("<<m_varY->describe() << ") Z=("<<m_varZ->describe() << ")"); - } - - } - */ return StatusCode::SUCCESS; } diff --git a/Reconstruction/Jet/JetMonitoring/src/JetHistoResponseAndEff.cxx b/Reconstruction/Jet/JetMonitoring/src/JetHistoResponseAndEff.cxx new file mode 100644 index 0000000000000000000000000000000000000000..4e7ac08ee6fd743221b63762b541d33544311112 --- /dev/null +++ b/Reconstruction/Jet/JetMonitoring/src/JetHistoResponseAndEff.cxx @@ -0,0 +1,89 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "AthenaMonitoringKernel/GenericMonitoringTool.h" +#include "JetMonitoring/JetHistoResponseAndEff.h" + +#include "JetMonitoring/JetMonitoringAlg.h" +#include "FourMomUtils/xAODP4Helpers.h" + +JetHistoResponseAndEff::JetHistoResponseAndEff( const std::string& type, const std::string & name ,const IInterface* parent): + AthAlgTool( type, name, parent ), + m_refContainerKey("REFCONTAINER") +{ + declareInterface<IJetHistoFiller>(this); + declareProperty("RefContainerName",m_refContainerKey); +} + + +StatusCode JetHistoResponseAndEff::initialize() { + ATH_CHECK( m_refContainerKey.initialize() ); + ATH_MSG_DEBUG(" initialize "<< m_refContainerKey.key()); + return StatusCode::SUCCESS; +} + + +StatusCode JetHistoResponseAndEff::processJetContainer(const JetMonitoringAlg& parentAlg, const xAOD::JetContainer & jets, const EventContext& ctx ) const { + if(jets.empty()) return StatusCode::SUCCESS; + + // retrieve the reference jet container (typically : truth jets) + SG::ReadHandle<xAOD::JetContainer> refJets(m_refContainerKey, ctx); + if (! refJets.isValid() ) { + ATH_MSG_ERROR("evtStore() does not contain jet Collection with name "<< m_refContainerKey.key()); + return StatusCode::FAILURE; + } + + + // declare the variables to be monitored by the framework + Monitored::Scalar<float> refPt("refPt"); + Monitored::Scalar<float> refEta("refEta"); + Monitored::Scalar<float> relDiff("relDiff"); + Monitored::Scalar<float> closestDr("closestDr"); + Monitored::Scalar<bool> passDr1("passDr1"); + Monitored::Scalar<bool> passDr2("passDr2"); + Monitored::Scalar<bool> passDr3("passDr3"); + + + // use a list to be a bit more efficient. + std::list<const xAOD::Jet*> listJets(jets.begin(), jets.end()); + + for ( const xAOD::Jet* refjet : *refJets ){ + double dr2min = 500000; + + if (listJets.empty() ) break; + // find the min match + std::list<const xAOD::Jet*>::iterator it=listJets.begin(); + std::list<const xAOD::Jet*>::iterator itmin=listJets.end(); + for( ; it != listJets.end(); ++it) { + double dr2 = xAOD::P4Helpers::deltaR2(*(*it),*refjet); + if(dr2 < dr2min) { dr2min = dr2; itmin = it ;} + } + + // calculate efficiency and response from matched jet + const xAOD::Jet* matched = *itmin; + listJets.erase(itmin); + + double dr = sqrt(dr2min); + refPt = refjet->pt() * m_energyScale; + closestDr = dr; + + // Set flag passDrX if (reco,truth) jets are closer than deltaR=0.X + passDr1 = dr<0.1; + passDr2 = dr<0.2; + passDr3 = dr<0.3; + // using these flags, the framework will fill 3 TEfficiency to draw ( efficiency_at_drX vs pT) (see also configuration) : + parentAlg.fill(m_group, refPt , passDr1, passDr2, passDr3 , closestDr); + + if( dr < 0.3) { + relDiff = ( matched->pt()* m_energyScale - refPt )/refPt; + refEta = refjet->eta(); + parentAlg.fill(m_group, refPt , refEta, relDiff ); + } + + } + + return StatusCode::SUCCESS; +} + + diff --git a/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx b/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx index 584056a1bc0a4ef3aee964bf13395d0d97a99f26..fa5c644f972ce9f7e5ce8cd40204c56ef8da4427 100644 --- a/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx +++ b/Reconstruction/Jet/JetMonitoring/src/components/JetMonitoring_entries.cxx @@ -16,6 +16,7 @@ #include "JetMonitoring/JetHistoTriggEfficiency.h" #include "JetMonitoring/JetHistoVarTool.h" #include "JetMonitoring/JetHistoSelectSort.h" +#include "JetMonitoring/JetHistoResponseAndEff.h" #include "JetMonitoring/JetSelectorAttributeRunII.h" @@ -39,6 +40,7 @@ DECLARE_COMPONENT( JetHistoTriggEfficiency) DECLARE_COMPONENT( JetHistoAttributeFiller) DECLARE_COMPONENT( JetHistoSelectSort) DECLARE_COMPONENT( JetHistoVarTool) +DECLARE_COMPONENT( JetHistoResponseAndEff) DECLARE_COMPONENT( JetAttributeHisto ) diff --git a/Reconstruction/Jet/JetRec/python/JetToolSupport.py b/Reconstruction/Jet/JetRec/python/JetToolSupport.py index 45b155247ad0d03c7196c51472f77033b5e04f9e..f6d198b4debe2d0d9055e81cb7bbb94b294574c4 100644 --- a/Reconstruction/Jet/JetRec/python/JetToolSupport.py +++ b/Reconstruction/Jet/JetRec/python/JetToolSupport.py @@ -139,8 +139,17 @@ class JetToolManager: self.msg(0, "Error adding jet builder without area.") raise LookupError + # Configures any tools in the given modifier list with the property + # "JetContainer" to set that property to the given string containerName. + def configureContainerName(self, modifiers, containerName): + for mod in modifiers: + if "JetContainer" in mod.properties(): + print ("configuring " + mod.name() + " to have container name " + containerName) + mod.JetContainer = containerName + # Return the list of modifiers associated with a name. - # If the argument is a list, it is returned directly. + # If the argument is a list, a copy is returned directly. + # Also configures any necessary container names in the copy. def getModifiers(self, modifiersin, altname =None): if modifiersin == None: if altname in ["lctopo","emtopo"]: @@ -290,7 +299,6 @@ class JetToolManager: jetlog.info( self.prefix + "Calibration option (" + calibOpt + ") provided with multiple calibration modifiers." ) raise Exception - return outmods # Create a jet finder without a JetRecToosl. @@ -411,6 +419,7 @@ class JetToolManager: ptminSave = self.ptminFilter if ptminFilter > 0.0: self.ptminFilter = ptminFilter jetrec.JetModifiers = self.buildModifiers(modifiersin, lofinder, getters, gettersin, output, calibOpt) + self.configureContainerName(jetrec.JetModifiers, output) if consumers != None: jetrec.JetConsumers = consumers self.ptminFilter = ptminSave @@ -458,6 +467,7 @@ class JetToolManager: jetrec.InputContainer = input jetrec.OutputContainer = output jetrec.JetModifiers = self.getModifiers(modifiersin) + self.configureContainerName(jetrec.JetModifiers, output) jetrec.Trigger = isTrigger or useTriggerStore jetrec.Timer = jetFlags.timeJetRecTool() self += jetrec @@ -492,6 +502,7 @@ class JetToolManager: jetrec.InputContainer = input jetrec.OutputContainer = output jetrec.JetModifiers = self.getModifiers(modifiersin) + self.configureContainerName(jetrec.JetModifiers, output) jetrec.Trigger = isTrigger or useTriggerStore jetrec.Timer = jetFlags.timeJetRecTool() if pseudojetRetriever in self.tools: @@ -539,6 +550,7 @@ class JetToolManager: jetrec.InputContainer = input jetrec.OutputContainer = output jetrec.JetModifiers = self.getModifiers(modifiersin) + self.configureContainerName(jetrec.JetModifiers, output) jetrec.Trigger = isTrigger or useTriggerStore jetrec.Timer = jetFlags.timeJetRecTool() self += jetrec @@ -597,6 +609,7 @@ class JetToolManager: jetrec.OutputContainer = output jetrec.JetGroomer = groomer jetrec.JetModifiers = self.getModifiers(modifiersin) + self.configureContainerName(jetrec.JetModifiers, output) if consumers != None: jetrec.JetConsumers = consumers jetrec.Trigger = isTrigger or useTriggerStore @@ -628,6 +641,7 @@ class JetToolManager: Label = inp getters = [get] jetrec.JetModifiers = self.buildModifiers(modifiersin, finder, getters, None, output, calibOpt) + self.configureContainerName(jetrec.JetModifiers, output) self.ptminFilter = ptminSave jetrec.Trigger = isTrigger or useTriggerStore jetrec.Timer = jetFlags.timeJetRecTool() @@ -779,6 +793,11 @@ class JetToolManager: for m in modifiers: self.setOutputLevel(m, OutputLevel) + # Temporary hard-coded solution until this config is deprecated. + triggerPrefix = "HLT_xAOD__JetContainer_" + + self.configureContainerName(modifiers, triggerPrefix + name.split('_')[1]) + self.ptminFilter = ptminSave @@ -802,8 +821,8 @@ class JetToolManager: self += builder return builder - def addTriggerJetTrimmer(self, + output, name, rclus, ptfrac, @@ -857,6 +876,7 @@ class JetToolManager: triggerGroomerTool = TriggerJetGroomerTool(name) triggerGroomerTool.JetGroomer = trimmerTool triggerGroomerTool.JetModifiers = self.getModifiers(modifiersin) + self.configureContainerName(triggerGroomerTool.JetModifiers, name.split('_')[1]) triggerGroomerTool.OutputLevel = OutputLevel # TriggerJetGroomerTool obtains a TriggerJetGroomerTool, will pass it @@ -874,4 +894,3 @@ class JetToolManager: self.trigjetrecs += [triggerGroomerTool] return triggerGroomerTool - diff --git a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py index 71811d6aa2a1b989904a09834be6095df0892e26..08e126ccae6104fddc0ae9d257311f7e9c9a6792 100644 --- a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py +++ b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py @@ -210,6 +210,14 @@ def expandPrereqs(reqtype,prereqs): return None return reqdefs +######################################################################## +# For each modifier in the given list with a configurable input container +# name ("JetContainer"), configure it to containerName. +def configureContainerName(modifiers, containerName): + for mod in modifiers: + if "JetContainer" in mod.properties(): + mod.JetContainer = containerName + ######################################################################## # Function producing an EventShapeAlg to calculate @@ -467,6 +475,7 @@ def getJetRecTool(jetname, finder, pjs, mods): JetFinder = finder, JetModifiers = mods ) + configureContainerName(jetrec.JetModifiers, jetname) return jetrec diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/ECFHelper.h b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/ECFHelper.h new file mode 100644 index 0000000000000000000000000000000000000000..3957a0f69e6e33a9e9c0d8dc20b025c7b91cafc6 --- /dev/null +++ b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/ECFHelper.h @@ -0,0 +1,14 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef jetsubstructuremomenttools_ecfhelper_header +#define jetsubstructuremomenttools_ecfhelper_header + +#include <algorithm> +#include <string> +#include <cmath> + +std::string GetBetaSuffix(float beta); + +#endif diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorGeneralizedRatiosTool.h b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorGeneralizedRatiosTool.h index 7eb332e2cf1ec3dde4faee1469e90051fc62cd7f..c1f8a8372ac5b3068668d442aa57243f20d00ac9 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorGeneralizedRatiosTool.h +++ b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorGeneralizedRatiosTool.h @@ -1,11 +1,12 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef jetsubstructuremomenttools_energycorrelatorgeneralizedratiostool_header #define jetsubstructuremomenttools_energycorrelatorgeneralizedratiostool_header #include "JetSubStructureMomentTools/JetSubStructureMomentToolsBase.h" +#include "JetSubStructureMomentTools/ECFHelper.h" class EnergyCorrelatorGeneralizedRatiosTool : public JetSubStructureMomentToolsBase { @@ -15,9 +16,14 @@ class EnergyCorrelatorGeneralizedRatiosTool : // Constructor and destructor EnergyCorrelatorGeneralizedRatiosTool(std::string name); - int modifyJet(xAOD::Jet &jet) const; + virtual StatusCode initialize() override; + + int modifyJet(xAOD::Jet &jet) const override; private: + std::vector<float> m_betaVals; + std::vector<float> m_cleaned_betaVals; // Local vector for cleaned up inputs + }; #endif diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorGeneralizedTool.h b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorGeneralizedTool.h index ba7b54f03fecd84cb6c1b0141e257bb72d956dba..bb6b2ea1104a34070bcddd2c1c8129a1659494e3 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorGeneralizedTool.h +++ b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorGeneralizedTool.h @@ -1,11 +1,12 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef jetsubstructuremomenttools_energycorrelatorgeneralizedtool_header #define jetsubstructuremomenttools_energycorrelatorgeneralizedtool_header #include "JetSubStructureMomentTools/JetSubStructureMomentToolsBase.h" +#include "JetSubStructureMomentTools/ECFHelper.h" class EnergyCorrelatorGeneralizedTool : public JetSubStructureMomentToolsBase { @@ -15,12 +16,17 @@ class EnergyCorrelatorGeneralizedTool : // Constructor and destructor EnergyCorrelatorGeneralizedTool(std::string name); - int modifyJet(xAOD::Jet &injet) const; + virtual StatusCode initialize() override; + + int modifyJet(xAOD::Jet &injet) const override; private: float m_Beta; bool m_doN3; bool m_doLSeries; + std::vector<float> m_betaVals; + std::vector<float> m_cleaned_betaVals; // Local vector for cleaned up inputs + }; #endif diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorRatiosTool.h b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorRatiosTool.h index 93f8dca2f36fbfdedd9610a7581eca11b4c17446..45be8fc93a26c52025d3f76a79879a02b0399167 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorRatiosTool.h +++ b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorRatiosTool.h @@ -1,11 +1,12 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef jetsubstructuremomenttools_energycorrelatorratiostool_header #define jetsubstructuremomenttools_energycorrelatorratiostool_header #include "JetSubStructureMomentTools/JetSubStructureMomentToolsBase.h" +#include "JetSubStructureMomentTools/ECFHelper.h" class EnergyCorrelatorRatiosTool : public JetSubStructureMomentToolsBase { @@ -14,12 +15,15 @@ class EnergyCorrelatorRatiosTool : public: // Constructor and destructor EnergyCorrelatorRatiosTool(std::string name); + + virtual StatusCode initialize() override; - int modifyJet(xAOD::Jet &jet) const; + int modifyJet(xAOD::Jet &jet) const override; private: - bool m_includeBeta2; bool m_includeECF4; + std::vector<float> m_betaVals; + std::vector<float> m_cleaned_betaVals; // Local vector for cleaned up inputs }; diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorTool.h b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorTool.h index f3cfa3a8ffd3632e165e44f8e05d6ec04a775102..4722a5c28ef6ee2ee1c6fc2d87d4221e0d0fb320 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorTool.h +++ b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/EnergyCorrelatorTool.h @@ -1,11 +1,12 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef jetsubstructuremomenttools_energycorrelatortool_header #define jetsubstructuremomenttools_energycorrelatortool_header #include "JetSubStructureMomentTools/JetSubStructureMomentToolsBase.h" +#include "JetSubStructureMomentTools/ECFHelper.h" class EnergyCorrelatorTool : public JetSubStructureMomentToolsBase { @@ -14,14 +15,17 @@ class EnergyCorrelatorTool : public: // Constructor and destructor EnergyCorrelatorTool(std::string name); + + virtual StatusCode initialize() override; - int modifyJet(xAOD::Jet &injet) const; + int modifyJet(xAOD::Jet &injet) const override; private: float m_Beta; - bool m_includeBeta2; bool m_includeECF4; - + std::vector<float> m_betaVals; + std::vector<float> m_cleaned_betaVals; // Local vector for cleaned up inputs + }; #endif diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/JetSubStructureMomentToolsDict.h b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/JetSubStructureMomentToolsDict.h index f34f681efacaabef5cf590734a3f6c2f768e1454..443a6a261edc5f481ee527e30808eaa436db0e72 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/JetSubStructureMomentToolsDict.h +++ b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/JetSubStructureMomentToolsDict.h @@ -24,6 +24,7 @@ #include "JetSubStructureMomentTools/JetSubStructureMomentToolsBase.h" #include "JetSubStructureMomentTools/KtDeltaRTool.h" #include "JetSubStructureMomentTools/PlanarFlowTool.h" +#include "JetSubStructureMomentTools/SoftDropObservablesTool.h" #include "JetSubStructureMomentTools/SubjetMakerTool.h" #include "JetSubStructureMomentTools/CenterOfMassShapesTool.h" #include "JetSubStructureMomentTools/ISubjetRecorderTool.h" diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/SoftDropObservablesTool.h b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/SoftDropObservablesTool.h new file mode 100644 index 0000000000000000000000000000000000000000..54ed200f8535502aa866a92ae127ef629a9d86ca --- /dev/null +++ b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/SoftDropObservablesTool.h @@ -0,0 +1,23 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef jetsubstructuremomenttools_softdropobservablestool_header +#define jetsubstructuremomenttools_softdropobservablestool_header + +#include "JetSubStructureMomentTools/JetSubStructureMomentToolsBase.h" + +class SoftDropObservablesTool : + public JetSubStructureMomentToolsBase { + ASG_TOOL_CLASS(SoftDropObservablesTool, IJetModifier) + + public: + // Constructor and destructor + SoftDropObservablesTool(std::string name); + + int modifyJet(xAOD::Jet &injet) const; + +}; + + +#endif diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/selection.xml b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/selection.xml index 1517905a743797bc1bb560c665dea90275cf0fdb..a550d791081ccac4fc729c7fef8dad93783ebf59 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/selection.xml +++ b/Reconstruction/Jet/JetSubStructureMomentTools/JetSubStructureMomentTools/selection.xml @@ -18,6 +18,7 @@ <class name="PlanarFlowTool"/> <class name="QwTool"/> <class name="ShowerDeconstructionTool"/> +<class name="SoftDropObservablesTool"/> <class name="SubjetFinderTool"/> <class name="SubjetMakerTool"/> <class name="SubjetRecorderTool"/> diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/Root/ECFHelper.cxx b/Reconstruction/Jet/JetSubStructureMomentTools/Root/ECFHelper.cxx new file mode 100644 index 0000000000000000000000000000000000000000..1047c0e618c8e929357eb148b85d20a2ff80eced --- /dev/null +++ b/Reconstruction/Jet/JetSubStructureMomentTools/Root/ECFHelper.cxx @@ -0,0 +1,31 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +// ---------------------------------------------------------------- +// This is a helper function that provides the suffix for ECF and +// ECF ratio decorations. No suffix is used for beta = 1.0 and +// other values are given a suffix of _BetaN where N is the value +// with decimal points removed. This assumes beta values of [0.0,9.9] +// and that the maximum precision is 0.1. +// ---------------------------------------------------------------- + +#ifndef jetsubstructuremomenttools_ecfhelper +#define jetsubstructuremomenttools_ecfhelper + +#include "JetSubStructureMomentTools/ECFHelper.h" + +std::string GetBetaSuffix(float beta) { + std::string suffix = ""; + + // Create suffix for beta != 1.0 + // If 10*beta is used in the suffix + // As long as beta < 10, this shouldn't cause any confusion + if(fabs(beta-1.0) > 1.0e-5) { + suffix = "_Beta" + std::to_string(int(beta*10)); + } + + return suffix; +} + +#endif diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorGeneralizedRatiosTool.cxx b/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorGeneralizedRatiosTool.cxx index bb1c5d423cef5c29ea0a4e7f0383f252cdc59f4d..a3181274415a3aad76386ad9abe5450277d8c77a 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorGeneralizedRatiosTool.cxx +++ b/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorGeneralizedRatiosTool.cxx @@ -1,7 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +// ---------------------------------------------------------------- +// The default behavior of this tool is to use beta = 1.0, but multiple +// values of beta can be used simultaneously. The property BetaList +// should be passed a list of floats. Values of < 0 or > 10 may result +// in poblematic output variable names and all values will be rounded +// to the nearest 0.1. No suffix will be added to the outputs for beta = 1.0 +// and for other values a suffix of _BetaN will be added where N= 10*beta. +// ---------------------------------------------------------------- + #include "JetSubStructureMomentTools/EnergyCorrelatorGeneralizedRatiosTool.h" #include "JetSubStructureUtils/EnergyCorrelatorGeneralized.h" @@ -10,33 +19,94 @@ using fastjet::PseudoJet; EnergyCorrelatorGeneralizedRatiosTool::EnergyCorrelatorGeneralizedRatiosTool(std::string name) : JetSubStructureMomentToolsBase(name) { + declareProperty("BetaList", m_betaVals = {}); +} + +StatusCode EnergyCorrelatorGeneralizedRatiosTool::initialize() { + ATH_MSG_INFO("Initializing EnergyCorrelatorTool"); + + // Add beta = 1.0 by default + m_cleaned_betaVals.push_back(1.0); + + // Clean up input list of beta values, rounding to nearest 0.1 and removing duplicates + for(float beta : m_betaVals) { + float betaFix = round( beta * 10.0 ) / 10.0; + if( std::find(m_cleaned_betaVals.begin(), m_cleaned_betaVals.end(), betaFix) == m_cleaned_betaVals.end() ) m_cleaned_betaVals.push_back(betaFix); + } + + for(float beta : m_cleaned_betaVals) { + ATH_MSG_DEBUG("Including beta = " << beta); + } + + ATH_CHECK(JetSubStructureMomentToolsBase::initialize()); + + return StatusCode::SUCCESS; } int EnergyCorrelatorGeneralizedRatiosTool::modifyJet(xAOD::Jet &jet) const { - if (!jet.isAvailable<float>(m_prefix+"ECFG_2_1") || - !jet.isAvailable<float>(m_prefix+"ECFG_3_2") || - !jet.isAvailable<float>(m_prefix+"ECFG_4_2") || - !jet.isAvailable<float>(m_prefix+"ECFG_3_1") || + for(float beta : m_cleaned_betaVals) { + std::string suffix = GetBetaSuffix(beta); + + if (!jet.isAvailable<float>(m_prefix+"ECFG_2_1"+suffix)) { + ATH_MSG_WARNING("Energy correlation function " << m_prefix << "ECFG_2_1" << suffix << "' is not available. Exiting.."); + return 1; + } + + if (!jet.isAvailable<float>(m_prefix+"ECFG_3_1"+suffix)) { + ATH_MSG_WARNING("Energy correlation function " << m_prefix << "ECFG_3_1" << suffix << "' is not available. Exiting.."); + return 1; + } + + if (!jet.isAvailable<float>(m_prefix+"ECFG_3_2"+suffix)) { + ATH_MSG_WARNING("Energy correlation function " << m_prefix << "ECFG_3_2" << suffix << "' is not available. Exiting.."); + return 1; + } + + if (!jet.isAvailable<float>(m_prefix+"ECFG_4_2"+suffix)) { + ATH_MSG_WARNING("Energy correlation function " << m_prefix << "ECFG_4_2" << suffix << "' is not available. Exiting.."); + return 1; + } + + float ecfg_2_1 = jet.getAttribute<float>(m_prefix+"ECFG_2_1"+suffix); + float ecfg_3_2 = jet.getAttribute<float>(m_prefix+"ECFG_3_2"+suffix); + + float ecfg_4_2 = jet.getAttribute<float>(m_prefix+"ECFG_4_2"+suffix); + float ecfg_3_1 = jet.getAttribute<float>(m_prefix+"ECFG_3_1"+suffix); + + // N2 + + if(ecfg_2_1 > 1e-8) // Prevent div-0 + jet.setAttribute(m_prefix+"N2"+suffix, ecfg_3_2 / (pow(ecfg_2_1, 2.0))); + else + jet.setAttribute(m_prefix+"N2"+suffix, -999.0); + + // N3 + if(ecfg_3_1 > 1e-8) // Prevent div-0 + jet.setAttribute(m_prefix+"N3"+suffix, ecfg_4_2 / (pow(ecfg_3_1, 2.0))); + else + jet.setAttribute(m_prefix+"N3"+suffix, -999.0); - !jet.isAvailable<float>(m_prefix+"ECFG_2_1_2") || + // M2 + if(ecfg_2_1 > 1e-8) // Prevent div-0 + jet.setAttribute(m_prefix+"M2"+suffix, ecfg_3_2 / ecfg_2_1); + else + jet.setAttribute(m_prefix+"M2"+suffix, -999.0); + + } + + // These are for t/H discrimination + if (!jet.isAvailable<float>(m_prefix+"ECFG_2_1_2") || !jet.isAvailable<float>(m_prefix+"ECFG_3_1_1") || !jet.isAvailable<float>(m_prefix+"ECFG_3_2_1") || !jet.isAvailable<float>(m_prefix+"ECFG_3_2_2") || !jet.isAvailable<float>(m_prefix+"ECFG_4_2_2") || !jet.isAvailable<float>(m_prefix+"ECFG_3_3_1") || !jet.isAvailable<float>(m_prefix+"ECFG_4_4_1")) { - ATH_MSG_WARNING("Energy correlation fractions with prefix '"<<m_prefix<<"' are not all available. Exiting.."); + ATH_MSG_WARNING("L series energy correlation functions with prefix '" << m_prefix << "' are not all available. Exiting.."); return 1; } - - float ecfg_2_1 = jet.getAttribute<float>(m_prefix+"ECFG_2_1"); - float ecfg_3_2 = jet.getAttribute<float>(m_prefix+"ECFG_3_2"); - float ecfg_4_2 = jet.getAttribute<float>(m_prefix+"ECFG_4_2"); - float ecfg_3_1 = jet.getAttribute<float>(m_prefix+"ECFG_3_1"); - - // these ones for t/H discrimination float ecfg_2_1_2 = jet.getAttribute<float>(m_prefix+"ECFG_2_1_2"); float ecfg_3_1_1 = jet.getAttribute<float>(m_prefix+"ECFG_3_1_1"); float ecfg_3_2_1 = jet.getAttribute<float>(m_prefix+"ECFG_3_2_1"); @@ -45,67 +115,48 @@ int EnergyCorrelatorGeneralizedRatiosTool::modifyJet(xAOD::Jet &jet) const { float ecfg_3_3_1 = jet.getAttribute<float>(m_prefix+"ECFG_3_3_1"); float ecfg_4_4_1 = jet.getAttribute<float>(m_prefix+"ECFG_4_4_1"); - // N2 - - if(ecfg_2_1 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"N2", ecfg_3_2 / (pow(ecfg_2_1, 2.0))); - else - jet.setAttribute(m_prefix+"N2", -999.0); - - // N3 - if(ecfg_3_1 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"N3", ecfg_4_2 / (pow(ecfg_3_1, 2.0))); - else - jet.setAttribute(m_prefix+"N3", -999.0); - - // M2 - if(ecfg_2_1 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"M2", ecfg_3_2 / ecfg_2_1); - else - jet.setAttribute(m_prefix+"M2", -999.0); - // L-series variables // (experimental for ttH t/H discrimination) /* - The exponents are determined in order to make - the whole thing dimensionless - - E = (a*n) / (b*m) - for an ECFG_X_Y_Z, a=Y, n=Z - - e.g. for L1 - - ecfg_3_3_1 / ecfg_2_1_2 - E = (3*1) / (1*2) = 3./2. - */ + The exponents are determined in order to make + the whole thing dimensionless + + E = (a*n) / (b*m) + for an ECFG_X_Y_Z, a=Y, n=Z + + e.g. for L1 + + ecfg_3_3_1 / ecfg_2_1_2 + E = (3*1) / (1*2) = 3./2. + */ if(ecfg_2_1_2 > 1e-8) // Prevent div-0 - { - jet.setAttribute(m_prefix+"L1", ecfg_3_2_1 / (pow(ecfg_2_1_2, (1.) ))); - jet.setAttribute(m_prefix+"L2", ecfg_3_3_1 / (pow(ecfg_2_1_2, (3./2.) ))); - } + { + jet.setAttribute(m_prefix+"L1", ecfg_3_2_1 / (pow(ecfg_2_1_2, (1.) ))); + jet.setAttribute(m_prefix+"L2", ecfg_3_3_1 / (pow(ecfg_2_1_2, (3./2.) ))); + } else - { - jet.setAttribute(m_prefix+"L1",-999.0); - jet.setAttribute(m_prefix+"L2",-999.0); - } + { + jet.setAttribute(m_prefix+"L1",-999.0); + jet.setAttribute(m_prefix+"L2",-999.0); + } if(ecfg_3_3_1 > 1e-8) // Prevent div-0 - { - jet.setAttribute(m_prefix+"L3", ecfg_3_1_1 / (pow(ecfg_3_3_1, (1./3.) )) ); - jet.setAttribute(m_prefix+"L4", ecfg_3_2_2 / (pow(ecfg_3_3_1, (4./3.) )) ); - } + { + jet.setAttribute(m_prefix+"L3", ecfg_3_1_1 / (pow(ecfg_3_3_1, (1./3.) )) ); + jet.setAttribute(m_prefix+"L4", ecfg_3_2_2 / (pow(ecfg_3_3_1, (4./3.) )) ); + } else - { - jet.setAttribute(m_prefix+"L3",-999.0); - jet.setAttribute(m_prefix+"L4",-999.0); - } + { + jet.setAttribute(m_prefix+"L3",-999.0); + jet.setAttribute(m_prefix+"L4",-999.0); + } if(ecfg_4_4_1 > 1e-8) // Prevent div-0 jet.setAttribute(m_prefix+"L5", ecfg_4_2_2 / (pow(ecfg_4_4_1, (1.) )) ); else jet.setAttribute(m_prefix+"L5",-999.0); - + return 0; } diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorGeneralizedTool.cxx b/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorGeneralizedTool.cxx index 992f0a615fb5cfa5f80d13665f5e245aba7bf68f..25ee66b73ba21d74d901c49295a8de87722c7b93 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorGeneralizedTool.cxx +++ b/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorGeneralizedTool.cxx @@ -1,7 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +// ---------------------------------------------------------------- +// The default behavior of this tool is to use beta = 1.0, but multiple +// values of beta can be used simultaneously. The property BetaList +// should be passed a list of floats. Values of < 0 or > 10 may result +// in poblematic output variable names and all values will be rounded +// to the nearest 0.1. No suffix will be added to the outputs for beta = 1.0 +// and for other values a suffix of _BetaN will be added where N= 10*beta. +// ---------------------------------------------------------------- + #include "JetSubStructureMomentTools/EnergyCorrelatorGeneralizedTool.h" #include "JetSubStructureUtils/EnergyCorrelatorGeneralized.h" #include "JetSubStructureUtils/EnergyCorrelator.h" @@ -12,48 +21,88 @@ EnergyCorrelatorGeneralizedTool::EnergyCorrelatorGeneralizedTool(std::string nam JetSubStructureMomentToolsBase(name) { ATH_MSG_DEBUG("Initializing EnergyCorrelatorGeneralized tool"); - declareProperty("Beta", m_Beta = 1.0); + declareProperty("Beta", m_Beta = 1.0); + declareProperty("BetaList", m_betaVals = {}); declareProperty("DoN3", m_doN3 = false); declareProperty("DoLSeries", m_doLSeries = false); } +StatusCode EnergyCorrelatorGeneralizedTool::initialize() { + ATH_MSG_INFO("Initializing EnergyCorrelatorTool"); + + // Add beta = 1.0 by default + m_cleaned_betaVals.push_back(1.0); + + // Add beta = m_Beta by default to keep backwards compatibility + if( fabs(m_Beta-1.0) > 1.0e-5 ) m_cleaned_betaVals.push_back(m_Beta); + + // Clean up input list of beta values, rounding to nearest 0.1 and removing duplicates + for(float beta : m_betaVals) { + float betaFix = round( beta * 10.0 ) / 10.0; + if( std::find(m_cleaned_betaVals.begin(), m_cleaned_betaVals.end(), betaFix) == m_cleaned_betaVals.end() ) m_cleaned_betaVals.push_back(betaFix); + } + + for(float beta : m_cleaned_betaVals) { + ATH_MSG_DEBUG("Including beta = " << beta); + } + + ATH_CHECK(JetSubStructureMomentToolsBase::initialize()); + + return StatusCode::SUCCESS; +} + int EnergyCorrelatorGeneralizedTool::modifyJet(xAOD::Jet &injet) const { fastjet::PseudoJet jet; bool decorate = SetupDecoration(jet,injet); - // These are necessary for N2 and M2 - float ECFG_2_1_value = -999, ECFG_3_2_value = -999; - - // These are necessary for N3 - float ECFG_3_1_value = -999, ECFG_4_2_value = -999; + for(float beta : m_cleaned_betaVals) { - // These are for t/H discrimination - float ECFG_3_3_2_value = -999, ECFG_3_2_2_value = -999, ECFG_3_3_1_value = -999, - ECFG_4_2_2_value = -999, ECFG_4_4_1_value = -999, ECFG_2_1_2_value = -999, ECFG_3_2_1_value = -999, - ECFG_3_1_1_value = -999; - // N.B. ECFG_angles_n_beta !! + std::string suffix = GetBetaSuffix(beta); - if (decorate) { + // These are used for N2 and M2 + float ECFG_2_1_value = -999, ECFG_3_2_value = -999; + + // These are used for N3 + float ECFG_3_1_value = -999, ECFG_4_2_value = -999; + + if (decorate) { + + // These are used for N2 and M2 - // These are necessary for N2 and M2 + JetSubStructureUtils::EnergyCorrelatorGeneralized ECFG_3_2(2, 3, beta, JetSubStructureUtils::EnergyCorrelator::pt_R); + JetSubStructureUtils::EnergyCorrelatorGeneralized ECFG_2_1(1, 2, beta, JetSubStructureUtils::EnergyCorrelator::pt_R); + ECFG_2_1_value = ECFG_2_1.result(jet); + ECFG_3_2_value = ECFG_3_2.result(jet); - JetSubStructureUtils::EnergyCorrelatorGeneralized ECFG_3_2(2, 3, m_Beta, JetSubStructureUtils::EnergyCorrelator::pt_R); - JetSubStructureUtils::EnergyCorrelatorGeneralized ECFG_2_1(1, 2, m_Beta, JetSubStructureUtils::EnergyCorrelator::pt_R); - ECFG_2_1_value = ECFG_2_1.result(jet); - ECFG_3_2_value = ECFG_3_2.result(jet); + // These are used for N3 - // These are necessary for N3 + if(m_doN3) { + JetSubStructureUtils::EnergyCorrelatorGeneralized ECFG_4_2(2, 4, beta, JetSubStructureUtils::EnergyCorrelator::pt_R); + JetSubStructureUtils::EnergyCorrelatorGeneralized ECFG_3_1(1, 3, beta, JetSubStructureUtils::EnergyCorrelator::pt_R); + ECFG_3_1_value = ECFG_3_1.result(jet); + ECFG_4_2_value = ECFG_4_2.result(jet); + } - if(m_doN3) { - JetSubStructureUtils::EnergyCorrelatorGeneralized ECFG_4_2(2, 4, m_Beta, JetSubStructureUtils::EnergyCorrelator::pt_R); - JetSubStructureUtils::EnergyCorrelatorGeneralized ECFG_3_1(1, 3, m_Beta, JetSubStructureUtils::EnergyCorrelator::pt_R); - ECFG_3_1_value = ECFG_3_1.result(jet); - ECFG_4_2_value = ECFG_4_2.result(jet); } + injet.setAttribute(m_prefix+"ECFG_2_1"+suffix, ECFG_2_1_value); + injet.setAttribute(m_prefix+"ECFG_3_2"+suffix, ECFG_3_2_value); + injet.setAttribute(m_prefix+"ECFG_3_1"+suffix, ECFG_3_1_value); + injet.setAttribute(m_prefix+"ECFG_4_2"+suffix, ECFG_4_2_value); + + } + + // These are for t/H discrimination + float ECFG_3_3_2_value = -999, ECFG_3_2_2_value = -999, ECFG_3_3_1_value = -999, + ECFG_4_2_2_value = -999, ECFG_4_4_1_value = -999, ECFG_2_1_2_value = -999, ECFG_3_2_1_value = -999, + ECFG_3_1_1_value = -999; + // N.B. ECFG_angles_n_beta !! + + if (decorate) { + // These are for t/H discrimination - + if(m_doLSeries) { // 332 JetSubStructureUtils::EnergyCorrelatorGeneralized ECFG_3_3_2(3, 3, 2, JetSubStructureUtils::EnergyCorrelator::pt_R); @@ -90,10 +139,6 @@ int EnergyCorrelatorGeneralizedTool::modifyJet(xAOD::Jet &injet) const { } - injet.setAttribute(m_prefix+"ECFG_2_1", ECFG_2_1_value); - injet.setAttribute(m_prefix+"ECFG_3_2", ECFG_3_2_value); - injet.setAttribute(m_prefix+"ECFG_3_1", ECFG_3_1_value); - injet.setAttribute(m_prefix+"ECFG_4_2", ECFG_4_2_value); injet.setAttribute(m_prefix+"ECFG_3_3_2", ECFG_3_3_2_value); injet.setAttribute(m_prefix+"ECFG_3_2_2", ECFG_3_2_2_value); injet.setAttribute(m_prefix+"ECFG_3_3_1", ECFG_3_3_1_value); diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorRatiosTool.cxx b/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorRatiosTool.cxx index 9b4aff0ee1be7e0126708e5a29f1851e4b2abb70..144f1c2c57f3cc361c62b94c899d2ae22fa7842d 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorRatiosTool.cxx +++ b/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorRatiosTool.cxx @@ -1,7 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +// ---------------------------------------------------------------- +// The default behavior of this tool is to use beta = 1.0, but multiple +// values of beta can be used simultaneously. The property BetaList +// should be passed a list of floats. Values of < 0 or > 10 may result +// in poblematic output variable names and all values will be rounded +// to the nearest 0.1. No suffix will be added to the outputs for beta = 1.0 +// and for other values a suffix of _BetaN will be added where N= 10*beta. +// ---------------------------------------------------------------- + #include "JetSubStructureMomentTools/EnergyCorrelatorRatiosTool.h" #include "JetSubStructureUtils/EnergyCorrelator.h" @@ -10,84 +19,85 @@ using fastjet::PseudoJet; EnergyCorrelatorRatiosTool::EnergyCorrelatorRatiosTool(std::string name) : JetSubStructureMomentToolsBase(name) { - declareProperty("IncludeBeta2", m_includeBeta2 = false); + declareProperty("BetaList", m_betaVals = {}); declareProperty("IncludeECF4", m_includeECF4 = false); } -int EnergyCorrelatorRatiosTool::modifyJet(xAOD::Jet &jet) const { - - if (!jet.isAvailable<float>(m_prefix+"ECF1") || !jet.isAvailable<float>(m_prefix+"ECF2") || !jet.isAvailable<float>(m_prefix+"ECF3")) { - ATH_MSG_WARNING("Energy correlation fractions "<<m_prefix <<"are not all available. Exiting.."); - return 1; +StatusCode EnergyCorrelatorRatiosTool::initialize() { + ATH_MSG_INFO("Initializing EnergyCorrelatorTool"); + + // Add beta = 1.0 by default + m_cleaned_betaVals.push_back(1.0); + + // Clean up input list of beta values, rounding to nearest 0.1 and removing duplicates + for(float beta : m_betaVals) { + float betaFix = round( beta * 10.0 ) / 10.0; + if( std::find(m_cleaned_betaVals.begin(), m_cleaned_betaVals.end(), betaFix) == m_cleaned_betaVals.end() ) m_cleaned_betaVals.push_back(betaFix); } - - float ecf1 = jet.getAttribute<float>(m_prefix+"ECF1"); - float ecf2 = jet.getAttribute<float>(m_prefix+"ECF2"); - float ecf3 = jet.getAttribute<float>(m_prefix+"ECF3"); - - // D2 - if(ecf2 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"D2", ecf3 * pow(ecf1, 3.0) / pow(ecf2, 3.0)); - else - jet.setAttribute(m_prefix+"D2", -999.0); - - // C1 - if(ecf1 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"C1", ecf2 / pow(ecf1, 2.0)); - else - jet.setAttribute(m_prefix+"C1", -999.0); - - // C2 - if(ecf2 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"C2", ecf3 * ecf1 / pow(ecf2, 2.0)); - else - jet.setAttribute(m_prefix+"C2", -999.0); - - if(m_includeECF4) { - // C3 - float ecf4 = jet.getAttribute<float>(m_prefix+"ECF4"); - if(ecf3 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"C3", ecf4 * ecf2 / pow(ecf3, 2.0)); - else - jet.setAttribute(m_prefix+"C3", -999.0); + + for(float beta : m_cleaned_betaVals) { + ATH_MSG_DEBUG("Including beta = " << beta); } - if(m_includeBeta2) { - - if (!jet.isAvailable<float>(m_prefix+"ECF1_Beta2") || !jet.isAvailable<float>(m_prefix+"ECF2_Beta2") || !jet.isAvailable<float>(m_prefix+"ECF3_Beta3")) { - ATH_MSG_WARNING("Energy correlation fractions for Beta2 are not all available. Exiting.."); - return 1; + ATH_CHECK(JetSubStructureMomentToolsBase::initialize()); + + return StatusCode::SUCCESS; +} + +int EnergyCorrelatorRatiosTool::modifyJet(xAOD::Jet &jet) const { + + for(float beta : m_cleaned_betaVals) { + std::string suffix = GetBetaSuffix(beta); + + if (!jet.isAvailable<float>(m_prefix+"ECF1"+suffix)) { + ATH_MSG_WARNING("Energy correlation function " << m_prefix << "ECF1" << suffix << " is not available. Exiting.."); + return 1; } - - float ecf1_beta2 = jet.getAttribute<float>(m_prefix+"ECF1_Beta2"); - float ecf2_beta2 = jet.getAttribute<float>(m_prefix+"ECF2_Beta2"); - float ecf3_beta2 = jet.getAttribute<float>(m_prefix+"ECF3_Beta2"); - + + if (!jet.isAvailable<float>(m_prefix+"ECF2"+suffix)) { + ATH_MSG_WARNING("Energy correlation function " << m_prefix << "ECF2" << suffix << " is not available. Exiting.."); + return 1; + } + + if (!jet.isAvailable<float>(m_prefix+"ECF3"+suffix)) { + ATH_MSG_WARNING("Energy correlation function " << m_prefix << "ECF3" << suffix << " is not available. Exiting.."); + return 1; + } + + if (m_includeECF4 && !jet.isAvailable<float>(m_prefix+"ECF4"+suffix)) { + ATH_MSG_WARNING("Energy correlation function " << m_prefix << "ECF4" << suffix << " is not available. Exiting.."); + return 1; + } + + float ecf1 = jet.getAttribute<float>(m_prefix+"ECF1"+suffix); + float ecf2 = jet.getAttribute<float>(m_prefix+"ECF2"+suffix); + float ecf3 = jet.getAttribute<float>(m_prefix+"ECF3"+suffix); + // D2 - if(ecf2_beta2 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"D2_Beta2", ecf3_beta2 * pow(ecf1_beta2, 3.0) / pow(ecf2_beta2, 3.0)); + if(ecf2 > 1e-8) // Prevent div-0 + jet.setAttribute(m_prefix+"D2"+suffix, ecf3 * pow(ecf1, 3.0) / pow(ecf2, 3.0)); else - jet.setAttribute(m_prefix+"D2_Beta2", -999.0); + jet.setAttribute(m_prefix+"D2"+suffix, -999.0); // C1 - if(ecf1_beta2 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"C1_Beta2", ecf2_beta2 / pow(ecf1_beta2, 2.0)); + if(ecf1 > 1e-8) // Prevent div-0 + jet.setAttribute(m_prefix+"C1"+suffix, ecf2 / pow(ecf1, 2.0)); else - jet.setAttribute(m_prefix+"C1_Beta2", -999.0); + jet.setAttribute(m_prefix+"C1"+suffix, -999.0); // C2 - if(ecf2_beta2 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"C2_Beta2", ecf3_beta2 * ecf1_beta2 / pow(ecf2_beta2, 2.0)); + if(ecf2 > 1e-8) // Prevent div-0 + jet.setAttribute(m_prefix+"C2"+suffix, ecf3 * ecf1 / pow(ecf2, 2.0)); else - jet.setAttribute(m_prefix+"C2_Beta2", -999.0); + jet.setAttribute(m_prefix+"C2"+suffix, -999.0); if(m_includeECF4) { - float ecf4_beta2 = jet.getAttribute<float>(m_prefix+"ECF4_Beta2"); + float ecf4 = jet.getAttribute<float>(m_prefix+"ECF4"+suffix); // C3 - if(ecf3_beta2 > 1e-8) // Prevent div-0 - jet.setAttribute(m_prefix+"C3_Beta2", ecf4_beta2 * ecf2_beta2 / pow(ecf3_beta2, 2.0)); + if(ecf3 > 1e-8) // Prevent div-0 + jet.setAttribute(m_prefix+"C3"+suffix, ecf4 * ecf2 / pow(ecf3, 2.0)); else - jet.setAttribute(m_prefix+"C3_Beta2", -999.0); + jet.setAttribute(m_prefix+"C3"+suffix, -999.0); } } diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorTool.cxx b/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorTool.cxx index 476eb8e1398ef46dfb974cbe2b4a791a914fad72..5b04cb48bcc7973bbfe4dc2f0afef5caa998a2f1 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorTool.cxx +++ b/Reconstruction/Jet/JetSubStructureMomentTools/Root/EnergyCorrelatorTool.cxx @@ -1,7 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +// ---------------------------------------------------------------- +// The default behavior of this tool is to use beta = 1.0, but multiple +// values of beta can be used simultaneously. The property BetaList +// should be passed a list of floats. Values of < 0 or > 10 may result +// in poblematic output variable names and all values will be rounded +// to the nearest 0.1. No suffix will be added to the outputs for beta = 1.0 +// and for other values a suffix of _BetaN will be added where N= 10*beta. +// ---------------------------------------------------------------- + #include "JetSubStructureMomentTools/EnergyCorrelatorTool.h" #include "JetSubStructureUtils/EnergyCorrelator.h" @@ -12,68 +21,78 @@ EnergyCorrelatorTool::EnergyCorrelatorTool(std::string name) : { ATH_MSG_DEBUG("Initializing EnergyCorrelator tool."); declareProperty("Beta", m_Beta = 1.0); - declareProperty("IncludeBeta2", m_includeBeta2 = false); + declareProperty("BetaList", m_betaVals = {}); declareProperty("IncludeECF4", m_includeECF4 = false); } +StatusCode EnergyCorrelatorTool::initialize() { + ATH_MSG_INFO("Initializing EnergyCorrelatorTool"); + + // Add beta = 1.0 by default + m_cleaned_betaVals.push_back(1.0); + + // Add beta = m_Beta by default to keep backwards compatibility + if( fabs(m_Beta-1.0) > 1.0e-5 ) m_cleaned_betaVals.push_back(m_Beta); + + // Clean up input list of beta values, rounding to nearest 0.1 and removing duplicates + for(float beta : m_betaVals) { + float betaFix = round( beta * 10.0 ) / 10.0; + if( std::find(m_cleaned_betaVals.begin(), m_cleaned_betaVals.end(), betaFix) == m_cleaned_betaVals.end() ) m_cleaned_betaVals.push_back(betaFix); + } + + for(float beta : m_cleaned_betaVals) { + ATH_MSG_DEBUG("Including beta = " << beta); + } + + ATH_CHECK(JetSubStructureMomentToolsBase::initialize()); + + return StatusCode::SUCCESS; +} + int EnergyCorrelatorTool::modifyJet(xAOD::Jet &injet) const { PseudoJet jet; bool decorate = SetupDecoration(jet,injet); - - float result_ECF1 = -999.0; - float result_ECF2 = -999.0; - float result_ECF3 = -999.0; - float result_ECF4 = -999.0; - - if(decorate) { - JetSubStructureUtils::EnergyCorrelator ECF1(1, m_Beta, JetSubStructureUtils::EnergyCorrelator::pt_R); - JetSubStructureUtils::EnergyCorrelator ECF2(2, m_Beta, JetSubStructureUtils::EnergyCorrelator::pt_R); - JetSubStructureUtils::EnergyCorrelator ECF3(3, m_Beta, JetSubStructureUtils::EnergyCorrelator::pt_R); - result_ECF1 = ECF1.result(jet); - result_ECF2 = ECF2.result(jet); - result_ECF3 = ECF3.result(jet); - - if(m_includeECF4) { - JetSubStructureUtils::EnergyCorrelator ECF4(4, m_Beta, JetSubStructureUtils::EnergyCorrelator::pt_R); - result_ECF4 = ECF4.result(jet); + + for(float beta : m_cleaned_betaVals) { + + if(beta < 0.0) { + ATH_MSG_WARNING("Negative beta values are not supported. Skipping " << beta); + continue; } - } - injet.setAttribute(m_prefix+"ECF1", result_ECF1); - injet.setAttribute(m_prefix+"ECF2", result_ECF2); - injet.setAttribute(m_prefix+"ECF3", result_ECF3); - if(m_includeECF4) - injet.setAttribute(m_prefix+"ECF4", result_ECF4); - - if(m_includeBeta2) { - - float result_ECF1_beta2 = -999.0; - float result_ECF2_beta2 = -999.0; - float result_ECF3_beta2 = -999.0; - float result_ECF4_beta2 = -999.0; - + + std::string suffix = GetBetaSuffix(beta); + + float result_ECF1 = -999; + float result_ECF2 = -999; + float result_ECF3 = -999; + float result_ECF4 = -999; + if(decorate) { - JetSubStructureUtils::EnergyCorrelator ECF1_beta2(1, 2.0, JetSubStructureUtils::EnergyCorrelator::pt_R); - JetSubStructureUtils::EnergyCorrelator ECF2_beta2(2, 2.0, JetSubStructureUtils::EnergyCorrelator::pt_R); - JetSubStructureUtils::EnergyCorrelator ECF3_beta2(3, 2.0, JetSubStructureUtils::EnergyCorrelator::pt_R); - - result_ECF1_beta2 = ECF1_beta2.result(jet); - result_ECF2_beta2 = ECF2_beta2.result(jet); - result_ECF3_beta2 = ECF3_beta2.result(jet); - + JetSubStructureUtils::EnergyCorrelator ECF1(1, beta, JetSubStructureUtils::EnergyCorrelator::pt_R); + JetSubStructureUtils::EnergyCorrelator ECF2(2, beta, JetSubStructureUtils::EnergyCorrelator::pt_R); + JetSubStructureUtils::EnergyCorrelator ECF3(3, beta, JetSubStructureUtils::EnergyCorrelator::pt_R); + + result_ECF1 = ECF1.result(jet); + result_ECF2 = ECF2.result(jet); + result_ECF3 = ECF3.result(jet); + if(m_includeECF4) { - JetSubStructureUtils::EnergyCorrelator ECF4_beta2(4, 2.0, JetSubStructureUtils::EnergyCorrelator::pt_R); - result_ECF4_beta2 = ECF4_beta2.result(jet); + JetSubStructureUtils::EnergyCorrelator ECF4(4, beta, JetSubStructureUtils::EnergyCorrelator::pt_R); + result_ECF4 = ECF4.result(jet); } } - - injet.setAttribute(m_prefix+"ECF1_Beta2", result_ECF1_beta2); - injet.setAttribute(m_prefix+"ECF2_Beta2", result_ECF2_beta2); - injet.setAttribute(m_prefix+"ECF3_Beta2", result_ECF3_beta2); - + + injet.setAttribute(m_prefix+"ECF1"+suffix, result_ECF1); + injet.setAttribute(m_prefix+"ECF2"+suffix, result_ECF2); + injet.setAttribute(m_prefix+"ECF3"+suffix, result_ECF3); + if(m_includeECF4) - injet.setAttribute(m_prefix+"ECF4_Beta2", result_ECF4_beta2); + injet.setAttribute(m_prefix+"ECF4"+suffix, result_ECF4); + } + return 0; } + diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/Root/JetSubStructureMomentToolsBase.cxx b/Reconstruction/Jet/JetSubStructureMomentTools/Root/JetSubStructureMomentToolsBase.cxx index 98888549be908cdabc710d2ba5f96c691a4ececa..963d63c4d82a10da4773970cee0ba9fa2e1f6953 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/Root/JetSubStructureMomentToolsBase.cxx +++ b/Reconstruction/Jet/JetSubStructureMomentTools/Root/JetSubStructureMomentToolsBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "JetSubStructureMomentTools/JetSubStructureMomentToolsBase.h" @@ -11,7 +11,7 @@ using fastjet::PseudoJet; JetSubStructureMomentToolsBase::JetSubStructureMomentToolsBase(std::string name) : JetModifierBase(name) { - declareProperty("inputContainer",m_inputContainer = ""); + declareProperty("InputContainer",m_inputContainer = ""); declareProperty("Prefix", m_prefix = ""); } diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/Root/LinkDef.h b/Reconstruction/Jet/JetSubStructureMomentTools/Root/LinkDef.h index adec55f992c5f329c91b64be857515c65f553c98..3e32942d18e5b4842cf433542ad2541213fee3ff 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/Root/LinkDef.h +++ b/Reconstruction/Jet/JetSubStructureMomentTools/Root/LinkDef.h @@ -26,6 +26,7 @@ #include "JetSubStructureMomentTools/ISubjetRecorderTool.h" #include "JetSubStructureMomentTools/KtMassDropTool.h" #include "JetSubStructureMomentTools/QwTool.h" +#include "JetSubStructureMomentTools/SoftDropObservablesTool.h" #include "JetSubStructureMomentTools/SubjetRecorderTool.h" #ifdef __CINT__ @@ -56,6 +57,7 @@ #pragma link C++ class PlanarFlowTool+; #pragma link C++ class QwTool+; #pragma link C++ class ShowerDeconstructionTool+; +#pragma link C++ class SoftDropObservablesTool+; #pragma link C++ class SubjetFinderTool+; #pragma link C++ class SubjetMakerTool+; #pragma link C++ class SubjetRecorderTool+; diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/Root/SoftDropObservablesTool.cxx b/Reconstruction/Jet/JetSubStructureMomentTools/Root/SoftDropObservablesTool.cxx new file mode 100644 index 0000000000000000000000000000000000000000..0b4b07a0b236c2f483b4598670e25919ae2a293b --- /dev/null +++ b/Reconstruction/Jet/JetSubStructureMomentTools/Root/SoftDropObservablesTool.cxx @@ -0,0 +1,42 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include <iostream> +#include <math.h> +#include <float.h> +#include "JetSubStructureMomentTools/SoftDropObservablesTool.h" +#include "JetEDM/JetConstituentFiller.h" +#include "JetSubStructureUtils/SoftDropObservables.h" +#include "fastjet/ClusterSequence.hh" + +using fastjet::PseudoJet; + +SoftDropObservablesTool::SoftDropObservablesTool(std::string name) : + JetSubStructureMomentToolsBase(name) +{ +} + +int SoftDropObservablesTool::modifyJet(xAOD::Jet &injet) const { + PseudoJet jet; + + bool decorate = SetupDecoration(jet,injet); + + // Groomed jet moments + float zg_value = -999, rg_value = -999; + + if (decorate) { + JetSubStructureUtils::SoftDropObservables zgGetter("zg"); + JetSubStructureUtils::SoftDropObservables rgGetter("rg"); + + zg_value = zgGetter.result(jet); + rg_value = rgGetter.result(jet); + } + + // Groomed jet moments + injet.setAttribute(m_prefix+"zg", zg_value); + injet.setAttribute(m_prefix+"rg", rg_value); + + + return 0; +} diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/python/DefaultTools.py b/Reconstruction/Jet/JetSubStructureMomentTools/python/DefaultTools.py index dc049402ab4d8f84b88dd0c3178a7127d821a553..145653849f0fdb73d26dcf349df3244e01efb310 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/python/DefaultTools.py +++ b/Reconstruction/Jet/JetSubStructureMomentTools/python/DefaultTools.py @@ -14,6 +14,7 @@ from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import EnergyCorr from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import CenterOfMassShapesTool from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import JetPullTool from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import JetChargeTool +from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import SoftDropObservablesTool def declareDefaultTools(): from JetRecConfig.JetRecStandardToolManager import jtm @@ -70,6 +71,8 @@ def declareDefaultTools(): # Jet charge jtm += JetChargeTool("charge", K=1.0) + jtm += SoftDropObservablesTool("softdropObservables") + # generalized ECFs jtm += EnergyCorrelatorGeneralizedTool("energycorrelatorgeneralized") diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/share/run.py b/Reconstruction/Jet/JetSubStructureMomentTools/share/run.py index 3fb228597b17d1f1220a869e4048da0f5f02fb50..06fc83575efd4c596fea87a08d86cb95b6df2ed0 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/share/run.py +++ b/Reconstruction/Jet/JetSubStructureMomentTools/share/run.py @@ -177,14 +177,12 @@ if 1: ToolSvc += EnergyCorrelatorTool("energycorrelator") energycorrelator = ToolSvc.energycorrelator #energycorrelator.Beta = 0.5 - #energycorrelator.IncludeBeta2 = True #energycorrelator.IncludeECF4 = True jetrec2.JetModifiers += [energycorrelator] from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import EnergyCorrelatorRatiosTool ToolSvc += EnergyCorrelatorRatiosTool("energycorrelatorratios") energycorrelatorratios = ToolSvc.energycorrelatorratios - #energycorrelatorratios.IncludeBeta2 = True #energycorrelatorratios.IncludeECF4 = True jetrec2.JetModifiers += [energycorrelatorratios] diff --git a/Reconstruction/Jet/JetSubStructureMomentTools/src/components/JetSubStructure_entries.cxx b/Reconstruction/Jet/JetSubStructureMomentTools/src/components/JetSubStructure_entries.cxx index a0845d2dc502617190758ceb03613011e7805ae5..fb05ed42620d502d6beb6aeae4e2bbe2a27f8eba 100644 --- a/Reconstruction/Jet/JetSubStructureMomentTools/src/components/JetSubStructure_entries.cxx +++ b/Reconstruction/Jet/JetSubStructureMomentTools/src/components/JetSubStructure_entries.cxx @@ -17,6 +17,7 @@ #include "JetSubStructureMomentTools/JetChargeTool.h" #include "JetSubStructureMomentTools/VolatilityTool.h" #include "JetSubStructureMomentTools/ShowerDeconstructionTool.h" +#include "JetSubStructureMomentTools/SoftDropObservablesTool.h" #include "JetSubStructureMomentTools/SubjetMakerTool.h" #include "JetSubStructureMomentTools/SubjetFinderTool.h" #include "JetSubStructureMomentTools/SubjetRecorderTool.h" @@ -43,6 +44,7 @@ DECLARE_COMPONENT( JetPullTool ) DECLARE_COMPONENT( JetChargeTool ) DECLARE_COMPONENT( VolatilityTool ) DECLARE_COMPONENT( ShowerDeconstructionTool ) +DECLARE_COMPONENT( SoftDropObservablesTool ) DECLARE_COMPONENT( SubjetMakerTool ) DECLARE_COMPONENT( SubjetFinderTool ) DECLARE_COMPONENT( SubjetRecorderTool ) @@ -50,4 +52,3 @@ DECLARE_COMPONENT( BosonTagTool ) DECLARE_COMPONENT( Validator ) DECLARE_COMPONENT( QwTool ) DECLARE_COMPONENT( BoostedXbbTagTool ) - diff --git a/Reconstruction/Jet/JetSubStructureUtils/CMakeLists.txt b/Reconstruction/Jet/JetSubStructureUtils/CMakeLists.txt index eb9e8272a0c8871c764a4671512be44bda99d98d..5c010a69a2010f3b6485c0ab003098f5bb27cd20 100644 --- a/Reconstruction/Jet/JetSubStructureUtils/CMakeLists.txt +++ b/Reconstruction/Jet/JetSubStructureUtils/CMakeLists.txt @@ -17,7 +17,7 @@ atlas_depends_on_subdirs( # External dependencies: find_package( FastJet ) -find_package( FastJetContrib COMPONENTS Nsubjettiness EnergyCorrelator ) +find_package( FastJetContrib COMPONENTS Nsubjettiness EnergyCorrelator SoftDrop ) find_package( ROOT COMPONENTS Matrix Core MathCore Physics ) # Component(s) in the package: diff --git a/Reconstruction/Jet/JetSubStructureUtils/Root/BoostToCenterOfMass.h b/Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/BoostToCenterOfMass.h similarity index 86% rename from Reconstruction/Jet/JetSubStructureUtils/Root/BoostToCenterOfMass.h rename to Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/BoostToCenterOfMass.h index f90257b8789b2371f4f32f1a152a7aa1e4ed7484..2945dca18e0ecfc80f914badc97af4512182ae8a 100644 --- a/Reconstruction/Jet/JetSubStructureUtils/Root/BoostToCenterOfMass.h +++ b/Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/BoostToCenterOfMass.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef jetsubstructureutils_boosttocenterofmass_header diff --git a/Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/SoftDropObservables.h b/Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/SoftDropObservables.h new file mode 100644 index 0000000000000000000000000000000000000000..e34692adc60ef405c13844beb460c540dda086f4 --- /dev/null +++ b/Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/SoftDropObservables.h @@ -0,0 +1,39 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef jetsubstructureutils_softdropobservables_header +#define jetsubstructureutils_softdropobservables_header + +#include "JetSubStructureUtils/SubstructureCalculator.h" +#include "fastjet/contrib/SoftDrop.hh" + +namespace JetSubStructureUtils { + + class SoftDropObservables : public SubstructureCalculator<double>{ + public: + SoftDropObservables(std::string observableName) { + m_observableName = observableName; + }; + + using SubstructureCalculator::result; + virtual double result(const fastjet::PseudoJet &jet) const { + // Set zcut to zero so that this doesn't groom the jet, just gives it the structure + fastjet::contrib::SoftDrop sd(0., 0.); //beta, zcut + // Apply the fake grooming to the jet + fastjet::PseudoJet sdJet = sd(jet); + + double zg=sdJet.structure_of<fastjet::contrib::SoftDrop>().symmetry(); + double rg=sdJet.structure_of<fastjet::contrib::SoftDrop>().delta_R(); + if( strcmp(m_observableName.c_str(), "zg") == 0){ + return zg; + } + return rg; + }; + private: + std::string m_observableName; // Currently, able to return zg and rg + + }; +} + +#endif diff --git a/Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/SubjetFinder.h b/Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/SubjetFinder.h index a8ec04ab755bfee21055428a3a89b742ce6f84d4..37dc82f31f1e7130cc2a3a6a653eeb1022f7171d 100644 --- a/Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/SubjetFinder.h +++ b/Reconstruction/Jet/JetSubStructureUtils/JetSubStructureUtils/SubjetFinder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef jetsubstructureutils_subjetfinder_header @@ -17,14 +17,11 @@ namespace JetSubStructureUtils { using SubstructureCalculator::result; virtual std::vector<fastjet::PseudoJet> result(const fastjet::PseudoJet &jet) const; - virtual void setCOM(bool doCOM){ m_doCOM = doCOM;} - private: fastjet::JetAlgorithm m_fj_jetalg; float m_jetrad; float m_ptmin; int m_exclusivenjets; - bool m_doCOM; }; } diff --git a/Reconstruction/Jet/JetSubStructureUtils/Root/BoostToCenterOfMass.cxx b/Reconstruction/Jet/JetSubStructureUtils/Root/BoostToCenterOfMass.cxx index 9bb4c292b49bd0de8a15091c405fd6fb664556f9..7314e8ab980620be20f571fe44a02a3db1baa907 100644 --- a/Reconstruction/Jet/JetSubStructureUtils/Root/BoostToCenterOfMass.cxx +++ b/Reconstruction/Jet/JetSubStructureUtils/Root/BoostToCenterOfMass.cxx @@ -1,8 +1,8 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "./BoostToCenterOfMass.h" +#include "JetSubStructureUtils/BoostToCenterOfMass.h" #include "TLorentzVector.h" using namespace std; diff --git a/Reconstruction/Jet/JetSubStructureUtils/Root/FoxWolfram.cxx b/Reconstruction/Jet/JetSubStructureUtils/Root/FoxWolfram.cxx index 0ddb5988b665defd8791da4556ce8d687f17e6b0..1590f10000a1cb293169d40b9669e55483afded4 100644 --- a/Reconstruction/Jet/JetSubStructureUtils/Root/FoxWolfram.cxx +++ b/Reconstruction/Jet/JetSubStructureUtils/Root/FoxWolfram.cxx @@ -1,10 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "JetSubStructureUtils/FoxWolfram.h" #include "TLorentzVector.h" -#include "./BoostToCenterOfMass.h" +#include "JetSubStructureUtils/BoostToCenterOfMass.h" using namespace std; using namespace JetSubStructureUtils; diff --git a/Reconstruction/Jet/JetSubStructureUtils/Root/Pull.cxx b/Reconstruction/Jet/JetSubStructureUtils/Root/Pull.cxx index 85b3cc27d4cc2e4718e4e109106907c8d0cf9b10..61d0cbe7ff0a13057f7cb8c8bb9207f3f85ae3dd 100644 --- a/Reconstruction/Jet/JetSubStructureUtils/Root/Pull.cxx +++ b/Reconstruction/Jet/JetSubStructureUtils/Root/Pull.cxx @@ -1,10 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "JetSubStructureUtils/Pull.h" #include "TLorentzVector.h" -#include "./BoostToCenterOfMass.h" +#include "JetSubStructureUtils/BoostToCenterOfMass.h" using namespace std; using namespace JetSubStructureUtils; diff --git a/Reconstruction/Jet/JetSubStructureUtils/Root/SphericityTensor.cxx b/Reconstruction/Jet/JetSubStructureUtils/Root/SphericityTensor.cxx index 071f679f6dc50f7f9bba0fe1fcc984b5121bd919..8e67d47a2f24bcc99b2232fb7c54d475ddb39bda 100644 --- a/Reconstruction/Jet/JetSubStructureUtils/Root/SphericityTensor.cxx +++ b/Reconstruction/Jet/JetSubStructureUtils/Root/SphericityTensor.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "JetSubStructureUtils/SphericityTensor.h" @@ -7,7 +7,7 @@ #include "TMatrixD.h" #include "TDecompSVD.h" #include "TLorentzVector.h" -#include "./BoostToCenterOfMass.h" +#include "JetSubStructureUtils/BoostToCenterOfMass.h" using namespace std; using namespace JetSubStructureUtils; diff --git a/Reconstruction/Jet/JetSubStructureUtils/Root/SubjetFinder.cxx b/Reconstruction/Jet/JetSubStructureUtils/Root/SubjetFinder.cxx index 19b6dcdb0646633e3d6ca27eb20c322d25d48392..310b9be068ae2fa257047f9d3ef56bed8aa6dbe6 100644 --- a/Reconstruction/Jet/JetSubStructureUtils/Root/SubjetFinder.cxx +++ b/Reconstruction/Jet/JetSubStructureUtils/Root/SubjetFinder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "JetSubStructureUtils/SubjetFinder.h" @@ -13,7 +13,7 @@ using namespace std; using namespace JetSubStructureUtils; SubjetFinder::SubjetFinder(fastjet::JetAlgorithm fj_jetalg, float jet_radius, float pt_min, int exclusive_njets) : - m_fj_jetalg(fj_jetalg), m_jetrad(jet_radius), m_ptmin(pt_min), m_exclusivenjets(exclusive_njets),m_doCOM(false) + m_fj_jetalg(fj_jetalg), m_jetrad(jet_radius), m_ptmin(pt_min), m_exclusivenjets(exclusive_njets) { } @@ -26,18 +26,19 @@ vector<fastjet::PseudoJet> SubjetFinder::result(const fastjet::PseudoJet &jet) c return subjets; } - - fastjet::ClusterSequence *clust_seq = NULL; - if (!m_doCOM){ - fastjet::JetDefinition jet_def = fastjet::JetDefinition(m_fj_jetalg, m_jetrad, fastjet::E_scheme, fastjet::Best); - clust_seq = new fastjet::ClusterSequence(constit_pseudojets, jet_def); - } else{ + + if (m_fj_jetalg==fastjet::ee_kt_algorithm) { + fastjet::JetDefinition jet_def = fastjet::JetDefinition(fastjet::ee_kt_algorithm); + clust_seq = new fastjet::ClusterSequence(constit_pseudojets, jet_def); + }else if (m_fj_jetalg==fastjet::plugin_algorithm) { fastjet::JetDefinition jet_def = fastjet::JetDefinition(new fastjet::EECambridgePlugin(m_jetrad)); - clust_seq = new fastjet::ClusterSequence(constit_pseudojets, jet_def); + clust_seq = new fastjet::ClusterSequence(constit_pseudojets, jet_def); + }else{ + fastjet::JetDefinition jet_def = fastjet::JetDefinition(m_fj_jetalg, m_jetrad, fastjet::E_scheme, fastjet::Best); + clust_seq = new fastjet::ClusterSequence(constit_pseudojets, jet_def); } - if(m_exclusivenjets < 0) { // Inclusive subjets = fastjet::sorted_by_pt(clust_seq->inclusive_jets(m_ptmin)); } diff --git a/Reconstruction/Jet/JetSubStructureUtils/Root/Thrust.cxx b/Reconstruction/Jet/JetSubStructureUtils/Root/Thrust.cxx index f88a57bebb40a6ba89611d91c7bacc2d39511f1e..8ed0ff1559cb7aa48d7c138a06f5f24929537f47 100644 --- a/Reconstruction/Jet/JetSubStructureUtils/Root/Thrust.cxx +++ b/Reconstruction/Jet/JetSubStructureUtils/Root/Thrust.cxx @@ -1,10 +1,10 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "JetSubStructureUtils/Thrust.h" #include "TLorentzVector.h" -#include "./BoostToCenterOfMass.h" +#include "JetSubStructureUtils/BoostToCenterOfMass.h" using namespace std; using namespace JetSubStructureUtils; diff --git a/Reconstruction/MVAUtils/util/convertLGBMToRootTree.py b/Reconstruction/MVAUtils/util/convertLGBMToRootTree.py index 41e5916a545d49e94a64dfefdd45a4e4bb8156e8..5af54d702cce38bee007e0182e4d90bc41ba023d 100755 --- a/Reconstruction/MVAUtils/util/convertLGBMToRootTree.py +++ b/Reconstruction/MVAUtils/util/convertLGBMToRootTree.py @@ -20,6 +20,21 @@ import logging logging.basicConfig(level=logging.DEBUG) +def lgbm_rawresponse_each_tree(model, my_input): + import numpy as np + nclasses = model.num_model_per_iteration() + output_values = np.array([np.array([[0] * nclasses])] + [model.predict(my_input, raw_score=True, num_iteration=itree) for itree in range(1, (model.num_trees() / nclasses + 1))]) + output_trees = np.diff(output_values, axis=0) + return output_trees + + +def list2stdvector(values, dtype='float'): + result = ROOT.std.vector(dtype)() + for v in values: + result.push_back(v) + return result + + class LGBMTextNode(dict): """ Adaptor from LGBM dictionary to tree @@ -289,6 +304,8 @@ def test_multiclass(booster, mva_utils, ntests=10000, test_file=None): logging.warning("using random uniform input as test: this is not safe, provide an input test file") data_input = np.random.uniform(-100, 100, size=(ntests, nvars)) + data_input = data_input.astype(np.float32) # to match what mvautils is doing (using c-float) + start = time.time() results_lgbm = booster.predict(data_input) logging.info("lgbm (vectorized) timing = %s ms/input", (time.time() - start) * 1000 / len(data_input)) @@ -300,17 +317,62 @@ def test_multiclass(booster, mva_utils, ntests=10000, test_file=None): input_values_vector.clear() for v in input_values: input_values_vector.push_back(v) - output_MVAUtils = list(mva_utils.GetMultiResponse(input_values_vector, nclasses)) + output_MVAUtils = np.asarray(mva_utils.GetMultiResponse(input_values_vector, nclasses)) results_MVAUtils.append(output_MVAUtils) logging.info("mvautils (not vectorized+overhead) timing = %s ms/input", (time.time() - start) * 1000 / len(data_input)) - for input_values, output_lgbm, output_MVAUtils in zip(data_input, results_lgbm, results_MVAUtils): + stop_event_loop = False + for ievent, (input_values, output_lgbm, output_MVAUtils) in enumerate(zip(data_input, results_lgbm, results_MVAUtils), 1): if not np.allclose(output_lgbm, output_MVAUtils): - logging.info("output are different:" - "mvautils: %s\n" - "lgbm: %s\n" - "inputs: %s", output_MVAUtils, output_lgbm, input_values) - return False + stop_event_loop = True + logging.info("output are different on input %d/%d:\n" % (ievent, len(data_input))) + for ivar, input_value in enumerate(input_values): + logging.info("var %d: %.15f", ivar, input_value) + logging.info("=" * 50) + logging.info(" mvautils lgbm") + for ioutput, (o1, o2) in enumerate(zip(output_MVAUtils, output_lgbm)): + diff_flag = "" if np.allclose(o1, o2) else "<---" + logging.info("output %3d %.5e %.5e %s", ioutput, o1, o2, diff_flag) + output_trees_lgbm = lgbm_rawresponse_each_tree(booster, [input_values]) + + stop_tree_loop = False + for itree, output_tree_lgbm in enumerate(output_trees_lgbm): + output_tree_mva_utils = [mva_utils.GetTreeResponse(list2stdvector(input_values), itree * nclasses + c) for c in range(nclasses)] + if not np.allclose(output_tree_mva_utils, output_tree_lgbm[0]): + stop_tree_loop = True + logging.info("first tree/class with different answer (%d)" % itree) + for isubtree, (ol, om) in enumerate(zip(output_tree_lgbm[0], output_tree_mva_utils)): + if not np.allclose(ol, om): + logging.info("different in position %d" % isubtree) + logging.info("lgbm: %f" % ol) + logging.info("mvautils: %f" % om) + logging.info("=" * 50) + logging.info("tree %d (itree) * %d (nclasses) + %d (isubtree) = %d", itree, nclasses, isubtree, itree * nclasses + isubtree) + mva_utils.PrintTree(itree * nclasses + isubtree) + + node_infos = [] + + # we now which tree is failing, check if this is due to input values very close to the threshold + # the problem is that lgbm is using double, while mva_utils is using float + def ff(tree): + if 'left_child' in tree: + node_infos.append((tree['split_feature'], tree['threshold'])) + ff(tree['left_child']) + ff(tree['right_child']) + + ff(booster.dump_model()['tree_info'][itree * nclasses + isubtree]['tree_structure']) + for node_info in node_infos: + value = input_values[node_info[0]] + threshold = node_info[1] + if not np.isnan(value) and (value <= threshold) != (np.float32(value) <= np.float32(threshold)): + logging.info("the problem could be due to double (lgbm) -> float (mvautil) conversion for variable %d: %f and threshold %f", node_info[0], value, threshold) + stop_tree_loop = False + stop_event_loop = False + + if stop_tree_loop: + break + if stop_event_loop: + return False return True @@ -336,13 +398,18 @@ if __name__ == "__main__": parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('input', help='input text file from LGBM') - parser.add_argument('output', help='output ROOT filename') + parser.add_argument('output', help='output ROOT filename', nargs='?') parser.add_argument('--tree-name', default='lgbm') parser.add_argument('--no-test', action='store_true', help="don't run test (not suggested)") parser.add_argument('--ntests', type=int, default=1000, help="number of random test, default=1000") parser.add_argument('--test-file', help='numpy table') args = parser.parse_args() + + if args.output is None: + import os + args.output = os.path.splitext(os.path.split(args.input)[1])[0] + '.root' + logging.info("converting input file %s to root file %s", args.input, args.output) output_treename = convertLGBMToRootTree(args.input, args.output, args.tree_name) if args.no_test: @@ -355,7 +422,10 @@ if __name__ == "__main__": if not result: print("some problems during test. Have you setup athena? Do not use this in production!") else: - print(u":::😀😀😀 everything fine: LGBM output == MVAUtils output 😀😀😀:::") + try: + print(u":::😀😀😀 everything fine: LGBM output == MVAUtils output 😀😀😀:::") + except UnicodeEncodeError: + print(":::==> everything fine: LGBM output == MVAUtils output <==:::") booster = lgb.Booster(model_file=args.input) objective = booster.dump_model()['objective'] if 'multiclass' in objective: diff --git a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx index 84cb835c0790a35528c2f0356663342bcc613a4a..13c163c6e9cc3b12da959f47e199eebd5e6f87ec 100644 --- a/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx +++ b/Reconstruction/MuonIdentification/MuonSegmentTaggers/MuonSegmentTaggerTools/src/MuTagMatchingTool.cxx @@ -193,8 +193,13 @@ bool MuTagMatchingTool::match( const Trk::TrackParameters* atSurface, std::string MuTagMatchingTool::segmentStationString( const Muon::MuonSegment* segment ) const { std::string station; - + for( unsigned int i = 0; i<segment->numberOfContainedROTs(); ++i ){ + const Trk::RIO_OnTrack* rot=segment->rioOnTrack(i); + if(!rot){ + ATH_MSG_DEBUG("no ROT"); + continue; + } Identifier segID = segment->rioOnTrack(i)->identify(); if( m_muonIdHelperTool->mdtIdHelper().is_mdt(segID) ){ station = m_muonIdHelperTool->mdtIdHelper().stationNameString( m_muonIdHelperTool->mdtIdHelper().stationName( segID ) ); diff --git a/Reconstruction/RecAlgs/src/JobOptsDumperAlg.cxx b/Reconstruction/RecAlgs/src/JobOptsDumperAlg.cxx new file mode 100755 index 0000000000000000000000000000000000000000..9b65520e051eb883ede3f69c950c4a4bf53f61d9 --- /dev/null +++ b/Reconstruction/RecAlgs/src/JobOptsDumperAlg.cxx @@ -0,0 +1,30 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "GaudiKernel/IJobOptionsSvc.h" + +#include "JobOptsDumperAlg.h" +#include <fstream> + +StatusCode JobOptsDumperAlg::initialize() { + + std::ofstream fout(m_fileName); + if (!fout.good()) { + ATH_MSG_ERROR("Failed to open output file " << m_fileName); + return StatusCode::FAILURE; + } + + + IJobOptionsSvc* p_jobOptionSvc; + ATH_CHECK(service("JobOptionsSvc", p_jobOptionSvc)); + + for (const std::string& compName : p_jobOptionSvc->getClients()) { + for (const auto& props: *p_jobOptionSvc->getProperties(compName)) { + fout << compName << "." << props->name() << " = " << props->toString() << std::endl; + } + fout << std::endl; + } + fout.close(); + return StatusCode::SUCCESS; +} \ No newline at end of file diff --git a/Reconstruction/RecAlgs/src/JobOptsDumperAlg.h b/Reconstruction/RecAlgs/src/JobOptsDumperAlg.h new file mode 100755 index 0000000000000000000000000000000000000000..4888567b2a9164817025fe241f645219fdb38b4e --- /dev/null +++ b/Reconstruction/RecAlgs/src/JobOptsDumperAlg.h @@ -0,0 +1,27 @@ +// -*- C++ -*- + +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef RECO_ALGS_JOBOPTIONSDUMPERALG_H +#define RECO_ALGS_JOBOPTIONSDUMPERALG_H + +#include "GaudiKernel/Property.h" +#include "AthenaBaseComps/AthAlgorithm.h" + +#include <string> + +class JobOptsDumperAlg : public AthAlgorithm { +public: + + using AthAlgorithm::AthAlgorithm; + StatusCode initialize() override; + StatusCode execute() {return StatusCode::SUCCESS;}; + +private: + // Properties + Gaudi::Property<std::string> m_fileName {this, "FileName","jobOptions.txt", "Name of the output file"}; +}; + +#endif \ No newline at end of file diff --git a/Reconstruction/RecAlgs/src/components/RecAlgs_entries.cxx b/Reconstruction/RecAlgs/src/components/RecAlgs_entries.cxx index 4c13d765500926bc208ca70e0caae4b865450b4e..ad2528108298b2b192dbdb05494f9e853f5ff907 100644 --- a/Reconstruction/RecAlgs/src/components/RecAlgs_entries.cxx +++ b/Reconstruction/RecAlgs/src/components/RecAlgs_entries.cxx @@ -3,10 +3,10 @@ #include "../JobInfo.h" #include "../EventInfoUnlocker.h" #include "../AppStopAlg.h" - +#include "../JobOptsDumperAlg.h" DECLARE_COMPONENT( TimingAlg ) DECLARE_COMPONENT( MemoryAlg ) DECLARE_COMPONENT( JobInfo ) DECLARE_COMPONENT( EventInfoUnlocker ) DECLARE_COMPONENT( AppStopAlg ) - +DECLARE_COMPONENT( JobOptsDumperAlg ) diff --git a/Reconstruction/RecEventAthenaPool/src/RecoTimingObjCnv.cxx b/Reconstruction/RecEventAthenaPool/src/RecoTimingObjCnv.cxx index 35b14133d5155092c24f575a964a7732412f22de..deb7b66e4f7f3e6007b936aebfc3f1400cfa702d 100755 --- a/Reconstruction/RecEventAthenaPool/src/RecoTimingObjCnv.cxx +++ b/Reconstruction/RecEventAthenaPool/src/RecoTimingObjCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -39,7 +39,7 @@ RecoTimingObj* RecoTimingObjCnv::createTransient() if ( compareClassGuid(p1_guid) ) { // using auto_ptr ensures deletion of the persistent object - std::auto_ptr<RecoTimingObj_p1> persObj( poolReadObject<RecoTimingObj_p1>() ); + std::unique_ptr<RecoTimingObj_p1> persObj( poolReadObject<RecoTimingObj_p1>() ); RecoTimingObjCnv_p1 cnv; transObj = cnv.createTransient( persObj.get(), *m_msg ); } else { diff --git a/Reconstruction/RecExample/RecExOnline/python/OnlineISConfiguration.py b/Reconstruction/RecExample/RecExOnline/python/OnlineISConfiguration.py index a59fa4a7e8004ea6ec9c00daf78f86a2b0026544..fbda833b60f61ad6cb9b99936c99e48464327dc5 100644 --- a/Reconstruction/RecExample/RecExOnline/python/OnlineISConfiguration.py +++ b/Reconstruction/RecExample/RecExOnline/python/OnlineISConfiguration.py @@ -1,4 +1,9 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + +from __future__ import print_function +from future import standard_library +standard_library.install_aliases() +import subprocess import ispy @@ -10,7 +15,7 @@ def GetAtlasReady(): r4p.checkout() return r4p.ready4physics except: - print "#### Failed to determine if we are ready for physics" + print ("#### Failed to determine if we are ready for physics") raise def GetRunType(): @@ -41,7 +46,7 @@ def GetRunType(): runparams.checkout() beamEnergy = runparams.beam_energy projectTag = runparams.T0_project_tag - except UserWarning, err: + except UserWarning as err: mlog.error(err) beamEnergy = None projectTag = None @@ -94,7 +99,7 @@ def GetBFields(): #And calculate the flags solOn = ((solCurrent.value > 1000.) and (solInvalid.value == 0)) torOn = ((torCurrent.value > 1000.) and (torInvalid.value == 0)) - except UserWarning, err: + except UserWarning as err: mlog.error(err) #Should always be able to access initial parititon mlog.fatal("Failed to read magnetic field configuration from IS, aborting") @@ -110,6 +115,6 @@ def GetBFields(): if __name__ == "__main__": runType = GetRunType() - print "(BeamType, BeamEnergy, ProjectTag): ", runType + print ("(BeamType, BeamEnergy, ProjectTag): ", runType) bFields = GetBFields() - print "(SolCurrent, TorCurrent):", (bFields[0].value, bFields[1].value) + print ("(SolCurrent, TorCurrent):", (bFields[0].value, bFields[1].value)) diff --git a/Reconstruction/RecExample/RecExOnline/python/comparison_plot.py b/Reconstruction/RecExample/RecExOnline/python/comparison_plot.py index 0f1e3463f3cdcfad2549c4822fb9345d357f26fa..998b759b7ce1ab1651d07f91164380ce84e5446f 100644 --- a/Reconstruction/RecExample/RecExOnline/python/comparison_plot.py +++ b/Reconstruction/RecExample/RecExOnline/python/comparison_plot.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """ Draw comparison plots and statistical tables for each 2 histograms inside 2 data sets. @@ -22,7 +22,7 @@ import copy from UnbinnedHist import UnbinnedHist from hash_tool import HashTool matplotlib.rcParams["text.usetex"]=True -matplotlib.rcParams['text.latex.preamble']=['\usepackage{booktabs}'] +matplotlib.rcParams['text.latex.preamble']=['\\usepackage{booktabs}'] def tree(): return defaultdict(tree) #set_style('ATLAS',mpl=True) def set_yaxis(ax, tick=None): diff --git a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring.py b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring.py index cf1be02b84d6c12980f2b487b4f77f527e1e79c3..27e026683190283b36d3d7c4901d547d66a282a8 100644 --- a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring.py +++ b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring.py @@ -29,7 +29,7 @@ partitionName = os.environ.get("TDAQ_PARTITION", "ATLAS") publishNumber = os.environ.get("GLOBAL_JOB_NUMBER", "1") publishName = os.environ.get("TDAQ_APPLICATION_NAME", "GlobalMonitoring") -print publishName +printfunc (publishName) isserverName = 'Histogramming-Global-iss' # Ak: 26-05-2014 - needed to write out the gathere hsitograms to the correct server #streamName = 'MinBias' @@ -56,10 +56,10 @@ if (partitionName == 'ATLAS' or partitionName == 'ATLAS_MP1'): #streamName = 'Main' # Switching due to missingg Minbias stream -= 13/06/2015 AK try: if RecExOnline.OnlineISConfiguration.GetAtlasReady(): - print "ATLAS READY, reading express stream" + printfunc ("ATLAS READY, reading express stream") streamName = 'express' else: - print "ATLAS NOT READY, reading standby stream" + printfunc ("ATLAS NOT READY, reading standby stream") ### streamName = 'standby' ### streamName = 'physics_Standby' streamName = 'Standby' @@ -84,8 +84,8 @@ if (partitionName != 'ATLAS' and partitionName != 'ATLAS_MP1'): isserverName = 'Histogramming' -print "GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic -print "publishName : ",publishName +printfunc ("GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic) +printfunc ("publishName : ",publishName) #import time @@ -93,23 +93,25 @@ print "publishName : ",publishName #tosleep = myfloat*5 #time.sleep(tosleep) -import commands -pids=commands.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") -print "pids",pids +from future import standard_library +standard_library.install_aliases() +import subprocess +pids=subprocess.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") +printfunc ("pids",pids) for pid in pids: - print "pid",pid + printfunc ("pid",pid) #if (False): #if (1): if (0): - print "pid = ",pid - #thisnumber=commands.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - thisname=commands.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - print "thisname = ",thisname - print "publishName = ",publishName + printfunc ("pid = ",pid) + #thisnumber=subprocess.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + thisname=subprocess.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + printfunc ("thisname = ",thisname) + printfunc ("publishName = ",publishName) if (thisname == publishName): - print "found a match! Will Kill pid = ",pid - killreturn = commands.getoutput("kill %u" % int(pid)) + printfunc ("found a match! Will Kill pid = ",pid) + killreturn = subprocess.getoutput("kill %u" % int(pid)) useAtlantisEmon = False @@ -260,7 +262,7 @@ DQMonFlags.doLVL1CaloMon.set_Value_and_Lock(False) ### DQMonFlags.doMuonTrkPhysMon.set_Value_and_Lock(False) #xx DQMonFlags.doMuonTrkPhysMon.set_Value_and_Lock(True) #xx ### DQMonFlags.doJetTagMon.set_Value_and_Lock(False) -#print "#### yunju Here is DQMonFlags.monManEnvironment:"+DQMonFlags.monManEnvironment +#printfunc ("#### yunju Here is DQMonFlags.monManEnvironment:"+DQMonFlags.monManEnvironment) ## for egmma monitoring in lxplus #if isHI_2016: # DQMonFlags.monManEnvironment.set_Value_and_Lock('tier0') diff --git a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_HI_2018.py b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_HI_2018.py index 83afe499b09ebb84d826e60cd1ff173706d89f8e..98e4085fc7916f2d0fd1da7f87eaa4c6cad21319 100644 --- a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_HI_2018.py +++ b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_HI_2018.py @@ -1,7 +1,7 @@ ## -- Overview of all default local settings that one can change ## -- The default values are also shown. -print "SMW in GM_HI" +printfunc ("SMW in GM_HI") isHI_mode = True @@ -33,7 +33,7 @@ partitionName = os.environ.get("TDAQ_PARTITION", "ATLAS") publishNumber = os.environ.get("GLOBAL_JOB_NUMBER", "1") publishName = os.environ.get("TDAQ_APPLICATION_NAME", "GlobalMonitoring") -print publishName +printfunc (publishName) isserverName = 'Histogramming-Global-iss' # Ak: 26-05-2014 - needed to write out the gathere hsitograms to the correct server #streamName = 'MinBias' @@ -60,13 +60,13 @@ if (partitionName == 'ATLAS' or partitionName == 'ATLAS_MP1'): #streamName = 'Main' # Switching due to missingg Minbias stream -= 13/06/2015 AK try: if RecExOnline.OnlineISConfiguration.GetAtlasReady(): - print "ATLAS READY, reading express stream" + printfunc ("ATLAS READY, reading express stream") streamName = 'express' ### streamName = 'express:MinBias:Standby' ### streamName = 'express:MinBias' ### streamName = 'MinBias:L1Calo' else: - print "ATLAS NOT READY, reading standby stream" + printfunc ("ATLAS NOT READY, reading standby stream") ### streamName = 'standby' ### streamName = 'physics_Standby' ### streamName = 'Standby' @@ -94,8 +94,8 @@ if (partitionName != 'ATLAS' and partitionName != 'ATLAS_MP1'): isserverName = 'Histogramming' -print "GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic -print "publishName : ",publishName +printfunc ("GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic) +printfunc ("publishName : ",publishName) #import time @@ -103,23 +103,25 @@ print "publishName : ",publishName #tosleep = myfloat*5 #time.sleep(tosleep) -import commands -pids=commands.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") -print "pids",pids +from future import standard_library +standard_library.install_aliases() +import subprocess +pids=subprocess.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") +printfunc ("pids",pids) for pid in pids: - print "pid",pid + printfunc ("pid",pid) #if (False): #if (1): if (0): - print "pid = ",pid - #thisnumber=commands.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - thisname=commands.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - print "thisname = ",thisname - print "publishName = ",publishName + printfunc ("pid = ",pid) + #thisnumber=subprocess.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + thisname=subprocess.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + printfunc ("thisname = ",thisname) + printfunc ("publishName = ",publishName) if (thisname == publishName): - print "found a match! Will Kill pid = ",pid - killreturn = commands.getoutput("kill %u" % int(pid)) + printfunc ("found a match! Will Kill pid = ",pid) + killreturn = subprocess.getoutput("kill %u" % int(pid)) useAtlantisEmon = False @@ -290,7 +292,7 @@ DQMonFlags.doLVL1CaloMon.set_Value_and_Lock(False) ### DQMonFlags.doMuonTrkPhysMon.set_Value_and_Lock(False) #xx DQMonFlags.doMuonTrkPhysMon.set_Value_and_Lock(True) #xx ### DQMonFlags.doJetTagMon.set_Value_and_Lock(False) -#print "#### yunju Here is DQMonFlags.monManEnvironment:"+DQMonFlags.monManEnvironment +#printfunc ("#### yunju Here is DQMonFlags.monManEnvironment:"+DQMonFlags.monManEnvironment) ## for egmma monitoring in lxplus #if isHI_2016: # DQMonFlags.monManEnvironment.set_Value_and_Lock('tier0') diff --git a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_RunHIPP.py b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_RunHIPP.py index a6ec3ba479c82ca452b0329bfd81919f6a236f7f..8bca31bb4a9ae3ed043d659db32d86a4deef4363 100644 --- a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_RunHIPP.py +++ b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_RunHIPP.py @@ -29,7 +29,7 @@ partitionName = os.environ.get("TDAQ_PARTITION", "ATLAS") publishNumber = os.environ.get("GLOBAL_JOB_NUMBER", "1") publishName = os.environ.get("TDAQ_APPLICATION_NAME", "GlobalMonitoring") -print publishName +printfunc (publishName) isserverName = 'Histogramming-Global-iss' # Ak: 26-05-2014 - needed to write out the gathere hsitograms to the correct server #streamName = 'MinBias' @@ -56,10 +56,10 @@ if (partitionName == 'ATLAS'): #streamName = 'Main' # Switching due to missingg Minbias stream -= 13/06/2015 AK try: if RecExOnline.OnlineISConfiguration.GetAtlasReady(): - print "ATLAS READY, reading express stream" + printfunc ("ATLAS READY, reading express stream") streamName = 'express' else: - print "ATLAS NOT READY, reading standby stream" + printfunc ("ATLAS NOT READY, reading standby stream") ### streamName = 'standby' ### streamName = 'physics_Standby' streamName = 'Standby' @@ -84,8 +84,8 @@ if (partitionName != 'ATLAS'): isserverName = 'Histogramming' -print "GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic -print "publishName : ",publishName +printfunc ("GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic) +printfunc ("publishName : ",publishName) #import time @@ -93,23 +93,25 @@ print "publishName : ",publishName #tosleep = myfloat*5 #time.sleep(tosleep) -import commands -pids=commands.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") -print "pids",pids +from future import standard_library +standard_library.install_aliases() +import subprocess +pids=subprocess.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") +printfunc ("pids",pids) for pid in pids: - print "pid",pid + printfunc ("pid",pid) #if (False): #if (1): if (0): - print "pid = ",pid - #thisnumber=commands.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - thisname=commands.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - print "thisname = ",thisname - print "publishName = ",publishName + printfunc ("pid = ",pid) + #thisnumber=subprocess.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + thisname=subprocess.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + printfunc ("thisname = ",thisname) + printfunc ("publishName = ",publishName) if (thisname == publishName): - print "found a match! Will Kill pid = ",pid - killreturn = commands.getoutput("kill %u" % int(pid)) + printfunc ("found a match! Will Kill pid = ",pid) + killreturn = subprocess.getoutput("kill %u" % int(pid)) useAtlantisEmon = False @@ -257,7 +259,7 @@ DQMonFlags.doLVL1CaloMon.set_Value_and_Lock(False) ### DQMonFlags.doMuonTrkPhysMon.set_Value_and_Lock(False) #xx DQMonFlags.doMuonTrkPhysMon.set_Value_and_Lock(True) #xx ### DQMonFlags.doJetTagMon.set_Value_and_Lock(False) -#print "#### yunju Here is DQMonFlags.monManEnvironment:"+DQMonFlags.monManEnvironment +#printfunc ("#### yunju Here is DQMonFlags.monManEnvironment:"+DQMonFlags.monManEnvironment) ## for egmma monitoring in lxplus #if isHI_2016: # DQMonFlags.monManEnvironment.set_Value_and_Lock('tier0') diff --git a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_defaultHI.py b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_defaultHI.py index d098d87e1c3ee748827edf4a621a0205b646e967..b98a4af28c8ede0e35dfaa8f73ef770e27afe5b5 100644 --- a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_defaultHI.py +++ b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_defaultHI.py @@ -26,7 +26,7 @@ partitionName = os.environ.get("TDAQ_PARTITION", "ATLAS") publishNumber = os.environ.get("GLOBAL_JOB_NUMBER", "1") publishName = os.environ.get("TDAQ_APPLICATION_NAME", "GlobalMonitoring") -print publishName +printfunc (publishName) isserverName = 'Histogramming-Global-iss' # Ak: 26-05-2014 - needed to write out the gathere hsitograms to the correct server #streamName = 'MinBias' @@ -53,10 +53,10 @@ if (partitionName == 'ATLAS'): #streamName = 'Main' # Switching due to missingg Minbias stream -= 13/06/2015 AK try: if RecExOnline.OnlineISConfiguration.GetAtlasReady(): - print "ATLAS READY, reading express stream" + printfunc ("ATLAS READY, reading express stream") streamName = 'express' else: - print "ATLAS NOT READY, reading standby stream" + printfunc ("ATLAS NOT READY, reading standby stream") ### streamName = 'standby' ### streamName = 'physics_Standby' streamName = 'Standby' @@ -79,8 +79,8 @@ if (partitionName != 'ATLAS'): isserverName = 'Histogramming' -print "GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic -print "publishName : ",publishName +printfunc ("GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic) +printfunc ("publishName : ",publishName) #import time @@ -88,23 +88,25 @@ print "publishName : ",publishName #tosleep = myfloat*5 #time.sleep(tosleep) -import commands -pids=commands.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") -print "pids",pids +from future import standard_library +standard_library.install_aliases() +import subprocess +pids=subprocess.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") +printfunc ("pids",pids) for pid in pids: - print "pid",pid + printfunc ("pid",pid) #if (False): #if (1): if (0): - print "pid = ",pid - #thisnumber=commands.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - thisname=commands.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - print "thisname = ",thisname - print "publishName = ",publishName + printfunc ("pid = ",pid) + #thisnumber=subprocess.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + thisname=subprocess.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + printfunc ("thisname = ",thisname) + printfunc ("publishName = ",publishName) if (thisname == publishName): - print "found a match! Will Kill pid = ",pid - killreturn = commands.getoutput("kill %u" % int(pid)) + printfunc ("found a match! Will Kill pid = ",pid) + killreturn = subprocess.getoutput("kill %u" % int(pid)) useAtlantisEmon = False @@ -246,7 +248,7 @@ DQMonFlags.doLVL1CaloMon.set_Value_and_Lock(False) ### DQMonFlags.doMuonTrkPhysMon.set_Value_and_Lock(False) #xx DQMonFlags.doMuonTrkPhysMon.set_Value_and_Lock(True) #xx ### DQMonFlags.doJetTagMon.set_Value_and_Lock(False) -#print "#### yunju Here is DQMonFlags.monManEnvironment:"+DQMonFlags.monManEnvironment +#printfunc ("#### yunju Here is DQMonFlags.monManEnvironment:"+DQMonFlags.monManEnvironment) ## for egmma monitoring in lxplus #DQMonFlags.monManEnvironment.set_Value_and_Lock('tier0') diff --git a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_defaultpp.py b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_defaultpp.py index 76f668d5cdc962dba7608b4b242652e13705b4a0..daad8021075d907bea3481ad39069b9d7bdff540 100644 --- a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_defaultpp.py +++ b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_defaultpp.py @@ -25,7 +25,7 @@ partitionName = os.environ.get("TDAQ_PARTITION", "ATLAS") publishNumber = os.environ.get("GLOBAL_JOB_NUMBER", "1") publishName = os.environ.get("TDAQ_APPLICATION_NAME", "GlobalMonitoring") -print publishName +printfunc (publishName) isserverName = 'Histogramming-Global-iss' # Ak: 26-05-2014 - needed to write out the gathere hsitograms to the correct server #streamName = 'MinBias' @@ -52,10 +52,10 @@ if (partitionName == 'ATLAS'): #streamName = 'Main' # Switching due to missingg Minbias stream -= 13/06/2015 AK try: if RecExOnline.OnlineISConfiguration.GetAtlasReady(): - print "ATLAS READY, reading express stream" + printfunc ("ATLAS READY, reading express stream") streamName = 'express' else: - print "ATLAS NOT READY, reading standby stream" + printfunc ("ATLAS NOT READY, reading standby stream") ### streamName = 'standby' ### streamName = 'physics_Standby' streamName = 'Standby' @@ -74,8 +74,8 @@ if (partitionName != 'ATLAS'): isserverName = 'Histogramming' -print "GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic -print "publishName : ",publishName +printfunc ("GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic) +printfunc ("publishName : ",publishName) #import time @@ -83,23 +83,25 @@ print "publishName : ",publishName #tosleep = myfloat*5 #time.sleep(tosleep) -import commands -pids=commands.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") -print "pids",pids +from future import standard_library +standard_library.install_aliases() +import subprocess +pids=subprocess.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") +printfunc ("pids",pids) for pid in pids: - print "pid",pid + printfunc ("pid",pid) #if (False): #if (1): if (0): - print "pid = ",pid - #thisnumber=commands.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - thisname=commands.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - print "thisname = ",thisname - print "publishName = ",publishName + printfunc ("pid = ",pid) + #thisnumber=subprocess.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + thisname=subprocess.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + printfunc ("thisname = ",thisname) + printfunc ("publishName = ",publishName) if (thisname == publishName): - print "found a match! Will Kill pid = ",pid - killreturn = commands.getoutput("kill %u" % int(pid)) + printfunc ("found a match! Will Kill pid = ",pid) + killreturn = subprocess.getoutput("kill %u" % int(pid)) useAtlantisEmon = False diff --git a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_pp_2018.py b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_pp_2018.py index 547229bd713a6837f6f88c2b0aff04d421840782..e6920228cc010e95636edfcd91f2fdc47a96c245 100644 --- a/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_pp_2018.py +++ b/Reconstruction/RecExample/RecExOnline/share/GlobalMonitoring_pp_2018.py @@ -31,7 +31,7 @@ partitionName = os.environ.get("TDAQ_PARTITION", "ATLAS") publishNumber = os.environ.get("GLOBAL_JOB_NUMBER", "1") publishName = os.environ.get("TDAQ_APPLICATION_NAME", "GlobalMonitoring") -print publishName +printfunc (publishName) isserverName = 'Histogramming-Global-iss' # Ak: 26-05-2014 - needed to write out the gathere hsitograms to the correct server #streamName = 'MinBias' @@ -58,13 +58,13 @@ if (partitionName == 'ATLAS' or partitionName == 'ATLAS_MP1'): #streamName = 'Main' # Switching due to missingg Minbias stream -= 13/06/2015 AK try: if RecExOnline.OnlineISConfiguration.GetAtlasReady(): - print "ATLAS READY, reading express stream" + printfunc ("ATLAS READY, reading express stream") streamName = 'express' ### streamName = 'express:MinBias:Standby' ### streamName = 'express:MinBias' ### streamName = 'MinBias:L1Calo' else: - print "ATLAS NOT READY, reading standby stream" + printfunc ("ATLAS NOT READY, reading standby stream") ### streamName = 'standby' ### streamName = 'physics_Standby' ### streamName = 'Standby' @@ -92,8 +92,8 @@ if (partitionName != 'ATLAS' and partitionName != 'ATLAS_MP1'): isserverName = 'Histogramming' -print "GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic -print "publishName : ",publishName +printfunc ("GlobalMonitoring : streamName streamLogic= ",streamName,streamLogic) +printfunc ("publishName : ",publishName) #import time @@ -101,23 +101,25 @@ print "publishName : ",publishName #tosleep = myfloat*5 #time.sleep(tosleep) -import commands -pids=commands.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") -print "pids",pids +from future import standard_library +standard_library.install_aliases() +import subprocess +pids=subprocess.getoutput("/sbin/pidof -o %u python" % os.getpid()).split(" ") +printfunc ("pids",pids) for pid in pids: - print "pid",pid + printfunc ("pid",pid) #if (False): #if (1): if (0): - print "pid = ",pid - #thisnumber=commands.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - thisname=commands.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) - print "thisname = ",thisname - print "publishName = ",publishName + printfunc ("pid = ",pid) + #thisnumber=subprocess.getoutput("grep GLOBAL_JOB_NUMBER /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + thisname=subprocess.getoutput("grep TDAQ_APPLICATION_NAME /proc/%u/fd/1 -m 1 | cut -f2 -d'='" % int(pid)) + printfunc ("thisname = ",thisname) + printfunc ("publishName = ",publishName) if (thisname == publishName): - print "found a match! Will Kill pid = ",pid - killreturn = commands.getoutput("kill %u" % int(pid)) + printfunc ("found a match! Will Kill pid = ",pid) + killreturn = subprocess.getoutput("kill %u" % int(pid)) useAtlantisEmon = False @@ -276,7 +278,7 @@ DQMonFlags.doLVL1CaloMon.set_Value_and_Lock(False) ### DQMonFlags.doMuonTrkPhysMon.set_Value_and_Lock(False) #xx DQMonFlags.doMuonTrkPhysMon.set_Value_and_Lock(True) #xx ### DQMonFlags.doJetTagMon.set_Value_and_Lock(False) -#print "#### yunju Here is DQMonFlags.monManEnvironment:"+DQMonFlags.monManEnvironment +#printfunc ("#### yunju Here is DQMonFlags.monManEnvironment:"+DQMonFlags.monManEnvironment) ## for egmma monitoring in lxplus #if isHI_2016: # DQMonFlags.monManEnvironment.set_Value_and_Lock('tier0') diff --git a/Reconstruction/RecExample/RecExOnline/share/RTTAlgmain.py b/Reconstruction/RecExample/RecExOnline/share/RTTAlgmain.py index 280bb3cfd9d379b1d09ce40cf363ddb126cbfc79..a2f6a2702573bf76510bd9eb1eaa790c0ea30a71 100644 --- a/Reconstruction/RecExample/RecExOnline/share/RTTAlgmain.py +++ b/Reconstruction/RecExample/RecExOnline/share/RTTAlgmain.py @@ -3,7 +3,7 @@ import numpy as np import ROOT sys.path.append(os.path.join(os.path.dirname(__file__),'HistCompare')) -print(sys.path) +printfunc (sys.path) from RecExOnline.power_of_test import power_of_test from RecExOnline.utils import get_array import warnings @@ -23,12 +23,12 @@ from collections import Counter, defaultdict import datetime currenttime=datetime.datetime.now() rel=currenttime.isoweekday() -print "Time for RTT Alg : %d" %currenttime.hour +printfunc ("Time for RTT Alg : %d" %currenttime.hour) if currenttime.hour>15: rel=rel+1 if rel==7: rel=0 -print "rel for RTT Alg : %d" %rel +printfunc ("rel for RTT Alg : %d" %rel) #output format header = dict([("Object", max(len(h) for h in histnames)),("Test",max(len(t.split("_")[0]) for t in tests)),("p-value",21)]) @@ -45,8 +45,8 @@ output_tree = ROOT.TTree("Tree", "Tree") output_tree.SetEntries(size) #main program -print std_line[0].ljust(header["Object"]), std_line[1].ljust(header["Test"]), std_line[2].center(header["p-value"]) -print "="*header["Object"], "="*header["Test"], "="*header["p-value"] +printfunc (std_line[0].ljust(header["Object"]), std_line[1].ljust(header["Test"]), std_line[2].center(header["p-value"])) +printfunc ("="*header["Object"], "="*header["Test"], "="*header["p-value"]) for histname, hist_pair in hist_pairs: output_tree.Branch("/"+histname.replace("/",".")) bins = np.intersect1d(*map(lambda hist: [hist.GetBinLowEdge(i) for i in range(1, hist.GetNbinsX()+2)], hist_pair)) @@ -62,13 +62,13 @@ for histname, hist_pair in hist_pairs: p_arr = np.array(p_arr).round(5) if test == "anderson_ksamp": p_arr[p_arr >= 1.2] = 0. - print (histname if std_line[0]!=histname else "").ljust(header["Object"]), (test.split("_")[0] if std_line[1]!=test else "").ljust(header["Test"]), "{:>8} +/- {:<8} (%)".format(round(p_arr.mean()*100,1),round(p_arr.std()*100,2)) + printfunc ((histname if std_line[0]!=histname else "").ljust(header["Object"]), (test.split("_")[0] if std_line[1]!=test else "").ljust(header["Test"]), "{:>8} +/- {:<8} (%)".format(round(p_arr.mean()*100,1),round(p_arr.std()*100,2))) Testresult= "%s %s:%s +- %s" % (histname,test ,p_arr.mean(),p_arr.std()) if test =="ks_2samp" and (p_arr.mean()+p_arr.std()<0.05): Testresult= "<font color=\"red\">%s %s:%s +- %s </font>" % (histname,test ,p_arr.mean(),p_arr.std()) Matrix[h_th]= Testresult h_th+=1 - print "matrix index check : %d "%(h_th) + printfunc ("matrix index check : %d "%(h_th)) sys.stdout.flush() std_line[:2] = histname, test for p in p_arr: @@ -77,7 +77,7 @@ for histname, hist_pair in hist_pairs: output_file.Write("", 2) for f in files: f.Close() output_file.Close() -print(Matrix) +printfunc (Matrix) diff --git a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_ID.py b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_ID.py index 104b2f97d042866c6b660fa0b8d39680fa23eae6..5cb6057b9aa3c5826a97810b546a793805e47fc4 100644 --- a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_ID.py +++ b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_ID.py @@ -46,7 +46,7 @@ if(partitionName == "ATLAS"): InDetFlags.doHeavyIon.set_Value_and_Lock(True) InDetFlags.cutLevel = 2 if RecExOnline.OnlineISConfiguration.GetAtlasReady(): - print "ATLAS READY, reading express stream" + printfunc ("ATLAS READY, reading express stream") streamName = 'express:IDMonDummyStream' streamType = 'express' if obj.T0_project_tag == 'data15_hi': @@ -55,10 +55,10 @@ if(partitionName == "ATLAS"): #streamName = 'IDTrack:IDMonDummyStream' #streamType = 'calib' else: - print "ATLAS NOT READY, reading standby stream" + printfunc ("ATLAS NOT READY, reading standby stream") streamName = 'Standby:IDMonDummyStream' except: - print "EXCEPTION" + printfunc ("EXCEPTION") streamName = 'express:IDMonDummyStream' elif obj.T0_project_tag == 'data16_1beam': streamName = 'express' diff --git a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo.py b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo.py index 1b7c7517bee1ade3e29e22684048831792f635bf..43a657cc8c5df448e0e2da2d280a49e9474c751b 100644 --- a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo.py +++ b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo.py @@ -203,70 +203,70 @@ include ("RecExOnline/RecExOnline_jobOptions.py") -print ' ' -print '-------------------------------------------------------------' -print '| RecExOnline_globalconfig settings' -print '| usePickleConfig = ',usePickleConfig -print '| DataSource = ',DataSource -print '| InputFormat = ',InputFormat -print '| fileName = ',fileName -#print '| doESD = ',doESD -print '| writeESD = ',writeESD -#print '| doAOD = ',doAOD -print '| writeAOD = ',writeAOD -print '| isOnlineStateless = ',isOnlineStateless -print '| beamType = ',beamType -print '| is_T0_project_tag = ',is_T0_project_tag -print '| ConditionsTag = ',ConditionsTag -#print '| DetDescrVersion = ',DetDescrVersion -print '| doPixelOnlyMon = ',doPixelOnlyMon -print '| evtMax = ',evtMax -print '-------------------------------------------------------------' -print '| RecExOnline_recoflags settings' -print '| doAllReco = ',doAllReco -print '| doInDet = ',doInDet -print '| doMuon = ',doMuon -print '| doLArg = ',doLArg -print '| doTile = ',doTile -print '| doLucid = ',doLucid -#print '| doTrigger = ',doTrigger -#print '| doHist = ',doHist -#print '| doJiveXML = ',doJiveXML -print '| doEgammaTau = ',doEgammaTau -print '| doCommissioning = ',doCommissioning -print '| abortonuncheckedstatuscode = ',abortonuncheckedstatuscode -print '-------------------------------------------------------------' -print '| RecExOnline_monitoring settings' -print '| doAllMon = ',doAllMon -print '| doCaloMon = ',doCaloMon -print '| doPhysMon = ',doPhysMon -print '| doHLTMon = ',doHLTMon -print '| doLVL1CaloMon = ',doLVL1CaloMon -print '| doCTPMon = ',doCTPMon -print '| doIDMon = ',doIDMon -print '| doPixelOnlyMon = ',doPixelOnlyMon -print '| doSCTMon = ',doSCTMon -print '| doMuonMon = ',doMuonMon -print '| doTRTMon = ',doTRTMon -print '| doLucidMon = ',doLucidMon -print '| isOnline = ',isOnline -print '-------------------------------------------------------------' -print '| RecExOnline: emonsvc settings' -print '| partitionName = ',partitionName -print '| publishName = ',publishName -print '| streamNames = ',streamName -print '| streamType = ',streamType -print '| streamLogic = ',streamLogic -print '| lvl1Name = ',lvl1Name -print '| lvl1Logic = ',lvl1Logic -print '| keyname = ',keyname -print '| keycount = ',keycount -print '| buffersize = ',buffersize -print '| updateperiod = ',updateperiod -print '| timeout = ',timeout -print '| isserverName = ',isserverName -print '| isGlobalMonitoring = ',isGlobalMonitoring -print '--------------------------------------------------------------' +printfunc (' ') +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline_globalconfig settings') +printfunc ('| usePickleConfig = ',usePickleConfig) +printfunc ('| DataSource = ',DataSource) +printfunc ('| InputFormat = ',InputFormat) +printfunc ('| fileName = ',fileName) +#printfunc ('| doESD = ',doESD) +printfunc ('| writeESD = ',writeESD) +#printfunc ('| doAOD = ',doAOD) +printfunc ('| writeAOD = ',writeAOD) +printfunc ('| isOnlineStateless = ',isOnlineStateless) +printfunc ('| beamType = ',beamType) +printfunc ('| is_T0_project_tag = ',is_T0_project_tag) +printfunc ('| ConditionsTag = ',ConditionsTag) +#printfunc ('| DetDescrVersion = ',DetDescrVersion) +printfunc ('| doPixelOnlyMon = ',doPixelOnlyMon) +printfunc ('| evtMax = ',evtMax) +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline_recoflags settings') +printfunc ('| doAllReco = ',doAllReco) +printfunc ('| doInDet = ',doInDet) +printfunc ('| doMuon = ',doMuon) +printfunc ('| doLArg = ',doLArg) +printfunc ('| doTile = ',doTile) +printfunc ('| doLucid = ',doLucid) +#printfunc ('| doTrigger = ',doTrigger) +#printfunc ('| doHist = ',doHist) +#printfunc ('| doJiveXML = ',doJiveXML) +printfunc ('| doEgammaTau = ',doEgammaTau) +printfunc ('| doCommissioning = ',doCommissioning) +printfunc ('| abortonuncheckedstatuscode = ',abortonuncheckedstatuscode) +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline_monitoring settings') +printfunc ('| doAllMon = ',doAllMon) +printfunc ('| doCaloMon = ',doCaloMon) +printfunc ('| doPhysMon = ',doPhysMon) +printfunc ('| doHLTMon = ',doHLTMon) +printfunc ('| doLVL1CaloMon = ',doLVL1CaloMon) +printfunc ('| doCTPMon = ',doCTPMon) +printfunc ('| doIDMon = ',doIDMon) +printfunc ('| doPixelOnlyMon = ',doPixelOnlyMon) +printfunc ('| doSCTMon = ',doSCTMon) +printfunc ('| doMuonMon = ',doMuonMon) +printfunc ('| doTRTMon = ',doTRTMon) +printfunc ('| doLucidMon = ',doLucidMon) +printfunc ('| isOnline = ',isOnline) +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline: emonsvc settings') +printfunc ('| partitionName = ',partitionName) +printfunc ('| publishName = ',publishName) +printfunc ('| streamNames = ',streamName) +printfunc ('| streamType = ',streamType) +printfunc ('| streamLogic = ',streamLogic) +printfunc ('| lvl1Name = ',lvl1Name) +printfunc ('| lvl1Logic = ',lvl1Logic) +printfunc ('| keyname = ',keyname) +printfunc ('| keycount = ',keycount) +printfunc ('| buffersize = ',buffersize) +printfunc ('| updateperiod = ',updateperiod) +printfunc ('| timeout = ',timeout) +printfunc ('| isserverName = ',isserverName) +printfunc ('| isGlobalMonitoring = ',isGlobalMonitoring) +printfunc ('--------------------------------------------------------------') #from AthenaCommon.AppMgr import ServiceMgr #from TrigT1CaloCondSvc.TrigT1CaloCondSvcConf import L1CaloCondSvc @@ -363,7 +363,7 @@ print '--------------------------------------------------------------' if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") >= 0) : #if (partitionName.find("L1CaloStandalone") >= 0) : - print "L1Calo Monitoring is overriding the run number and lumiblock number." + printfunc ("L1Calo Monitoring is overriding the run number and lumiblock number.") import ispy ## this should retrieve the run number automatically as done in RecExOnline_globalconfig.py from ispy import * from ipc import IPCPartition @@ -375,7 +375,7 @@ if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") svcMgr.IOVDbSvc.forceRunNumber = is_run_number #svcMgr.IOVDbSvc.forceRunNumber=313285 #313063 #312649(HI) #312424(HI) #309640 #271733 #182519 #238735 svcMgr.IOVDbSvc.forceLumiblockNumber=1 - print "L1Calo Monitoring set run to ",svcMgr.IOVDbSvc.forceRunNumber,"and lumi block to",svcMgr.IOVDbSvc.forceLumiblockNumber + printfunc ("L1Calo Monitoring set run to ",svcMgr.IOVDbSvc.forceRunNumber,"and lumi block to",svcMgr.IOVDbSvc.forceLumiblockNumber) #from IOVDbSvc.CondDB import conddb #conddb.addFolder("TRIGGER","/TRIGGER/HLT/Menu <tag>HEAD</tag>") @@ -408,7 +408,7 @@ if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") # only offline from RecExConfig.InputFilePeeker import inputFileSummary - print "inputFileSummary =",inputFileSummary + printfunc ("inputFileSummary =",inputFileSummary) if inputFileSummary.__contains__('bs_metadata'): # get the run number and lumi_block for the input run_number = inputFileSummary['bs_metadata']['run_number'] @@ -416,7 +416,7 @@ if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") pointintime = (int(run_number)<<32) + int(lumi_block) # start from lumiblock 0 (or 1?) DBInstance = svcMgr.IOVDbSvc.properties()['DBInstance'] - print "L1Calo Monitoring check DBInstance ",DBInstance + printfunc ("L1Calo Monitoring check DBInstance ",DBInstance) connstring = "COOLONL_TRIGGER/"+str(DBInstance) from CoolConvUtilities.AtlCoolLib import indirectOpen coolDB=indirectOpen(connstring,oracle='True') @@ -426,9 +426,9 @@ if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") retrieved_payload=retrieved_obj.payload() retrieved_format=retrieved_payload['MasterConfigurationKey'] SuperMasterKey=int(999) - print "SMK SuperMasterKey default =",SuperMasterKey + printfunc ("SMK SuperMasterKey default =",SuperMasterKey) SuperMasterKey = int(retrieved_format) - print "SMK SuperMasterKey from Cool =",SuperMasterKey + printfunc ("SMK SuperMasterKey from Cool =",SuperMasterKey) coolDB.closeDatabase() #from IOVDbSvc.CondDB import conddb diff --git a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo_Cosmics.py b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo_Cosmics.py index 0abbb60111a2ec92efadc7fa16fecfc7c80c1fc6..26287461b8643ee0d50eacc032b277b8f083c532 100644 --- a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo_Cosmics.py +++ b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo_Cosmics.py @@ -202,70 +202,70 @@ include ("RecExOnline/RecExOnline_jobOptions.py") -print ' ' -print '-------------------------------------------------------------' -print '| RecExOnline_globalconfig settings' -print '| usePickleConfig = ',usePickleConfig -print '| DataSource = ',DataSource -print '| InputFormat = ',InputFormat -print '| fileName = ',fileName -#print '| doESD = ',doESD -print '| writeESD = ',writeESD -#print '| doAOD = ',doAOD -print '| writeAOD = ',writeAOD -print '| isOnlineStateless = ',isOnlineStateless -print '| beamType = ',beamType -print '| is_T0_project_tag = ',is_T0_project_tag -print '| ConditionsTag = ',ConditionsTag -#print '| DetDescrVersion = ',DetDescrVersion -print '| doPixelOnlyMon = ',doPixelOnlyMon -print '| evtMax = ',evtMax -print '-------------------------------------------------------------' -print '| RecExOnline_recoflags settings' -print '| doAllReco = ',doAllReco -print '| doInDet = ',doInDet -print '| doMuon = ',doMuon -print '| doLArg = ',doLArg -print '| doTile = ',doTile -print '| doLucid = ',doLucid -#print '| doTrigger = ',doTrigger -#print '| doHist = ',doHist +printfunc (' ') +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline_globalconfig settings') +printfunc ('| usePickleConfig = ',usePickleConfig) +printfunc ('| DataSource = ',DataSource) +printfunc ('| InputFormat = ',InputFormat) +printfunc ('| fileName = ',fileName) +#printfunc ('| doESD = ',doESD) +printfunc ('| writeESD = ',writeESD) +#printfunc ('| doAOD = ',doAOD) +printfunc ('| writeAOD = ',writeAOD) +printfunc ('| isOnlineStateless = ',isOnlineStateless) +printfunc ('| beamType = ',beamType) +printfunc ('| is_T0_project_tag = ',is_T0_project_tag) +printfunc ('| ConditionsTag = ',ConditionsTag) +#printfunc ('| DetDescrVersion = ',DetDescrVersion) +printfunc ('| doPixelOnlyMon = ',doPixelOnlyMon) +printfunc ('| evtMax = ',evtMax) +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline_recoflags settings') +printfunc ('| doAllReco = ',doAllReco) +printfunc ('| doInDet = ',doInDet) +printfunc ('| doMuon = ',doMuon) +printfunc ('| doLArg = ',doLArg) +printfunc ('| doTile = ',doTile) +printfunc ('| doLucid = ',doLucid) +#printfunc ('| doTrigger = ',doTrigger) +#printfunc ('| doHist = ',doHist) #print '| doJiveXML = ',doJiveXML -print '| doEgammaTau = ',doEgammaTau -print '| doCommissioning = ',doCommissioning -print '| abortonuncheckedstatuscode = ',abortonuncheckedstatuscode -print '-------------------------------------------------------------' -print '| RecExOnline_monitoring settings' -print '| doAllMon = ',doAllMon -print '| doCaloMon = ',doCaloMon -print '| doPhysMon = ',doPhysMon -print '| doHLTMon = ',doHLTMon -print '| doLVL1CaloMon = ',doLVL1CaloMon -print '| doCTPMon = ',doCTPMon -print '| doIDMon = ',doIDMon -print '| doPixelOnlyMon = ',doPixelOnlyMon -print '| doSCTMon = ',doSCTMon -print '| doMuonMon = ',doMuonMon -print '| doTRTMon = ',doTRTMon -print '| doLucidMon = ',doLucidMon -print '| isOnline = ',isOnline -print '-------------------------------------------------------------' -print '| RecExOnline: emonsvc settings' -print '| partitionName = ',partitionName -print '| publishName = ',publishName -print '| streamNames = ',streamName -print '| streamType = ',streamType -print '| streamLogic = ',streamLogic -print '| lvl1Name = ',lvl1Name -print '| lvl1Logic = ',lvl1Logic -print '| keyname = ',keyname -print '| keycount = ',keycount -print '| buffersize = ',buffersize -print '| updateperiod = ',updateperiod -print '| timeout = ',timeout -print '| isserverName = ',isserverName -print '| isGlobalMonitoring = ',isGlobalMonitoring -print '--------------------------------------------------------------' +printfunc ('| doEgammaTau = ',doEgammaTau) +printfunc ('| doCommissioning = ',doCommissioning) +printfunc ('| abortonuncheckedstatuscode = ',abortonuncheckedstatuscode) +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline_monitoring settings') +printfunc ('| doAllMon = ',doAllMon) +printfunc ('| doCaloMon = ',doCaloMon) +printfunc ('| doPhysMon = ',doPhysMon) +printfunc ('| doHLTMon = ',doHLTMon) +printfunc ('| doLVL1CaloMon = ',doLVL1CaloMon) +printfunc ('| doCTPMon = ',doCTPMon) +printfunc ('| doIDMon = ',doIDMon) +printfunc ('| doPixelOnlyMon = ',doPixelOnlyMon) +printfunc ('| doSCTMon = ',doSCTMon) +printfunc ('| doMuonMon = ',doMuonMon) +printfunc ('| doTRTMon = ',doTRTMon) +printfunc ('| doLucidMon = ',doLucidMon) +printfunc ('| isOnline = ',isOnline) +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline: emonsvc settings') +printfunc ('| partitionName = ',partitionName) +printfunc ('| publishName = ',publishName) +printfunc ('| streamNames = ',streamName) +printfunc ('| streamType = ',streamType) +printfunc ('| streamLogic = ',streamLogic) +printfunc ('| lvl1Name = ',lvl1Name) +printfunc ('| lvl1Logic = ',lvl1Logic) +printfunc ('| keyname = ',keyname) +printfunc ('| keycount = ',keycount) +printfunc ('| buffersize = ',buffersize) +printfunc ('| updateperiod = ',updateperiod) +printfunc ('| timeout = ',timeout) +printfunc ('| isserverName = ',isserverName) +printfunc ('| isGlobalMonitoring = ',isGlobalMonitoring) +printfunc ('--------------------------------------------------------------') #from AthenaCommon.AppMgr import ServiceMgr #from TrigT1CaloCondSvc.TrigT1CaloCondSvcConf import L1CaloCondSvc @@ -362,10 +362,10 @@ print '--------------------------------------------------------------' if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") >= 0) : #if (partitionName.find("L1CaloStandalone") >= 0) : - print "L1Calo Monitoring is overriding the run number and lumiblock number." + printfunc ("L1Calo Monitoring is overriding the run number and lumiblock number.") svcMgr.IOVDbSvc.forceRunNumber=313285 #312649 #312424(HI) #309640 #271733 #182519 #238735 svcMgr.IOVDbSvc.forceLumiblockNumber=1 - print "L1Calo Monitoring set run to ",svcMgr.IOVDbSvc.forceRunNumber,"and lumi block to",svcMgr.IOVDbSvc.forceLumiblockNumber + printfunc ("L1Calo Monitoring set run to ",svcMgr.IOVDbSvc.forceRunNumber,"and lumi block to",svcMgr.IOVDbSvc.forceLumiblockNumber) #from IOVDbSvc.CondDB import conddb #conddb.addFolder("TRIGGER","/TRIGGER/HLT/Menu <tag>HEAD</tag>") @@ -398,7 +398,7 @@ if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") # only offline from RecExConfig.InputFilePeeker import inputFileSummary - print "inputFileSummary =",inputFileSummary + printfunc ("inputFileSummary =",inputFileSummary) if inputFileSummary.__contains__('bs_metadata'): # get the run number and lumi_block for the input run_number = inputFileSummary['bs_metadata']['run_number'] @@ -406,7 +406,7 @@ if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") pointintime = (int(run_number)<<32) + int(lumi_block) # start from lumiblock 0 (or 1?) DBInstance = svcMgr.IOVDbSvc.properties()['DBInstance'] - print "L1Calo Monitoring check DBInstance ",DBInstance + printfunc ("L1Calo Monitoring check DBInstance ",DBInstance) connstring = "COOLONL_TRIGGER/"+str(DBInstance) from CoolConvUtilities.AtlCoolLib import indirectOpen coolDB=indirectOpen(connstring,oracle='True') @@ -416,9 +416,9 @@ if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") retrieved_payload=retrieved_obj.payload() retrieved_format=retrieved_payload['MasterConfigurationKey'] SuperMasterKey=int(999) - print "SMK SuperMasterKey default =",SuperMasterKey + printfunc ("SMK SuperMasterKey default =",SuperMasterKey) SuperMasterKey = int(retrieved_format) - print "SMK SuperMasterKey from Cool =",SuperMasterKey + printfunc ("SMK SuperMasterKey from Cool =",SuperMasterKey) coolDB.closeDatabase() #from IOVDbSvc.CondDB import conddb diff --git a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo_Stability.py b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo_Stability.py index fbca813110b2b9cb4c1c93ebbae1de99f9b338e9..fe08153cff52c26c78935ea2fa2a2ac7e49b24cf 100644 --- a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo_Stability.py +++ b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_L1Calo_Stability.py @@ -215,70 +215,70 @@ include ("RecExOnline/RecExOnline_jobOptions.py") -print ' ' -print '-------------------------------------------------------------' -print '| RecExOnline_globalconfig settings' -print '| usePickleConfig = ',usePickleConfig -print '| DataSource = ',DataSource -print '| InputFormat = ',InputFormat -print '| fileName = ',fileName -#print '| doESD = ',doESD -print '| writeESD = ',writeESD -#print '| doAOD = ',doAOD -print '| writeAOD = ',writeAOD -print '| isOnlineStateless = ',isOnlineStateless -print '| beamType = ',beamType -print '| is_T0_project_tag = ',is_T0_project_tag -print '| ConditionsTag = ',ConditionsTag -#print '| DetDescrVersion = ',DetDescrVersion -print '| doPixelOnlyMon = ',doPixelOnlyMon -print '| evtMax = ',evtMax -print '-------------------------------------------------------------' -print '| RecExOnline_recoflags settings' -print '| doAllReco = ',doAllReco -print '| doInDet = ',doInDet -print '| doMuon = ',doMuon -print '| doLArg = ',doLArg -print '| doTile = ',doTile -print '| doLucid = ',doLucid -#print '| doTrigger = ',doTrigger -#print '| doHist = ',doHist -#print '| doJiveXML = ',doJiveXML -print '| doEgammaTau = ',doEgammaTau -print '| doCommissioning = ',doCommissioning -print '| abortonuncheckedstatuscode = ',abortonuncheckedstatuscode -print '-------------------------------------------------------------' -print '| RecExOnline_monitoring settings' -print '| doAllMon = ',doAllMon -print '| doCaloMon = ',doCaloMon -print '| doPhysMon = ',doPhysMon -print '| doHLTMon = ',doHLTMon -print '| doLVL1CaloMon = ',doLVL1CaloMon -print '| doCTPMon = ',doCTPMon -print '| doIDMon = ',doIDMon -print '| doPixelOnlyMon = ',doPixelOnlyMon -print '| doSCTMon = ',doSCTMon -print '| doMuonMon = ',doMuonMon -print '| doTRTMon = ',doTRTMon -print '| doLucidMon = ',doLucidMon -print '| isOnline = ',isOnline -print '-------------------------------------------------------------' -print '| RecExOnline: emonsvc settings' -print '| partitionName = ',partitionName -print '| publishName = ',publishName -print '| streamNames = ',streamName -print '| streamType = ',streamType -print '| streamLogic = ',streamLogic -print '| lvl1Name = ',lvl1Name -print '| lvl1Logic = ',lvl1Logic -print '| keyname = ',keyname -print '| keycount = ',keycount -print '| buffersize = ',buffersize -print '| updateperiod = ',updateperiod -print '| timeout = ',timeout -print '| isserverName = ',isserverName -print '| isGlobalMonitoring = ',isGlobalMonitoring -print '--------------------------------------------------------------' +printfunc (' ') +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline_globalconfig settings') +printfunc ('| usePickleConfig = ',usePickleConfig) +printfunc ('| DataSource = ',DataSource) +printfunc ('| InputFormat = ',InputFormat) +printfunc ('| fileName = ',fileName) +#printfunc ('| doESD = ',doESD) +printfunc ('| writeESD = ',writeESD) +#printfunc ('| doAOD = ',doAOD) +printfunc ('| writeAOD = ',writeAOD) +printfunc ('| isOnlineStateless = ',isOnlineStateless) +printfunc ('| beamType = ',beamType) +printfunc ('| is_T0_project_tag = ',is_T0_project_tag) +printfunc ('| ConditionsTag = ',ConditionsTag) +#printfunc ('| DetDescrVersion = ',DetDescrVersion) +printfunc ('| doPixelOnlyMon = ',doPixelOnlyMon) +printfunc ('| evtMax = ',evtMax) +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline_recoflags settings') +printfunc ('| doAllReco = ',doAllReco) +printfunc ('| doInDet = ',doInDet) +printfunc ('| doMuon = ',doMuon) +printfunc ('| doLArg = ',doLArg) +printfunc ('| doTile = ',doTile) +printfunc ('| doLucid = ',doLucid) +#printfunc ('| doTrigger = ',doTrigger) +#printfunc ('| doHist = ',doHist) +#printfunc ('| doJiveXML = ',doJiveXML) +printfunc ('| doEgammaTau = ',doEgammaTau) +printfunc ('| doCommissioning = ',doCommissioning) +printfunc ('| abortonuncheckedstatuscode = ',abortonuncheckedstatuscode) +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline_monitoring settings') +printfunc ('| doAllMon = ',doAllMon) +printfunc ('| doCaloMon = ',doCaloMon) +printfunc ('| doPhysMon = ',doPhysMon) +printfunc ('| doHLTMon = ',doHLTMon) +printfunc ('| doLVL1CaloMon = ',doLVL1CaloMon) +printfunc ('| doCTPMon = ',doCTPMon) +printfunc ('| doIDMon = ',doIDMon) +printfunc ('| doPixelOnlyMon = ',doPixelOnlyMon) +printfunc ('| doSCTMon = ',doSCTMon) +printfunc ('| doMuonMon = ',doMuonMon) +printfunc ('| doTRTMon = ',doTRTMon) +printfunc ('| doLucidMon = ',doLucidMon) +printfunc ('| isOnline = ',isOnline) +printfunc ('-------------------------------------------------------------') +printfunc ('| RecExOnline: emonsvc settings') +printfunc ('| partitionName = ',partitionName) +printfunc ('| publishName = ',publishName) +printfunc ('| streamNames = ',streamName) +printfunc ('| streamType = ',streamType) +printfunc ('| streamLogic = ',streamLogic) +printfunc ('| lvl1Name = ',lvl1Name) +printfunc ('| lvl1Logic = ',lvl1Logic) +printfunc ('| keyname = ',keyname) +printfunc ('| keycount = ',keycount) +printfunc ('| buffersize = ',buffersize) +printfunc ('| updateperiod = ',updateperiod) +printfunc ('| timeout = ',timeout) +printfunc ('| isserverName = ',isserverName) +printfunc ('| isGlobalMonitoring = ',isGlobalMonitoring) +printfunc ('--------------------------------------------------------------') #from AthenaCommon.AppMgr import ServiceMgr #from TrigT1CaloCondSvc.TrigT1CaloCondSvcConf import L1CaloCondSvc @@ -375,10 +375,10 @@ print '--------------------------------------------------------------' if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") >= 0) : #if (partitionName.find("L1CaloStandalone") >= 0) : - print "L1Calo Monitoring is overriding the run number and lumiblock number." + printfunc ("L1Calo Monitoring is overriding the run number and lumiblock number.") svcMgr.IOVDbSvc.forceRunNumber=313285 #312424 #309640 #271733 #182519 #238735 svcMgr.IOVDbSvc.forceLumiblockNumber=1 - print "L1Calo Monitoring set run to ",svcMgr.IOVDbSvc.forceRunNumber,"and lumi block to",svcMgr.IOVDbSvc.forceLumiblockNumber + printfunc ("L1Calo Monitoring set run to ",svcMgr.IOVDbSvc.forceRunNumber,"and lumi block to",svcMgr.IOVDbSvc.forceLumiblockNumber) #from IOVDbSvc.CondDB import conddb #conddb.addFolder("TRIGGER","/TRIGGER/HLT/Menu <tag>HEAD</tag>") @@ -411,7 +411,7 @@ if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") # only offline from RecExConfig.InputFilePeeker import inputFileSummary - print "inputFileSummary =",inputFileSummary + printfunc ("inputFileSummary =",inputFileSummary) if inputFileSummary.__contains__('bs_metadata'): # get the run number and lumi_block for the input run_number = inputFileSummary['bs_metadata']['run_number'] @@ -419,7 +419,7 @@ if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") pointintime = (int(run_number)<<32) + int(lumi_block) # start from lumiblock 0 (or 1?) DBInstance = svcMgr.IOVDbSvc.properties()['DBInstance'] - print "L1Calo Monitoring check DBInstance ",DBInstance + printfunc ("L1Calo Monitoring check DBInstance ",DBInstance) connstring = "COOLONL_TRIGGER/"+str(DBInstance) from CoolConvUtilities.AtlCoolLib import indirectOpen coolDB=indirectOpen(connstring,oracle='True') @@ -429,9 +429,9 @@ if (partitionName.find("L1CaloStandalone") >= 0) or (partitionName.find("ATLAS") retrieved_payload=retrieved_obj.payload() retrieved_format=retrieved_payload['MasterConfigurationKey'] SuperMasterKey=int(999) - print "SMK SuperMasterKey default =",SuperMasterKey + printfunc ("SMK SuperMasterKey default =",SuperMasterKey) SuperMasterKey = int(retrieved_format) - print "SMK SuperMasterKey from Cool =",SuperMasterKey + printfunc ("SMK SuperMasterKey from Cool =",SuperMasterKey) coolDB.closeDatabase() #from IOVDbSvc.CondDB import conddb diff --git a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_SCT.py b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_SCT.py index 158adedeb4af65e3fe6b80328c6fd81e84080f7d..510c4b886d6eabf3ca2b59be89c2578e40be8a9b 100644 --- a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_SCT.py +++ b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_Partition_Online_SCT.py @@ -36,9 +36,9 @@ else: streamName = 'CosmicCalo:CosmicCaloEM:L1Calo:L1CaloEM:MinBias:MuonswBeam:RNDM' # streamName = 'MinBias' -print publishName -print 'Hi. the streamName = ' -print streamName +printfunc (publishName) +printfunc ('Hi. the streamName = ') +printfunc (streamName) ## ------------------------------------------- flags set in: RecExOnline_globalconfig.py (from RecExOnline_jobOptions.py) #read the pickle file if you want to use the AMI tag info diff --git a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_globalconfig.py b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_globalconfig.py index 5a6186194e5183f8a8e3aef3f9cb8d491a56dfb5..13fb8dafe0c15c4d664a92366be20d99b29e6e6b 100644 --- a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_globalconfig.py +++ b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_globalconfig.py @@ -210,8 +210,8 @@ from InDetRecExample.InDetJobProperties import InDetFlags InDetFlags.doPixelClusterSplitting.set_Value(False) # does not work online ## new ID alignment 26 May 2017 -from AtlasGeoModel.InDetGMJobProperties import GeometryFlags -GeometryFlags.useDynamicAlignFolders.set_Value_and_Lock(True) +from AtlasGeoModel.InDetGMJobProperties import InDetGeometryFlags +InDetGeometryFlags.useDynamicAlignFolders.set_Value_and_Lock(True) # ----------------------------------------------- Online flag athenaCommonFlags.EvtMax.set_Value_and_Lock(evtMax) @@ -340,7 +340,6 @@ rec.doPerfMon.set_Value_and_Lock(False) # op rec.doDetailedPerfMon.set_Value_and_Lock(False) rec.doSemiDetailedPerfMon.set_Value_and_Lock(False) rec.doNameAuditor.set_Value_and_Lock(False) # optional for debugging -rec.doDetStatus.set_Value_and_Lock(False) # fails when true (fixed in next release) if not 'IOVDbSvcMessage' in dir(): from AthenaCommon.AppMgr import ServiceMgr as svcMgr diff --git a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_postconfig.py b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_postconfig.py index cced7939c29b11dea845fa31085431025fe3c3d0..a4af971e90762dea8654bb1d87cd3378fd85faab 100644 --- a/Reconstruction/RecExample/RecExOnline/share/RecExOnline_postconfig.py +++ b/Reconstruction/RecExample/RecExOnline/share/RecExOnline_postconfig.py @@ -82,7 +82,7 @@ if (isOnline and isOfflineTest): # ----------------------------- Printout -print "CHECK POINT PRINTING" +printfunc ("CHECK POINT PRINTING") globalflags.print_JobProperties() diff --git a/Reconstruction/RecExample/RecExOnline/share/Rtt_histogram.py b/Reconstruction/RecExample/RecExOnline/share/Rtt_histogram.py index 6239b69b4bcf2dae248f7c0f1aa75da9fa56fa27..9c0740dc2fd4276f4740a08b8bf22d0c8d8a051c 100644 --- a/Reconstruction/RecExample/RecExOnline/share/Rtt_histogram.py +++ b/Reconstruction/RecExample/RecExOnline/share/Rtt_histogram.py @@ -1,79 +1,79 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration import xml.etree.ElementTree as ET import sys import string import ROOT theApp.EvtMax = 0 -print (sys.version) +printfunc (sys.version) #tree = ET.parse("tesr.xml") listhis = [] #list for combine perf his listhisIndetG = [] #list for indet global his -print "############# reading combine performance " +printfunc ("############# reading combine performance ") tree = ET.parse("/afs/cern.ch/user/y/yunju/working/yunju/public/Rtt_ohpxml/CombPerf.xml") #tree = ET.parse("ohp.xml") root = tree.getroot() for neighbor in root.getiterator('histos'): - #print neighbor.attrib - #print neighbor.text + #printfunc (neighbor.attrib) + #printfunc (neighbor.text) listpaths=neighbor.text - print "info: %s %s" % (neighbor,listpaths) + printfunc ("info: %s %s" % (neighbor,listpaths)) n1 = neighbor.text.split(',') - print "list:%s" %n1 + printfunc ("list:%s" %n1) for stringth in n1: - print stringth.find("Global_ISSERVER") + printfunc (stringth.find("Global_ISSERVER")) if stringth.find("Global_ISSERVER")!=-1: finalpath=string.replace(stringth,"${Global_ISSERVER}/${Global_PROVIDER}","run_302347") - print stringth.find("MET") + printfunc (stringth.find("MET")) if stringth.find("MET")!=-1: finalpath=string.replace(finalpath,"run_302347","run_302347/lb_432") finalpath2=string.replace(finalpath," ", "") finalpath2=string.replace(finalpath2,"\t","")#remove tab finalpath3=string.replace(finalpath2,"\n","") listhis.append(finalpath3) -print listhis -print "############# reading indetglobal " +printfunc (listhis ) +printfunc ("############# reading indetglobal ") treeindetglobal = ET.parse("/afs/cern.ch/user/y/yunju/working/yunju/public/Rtt_ohpxml/globaldq-indet_20_11_0_25_1.xml") #treeindetglobal = ET.parse("ohp.xml") rootindetglobal = treeindetglobal.getroot() for neighbor in rootindetglobal.getiterator('histos'): - #print neighbor.attrib - #print neighbor.text + #printfunc (neighbor.attrib) + #printfunc (neighbor.text) listpaths=neighbor.text - print "info: %s %s" % (neighbor,listpaths) + printfunc ("info: %s %s" % (neighbor,listpaths)) n1 = neighbor.text.split(',') - print "list:%s" %n1 + printfunc ("list:%s" %n1) for stringth in n1: - print stringth.find("Global_ISSERVER") + printfunc (stringth.find("Global_ISSERVER")) if stringth.find("Histogramming-Global-iss/GM-Gatherer-MIG:GlobalMonitoringSegment")!=-1: finalpath=string.replace(stringth,"Histogramming-Global-iss/GM-Gatherer-MIG:GlobalMonitoringSegment","run_302347") - print stringth.find("${ID_AL_BASE_PATH}") + printfunc (stringth.find("${ID_AL_BASE_PATH}")) if stringth.find("${ID_AL_BASE_PATH}")!=-1: finalpath=string.replace(finalpath,"${ID_AL_BASE_PATH}","ExtendedTracks_NoTriggerSelection") #defined in idgl-options.xml - print "info with empty: %s" % ([finalpath]) + printfunc ("info with empty: %s" % ([finalpath])) finalpath2=string.replace(finalpath,"\t","")#remove tab finalpath2=string.replace(finalpath2," ","")#remove space - print "info with out empty: %s" % (finalpath2) + printfunc ("info with out empty: %s" % (finalpath2)) finalpath3=string.replace(finalpath2,"\n","") listhisIndetG.append(finalpath3) -print listhisIndetG +printfunc (listhisIndetG ) f = ROOT.TFile("Monitor.root") -print "############# checking combine perf " +printfunc ("############# checking combine perf ") for ith in listhis: - print "get his %s" %ith + printfunc ("get his %s" %ith) histCount = f.Get(ith) if histCount : histCount.Draw() else: - print "missing combined perf %s " %ith + printfunc ("missing combined perf %s " %ith ) -print "############# checking indetglobal " +printfunc ("############# checking indetglobal ") for ith in listhisIndetG: - print "get his %s" %ith + printfunc ("get his %s" %ith) histCount = f.Get(ith) if histCount : histCount.Draw() else: - print "missing indet global %s " %ith + printfunc ("missing indet global %s " %ith ) diff --git a/Reconstruction/TrackParticleTruthAthenaPool/src/TrackParticleTruthCollectionCnv.cxx b/Reconstruction/TrackParticleTruthAthenaPool/src/TrackParticleTruthCollectionCnv.cxx index d09a9d01bf1fb704bd84aa95f664b20ca03aae77..0835006ccace586868b459759e8d9082cd73f66c 100755 --- a/Reconstruction/TrackParticleTruthAthenaPool/src/TrackParticleTruthCollectionCnv.cxx +++ b/Reconstruction/TrackParticleTruthAthenaPool/src/TrackParticleTruthCollectionCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrackParticleTruthCollectionCnv.h" @@ -42,7 +42,7 @@ TrackParticleTruthCollectionPERS* TrackParticleTruthCollectionCnv::createPersist //================================================================ TrackParticleTruthCollection* TrackParticleTruthCollectionCnv::createTransient() { MsgStream log(msgSvc(), "TrackParticleTruthCollectionCnv" ); - std::auto_ptr<TrackParticleTruthCollection> trans(new TrackParticleTruthCollection()); + std::unique_ptr<TrackParticleTruthCollection> trans(new TrackParticleTruthCollection()); if (compareClassGuid(s_p2_guid)) { log<<MSG::DEBUG<<"Read TrackParticleTruthCollection_p2. GUID="<<m_classID.toString()<<endmsg; diff --git a/Reconstruction/eflowAthenaPool/src/eflowObjectContainerCnv.cxx b/Reconstruction/eflowAthenaPool/src/eflowObjectContainerCnv.cxx index 17a33171e4625b9d0f45e0a4a91f2e90683c700d..4b7ea7f50e3fafdb45ae9be983b1a3356aecad58 100644 --- a/Reconstruction/eflowAthenaPool/src/eflowObjectContainerCnv.cxx +++ b/Reconstruction/eflowAthenaPool/src/eflowObjectContainerCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Framework includes @@ -49,32 +49,32 @@ eflowObjectContainer* eflowObjectContainerCnv::createTransient() } else if ( compareClassGuid(p1_guid) ) { // using auto_ptr ensures deletion of the persistent object - std::auto_ptr<eflowObjectContainer_p1> persObj( poolReadObject<eflowObjectContainer_p1>() ); + std::unique_ptr<eflowObjectContainer_p1> persObj( poolReadObject<eflowObjectContainer_p1>() ); eflowObjectContainerCnv_p1 cnv; transObj = cnv.createTransient( persObj.get(), eflowStream ); } else if (compareClassGuid(p2_guid) ) { // using auto_ptr ensures deletion of the persistent object - std::auto_ptr<eflowObjectContainer_p2> persObj( poolReadObject<eflowObjectContainer_p2>() ); + std::unique_ptr<eflowObjectContainer_p2> persObj( poolReadObject<eflowObjectContainer_p2>() ); eflowObjectContainerCnv_p2 cnv; transObj = cnv.createTransient( persObj.get(), eflowStream ); } else if (compareClassGuid(p3_guid) ) { // using auto_ptr ensures deletion of the persistent object - std::auto_ptr<eflowObjectContainer_p3> persObj( poolReadObject<eflowObjectContainer_p3>() ); + std::unique_ptr<eflowObjectContainer_p3> persObj( poolReadObject<eflowObjectContainer_p3>() ); eflowObjectContainerCnv_p3 cnv; transObj = cnv.createTransient( persObj.get(), eflowStream ); } else if (compareClassGuid(p4_guid) ) { // using auto_ptr ensures deletion of the persistent object - std::auto_ptr<eflowObjectContainer_p4> persObj( poolReadObject<eflowObjectContainer_p4>() ); + std::unique_ptr<eflowObjectContainer_p4> persObj( poolReadObject<eflowObjectContainer_p4>() ); eflowObjectContainerCnv_p4 cnv; transObj = cnv.createTransient( persObj.get(), eflowStream ); } else if (compareClassGuid(p5_guid) ) { // using auto_ptr ensures deletion of the persistent object - std::auto_ptr<eflowObjectContainer_p5> persObj( poolReadObject<eflowObjectContainer_p5>() ); + std::unique_ptr<eflowObjectContainer_p5> persObj( poolReadObject<eflowObjectContainer_p5>() ); eflowObjectContainerCnv_p5 cnv; transObj = cnv.createTransient( persObj.get(), eflowStream ); } diff --git a/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopy.py b/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopy.py index 7e3d61c5bba2169a30810fb337294083c56f7a03..f27f71d7501958a17a4c807df7b26c2a06c4489b 100644 --- a/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopy.py +++ b/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopy.py @@ -14,6 +14,7 @@ from egammaCaloTools import egammaCaloToolsConf egammaCaloClusterGSFSelector = ToolFactory(egammaCaloToolsConf.egammaCaloClusterSelector, name='caloClusterGSFSelector', EMEtRanges=[2300.], + EMEtSplittingFraction = 0.7, EMFCuts=[0.5], # 3x7/7x7=0.429. Below this # there is more energy outside the diff --git a/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopyConfig.py b/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopyConfig.py index 2f27b17969324415a968228c3e232eac81bb9913..d519a8fe23c3bfda2b4296d26823399a2ab9fa5e 100644 --- a/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopyConfig.py +++ b/Reconstruction/egamma/egammaAlgs/python/egammaSelectedTrackCopyConfig.py @@ -20,6 +20,7 @@ def egammaSelectedTrackCopyCfg(flags, name='egammaSelectedTrackCopy', **kwargs): if "egammaCaloClusterSelector" not in kwargs: egammaCaloClusterGSFSelector = egammaCaloClusterSelector(name='caloClusterGSFSelector', EMEtRanges=[2300.], + EMEtSplittingFraction = 0.7, EMFCuts=[0.5], # 3x7/7x7=0.429. Below this # there is more energy outside the diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.cxx index 108bae4d4657b6506b36c26e7b0871133cd62561..18550735a705b618109fafe346eb6c0ab5595eb3 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.cxx @@ -41,6 +41,7 @@ and eventually conversions. #include "egammaUtils/egammaDuplicateRemoval.h" +#include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloUtils/CaloClusterStoreHelper.h" #include "CaloGeoHelpers/CaloPhiRange.h" @@ -101,6 +102,9 @@ StatusCode egammaBuilder::initialize() // retrieve ambiguity tool ATH_CHECK( m_ambiguityTool.retrieve() ); + //retrieve shower builder + ATH_CHECK( m_ShowerTool.retrieve() ); + ATH_MSG_INFO("Retrieving " << m_egammaTools.size() << " tools for egamma objects"); ATH_CHECK( m_egammaTools.retrieve() ); @@ -311,11 +315,28 @@ StatusCode egammaBuilder::execute(){ if (m_doTopoSeededPhotons) { CHECK( addTopoSeededPhotons(photonContainer.ptr(), clusters.ptr()) ); } - + + const CaloDetDescrManager* calodetdescrmgr = nullptr; + ATH_CHECK( detStore()->retrieve(calodetdescrmgr,"CaloMgr") ); // Call tools + + /* + * Shower Shapes + */ + if (electronContainer.ptr()) { + for (xAOD::Electron* electron : *electronContainer) { + ATH_CHECK(m_ShowerTool->execute(ctx, *calodetdescrmgr, electron)); + } + } + if (photonContainer.ptr()) { + for (xAOD::Photon* photon : *photonContainer) { + ATH_CHECK(m_ShowerTool->execute(ctx, *calodetdescrmgr, photon)); + } + } + // First the final cluster/calibration ATH_MSG_DEBUG("Executing : " << m_clusterTool); - if ( m_clusterTool->contExecute(ctx, electronContainer.ptr(), photonContainer.ptr()).isFailure() ){ + if ( m_clusterTool->contExecute(ctx, *calodetdescrmgr ,electronContainer.ptr(), photonContainer.ptr()).isFailure() ){ ATH_MSG_ERROR("Problem executing the " << m_clusterTool<<" tool"); return StatusCode::FAILURE; } diff --git a/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.h b/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.h index b3323dfabb56161ad1cb3e5f7912bb2f02d1a14b..e1835f6a3a5762c91b6da821eed65394395a1d37 100644 --- a/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.h +++ b/Reconstruction/egamma/egammaAlgs/src/egammaBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMAALGS_EGAMMABUILDER_H @@ -47,7 +47,7 @@ #include "egammaInterfaces/IegammaBaseTool.h" #include "egammaInterfaces/IEMTrackMatchBuilder.h" #include "egammaInterfaces/IEMConversionBuilder.h" - +#include "egammaInterfaces/IEMShowerBuilder.h" #include "GaudiKernel/SystemOfUnits.h" class egammaRec; @@ -105,6 +105,11 @@ class egammaBuilder : public AthAlgorithm ToolHandleArray<IegammaBaseTool> m_photonTools {this, "PhotonTools", {}, "Tools for dressing ONLY photons"}; + /** @brief Tool to do the final electron/photon cluster building */ + ToolHandle<IEMShowerBuilder> m_ShowerTool {this, + "EMShowerTool", "egammaTools/EMShowerBuilder", + "Tool that does electron/photon shower shape building"}; + /** @brief Tool to do the final electron/photon cluster building */ ToolHandle<IEMClusterTool> m_clusterTool {this, "EMClusterTool", "EMClusterTool", diff --git a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx index 4fa41b420c564c0cb3a97ebbe6ba3e4adb64db92..398fa1ec5b0d6deb8a3bd57e91d53ed6a972fe84 100644 --- a/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx +++ b/Reconstruction/egamma/egammaAlgs/src/topoEgammaBuilder.cxx @@ -198,7 +198,7 @@ StatusCode topoEgammaBuilder::execute(const EventContext& ctx) const{ /* * Calibration */ - if ( m_clusterTool->contExecute(ctx, electrons , photons).isFailure() ){ + if ( m_clusterTool->contExecute(ctx, *calodetdescrmgr,electrons , photons).isFailure() ){ ATH_MSG_ERROR("Problem executing the " << m_clusterTool<<" tool"); return StatusCode::FAILURE; } diff --git a/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx b/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx index 0b89ac4b42b4102e920b76aef7c6e6f53aabbf54..3ebfc03fd2378cbc6ec7728320ccd921a0ae7277 100644 --- a/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx +++ b/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.cxx @@ -58,6 +58,7 @@ StatusCode egammaCaloClusterSelector::initialize() << ", must be zero or the number of Et bins: " << numBins); return StatusCode::FAILURE; } + return StatusCode::SUCCESS; } @@ -106,7 +107,11 @@ bool egammaCaloClusterSelector::passSelection( static const SG::AuxElement::ConstAccessor<float> acc("EMFraction"); const double emFrac = acc.isAvailable(*cluster)? acc(*cluster) : 0.; const double EMEnergy= cluster->e()* emFrac; - const double EMEt = EMEnergy/cosh(eta2); + double EMEt = EMEnergy/std::cosh(eta2); + const double rescaleFactor = 1.0/m_EMEtSplittingFraction; + if ((std::abs(cluster->eta()) > 1.37 && std::abs(cluster->eta()) < 1.52)) { + EMEt*=rescaleFactor; + } const double bin = findETBin(EMEt); /* Check for the minimum EM Et required this should be the 0th entry in EMEtRanges*/ if (bin<0){ @@ -172,6 +177,7 @@ int egammaCaloClusterSelector::findETBin(double EMEt) const { const int numBins = m_EMEtRanges.size(); int newBin = 0; + while (newBin < numBins && EMEt > m_EMEtRanges[newBin]) { newBin++; } diff --git a/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.h b/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.h index 13363a725a4640b691e36adfcf521cbb23b21097..07d0b69cb2308582a4357f36fbe1d8a7ce90a7d0 100644 --- a/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.h +++ b/Reconstruction/egamma/egammaCaloTools/src/egammaCaloClusterSelector.h @@ -67,6 +67,9 @@ private: "EMEtRanges", {}, "EM Et Ranges to consider, with different cuts; Minimal EM Et cut will be the value of the 0th bin"}; + Gaudi::Property<double> m_EMEtSplittingFraction {this, + "EMEtSplittingFraction", 1.0, "Apply only fraction of EMEt cut for crack region"}; + /** @brief Threshold on minimum energy reconstructed in 2nd sampling */ Gaudi::Property<double> m_MinEM2Energy{this, "MinEM2Energy", 50., "Threshold on minimum energy reconstructed in 2nd sampling"}; diff --git a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/ICaloCluster_OnTrackBuilder.h b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/ICaloCluster_OnTrackBuilder.h index cb7f330a8a01490f45f9ba90809cd8aa2a7294c7..eb6d4bd651c2652970af08af34a863aebf114b04 100755 --- a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/ICaloCluster_OnTrackBuilder.h +++ b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/ICaloCluster_OnTrackBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef ICALOCLUSTER_ONTRACKBUILER_H @@ -12,7 +12,6 @@ namespace Trk{ class CaloCluster_OnTrack; } - static const InterfaceID IID_caloCluster_OnTrackBuilder("ICaloCluster_OnTrackBuilder",1,0); class ICaloCluster_OnTrackBuilder : virtual public IAlgTool @@ -20,11 +19,11 @@ class ICaloCluster_OnTrackBuilder : virtual public IAlgTool public: static const InterfaceID& interfaceID() { return IID_caloCluster_OnTrackBuilder; }; - ~ICaloCluster_OnTrackBuilder() {}; + ~ICaloCluster_OnTrackBuilder() {}; - virtual Trk::CaloCluster_OnTrack* buildClusterOnTrack( const xAOD::Egamma* eg, int charge=0 ) const = 0 ; - virtual Trk::CaloCluster_OnTrack* buildClusterOnTrack( const xAOD::CaloCluster* cl, int charge=0 ) const = 0; - + virtual Trk::CaloCluster_OnTrack* + buildClusterOnTrack(const xAOD::CaloCluster* cl, + int charge = 0) const = 0; }; #endif //ICALOCLUSTER_ONTRACKBUILER_H diff --git a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMClusterTool.h b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMClusterTool.h index ce56ae36bbbd8e6ad61c39463fde2763c87562a3..9e58569d17f59ab3d8accd4ad5fb338cbab8cf6b 100644 --- a/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMClusterTool.h +++ b/Reconstruction/egamma/egammaInterfaces/egammaInterfaces/IEMClusterTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMAINTERFACES_IEMCLUSTERTOOL_H @@ -18,6 +18,7 @@ */ static const InterfaceID IID_IEMClusterTool("IEMClusterTool", 1, 0); +class CaloDetDescrManager; class IEMClusterTool : virtual public IAlgTool { @@ -32,13 +33,12 @@ class IEMClusterTool : virtual public IAlgTool { virtual StatusCode initialize() = 0; /** @brief execute on containers */ virtual StatusCode contExecute(const EventContext& ctx, - xAOD::ElectronContainer *electronContainer, - xAOD::PhotonContainer *photonContainer) const = 0; + const CaloDetDescrManager& cmgr, + xAOD::ElectronContainer* electronContainer, + xAOD::PhotonContainer* photonContainer) const = 0; /** @brief finalize method*/ virtual StatusCode finalize() = 0; - /** @brief build extra positions in calo frame*/ - virtual void fillPositionsInCalo(xAOD::CaloCluster* cluster) const =0; }; inline const InterfaceID& IEMClusterTool::interfaceID() diff --git a/Reconstruction/egamma/egammaRec/python/egammaGetter.py b/Reconstruction/egamma/egammaRec/python/egammaGetter.py index 84b8455666cd0bf815eb3f15a25fb83ad6498a99..1ee172fbbb64e4c13f9bc4118f3b7ee3c3a5f0b2 100755 --- a/Reconstruction/egamma/egammaRec/python/egammaGetter.py +++ b/Reconstruction/egamma/egammaRec/python/egammaGetter.py @@ -44,7 +44,7 @@ def getTopoSeededCollectionName(): #The tools used to add properties def egammaDecorationTools(): "Return a list with the tools that decorate both electrons and photons" - return [EMFourMomBuilder(), EMShowerBuilder(), egammaOQFlagsBuilder()] + return [EMFourMomBuilder(), egammaOQFlagsBuilder()] def electronDecorationTools(): "Return a list with the tools that decorate only electrons" @@ -69,7 +69,8 @@ class egammaGetter ( Configured ) : # Builder tools TrackMatchBuilderTool = EMTrackMatchBuilder, ConversionBuilderTool = EMConversionBuilder if doConversions() else None, - EMClusterTool=EMClusterTool, + EMClusterTool=EMClusterTool, + EMShowerTool=EMShowerBuilder, AmbiguityTool = EGammaAmbiguityTool, # Decoration tools egammaTools = FcnWrapper(egammaDecorationTools), diff --git a/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx b/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx index 3d2675e600e8e5b037a2b585819325ee21e33c0b..d5d5bf50324416994fdc873d8c35850b4b3dd373 100644 --- a/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx +++ b/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx @@ -13,6 +13,7 @@ #include "xAODEgamma/ElectronContainer.h" #include "xAODEgamma/PhotonContainer.h" +#include "CaloDetDescr/CaloDetDescrManager.h" #include "CaloUtils/CaloClusterStoreHelper.h" #include "CaloUtils/CaloCellDetPos.h" #include "StoreGate/WriteHandle.h" @@ -21,11 +22,11 @@ // ============================================================= EMClusterTool::EMClusterTool(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type, name, parent), + m_caloCellDetPos{}, m_doTopoSeededContainer(false) { declareInterface<IEMClusterTool>(this); - m_caloCellDetPos = std::make_unique<CaloCellDetPos>(); } EMClusterTool::~EMClusterTool() { } @@ -79,6 +80,7 @@ StatusCode EMClusterTool::finalize() { // ========================================================================= StatusCode EMClusterTool::contExecute(const EventContext& ctx, + const CaloDetDescrManager& mgr, xAOD::ElectronContainer *electronContainer, xAOD::PhotonContainer *photonContainer) const { @@ -106,7 +108,7 @@ StatusCode EMClusterTool::contExecute(const EventContext& ctx, xAOD::EgammaParameters::EgammaType egType = xAOD::EgammaParameters::electron; if(electronContainer){ for (auto electron : *electronContainer){ - setNewCluster(ctx, electron, outputClusterContainer.ptr(), egType); + setNewCluster(ctx,mgr, electron, outputClusterContainer.ptr(), egType); } } if(photonContainer){ @@ -117,10 +119,10 @@ StatusCode EMClusterTool::contExecute(const EventContext& ctx, xAOD::EgammaParameters::unconvertedPhoton); if (!m_doTopoSeededContainer || !photon->author(xAOD::EgammaParameters::AuthorCaloTopo35) ){ - setNewCluster(ctx, photon, outputClusterContainer.ptr(), egType); + setNewCluster(ctx, mgr,photon, outputClusterContainer.ptr(), egType); } else{ - setNewCluster(ctx, photon, outputTopoSeededClusterContainer.ptr(), egType); + setNewCluster(ctx, mgr,photon, outputTopoSeededClusterContainer.ptr(), egType); } } } @@ -142,11 +144,12 @@ StatusCode EMClusterTool::contExecute(const EventContext& ctx, return StatusCode::SUCCESS; } -// ========================================================================== -void EMClusterTool::setNewCluster(const EventContext& ctx, - xAOD::Egamma *eg, - xAOD::CaloClusterContainer *outputClusterContainer, - xAOD::EgammaParameters::EgammaType egType) const +void +EMClusterTool::setNewCluster(const EventContext& ctx, + const CaloDetDescrManager& mgr, + xAOD::Egamma* eg, + xAOD::CaloClusterContainer* outputClusterContainer, + xAOD::EgammaParameters::EgammaType egType) const { if (!eg) {return;} @@ -160,14 +163,14 @@ void EMClusterTool::setNewCluster(const EventContext& ctx, //Special Case for topo seeded photons. if (eg->author(xAOD::EgammaParameters::AuthorCaloTopo35)) { cluster = new xAOD::CaloCluster(*(eg->caloCluster())); - fillPositionsInCalo(cluster); + fillPositionsInCalo(cluster,mgr); } // Doing superClusters else if ( m_doSuperClusters){ //copy over for super clusters cluster = makeNewSuperCluster(*(eg->caloCluster()),eg); } else { - cluster = makeNewCluster(ctx, *(eg->caloCluster()), eg, egType); + cluster = makeNewCluster(ctx,*(eg->caloCluster()), mgr, eg, egType); } outputClusterContainer->push_back(cluster); @@ -178,10 +181,13 @@ void EMClusterTool::setNewCluster(const EventContext& ctx, } -// ========================================================================== -xAOD::CaloCluster* EMClusterTool::makeNewCluster(const EventContext& ctx, - const xAOD::CaloCluster& cluster, xAOD::Egamma *eg, - xAOD::EgammaParameters::EgammaType egType) const { +xAOD::CaloCluster* +EMClusterTool::makeNewCluster(const EventContext& ctx, + const xAOD::CaloCluster& cluster, + const CaloDetDescrManager& mgr, + xAOD::Egamma* eg, + xAOD::EgammaParameters::EgammaType egType) const +{ // // Create new cluster based on an existing one // const CaloCluster* cluster : input cluster @@ -208,7 +214,7 @@ xAOD::CaloCluster* EMClusterTool::makeNewCluster(const EventContext& ctx, else {//(egType == xAOD::EgammaParameters::unconvertedPhoton) cluSize = (isBarrel ? xAOD::CaloCluster::SW_37gam : xAOD::CaloCluster::SW_55gam); } - xAOD::CaloCluster *newCluster = makeNewCluster(ctx, cluster, cluSize); + xAOD::CaloCluster *newCluster = makeNewCluster(ctx,cluster, mgr,cluSize); if (newCluster && m_MVACalibSvc->execute(*newCluster,*eg).isFailure()){ ATH_MSG_ERROR("Problem executing MVA cluster tool"); @@ -217,9 +223,12 @@ xAOD::CaloCluster* EMClusterTool::makeNewCluster(const EventContext& ctx, } // ========================================================================== -xAOD::CaloCluster* EMClusterTool::makeNewCluster(const EventContext& ctx, - const xAOD::CaloCluster& cluster, - const xAOD::CaloCluster::ClusterSize& cluSize) const { +xAOD::CaloCluster* +EMClusterTool::makeNewCluster(const EventContext& ctx, + const xAOD::CaloCluster& cluster, + const CaloDetDescrManager& mgr, + const xAOD::CaloCluster::ClusterSize& cluSize) const +{ xAOD::CaloCluster* newClus = CaloClusterStoreHelper::makeCluster(cluster.getCellLinks()->getCellContainer(), cluster.eta0(),cluster.phi0(), @@ -228,7 +237,7 @@ xAOD::CaloCluster* EMClusterTool::makeNewCluster(const EventContext& ctx, if (m_clusterCorrectionTool->execute(ctx,newClus).isFailure()){ ATH_MSG_ERROR("Problem executing cluster correction tool"); } - fillPositionsInCalo(newClus); + fillPositionsInCalo(newClus,mgr); //Fill the raw state using the cluster with correct size but not MVA newClus->setRawE(newClus->calE()); newClus->setRawEta(newClus->calEta()); @@ -244,7 +253,10 @@ xAOD::CaloCluster* EMClusterTool::makeNewCluster(const EventContext& ctx, return newClus; } -xAOD::CaloCluster* EMClusterTool::makeNewSuperCluster(const xAOD::CaloCluster& cluster,xAOD::Egamma *eg) const { +xAOD::CaloCluster* +EMClusterTool::makeNewSuperCluster(const xAOD::CaloCluster& cluster, + xAOD::Egamma* eg) const +{ // xAOD::CaloCluster* newClus = new xAOD::CaloCluster(cluster); if(m_applySuperClusters){ @@ -257,27 +269,27 @@ xAOD::CaloCluster* EMClusterTool::makeNewSuperCluster(const xAOD::CaloCluster& c return newClus; } -// ========================================================================== -void EMClusterTool::fillPositionsInCalo(xAOD::CaloCluster* cluster) const{ +void +EMClusterTool::fillPositionsInCalo(xAOD::CaloCluster* cluster, const CaloDetDescrManager& mgr) const +{ bool isBarrel = xAOD::EgammaHelpers::isBarrel(cluster); CaloCell_ID::CaloSample sample = isBarrel ? CaloCell_ID::EMB2 : CaloCell_ID::EME2; // eta and phi of the cluster in the calorimeter frame double eta; double phi; - m_caloCellDetPos->getDetPosition(sample, cluster->eta(), cluster->phi(), eta, phi); + m_caloCellDetPos.getDetPosition(mgr,sample,cluster->eta(), cluster->phi(), eta, phi); cluster->insertMoment(xAOD::CaloCluster::ETACALOFRAME,eta); cluster->insertMoment(xAOD::CaloCluster::PHICALOFRAME,phi); // eta in the second sampling - m_caloCellDetPos->getDetPosition(sample, cluster->etaBE(2), cluster->phiBE(2), eta, phi); + m_caloCellDetPos.getDetPosition(mgr,sample, cluster->etaBE(2), cluster->phiBE(2), eta, phi); cluster->insertMoment(xAOD::CaloCluster::ETA2CALOFRAME,eta); cluster->insertMoment(xAOD::CaloCluster::PHI2CALOFRAME,phi); // eta in the first sampling sample = isBarrel ? CaloCell_ID::EMB1 : CaloCell_ID::EME1; - m_caloCellDetPos->getDetPosition(sample, cluster->etaBE(1), cluster->phiBE(1),eta, phi); + m_caloCellDetPos.getDetPosition(mgr,sample, cluster->etaBE(1), cluster->phiBE(1),eta, phi); cluster->insertMoment(xAOD::CaloCluster::ETA1CALOFRAME,eta); cluster->insertMoment(xAOD::CaloCluster::PHI1CALOFRAME,phi); - } diff --git a/Reconstruction/egamma/egammaTools/src/EMClusterTool.h b/Reconstruction/egamma/egammaTools/src/EMClusterTool.h index c55f368ef1d8c06135324a345a076dc70c20f5c1..a729802a76a9002f952562eed52bcffd243dbadb 100644 --- a/Reconstruction/egamma/egammaTools/src/EMClusterTool.h +++ b/Reconstruction/egamma/egammaTools/src/EMClusterTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef EGAMMATOOLS_EMCLUSTERTOOL_H @@ -20,7 +20,7 @@ #include "xAODEgamma/EgammaEnums.h" #include "StoreGate/WriteHandleKey.h" -class CaloCellDetPos; +#include "CaloUtils/CaloCellDetPos.h" class CaloClusterCellLink; /** @@ -59,17 +59,19 @@ class EMClusterTool : public AthAlgTool, virtual public IEMClusterTool { virtual StatusCode initialize() override; /** @brief execute on container */ virtual StatusCode contExecute(const EventContext& ctx, - xAOD::ElectronContainer *electronContainer, - xAOD::PhotonContainer *photonContainer) const override; + const CaloDetDescrManager& mgr, + xAOD::ElectronContainer* electronContainer, + xAOD::PhotonContainer* photonContainer) const override final; /** @brief finalize method */ virtual StatusCode finalize() override; - - virtual void fillPositionsInCalo(xAOD::CaloCluster* cluster) const override; - private: + + +private: /** @brief Set new cluster to the egamma object, decorate the new cluster * with a link to the old one **/ void setNewCluster(const EventContext& ctx, + const CaloDetDescrManager& mgr, xAOD::Egamma *eg, xAOD::CaloClusterContainer *outputClusterContainer, xAOD::EgammaParameters::EgammaType egType) const; @@ -79,9 +81,11 @@ class EMClusterTool : public AthAlgTool, virtual public IEMClusterTool { * applying cluster corrections and MVA calibration (requires the egamma object). * The cluster size depends on the given EgammaType */ - virtual xAOD::CaloCluster* makeNewCluster(const EventContext&, - const xAOD::CaloCluster&, xAOD::Egamma *eg, - xAOD::EgammaParameters::EgammaType) const; + xAOD::CaloCluster* makeNewCluster(const EventContext&, + const xAOD::CaloCluster&, + const CaloDetDescrManager& mgr, + xAOD::Egamma* eg, + xAOD::EgammaParameters::EgammaType) const; /** @brief creation of new cluster based on existing one * Return a new cluster with the given size using the seed eta0, phi0 from the @@ -89,12 +93,17 @@ class EMClusterTool : public AthAlgTool, virtual public IEMClusterTool { * If doDecorate is true, copy the cal to the raw signal state * and set the raw one to the cal e,eta,phi from the existing cluster */ - virtual xAOD::CaloCluster* makeNewCluster(const EventContext& ctx, - const xAOD::CaloCluster&, - const xAOD::CaloCluster::ClusterSize&) const; + xAOD::CaloCluster* makeNewCluster(const EventContext& ctx, + const xAOD::CaloCluster&, + const CaloDetDescrManager& mgr, + const xAOD::CaloCluster::ClusterSize&) const; /** @brief creation of new super cluster based on existing one */ - xAOD::CaloCluster* makeNewSuperCluster(const xAOD::CaloCluster& cluster, xAOD::Egamma *eg) const; + xAOD::CaloCluster* makeNewSuperCluster(const xAOD::CaloCluster& cluster, + xAOD::Egamma* eg) const; + + /** @brief build extra positions in calo frame*/ + void fillPositionsInCalo(xAOD::CaloCluster* cluster, const CaloDetDescrManager& mgr) const; /** @brief Key of the output cluster container **/ SG::WriteHandleKey<xAOD::CaloClusterContainer> m_outputClusterContainerKey {this, @@ -122,27 +131,24 @@ class EMClusterTool : public AthAlgTool, virtual public IEMClusterTool { ServiceHandle<IegammaMVASvc> m_MVACalibSvc {this, "MVACalibSvc", "egammaMVASvc", "calibration service"}; - /** @brief Name of the input electron container **/ - std::string m_electronContainerName; - - /** @brief Name of the input photon container **/ - std::string m_photonContainerName; /** @brief Tool to handle cluster corrections */ - ToolHandle<IegammaSwTool> m_clusterCorrectionTool {this, - "ClusterCorrectionTool", "egammaSwTool/egammaswtool", - "tool that applies cluster corrections"}; - - /** @brief do super clusters **/ - Gaudi::Property<bool> m_doSuperClusters {this, "doSuperCluster", true, - "Do Super Cluster Reco"}; + ToolHandle<IegammaSwTool> m_clusterCorrectionTool{ this, + "ClusterCorrectionTool", + "egammaSwTool/egammaswtool", + "tool that applies cluster corrections" }; + + /** @brief do super clusters **/ + Gaudi::Property<bool> m_doSuperClusters{ this, "doSuperCluster", true, "Do Super Cluster Reco" }; - /** @brief flag to protect against applying the MVA to super Clusters **/ - Gaudi::Property<bool> m_applySuperClusters {this, "applyMVAToSuperCluster", true, - "Protection to not do anything for superClusters"}; + /** @brief flag to protect against applying the MVA to super Clusters **/ + Gaudi::Property<bool> m_applySuperClusters{ this, + "applyMVAToSuperCluster", + true, + "Protection to not do anything for superClusters" }; /** @brief Position in Calo frame**/ - std::unique_ptr<CaloCellDetPos> m_caloCellDetPos; + const CaloCellDetPos m_caloCellDetPos; // derived variable (not set by JOs) bool m_doTopoSeededContainer; diff --git a/Reconstruction/egamma/egammaTools/src/egammaLargeClusterMaker.cxx b/Reconstruction/egamma/egammaTools/src/egammaLargeClusterMaker.cxx index 587c025965991d93e22d2bf8e8b45b455ab2998f..44b6fc439446e46d8c211681700e8edce49f17f1 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaLargeClusterMaker.cxx +++ b/Reconstruction/egamma/egammaTools/src/egammaLargeClusterMaker.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "egammaLargeClusterMaker.h" @@ -54,7 +54,10 @@ StatusCode egammaLargeClusterMaker::execute(const EventContext& ctx, SG::ReadHandle<xAOD::CaloClusterContainer> inputClusters(m_inputClusterCollection, ctx); // retrieve the cell containers SG::ReadHandle<CaloCellContainer> cellcoll(m_cellsKey, ctx); - + + const CaloDetDescrManager* dd_man= nullptr; + ATH_CHECK( detStore()->retrieve(dd_man,"CaloMgr") ); + // The main loop over clusters for (auto cluster : *inputClusters) { @@ -82,9 +85,7 @@ StatusCode egammaLargeClusterMaker::execute(const EventContext& ctx, if ((eta==0. && phi==0.) || fabs(eta)>100) { return StatusCode::SUCCESS; } - - const CaloDetDescrManager* dd_man = CaloDetDescrManager::instance(); - + // Should get overritten bool barrel=false; CaloCell_ID::SUBCALO subcalo=CaloCell_ID::LAREM; diff --git a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx index fd13f9bd5f404c0305c63233ccef10041109659b..fbb8be357cf3c3f841710ac01745da86db8dfba8 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx @@ -105,7 +105,7 @@ StatusCode egammaOQFlagsBuilder::finalize() // =============================================================== bool egammaOQFlagsBuilder::findCentralCell(const xAOD::CaloCluster* cluster, - Identifier cellCentrId) const { + Identifier& cellCentrId) const { bool thereIsACentrCell = false; diff --git a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.h b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.h index a269956cfceddc0868dedf31d9c25bfc9ea94243..0bed898ff8326c13cc78e04aba6110065c451e33 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.h +++ b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.h @@ -78,7 +78,7 @@ class egammaOQFlagsBuilder : public egammaBaseTool bool isbadtilecell (CaloCellList& ccl, float clusterEta, float clusterPhi, double sizeEta, double sizePhi, CaloSampling::CaloSample sample) const ; - bool findCentralCell(const xAOD::CaloCluster* cluster, Identifier cellCentrId) const; + bool findCentralCell(const xAOD::CaloCluster* cluster, Identifier& cellCentrId) const; Gaudi::Property<double> m_QCellCut {this, "QCellCut", 4000.}; Gaudi::Property<double> m_QCellHECCut {this, "QCellHECCut", 60000.}; diff --git a/Reconstruction/egamma/egammaTrackTools/src/CaloCluster_OnTrackBuilder.cxx b/Reconstruction/egamma/egammaTrackTools/src/CaloCluster_OnTrackBuilder.cxx index 1cd41047a528e4061aafd846d9ad9cf17c145411..d909b4a8f0bdec410cf7314308582bde2e834250 100755 --- a/Reconstruction/egamma/egammaTrackTools/src/CaloCluster_OnTrackBuilder.cxx +++ b/Reconstruction/egamma/egammaTrackTools/src/CaloCluster_OnTrackBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "CaloCluster_OnTrackBuilder.h" @@ -23,60 +23,35 @@ CaloCluster_OnTrackBuilder::CaloCluster_OnTrackBuilder(const std::string& t, const std::string& n, const IInterface* p ) : AthAlgTool(t,n,p), - m_calo_dd(nullptr), m_emid(nullptr) { declareInterface<ICaloCluster_OnTrackBuilder>(this); } -//-------------------------------------------------------------------------------------------- CaloCluster_OnTrackBuilder::~CaloCluster_OnTrackBuilder() {} -//-------------------------------------------------------------------------------------------- -//-------------------------------------------------------------------------------------------- StatusCode CaloCluster_OnTrackBuilder::initialize() { -//-------------------------------------------------------------------------------------------- ATH_MSG_INFO("Initializing CaloCluster_OnTrackBuilder"); - ATH_CHECK(m_caloCellContainerKey.initialize()); - // Retrieve the updator CaloSurfaceBuilder if ( m_calosurf.retrieve().isFailure() ){ ATH_MSG_FATAL ( "Unable to retrieve the instance " << m_calosurf.name() << "... Exiting!" ); return StatusCode::FAILURE; } - // retrieve all helpers from det store - m_calo_dd = CaloDetDescrManager::instance(); return StatusCode::SUCCESS; } -//-------------------------------------------------------------------------------------------- -StatusCode CaloCluster_OnTrackBuilder::finalize(){ return StatusCode::SUCCESS; } -//-------------------------------------------------------------------------------------------- - - - - - - -//-------------------------------------------------------------------------------------------- - Trk::CaloCluster_OnTrack* CaloCluster_OnTrackBuilder::buildClusterOnTrack( const xAOD::Egamma* eg, int charge ) const -//-------------------------------------------------------------------------------------------- -{ - return buildClusterOnTrack( eg->caloCluster(), charge ); +StatusCode CaloCluster_OnTrackBuilder::finalize() { + return StatusCode::SUCCESS; } - - -//-------------------------------------------------------------------------------------------- - Trk::CaloCluster_OnTrack* CaloCluster_OnTrackBuilder::buildClusterOnTrack( const xAOD::CaloCluster* cluster, int charge ) const -//-------------------------------------------------------------------------------------------- -{ +Trk::CaloCluster_OnTrack* CaloCluster_OnTrackBuilder::buildClusterOnTrack( + const xAOD::CaloCluster* cluster, int charge) const { ATH_MSG_DEBUG("Building Trk::CaloCluster_OnTrack"); @@ -116,11 +91,7 @@ StatusCode CaloCluster_OnTrackBuilder::finalize(){ return StatusCode::SUCCESS; } return ccot; } - - -//-------------------------------------------------------------------------------------------- const Trk::Surface* CaloCluster_OnTrackBuilder::getCaloSurface( const xAOD::CaloCluster* cluster ) const -//-------------------------------------------------------------------------------------------- { const Trk::Surface* destinationSurface = nullptr; @@ -137,11 +108,9 @@ const Trk::Surface* CaloCluster_OnTrackBuilder::getCaloSurface( const xAOD::Ca } -//-------------------------------------------------------------------------------------------- const Trk::LocalParameters* CaloCluster_OnTrackBuilder::getClusterLocalParameters( const xAOD::CaloCluster* cluster, const Trk::Surface* surf, int charge) const -//-------------------------------------------------------------------------------------------- { Amg::Vector3D surfRefPoint = surf->globalReferencePoint(); @@ -154,21 +123,6 @@ const Trk::LocalParameters* CaloCluster_OnTrackBuilder::getClusterLocalParamet double clusterQoverE = cluster->calE() !=0 ? (double)charge/cluster->calE() : 0; - //std::cout << " Cluster Energy "<< cluster->calE() << std::endl; - -/* - double correction(0); - double phis = CalculatePhis( cluster ); - int inteta = abs(eta*10); - //int intphis = phis*2e3-25; - if (phis < 0 || phis > 74){ - //intphis = 0; - } - if (inteta > 24) inteta = 24; - - phi += correction * 1e-3 * charge; -*/ - Trk::LocalParameters* newLocalParameters(nullptr); if ( xAOD::EgammaHelpers::isBarrel( cluster ) ){ @@ -207,25 +161,11 @@ const Trk::LocalParameters* CaloCluster_OnTrackBuilder::getClusterLocalParamet } -//-------------------------------------------------------------------------------------------- const Amg::MatrixX* CaloCluster_OnTrackBuilder::getClusterErrorMatrix( const xAOD::CaloCluster* cluster, const Trk::Surface* surf, int ) const -//-------------------------------------------------------------------------------------------- { - -/* - double eta = cluster->eta(); - int inteta = abs(eta*10); - if (inteta > 24) inteta = 24; - double phis = CalculatePhis( cluster ); - int intphis = phis*2e3 ; - intphis -= 25; - if (phis < 0 || phis > 74){ - intphis = 0; - } -*/ double phierr = 0.1; phierr = phierr < 1.e-10 ? 0.1 : pow(phierr,2); if(!m_useClusterPhi) phierr = 10; @@ -288,9 +228,7 @@ const Amg::MatrixX* CaloCluster_OnTrackBuilder::getClusterErrorMatrix( const } -//-------------------------------------------------------------------------------------------- double CaloCluster_OnTrackBuilder::getClusterPhiError( const xAOD::CaloCluster* cluster ) const -//-------------------------------------------------------------------------------------------- { /** Error on theta = C(eta) mrad/sqrt(Energy) */ @@ -306,9 +244,7 @@ double CaloCluster_OnTrackBuilder::getClusterPhiError( const xAOD::CaloCluster* } -//-------------------------------------------------------------------------------------------- double CaloCluster_OnTrackBuilder::electronPhiResolution(double eta, double energy) const -//-------------------------------------------------------------------------------------------- { eta = fabs( eta ); @@ -317,9 +253,7 @@ double CaloCluster_OnTrackBuilder::electronPhiResolution(double eta, double ener } -//-------------------------------------------------------------------------------------------- double CaloCluster_OnTrackBuilder::electronPhiResoA(double eta) const -//-------------------------------------------------------------------------------------------- { if ( eta < 0.30 ) @@ -351,9 +285,7 @@ double CaloCluster_OnTrackBuilder::electronPhiResoA(double eta) const } -//-------------------------------------------------------------------------------------------- double CaloCluster_OnTrackBuilder::electronPhiResoB(double eta) const -//-------------------------------------------------------------------------------------------- { if ( eta < 0.65 ) @@ -382,62 +314,4 @@ double CaloCluster_OnTrackBuilder::electronPhiResoB(double eta) const } -// ===================================================================== -double CaloCluster_OnTrackBuilder::CalculatePhis(const xAOD::CaloCluster* cluster) const -// ===================================================================== -{ - if (!cluster) {return -999.;} - CaloSampling::CaloSample sam = - xAOD::EgammaHelpers::isBarrel(cluster) ? CaloSampling::EMB2 : CaloSampling::EME2; - - /* - * From the original (eta,phi) position, find the location - * (sampling, barrel/end-cap, granularity) - * For this we use the tool egammaEnergyAllSamples - * which uses the CaloCluster method inBarrel() and inEndcap() - * but also, in case close to the crack region where both - * boolean can be true, the energy reconstructed in the sampling - */ - const double eta = cluster->etaSample(sam); - const double phi = cluster->phiSample(sam); - if ((eta==0. && phi==0.) || fabs(eta)>100) {return -999.;} - int sampling_or_module; - bool barrel; - CaloCell_ID::SUBCALO subcalo; - /* granularity in (eta,phi) in the pre sampler - CaloCellList needs both enums: subCalo and CaloSample*/ - m_calo_dd->decode_sample(subcalo, barrel, sampling_or_module, - (CaloCell_ID::CaloSample) sam); - - /* - * Get the corresponding grannularities : needs to know where you are - the easiest is to look for the CaloDetDescrElement*/ - const CaloDetDescrElement* dde; - dde = m_calo_dd->get_element(subcalo,sampling_or_module,barrel,eta,phi); - // if object does not exist then return - if (!dde) {return -999.;} - // local granularity - double deta = dde->deta(); - double dphi = dde->dphi(); - - SG::ReadHandle<CaloCellContainer> cellContainer(m_caloCellContainerKey); - // check is only used for serial running; remove when MT scheduler used - if(!cellContainer.isValid()) { - ATH_MSG_ERROR("Failed to retrieve cell container: "<< m_caloCellContainerKey.key()); - return 0.; - } - - CaloLayerCalculator calc; - if (calc.fill(cellContainer.cptr(),cluster->etaSample(sam),cluster->phiSample(sam), - 7*deta,7*dphi,sam).isFailure() ){ - ATH_MSG_WARNING("CaloLayerCalculator failed fill "); - } - double etamax = calc.etarmax(); - double phimax = calc.phirmax(); - if (calc.fill(cellContainer.cptr(),etamax,phimax,3.*deta,7.*dphi,sam).isFailure()){ - ATH_MSG_WARNING("CaloLayerCalculator failed fill "); - } - - return calc.phis(); -} diff --git a/Reconstruction/egamma/egammaTrackTools/src/CaloCluster_OnTrackBuilder.h b/Reconstruction/egamma/egammaTrackTools/src/CaloCluster_OnTrackBuilder.h index 1b6097cea3045c331f75f0558ce93758fa2e7873..fa27e1a212fe68c613aa3d52f6969864e9310a0f 100755 --- a/Reconstruction/egamma/egammaTrackTools/src/CaloCluster_OnTrackBuilder.h +++ b/Reconstruction/egamma/egammaTrackTools/src/CaloCluster_OnTrackBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef CALOCLUSTER_ONTRACKBUILER_H @@ -39,12 +39,12 @@ class CaloCluster_OnTrackBuilder : public AthAlgTool, virtual public ICaloCluste // standard Athena methods virtual StatusCode initialize() override; virtual StatusCode finalize() override; - - virtual Trk::CaloCluster_OnTrack* buildClusterOnTrack( const xAOD::Egamma* eg, int charge=0) const override; - virtual Trk::CaloCluster_OnTrack* buildClusterOnTrack( const xAOD::CaloCluster* cl, int charge=0) const override; + virtual Trk::CaloCluster_OnTrack* + buildClusterOnTrack(const xAOD::CaloCluster* cl, + int charge = 0) const override; - private: +private: const Trk::Surface* getCaloSurface( const xAOD::CaloCluster* cluster ) const ; const Trk::LocalParameters* getClusterLocalParameters( const xAOD::CaloCluster* cluster, @@ -60,9 +60,6 @@ class CaloCluster_OnTrackBuilder : public AthAlgTool, virtual public ICaloCluste double electronPhiResoA(double eta) const; double electronPhiResoB(double eta) const; - double CalculatePhis(const xAOD::CaloCluster* cluster) const; - - /** @brief Tool to build calorimeter layer surfaces */ ToolHandle<ICaloSurfaceBuilder> m_calosurf {this, "CaloSurfaceBuilder", "CaloSurfaceBuilder", "Tool to build calorimeter layer surfaces"}; @@ -71,11 +68,7 @@ class CaloCluster_OnTrackBuilder : public AthAlgTool, virtual public ICaloCluste Gaudi::Property<bool> m_useClusterPhi{this, "UseClusterPhi", true}; Gaudi::Property<bool> m_useClusterEta{this, "UseClusterEta", true}; - SG::ReadHandleKey<CaloCellContainer> m_caloCellContainerKey {this, - "InputCellContainerName", "AODCellContainer"}; - /** @brief (deta,dphi) granularity*/ - const CaloDetDescrManager* m_calo_dd; const LArEM_ID* m_emid; }; diff --git a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx index 7c41b9ccc39b97976f843f05a9e017fab84732ac..b61d42bbb62c7f52a4ae84aa2d720b694c4e324c 100644 --- a/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx +++ b/Reconstruction/egamma/egammaTrackTools/src/egammaTrkRefitterTool.cxx @@ -298,10 +298,10 @@ egammaTrkRefitterTool::MeasurementsAndTrash egammaTrkRefitterTool::addPointsToTr ATH_MSG_WARNING("Could not extract MeasurementBase from track"); return collect; } - if (m_useClusterPosition && eg){ + if (m_useClusterPosition && eg->caloCluster()){ int charge(0); if( track->perigeeParameters() ) charge = (int)track->perigeeParameters()->charge(); - std::unique_ptr<const Trk::CaloCluster_OnTrack> ccot (m_CCOTBuilder->buildClusterOnTrack(eg,charge)); + std::unique_ptr<const Trk::CaloCluster_OnTrack> ccot (m_CCOTBuilder->buildClusterOnTrack(eg->caloCluster(),charge)); if (ccot!=nullptr){ collect.m_trash.push_back(std::move(ccot)); collect.m_measurements.push_back(collect.m_trash.back().get()); diff --git a/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt b/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt index 93c1417b49cd1661effce64b26dabcd46f814010..e34fc393bf5dd93de6e4b34a345733ad1ba86241 100644 --- a/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt +++ b/Reconstruction/iPat/iPatTrackFinder/CMakeLists.txt @@ -19,6 +19,7 @@ atlas_depends_on_subdirs( PUBLIC PRIVATE InnerDetector/InDetConditions/InDetBeamSpotService InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry MagneticField/MagFieldInterfaces Reconstruction/iPat/iPatGeometry Reconstruction/iPat/iPatTrackParameters @@ -41,7 +42,7 @@ atlas_add_component( iPatTrackFinder src/TrackFinder.cxx src/TrackManager.cxx src/components/*.cxx - LINK_LIBRARIES AthenaBaseComps Identifier EventPrimitives GaudiKernel InDetPrepRawData iPatInterfaces iPatTrack InDetReadoutGeometry MagFieldInterfaces iPatGeometry iPatTrackParameters iPatUtility TrkPrepRawData TrkSpacePoint VxVertex EventContainers) + LINK_LIBRARIES AthenaBaseComps Identifier EventPrimitives GaudiKernel InDetPrepRawData iPatInterfaces iPatTrack InDetReadoutGeometry PixelReadoutGeometry MagFieldInterfaces iPatGeometry iPatTrackParameters iPatUtility TrkPrepRawData TrkSpacePoint VxVertex EventContainers) # Install files from the package: atlas_install_headers( iPatTrackFinder ) diff --git a/Reconstruction/iPat/iPatTrackFinder/src/FinderTolerances.cxx b/Reconstruction/iPat/iPatTrackFinder/src/FinderTolerances.cxx index b2842186ef9b632f529822271ec910f44360f70a..9f461a77650e8e4b6916cd983121443039f895bb 100755 --- a/Reconstruction/iPat/iPatTrackFinder/src/FinderTolerances.cxx +++ b/Reconstruction/iPat/iPatTrackFinder/src/FinderTolerances.cxx @@ -12,7 +12,7 @@ #include "GaudiKernel/Incident.h" #include "GaudiKernel/SystemOfUnits.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "MagFieldInterfaces/IMagFieldSvc.h" #include "iPatTrackFinder/FinderTolerances.h" #include "iPatUtility/VertexRegion.h" diff --git a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py index 18a4ab62e3d077aa776f6bb8ff06fce41cd903f0..b2a28b329e28320d9f30c065a70026b1411f39a9 100644 --- a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py +++ b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py @@ -290,11 +290,7 @@ def getTauVertexVariables(): TauVertexVariables = TauVertexVariables( name = _name, TrackToVertexIPEstimator = getTauTrackToVertexIPEstimator(), VertexFitter = getTauAdaptiveVertexFitter(), - #VertexFitter = "Trk::AdaptiveVertexFitter/InDetAdaptiveVxFitterTool", SeedFinder = getTauCrossDistancesSeedFinder(), - Key_vertexInputContainer = _DefaultVertexContainer, - Key_trackPartInputContainer = _DefaultTrackContainer # ATM only needed in case old API is used - #OutputLevel = 2 ) cached_instances[_name] = TauVertexVariables diff --git a/Reconstruction/tauRec/src/TauProcessorAlg.cxx b/Reconstruction/tauRec/src/TauProcessorAlg.cxx index 22f3778e28322d61e62c65abaa565824b3f6d12e..52eb44cd9748335f09adae1bacd00b6d90650c7b 100644 --- a/Reconstruction/tauRec/src/TauProcessorAlg.cxx +++ b/Reconstruction/tauRec/src/TauProcessorAlg.cxx @@ -257,7 +257,7 @@ StatusCode TauProcessorAlg::execute() { // symlink as INavigable4MomentumCollection (as in CaloRec/CaloCellMaker) ATH_CHECK(evtStore()->symLink(Pi0CellContainer, static_cast<INavigable4MomentumCollection*> (0))); - // sort the cll container by hash + // sort the cell container by hash ATH_CHECK( m_cellMakerTool->process(static_cast<CaloCellContainer*> (Pi0CellContainer), ctx) ); ATH_MSG_VERBOSE("The tau candidate container has been modified"); diff --git a/Reconstruction/tauRecTools/CMakeLists.txt b/Reconstruction/tauRecTools/CMakeLists.txt index 4ff7229e5481628368841f7fb27ddbf90b235aed..d28b9e38f358b3321f5b39514fa82efa5d0eadaf 100644 --- a/Reconstruction/tauRecTools/CMakeLists.txt +++ b/Reconstruction/tauRecTools/CMakeLists.txt @@ -53,9 +53,11 @@ else() Event/FourMomUtils Event/NavFourMom Event/xAOD/xAODJet + LumiBlock/LumiBlockComps GaudiKernel InnerDetector/InDetRecTools/InDetRecToolInterfaces InnerDetector/InDetRecTools/InDetTrackSelectionTool + InnerDetector/InDetConditions/BeamSpotConditionsData Reconstruction/Jet/JetEDM Reconstruction/RecoTools/ITrackToVertex Reconstruction/RecoTools/RecoToolInterfaces @@ -111,7 +113,7 @@ if( XAOD_STANDALONE OR XAOD_ANALYSIS ) AthLinks AsgTools CxxUtils xAODCaloEvent xAODEventInfo xAODPFlow xAODEgamma xAODTau xAODTracking xAODParticleEvent PRIVATE_LINK_LIBRARIES ${FASTJETCONTRIB_LIBRARIES} ${LWTNN_LIBRARIES} FourMomUtils xAODJet - PathResolver MVAUtils ElectronPhotonSelectorToolsLib ) + PathResolver MVAUtils ElectronPhotonSelectorToolsLib LumiBlockCompsLib) else() atlas_add_library( tauRecToolsLib tauRecTools/*.h Root/*.cxx tauRecTools/lwtnn/*.h Root/lwtnn/*.cxx ${tauRecToolsLibCintDict} @@ -123,7 +125,7 @@ else() AthLinks AsgTools CxxUtils xAODCaloEvent xAODEventInfo xAODPFlow xAODEgamma xAODTau xAODTracking xAODParticleEvent CaloUtilsLib Particle PRIVATE_LINK_LIBRARIES ${FASTJETCONTRIB_LIBRARIES} ${LWTNN_LIBRARIES} FourMomUtils xAODJet - PathResolver MVAUtils ElectronPhotonSelectorToolsLib) + PathResolver MVAUtils ElectronPhotonSelectorToolsLib LumiBlockCompsLib) endif() if( NOT XAOD_STANDALONE ) @@ -133,7 +135,7 @@ if( NOT XAOD_STANDALONE ) INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${LWTNN_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} ${Boost_LIBRARIES} ${LWTNN_LIBRARIES} xAODTau xAODTracking xAODEgamma AthContainers FourMomUtils xAODCaloEvent xAODJet - xAODPFlow xAODParticleEvent MVAUtils ElectronPhotonSelectorToolsLib GaudiKernel tauRecToolsLib ) + xAODPFlow xAODParticleEvent MVAUtils ElectronPhotonSelectorToolsLib GaudiKernel tauRecToolsLib LumiBlockCompsLib) else() atlas_add_component( tauRecTools src/*.h src/*.cxx src/components/*.cxx @@ -145,7 +147,7 @@ if( NOT XAOD_STANDALONE ) RecoToolInterfaces TrkLinks TrkParametersIdentificationHelpers TrkTrackSummary VxVertex TrkToolInterfaces TrkVertexFitterInterfaces TrkVertexFittersLib InDetTrackSelectionToolLib - tauRecToolsLib ) + tauRecToolsLib LumiBlockCompsLib) endif() endif() diff --git a/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx b/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx index e1cad2c731ac3e096c47263308214363e57b213b..5f0958c2ac9e2432ad0d987d4386e427b4b89fb3 100644 --- a/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx +++ b/Reconstruction/tauRecTools/Root/CaloClusterVariables.cxx @@ -1,10 +1,8 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "tauRecTools/CaloClusterVariables.h" -//#include "tauEvent/TauJet.h" -//#include "boost/foreach.hpp" #include "math.h" const double CaloClusterVariables::DEFAULT = -1111.; @@ -146,13 +144,9 @@ bool CaloClusterVariables::update(const xAOD::TauJet& pTau, bool inAODmode) { --icount; double energy = c.e(); - //XXXchange to use tlorentzvector double px = c.p4().Px(); double py = c.p4().Py(); double pz = c.p4().Pz(); - // FF: see comment above - //CLHEP::HepLorentzVector constituentHLV(px, py, pz, 1); - //sum_radii += centroid.deltaR(constituentHLV); double dr = std::sqrt( std::pow(c.eta() - centroid.Eta(),2) + std::pow(c.phi() - centroid.Phi(),2)); sum_radii += dr; @@ -179,10 +173,9 @@ bool CaloClusterVariables::update(const xAOD::TauJet& pTau, bool inAODmode) { } -//***************************************** -// Calculate the geometrical center of the -// tau constituents -//***************************************** +//*********************************************************** +// Calculate the geometrical center of the tau constituents +//*********************************************************** TLorentzVector CaloClusterVariables::calculateTauCentroid(int nConst, const std::vector<CaloVertexedClusterType>& constituents) { double px = 0; diff --git a/Reconstruction/tauRecTools/Root/MvaTESEvaluator.cxx b/Reconstruction/tauRecTools/Root/MvaTESEvaluator.cxx index 10f38c1c137acbaabda69f42a81ae894c273540c..21ab187e4a02305d02119b5f40d4650f9a0095f4 100644 --- a/Reconstruction/tauRecTools/Root/MvaTESEvaluator.cxx +++ b/Reconstruction/tauRecTools/Root/MvaTESEvaluator.cxx @@ -181,6 +181,8 @@ StatusCode MvaTESEvaluator::execute(xAOD::TauJet& xTau){ // apply MVA calibration xTau.setP4(ptMVA, m_etaDetectorAxis, xTau.phiDetectorAxis(), 0); } + + ATH_MSG_DEBUG("final calib:" << xTau.pt() << " " << xTau.eta() << " " << xTau.phi() << " " << xTau.e()); return StatusCode::SUCCESS; } diff --git a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx index ecb39adb977a9922077abf92625b97bc7546e87b..b2b45b469905d29395b1eb38cb44c2c0376274b7 100644 --- a/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx +++ b/Reconstruction/tauRecTools/Root/MvaTESVariableDecorator.cxx @@ -10,8 +10,6 @@ //_____________________________________________________________________________ MvaTESVariableDecorator::MvaTESVariableDecorator(const std::string& name) : TauRecToolBase(name) - , m_mu(0) - , m_nVtxPU(0) { } @@ -38,33 +36,29 @@ StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) { // Decorate event info // need to check mu can be retrieved via EventInfo for Run3 trigger + int mu = 0; SG::ReadHandle<xAOD::EventInfo> eventinfoInHandle( m_eventInfo ); if (!eventinfoInHandle.isValid()) { - ATH_MSG_ERROR( "Could not retrieve HiveDataObj with key " << eventinfoInHandle.key() << ", will set mu=0."); - m_mu = 0.; + ATH_MSG_ERROR ( "Could not retrieve HiveDataObj with key " << eventinfoInHandle.key() << ", will set mu=0."); + mu = 0.; } else { const xAOD::EventInfo* eventInfo = eventinfoInHandle.cptr(); - m_mu = eventInfo->averageInteractionsPerCrossing(); + mu = eventInfo->averageInteractionsPerCrossing(); } - m_nVtxPU = 0; + int nVtxPU = 0; if(!m_vertexInputContainer.key().empty()) { // Get the primary vertex container from StoreGate SG::ReadHandle<xAOD::VertexContainer> vertexInHandle( m_vertexInputContainer ); if (!vertexInHandle.isValid()) { - ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << vertexInHandle.key()); - if(m_emitVertexWarning) { - ATH_MSG_WARNING("No xAOD::VertexContainer, setting nVtxPU to 0"); - m_emitVertexWarning=false; - } + ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << vertexInHandle.key() << ", will set nVtxPU=0."); } else { const xAOD::VertexContainer* vertexContainer = vertexInHandle.cptr(); - ATH_MSG_VERBOSE(" read: " << vertexInHandle.key() << " = " << "..." ); for (auto xVertex : *vertexContainer){ if (xVertex->vertexType() == xAOD::VxType::PileUp) - m_nVtxPU++; + ++nVtxPU; } } } @@ -72,8 +66,8 @@ StatusCode MvaTESVariableDecorator::execute(xAOD::TauJet& xTau) { SG::AuxElement::Accessor<float> acc_mu("mu"); SG::AuxElement::Accessor<int> acc_nVtxPU("nVtxPU"); - acc_mu(xTau) = m_mu; - acc_nVtxPU(xTau) = m_nVtxPU; + acc_mu(xTau) = mu; + acc_nVtxPU(xTau) = nVtxPU; // Decorate jet seed variables const xAOD::Jet* jet_seed = xTau.jet(); diff --git a/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx b/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx index a1afe0d4410406228251153bbfaa760a94df52af..545750924e1e76eaf4154371c83e34cc6e85a2c9 100644 --- a/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx +++ b/Reconstruction/tauRecTools/Root/TauCalibrateLC.cxx @@ -5,7 +5,8 @@ //tau #include "tauRecTools/TauCalibrateLC.h" #include "xAODTau/TauJet.h" -#include "tauRecTools/TauEventData.h" + +#include "LumiBlockComps/ILumiBlockMuTool.h" //compilation error if attempting to include CLHEP first //ASGTOOL_ATHENA defined here: @@ -16,7 +17,6 @@ #include "TF1.h" #include "TH1D.h" -//included eventually from ITauToolBase #ifndef XAOD_STANDALONE #include "CLHEP/Vector/LorentzVector.h" #include "CLHEP/Units/SystemOfUnits.h" @@ -28,6 +28,7 @@ using CLHEP::GeV; /********************************************************************/ TauCalibrateLC::TauCalibrateLC(const std::string& name) : TauRecToolBase(name), + m_lumiBlockMuTool("LumiBlockMuTool/LumiBlockMuTool"), m_doEnergyCorr(false), m_doPtResponse(false), m_doAxisCorr(false), @@ -50,8 +51,16 @@ TauCalibrateLC::~TauCalibrateLC() { /********************************************************************/ StatusCode TauCalibrateLC::initialize() { - ATH_CHECK( m_vertexInputContainer.initialize(! m_vertexInputContainer.key().empty()) ); - + if (m_in_trigger) { + if (m_lumiBlockMuTool.retrieve().isFailure()) + ATH_MSG_WARNING( "Unable to retrieve LumiBlockMuTool" ); + else + ATH_MSG_DEBUG( "Successfully retrieved LumiBlockMuTool" ); + } + else { + ATH_CHECK( m_vertexInputContainer.initialize() ); + } + std::string fullPath = find_file(m_calibrationFile); TFile * file = TFile::Open(fullPath.c_str(), "READ"); @@ -145,7 +154,6 @@ StatusCode TauCalibrateLC::initialize() { /********************************************************************/ StatusCode TauCalibrateLC::execute(xAOD::TauJet& pTau) { - // energy calibration depends on number of tracks - 1p or Mp int prongBin = 1; //Mp if (pTau.nTracks() <= 1) prongBin = 0; //1p @@ -160,55 +168,35 @@ StatusCode TauCalibrateLC::execute(xAOD::TauJet& pTau) if (etaBin>=m_nEtaBins) etaBin = m_nEtaBins-1; // correction from last bin should be applied on all taus outside stored eta range - const xAOD::VertexContainer * vxContainer = 0; int nVertex = 0; - - // Only retrieve the container if we are not in trigger - if ( ! m_vertexInputContainer.key().empty() ) { - - // StatusCode sc; - // Get the primary vertex container from StoreGate + + // Obtain pileup + if (m_in_trigger) { // online: retrieved from LumiBlockTool + if(m_lumiBlockMuTool){ + nVertex = m_lumiBlockMuTool->averageInteractionsPerCrossing(); + ATH_MSG_DEBUG("AvgInteractions object in tau candidate = " << nVertex); + } + else { + nVertex = m_averageNPV; + ATH_MSG_DEBUG("No AvgInteractions object in tau candidate - using default value = " << nVertex); + } + } + else { // offline: count the primary vertex container SG::ReadHandle<xAOD::VertexContainer> vertexInHandle( m_vertexInputContainer ); if (!vertexInHandle.isValid()) { ATH_MSG_ERROR ("Could not retrieve HiveDataObj with key " << vertexInHandle.key()); return StatusCode::FAILURE; } - vxContainer = vertexInHandle.cptr(); - - // Calculate nVertex - xAOD::VertexContainer::const_iterator vx_iter = vxContainer->begin(); - xAOD::VertexContainer::const_iterator vx_end = vxContainer->end(); - - for (; vx_iter != vx_end; ++vx_iter) { - if(m_countOnlyPileupVertices && - (*vx_iter)->vertexType() == xAOD::VxType::PileUp) - ++nVertex; - else if(!m_countOnlyPileupVertices && - (*vx_iter)->nTrackParticles() >= m_minNTrackAtVertex) - ++nVertex; - } - + const xAOD::VertexContainer * vxContainer = vertexInHandle.cptr(); + for (const auto vertex : *vxContainer) { + if (m_countOnlyPileupVertices && vertex->vertexType() == xAOD::VxType::PileUp) + ++nVertex; + else if (!m_countOnlyPileupVertices && vertex->nTrackParticles() >= m_minNTrackAtVertex) + ++nVertex; + } ATH_MSG_DEBUG("calculated nVertex " << nVertex ); - - } else { - - StatusCode scMu = StatusCode::FAILURE; - double muTemp = 0.0; - - if (tauEventData()->hasObject("AvgInteractions")) scMu = tauEventData()->getObject("AvgInteractions", muTemp); - - if(scMu.isSuccess()){ - ATH_MSG_DEBUG("AvgInteractions object in tau candidate = " << muTemp); - nVertex = muTemp; - } else { - ATH_MSG_DEBUG("No AvgInteractions object in tau candidate - using default value"); - nVertex = m_averageNPV; - } - - } - - + } double calibConst = 1.0; @@ -216,7 +204,7 @@ StatusCode TauCalibrateLC::execute(xAOD::TauJet& pTau) double offset = slopeNPV * (nVertex - m_averageNPV); // energy response parameterized as a function of pileup-corrected E_LC - double energyLC = pTau.p4(xAOD::TauJetParameters::DetectorAxis).E() / GeV; //was sumClusterVector.e() / GeV; + double energyLC = pTau.p4(xAOD::TauJetParameters::DetectorAxis).E() / GeV; if(m_doPtResponse) energyLC = pTau.ptDetectorAxis() / GeV; if (energyLC <= 0) { @@ -227,9 +215,6 @@ StatusCode TauCalibrateLC::execute(xAOD::TauJet& pTau) return StatusCode::SUCCESS; } - // get detector axis energy - // was saved by TauAxisSetter - if (energyLC - offset <= 0) { ATH_MSG_DEBUG("after pile-up correction energy would be = " << energyLC - offset << " --> setting offset=0 now!"); offset = 0; @@ -269,42 +254,31 @@ StatusCode TauCalibrateLC::execute(xAOD::TauJet& pTau) if (m_doAxisCorr) { // get tau intermediate axis values - double eta = pTau.etaIntermediateAxis(); double absEta = std::abs(eta); double etaCorr = eta; - // WARNING !!! THIS IS NEW - MAKE SURE WE WANT THIS double phi = pTau.phiIntermediateAxis(); double phiCorr = phi; // TauCalibrateLC should then only be called after Pantau !! - // if(m_usePantauAxis && fabs(pTau.etaPanTauCellBased()) < 111) { etaCorr = pTau.etaPanTauCellBased(); phiCorr = pTau.phiPanTauCellBased(); - } else if (absEta) { - etaCorr = (eta / absEta)*(absEta - m_etaCorrectionHist->GetBinContent(m_etaCorrectionHist->GetXaxis()->FindBin(absEta))); - } ATH_MSG_DEBUG("eta " << eta << "; corrected eta = " << etaCorr << " ; phi " << phi << "; corrected phi " << phiCorr ); - pTau.setP4( pTau.e() / cosh( etaCorr ), etaCorr, phiCorr, pTau.m()); - pTau.setP4(xAOD::TauJetParameters::TauEtaCalib, pTau.pt(), pTau.eta(), pTau.phi(), pTau.m()); } if (m_isCaloOnly == true && m_in_trigger == true){ - pTau.setP4(xAOD::TauJetParameters::TrigCaloOnly, pTau.pt(), pTau.eta(), pTau.phi(), pTau.m()); - } - return StatusCode::SUCCESS; } diff --git a/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx b/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx index 64c09d7844eea64a164284d4c672e9a51dcfce27..ce162bc13540c90eeab7ae2c2f319e0160c6961a 100644 --- a/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx +++ b/Reconstruction/tauRecTools/Root/TauRecToolBase.cxx @@ -150,38 +150,46 @@ StatusCode TauRecToolBase::eventInitialize(){ //________________________________________ StatusCode TauRecToolBase::execute(xAOD::TauJet&){ - return StatusCode::SUCCESS; + ATH_MSG_ERROR("function not implemented"); + return StatusCode::FAILURE; } StatusCode TauRecToolBase::executeShotFinder(xAOD::TauJet& /*pTau*/, xAOD::CaloClusterContainer& /*shotClusterContainer*/, xAOD::PFOContainer& /*PFOContainer*/ ) { - return StatusCode::SUCCESS; + ATH_MSG_ERROR("function not implemented"); + return StatusCode::FAILURE; } StatusCode TauRecToolBase::executePi0CreateROI(xAOD::TauJet& /*pTau*/, CaloCellContainer& /*caloCellContainer*/, std::vector<CaloCell*>& /*map*/ ) { - return StatusCode::SUCCESS; + ATH_MSG_ERROR("function not implemented"); + return StatusCode::FAILURE; } StatusCode TauRecToolBase::executePi0ClusterCreator(xAOD::TauJet& /*pTau*/, xAOD::PFOContainer& /*neutralPFOContainer*/, xAOD::PFOContainer& /*hadronicPFOContainer*/, xAOD::CaloClusterContainer& /*caloClusterContainer*/, const xAOD::CaloClusterContainer& /*pCaloClusterContainer*/ ) { - return StatusCode::SUCCESS; + ATH_MSG_ERROR("function not implemented"); + return StatusCode::FAILURE; } StatusCode TauRecToolBase::executeVertexVariables(xAOD::TauJet& /*pTau*/, xAOD::VertexContainer& /*vertexContainer*/ ) { - return StatusCode::SUCCESS; + ATH_MSG_ERROR("function not implemented"); + return StatusCode::FAILURE; } StatusCode TauRecToolBase::executePi0ClusterScaler(xAOD::TauJet& /*pTau*/, xAOD::PFOContainer& /*neutralPFOContainer*/, xAOD::PFOContainer& /*chargedPFOContainer*/ ) { - return StatusCode::SUCCESS; + ATH_MSG_ERROR("function not implemented"); + return StatusCode::FAILURE; } StatusCode TauRecToolBase::executePi0nPFO(xAOD::TauJet& /*pTau*/, xAOD::PFOContainer& /*neutralPFOContainer*/) { - return StatusCode::SUCCESS; + ATH_MSG_ERROR("function not implemented"); + return StatusCode::FAILURE; } StatusCode TauRecToolBase::executePanTau(xAOD::TauJet& /*pTau*/, xAOD::ParticleContainer& /*particleContainer*/) { - return StatusCode::SUCCESS; + ATH_MSG_ERROR("function not implemented"); + return StatusCode::FAILURE; } //________________________________________ diff --git a/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx b/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx index 9d50ef8633ea80a13817812108f2d1785ff28e29..8adf683056a83a283fae7683b43ce44bbb36da9b 100644 --- a/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx +++ b/Reconstruction/tauRecTools/Root/TauSubstructureVariables.cxx @@ -13,11 +13,6 @@ #include <math.h> #include <sstream> -//#include "GaudiKernel/Property.h" -//#include "FourMomUtils/P4Helpers.h" - -//#include "AnalysisUtils/AnalysisMisc.h" - #include "xAODJet/Jet.h" #include "xAODTau/TauJet.h" @@ -25,8 +20,6 @@ #include "tauRecTools/TauSubstructureVariables.h" #include "tauRecTools/KineUtils.h" -//#include "CaloUtils/CaloVertexedCluster.h" -//#include "CaloEvent/CaloVertexedCluster.h" #ifndef XAOD_ANALYSIS #include "GaudiKernel/SystemOfUnits.h" @@ -45,7 +38,7 @@ TauSubstructureVariables::TauSubstructureVariables( const std::string& name ) : TauRecToolBase(name), m_maxPileUpCorrection(4 * GeV), m_pileUpAlpha(1.0), - m_doVertexCorrection(false), //FF: don't do cell correction by default + m_doVertexCorrection(false), m_inAODmode(false) { declareProperty("maxPileUpCorrection", m_maxPileUpCorrection); declareProperty("pileUpAlpha", m_pileUpAlpha); diff --git a/Reconstruction/tauRecTools/src/TauAxisSetter.cxx b/Reconstruction/tauRecTools/src/TauAxisSetter.cxx index d7d13ae9be7affbcb6b8452aba582fedd38b5515..495d38c7e5a28041d7cb3f393bada97cfc8572be 100644 --- a/Reconstruction/tauRecTools/src/TauAxisSetter.cxx +++ b/Reconstruction/tauRecTools/src/TauAxisSetter.cxx @@ -87,7 +87,7 @@ StatusCode TauAxisSetter::execute(xAOD::TauJet& pTau) } // save values for detector axis. - ATH_MSG_VERBOSE("detector axis:" << tauDetectorAxis.Pt()<< " " << tauDetectorAxis.Eta() << " " << tauDetectorAxis.Phi() << " " << tauDetectorAxis.E() ); + ATH_MSG_DEBUG("detector axis:" << tauDetectorAxis.Pt()<< " " << tauDetectorAxis.Eta() << " " << tauDetectorAxis.Phi() << " " << tauDetectorAxis.E() ); pTau.setP4(tauDetectorAxis.Pt(), tauDetectorAxis.Eta(), tauDetectorAxis.Phi(), pTau.m()); pTau.setP4(xAOD::TauJetParameters::DetectorAxis, tauDetectorAxis.Pt(), tauDetectorAxis.Eta(), tauDetectorAxis.Phi(), tauDetectorAxis.M()); @@ -112,8 +112,8 @@ StatusCode TauAxisSetter::execute(xAOD::TauJet& pTau) } // save values for intermediate axis - ATH_MSG_VERBOSE("tau axis:" << tauInterAxis.Pt()<< " " << tauInterAxis.Eta() << " " << tauInterAxis.Phi() << " " << tauInterAxis.E() ); - pTau.setP4(tauInterAxis.Pt(), tauInterAxis.Eta(), tauInterAxis.Phi(), pTau.m()); + ATH_MSG_DEBUG("tau axis:" << tauInterAxis.Pt()<< " " << tauInterAxis.Eta() << " " << tauInterAxis.Phi() << " " << tauInterAxis.E() ); + pTau.setP4(tauInterAxis.Pt(), tauInterAxis.Eta(), tauInterAxis.Phi(), pTau.m()); pTau.setP4(xAOD::TauJetParameters::IntermediateAxis, tauInterAxis.Pt(), tauInterAxis.Eta(), tauInterAxis.Phi(), tauInterAxis.M()); } diff --git a/Reconstruction/tauRecTools/src/TauVertexVariables.cxx b/Reconstruction/tauRecTools/src/TauVertexVariables.cxx index ec5058fa41a08b1d1b079bed60b9fb80d1c0ea82..ae3bfcafb06591aad571331723a5cdb37c5b6f50 100644 --- a/Reconstruction/tauRecTools/src/TauVertexVariables.cxx +++ b/Reconstruction/tauRecTools/src/TauVertexVariables.cxx @@ -13,7 +13,6 @@ #include "TrkVertexFitters/AdaptiveVertexFitter.h" #include "TrkLinks/LinkToXAODTrackParticle.h" -#include "tauRecTools/TauEventData.h" #include "TauVertexVariables.h" //----------------------------------------------------------------------------- @@ -43,12 +42,14 @@ TauVertexVariables::~TauVertexVariables() { //----------------------------------------------------------------------------- StatusCode TauVertexVariables::initialize() { - CHECK( m_trackToVertexIPEstimator.retrieve() ); - CHECK( m_fitTool.retrieve() ); - CHECK( m_SeedFinder.retrieve() ); + + ATH_CHECK( m_trackToVertexIPEstimator.retrieve() ); + ATH_CHECK( m_fitTool.retrieve() ); + ATH_CHECK( m_SeedFinder.retrieve() ); - ATH_CHECK(m_vertexInputContainer.initialize(!m_vertexInputContainer.key().empty()) ); - ATH_CHECK(m_trackPartInputContainer.initialize(!m_trackPartInputContainer.key().empty()) ); + if (m_in_trigger) { + ATH_CHECK(m_beamSpotKey.initialize()); + } return StatusCode::SUCCESS; } @@ -64,42 +65,44 @@ StatusCode TauVertexVariables::finalize() { // Execution //----------------------------------------------------------------------------- StatusCode TauVertexVariables::executeVertexVariables(xAOD::TauJet& pTau, xAOD::VertexContainer& pSecVtxContainer) { - - ATH_MSG_DEBUG("executing TauVertexVariables"); + ATH_MSG_DEBUG("execut()"); // impact parameter variables for standard tracks if (pTau.nTracks() > 0) { - const Trk::ImpactParametersAndSigma* myIPandSigma(0); + const Trk::ImpactParametersAndSigma* myIPandSigma(nullptr); const xAOD::Vertex* vxcand = nullptr; - - if (m_in_trigger) { - - StatusCode scBeam = StatusCode::FAILURE; - - if (tauEventData()->hasObject("Beamspot")) scBeam = tauEventData()->getObject("Beamspot", vxcand); - if(scBeam){ - myIPandSigma = m_trackToVertexIPEstimator->estimate(pTau.track(0)->track(), vxcand); - } else { - ATH_MSG_DEBUG("No Beamspot object in tau candidate"); - } - - } else if (pTau.vertexLink()) { + xAOD::Vertex theBeamspot; + theBeamspot.makePrivateStore(); + if (m_in_trigger) { // online: use beamspot + SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey }; + if(beamSpotHandle.isValid()){ + theBeamspot.setPosition(beamSpotHandle->beamPos()); + const auto& cov = beamSpotHandle->beamVtx().covariancePosition(); + theBeamspot.setCovariancePosition(cov); + vxcand = &theBeamspot; + + myIPandSigma = m_trackToVertexIPEstimator->estimate(pTau.track(0)->track(), vxcand); + } + else { + ATH_MSG_DEBUG("No Beamspot object in tau candidate"); + } + } + else if (pTau.vertexLink()) { // offline: obtain tau vertex by link vxcand = *(pTau.vertexLink()) ; - //check if vertex has a valid type (skip if vertex has type NoVtx) if (vxcand->vertexType() > 0){ myIPandSigma = m_trackToVertexIPEstimator->estimate(pTau.track(0)->track(), vxcand); } - } if (myIPandSigma != 0) { pTau.setDetail(xAOD::TauJetParameters::ipSigLeadTrk, (float)( myIPandSigma->IPd0 / myIPandSigma->sigmad0 )); pTau.setDetail(xAOD::TauJetParameters::ipZ0SinThetaSigLeadTrk, (float)( myIPandSigma->IPz0SinTheta / myIPandSigma->sigmaz0SinTheta )); - } else { + } + else { ATH_MSG_DEBUG("trackToVertexIPestimator failed for a standard track!"); pTau.setDetail(xAOD::TauJetParameters::ipSigLeadTrk, (float)(-999.)); pTau.setDetail(xAOD::TauJetParameters::ipZ0SinThetaSigLeadTrk, (float)(-999.)); @@ -107,13 +110,11 @@ StatusCode TauVertexVariables::executeVertexVariables(xAOD::TauJet& pTau, xAOD:: delete myIPandSigma; - } else { - + } + else { ATH_MSG_DEBUG("Tau has no tracks"); - } - float ipSigLeadTrk; float ipZ0SinThetaSigLeadTrk; @@ -122,40 +123,13 @@ StatusCode TauVertexVariables::executeVertexVariables(xAOD::TauJet& pTau, xAOD:: if (pTau.detail(xAOD::TauJetParameters::ipZ0SinThetaSigLeadTrk, ipZ0SinThetaSigLeadTrk)) ATH_MSG_VERBOSE("IP Z0 significance lead track " << ipZ0SinThetaSigLeadTrk); - //try to find secondary vertex - //look for secondary vertex if more than 1 track pTau.setDetail(xAOD::TauJetParameters::trFlightPathSig, (float)(-1111.)); - if (pTau.nTracks() < 2) { + + //try to find secondary vertex if more than 1 track and the tau vertex is available + if ( pTau.nTracks() < 2 || !(pTau.vertexLink()) ) { return StatusCode::SUCCESS; } - if (m_vertexInputContainer.key().empty()){ - const xAOD::VertexContainer* vxContainer = 0; - StatusCode sc=StatusCode::SUCCESS; - sc = tauEventData()->getObject("VxPrimaryCandidate", vxContainer); - - if (sc.isFailure() || !vxContainer) { - ATH_MSG_WARNING("No vertex container found. Skipping secondary vertex fitting."); - return StatusCode::SUCCESS; - } - } - else{ - // retrieve vertex container, exit if not found - SG::ReadHandle<xAOD::VertexContainer> vertexInHandle( m_vertexInputContainer ); - if (!vertexInHandle.isValid()) { - ATH_MSG_WARNING("No vertex container found. Skipping secondary vertex fitting."); - return StatusCode::SUCCESS; - } - // retrieve track particle container, exit if not found - if(!m_trackPartInputContainer.key().empty()){ - SG::ReadHandle<xAOD::TrackParticleContainer> trackPartInHandle( m_trackPartInputContainer ); - if (!trackPartInHandle.isValid()) { - ATH_MSG_WARNING("No track particle container found. Skipping secondary vertex fitting."); - return StatusCode::SUCCESS; - } - } - } - // get xAOD TrackParticles and Trk::Tracks std::vector<const xAOD::TrackParticle*> xaodTracks; std::vector<const Trk::Track*> origTracks; @@ -164,16 +138,6 @@ StatusCode TauVertexVariables::executeVertexVariables(xAOD::TauJet& pTau, xAOD:: ATH_MSG_VERBOSE("xAOD::TrackParticle " <<i<<": "<< pTau.track(i)->pt() << " " << pTau.track(i)->eta() << " " << pTau.track(i)->phi()); if (pTau.track(i)->track()) { origTracks.push_back(pTau.track(i)->track()->track()); - - // for debugging - /* - ATH_MSG_DEBUG("Trk::Track " <<i<<": "<< (*pTau.track(i)->track())->pt() << " " << (*pTau.track(i)->track())->eta() << " " << (*pTau.track(i)->track())->phi()); - const Trk::TrackParameters * tmpMeasPer = (*pTau.track(i)->track())->perigeeParameters(); - const AmgSymMatrix(5)* cov = tmpMeasPer->covariance(); - ATH_MSG_DEBUG(" TrackParameters: pT="<< tmpMeasPer->pT() << ", eta=" << tmpMeasPer->eta() << ", x=" << tmpMeasPer->position().x() << ", y="<< tmpMeasPer->position().y() <<", z="<< tmpMeasPer->position().z()); - ATH_MSG_DEBUG(" covariance ="<< *cov); - */ - // for debugging } else { ATH_MSG_WARNING("no Trk::Track for xAOD::TrackParticle"); @@ -181,23 +145,12 @@ StatusCode TauVertexVariables::executeVertexVariables(xAOD::TauJet& pTau, xAOD:: } // get the starting point for the fit using Trk::Tracks - // Trk::Vertex* seedPoint = new Trk::Vertex(m_SeedFinder->findSeed(origTracks)); Amg::Vector3D seedPoint = m_SeedFinder->findSeed(origTracks); ATH_MSG_VERBOSE("seedPoint x/y/perp=" << seedPoint.x() << " " << seedPoint.y() << " "<< seedPoint.z() << " " << TMath::Sqrt(seedPoint.x()*seedPoint.x()+seedPoint.y()+seedPoint.y())); - // if (!seedPoint) { - // ATH_MSG_WARNING("no seedPoint: Can not calculate secondary vertex!"); - // return StatusCode::SUCCESS; - // } // fitting the vertex itself xAOD::Vertex* xAODvertex(0); - xAODvertex = m_fitTool->fit(xaodTracks, seedPoint); - if (xAODvertex && !m_in_trigger) { - ATH_MSG_VERBOSE("using new xAOD API: Secondary Vertex found and recorded! x="<<xAODvertex->position().x()<< ", y="<<xAODvertex->position().y()<<", perp="<<xAODvertex->position().perp()); - pSecVtxContainer.push_back(xAODvertex); - xAODvertex->setVertexType(xAOD::VxType::NotSpecified); - } - + xAODvertex = m_fitTool->fit(xaodTracks, seedPoint); if (!xAODvertex) { ATH_MSG_WARNING("no secondary vertex found!"); return StatusCode::SUCCESS; @@ -210,6 +163,9 @@ StatusCode TauVertexVariables::executeVertexVariables(xAOD::TauJet& pTau, xAOD:: // Note, we only attach the 2nd vertex if at offline, otherwise, break the trigger persistency if (!m_in_trigger) { + ATH_MSG_VERBOSE("secondary vertex recorded! x="<<xAODvertex->position().x()<< ", y="<<xAODvertex->position().y()<<", perp="<<xAODvertex->position().perp()); + pSecVtxContainer.push_back(xAODvertex); + xAODvertex->setVertexType(xAOD::VxType::NotSpecified); pTau.setSecondaryVertex(&pSecVtxContainer, xAODvertex); // set the link to the vertex } else { @@ -256,7 +212,6 @@ double TauVertexVariables::trFlightPathSig(const xAOD::TauJet& pTau, const xAOD: if (fpx * pTau.p4().Px() + fpy * pTau.p4().Py() > 0.) sign = 1.; else sign = -1.; - //ATH_MSG_INFO(sign << " " <<fpt << " " << sigma_fpt << " " << sign * fpt / sigma_fpt); return sign * fpt / sigma_fpt; } diff --git a/Reconstruction/tauRecTools/src/TauVertexVariables.h b/Reconstruction/tauRecTools/src/TauVertexVariables.h index 48bce54a2ef5de231c73d2a55d4e5c858a910ecd..77e01486b7a1348208b5fc5d9cb4469948a504fa 100644 --- a/Reconstruction/tauRecTools/src/TauVertexVariables.h +++ b/Reconstruction/tauRecTools/src/TauVertexVariables.h @@ -10,6 +10,8 @@ #include "tauRecTools/TauRecToolBase.h" #include "GaudiKernel/ToolHandle.h" +#include "BeamSpotConditionsData/BeamSpotData.h" + // forwards class TauEventData; namespace Trk { @@ -47,10 +49,8 @@ private: ToolHandle< Trk::ITrackToVertexIPEstimator > m_trackToVertexIPEstimator; ToolHandle< Trk::IVertexFitter > m_fitTool; //!< Pointer to the base class of the fit algtools ToolHandle< Trk::IVertexSeedFinder > m_SeedFinder; - - SG::ReadHandleKey<xAOD::VertexContainer> m_vertexInputContainer{this,"Key_vertexInputContainer", "PrimaryVertices", "input vertex container key"}; - SG::ReadHandleKey<xAOD::TrackParticleContainer> m_trackPartInputContainer{this,"Key_trackPartInputContainer", "InDetTrackParticles", "input track particle container key"}; + SG::ReadCondHandleKey<InDet::BeamSpotData> m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }; }; #endif /* TAUREC_TAUVERTEXVARIABLES_H */ diff --git a/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h b/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h index e1c4484ac9299c913717c800c889416629ae786d..13bb9e2d9a3147a4f8ff8d7ecc46abba29f7dd41 100644 --- a/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h +++ b/Reconstruction/tauRecTools/tauRecTools/CombinedP4FromRecoTaus.h @@ -5,10 +5,6 @@ #ifndef TAURECTOOLS_COMBINEDP4FROMRECOTAUS_H #define TAURECTOOLS_COMBINEDP4FROMRECOTAUS_H -//STL include(s) -//#include <memory> -//#include <map> - //Root include(s) #include "TH1F.h" #include "TFile.h" @@ -74,10 +70,6 @@ class CombinedP4FromRecoTaus StatusCode execute(xAOD::TauJet& xTau) override; private: - /*std::vector< std::vector<TH1F*> > m_resHists_tauRec; - std::vector< std::vector<TH1F*> > m_resHists_CellBased2PanTau; - std::vector< std::vector<TH1F*> > m_meanHists_CellBased2PanTau; - std::vector< std::vector<TH1F*> > m_meanHists_tauRec;*/ std::vector< std::vector<TGraph*> > m_resTGraph_tauRec; std::vector< std::vector<TGraph*> > m_resTGraph_CellBased2PanTau; std::vector< std::vector<TGraph*> > m_meanTGraph_CellBased2PanTau; diff --git a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h index 3d1d5eefa659e3c5a531f4e58d9f321f2b4d15d5..c65ce68b1a4b63e3a4fbdcd0ce88c9a14018ea52 100644 --- a/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h +++ b/Reconstruction/tauRecTools/tauRecTools/MvaTESVariableDecorator.h @@ -26,9 +26,6 @@ class MvaTESVariableDecorator StatusCode finalize() override; private: - int m_mu; //! - int m_nVtxPU; //! - bool m_emitVertexWarning=true; //! SG::ReadHandleKey<xAOD::EventInfo> m_eventInfo{this,"Key_eventInfo", "EventInfo", "EventInfo key"}; SG::ReadHandleKey<xAOD::VertexContainer> m_vertexInputContainer{this,"Key_vertexInputContainer", "PrimaryVertices", "input vertex container key"}; diff --git a/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h b/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h index 37f824c2ed2c5ad6d7432b09239a84df6c57c519..7aa0d9105ef5c5eb88ab2693feb1d689eefe7454 100644 --- a/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h +++ b/Reconstruction/tauRecTools/tauRecTools/TauCalibrateLC.h @@ -6,9 +6,11 @@ #define TAUREC_TAUCALIBRATELC_H #include "tauRecTools/TauRecToolBase.h" +#include "GaudiKernel/ToolHandle.h" class TH1; class TF1; +class ILumiBlockMuTool; /** * @brief Implementation of tau energy scale (TES) with eta and pile-up correction. @@ -43,6 +45,8 @@ private: const TH1 * m_etaBinHist=0; const TH1 * m_etaCorrectionHist=0; + ToolHandle<ILumiBlockMuTool> m_lumiBlockMuTool; + unsigned int m_minNTrackAtVertex=0; int m_nEtaBins=0; double m_averageNPV=0; @@ -55,7 +59,6 @@ private: bool m_isCaloOnly; //!< switch for CaloOnly corrections SG::ReadHandleKey<xAOD::VertexContainer> m_vertexInputContainer{this,"Key_vertexInputContainer", "PrimaryVertices", "input vertex container key"}; - }; #endif diff --git a/Reconstruction/tauRecTools/tauRecTools/lwtnn/NNLayerConfig.h b/Reconstruction/tauRecTools/tauRecTools/lwtnn/NNLayerConfig.h index 9b10d4838eb3612990ff6ff07e09a352ce56dba8..433603c63a93171807c21a9564e94b38bfba8ca6 100644 --- a/Reconstruction/tauRecTools/tauRecTools/lwtnn/NNLayerConfig.h +++ b/Reconstruction/tauRecTools/tauRecTools/lwtnn/NNLayerConfig.h @@ -14,6 +14,7 @@ #include <vector> #include <map> +#include <string> namespace lwtDev { enum class Activation {NONE, LINEAR, SIGMOID, RECTIFIED, SOFTMAX, TANH, diff --git a/Simulation/Digitization/CMakeLists.txt b/Simulation/Digitization/CMakeLists.txt index c4e77419dea6944e043932fd8b6366bc73f10f4d..1560964c26999b2a3b1bad8299d3c06f36fa0e6d 100644 --- a/Simulation/Digitization/CMakeLists.txt +++ b/Simulation/Digitization/CMakeLists.txt @@ -10,7 +10,7 @@ atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} ) atlas_install_joboptions( share/*.py share/jobOpts/*.py ) atlas_install_scripts( test/*.py ) -atlas_install_runtime( data/*.ascii test/Digitization_TestConfiguration.xml ) +atlas_install_runtime( data/*.ascii ) atlas_add_test(test_MC16a_Digi_tf_configuration SCRIPT test/test_MC16a_Digi_tf_configuration.py diff --git a/Simulation/Digitization/test/DigitizationComparisonNew_test.py b/Simulation/Digitization/test/DigitizationComparisonNew_test.py index 036ad30443b0d4ea9debcfad5bcc74b871042a57..9c912b891556452b78c82adbc944c2649cc05997 100755 --- a/Simulation/Digitization/test/DigitizationComparisonNew_test.py +++ b/Simulation/Digitization/test/DigitizationComparisonNew_test.py @@ -43,7 +43,8 @@ ConfigFlags.LAr.ROD.DoOFCPileupOptimization = True ConfigFlags.LAr.ROD.FirstSample = 0 ConfigFlags.LAr.ROD.UseHighestGainAutoCorr = True ConfigFlags.Digitization.Pileup = False -ConfigFlags.Digitization.DoDigiTruth = False +ConfigFlags.Digitization.DoDigiTruth = True +ConfigFlags.Digitization.TruthOutput = True ConfigFlags.GeoModel.Align.Dynamic = False ConfigFlags.Concurrency.NumThreads = 1 ConfigFlags.lock() @@ -57,7 +58,7 @@ acc.merge(writeDigitizationMetadata(ConfigFlags)) # TODO include other modules --- to be uncommented once they are made to agree # Inner Detector # acc.merge(BCM_DigitizationCfg(ConfigFlags)) -# acc.merge(PixelDigitizationCfg(ConfigFlags)) +acc.merge(PixelDigitizationCfg(ConfigFlags)) # acc.merge(SCT_DigitizationCfg(ConfigFlags)) # acc.merge(TRT_DigitizationCfg(ConfigFlags)) @@ -76,7 +77,12 @@ acc.merge(LArTriggerDigitizationCfg(ConfigFlags)) acc.merge(MergeRecoTimingObjCfg(ConfigFlags)) # FIXME hack to match to buggy behaviour in old style configuration -acc.getSequence("AthOutSeq").OutputStreamRDO.ItemList += ['EventInfo#*'] +acc.getSequence("AthOutSeq").OutputStreamRDO.ItemList += ["EventInfo#*"] +acc.getSequence("AthOutSeq").OutputStreamRDO.ItemList.remove("xAOD::EventInfo#EventInfo") +acc.getSequence("AthOutSeq").OutputStreamRDO.ItemList.remove("xAOD::EventAuxInfo#EventInfoAux.") +# Calorimeter truth output from DigiOutput.py#0082 +acc.getSequence("AthOutSeq").OutputStreamRDO.ItemList += ["CaloCalibrationHitContainer#*"] +acc.getSequence("AthOutSeq").OutputStreamRDO.ItemList += ["TileHitVector#MBTSHits"] # Dump config acc.getService("StoreGateSvc").Dump = True diff --git a/Simulation/Tests/DigitizationTests/test/DigitizationComparison_test.sh b/Simulation/Tests/DigitizationTests/test/DigitizationComparison_test.sh index 0debfcb484574db3bfbe294f2c97e4d75fa17217..8ecd8e361a2717a1a63c655dfa530176187aefbd 100755 --- a/Simulation/Tests/DigitizationTests/test/DigitizationComparison_test.sh +++ b/Simulation/Tests/DigitizationTests/test/DigitizationComparison_test.sh @@ -34,7 +34,9 @@ print(AthSequencer('AthCondSeq'))\ _preInclude="\ HITtoRDO:Digitization/ForceUseOfAlgorithms.py,\ -SimulationJobOptions/preInclude.LArOnlyConfig.py\ +SimulationJobOptions/preInclude.LArOnlyConfig.py,\ +SimulationJobOptions/preInclude.PixelOnlyConfig.py,\ +SimulationJobOptions/preInclude.TruthOnlyConfig.py\ " rc2=-9999 diff --git a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT.sh b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT.sh index df86156875e43eaf7f330a0d354dedc53e5092b6..2812594f46e329481ca0880b72ba603733a14b2c 100755 --- a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT.sh +++ b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT.sh @@ -54,7 +54,7 @@ echo "art-result: $rc2 STdigi" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_1thread.sh b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_1thread.sh index 7d78e9733b180b0b8ec3f3fb2d635db318da1146..1b3ef806ddcd0f91ddb6f677ed6548d6bf57e9d2 100755 --- a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_1thread.sh +++ b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_1thread.sh @@ -54,7 +54,7 @@ echo "art-result: $rc2 STdigi" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_LAr.sh b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_LAr.sh index 544af162d78507cdf3bb5defea2b516d83e37084..f7ab36480ff201b47c8905dafd3715e09b8d8534 100755 --- a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_LAr.sh +++ b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_LAr.sh @@ -54,7 +54,7 @@ echo "art-result: $rc2 STdigi" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_Muon.sh b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_Muon.sh index 88a59de2fad79ba5f7e5bc8eb8c41f70bb5eec66..82d903572adb622e08c014735a2f37066c23d010 100755 --- a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_Muon.sh +++ b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_Muon.sh @@ -52,7 +52,7 @@ echo "art-result: $rc2 STdigi" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_SCT.sh b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_SCT.sh index 7f6f25ea24cd80120449a3512ccc83e513b5d136..44369eb5d06308b01b4b43958f42e45a01c60a9c 100755 --- a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_SCT.sh +++ b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_SCT.sh @@ -52,7 +52,7 @@ echo "art-result: $rc2 STdigi" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_TRT.sh b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_TRT.sh index bc1865fd63993c29577d3013d62dafb98e97988f..b75e6e55e10b00ad70d7fa748a65fe5dac058c28 100755 --- a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_TRT.sh +++ b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_TRT.sh @@ -52,7 +52,7 @@ echo "art-result: $rc2 STdigi" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_Tile.sh b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_Tile.sh index 0e99397bf3cf0fc611c3a78cc3517f05f50df7e2..c8d373d83877319ff1d5f1b8e04207f13306ef20 100755 --- a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_Tile.sh +++ b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_Tile.sh @@ -52,7 +52,7 @@ echo "art-result: $rc2 STdigi" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_pixel.sh b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_pixel.sh index 75896587c8c6e523b504c99c2b35bdeb3021c823..483aa9f315b7351def202813ffe0bab00f64570d 100755 --- a/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_pixel.sh +++ b/Simulation/Tests/DigitizationTestsMT/test/test_Digi_tf_mc16a_ttbar_no_pileup_ST_vs_MT_pixel.sh @@ -52,7 +52,7 @@ echo "art-result: $rc2 STdigi" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root mc16a_ttbar.ST.RDO.pool.root mc16a_ttbar.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/ISF_ValidationMT/test/test_MC16_FullG4_ttbar_MTvsST.sh b/Simulation/Tests/ISF_ValidationMT/test/test_MC16_FullG4_ttbar_MTvsST.sh index 8062064a20c78e7fa49c11c236341a079beddb2c..365cef8c0929e73ece69cb194f77d0d0be1eb5c3 100755 --- a/Simulation/Tests/ISF_ValidationMT/test/test_MC16_FullG4_ttbar_MTvsST.sh +++ b/Simulation/Tests/ISF_ValidationMT/test/test_MC16_FullG4_ttbar_MTvsST.sh @@ -78,14 +78,14 @@ echo "art-result: $rc3 FullG4Athena" rc4=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref + acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc4=$? fi echo "art-result: $rc4 FullG4MT_STvsMT" rc5=-9999 if [ $rc3 -eq 0 ] then - acmd.py diff-root test.MT.HITS.pool.root test.ST.old.HITS.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref + acmd.py diff-root test.MT.HITS.pool.root test.ST.old.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc5=$? fi echo "art-result: $rc5 FullG4MTvsFullG4" diff --git a/Simulation/Tests/ISF_ValidationMT/test/test_MC16_PassbackG4_ttbar_MTvsST.sh b/Simulation/Tests/ISF_ValidationMT/test/test_MC16_PassbackG4_ttbar_MTvsST.sh index d9328b2e6a5ec5009cdb4015cd58ff55b43e00bb..c760fb22fecee4d4982735ebaf6e9fb951af4bff 100755 --- a/Simulation/Tests/ISF_ValidationMT/test/test_MC16_PassbackG4_ttbar_MTvsST.sh +++ b/Simulation/Tests/ISF_ValidationMT/test/test_MC16_PassbackG4_ttbar_MTvsST.sh @@ -79,14 +79,14 @@ echo "art-result: $rc3 PassbackG4Athena" rc4=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref + acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc4=$? fi echo "art-result: $rc4 PassbackG4MT_STvsMT" rc5=-9999 if [ $rc3 -eq 0 ] then - acmd.py diff-root test.MT.HITS.pool.root test.ST.old.HITS.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref + acmd.py diff-root test.MT.HITS.pool.root test.ST.old.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc5=$? fi echo "art-result: $rc5 PassbackG4MTvsPassbackG4" diff --git a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT.sh b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT.sh index 4e3d586542c00ab62dee63f9f48d653f853aa2f6..c565afc3cb82a0cac3cd2d5c47ce378608a9d4d3 100755 --- a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT.sh +++ b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT.sh @@ -48,7 +48,7 @@ echo "art-result: $rc2 overlayST" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_1thread.sh b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_1thread.sh index df3db744255dd5d60d436ec74768e171c03e417d..3e5a6ee3a3d6fbcc7d2e51ad7140cb7472668d1f 100755 --- a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_1thread.sh +++ b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_1thread.sh @@ -48,7 +48,7 @@ echo "art-result: $rc2 overlayST" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_LAr.sh b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_LAr.sh index 13be9ee5aee873718e8625c9e85f888154ba8755..7e94c72864b7da81d4a01ffc3bd5e65c17815b0f 100755 --- a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_LAr.sh +++ b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_LAr.sh @@ -50,7 +50,7 @@ echo "art-result: $rc2 overlayST" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn + acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_Muon.sh b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_Muon.sh index 0449d16e15a4b3c2035680594001ce1a76e76936..4362b8276bb411a405ced43dae02b59a9b1662d5 100755 --- a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_Muon.sh +++ b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_Muon.sh @@ -50,7 +50,7 @@ echo "art-result: $rc2 overlayST" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn + acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_SCT.sh b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_SCT.sh index 7a3e36f6d5898685cf036e93f3ed09edf4e9d06b..2c9989719dbdce31284cbd0a09da0c9b2923c9a0 100755 --- a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_SCT.sh +++ b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_SCT.sh @@ -50,7 +50,7 @@ echo "art-result: $rc2 overlayST" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn + acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_TRT.sh b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_TRT.sh index fb9da29f825ba667a7ea3374dfd582ad64355bb1..c58d39ba945b5e66d9e3b8fcbdb11009057abb2a 100755 --- a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_TRT.sh +++ b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_TRT.sh @@ -50,7 +50,7 @@ echo "art-result: $rc2 overlayST" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn + acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_Tile.sh b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_Tile.sh index eb520b21b01d050464f031878431a96b7870fe3d..31677bc759f8b37a44900890bf50b1addb366eba 100755 --- a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_Tile.sh +++ b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_Tile.sh @@ -50,7 +50,7 @@ echo "art-result: $rc2 overlayST" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn + acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_pixel.sh b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_pixel.sh index dbc0725d433354063834d75ed2a744a68613cf03..147e92461bb2f57c6f311764f571e509806448da 100755 --- a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_pixel.sh +++ b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_pixel.sh @@ -50,7 +50,7 @@ echo "art-result: $rc2 overlayST" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn + acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_InTimeAntiKt4TruthJetsAuxDyn xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAux xAOD::JetAuxContainer_v1_OutOfTimeAntiKt4TruthJetsAuxDyn rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_truth.sh b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_truth.sh index e6fcbf8e5c70e99e9b4d6f6dcc42d3a919407e11..ed4334eefd9945bd9ceffcfe4c1a1376aab926af 100755 --- a/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_truth.sh +++ b/Simulation/Tests/OverlayTestsMT/test/test_MCOverlay_ttbar_ST_vs_MT_truth.sh @@ -50,7 +50,7 @@ echo "art-result: $rc2 overlayST" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref + acmd.py diff-root MC_plus_MC.ST.RDO.pool.root MC_plus_MC.MT.RDO.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings RecoTimingObj_p1_HITStoRDO_timings index_ref rc3=$? fi echo "art-result: $rc3 comparison" diff --git a/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_AFPSimTest_MTvsST.sh b/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_AFPSimTest_MTvsST.sh index 9209aebed8d348552bfe03d428033f488e729255..ee3421683cd989b57916bbc7b3afb61ea3cddb72 100755 --- a/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_AFPSimTest_MTvsST.sh +++ b/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_AFPSimTest_MTvsST.sh @@ -56,7 +56,7 @@ echo "art-result: $rc2 STsim" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref + acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 comparision" diff --git a/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_ALFASimTest_MTvsST.sh b/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_ALFASimTest_MTvsST.sh index 79fdf9f453bde5a280caac578d5466902ffd5eb1..cd0ef04315a33c5c736e4120c7f78986f19bf234 100755 --- a/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_ALFASimTest_MTvsST.sh +++ b/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_ALFASimTest_MTvsST.sh @@ -56,7 +56,7 @@ echo "art-result: $rc2 STsim" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref + acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 comparision" diff --git a/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_TTbarSim_MTvsST.sh b/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_TTbarSim_MTvsST.sh index 4e3b6905112216363524ad7599a0e3e7fe2e4358..68f7226aa53b80fb75b829aeb588203b710e7b3e 100755 --- a/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_TTbarSim_MTvsST.sh +++ b/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_TTbarSim_MTvsST.sh @@ -53,7 +53,7 @@ echo "art-result: $rc2 STsim" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref + acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 comparision" diff --git a/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_ZDCSimTest_MTvsST.sh b/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_ZDCSimTest_MTvsST.sh index 7d4f0b4cda661c1349940f46497b209d0bea50f8..66b31d9868b5eb3cf8bd5a4eb3f8aed47897ce63 100755 --- a/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_ZDCSimTest_MTvsST.sh +++ b/Simulation/Tests/SimCoreTestsMT/test/test_AtlasG4_ZDCSimTest_MTvsST.sh @@ -56,7 +56,7 @@ echo "art-result: $rc2 STsim" rc3=-9999 if [ $rc2 -eq 0 ] then - acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref + acmd.py diff-root test.MT.HITS.pool.root test.ST.HITS.pool.root --error-mode resilient --mode=semi-detailed --order-trees --ignore-leaves RecoTimingObj_p1_EVNTtoHITS_timings index_ref rc3=$? fi echo "art-result: $rc3 comparision" diff --git a/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py b/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py index 96d6607a99febaf1df264f76108373a71db508b0..eb01ad1c38c5f76756e3c50e869c7833ae17c07e 100644 --- a/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py +++ b/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileCalibRec.py @@ -7,6 +7,7 @@ from os import system from subprocess import check_output from subprocess import CalledProcessError +import six from AthenaCommon.AppMgr import theApp svcMgr = theApp.serviceMgr() @@ -272,6 +273,7 @@ def FindFile(path, runinput, filter): files = [] log.warn('Seems there are no such directory: ' + path) + files = [six.ensure_str(f) for f in files] for file_name in (files): try: good=(not file_name in open('/afs/cern.ch/user/t/tilebeam/ARR/bad_data_files').read()) @@ -288,7 +290,7 @@ def FindFile(path, runinput, filter): else: fullname.append(path + '/' + file_name) else: - print "Excluding known bad data file",file_name + printfunc ("Excluding known bad data file",file_name) return [fullname, run] @@ -790,7 +792,7 @@ jobproperties.print_JobProperties('tree&value') include( "TileConditions/TileConditions_jobOptions.py" ) tileInfoConfigurator.OutputLevel = OutputLevel # use correct timing constants for different run types -print tileInfoConfigurator +printfunc (tileInfoConfigurator) #============================================================ #=== configure TileCondToolOfcCool @@ -811,7 +813,7 @@ if not OfcFromCOOL and (doTileOpt2 or doTileOptATLAS or doTileOF1): # 'LAS' or "CIS" or 'PHY' pulse shape - print tileCondToolOfc + printfunc (tileCondToolOfc) #============================================================ #=== adding Event Info @@ -885,13 +887,13 @@ if doTileFit and tileRawChannelBuilderFitFilter: tileRawChannelBuilderFitFilter.RMSChannelNoise = 3; tileRawChannelBuilderFitFilter.UseDSPCorrection = not TileBiGainRun - print tileRawChannelBuilderFitFilter + printfunc (tileRawChannelBuilderFitFilter) if doTileFitCool: ToolSvc.TileRawChannelBuilderFitFilterCool.MaxTimeFromPeak = 250.0; # recover behaviour of rel 13.0.30 ToolSvc.TileRawChannelBuilderFitFilterCool.UseDSPCorrection = not TileBiGainRun - print ToolSvc.TileRawChannelBuilderFitFilterCool + printfunc (ToolSvc.TileRawChannelBuilderFitFilterCool) if doTileOpt2: @@ -902,7 +904,7 @@ if doTileOpt2: tileRawChannelBuilderOpt2Filter.EmulateDSP = True # use dsp emulation tileRawChannelBuilderOpt2Filter.UseDSPCorrection = not TileBiGainRun - print tileRawChannelBuilderOpt2Filter + printfunc (tileRawChannelBuilderOpt2Filter) if doTileOptATLAS and tileRawChannelBuilderOptATLAS: if ReadPool: @@ -916,7 +918,7 @@ if doTileOptATLAS and tileRawChannelBuilderOptATLAS: tileRawChannelBuilderOptATLAS.EmulateDSP = True # use dsp emulation tileRawChannelBuilderOptATLAS.UseDSPCorrection = not TileBiGainRun - print tileRawChannelBuilderOptATLAS + printfunc (tileRawChannelBuilderOptATLAS) if doTileMF: @@ -933,7 +935,7 @@ if doTileMF: tileInfoConfigurator.setupCOOLPULSE(type = TilePulse) tileInfoConfigurator.setupCOOLAutoCr() - print ToolSvc.TileRawChannelBuilderMF + printfunc (ToolSvc.TileRawChannelBuilderMF ) if doTileOF1: ToolSvc.TileRawChannelBuilderOF1.PedestalMode = TileOF1Ped @@ -946,7 +948,7 @@ if doTileOF1: ToolSvc.TileRawChannelBuilderOF1.EmulateDSP = True # use dsp emulation ToolSvc.TileRawChannelBuilderOF1.UseDSPCorrection = not TileBiGainRun - print ToolSvc.TileRawChannelBuilderOF1 + printfunc (ToolSvc.TileRawChannelBuilderOF1 ) if doTileWiener and tileRawChannelBuilderWienerFilter: if PhaseFromCOOL: @@ -959,7 +961,7 @@ if doTileWiener and tileRawChannelBuilderWienerFilter: tileRawChannelBuilderWienerFilter.EmulateDSP = True # use dsp emulation tileRawChannelBuilderWienerFilter.UseDSPCorrection = not TileBiGainRun - print tileRawChannelBuilderWienerFilter + printfunc (tileRawChannelBuilderWienerFilter) if (doEventDisplay or doCreatePool): # create TileHit from TileRawChannel and store it in TileHitVec @@ -968,7 +970,7 @@ if (doEventDisplay or doCreatePool): theTileHitFromRawChGetter.TileRawChannelToHit().TileRawChannelContainer = "TileRawChannelOpt2" theTileHitFromRawChGetter.TileRawChannelToHit().UseSamplFract = False - print theTileHitFromRawChGetter.TileRawChannelToHit() + printfunc (theTileHitFromRawChGetter.TileRawChannelToHit()) if doCaloCell: # create TileCell from TileRawChannel and store it in CaloCellContainer @@ -1052,14 +1054,16 @@ if (doTileNtuple or doD3PD): if not hasattr(svcMgr,"THistSvc"): from GaudiSvc.GaudiSvcConf import THistSvc svcMgr+=THistSvc() - exec 'svcMgr.THistSvc.Output += [ "AANT DATAFILE=\'%(dir)s/tile_%(RunNum).f_%(Version)s.aan.root\' OPT=\'RECREATE\' " ] ' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } + datafile = '%(dir)s/tile_%(RunNum).f_%(Version)s.aan.root' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } + svcMgr.THistSvc.Output += [ "AANT DATAFILE='" + datafile + "' OPT='RECREATE' " ] svcMgr.THistSvc.MaxFileSize = 32768 from AnalysisTools.AthAnalysisToolsConf import AANTupleStream topSequence += AANTupleStream( "AANTupleStream1" ) AANTupleStream1 = topSequence.AANTupleStream1 AANTupleStream1.ExtraRefNames = [ "StreamESD","StreamRDO" ] - exec 'AANTupleStream1.OutputName = \'%(dir)s/tile_%(RunNum).f_%(Version)s.aan.root\' ' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } + datafile = '%(dir)s/tile_%(RunNum).f_%(Version)s.aan.root' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } + AANTupleStream1.OutputName = datafile AANTupleStream1.ExistDataHeader = False @@ -1237,7 +1241,8 @@ if doTileMon: if not hasattr(svcMgr,"THistSvc"): from GaudiSvc.GaudiSvcConf import THistSvc svcMgr+=THistSvc() - exec 'svcMgr.THistSvc.Output += [ "Tile DATAFILE=\'%(dir)s/tilemon_%(RunNum).f_%(Version)s.root\' OPT=\'RECREATE\' " ] ' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } + datafile = '%(dir)s/tilemon_%(RunNum).f_%(Version)s.root' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } + svcMgr.THistSvc.Output += [ "Tile DATAFILE='" + datafile + "' OPT=\'RECREATE\' " ] if (TileMonoRun): runType = 9 @@ -1280,7 +1285,7 @@ if doTileMon: FillPedestalDifference = True) #ToolSvc += theTileDigitsMon TileMon.AthenaMonTools += [ theTileDigitsMon ] - print theTileDigitsMon + printfunc (theTileDigitsMon) if doTileMonRch: b2d = TileCisRun or TileRampRun @@ -1320,7 +1325,7 @@ if doTileMon: #theTileRawChannelMon.MinAmpForCorrectedTime = 0.1 - print theTileRawChannelMon + printfunc (theTileRawChannelMon) if doTileMonDQ: theTileDQFragMon = TileDQFragMonTool(name = 'TileDQFragMon', @@ -1356,7 +1361,7 @@ if doTileMon: #ToolSvc += theTileDQFragMon; TileMon.AthenaMonTools += [ theTileDQFragMon ]; - print theTileDQFragMon + printfunc (theTileDQFragMon) if doTileMonCell: if TileBiGainRun: @@ -1369,7 +1374,7 @@ if doTileMon: histoPathBase = "/Tile/Cell"); #ToolSvc += theTileCellMonHG; TileMon.AthenaMonTools += [ theTileCellMonHG ]; - print theTileCellMonHG; + printfunc (theTileCellMonHG) else: theTileCellMon = TileCellMonTool(name = 'TileCellMon', @@ -1385,7 +1390,7 @@ if doTileMon: #theTileCellMon.FillTimeHistograms = True #ToolSvc += theTileCellMon; TileMon.AthenaMonTools += [ theTileCellMon ]; - print theTileCellMon; + printfunc (theTileCellMon) if doTileDigiNoiseMon: TileDigiNoiseMon = TileDigiNoiseMonTool(name = 'TileDigiNoiseMon', @@ -1397,7 +1402,7 @@ if doTileMon: if not TileBiGainRun: TileDigiNoiseMon.TriggerTypes = [ 0x82 ] #ToolSvc += TileDigiNoiseMon; TileMon.AthenaMonTools += [ TileDigiNoiseMon ]; - print TileDigiNoiseMon; + printfunc (TileDigiNoiseMon) if TileBiGainRun and doTileCellNoiseMon: TileCellNoiseMonLG = TileCellNoiseMonTool(name = 'TileCellNoiseMonLG', @@ -1409,7 +1414,7 @@ if doTileMon: TileCellNoiseMonLG.Xmax = 2000.; #ToolSvc += TileCellNoiseMonLG; TileMon.AthenaMonTools += [ TileCellNoiseMonLG ]; - print TileCellNoiseMonLG; + printfunc (TileCellNoiseMonLG) TileCellNoiseMonHG = TileCellNoiseMonTool(name = 'TileCellNoiseMonHG', @@ -1421,7 +1426,7 @@ if doTileMon: TileCellNoiseMonHG.Xmax = 300.; #ToolSvc += TileCellNoiseMonHG; TileMon.AthenaMonTools += [ TileCellNoiseMonHG ]; - print TileCellNoiseMonHG; + printfunc (TileCellNoiseMonHG) if (not TileBiGainRun) and doTileCellNoiseMon: TileCellNoiseMon = TileCellNoiseMonTool(name = 'TileCellNoiseMon', @@ -1433,7 +1438,7 @@ if doTileMon: TileCellNoiseMon.Xmax = 2000.; #ToolSvc += TileCellNoiseMon; TileMon.AthenaMonTools += [ TileCellNoiseMon ]; - print TileCellNoiseMon; + printfunc (TileCellNoiseMon) if doTileRawChannelTimeMonTool: @@ -1448,7 +1453,7 @@ if doTileMon: #ToolSvc += TileRawChannelTimeMon TileMon.AthenaMonTools += [ TileRawChannelTimeMon ]; - print TileRawChannelTimeMon + printfunc (TileRawChannelTimeMon) @@ -1469,7 +1474,7 @@ if doTileMon: #ToolSvc += TileRawChannelNoiseMonLG; TileMon.AthenaMonTools += [ TileRawChannelNoiseMonLG ]; - print TileRawChannelNoiseMonLG; + printfunc (TileRawChannelNoiseMonLG) TileRawChannelNoiseMonHG = TileRawChannelNoiseMonTool(name = 'TileRawChannelNoiseMonHG', @@ -1486,7 +1491,7 @@ if doTileMon: #ToolSvc += TileRawChannelNoiseMonHG; TileMon.AthenaMonTools += [ TileRawChannelNoiseMonHG ]; - print TileRawChannelNoiseMonHG; + printfunc (TileRawChannelNoiseMonHG) if (not TileBiGainRun) and doTileRawChannelNoiseMon: TileRawChannelNoiseMon = TileRawChannelNoiseMonTool(name = 'TileRawChannelNoiseMon', @@ -1506,7 +1511,7 @@ if doTileMon: #ToolSvc += TileRawChannelNoiseMon; TileMon.AthenaMonTools += [ TileRawChannelNoiseMon ]; - print TileRawChannelNoiseMon; + printfunc (TileRawChannelNoiseMon) ########### end doTileCellNoiseMon ########## @@ -1518,7 +1523,7 @@ if doTileMon: , histoPathBase = "/Tile/TMDBDigits") TileMon.AthenaMonTools += [ TileTMDBDigitsMon ] - print TileTMDBDigitsMon + printfunc (TileTMDBDigitsMon) if doTileTMDBRawChannelMon: @@ -1530,7 +1535,7 @@ if doTileMon: TileMon.AthenaMonTools += [TileTMDBRawChannelDspMon ] - print TileTMDBRawChannelDspMon + printfunc (TileTMDBRawChannelDspMon) TileTMDBRawChannelMon = CfgMgr.TileTMDBRawChannelMonTool(name = 'TileTMDBRawChannelMon' , OutputLevel = INFO @@ -1541,7 +1546,7 @@ if doTileMon: TileMon.AthenaMonTools += [TileTMDBRawChannelMon ] - print TileTMDBRawChannelMon + printfunc (TileTMDBRawChannelMon) if doTileMonDigi or doTileMonRch or doTileMonCell or doTileMonDQ \ @@ -1562,18 +1567,18 @@ if doTileCalib: theTileDigiNoiseCalibAlg = TileDigiNoiseCalibAlg( "theTileDigiNoiseCalibAlg" ) theTileDigiNoiseCalibAlg.DoAvgCorr = False # False=> Full AutoCorr matrix calculation if TileNoiseFilter > 0: - exec 'theTileDigiNoiseCalibAlg.FileNamePrefix = \'Digi_NoiseCalib_%(Version)s\' ' % {'Version': TileNoiseFilter } + theTileDigiNoiseCalibAlg.FileNamePrefix = 'Digi_NoiseCalib_%(Version)s' % {'Version': TileNoiseFilter } if Version != "0" and Version != "Ped.0" and Version != "Ped" : VF = Version+"_tnf"+str(TileNoiseFilter) - exec 'theTileDigiNoiseCalibAlg.FileNamePrefix = \'Digi_NoiseCalib_%(Version)s\' ' % {'Version': VF } + theTileDigiNoiseCalibAlg.FileNamePrefix = 'Digi_NoiseCalib_%(Version)s' % {'Version': VF } topSequence += theTileDigiNoiseCalibAlg theTileRawChNoiseCalibAlg = TileRawChNoiseCalibAlg("theTileRawChNoiseCalibAlg") theTileRawChNoiseCalibAlg.UseforCells = 1 # 1= Fixed , 2= Opt2 if TileNoiseFilter > 0: - exec 'theTileRawChNoiseCalibAlg.FileNamePrefix = \'RawCh_NoiseCalib_%(Version)s\' ' % {'Version': TileNoiseFilter } + theTileRawChNoiseCalibAlg.FileNamePrefix = 'RawCh_NoiseCalib_%(Version)s' % {'Version': TileNoiseFilter } if Version != "0" and Version != "Ped.0" and Version != "Ped" : VF = Version + "_tnf" + str(TileNoiseFilter) - exec 'theTileRawChNoiseCalibAlg.FileNamePrefix = \'RawCh_NoiseCalib_%(Version)s\' ' % {'Version': VF } + theTileRawChNoiseCalibAlg.FileNamePrefix = 'RawCh_NoiseCalib_%(Version)s' % {'Version': VF } topSequence += theTileRawChNoiseCalibAlg if TileEmulateDSP: @@ -1594,7 +1599,7 @@ if doTileCalib: TileCalibAlg = TileTopCalibAlg() TileCalibAlg.RunNumber = RunNumber TileCalibAlg.RunType = 8 - exec 'TileCalibAlg.FileName = \'%(dir)s/tileCalibCIS_%(RunNum).f_%(Version)s.root\' ' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } + TileCalibAlg.FileName = '%(dir)s/tileCalibCIS_%(RunNum).f_%(Version)s.root' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } # declare CIS tool(s) and set jobOptions if necessary TileCisTool = TileCisDefaultCalibTool() @@ -1619,7 +1624,7 @@ if doTileCalib: TileCalibAlg = TileTopCalibAlg() TileCalibAlg.RunNumber = RunNumber TileCalibAlg.RunType = 8 - exec 'TileCalibAlg.FileName = \'%(dir)s/tileCalibL1Calo_%(RunNum).f_%(Version)s.root\' ' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } + TileCalibAlg.FileName = '%(dir)s/tileCalibL1Calo_%(RunNum).f_%(Version)s.root' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } # declare Trigger tool(s) and set jobOptions if necessary TileTriggerTool = TileTriggerDefaultCalibTool() @@ -1635,7 +1640,7 @@ if doTileCalib: from TileCalibAlgs.TileCalibAlgsConf import TileLaserDefaultCalibTool TileCalibAlg = TileLaserCalibAlg() - exec 'TileCalibAlg.FileName = \'%(dir)s/tileCalibLAS_%(RunNum).f_%(Version)s.root\' ' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } + TileCalibAlg.FileName = '%(dir)s/tileCalibLAS_%(RunNum).f_%(Version)s.root' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } # declare LASER tool(s) and set jobOptions if necessary TileLaserTool = TileLaserDefaultCalibTool() @@ -1661,7 +1666,7 @@ if doCreatePool: # Pool Output include( "AthenaPoolCnvSvc/WriteAthenaPool_jobOptions.py" ) from AthenaPoolCnvSvc.WriteAthenaPool import AthenaPoolOutputStream - exec 'FileName = \'%(dir)s/tile_%(RunNum).f_%(Version)s.pool.root\' ' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } + FileName = '%(dir)s/tile_%(RunNum).f_%(Version)s.pool.root' % {'dir': OutputDirectory, 'RunNum': RunNumber, 'Version': Version } Stream1 = AthenaPoolOutputStream( "Stream1", FileName ) # list of output objects @@ -1731,7 +1736,7 @@ if doAtlantis: ToolSvc += thexAODCaloClusterRetriever theEventData2XML.DataTypes += ["JiveXML::xAODCaloClusterRetriever/xAODCaloClusterRetriever"] - print theEventData2XML + printfunc (theEventData2XML) #----------------------- # And some final options @@ -1747,7 +1752,7 @@ if not ReadPool: #svcMgr.ByteStreamInputSvc.DumpFlag = True ToolSvc.TileROD_Decoder.VerboseOutput = True -print topSequence +printfunc (topSequence) svcMgr.MessageSvc.OutputLevel = OutputLevel svcMgr.EventSelector.SkipEvents = EvtMin diff --git a/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileTBDump.py b/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileTBDump.py index 4fbada33a369e484b91eacf4b9a79e290a43ba3e..0cf62675c8923cc48b48f6ec9be1012af665202d 100644 --- a/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileTBDump.py +++ b/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileTBDump.py @@ -300,7 +300,7 @@ tileInfoConfigurator.OutputLevel = OutputLevel from AthenaCommon.AppMgr import ToolSvc from TileConditions.TileCondToolConf import * -print tileInfoConfigurator +printfunc (tileInfoConfigurator) #============================================================= #=== ByteStream Input diff --git a/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileTBStat.py b/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileTBStat.py index 741868998ab41fb7e907576ecf2db9d4c073155b..465f6796ff8ba9a85ce865f9672508fd84aa79ad 100644 --- a/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileTBStat.py +++ b/TileCalorimeter/TileExample/TileRecEx/share/jobOptions_TileTBStat.py @@ -188,7 +188,7 @@ def FindFile(path, runinput, filter): else: fullname.append(path + '/' + file_name) else: - print "Excluding known bad data file",file_name + printfunc ("Excluding known bad data file",file_name) return [fullname, run] @@ -303,7 +303,7 @@ tileInfoConfigurator.OutputLevel = OutputLevel from AthenaCommon.AppMgr import ToolSvc from TileConditions.TileCondToolConf import * -print tileInfoConfigurator +printfunc (tileInfoConfigurator) #============================================================= #=== ByteStream Input diff --git a/TileCalorimeter/TileExample/TileSimEx/share/jobOptions.G4Atlas_Tile.py b/TileCalorimeter/TileExample/TileSimEx/share/jobOptions.G4Atlas_Tile.py index 41255243cd3703a87dd1c6f80f5e6951991c4fe1..8214ec8503c79feac21afb0a482ee6b10db0b2dd 100644 --- a/TileCalorimeter/TileExample/TileSimEx/share/jobOptions.G4Atlas_Tile.py +++ b/TileCalorimeter/TileExample/TileSimEx/share/jobOptions.G4Atlas_Tile.py @@ -111,9 +111,9 @@ simFlags.EventFilter.set_On() ## Register callback functions at various init stages #def test_preInit(): -# print "CALLBACK AT PREINIT" +# printfunc ("CALLBACK AT PREINIT") #def test_postInit(): -# print "CALLBACK AT POSTINIT" +# printfunc ("CALLBACK AT POSTINIT") #simFlags.InitFunctions.add_function("preInit", test_preInit) #simFlags.InitFunctions.add_function("postInit", test_postInit) @@ -171,7 +171,7 @@ topSeq += getAlgorithm("BeamEffectsAlg", tryDefaultConfigurable=True) ## Add the G4 sim to the alg sequence after the generator from AthenaCommon.CfgGetter import getAlgorithm topSeq += getAlgorithm("G4AtlasAlg",tryDefaultConfigurable=True) -print topSeq +printfunc (topSeq) ## Set non-standard range cut if 'RangeCut' in dir(): @@ -190,7 +190,7 @@ if 'DoBirk' in dir(): SD.DoBirk = DoBirk if 'TileUshape' in dir(): SD.Ushape=TileUshape -print SD +printfunc (SD) ## VP1 algorithm for visualization if 'VP1' in dir(): diff --git a/TileCalorimeter/TileExample/TileSimEx/share/jobOptions_TileTB_Sim.py b/TileCalorimeter/TileExample/TileSimEx/share/jobOptions_TileTB_Sim.py index 9d22ed1e6e1e98f624f1df283d6b8dd1c04ce5f4..0a1cd87aefb61adb31791d6daa6b4d319df87c63 100755 --- a/TileCalorimeter/TileExample/TileSimEx/share/jobOptions_TileTB_Sim.py +++ b/TileCalorimeter/TileExample/TileSimEx/share/jobOptions_TileTB_Sim.py @@ -197,7 +197,7 @@ try: from AthenaCommon.CfgGetter import getAlgorithm topSeq += getAlgorithm("BeamEffectsAlg") except: - print "can not import BeamEffectsAlg algorithm" + printfunc ("can not import BeamEffectsAlg algorithm") include('G4AtlasApps/Tile2000_2003.flat.configuration.py')#HACK - has to be here for TBDetDescrLoader @@ -237,7 +237,7 @@ if 'DoBirk' in dir(): SD.DoBirk = DoBirk if 'TileUshape' in dir(): SD.Ushape=TileUshape -print SD +printfunc (SD) ## VP1 algorithm for visualization if 'VP1' in dir(): diff --git a/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions.py b/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions.py index 059c6dbcf14371238622247b2841ff2b087ac820..57e8f5b1d10266f818fbb67dd9696c736b090dbf 100755 --- a/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions.py +++ b/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions.py @@ -5,7 +5,7 @@ try: from CaloRec.CaloRecConf import CaloCellMaker except: mlog.error("could not import CaloRec.CaloCellMaker") - print traceback.format_exc() + mlog.error (traceback.format_exc()) theCaloCellMaker=CaloCellMaker() theCaloCellMaker.CaloCellsOutputName = "AllCalo" @@ -62,5 +62,5 @@ from CaloRec.CaloRecConf import CaloCellContainerCheckerTool theCaloCellMaker.CaloCellMakerToolNames += [CaloCellContainerCheckerTool()] -print theCaloCellMaker -print ToolSvc.TileCellBuilder +printfunc (theCaloCellMaker) +printfunc (ToolSvc.TileCellBuilder) diff --git a/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions_doublegain.py b/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions_doublegain.py index 540ce7aecfb3a001c0b4b2f1a2fcb7516289cc91..a945942d2c892f05a56c455f15dc711090806537 100755 --- a/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions_doublegain.py +++ b/TileCalorimeter/TileRec/share/TileCellMaker_jobOptions_doublegain.py @@ -5,7 +5,7 @@ try: from CaloRec.CaloRecConf import CaloCellMaker except: mlog.error("could not import CaloRec.CaloCellMaker") - print traceback.format_exc() + mlog.error (traceback.format_exc()) theCaloCellMakerLG=CaloCellMaker("CaloCellMakerLG") theCaloCellMakerLG.CaloCellsOutputName = "AllCaloLG" @@ -117,10 +117,10 @@ if not hasattr( ToolSvc, "CaloCellContainerCheckerToolHG" ): else: theCaloCellMakerHG.CaloCellMakerToolNames += ["CaloCellContainerCheckerToolHG"] -print theCaloCellMakerLG -print ToolSvc.TileCellBuilderLG +printfunc (theCaloCellMakerLG) +printfunc (ToolSvc.TileCellBuilderLG) -print "####################################################################################" +printfunc ("####################################################################################") -print theCaloCellMakerHG -print ToolSvc.TileCellBuilderHG +printfunc (theCaloCellMakerHG) +printfunc (ToolSvc.TileCellBuilderHG) diff --git a/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx b/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx index 53df2e669c6647187f04af7fed61f75546786b3a..5c95f125bcf17d4cf6e4a3eb614332b18aefa41f 100644 --- a/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx +++ b/TileCalorimeter/TileRecAlgs/src/TileCellVerify.cxx @@ -34,7 +34,7 @@ using namespace std; -class CompCell: public binary_function<const CaloCell*, const CaloCell*, bool> { +class CompCell { public: bool operator()(const CaloCell* p1, const CaloCell* p2) { return p1->energy() < p2->energy(); diff --git a/TileCalorimeter/TileRecUtils/src/TileRawChannelVerify.cxx b/TileCalorimeter/TileRecUtils/src/TileRawChannelVerify.cxx index 8aa4db83b7f719042961a20e70ddb421775bb00f..fb65457bcd6cc2689616a43d6645643869a89ac0 100644 --- a/TileCalorimeter/TileRecUtils/src/TileRawChannelVerify.cxx +++ b/TileCalorimeter/TileRecUtils/src/TileRawChannelVerify.cxx @@ -45,7 +45,7 @@ using namespace std; @brief Small class holding a single method to compare two different TileRawChannel */ -class CompRawChannel: public binary_function<const TileRawChannel*, const TileRawChannel*, bool> { +class CompRawChannel { public: bool operator()(const TileRawChannel* p1, const TileRawChannel* p2) { return p1->amplitude() < p2->amplitude(); diff --git a/Tools/DCubeClient/share/DCubeValid.xml b/Tools/DCubeClient/share/DCubeValid.xml index 2489812256c3be2b0f88c681ab27d3160d9076fc..fd1579e4ab43675b8d39df1769726dac732e3751 100644 --- a/Tools/DCubeClient/share/DCubeValid.xml +++ b/Tools/DCubeClient/share/DCubeValid.xml @@ -97,6 +97,7 @@ <project>AtlasCAFHLT</project> <project>TopPhys</project> <project>AtlasPhysics</project> +<project>AthGeneration</project> <!-- this one matches to ALL --> <project>*</project> diff --git a/Tools/PROCTools/python/diffTAGTree.py b/Tools/PROCTools/python/diffTAGTree.py index e14178462ce24dcfd87f33db3a7a172ec8e6e005..f5ee3943656eb04e1b6f0c42530aa7cf6b5f5919 100755 --- a/Tools/PROCTools/python/diffTAGTree.py +++ b/Tools/PROCTools/python/diffTAGTree.py @@ -17,7 +17,7 @@ def diffTTree(tOld,tNew,details=None): if nOld != nNew: msg="Different number of entries: %i vs %i. Comparing first %i" % \ (nOld,nNew,n) - print msg + print(msg) if details is not None: details.write(msg+"\n") leavesOld=tOld.GetListOfLeaves() @@ -44,7 +44,7 @@ def diffTTree(tOld,tNew,details=None): msg="The following variables exist in only one tree, not compared:\n" for d in diffLeaves: msg+=d+"\n" - print msg + print(msg) if details is not None: details.write(msg) nGood=0 @@ -65,7 +65,7 @@ def diffTTree(tOld,tNew,details=None): msg+= "RunNbr: %i vs %i, EventNbr: %i vs %i" % \ (runOld, runNew, evOld, evNew) msg+="\nStop comparison now." - print msg + print(msg) if details is not None: details.write(msg+"\n") break @@ -104,7 +104,7 @@ def diffTTree(tOld,tNew,details=None): if details is not None: details.write(diffmsg+"\n") else: - print diffmsg + print(diffmsg) if diffSummary.has_key(name): diffSummary[name]+=1 @@ -116,13 +116,13 @@ def diffTTree(tOld,tNew,details=None): nGood+=1 msg="Found %i identical events and %i different events" % (nGood,nBad) - print msg + print(msg) if details is not None: details.write(msg+"\n") - for n,v in diffSummary.iteritems(): + for n,v in diffSummary.items(): msg="\tName: %s: %i Events differ" % (n,v) - print msg + print(msg) if details is not None: details.write(msg+"\n") @@ -131,7 +131,7 @@ def diffTTree(tOld,tNew,details=None): if __name__=='__main__': if len(sys.argv)<3 or len(sys.argv)>4 or sys.argv[1]=="-help": - print "Usage:",sys.argv[0],"File1 File2 <treename>" + print("Usage:",sys.argv[0],"File1 File2 <treename>") sys.exit(-1) fnOld=sys.argv[1] @@ -142,30 +142,30 @@ if __name__=='__main__': treename="POOLCollectionTree" if not os.access(fnOld,os.R_OK): - print "Can't access file",fnOld + print("Can't access file",fnOld) sys.exit(-1) if not os.access(fnNew,os.R_OK): - print "Can't access file",fnNew + print("Can't access file",fnNew) sys.exit(-1) fOld = TFile(fnOld) if fOld is None: - print "Failed to open file",fnOld + print("Failed to open file",fnOld) tOld = fOld.Get(treename) if tOld is None: - print "Tree",treename,"not found in file",fnOld + print("Tree",treename,"not found in file",fnOld) sys.exit(-1) fNew = TFile(fnNew) if fNew is None: - print "Failed to open file",fnNew + print("Failed to open file",fnNew) tNew = fNew.Get(treename) if fNew is None: - print "Tree",treename,"not found in file",fnNew + print("Tree",treename,"not found in file",fnNew) ndiff=diffTTree(tOld,tNew) diff --git a/Tools/PyJobTransformsCore/python/AtlasErrorCodes.py b/Tools/PyJobTransformsCore/python/AtlasErrorCodes.py index 14d34674f47e678af83318ca59ce221cbeb3fd85..18621634a2a2832d81ab5eada5fc6072e95e068a 100755 --- a/Tools/PyJobTransformsCore/python/AtlasErrorCodes.py +++ b/Tools/PyJobTransformsCore/python/AtlasErrorCodes.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @package AtlasErrorCodes # @@ -10,8 +10,8 @@ from __future__ import with_statement, print_function import os,re,sys,traceback -from envutil import find_file_env -from xmlutil import XMLNode +from .envutil import find_file_env +from .xmlutil import XMLNode __all__ = [ 'AtlasErrorCodeException', 'ErrorInfo', 'ErrorCategory' ] diff --git a/Tools/PyJobTransformsCore/python/JobReport.py b/Tools/PyJobTransformsCore/python/JobReport.py index 4daac9709748969914068f368c012239b9d1ee82..f2efa9afdf2839f194b9afce5aa01710f818b0b8 100755 --- a/Tools/PyJobTransformsCore/python/JobReport.py +++ b/Tools/PyJobTransformsCore/python/JobReport.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ## @package JobReport # @@ -9,10 +9,10 @@ from __future__ import with_statement, print_function import os,sys,re,shutil,traceback, subprocess, itertools -import cPickle as pickle +import pickle from copy import copy from PyJobTransformsCore import AtlasErrorCodes, extraMetadata -from xmlutil import XMLNode +from .xmlutil import XMLNode __all__ = [ 'JobInfo', 'FileInfo', 'TaskInfo', 'JobReport', '_extraMetadataDict' ] @@ -389,9 +389,8 @@ class JobReport( object ): metadata_xml = 'metadata.xml' jobinfo_xml = 'jobInfo.xml' defaultFilenameBase = 'jobReport' - fileExtentions = ( '.txt', '.pickle', '.xml' ) + fileExtensions = ( '.txt', '.pickle', '.xml' ) # List of files created by the transform - defaultFiles = [ defaultFilenameBase + ext for ext in fileExtentions ] + [ metadata_xml, jobinfo_xml ] ## @brief Constructor for the JobReport class. # @details A newly instantiated JobReport class is invalid for the purpose for which it was designed as @@ -400,6 +399,9 @@ class JobReport( object ): # A JobReport instance may be explicitly created as a container in which other JobReport instances may be # stored e.g. in composite transforms. def __init__( self ): + # Can't be at class scope due to py3 scoping rules for comprehensions. + JobReport.defaultFiles = [ defaultFilenameBase + ext for ext in fileExtensions ] + [ metadata_xml, jobinfo_xml ] + self.reset() self.setCommand() # print everything by default diff --git a/Tools/PyJobTransformsCore/python/TransformConfig.py b/Tools/PyJobTransformsCore/python/TransformConfig.py index 938dbe5c466932e4c4bf2f5bda936f3d99b63429..36aff25438c2c9e27cf52e1f65c67ab2246e44f3 100755 --- a/Tools/PyJobTransformsCore/python/TransformConfig.py +++ b/Tools/PyJobTransformsCore/python/TransformConfig.py @@ -1,15 +1,10 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -import CVSutil -CVSkeywords = CVSutil.CVSkeywords( ["$Id: TransformConfig.py,v 1.21 2009-02-13 21:15:41 ctan Exp $" , - "$Name: not supported by cvs2svn $" , - "$Revision: 285339 $"] ) - -__version__ = CVSkeywords["Revision"] __author__ = "clat@hep.ph.bham.ac.uk" import os,sys from PyJobTransformsCore.trferr import TransformConfigError +from future.utils import with_metaclass class Descriptor(object): @@ -281,6 +276,11 @@ class AllowedExpression: def next(self): """No iteration""" raise StopIteration + + + def __next__(self): + """No iteration""" + raise StopIteration @@ -320,11 +320,9 @@ class JobConfigMetaClass(type): -class JobConfig(object): +class JobConfig(with_metaclass(JobConfigMetaClass,object)): __slots__ = ( '__name', '__attributes' ) - __metaclass__ = JobConfigMetaClass - def __init__(self,name=None): """name is used in printout. The default name is derived from the filename of the python file where constructor is called""" @@ -442,7 +440,7 @@ class TransformConfig(JobConfig): me += '(None)' return me - + def metaData(self): """A dictionary of metadata to be added to the metadata of the output files. Values set to None will not be added to the list. Values will be converted to strings. diff --git a/Tools/PyJobTransformsCore/python/VTimer.py b/Tools/PyJobTransformsCore/python/VTimer.py index 325162f939953b6bd792c78459d51d0489ca3cfa..1956cbe21a093104a837d812aa485c41cde64067 100644 --- a/Tools/PyJobTransformsCore/python/VTimer.py +++ b/Tools/PyJobTransformsCore/python/VTimer.py @@ -1,8 +1,8 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function -import cPickle as pickle +import pickle import os, time from resource import getrusage, RUSAGE_SELF, RUSAGE_CHILDREN diff --git a/Tools/PyJobTransformsCore/python/envutil.py b/Tools/PyJobTransformsCore/python/envutil.py index edb16cfe4eba157c8cf767c0c78e4fd74b1183a8..156c076e7937811dea5c0414c3cede16b93f83f2 100755 --- a/Tools/PyJobTransformsCore/python/envutil.py +++ b/Tools/PyJobTransformsCore/python/envutil.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function @@ -394,7 +394,7 @@ def find_files( filename, dirlist, access, depth ): <depth> < 0 : treated as = 0 <depth> > 0 : descend deeper into the directory tree up to max <depth> levels. It returns a list of filenames with full pathnames. If none is found, an empty list is returned.""" - return map( lambda arg : os.path.join( arg[0], arg[1] ), find_files_split( filename, dirlist, access, depth ) ) + return list (map( lambda arg : os.path.join( arg[0], arg[1] ), find_files_split( filename, dirlist, access, depth ) )) def find_file_env( filename, env_var_name, access = os.R_OK, sep = defaultPathSeps, depth = 0 ): diff --git a/Tools/PyJobTransformsCore/python/runargs.py b/Tools/PyJobTransformsCore/python/runargs.py index 4d7cbbaad356a519f70a6a305b7c3e284ad2be81..525564c0209c7a97e57d705b08972283c6a4d285 100755 --- a/Tools/PyJobTransformsCore/python/runargs.py +++ b/Tools/PyJobTransformsCore/python/runargs.py @@ -1,12 +1,7 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function -import CVSutil -CVSkeywords = CVSutil.CVSkeywords( ["$Id: runargs.py,v 1.16 2009-03-16 09:01:06 ctan Exp $" , - "$Name: not supported by cvs2svn $" , - "$Revision: 468439 $"] ) -__version__ = CVSkeywords["Revision"] __author__ = "clat@hep.ph.bham.ac.uk" import os @@ -213,7 +208,7 @@ class RunOptions(JobConfig): command = CommandLineOption('c', 'command', 'Python code to be pre-executed before any scripts', True ) mcinput = CommandLineOption('', 'mcinput', 'Monte Carlo input file used. Omit if real data is used. Enabling this option also implies setting --usesqlite=True', True, False, choices = [ True, False ] ) usesqlite = CommandLineOption('', 'usesqlite', 'Force the use of local/symlinked sqlite files rather than ORACLE.', True, False, choices = [ True, False ] ) - omitvalidation = CommandLineOption('', 'omitvalidation', 'Omit certain validation routines. Use "ALL" to omit all validation routines, use "NONE" to remove all validation ommissions.', True, choices = VALIDATION_DICT.keys() + ['NONE'] ) + omitvalidation = CommandLineOption('', 'omitvalidation', 'Omit certain validation routines. Use "ALL" to omit all validation routines, use "NONE" to remove all validation ommissions.', True, choices = list(VALIDATION_DICT.keys()) + ['NONE'] ) athenaopts = CommandLineOption('a', 'athenaopts', 'Options to be passed on to athena', True) argdict = CommandLineOption('', 'argdict', 'Run arguments given in a python dictionary in a pickle file', True) diff --git a/Tools/PyJobTransformsCore/python/trferr.py b/Tools/PyJobTransformsCore/python/trferr.py index f33f85601015c734f0a56a81e625458bc49fbb9b..56dff3387adffcc52537264308dfda7170d7085f 100755 --- a/Tools/PyJobTransformsCore/python/trferr.py +++ b/Tools/PyJobTransformsCore/python/trferr.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function @@ -11,7 +11,7 @@ __all__ = [ 'TransformError', 'TransformDefinitionError', 'TransformArgumentErro 'JobOptionsNotFoundError', 'TransformErrorHandler', 'AthenaLogChecker', 'TransformThreadTimeout', 'TransformThreadError' ] -import sys,commands,re,os,copy +import sys,re,os,copy from PyJobTransformsCore import fileutil, trfconsts, AtlasErrorCodes, VTimer from PyJobTransformsCore.xmlutil import XMLNode from PyJobTransformsCore.envutil import * @@ -20,6 +20,9 @@ from PyJobTransformsCore.TransformLogger import TransformLogger from AthenaCommon.Include import IncludeError from PyJobTransformsCore.JobReport import * +from future import standard_library +standard_library.install_aliases() + # some constants for shared library loading problems systemLibs = [ 'libc.so', 'libg2c.so', 'libstdc++.so', 'libshift.so', 'libpthread.so', 'libm.so', 'libgcc_s.so', @@ -570,7 +573,7 @@ class TransformErrorHandler(TransformLogger): diag += '%s not found.' % (lib) else: self.logger().debug( "Found %s. Checking dependencies..." % full_lib ) - lddOut = commands.getoutput( 'ldd %s' % (full_lib) ) + lddOut = subprocess.getoutput( 'ldd %s' % (full_lib) ) missLibs = [ ] subRE = "%s%s%s" % (r"^\s*",dllNameRE,r"\s+.*not found\s*.*$") for line in lddOut: diff --git a/Tools/PyJobTransformsCore/python/trfutil.py b/Tools/PyJobTransformsCore/python/trfutil.py index b82192d876976a94ff8697bd9495f95d310e944c..bc7a55248e091cdd70d388b71c1d7144376fc2e2 100755 --- a/Tools/PyJobTransformsCore/python/trfutil.py +++ b/Tools/PyJobTransformsCore/python/trfutil.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function @@ -16,8 +16,8 @@ try: except AttributeError: # __stop does not exist in Python 3.0 TRF_Thread_stop = Thread._stop -from xmlutil import XMLNode -from envutil import * +from .xmlutil import XMLNode +from .envutil import * from PyJobTransformsCore import trfconsts, trfenv, fileutil from PyJobTransformsCore.trferr import * from PyJobTransformsCore import AtlasErrorCodes diff --git a/Tools/PyUtils/CMakeLists.txt b/Tools/PyUtils/CMakeLists.txt index 9b1a84ec04d4c760bf81a2b3955636bb73158f1f..780c92292dc98c189f3382f24bd2edc9858ae5cf 100644 --- a/Tools/PyUtils/CMakeLists.txt +++ b/Tools/PyUtils/CMakeLists.txt @@ -17,7 +17,7 @@ find_package( ROOT COMPONENTS Core PyROOT Tree MathCore Hist RIO pthread ) # Install files from the package: atlas_install_python_modules( python/*.py python/scripts python/AthFile ) -atlas_install_scripts( bin/acmd.py bin/atl-gen-athena-d3pd-reader bin/checkFile.py bin/checkPlugins.py bin/checkSG.py bin/checkMetaSG.py bin/checkTP.py bin/checkxAOD.py bin/diff-athfile bin/diff-jobo-cfg.py bin/diffConfigs.py bin/diffPoolFiles.py bin/diffTAGTree.py bin/dlldep.py bin/dso-stats.py bin/dump-athfile.py bin/dumpAthfilelite.py bin/filter-and-merge-d3pd.py bin/getMetadata.py bin/get-tag-diff.py bin/gprof2dot bin/issues bin/magnifyPoolFile.py bin/merge-poolfiles.py bin/pep8.py bin/pool_extractFileIdentifier.py bin/pool_insertFileToCatalog.py bin/print_auditor_callgraph.py bin/pyroot.py bin/vmem-sz.py bin/meta-reader.py bin/lstags bin/tree-orderer.py ) +atlas_install_scripts( bin/acmd.py bin/checkFile.py bin/checkPlugins.py bin/checkSG.py bin/checkMetaSG.py bin/checkTP.py bin/checkxAOD.py bin/diff-athfile bin/diff-jobo-cfg.py bin/diffConfigs.py bin/diffPoolFiles.py bin/dlldep.py bin/dso-stats.py bin/dump-athfile.py bin/dumpAthfilelite.py bin/filter-and-merge-d3pd.py bin/getMetadata.py bin/gprof2dot bin/issues bin/magnifyPoolFile.py bin/merge-poolfiles.py bin/pep8.py bin/pool_extractFileIdentifier.py bin/pool_insertFileToCatalog.py bin/print_auditor_callgraph.py bin/pyroot.py bin/vmem-sz.py bin/meta-reader.py bin/tree-orderer.py ) # Aliases: atlas_add_alias( checkFile "checkFile.py" ) @@ -32,9 +32,7 @@ atlas_add_alias( diffPoolFiles "diffPoolFiles.py" ) atlas_add_alias( print_auditor_callgraph "print_auditor_callgraph.py" ) atlas_add_alias( dump-athfile "dump-athfile.py" ) atlas_add_alias( pyroot "pyroot.py" ) -atlas_add_alias( diffTAGTree "diffTAGTree.py" ) atlas_add_alias( checkxAOD "checkxAOD.py" ) -atlas_add_alias( get-tag-diff "get-tag-diff.py" ) atlas_add_alias( checkSG "checkSG.py" ) atlas_add_alias( diff-jobo-cfg "diff-jobo-cfg.py" ) atlas_add_alias( acmd "acmd.py" ) diff --git a/Tools/PyUtils/python/scripts/diff_root_files.py b/Tools/PyUtils/python/scripts/diff_root_files.py index e079ee6fc5e9a6254bb0cc33a9be0b405f623bb7..49fbdada1f9da8ccc06db09383fc051bf306193a 100644 --- a/Tools/PyUtils/python/scripts/diff_root_files.py +++ b/Tools/PyUtils/python/scripts/diff_root_files.py @@ -12,7 +12,7 @@ __author__ = "Sebastien Binet" ### imports ------------------------------------------------------------------- import PyUtils.acmdlib as acmdlib from math import isnan - +from numbers import Real ### globals ------------------------------------------------------------------- g_ALLOWED_MODES = ('summary', 'semi-detailed', 'detailed') @@ -298,9 +298,10 @@ def main(args): tree_name, jentry, name, inew = d_new # for regression testing we should have NAN == NAN - if isnan(iold) and isnan(inew) and args.nan_equal: - n_good += 1 - continue + if args.nan_equal: + if all([isinstance(x,Real) and isnan(x) for x in [iold,inew]]): + n_good += 1 + continue # FIXME: that's a plain (temporary?) hack if name[-1] in args.known_hacks: diff --git a/Tools/Tier0ChainTests/python/CastorFileTool.py b/Tools/Tier0ChainTests/python/CastorFileTool.py deleted file mode 100644 index 8234d810a8f8a410ffc42c55e831dd0a17fff299..0000000000000000000000000000000000000000 --- a/Tools/Tier0ChainTests/python/CastorFileTool.py +++ /dev/null @@ -1,553 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import os -from datetime import datetime - -class CastorFileTool: - def __init__(self, baseCastorDir="/castor/cern.ch/grid/atlas/DAQ/2008/91890", inStream=["IDCosmic"], tmpdir="${TMPDIR}/", - nJobs=30, nFilesPerJob=7, nFilesNeeded=-1, linkdir="./", useBaseSubdirs=True, - runSubdirToSearch = "", staticRuns = [], lumiBlock = None): - - # need this conversion map somewhere ... - self.monthMap = {} - self.monthMap["Jan"] = "01" - self.monthMap["Feb"] = "02" - self.monthMap["Mar"] = "03" - self.monthMap["Apr"] = "04" - self.monthMap["May"] = "05" - self.monthMap["Jun"] = "06" - self.monthMap["Jul"] = "07" - self.monthMap["Aug"] = "08" - self.monthMap["Sep"] = "09" - self.monthMap["Oct"] = "10" - self.monthMap["Nov"] = "11" - self.monthMap["Dec"] = "12" - - self.twogblimit = 2000000000 - - self.baseCastorDir = baseCastorDir - self.inStream = inStream - - if ( tmpdir.rfind("/")!=(len(tmpdir)-1) ): - tmpdir+="/" - self.tmpdir = tmpdir - - self.nJobs = nJobs - self.nFilesPerJob = nFilesPerJob - - self.nFilesNeeded = self.nJobs * self.nFilesPerJob - if (nFilesNeeded>0): self.nFilesNeeded = nFilesNeeded - - self.fileIdx = 0 - self.fileIdxEndOfRun = 0 - self.fileList = [] - self.fileListEndOfRun = [] - - if ( linkdir.rfind("/")!=(len(linkdir)-1) ): - linkdir+="/" - self.linkdir = linkdir - self.useBaseSubdirs = useBaseSubdirs - self.runSubdirToSearch = runSubdirToSearch - self.staticRuns = staticRuns - self.lumiBlock = lumiBlock - - def init(self): - self.GetLatestRunFilesFromCastor() - - def ListFromLocal(self,localDir): - timenow = datetime.today().strftime("%d%b%y.%Hh%M") - os.system("ls -l "+localDir+" > filelist.temp") - FileList=open("filelist.temp","r").readlines() - FileList1=[localDir+"/"+file.split()[8] - for file in FileList - if file.split()[4]!="0"] - os.system("rm -f filelist.temp") - return FileList1 - - def ListFromCastor(self,castorDir,stream="Express"): - timenow = datetime.today().strftime("%d%b%y.%Hh%M") - os.system("nsls -l "+castorDir+" | grep "+stream+" > filelist.temp") - FileList=open("filelist.temp","r").readlines() - FileList1=["rfio:"+castorDir+file.split()[8] - for file in FileList - if file.split()[0][0]!="d"] - os.system("rm filelist.temp") - return FileList1 - - def GetTmpdir(self): - # default - defaultTmpdir = "" - - try: - defaultTmpdir = os.environ['TMPDIR'] - except Exception,inst: - pass - - # cern lxbatch machines - hostname = "" - - try: - hostname = os.environ['HOSTNAME'] - except Exception,inst: - pass - - #hostname = os.environ['HOSTNAME'] - hostPieces = hostname.split(".") - nhostPieces = len(hostPieces) - if(nhostPieces>=3): - if (hostPieces[0].find("lxb")!=-1) and (hostPieces[nhostPieces-2]=="cern"): - pwddir = os.environ['PWD'] - if (pwddir.find("pool")!=-1): defaultTmpdir = pwddir - - # use given tmpdir - if (len(self.tmpdir)>0): defaultTmpdir = self.tmpdir - - # fall back option - if (len(defaultTmpdir)==0): defaultTmpdir="/tmp" - - return defaultTmpdir - - def StageCollections(self,inputFiles=[],stageFirstCollection=False): - baseTmpdir = self.GetTmpdir() - - if ( baseTmpdir.rfind("/")!=(len(baseTmpdir)-1) ): - baseTmpdir+="/" - - outputFiles = [] - - for input in inputFiles: - filePiece = input.split("/") - nPieces = len(filePiece) - tmpFile = baseTmpdir + "tcf_" + filePiece[nPieces-1] - outputFiles.append(tmpFile) - - # stage first file ... - if(len(inputFiles)>=1 and stageFirstCollection): - rfioPiece = inputFiles[0].split(":") - nPieces = len(rfioPiece) - inFile = rfioPiece[nPieces-1] - outFile = outputFiles[0] - print "StageCollections() : Waiting till <%s> is staged." % (inputFiles[0]) - os.system("rfcp "+inFile+" "+outFile) - os.system("touch "+outFile+"_stage.out") - os.system("touch "+outFile+"_stage.err") - os.system("ls -l -h %s" % (baseTmpdir)) - - return outputFiles - - def GetFileTimeInt(self, castorLine): - # get current year - #from datetime import datetime - thisyearstr = datetime.today().strftime("%Y") - - linesplit = castorLine.split() - - # reconstruct directory creation time for sorting - monthstr = linesplit[5] - daystr = linesplit[6] - hourminstr = linesplit[7] - - yearstr = "" - if (hourminstr.find(":")!=-1): - yearstr = thisyearstr - else: - yearstr = hourminstr - hourminstr = "00:00" - - hourstr = hourminstr.split(":")[0] - minstr = hourminstr.split(":")[1] - - # sortable time integer - timeint = int(yearstr+self.monthMap[monthstr]+daystr+hourstr+minstr) - - return timeint - - def GetRunNumber(self, fileName): - nameSplit = fileName.split(".") - - # use first number in filename as runnumber - runString = "" - runNumber = -1 - idx = 0 - while ( idx<len(nameSplit) ): - try: - runNumber = int(nameSplit[idx]) # replace - except Exception,inst: - pass - - if( runNumber!=-1 ): break - - idx+=1 - - return runNumber - - def LatestSubdirsFromCastor(self, castorDir, recursiveSearch=False): - if ( castorDir.rfind("/")!=(len(castorDir)-1) ): - castorDir+="/" - - # dirs in given castor directory - timenow = datetime.today().strftime("%d%b%y.%Hh%M") - dirlist = "dirlist.temp" + timenow - os.system("eos ls -l " + castorDir + " > " + dirlist) - FileList=open(dirlist,"r").readlines() - - # construct map with subdirectories - dirList = {} - for line in FileList: - linesplit = line.split() - - # filesize == 0 for a directory - # TC: not true with eos!! - #if (linesplit[4]=="0"): - if (linesplit[0][0]=="d"): - - # sortable time integer - timeint = self.GetFileTimeInt(line) - - timeFound = False - for key in dirList.keys(): - if (timeint==key): - timeFound = True - break - newdir=castorDir+linesplit[8] - if newdir.find("merge")!=-1 or newdir.find("recon")!=-1: - continue - if (not timeFound): dirList[timeint] = [] - - dirList[timeint].append(newdir) - - # Be sure to delete tmpfile before next iteration. - os.system("rm -f "+dirlist) - - keys = dirList.keys() - keys.sort() - - # default is given castordir - if (len(keys)==0): - dirList[0] = [ castorDir ] - print "Using basedir : " - print castorDir - recursiveSearch = False - - # return - if (recursiveSearch): - return self.LatestSubdirsFromCastor(dirList[keys[len(keys)-1]][0],recursiveSearch) - else: - return dirList - - def RunFilesFromCastor(self, castorDir, streamStr=["Express"]): - if ( castorDir.rfind("/")!=(len(castorDir)-1) ): - castorDir+="/" - if ( self.runSubdirToSearch != "" ): - if ( self.runSubdirToSearch.rfind("/")!=(len(self.runSubdirToSearch)-1) ): - self.runSubdirToSearch += "/" - #castorDir += self.runSubdirToSearch - - # dirs in given castor directory - timenow = datetime.today().strftime("%d%b%y.%Hh%M") - filelist = "filelist.temp" + timenow - if self.lumiBlock != None and ',' in self.lumiBlock: - FileList = [] - for iblock in range(int(self.lumiBlock.split(',')[0]),int(self.lumiBlock.split(',')[1])+1): - cmd = "eos ls -l " + castorDir - for grepStr in streamStr: - cmd += " | grep " + grepStr - pass - cmd += " | grep _lb%0.4d" % iblock - cmd += " > " + filelist - print "RunFilesFromCastor : running command",cmd - os.system(cmd) - FileList += open(filelist,"r").readlines() - pass - else: - #cmd = "nsls -l " + castorDir - cmd = "eos ls -l " + castorDir - #for grepStr in streamStr: - # cmd += " | grep " + grepStr - if self.lumiBlock != None: cmd += " | grep _lb%0.4d" % int(self.lumiBlock) - cmd += " > " + filelist - print "RunFilesFromCastor : running command",cmd - os.system(cmd) - FileList=open(filelist,"r").readlines() - pass - - # construct map with subdirectories - runMap = {} - for line in FileList: - linesplit = line.split() - - # filesize == 0 for a directory - # TC: not true with eos!! - #print "test ",linesplit[0]," ",linesplit[0][0]," ",linesplit[4] - #if (linesplit[4]!="0"): - if (linesplit[0][0]!="d"): - - # run number - runNumber = self.GetRunNumber(linesplit[8]) - - runFound = False - for key in runMap.keys(): - if (runNumber==key): - runFound = True - break - if (not runFound): runMap[runNumber] = [] - - # two gb webserver limit - if (self.nFilesNeeded==5 and self.nFilesPerJob==1 and int(linesplit[4])>=self.twogblimit): continue - #if (int(linesplit[4])<100000000): continue - - runMap[runNumber].append(castorDir+linesplit[8]) - - # Be sure to delete tmpfile before next iteration. - os.system("rm -f " + filelist) - - return runMap - - def GetLatestRunFilesFromCastor(self,nFilesNeeded=-1): - - if (nFilesNeeded>0): self.nFilesNeeded = nFilesNeeded - - print "CastorTool.GetLatestRunFilesFromCastor() : INFO" - print ">> Now retrieving names of latest <", self.nFilesNeeded, "> runfiles on Castor. This may take some time." - print ">> Searching in latest subdirector(y/ies) of <", self.baseCastorDir, ">, matching <", self.inStream, ">, and runsubdir <", self.runSubdirToSearch, ">." - - fileList = [] - fileListEndOfRun = [] - dirMap = {} - - # retrieve castor directories, with timestamps - if (self.useBaseSubdirs): - dirMap = self.LatestSubdirsFromCastor( self.baseCastorDir+"/"+self.runSubdirToSearch, recursiveSearch=True ) - else: dirMap[len(self.staticRuns)] = [ self.baseCastorDir ] - - # sort directories in time - timeints = dirMap.keys() - timeints.sort() - - # add static runs to the top - idx = 1 - for staticRunNumber in self.staticRuns: - dirMap[timeints[len(timeints)-1]+idx] = [ self.baseCastorDir + "/" + str(staticRunNumber)] - idx+=1 - - # sort directories again in time - timeints = dirMap.keys() - timeints.sort() - - # loop over latest castor directories, till enough files found - noFilesInRunMap = 0 - idx = len(timeints)-1 - while (idx>=0): - timeint = timeints[idx] - # collect runfiles from next-to-latest directory - print "Now retrieving files from directory : " + dirMap[timeint][0],timeint - runMapTmp = self.RunFilesFromCastor( dirMap[timeint][0], self.inStream ) - - #print runMapTmp - - # sort runs - runs = runMapTmp.keys() - runs.sort() - - #if len(self.staticRuns)>0: - # runs = self.staticRuns + runs - - # add enough files from next-to-latest run - jdx = len(runs)-1 - while (jdx>=0 and noFilesInRunMap<self.nFilesNeeded): - run = runs[jdx] - print ">> Now including run <", run, ">" - - noLoop = 0 - if (len(runMapTmp[run]) > self.nFilesNeeded-noFilesInRunMap): # add only number of files needed - noLoop = self.nFilesNeeded-noFilesInRunMap - else: noLoop = len(runMapTmp[run]) # add everything - - kdx = 0 - while (kdx<noLoop): - #while (kdx<self.nFilesNeeded-noFilesInRunMap): - fileList.append(runMapTmp[run][kdx]) # reverse map for later use - fileListEndOfRun.append(runMapTmp[run][len(runMapTmp[run])-(kdx+1)]) - kdx+=1 - - noFilesInRunMap += noLoop - - jdx-=1 - - # stop when enough files have been found - if (noFilesInRunMap>=self.nFilesNeeded): break - - idx-=1 - - self.fileList = fileList - self.fileListEndOfRun = fileListEndOfRun - self.nJobs = int(len(fileList)/self.nFilesPerJob) - - print ">> Retrieved <", len(fileList), "> file names. Enough for <", self.nJobs, "> jobs with <", self.nFilesPerJob, "> files per job." - - return fileList,fileListEndOfRun - - def GetFilesForJob(self, nFiles=-1, fileList=[], fileListEndOfRun=[], addFilesEndOfRun=False, jobIdx=-1): - - if (fileList==[]): fileList = self.fileList - if (fileListEndOfRun==[] and addFilesEndOfRun): - fileListEndOfRun = self.fileListEndOfRun - if (nFiles<=0): nFiles = self.nFilesPerJob - - fileIdxTemp = self.fileIdx - if (jobIdx>=0): self.fileIdx = jobIdx * nFiles - - if (self.fileIdx+nFiles>=len(fileList)): - print "CastorTool.GetFilesForJob() : WARNING" - print "fileindex > number of files",self.fileIdx,len(fileList),nFiles - self.fileIdx = (self.fileIdx+nFiles)%(len(fileList)) - print "new fileindex is",self.fileIdx - pass - - jobFileList = [] - - jdx = 0 - eoridx = 0 - if (addFilesEndOfRun): eoridx = 1 - - firstrunnumber = -1 - runnumber = -1 - - while (jdx<(nFiles-eoridx) and self.fileIdx<len(fileList)): - if (firstrunnumber == -1): firstrunnumber = self.GetRunNumber(fileList[self.fileIdx]) - runnumber = self.GetRunNumber(fileList[self.fileIdx]) - if (runnumber == firstrunnumber): - jobFileList.append(fileList[self.fileIdx]) - self.fileIdx+=1 - jdx+=1 - - if (addFilesEndOfRun): - jobFileList.append(fileListEndOfRun[self.fileIdxEndOfRun]) - self.fileIdxEndOfRun+=1 - - if (jobIdx>=0): self.fileIdx = fileIdxTemp - - return jobFileList - - def GetFilesString(self, fileList, prefix = "datasetname#"): - fileStr = "\"" - - jdx=0 - while (jdx<len(fileList)): - fileStr += prefix - fileStr += fileList[jdx] - if (jdx+1<len(fileList)): fileStr += " " - jdx+=1 - - fileStr += "\"" - - return fileStr - - def TmpFilesCopyCommands(self, jobFileList,tmpFileList): - cpcommand = "time xrdcp root://eosatlas.cern.ch/" - #cpcommand = "time rfcp " - inprefix = "" - outprefix = "" - - tmpcommands = [] - baseTmpdir = self.GetTmpdir() - - if False: - #tmpcommands.append('export STAGE_SVCCLASS=atlcal') - tmpcommands.append('\n# *** To run this script from a shell, one needs to set RUNDIR and WORKDIR below. ***') - tmpcommands.append('\n# Uncomment following line to specify where the transform should be run. (Otherwise this script will not work.)') - tmpcommands.append('#export RUNDIR=afsRunDirectory # Provide full afs path.') - if True: - tmpcommands.append('#export STAGE_SVCCLASS=default') - tmpcommands.append('') - tmpcommands.append('## Set WORKDIR to specify where to store temporary files.') - tmpcommands.append('## Note that WORKDIR is set dynamically when running in a batch queue.') - tmpcommands.append('#export WORKDIR=afsDirectoryForTmpStorage # Provide full afs path.') - tmpcommands.append('if [ "$WORKDIR" = "" ]; then') - tmpcommands.append(' if [ "$TMPDIR" = "" ]; then') - tmpcommands.append(' export WORKDIR=${PWD}') - tmpcommands.append(' else') - tmpcommands.append(' export WORKDIR=${TMPDIR}') - tmpcommands.append(' fi') - tmpcommands.append('fi\n') - - #idx=0 - #while (idx<len(tmpFileList)): - # tmpcommands.append("touch "+tmpFileList[idx]) - # idx+=1 - - idx=0 - while (idx<len(tmpFileList)): - tmpcommands.append(cpcommand+inprefix+jobFileList[idx]+" "+outprefix+tmpFileList[idx]) - #tmpcommands.append(('ls -l -h %s' % baseTmpdir)) - idx+=1 - - ## commands to compose filestager list - if False: - tmpcommands.append("\nrm -f $WORKDIR/castorsample.def") - tmpcommands.append("cat > $WORKDIR/castorsample.def <<EOF") - idx=0 - while (idx<len(tmpFileList)): - tmpcommands.append("gridcopy://"+jobFileList[idx]) - idx+=1 - tmpcommands.append("EOF") - - return tmpcommands - - def GetLinkCommands(self, tmpFiles ): - - linkFiles = [] - pooldir = "" #"pooldir/" - - for input in tmpFiles: - filePiece = input.split("/") - nPieces = len(filePiece) - tmpFile = pooldir + filePiece[nPieces-1] #self.linkdir + pooldir + filePiece[nPieces-1] - linkFiles.append(tmpFile) - - rmcommand = "rm -f" - lncommand = "ln -s" - - lncommands = [] - #lncommands.append("\n# Copy over relevant data collections.") - lncommands.append("mkdir -p "+self.linkdir) - #if (len(pooldir)>1): - # lncommands.append(rmcommand+" "+self.linkdir+pooldir) - # lncommands.append(lncommand+" "+"${WORKDIR}"+" "+self.linkdir+pooldir) - #lncommands.append("ls -l") - - idx=0 - while (idx<len(tmpFiles)): - #if (len(pooldir)==0): - #lncommands.append(rmcommand+" "+linkFiles[idx]) - #lncommands.append(lncommand+" "+tmpFiles[idx]+" "+linkFiles[idx]) - #lncommands.append("gridcopy://"+tmpFiles[idx]) - idx+=1 - - #lncommands.append("ls -l "+self.linkdir+pooldir) - - return lncommands, linkFiles - - - def GetNextJob(self, nFiles=-1, fileList=[], fileListEndOfRun=[], addFilesEndOfRun=False, jobIdx=-1): - jobFileList = self.GetFilesForJob(nFiles,fileList,fileListEndOfRun,addFilesEndOfRun,jobIdx) - tmpFileList = self.StageCollections(jobFileList) - #tmpFileStr = self.GetFilesString(tmpFileList) - cpCommands = self.TmpFilesCopyCommands(jobFileList,tmpFileList) - - lnCommands, linkFiles = self.GetLinkCommands(tmpFileList) - #cpCommands += lnCommands - - dict = {} - dict["jobFileList"] = jobFileList - dict["tmpFileList"] = tmpFileList - dict["cpCommands"] = cpCommands - dict["lnCommands"] = lnCommands - dict["linkFiles"] = linkFiles - - return dict - - - -############################################################## - diff --git a/Tools/Tier0ChainTests/scripts/tct_generate_copyscript.py b/Tools/Tier0ChainTests/scripts/tct_generate_copyscript.py deleted file mode 100755 index 32d7c7474c67e12711d5a3647558667bcf704bb7..0000000000000000000000000000000000000000 --- a/Tools/Tier0ChainTests/scripts/tct_generate_copyscript.py +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -# -# usage: tct_GenerateCopyScript <samplefile> - -import sys -import os -import string, commands -import random -from datetime import datetime -from Tier0ChainTests.CastorFileTool import CastorFileTool - -fallbackfile = [] -fallbackfile.append("/afs/cern.ch/atlas/offline/external/FullChainTest/tier0-vol3/rtt/fallbackfiles/data09_cos.00135664.physics_IDCosmic.daq.RAW._lb0000._SFO-2._0001.data") -fallbackfile.append("/afs/cern.ch/atlas/offline/external/FullChainTest/tier0-vol3/rtt/fallbackfiles/data09_cos.00135664.physics_IDCosmic.daq.RAW._lb0000._SFO-2._0002.data") -fallbackfile.append("/afs/cern.ch/atlas/offline/external/FullChainTest/tier0-vol3/rtt/fallbackfiles/data09_cos.00135664.physics_IDCosmic.daq.RAW._lb0000._SFO-2._0003.data") - -def GenerateCopyLinkScript(jobindex,castorsubdir,nfilesperjob,castorbasedir,useBaseSubdirs,lumiblock): - - timenow = "## Auto-generated at: %s\n\n" % datetime.today().strftime("%d%b%y.%Hh%M") - - outfile = "copylinkscript.sh" - inStream = ["physics"] - nJobsMax = 5 - tmpdir = "${WORKDIR}/" - linkdir = tmpdir - - ## Castor file retrieval - ## tool searches for (nfilesperjob*nJobsMax) files in castor dir: castorbasedir/castorsubdir - filetool = CastorFileTool(baseCastorDir=castorbasedir, inStream=inStream, nJobs=nJobsMax, - tmpdir=tmpdir, linkdir=linkdir, useBaseSubdirs=useBaseSubdirs, - nFilesPerJob=nfilesperjob, runSubdirToSearch=castorsubdir, - lumiBlock = lumiblock) - filetool.init() - dict = filetool.GetNextJob(jobIdx=jobindex,addFilesEndOfRun=False) - - ## generate copy & link script - filemap = {} - file = open(outfile,'w') - file.write("#!/bin/sh\n") - file.write(timenow) - file.write("echo \"STAGE_SVCCLASS is set to ${STAGE_SVCCLASS}\"\n") - file.write("echo \"STAGE_HOST is set to ${STAGE_HOST}\"\n") - file.write("echo \"RFIO_USE_CASTOR_V2 is set to ${RFIO_USE_CASTOR_V2}\"\n") - file.write("echo \">> Now copying file(s) from Castor. This may take some time.\"\n") - ## copying - for line in dict["cpCommands"]: - file.write(line + "\n") - file.write("\nTEST=\"OK\"\n") - ## testing all files exist - for i in range(len(dict["linkFiles"])): - linkFile = linkdir + dict["linkFiles"][i] - file.write("if [ ! -f %s ] ; then\n" % linkFile) - file.write(" echo file %s was not copied properly\n" % linkFile) - file.write(" TEST=\"NO\"\nfi\n") - ## linking & fallback - file.write("if [ \"IS${TEST}\" = \"ISOK\" ] ; then\n") - file.write(" echo All files copied from castor are ok !\n") - for i in range(len(dict["linkFiles"])): - linkFile = linkdir + dict["linkFiles"][i] - toFile = "%d.data" % i - rmcmd = "rm -f %s" % (toFile) - file.write(" %s ; ln -s %s %s\n" % (rmcmd,linkFile,toFile)) - filemap[toFile] = dict["jobFileList"][i] - file.write("else\n") - file.write(" echo WARNING: Some files copied from castor were corrupted !\n") - for i in range(len(dict["linkFiles"])): - randFile = random.choice(fallbackfile) - toFile = "%d.data" % i - rmcmd = "rm -f %s" % (toFile) - file.write(" %s ; ln -s %s %s\n" % (rmcmd,randFile,toFile)) - file.write("fi\n") - file.write("\n") - file.close() - - cmd = "chmod +x %s" % outfile - os.system(cmd) - - ## file map: - print "\nPrincipal file dictionary:" - print filemap - print "" - - return - -## main -if __name__ == "__main__": - - usageline = "usage: " + sys.argv[0] + " <jobindex> [<castorsubdir>] [<nfilesperjob>] [<castorbasedir>] [<findlatestcastordir>] [<lumiblock>]" - if (len(sys.argv)<2): - print usageline - sys.exit(1) - - ## job index - jobindex = int(sys.argv[1]) - - ## castor subdir to search - castorsubdir = "physics_IDCosmic" - if (len(sys.argv) >= 3): - castorsubdir = sys.argv[2] - - ## number of files per job - nfilesperjob = 3 - if (len(sys.argv) >= 4): - nfilesperjob = int(sys.argv[3]) - - ## castor base directory to search from - castorbasedir = "/castor/cern.ch/grid/atlas/DAQ/2008/91890" - if (len(sys.argv) >= 5): - castorbasedir = sys.argv[4] - - ## search in castor subdirectories - useBaseSubdirs = False - if len(sys.argv)>= 6: - if sys.argv[5]=="True": useBaseSubdirs = True - - ## select a given lumi block - lumiblock = None - if len(sys.argv)>=7: lumiblock = sys.argv[6] - - ## generate copy script - GenerateCopyLinkScript(jobindex,castorsubdir,nfilesperjob,castorbasedir,useBaseSubdirs,lumiblock) - diff --git a/Tracking/Acts/ActsGeometry/CMakeLists.txt b/Tracking/Acts/ActsGeometry/CMakeLists.txt index 54fc8386ae0b2b31daefb0c3a8883a747a4e2fc6..ac6cd6d994ccfb601e1e0fab0812e59fdc589686 100755 --- a/Tracking/Acts/ActsGeometry/CMakeLists.txt +++ b/Tracking/Acts/ActsGeometry/CMakeLists.txt @@ -9,6 +9,7 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/Identifier InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry Control/AthenaBaseComps AthenaKernel DetectorDescription/GeoModel/GeoModelUtilities @@ -42,7 +43,8 @@ atlas_add_library( ActsGeometryLib AthenaKernel ActsInteropLib ActsGeometryInterfacesLib - ActsCore) + ActsCore + PixelReadoutGeometry) atlas_add_component( ActsGeometry src/ActsExtrapolationAlg.cxx diff --git a/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.cxx b/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.cxx index bfde8c7b4d3d30c370f31e96d3aebf584bff2596..bc59d59d1c3e7148bb69b14dce664625fb9ba6ee 100644 --- a/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.cxx +++ b/Tracking/Acts/ActsGeometry/src/ActsAlignmentCondAlg.cxx @@ -11,7 +11,7 @@ #include "GaudiKernel/EventIDRange.h" #include "GaudiKernel/ICondSvc.h" #include "GeoModelKernel/GeoAlignableTransform.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/TRT_DetectorManager.h" #include "StoreGate/StoreGateSvc.h" diff --git a/Tracking/Acts/ActsGeometry/src/GeomShiftCondAlg.cxx b/Tracking/Acts/ActsGeometry/src/GeomShiftCondAlg.cxx index 0d83ab11578f81cdca8c66cdc4e9f5c3e4d3a79a..cdc1368005171f82b5bb2c14922ac2f2c38c7fb5 100644 --- a/Tracking/Acts/ActsGeometry/src/GeomShiftCondAlg.cxx +++ b/Tracking/Acts/ActsGeometry/src/GeomShiftCondAlg.cxx @@ -11,7 +11,7 @@ #include "EventInfo/EventInfo.h" #include "EventInfo/EventID.h" #include "GeoModelKernel/GeoAlignableTransform.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/TRT_DetectorManager.h" #include "GeoPrimitives/CLHEPtoEigenConverter.h" diff --git a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/SharedObject.h b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/SharedObject.h index e94ee9254da42841931af8c624cc5e9eed33e0cc..7401adaff0a79f8b20a255598d91dfcb8ad7528d 100644 --- a/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/SharedObject.h +++ b/Tracking/TrkDetDescr/TrkDetDescrUtils/TrkDetDescrUtils/SharedObject.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -24,7 +24,7 @@ template<class T> using SharedObject = std::shared_ptr<T>; template<typename T> -auto do_not_delete = [](T*) {}; +const auto do_not_delete = [](T*) {}; } // end of namespace diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BevelledCylinderVolumeBounds.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BevelledCylinderVolumeBounds.h index 23d627f3d67abc2361a18f5d800fa43beb77cfea..b177e849a53ea6a9d5eba05d271d6de8720df1e0 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BevelledCylinderVolumeBounds.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/BevelledCylinderVolumeBounds.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -122,7 +122,7 @@ namespace Trk { bool inside(const Amg::Vector3D& , double tol=0.) const override; /** Method to decompose the Bounds into boundarySurfaces */ - const std::vector<const Trk::Surface*>* decomposeToSurfaces(const Amg::Transform3D& transform) const override; + const std::vector<const Trk::Surface*>* decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const override; /** Provide accessor for BoundarySurfaces */ ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D& gp, diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CombinedVolumeBounds.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CombinedVolumeBounds.h index 7e488ffb2fb37f69495c24a653110990f870b2c5..41a87c9d2fd6a96652e55d42255086b12f9adb1e 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CombinedVolumeBounds.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CombinedVolumeBounds.h @@ -40,7 +40,7 @@ namespace Trk { @author Sarka.Todorova@cern.ch */ - class ATLAS_NOT_THREAD_SAFE CombinedVolumeBounds : public VolumeBounds { + class CombinedVolumeBounds : public VolumeBounds { public: /**Default Constructor*/ @@ -65,7 +65,7 @@ namespace Trk { virtual bool inside(const Amg::Vector3D&, double tol=0.) const override; /** Method to decompose the Bounds into boundarySurfaces */ - virtual const std::vector<const Trk::Surface*>* decomposeToSurfaces (const Amg::Transform3D& transform) const override; + virtual const std::vector<const Trk::Surface*>* decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const override; /** Provide accessor for BoundarySurfaces */ virtual @@ -74,10 +74,10 @@ namespace Trk { bool forceInside=false) const override; /**This method returns the first VolumeBounds*/ - Volume* first() const; + const Volume* first() const; /**This method returns the second VolumeBounds*/ - Volume* second() const; + const Volume* second() const; /**This method distinguishes between Union(0) and Intersection(1)*/ bool intersection() const; @@ -99,7 +99,7 @@ namespace Trk { Volume* m_second; bool m_intersection; EightObjectsAccessor m_objectAccessor; - mutable std::vector<bool> m_boundsOrientation; + mutable std::vector<bool> m_boundsOrientation ATLAS_THREAD_SAFE; }; @@ -112,9 +112,9 @@ namespace Trk { return (m_first->inside(pos,tol) || m_second->inside(pos,tol) ); } - inline Volume* CombinedVolumeBounds::first() const { return m_first; } + inline const Volume* CombinedVolumeBounds::first() const { return m_first; } - inline Volume* CombinedVolumeBounds::second() const { return m_second; } + inline const Volume* CombinedVolumeBounds::second() const { return m_second; } inline bool CombinedVolumeBounds::intersection() const { return m_intersection; } diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CuboidVolumeBounds.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CuboidVolumeBounds.h index 98106dae15f0df3cc67143bacecd50e56c0b58a0..a0662cd6cc09da63ecb2809d4d3521095194c6c8 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CuboidVolumeBounds.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CuboidVolumeBounds.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -67,7 +67,7 @@ namespace Trk { bool inside(const Amg::Vector3D& , double tol=0.) const override; /** Method to decompose the Bounds into boundarySurfaces */ - const std::vector<const Trk::Surface*>* decomposeToSurfaces(const Amg::Transform3D& transform) const override; + const std::vector<const Trk::Surface*>* decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const override; /** Provide accessor for BoundarySurfaces */ ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D& gp, diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CylinderVolumeBounds.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CylinderVolumeBounds.h index 1a220ac1a332dc3fa20e7cf537ccb83f53d92e29..6def570f21ea0e704e067de46477beb63e1333c3 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CylinderVolumeBounds.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/CylinderVolumeBounds.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -94,7 +94,7 @@ namespace Trk { bool inside(const Amg::Vector3D& , double tol=0.) const override; /** Method to decompose the Bounds into boundarySurfaces */ - const std::vector<const Trk::Surface*>* decomposeToSurfaces(const Amg::Transform3D& transform) const override; + const std::vector<const Trk::Surface*>* decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const override; /** Provide accessor for BoundarySurfaces */ ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D& gp, diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/DoubleTrapezoidVolumeBounds.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/DoubleTrapezoidVolumeBounds.h index 72d0b475136d50f47ab53fa604b2ca13f7200ab0..01a6d82a4f1faf33924334454ea732aa8c12fedc 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/DoubleTrapezoidVolumeBounds.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/DoubleTrapezoidVolumeBounds.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -81,7 +81,7 @@ namespace Trk { bool inside(const Amg::Vector3D& , double tol=0.) const override; /** Method to decompose the Bounds into Surfaces */ - const std::vector<const Trk::Surface*>* decomposeToSurfaces(const Amg::Transform3D& transform) const override; + const std::vector<const Trk::Surface*>* decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const override; /** Provide accessor for BoundarySurfaces */ ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D& gp, diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/PrismVolumeBounds.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/PrismVolumeBounds.h index 924f3cc00348684fc8a8a3491ee2e5d00f8ac6cf..2c053f3be1f197b6d6280dd97619095c36cb17db 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/PrismVolumeBounds.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/PrismVolumeBounds.h @@ -67,7 +67,7 @@ namespace Trk { bool inside(const Amg::Vector3D& , double tol=0.) const override; /** Method to decompose the Bounds into Surfaces */ - const std::vector<const Trk::Surface*>* decomposeToSurfaces(const Amg::Transform3D& transform) const override; + const std::vector<const Trk::Surface*>* decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const override; /** Provide accessor for BoundarySurfaces */ ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D& gp, diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/SimplePolygonBrepVolumeBounds.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/SimplePolygonBrepVolumeBounds.h index 536595f506f2b7766db52905abbc0fed8ff87336..e30f72e0638abd78ef1c9ba7fb9511d3ed98e7dc 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/SimplePolygonBrepVolumeBounds.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/SimplePolygonBrepVolumeBounds.h @@ -67,7 +67,7 @@ namespace Trk { bool inside(const Amg::Vector3D& , double tol=0.) const override; /** Method to decompose the Bounds into Surfaces */ - const std::vector<const Trk::Surface*>* decomposeToSurfaces(const Amg::Transform3D& transform) const override; + const std::vector<const Trk::Surface*>* decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const override; /** Provide accessor for BoundarySurfaces */ ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D& gp, diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/SubtractedVolumeBounds.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/SubtractedVolumeBounds.h index 829d72567a3374a6684b6b777e1da226d4cacd84..ea10e97ce543f8713271cd3e2dac2956822c37aa 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/SubtractedVolumeBounds.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/SubtractedVolumeBounds.h @@ -39,7 +39,7 @@ namespace Trk { @author Sarka.Todorova@cern.ch */ - class ATLAS_NOT_THREAD_SAFE SubtractedVolumeBounds : public VolumeBounds { + class SubtractedVolumeBounds : public VolumeBounds { public: /**Default Constructor*/ @@ -64,7 +64,7 @@ namespace Trk { bool inside(const Amg::Vector3D& , double tol=0.) const override; /** Method to decompose the Bounds into boundarySurfaces */ - const std::vector<const Trk::Surface*>* decomposeToSurfaces(const Amg::Transform3D& transform) const override; + const std::vector<const Trk::Surface*>* decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const override; /** Provide accessor for BoundarySurfaces */ ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D& gp, @@ -72,10 +72,10 @@ namespace Trk { bool forceInside=false) const override; /**This method returns the outer Volume*/ - Volume* outer() const; + const Volume* outer() const; /**This method returns the inner Volume*/ - Volume* inner() const; + const Volume* inner() const; /**This method returns bounds orientation*/ std::vector<bool> boundsOrientation() const; @@ -97,7 +97,7 @@ namespace Trk { has to be implemented if Subtracteds are used more widely */ EightObjectsAccessor m_objectAccessor; - mutable std::vector<bool> m_boundsOrientation; + mutable std::vector<bool> m_boundsOrientation ATLAS_THREAD_SAFE; }; @@ -109,9 +109,9 @@ namespace Trk { return (m_outer->inside(pos,tol) && !m_inner->inside(pos,-tol) ); } - inline Volume* SubtractedVolumeBounds::outer() const { return m_outer; } + inline const Volume* SubtractedVolumeBounds::outer() const { return m_outer; } - inline Volume* SubtractedVolumeBounds::inner() const { return m_inner; } + inline const Volume* SubtractedVolumeBounds::inner() const { return m_inner; } inline ObjectAccessor SubtractedVolumeBounds::boundarySurfaceAccessor(const Amg::Vector3D&, const Amg::Vector3D&, diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/TrapezoidVolumeBounds.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/TrapezoidVolumeBounds.h index 71e9b1cdceb642f43fb7c559bb0b0c411043f1a2..430c17e212ff918001f9bfb158544cfca67cbd03 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/TrapezoidVolumeBounds.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/TrapezoidVolumeBounds.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -77,7 +77,7 @@ namespace Trk { bool inside(const Amg::Vector3D& , double tol=0.) const override; /** Method to decompose the Bounds into Surfaces */ - const std::vector<const Trk::Surface*>* decomposeToSurfaces(const Amg::Transform3D& transform) const override; + const std::vector<const Trk::Surface*>* decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const override; /** Provide accessor for BoundarySurfaces */ ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D& gp, diff --git a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/VolumeBounds.h b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/VolumeBounds.h index f5dda23eca544177a57a75026746cfc4c46c02db..e6eb888149c32e5c13a358fcb6ce64c5347fe83a 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/VolumeBounds.h +++ b/Tracking/TrkDetDescr/TrkVolumes/TrkVolumes/VolumeBounds.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -17,6 +17,8 @@ // Trk #include "GeoPrimitives/GeoPrimitives.h" #include "TrkDetDescrUtils/ObjectAccessor.h" + +#include "CxxUtils/checker_macros.h" namespace Trk { @@ -56,7 +58,7 @@ namespace Trk { virtual bool inside(const Amg::Vector3D& pos, double tol=0.) const = 0; /** Method to decompose the Bounds into Surfaces, the Volume can turn them into BoundarySurfaces */ - virtual const std::vector<const Trk::Surface*>* decomposeToSurfaces(const Amg::Transform3D& transform) const = 0; + virtual const std::vector<const Trk::Surface*>* decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const = 0; /** Provide accessor for BoundarySurfaces */ virtual ObjectAccessor boundarySurfaceAccessor(const Amg::Vector3D& gp, diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/BevelledCylinderVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/BevelledCylinderVolumeBounds.cxx index 4749245751b93ccabd636b6f2ba7f75a765dad18..29dd0cfa2f711c239fea61bd8574a956d905a4fb 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/BevelledCylinderVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/BevelledCylinderVolumeBounds.cxx @@ -93,7 +93,7 @@ Trk::BevelledCylinderVolumeBounds& } -const std::vector<const Trk::Surface*>* Trk::BevelledCylinderVolumeBounds::decomposeToSurfaces(const Amg::Transform3D& transform) const +const std::vector<const Trk::Surface*>* Trk::BevelledCylinderVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const { std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; // memory optimisation (reserve a save number of 20) diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/CombinedVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/CombinedVolumeBounds.cxx index b8b4902ee744d3ec20853e4fc3deb7c9116aded7..4cc01f3e79bbc8acb37db9c2bdb66850257003be 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/CombinedVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/CombinedVolumeBounds.cxx @@ -80,7 +80,7 @@ Trk::CombinedVolumeBounds& Trk::CombinedVolumeBounds::operator=(const Trk::Combi return *this; } -const std::vector<const Trk::Surface*>* Trk::CombinedVolumeBounds::decomposeToSurfaces(const Amg::Transform3D& transf) const +const std::vector<const Trk::Surface*>* Trk::CombinedVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transf) const { std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/CuboidVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/CuboidVolumeBounds.cxx index 30c0d9e4febd14613ae8f33948f67f0b62582f79..0717995df2199f3f9c5a08d1032835506308b17a 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/CuboidVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/CuboidVolumeBounds.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -57,7 +57,7 @@ Trk::CuboidVolumeBounds& Trk::CuboidVolumeBounds::operator=(const Trk::CuboidVol return *this; } -const std::vector<const Trk::Surface*>* Trk::CuboidVolumeBounds::decomposeToSurfaces(const Amg::Transform3D& transform) const +const std::vector<const Trk::Surface*>* Trk::CuboidVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const { std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/CylinderVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/CylinderVolumeBounds.cxx index 6bdceed3aa00221b4bb26dbc237d960476535629..6200f44cd7589f5797f2a2c8b0b7e1e36612d38e 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/CylinderVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/CylinderVolumeBounds.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -86,7 +86,7 @@ Trk::CylinderVolumeBounds& Trk::CylinderVolumeBounds::operator=(const Trk::Cylin } -const std::vector<const Trk::Surface*>* Trk::CylinderVolumeBounds::decomposeToSurfaces(const Amg::Transform3D& transform) const +const std::vector<const Trk::Surface*>* Trk::CylinderVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const { std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; // memory optimisation --- reserve the maximum diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/DoubleTrapezoidVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/DoubleTrapezoidVolumeBounds.cxx index 74fea0c561f8d542f15bf55682f8055cf2d2b12b..575b38d5dc415427f104360b0648b9423bcb1cb3 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/DoubleTrapezoidVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/DoubleTrapezoidVolumeBounds.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -81,7 +81,7 @@ Trk::DoubleTrapezoidVolumeBounds& Trk::DoubleTrapezoidVolumeBounds::operator=(co return *this; } -const std::vector<const Trk::Surface*>* Trk::DoubleTrapezoidVolumeBounds::decomposeToSurfaces(const Amg::Transform3D& transform) const +const std::vector<const Trk::Surface*>* Trk::DoubleTrapezoidVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const { std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/PrismVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/PrismVolumeBounds.cxx index 2ca3cb6f5f7b5dd52f7102c2f636c228c583956f..eaab739e292098d24186be470f6f02a0c0d40dcb 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/PrismVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/PrismVolumeBounds.cxx @@ -85,7 +85,7 @@ Trk::PrismVolumeBounds& Trk::PrismVolumeBounds::operator=(const Trk::PrismVolume return *this; } -const std::vector<const Trk::Surface*>* Trk::PrismVolumeBounds::decomposeToSurfaces(const Amg::Transform3D& transform) const +const std::vector<const Trk::Surface*>* Trk::PrismVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const { std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/SimplePolygonBrepVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/SimplePolygonBrepVolumeBounds.cxx index eb7ce4c99d43153830ce6c2cab224e72ac3982d0..021f41e512bb288c2b58d174c0596a09f25b04df 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/SimplePolygonBrepVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/SimplePolygonBrepVolumeBounds.cxx @@ -135,7 +135,7 @@ Trk::SimplePolygonBrepVolumeBounds& Trk::SimplePolygonBrepVolumeBounds::operator return *this; } -const std::vector<const Trk::Surface*>* Trk::SimplePolygonBrepVolumeBounds::decomposeToSurfaces(const Amg::Transform3D& transform) const +const std::vector<const Trk::Surface*>* Trk::SimplePolygonBrepVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const { std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/SubtractedVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/SubtractedVolumeBounds.cxx index 6342d268c59f7bad983491309d0ad19e1b3fd607..d9cd15ee0bf1730a3e9c3a0fa287aca72ef4eee5 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/SubtractedVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/SubtractedVolumeBounds.cxx @@ -76,7 +76,7 @@ Trk::SubtractedVolumeBounds& Trk::SubtractedVolumeBounds::operator=(const Trk::S return *this; } -const std::vector<const Trk::Surface*>* Trk::SubtractedVolumeBounds::decomposeToSurfaces(const Amg::Transform3D& transf) const +const std::vector<const Trk::Surface*>* Trk::SubtractedVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transf) const { //double tol=0.001; // get surfaces for outer boundaries diff --git a/Tracking/TrkDetDescr/TrkVolumes/src/TrapezoidVolumeBounds.cxx b/Tracking/TrkDetDescr/TrkVolumes/src/TrapezoidVolumeBounds.cxx index cfab7ca3662b4835ac94d114cbc213bc30a82c98..af0d333b47a6196cc53fa3cdc40823790c19a017 100755 --- a/Tracking/TrkDetDescr/TrkVolumes/src/TrapezoidVolumeBounds.cxx +++ b/Tracking/TrkDetDescr/TrkVolumes/src/TrapezoidVolumeBounds.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -90,7 +90,7 @@ Trk::TrapezoidVolumeBounds& Trk::TrapezoidVolumeBounds::operator=(const Trk::Tra return *this; } -const std::vector<const Trk::Surface*>* Trk::TrapezoidVolumeBounds::decomposeToSurfaces(const Amg::Transform3D& transform) const +const std::vector<const Trk::Surface*>* Trk::TrapezoidVolumeBounds::decomposeToSurfaces ATLAS_NOT_THREAD_SAFE (const Amg::Transform3D& transform) const { std::vector<const Trk::Surface*>* retsf = new std::vector<const Trk::Surface*>; diff --git a/Tracking/TrkEventCnv/TrkTruthAthenaPool/src/PRD_MultiTruthCollectionCnv.cxx b/Tracking/TrkEventCnv/TrkTruthAthenaPool/src/PRD_MultiTruthCollectionCnv.cxx index c0b67d92ae3db88847be183bf479f1521e382cfd..86c520c49589c5f1b63be9f1ecceb7eb8781f876 100755 --- a/Tracking/TrkEventCnv/TrkTruthAthenaPool/src/PRD_MultiTruthCollectionCnv.cxx +++ b/Tracking/TrkEventCnv/TrkTruthAthenaPool/src/PRD_MultiTruthCollectionCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "PRD_MultiTruthCollectionCnv.h" @@ -33,7 +33,7 @@ PRD_MultiTruthCollectionPERS* PRD_MultiTruthCollectionCnv::createPersistent(PRD_ //================================================================ PRD_MultiTruthCollection* PRD_MultiTruthCollectionCnv::createTransient() { MsgStream log(msgSvc(), "PRD_MultiTruthCollectionCnv" ); - std::auto_ptr<PRD_MultiTruthCollection> trans(new PRD_MultiTruthCollection()); + std::unique_ptr<PRD_MultiTruthCollection> trans(new PRD_MultiTruthCollection()); if (compareClassGuid(s_p3_guid)) { log<<MSG::DEBUG<<"Read PRD_MultiTruthCollection_p3. GUID="<<m_classID.toString()<<endmsg; diff --git a/Tracking/TrkEventCnv/TrkTruthAthenaPool/src/TrackTruthCollectionCnv.cxx b/Tracking/TrkEventCnv/TrkTruthAthenaPool/src/TrackTruthCollectionCnv.cxx index 16843da67d4d52bcb7957987a24e0884bde3b987..3113193a78e3b293c01805b69114cdef1a381c03 100755 --- a/Tracking/TrkEventCnv/TrkTruthAthenaPool/src/TrackTruthCollectionCnv.cxx +++ b/Tracking/TrkEventCnv/TrkTruthAthenaPool/src/TrackTruthCollectionCnv.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrackTruthCollectionCnv.h" @@ -43,7 +43,7 @@ TrackTruthCollectionPERS* TrackTruthCollectionCnv::createPersistent(TrackTruthCo //================================================================ TrackTruthCollection* TrackTruthCollectionCnv::createTransient() { MsgStream log(msgSvc(), "TrackTruthCollectionCnv" ); - std::auto_ptr<TrackTruthCollection> trans(new TrackTruthCollection()); + std::unique_ptr<TrackTruthCollection> trans(new TrackTruthCollection()); if (compareClassGuid(s_p2_guid)) { log<<MSG::DEBUG<<"Read TrackTruthCollection_p2. GUID="<<m_classID.toString()<<endmsg; diff --git a/Tracking/TrkFitter/TrkDistributedKalmanFilter/src/DistributedKalmanFilter.cxx b/Tracking/TrkFitter/TrkDistributedKalmanFilter/src/DistributedKalmanFilter.cxx index e76cf14022ae7e8f5d0a4d9574a16c16b2cce570..31619ef45496be74e5583730233501874a6fc0c0 100755 --- a/Tracking/TrkFitter/TrkDistributedKalmanFilter/src/DistributedKalmanFilter.cxx +++ b/Tracking/TrkFitter/TrkDistributedKalmanFilter/src/DistributedKalmanFilter.cxx @@ -116,7 +116,7 @@ StatusCode Trk::DistributedKalmanFilter::finalize() // helper operator for STL min_element -struct minTrkPar : public std::binary_function<const Trk::TrackParameters*, const Trk::TrackParameters*, bool> { +struct minTrkPar { bool operator() (const Trk::TrackParameters* one, const Trk::TrackParameters* two) const { return (one->position().mag() < two->position().mag()); }; diff --git a/Tracking/TrkFitter/TrkFitterUtils/TrkFitterUtils/MeasBaseIndexComparisonFunction.h b/Tracking/TrkFitter/TrkFitterUtils/TrkFitterUtils/MeasBaseIndexComparisonFunction.h index c55150b4c3dbc2cbfcfe956f8c024c938dfeaf55..a5653a220cb3d71aecbb6e01d8ab29c85a3d358b 100755 --- a/Tracking/TrkFitter/TrkFitterUtils/TrkFitterUtils/MeasBaseIndexComparisonFunction.h +++ b/Tracking/TrkFitter/TrkFitterUtils/TrkFitterUtils/MeasBaseIndexComparisonFunction.h @@ -26,21 +26,19 @@ namespace Trk { typedef std::pair<const Trk::MeasurementBase*, int> MeasBaseIndex; - /** @brief class inheriting from std::binary_function to provide - a comparison function, or relational definition, for sorting - MeasurementBase objects in pair with an index. - - This index can be used to keep a link to the original position index - e.g. on a track. As with the objects in TrkEventUtils, the ordering - can be made with respect to a point, direction or straight - line vector. - - @author Wolfgang.Liebig <http://consult.cern.ch/xwho/people/54608> - + /** + * @brief class provides a comparison function, or relational definition, + * for sorting MeasurementBase objects in pair with an index. + * + * This index can be used to keep a link to the original position index + * e.g. on a track. As with the objects in TrkEventUtils, the ordering + * can be made with respect to a point, direction or straight + * line vector. + * + * @author Wolfgang.Liebig <http://consult.cern.ch/xwho/people/54608> + * */ - class MeasBaseIndexComparisonFunction - : public std::binary_function<MeasBaseIndex, - MeasBaseIndex, bool> { + class MeasBaseIndexComparisonFunction { public: //! Default Constructor, default will be sorting towards radius of 0 diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AllignedDynArray.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AllignedDynArray.h index 9573a998dbddcc95c9a72cb76644d8b21f88981a..7fd6db3c5dac7f9893c6c5dccd82d3ad3a006939 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AllignedDynArray.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/AllignedDynArray.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -14,18 +14,18 @@ #define GSFUtils_AllignedDynArray_H #include <stdlib.h> -namespace GSFUtils{ +namespace GSFUtils { -template<typename T,int Alignment> +template<typename T, int Alignment> /* - * Dynamically allocate un-initialized storage where the storage is - * aligned according to Alignment i.e the storage starts at an adrress - * that should be divisible with Alignment + * Dynamically allocate un-initialized storage where the storage is + * aligned according to Alignment i.e the storage starts at an adrress + * that should be divisible with Alignment * * This is usefull for arrays of simple types like int,float,double - * + * * Notes : - * For fixed size buffers i.e when the size is known at runtime prefer : + * For fixed size buffers i.e when the size is known at runtime prefer : * std::aligned_storage/std::align * */ @@ -36,33 +36,33 @@ public: AlignedDynArray() = delete; AlignedDynArray(AlignedDynArray const&) = delete; AlignedDynArray& operator=(AlignedDynArray const&) = delete; - + explicit AlignedDynArray(size_t n); AlignedDynArray(AlignedDynArray&&); AlignedDynArray& operator=(AlignedDynArray&&); ~AlignedDynArray(); - ///conversions to T* - operator T*(); - operator const T*() const; - - /// index array operators - T& operator [](const std::size_t pos); - const T& operator [](const std::size_t pos) const ; - - ///size of allocated buffer + /// conversions to T* + operator T*(); + operator const T*() const; + + /// index array operators + T& operator[](const std::size_t pos); + const T& operator[](const std::size_t pos) const; + + /// size of allocated buffer std::size_t size() const; private: void cleanup(); - T* m_buffer=nullptr; - void* m_raw=nullptr; - size_t m_size=0; -}; + T* m_buffer = nullptr; + void* m_raw = nullptr; + size_t m_size = 0; +}; -}//namespace GSFUtils +} // namespace GSFUtils -//impl .icc +// impl .icc #include "TrkGaussianSumFilter/AllignedDynArray.icc" #endif diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/ForwardGsfFitter.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/ForwardGsfFitter.h index 8c30a9178fc486c7cee0328f08701c89e2e3708f..6bc6caedc84064179541998f7b8c88393ef0ed35 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/ForwardGsfFitter.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/ForwardGsfFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* ******************************************************************************* @@ -14,9 +14,9 @@ decription : Class definition for the forward GSF fitter #ifndef TrkForwardGsfFitter_H #define TrkForwardGsfFitter_H -#include "TrkGaussianSumFilter/IForwardGsfFitter.h" #include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkFitterUtils/FitterTypes.h" +#include "TrkGaussianSumFilter/IForwardGsfFitter.h" #include "TrkMultiComponentStateOnSurface/MultiComponentState.h" #include "TrkParameters/TrackParameters.h" @@ -40,7 +40,7 @@ public: ForwardGsfFitter(const std::string&, const std::string&, const IInterface*); /** Virtual destructor */ - virtual ~ForwardGsfFitter()= default; + virtual ~ForwardGsfFitter() = default; /** AlgTool initialise method */ virtual StatusCode initialize() override final; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h index 0d072fd51379c4d6c5176e90769a94c588874984..b9786dd38b912abc355cd80dab98b7c7002da0ef 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GaussianSumFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* ******************************************************************************* @@ -48,7 +48,7 @@ public: GaussianSumFitter(const std::string&, const std::string&, const IInterface*); /** Virtual destructor */ - virtual ~GaussianSumFitter()= default; + virtual ~GaussianSumFitter() = default; /** AlgTool initialise method */ virtual StatusCode initialize() override final; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfBetheHeitlerEffects.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfBetheHeitlerEffects.h index 55dcd511558934fafa3955d7891401a91f075a3a..bb1d4a0823166c2b04b3f0506d44246bd66f151d 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfBetheHeitlerEffects.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfBetheHeitlerEffects.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -34,7 +34,7 @@ private: { public: // Default constructor - Polynomial()= default; + Polynomial() = default; /** Constructor from a vector of coefficients (in decreasing order of powers of x */ Polynomial(const std::vector<double>& coefficients) @@ -66,7 +66,7 @@ private: public: GsfBetheHeitlerEffects(const std::string&, const std::string&, const IInterface*); - virtual ~GsfBetheHeitlerEffects()= default; + virtual ~GsfBetheHeitlerEffects() = default; /** AlgTool initialise method */ virtual StatusCode initialize() override final; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfCombinedMaterialEffects.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfCombinedMaterialEffects.h index 7a334c05d39db3892f45af6cd2edebb13a759c61..0a8a65c948e4db14aa470c1358023c315a8bf036 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfCombinedMaterialEffects.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfCombinedMaterialEffects.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -16,8 +16,8 @@ decription : Class definition for consideration of multiple scatter an #define TrkGsfCombinedMaterialEffects_H #include "AthenaBaseComps/AthAlgTool.h" -#include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" #include "GaudiKernel/ToolHandle.h" +#include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" namespace Trk { @@ -46,14 +46,16 @@ public: ParticleHypothesis = nonInteracting) const; private: - ToolHandle<IMultiStateMaterialEffects> m_multipleScatterEffects{ this, - "MultipleScatteringEffects", - "Trk::MultipleScatteringEffects/MultipleScatterEffects", - "" }; + ToolHandle<IMultiStateMaterialEffects> m_multipleScatterEffects{ + this, + "MultipleScatteringEffects", + "Trk::MultipleScatteringEffects/MultipleScatterEffects", + "" + }; ToolHandle<IMultiStateMaterialEffects> m_energyLossEffects{ this, - "EnergyLossEffects", - "Trk::GsfEnergyLossEffects/GsfEnergyLossEffects", - "" }; + "EnergyLossEffects", + "Trk::GsfEnergyLossEffects/GsfEnergyLossEffects", + "" }; ToolHandle<IMultiStateMaterialEffects> m_betheHeitlerEffects{ this, "BetheHeitlerEffects", "Trk::GsfBetheHeitlerEffects/GsfBetheHeitlerEffects", diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfEnergyLossEffects.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfEnergyLossEffects.h index 697d8257cd96c28744bf83abf9715a8f84130e08..ffb2596bce7e157847d47e56b2c19b5930926375 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfEnergyLossEffects.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfEnergyLossEffects.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -19,8 +19,8 @@ decription : Class for describing energy loss effects only. #include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkEventPrimitives/PropDirection.h" #include "TrkExInterfaces/IEnergyLossUpdator.h" -#include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" #include "TrkExUtils/MaterialUpdateMode.h" +#include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" #include "TrkParameters/TrackParameters.h" namespace Trk { @@ -46,7 +46,6 @@ public: /** AlgTool finalise method */ StatusCode finalize() override final; - virtual void compute(IMultiStateMaterialEffects::Cache&, const ComponentParameters&, const MaterialProperties&, @@ -54,7 +53,6 @@ public: PropDirection direction = anyDirection, ParticleHypothesis particleHypothesis = nonInteracting) const override final; - private: ToolHandle<IEnergyLossUpdator> m_EnergyLossUpdator{ this, "EnergyLossUpdator", diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h index b93e1c8afd70d5bd10e462ac33d999b34557844e..3cf533d534804e3f1943e745f98ce2ed81aab302 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfExtrapolator.h @@ -108,7 +108,8 @@ public: const BoundaryCheck& boundaryCheck = true, ParticleHypothesis particleHypothesis = nonInteracting) const override final; - /** - Extrapolation of a MultiComponentState to destination surface without material effects (2) */ + /** - Extrapolation of a MultiComponentState to destination surface without material effects (2) + */ virtual std::unique_ptr<MultiComponentState> extrapolateDirectly( const IPropagator&, const MultiComponentState&, @@ -143,13 +144,15 @@ public: private: struct Cache { - bool m_recall; //!< Flag the recall solution - const Surface* m_recallSurface; //!< Surface for recall - const Layer* m_recallLayer; //!< Layer for recall - const TrackingVolume* m_recallTrackingVolume; //!< Tracking volume for recall - StateAtBoundarySurface m_stateAtBoundarySurface; //!< Instance of structure describing the state at a boundary of tracking volumes + bool m_recall; //!< Flag the recall solution + const Surface* m_recallSurface; //!< Surface for recall + const Layer* m_recallLayer; //!< Layer for recall + const TrackingVolume* m_recallTrackingVolume; //!< Tracking volume for recall + StateAtBoundarySurface m_stateAtBoundarySurface; //!< Instance of structure describing the state + //!< at a boundary of tracking volumes std::unique_ptr<std::vector<const Trk::TrackStateOnSurface*>> m_matstates; - std::vector<std::unique_ptr<const MultiComponentState>>m_mcsGarbageBin; //!< Garbage bin for MultiComponentState objects + std::vector<std::unique_ptr<const MultiComponentState>> + m_mcsGarbageBin; //!< Garbage bin for MultiComponentState objects std::vector<std::unique_ptr<const TrackParameters>> m_tpGarbageBin; //!< Garbage bin for TrackParameter objects Cache() @@ -183,7 +186,8 @@ private: /** Two primary private extrapolation methods - extrapolateToVolumeBoundary - extrapolates to the exit of the destination tracking volume - Exit layer surface will be hit in this method. - - extrapolateInsideVolume - extrapolates to the destination surface in the final tracking volume + - extrapolateInsideVolume - extrapolates to the destination surface in the final tracking + volume */ void extrapolateToVolumeBoundary(Cache& cache, @@ -194,15 +198,16 @@ private: PropDirection direction = anyDirection, ParticleHypothesis particleHypothesis = nonInteracting) const; - std::unique_ptr<MultiComponentState> extrapolateInsideVolume(Cache& cache, - const IPropagator&, - const MultiComponentState&, - const Surface&, - const Layer*, - const TrackingVolume&, - PropDirection direction = anyDirection, - const BoundaryCheck& boundaryCheck = true, - ParticleHypothesis particleHypothesis = nonInteracting) const; + std::unique_ptr<MultiComponentState> extrapolateInsideVolume( + Cache& cache, + const IPropagator&, + const MultiComponentState&, + const Surface&, + const Layer*, + const TrackingVolume&, + PropDirection direction = anyDirection, + const BoundaryCheck& boundaryCheck = true, + ParticleHypothesis particleHypothesis = nonInteracting) const; /** Additional private extrapolation methods */ @@ -217,27 +222,30 @@ private: ParticleHypothesis particleHypothesis = nonInteracting) const; /** Single extrapolation step to an intermediate layer */ - std::unique_ptr<Trk::MultiComponentState> extrapolateToIntermediateLayer(Cache& cache, - const IPropagator&, - const MultiComponentState&, - const Layer&, - const TrackingVolume&, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting, - bool perpendicularCheck = true) const; + std::unique_ptr<Trk::MultiComponentState> extrapolateToIntermediateLayer( + Cache& cache, + const IPropagator&, + const MultiComponentState&, + const Layer&, + const TrackingVolume&, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting, + bool perpendicularCheck = true) const; /** Final extrapolation step to a destination layer */ - std::unique_ptr<Trk::MultiComponentState> extrapolateToDestinationLayer(Cache& cache, - const IPropagator&, - const MultiComponentState&, - const Surface&, - const Layer&, - const Layer*, - PropDirection direction = anyDirection, - const BoundaryCheck& boundaryCheck = true, - ParticleHypothesis particleHypothesis = nonInteracting) const; - - /** Extrapolation to consider material effects assuming all material on active sensor elements - CTB method */ + std::unique_ptr<Trk::MultiComponentState> extrapolateToDestinationLayer( + Cache& cache, + const IPropagator&, + const MultiComponentState&, + const Surface&, + const Layer&, + const Layer*, + PropDirection direction = anyDirection, + const BoundaryCheck& boundaryCheck = true, + ParticleHypothesis particleHypothesis = nonInteracting) const; + + /** Extrapolation to consider material effects assuming all material on active sensor elements - + * CTB method */ std::unique_ptr<Trk::MultiComponentState> extrapolateSurfaceBasedMaterialEffects( const IPropagator&, const MultiComponentState&, @@ -247,17 +255,19 @@ private: ParticleHypothesis particleHypothesis = nonInteracting) const; /** GSF Method to propagate a number of components simultaneously */ - std::unique_ptr<Trk::MultiComponentState> multiStatePropagate(const IPropagator&, - const MultiComponentState&, - const Surface&, - PropDirection direction = anyDirection, - const BoundaryCheck& boundaryCheck = true, - ParticleHypothesis particleHypothesis = nonInteracting) const; + std::unique_ptr<Trk::MultiComponentState> multiStatePropagate( + const IPropagator&, + const MultiComponentState&, + const Surface&, + PropDirection direction = anyDirection, + const BoundaryCheck& boundaryCheck = true, + ParticleHypothesis particleHypothesis = nonInteracting) const; /** Method to choose propagator type */ unsigned int propagatorType(const TrackingVolume& trackingVolume) const; - /** Method to initialise navigation parameters including starting state, layer and volume, and destination volume */ + /** Method to initialise navigation parameters including starting state, layer and volume, and + * destination volume */ void initialiseNavigation(Cache& cache, const IPropagator& propagator, const MultiComponentState& initialState, @@ -331,9 +341,11 @@ private: mutable Gaudi::Accumulators::Counter<int, Gaudi::Accumulators::atomicity::full> m_extrapolateDirectlyCalls; //!< Statistics: Number of calls to the extrapolate directly method mutable Gaudi::Accumulators::Counter<int, Gaudi::Accumulators::atomicity::full> - m_extrapolateDirectlyFallbacks; //!< Statistics: Number of calls to the extrapolate directly fallback + m_extrapolateDirectlyFallbacks; //!< Statistics: Number of calls to the extrapolate directly + //!< fallback mutable Gaudi::Accumulators::Counter<int, Gaudi::Accumulators::atomicity::full> - m_navigationDistanceIncreaseBreaks; //!< Statistics: Number of times navigation stepping fails to go the right way + m_navigationDistanceIncreaseBreaks; //!< Statistics: Number of times navigation stepping fails + //!< to go the right way mutable Gaudi::Accumulators::Counter<int, Gaudi::Accumulators::atomicity::full> m_oscillationBreaks; //!< Statistics: Number of times a tracking volume oscillation is detected mutable Gaudi::Accumulators::Counter<int, Gaudi::Accumulators::atomicity::full> diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialEffectsUpdator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialEffectsUpdator.h index 72cbb8c4ca882e102f2ae5b8262f3eae1487583a..9169d8afdadf1990119fcd84742f40f932785e08 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialEffectsUpdator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialEffectsUpdator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -15,9 +15,9 @@ decription : Material effects for the GsfExtrapolator. It is an Alg #ifndef TrkGsfMaterialEffectsUpdator_H #define TrkGsfMaterialEffectsUpdator_H -#include "TrkGaussianSumFilter/IMultiStateMaterialEffectsUpdator.h" #include "AthenaBaseComps/AthAlgTool.h" #include "GaudiKernel/ToolHandle.h" +#include "TrkGaussianSumFilter/IMultiStateMaterialEffectsUpdator.h" namespace Trk { @@ -48,7 +48,8 @@ public: PropDirection direction = anyDirection, ParticleHypothesis particleHypothesis = nonInteracting) const; - /** Method for updating the state with material effects provided by a material properties object and a pathlength */ + /** Method for updating the state with material effects provided by a material properties object + * and a pathlength */ virtual std::unique_ptr<Trk::MultiComponentState> updateState( const ComponentParameters&, const MaterialProperties&, @@ -56,7 +57,8 @@ public: PropDirection direction = anyDirection, ParticleHypothesis particleHypothesis = nonInteracting) const; - /** Method for the state with material effects provided by the layer object prior to propagation */ + /** Method for the state with material effects provided by the layer object prior to propagation + */ virtual std::unique_ptr<Trk::MultiComponentState> preUpdateState( const ComponentParameters&, const Layer&, @@ -72,15 +74,14 @@ public: private: /** Method to perform centralised calculation of updated state */ - std::unique_ptr<Trk::MultiComponentState> compute( - const ComponentParameters&, - const MaterialProperties&, - double, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const; + std::unique_ptr<Trk::MultiComponentState> compute(const ComponentParameters&, + const MaterialProperties&, + double, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const; /** Method to calculate the updated momentum based on material effects */ - bool updateP(AmgVector(5)&, double) const; + bool updateP(AmgVector(5) &, double) const; private: ToolHandle<IMultiStateMaterialEffects> diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h index 237640503f58f8a1a503163e21e3aaff715c0af8..e91c8a9ed6c1f8e3aad78ccd9681070730689211 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /************************************************************************************* @@ -45,47 +45,44 @@ public: virtual StatusCode finalize() override; //!< Convolution with full material properties - virtual std::unique_ptr<MultiComponentState> - update(const MultiComponentState&, - const Layer&, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const override final; + virtual std::unique_ptr<MultiComponentState> update( + const MultiComponentState&, + const Layer&, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const override final; //!< Convolution with pre-measurement-update material properties - virtual std::unique_ptr<MultiComponentState> - preUpdate(const MultiComponentState&, - const Layer&, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const override final; + virtual std::unique_ptr<MultiComponentState> preUpdate( + const MultiComponentState&, + const Layer&, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const override final; //!< Convolution with post-measurement-update material properties - virtual std::unique_ptr<MultiComponentState> - postUpdate(const MultiComponentState&, - const Layer&, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const override final; + virtual std::unique_ptr<MultiComponentState> postUpdate( + const MultiComponentState&, + const Layer&, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const override final; //!< Retain for now redundant simplified material effects - virtual std::unique_ptr<MultiComponentState> - simplifiedMaterialUpdate(const MultiComponentState& multiComponentState, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const override final; + virtual std::unique_ptr<MultiComponentState> simplifiedMaterialUpdate( + const MultiComponentState& multiComponentState, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const override final; private: - ToolHandle<IMultiStateMaterialEffectsUpdator> m_updator{ - this, - "MaterialEffectsUpdator", - "Trk::GsfMaterialEffectsUpdator/GsfMaterialEffectsUpdator", - "" - }; - + ToolHandle<IMultiStateMaterialEffectsUpdator> m_updator{ this, + "MaterialEffectsUpdator", + "Trk::GsfMaterialEffectsUpdator/GsfMaterialEffectsUpdator", + "" }; + ToolHandle<IMultiComponentStateMerger> m_stateMerger{ this, "MultiComponentStateMerger", "Trk::QuickCloseComponentsMultiStateMerger/MaterialConvolutionMerger", "" }; - }; } // end Trk namespace diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMeasurementUpdator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMeasurementUpdator.h index cdeacfd97ac291bfa47783250af54bcf30f6fdd0..4517c716d4fb54cbbe7833ff03afc3860e10dd46 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMeasurementUpdator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfMeasurementUpdator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -36,7 +36,8 @@ class GsfMeasurementUpdator { private: - /** Private typedef for calling the correct updator member function depending of direction of fitting */ + /** Private typedef for calling the correct updator member function depending of direction of + * fitting */ typedef Trk::TrackParameters* (Trk::IUpdator::*Updator)(const Trk::TrackParameters&, const LocalParameters&, const Amg::MatrixX&, @@ -47,7 +48,7 @@ public: GsfMeasurementUpdator(const std::string&, const std::string&, const IInterface*); /** Virtual destructor */ - virtual ~GsfMeasurementUpdator()= default; + virtual ~GsfMeasurementUpdator() = default; /** AlgTool initialise method */ StatusCode initialize() override; @@ -59,18 +60,19 @@ public: virtual std::unique_ptr<MultiComponentState> update(MultiComponentState&&, const MeasurementBase&) const override final; - /** Method for updating the multi-state with a new measurement and calculate the fit qaulity at the same time*/ + /** Method for updating the multi-state with a new measurement and calculate the fit qaulity at + * the same time*/ virtual std::unique_ptr<MultiComponentState> update( Trk::MultiComponentState&&, const Trk::MeasurementBase&, std::unique_ptr<FitQualityOnSurface>& fitQoS) const override final; /** Method for GSF smoother to calculate unbiased parameters of the multi-component state */ - virtual std::unique_ptr<MultiComponentState> - getUnbiasedTrackParameters(MultiComponentState&&, - const MeasurementBase&) const override final; + virtual std::unique_ptr<MultiComponentState> getUnbiasedTrackParameters(MultiComponentState&&, + const MeasurementBase&) const override final; - /** Method for determining the chi2 of the multi-component state and the number of degrees of freedom */ + /** Method for determining the chi2 of the multi-component state and the number of degrees of + * freedom */ virtual const FitQualityOnSurface* fitQuality(const MultiComponentState&, const MeasurementBase&) const override; private: diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfSmoother.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfSmoother.h index 51d212b9410ec7fc5e671d8a3b90f3c0a3fc7576..441856c4d67e058be867c86194e1a9a3e4766ecb 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfSmoother.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/GsfSmoother.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* ******************************************************************************* @@ -41,7 +41,7 @@ public: GsfSmoother(const std::string&, const std::string&, const IInterface*); /** Virtual destructor */ - virtual ~GsfSmoother()= default; + virtual ~GsfSmoother() = default; /** AlgTool initialise method */ StatusCode initialize(); diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IForwardGsfFitter.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IForwardGsfFitter.h index 65a05598a378e7856605d04658cfaeac39dda178..8354dcf618a6fb5bb3344db4ea641766b6d5718e 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IForwardGsfFitter.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IForwardGsfFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* ******************************************************************************* @@ -14,12 +14,12 @@ decription : Abstract interface for the forward GSF fitter #ifndef TrkIForwardGsfFitter_H #define TrkIForwardGsfFitter_H +#include "GaudiKernel/IAlgTool.h" +#include "GaudiKernel/ToolHandle.h" #include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkFitterUtils/FitterTypes.h" #include "TrkMultiComponentStateOnSurface/MultiComponentState.h" #include "TrkParameters/TrackParameters.h" -#include "GaudiKernel/IAlgTool.h" -#include "GaudiKernel/ToolHandle.h" #include <memory> namespace Trk { @@ -39,7 +39,7 @@ public: static const InterfaceID& interfaceID() { return InterfaceID_ForwardGsfFitter; }; /** Virtual destructor */ - virtual ~IForwardGsfFitter()= default; + virtual ~IForwardGsfFitter() = default; /** Configure the forward GSF fitter - Configure the extrapolator @@ -56,12 +56,13 @@ public: const ParticleHypothesis particleHypothesis = nonInteracting) const = 0; /** Forward GSF fit using MeasurementSet */ - virtual std::unique_ptr<ForwardTrajectory> fitMeasurements( + virtual std::unique_ptr<ForwardTrajectory> fitMeasurements( const MeasurementSet&, const TrackParameters&, const ParticleHypothesis particleHypothesis = nonInteracting) const = 0; - /** The interface will later be extended so that the initial state can be additionally a MultiComponentState object! + /** The interface will later be extended so that the initial state can be additionally a + * MultiComponentState object! */ }; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IGsfSmoother.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IGsfSmoother.h index ab9b63a3a3d8391c7a8fe193461f23971a366322..b60d348354d33f24c2322946189dd30ff2c71d04 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IGsfSmoother.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IGsfSmoother.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* ******************************************************************************* @@ -37,7 +37,7 @@ public: static const InterfaceID& interfaceID() { return InterfaceID_GsfSmoother; }; /** Virtual destructor */ - virtual ~IGsfSmoother()= default; + virtual ~IGsfSmoother() = default; /** Configure the GSF smoother - Configure the extrapolator diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMaterialMixtureConvolution.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMaterialMixtureConvolution.h index d6c224d6771ffc67c4cd8a6cd575f672c7e3e43c..66e51143e654daf4ea0faaafd78673172172db67 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMaterialMixtureConvolution.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMaterialMixtureConvolution.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /************************************************************************************* @@ -14,10 +14,10 @@ decription : Abstract base class for convolution of material effects #ifndef TrkIMaterialMixtureConvolution_H #define TrkIMaterialMixtureConvolution_H +#include "GaudiKernel/IAlgTool.h" #include "TrkEventPrimitives/ParticleHypothesis.h" #include "TrkEventPrimitives/PropDirection.h" #include "TrkMultiComponentStateOnSurface/MultiComponentState.h" -#include "GaudiKernel/IAlgTool.h" namespace Trk { class Layer; @@ -31,34 +31,33 @@ public: static const InterfaceID& interfaceID() { return IID_IMaterialMixtureConvolution; }; //!< Virtual destructor - virtual ~IMaterialMixtureConvolution()= default; + virtual ~IMaterialMixtureConvolution() = default; //!< Convolution with full material properties - virtual std::unique_ptr<MultiComponentState> - update(const MultiComponentState&, - const Layer&, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const = 0; + virtual std::unique_ptr<MultiComponentState> update(const MultiComponentState&, + const Layer&, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const = 0; //!< Convolution with pre-measurement-update material properties - virtual std::unique_ptr<MultiComponentState> - preUpdate(const MultiComponentState&, - const Layer&, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const = 0; + virtual std::unique_ptr<MultiComponentState> preUpdate( + const MultiComponentState&, + const Layer&, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const = 0; //!< Convolution with post-measurement-update material properties - virtual std::unique_ptr<MultiComponentState> - postUpdate(const MultiComponentState&, - const Layer&, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const = 0; + virtual std::unique_ptr<MultiComponentState> postUpdate( + const MultiComponentState&, + const Layer&, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const = 0; //!< Retain for now redundant simplified material effects - virtual std::unique_ptr<MultiComponentState> - simplifiedMaterialUpdate(const MultiComponentState& multiComponentState, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const = 0; + virtual std::unique_ptr<MultiComponentState> simplifiedMaterialUpdate( + const MultiComponentState& multiComponentState, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const = 0; }; } // end Trk namespace diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiComponentStateMerger.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiComponentStateMerger.h index 5c7de6fe6c161d3fd1b3871dbcee2b6d8a7e7194..13e229305be136c835765aaef348aad5ef15c3b8 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiComponentStateMerger.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiComponentStateMerger.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -31,8 +31,8 @@ public: static const InterfaceID& interfaceID() { return IID_IMultiComponentStateMerger; }; /** Abstract base class virtual destructor */ - virtual ~IMultiComponentStateMerger()= default; - + virtual ~IMultiComponentStateMerger() = default; + /** Method for merging components - ownership of objects is passed */ virtual std::unique_ptr<MultiComponentState> merge(Trk::MultiComponentState) const = 0; }; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h index 89f5347c47e7c170ffebe52fc5bcc712df6e0d46..5e967d24c120b0c2c2af07f92ca53cfd6dbe87ac 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateExtrapolator.h @@ -23,8 +23,8 @@ decription : Extrapolation of a MultiComponentState to a destination #include "TrkSurfaces/BoundaryCheck.h" #include "GaudiKernel/IAlgTool.h" -#include <vector> #include <memory> +#include <vector> namespace Trk { class IPropagator; @@ -39,7 +39,7 @@ class IMultiStateExtrapolator : virtual public IAlgTool { public: /** Virtual destructor */ - virtual ~IMultiStateExtrapolator()= default; + virtual ~IMultiStateExtrapolator() = default; /** AlgTool interface method */ static const InterfaceID& interfaceID() { return IID_IMultiStateExtrapolator; }; @@ -53,7 +53,8 @@ public: const BoundaryCheck& boundaryCheck = true, ParticleHypothesis particleHypothesis = nonInteracting) const = 0; - /** - Extrapolation of a MultiComponentState to destination surface without material effects (2) */ + /** - Extrapolation of a MultiComponentState to destination surface without material effects (2) + */ virtual std::unique_ptr<MultiComponentState> extrapolateDirectly( const IPropagator&, const MultiComponentState&, @@ -78,7 +79,7 @@ public: const BoundaryCheck& boundaryCheck = true, ParticleHypothesis particleHypothesis = nonInteracting) const = 0; - virtual std::unique_ptr<std::vector<const Trk::TrackStateOnSurface*>> extrapolateM( + virtual std::unique_ptr<std::vector<const Trk::TrackStateOnSurface*>> extrapolateM( const MultiComponentState&, const Surface&, PropDirection dir = anyDirection, diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h index fbc851c3f02c8b43fceee88aa934469ea700a520..44ab3d9bb682af77ad6f400b382806aa7ed9ee5b 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffects.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /************************************************************************************* @@ -66,7 +66,7 @@ public: static const InterfaceID& interfaceID() { return IID_IMultiStateMaterialEffects; }; /** virtual destructor */ - virtual ~IMultiStateMaterialEffects()= default; + virtual ~IMultiStateMaterialEffects() = default; virtual void compute(IMultiStateMaterialEffects::Cache&, const ComponentParameters&, diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffectsUpdator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffectsUpdator.h index 17b15925fde4f92190cd2788193b9906c5f5e819..9d614f1e6775b66e2e8af275a16943fd1ad29212 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffectsUpdator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMaterialEffectsUpdator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -37,32 +37,36 @@ public: static const InterfaceID& interfaceID() { return IID_IMultiStateMaterialEffectsUpdator; }; /** Virtual destructor */ - virtual ~IMultiStateMaterialEffectsUpdator()= default; + virtual ~IMultiStateMaterialEffectsUpdator() = default; /** Method for updating the state with material effects provided by the layer object */ virtual std::unique_ptr<Trk::MultiComponentState> updateState(const ComponentParameters&, - const Layer&, - PropDirection direction = alongMomentum, - ParticleHypothesis = nonInteracting) const = 0; + const Layer&, + PropDirection direction = alongMomentum, + ParticleHypothesis = nonInteracting) const = 0; - /** Method for updating the state with material effects provided by a material properties object and a pathlength */ + /** Method for updating the state with material effects provided by a material properties object + * and a pathlength */ virtual std::unique_ptr<Trk::MultiComponentState> updateState(const ComponentParameters&, - const MaterialProperties&, - double, - PropDirection = alongMomentum, - ParticleHypothesis = nonInteracting) const = 0; - - /** Method for the state with material effects provided by the layer object prior to propagation */ - virtual std::unique_ptr<Trk::MultiComponentState> preUpdateState(const ComponentParameters&, - const Layer&, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const = 0; + const MaterialProperties&, + double, + PropDirection = alongMomentum, + ParticleHypothesis = nonInteracting) const = 0; + + /** Method for the state with material effects provided by the layer object prior to propagation + */ + virtual std::unique_ptr<Trk::MultiComponentState> preUpdateState( + const ComponentParameters&, + const Layer&, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const = 0; /** Method for the state with material effects provided by the layer object after propagation */ - virtual std::unique_ptr<Trk::MultiComponentState> postUpdateState(const ComponentParameters&, - const Layer&, - PropDirection direction = anyDirection, - ParticleHypothesis particleHypothesis = nonInteracting) const = 0; + virtual std::unique_ptr<Trk::MultiComponentState> postUpdateState( + const ComponentParameters&, + const Layer&, + PropDirection direction = anyDirection, + ParticleHypothesis particleHypothesis = nonInteracting) const = 0; }; } // end Trk namespace diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMeasurementUpdator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMeasurementUpdator.h index 388a04937849dc9685dea589200ab7243d0df5a2..b2dae07554e7d57c0cfabac1903902dd8636d1ee 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMeasurementUpdator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/IMultiStateMeasurementUpdator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -34,12 +34,13 @@ public: static const InterfaceID& interfaceID() { return IID_IMultiStateMeasurementUpdator; }; /** Virtual destructor */ - virtual ~IMultiStateMeasurementUpdator()= default; + virtual ~IMultiStateMeasurementUpdator() = default; /** Method for forward filters to incorporate measurement updates */ virtual std::unique_ptr<MultiComponentState> update(MultiComponentState&&, const MeasurementBase&) const = 0; - /** Method for updating the multi-state with a new measurement and calculate the fit qaulity at the same time*/ + /** Method for updating the multi-state with a new measurement and calculate the fit qaulity at + * the same time*/ virtual std::unique_ptr<MultiComponentState> update(Trk::MultiComponentState&&, const Trk::MeasurementBase&, std::unique_ptr<FitQualityOnSurface>& fitQoS) const = 0; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h index 88fc4662abae2770adaa5a3ba79df2c523f816b2..55ccc81a8f60e6d197cef97bf89d346db10126bb 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/KLGaussianMixtureReduction.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -7,7 +7,7 @@ ------------------------------------------------- begin : 26th November 2019 author : amorley, Christos -decription : Function that help implement a +decription : Function that help implement a "Kullback-Leibler Approach to Gaussian Mixture Reduction" *********************************************************************************/ @@ -15,31 +15,30 @@ decription : Function that help implement a #define KLGaussianMixReductionUtils_H #include "CxxUtils/restrict.h" -#include <utility> +#include <utility> -namespace GSFUtils{ +namespace GSFUtils { - -/** - * Assuming 0..... N (N+1 elements) +/** + * Assuming 0..... N (N+1 elements) * the pairwise distance matrix can be represented in a trangular way: * * [ (0,0)............... * [ (1,0), (1,1)........ - * [ (2,0), (2,1), (2,2) + * [ (2,0), (2,1), (2,2) * [....................... * [............................. * [...................................(N,N)] * - * Stored as + * Stored as * [(0,0),(1,0),(1,1),(2,0),(2,1),(2,2)...... (N,N)] * with size N*(N+1)/2 - * - * In the following methods: - * qonpIn,qonpCovIn,qonpGIn have size N+1 [0......N] + * + * In the following methods: + * qonpIn,qonpCovIn,qonpGIn have size N+1 [0......N] * distancesIn has size N*(N+1)/2 * - * We also want to map the position in the distance array to the (i,j) of + * We also want to map the position in the distance array to the (i,j) of * the elements * 0--> (0,0) * 1-->(1,0) @@ -47,36 +46,39 @@ namespace GSFUtils{ * */ -struct triangularToIJ{ - int I=-1; - int J=-1; +struct triangularToIJ +{ + int I = -1; + int J = -1; }; - + typedef float* ATH_RESTRICT floatPtrRestrict; -constexpr int alignment =32; +constexpr int alignment = 32; // Recalculate the distances for a row of pairs and return the index of the minimum pair -int recalculateDistances(floatPtrRestrict qonpIn, - floatPtrRestrict qonpCovIn, - floatPtrRestrict qonpGIn, - floatPtrRestrict distancesIn, - int mini, - int n); +int +recalculateDistances(floatPtrRestrict qonpIn, + floatPtrRestrict qonpCovIn, + floatPtrRestrict qonpGIn, + floatPtrRestrict distancesIn, + int mini, + int n); // Calculate the distances for all pairs -void calculateAllDistances(floatPtrRestrict qonpIn, - floatPtrRestrict qonpCovIn, - floatPtrRestrict qonpGIn, - floatPtrRestrict distancesIn, - int n) ; +void +calculateAllDistances(floatPtrRestrict qonpIn, + floatPtrRestrict qonpCovIn, + floatPtrRestrict qonpGIn, + floatPtrRestrict distancesIn, + int n); // Reset the distances for a row -void resetDistances(floatPtrRestrict distancesIn, const int mini, const int n) ; - - -std::pair<int, int> findMinimumIndex(const floatPtrRestrict distancesIn, const int n) ; +void +resetDistances(floatPtrRestrict distancesIn, const int mini, const int n); -}//namespace KLGaussianMixtureReduction +std::pair<int, int> +findMinimumIndex(const floatPtrRestrict distancesIn, const int n); +} // namespace KLGaussianMixtureReduction #endif diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateAssembler.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateAssembler.h index 7a57ece4a2d3d7685a92b366fcca414f63a6ab2d..7069333e9fadd83af0dc70d9c41e802662aa9027 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateAssembler.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateAssembler.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -26,7 +26,6 @@ description : This is a helper class to collect components of a #include <memory> #include <vector> - namespace Trk { namespace MultiComponentStateAssembler { @@ -38,7 +37,10 @@ struct Cache , invalidWeightSum{ 0 } , minimumValidFraction{ 0.01 } , minimumFractionalWeight{ 1e-09 } - , assemblyDone{ false } { multiComponentState.reserve(72); } + , assemblyDone{ false } + { + multiComponentState.reserve(72); + } Trk::MultiComponentState multiComponentState; double validWeightSum; double invalidWeightSum; @@ -51,7 +53,7 @@ struct Cache void reset(Cache& cache); -/** Method to add a single set of Trk::ComponentParameters to the cached Trk::MultiComponentState +/** Method to add a single set of Trk::ComponentParameters to the cached Trk::MultiComponentState * object under construction */ bool addComponent(Cache& cache, ComponentParameters&&); @@ -71,14 +73,14 @@ addInvalidComponentWeight(Cache& cache, const double); std::unique_ptr<MultiComponentState> assembledState(Cache& cache); -/** Method to return the cached state object - +/** Method to return the cached state object - * it performs a reweighting based on the input parameter */ std::unique_ptr<MultiComponentState> assembledState(Cache& cache, const double); /** Method to Check component entries before full assembly */ bool -prepareStateForAssembly(Cache& cache) ; +prepareStateForAssembly(Cache& cache); /** Method to assemble state with correct weightings */ std::unique_ptr<MultiComponentState> @@ -88,7 +90,7 @@ doStateAssembly(Cache& cache, const double); bool isStateValid(const Cache& cache); -}//End MultiComponentStateAssembler namespace +} // End MultiComponentStateAssembler namespace typedef MultiComponentStateAssembler::Cache Cache; } // End Trk namepace diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateCombiner.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateCombiner.h index 06ff55ea44b4577b53e79db42479959b182774f5..ad65f1117fb85c1ecfb1e4cbb7aa1edc339673a7 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateCombiner.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateCombiner.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /******************************************************************************* @@ -23,26 +23,18 @@ namespace MultiComponentStateCombiner { /** Calculate combined state of many components */ std::unique_ptr<Trk::TrackParameters> -combine(const MultiComponentState&, - const bool useMode = false, - const double fractionPDFused = 1.0); - +combine(const MultiComponentState&, const bool useMode = false, const double fractionPDFused = 1.0); /** Combined/merge a component to another one */ void -combineWithWeight(Trk::ComponentParameters& mergeTo, - const Trk::ComponentParameters& addThis); +combineWithWeight(Trk::ComponentParameters& mergeTo, const Trk::ComponentParameters& addThis); /** Calculate combined state and weight of many components */ std::unique_ptr<Trk::ComponentParameters> -combineWithWeight(const MultiComponentState&, - const bool useMode = false, - const double fractionPDFused = 1.0); +combineWithWeight(const MultiComponentState&, const bool useMode = false, const double fractionPDFused = 1.0); std::unique_ptr<Trk::ComponentParameters> -compute(const MultiComponentState*, - const bool useMode = false, - const double fractionPDFused = 1.0); +compute(const MultiComponentState*, const bool useMode = false, const double fractionPDFused = 1.0); } } // end Trk namespace diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateModeCalculator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateModeCalculator.h old mode 100755 new mode 100644 index f29fa688038ec7d6cfd5c175fc98a147a996ae9a..7a21a20efeff8d0fb2bfcff31af360c08397840b --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateModeCalculator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultiComponentStateModeCalculator.h @@ -21,49 +21,67 @@ description : Class to calculate the mode (q/p) of a gaussian mixtureAr namespace Trk { namespace MultiComponentStateModeCalculator { -struct Component { +struct Component +{ // Default ctors/dtor/assignment operators Component() = default; ~Component() = default; - Component(const Component &) = default; - Component &operator=(const Component &) = default; - Component(Component &&) = default; - Component &operator=(Component &&) = default; + Component(const Component&) = default; + Component& operator=(const Component&) = default; + Component(Component&&) = default; + Component& operator=(Component&&) = default; // Constructor with arguments Component(double aWeight, double aMean, double aSigma) - : weight(aWeight), mean(aMean), sigma(aSigma) {} + : weight(aWeight) + , mean(aMean) + , sigma(aSigma) + {} double weight = 0; double mean = 0; double sigma = 0; }; //!< IMultiComponentStateModeCalculator interface method to calculate mode -std::array<double,10> calculateMode(const MultiComponentState &); +std::array<double, 10> +calculateMode(const MultiComponentState&); //!< method to extract the weight, mean and sigma values from the multi-component state -void fillMixture(const MultiComponentState &, std::array<std::vector<Component>, 5> &mixture); +void +fillMixture(const MultiComponentState&, std::array<std::vector<Component>, 5>& mixture); //!< method to find the mode using the Newton-Raphson method based on a starting guess -double findMode(double, int, const std::array<std::vector<Component>, 5> &mixture); +double +findMode(double, int, const std::array<std::vector<Component>, 5>& mixture); //!< method to determine the pdf of the cashed mixture at a given value -double pdf(double, int, const std::array<std::vector<Component>, 5> &mixture); +double +pdf(double, int, const std::array<std::vector<Component>, 5>& mixture); //!< method to determine the first order derivative of the pdf at a given value -double d1pdf(double, int, const std::array<std::vector<Component>, 5> &mixture); +double +d1pdf(double, int, const std::array<std::vector<Component>, 5>& mixture); //!< method to determine the second order derivative of the pdf at a given value -double d2pdf(double, int, const std::array<std::vector<Component>, 5> &mixture); +double +d2pdf(double, int, const std::array<std::vector<Component>, 5>& mixture); //!< method to determine the value of the a gaussian distribution at a given value -double gaus(double x, double mean, double sigma); - -double findModeGlobal(double, int, const std::array<std::vector<Component>, 5> &mixture); - -double width(int i, const std::array<std::vector<Component>, 5> &mixture); - -double findRoot(double &result, double xlo, double xhi, double value, double i, - const std::array<std::vector<Component>, 5> &mixture); +double +gaus(double x, double mean, double sigma); + +double +findModeGlobal(double, int, const std::array<std::vector<Component>, 5>& mixture); + +double +width(int i, const std::array<std::vector<Component>, 5>& mixture); + +double +findRoot(double& result, + double xlo, + double xhi, + double value, + double i, + const std::array<std::vector<Component>, 5>& mixture); } // namespace MultiComponentStateModeCalculator diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultipleScatteringEffects.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultipleScatteringEffects.h index 347961e217bcc60bd105655d93ab532da0d07cf6..c8e9ed201fd8bc3c3636e911ccdfd5f507c85ade 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultipleScatteringEffects.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/MultipleScatteringEffects.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -16,9 +16,9 @@ decription : Class for describing multiple scattering effects only. #include "AthenaBaseComps/AthAlgTool.h" #include "TrkEventPrimitives/PropDirection.h" -#include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" #include "TrkExInterfaces/IMultipleScatteringUpdator.h" #include "TrkExUtils/MaterialUpdateMode.h" +#include "TrkGaussianSumFilter/IMultiStateMaterialEffects.h" #include "TrkParameters/TrackParameters.h" #include "GaudiKernel/ToolHandle.h" diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/PosteriorWeightsCalculator.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/PosteriorWeightsCalculator.h index c755905f8572c076ea97b0aaf7e9e4b4ce2e667a..05e1f0ba35700a14e6e69a7ed5511b2718af0c9c 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/PosteriorWeightsCalculator.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/PosteriorWeightsCalculator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -23,18 +23,14 @@ description : Class to calculate the weighting of state components #include "TrkMultiComponentStateOnSurface/MultiComponentState.h" #include "TrkParameters/TrackParameters.h" - namespace Trk { -class PosteriorWeightsCalculator +class PosteriorWeightsCalculator { public: - - std::unique_ptr<std::vector<Trk::ComponentParameters>> weights(MultiComponentState&&, - const MeasurementBase&) const; + std::unique_ptr<std::vector<Trk::ComponentParameters>> weights(MultiComponentState&&, const MeasurementBase&) const; private: - /** Function to calculate the determinant and chi2 of a measurement for a 1D hit */ std::pair<double, double> calculateWeight_1D(const TrackParameters* componentTrackParameters, const AmgSymMatrix(5) * predictedCov, @@ -74,8 +70,8 @@ PosteriorWeightsCalculator::calculateWeight_T(const TrackParameters* componentTr // Calculate the residual AmgVector(DIM) r = measPar - H * componentTrackParameters->parameters(); - // Residual covariance. Posterior weights is calculated used predicted state and measurement. Therefore add - // covariances + // Residual covariance. Posterior weights is calculated used predicted state and measurement. + // Therefore add covariances AmgSymMatrix(DIM) R(measCov + H * (*predictedCov) * H.transpose()); // compute determinant of residual @@ -83,10 +79,10 @@ PosteriorWeightsCalculator::calculateWeight_T(const TrackParameters* componentTr if (det == 0) { // ATH_MSG_WARNING( "Determinant is 0, cannot invert matrix... Ignoring component" ); - return std::pair<double,double>(0,0) ; + return std::pair<double, double>(0, 0); } // Compute Chi2 - return std::pair<double,double> (det,(1. / (double)DIM) * ((r.transpose() * R.inverse() * r)(0, 0))); + return std::pair<double, double>(det, (1. / (double)DIM) * ((r.transpose() * R.inverse() * r)(0, 0))); } } // end Trk namespace diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/QuickCloseComponentsMultiStateMerger.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/QuickCloseComponentsMultiStateMerger.h index ba9aa8e4b486167f27c7cc7b453aa7fe25d6c910..3b87372c5ccb0a49bd15182ff69bcf9d360f2c00 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/QuickCloseComponentsMultiStateMerger.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/QuickCloseComponentsMultiStateMerger.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -21,11 +21,10 @@ decription : Class for merging components of a multi-state based on #include "GaudiKernel/ServiceHandle.h" #include "GaudiKernel/ToolHandle.h" -#include "TrkGaussianSumFilter/MultiComponentStateAssembler.h" #include "TrkGaussianSumFilter/IMultiComponentStateMerger.h" +#include "TrkGaussianSumFilter/MultiComponentStateAssembler.h" #include "TrkGaussianSumFilter/SortingClasses.h" - namespace Trk { class IMultiComponentStateCombiner; @@ -61,9 +60,7 @@ private: ServiceHandle<IChronoStatSvc> m_chronoSvc; //!< Timing: The Gaudi time auditing service std::unique_ptr<MultiComponentState> mergeFullDistArray(MultiComponentStateAssembler::Cache& cache, - Trk::MultiComponentState& ) const; - - + Trk::MultiComponentState&) const; }; } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/SortingClasses.h b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/SortingClasses.h index 3fbf08923785cdf229e8d739afff8998b1d6b652..cb1ec50e85b7e11e4a75f5825434d52ed973d617 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/SortingClasses.h +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/TrkGaussianSumFilter/SortingClasses.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -21,7 +21,7 @@ namespace Trk { class SortByLargerComponentWeight { public: - SortByLargerComponentWeight()= default; + SortByLargerComponentWeight() = default; bool operator()(const ComponentParameters firstComponent, const ComponentParameters secondComponent) const { return firstComponent.second > secondComponent.second; @@ -31,7 +31,7 @@ public: class SortByLargerWeight { public: - SortByLargerWeight()= default; + SortByLargerWeight() = default; bool operator()(const double& firstWeight, const double& secondWeight) const { return firstWeight > secondWeight; } }; @@ -39,7 +39,7 @@ class SortBySmallerWeight { public: - SortBySmallerWeight()= default; + SortBySmallerWeight() = default; bool operator()(const double& firstWeight, const double& secondWeight) const { return firstWeight < secondWeight; } }; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/ForwardGsfFitter.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/ForwardGsfFitter.cxx index 273965a5e62b0b2468950a4cb3112dc6e220c18a..c3a648b130fa7276594a0c745bd988e13e5832a7 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/ForwardGsfFitter.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/ForwardGsfFitter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* ******************************************************************************* @@ -15,9 +15,9 @@ decription : Implementation code for ForwardGsfFitter class #include "TrkMultiComponentStateOnSurface/MultiComponentStateOnSurface.h" -#include "TrkGaussianSumFilter/MultiComponentStateCombiner.h" #include "TrkGaussianSumFilter/IMultiStateExtrapolator.h" #include "TrkGaussianSumFilter/IMultiStateMeasurementUpdator.h" +#include "TrkGaussianSumFilter/MultiComponentStateCombiner.h" #include "TrkDetElementBase/TrkDetElementBase.h" #include "TrkEventPrimitives/FitQuality.h" @@ -45,13 +45,14 @@ StatusCode Trk::ForwardGsfFitter::initialize() { - ATH_MSG_DEBUG( "A cut on Chi2 / NDOF: " << m_cutChiSquaredPerNumberDOF << " will be applied"); + ATH_MSG_DEBUG("A cut on Chi2 / NDOF: " << m_cutChiSquaredPerNumberDOF << " will be applied"); Trk::ParticleSwitcher particleSwitcher; m_overideParticleHypothesis = particleSwitcher.particle[m_overideMaterialEffects]; - if (m_overideMaterialEffectsSwitch){ - ATH_MSG_INFO("Material effects in forwards fitter have been overiden by jobOptions... New Trk::ParticleHypothesis: " - << m_overideMaterialEffects); + if (m_overideMaterialEffectsSwitch) { + ATH_MSG_INFO("Material effects in forwards fitter have been overiden by jobOptions... New " + "Trk::ParticleHypothesis: " + << m_overideMaterialEffects); } ATH_MSG_INFO("Initialisation of " << name() << " was successful"); @@ -89,15 +90,14 @@ Trk::ForwardGsfFitter::fitPRD(const Trk::PrepRawDataSet& inputPrepRawDataSet, const Trk::ParticleHypothesis particleHypothesis) const { - // Check that the updator is instansiated if (!m_updator) { - ATH_MSG_ERROR ("The measurement updator is not configured... Exiting!"); + ATH_MSG_ERROR("The measurement updator is not configured... Exiting!"); return nullptr; } if (!m_extrapolator) { - ATH_MSG_ERROR("The extrapolator is not configured... Exiting!"); + ATH_MSG_ERROR("The extrapolator is not configured... Exiting!"); return nullptr; } @@ -114,23 +114,22 @@ Trk::ForwardGsfFitter::fitPRD(const Trk::PrepRawDataSet& inputPrepRawDataSet, // Configure for forwards filtering material effects overide Trk::ParticleHypothesis configuredParticleHypothesis; - if (m_overideMaterialEffectsSwitch){ + if (m_overideMaterialEffectsSwitch) { configuredParticleHypothesis = m_overideParticleHypothesis; - } - else{ + } else { configuredParticleHypothesis = particleHypothesis; } - // Extract PrepRawDataSet into new local object and check that the PrepRawData is associated with a detector element + // Extract PrepRawDataSet into new local object and check that the PrepRawData is associated with + // a detector element Trk::PrepRawDataSet prepRawDataSet; Trk::PrepRawDataSet::const_iterator prepRawData = inputPrepRawDataSet.begin(); for (; prepRawData != inputPrepRawDataSet.end(); ++prepRawData) { - if (!(*prepRawData)->detectorElement()){ + if (!(*prepRawData)->detectorElement()) { ATH_MSG_WARNING("PrepRawData has no Element link... disregard it"); - } - else{ + } else { prepRawDataSet.push_back(*prepRawData); } } @@ -140,12 +139,13 @@ Trk::ForwardGsfFitter::fitPRD(const Trk::PrepRawDataSet& inputPrepRawDataSet, // Prepare the multi-component state. For starting guess this has single component, weight 1 const AmgVector(5)& par = estimatedTrackParametersNearOrigin.parameters(); - + Trk::ComponentParameters componentParametersNearOrigin( estimatedTrackParametersNearOrigin.associatedSurface().createTrackParameters( - par[Trk::loc1], par[Trk::loc2], par[Trk::phi], par[Trk::theta], par[Trk::qOverP], nullptr /*no errors*/),1.); + par[Trk::loc1], par[Trk::loc2], par[Trk::phi], par[Trk::theta], par[Trk::qOverP], nullptr /*no errors*/), + 1.); - auto multiComponentStateNearOrigin =std::make_unique<Trk::MultiComponentState>(); + auto multiComponentStateNearOrigin = std::make_unique<Trk::MultiComponentState>(); multiComponentStateNearOrigin->push_back(std::move(componentParametersNearOrigin)); // Loop over all PrepRawData measurements @@ -198,10 +198,9 @@ Trk::ForwardGsfFitter::fitMeasurements(const Trk::MeasurementSet& inputMeasureme // Configure for forwards filtering material effects overide Trk::ParticleHypothesis configuredParticleHypothesis; - if (m_overideMaterialEffectsSwitch){ + if (m_overideMaterialEffectsSwitch) { configuredParticleHypothesis = m_overideParticleHypothesis; - } - else{ + } else { configuredParticleHypothesis = particleHypothesis; } @@ -215,11 +214,12 @@ Trk::ForwardGsfFitter::fitMeasurements(const Trk::MeasurementSet& inputMeasureme Trk::ComponentParameters componentParametersNearOrigin( estimatedTrackParametersNearOrigin.associatedSurface().createTrackParameters( - par[Trk::loc1], par[Trk::loc2], par[Trk::phi], par[Trk::theta], par[Trk::qOverP], covariance /*no errors*/),1.); + par[Trk::loc1], par[Trk::loc2], par[Trk::phi], par[Trk::theta], par[Trk::qOverP], covariance /*no errors*/), + 1.); auto multiComponentStateNearOrigin = std::make_unique<Trk::MultiComponentState>(); multiComponentStateNearOrigin->push_back(std::move(componentParametersNearOrigin)); - + // Loop over all MeasurementBase objects in set Trk::MeasurementSet::const_iterator measurement = inputMeasurementSet.begin(); @@ -249,7 +249,7 @@ Trk::ForwardGsfFitter::stepForwardFit(ForwardTrajectory* forwardTrajectory, const Trk::PrepRawData* originalPrepRawData, const Trk::MeasurementBase* originalMeasurement, const Trk::Surface& surface, - std::unique_ptr<Trk::MultiComponentState>& updatedState, + std::unique_ptr<Trk::MultiComponentState>& updatedState, const Trk::ParticleHypothesis particleHypothesis) const { // Protect against undefined Measurement or PrepRawData @@ -268,9 +268,9 @@ Trk::ForwardGsfFitter::stepForwardFit(ForwardTrajectory* forwardTrajectory, // ================================================================= std::unique_ptr<Trk::MultiComponentState> extrapolatedState = - m_extrapolator->extrapolate(*updatedState, surface, Trk::alongMomentum, false, particleHypothesis); + m_extrapolator->extrapolate(*updatedState, surface, Trk::alongMomentum, false, particleHypothesis); if (!extrapolatedState) { - ATH_MSG_DEBUG( "Extrapolation failed... returning false"); + ATH_MSG_DEBUG("Extrapolation failed... returning false"); return false; } // ======================= @@ -282,8 +282,7 @@ Trk::ForwardGsfFitter::stepForwardFit(ForwardTrajectory* forwardTrajectory, if (originalMeasurement) { // Clone original MeasurementBase object (refit with no new calibration) measurement.reset(originalMeasurement->clone()); - } - else { + } else { combinedState = MultiComponentStateCombiner::combine(*extrapolatedState); if (!combinedState) { ATH_MSG_WARNING("State combination failed... exiting"); @@ -301,8 +300,8 @@ Trk::ForwardGsfFitter::stepForwardFit(ForwardTrajectory* forwardTrajectory, return false; } std::unique_ptr<Trk::FitQualityOnSurface> fitQuality; - updatedState = m_updator->update( - std::move(*(MultiComponentStateHelpers::clone(*extrapolatedState))), *measurement, fitQuality); + updatedState = + m_updator->update(std::move(*(MultiComponentStateHelpers::clone(*extrapolatedState))), *measurement, fitQuality); if (!updatedState) { ATH_MSG_DEBUG("Measurement update of the state failed... Exiting!"); return false; @@ -322,17 +321,16 @@ Trk::ForwardGsfFitter::stepForwardFit(ForwardTrajectory* forwardTrajectory, std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type(0); type.set(TrackStateOnSurface::Outlier); const Trk::MultiComponentStateOnSurface* multiComponentStateOnSurface = - new MultiComponentStateOnSurface( - measurement.release(), - MultiComponentStateHelpers::clone(*extrapolatedState).release(), - fitQuality.release(), - nullptr, - type); + new MultiComponentStateOnSurface(measurement.release(), + MultiComponentStateHelpers::clone(*extrapolatedState).release(), + fitQuality.release(), + nullptr, + type); forwardTrajectory->push_back(multiComponentStateOnSurface); // Clean up objects associated with removed measurement - updatedState =std::move(extrapolatedState); + updatedState = std::move(extrapolatedState); } else { const Trk::MultiComponentStateOnSurface* multiComponentStateOnSurface = new MultiComponentStateOnSurface(measurement.release(), extrapolatedState.release(), fitQuality.release()); diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx index dc0733ad09e6a160ceda5e176974c26e2ebaf7f0..43d629542b3930c9f50da9867234961e63d34653 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GaussianSumFitter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* ******************************************************************************* @@ -12,11 +12,11 @@ decription : Implementation code for Gaussian Sum Fitter class ********************************************************************************** */ #include "TrkGaussianSumFilter/GaussianSumFitter.h" -#include "TrkGaussianSumFilter/MultiComponentStateCombiner.h" #include "TrkGaussianSumFilter/IForwardGsfFitter.h" #include "TrkGaussianSumFilter/IGsfSmoother.h" #include "TrkGaussianSumFilter/IMultiStateExtrapolator.h" #include "TrkGaussianSumFilter/IMultiStateMeasurementUpdator.h" +#include "TrkGaussianSumFilter/MultiComponentStateCombiner.h" #include "TrkEventUtils/MeasurementBaseComparisonFunction.h" #include "TrkEventUtils/PrepRawDataComparisonFunction.h" @@ -173,7 +173,8 @@ Trk::GaussianSumFitter::finalize() /* ====================================================================================================== Refitting of a track -========================================================================================================= */ +========================================================================================================= +*/ Trk::Track* Trk::GaussianSumFitter::fit(const Trk::Track& inputTrack, @@ -235,7 +236,8 @@ Trk::GaussianSumFitter::fit(const Trk::Track& inputTrack, } - // If refitting of the track is at the PrepRawData level then extract the PrepRawData objects from the input track + // If refitting of the track is at the PrepRawData level then extract the PrepRawData objects from + // the input track else { PrepRawDataSet prepRawDataSet; @@ -279,7 +281,8 @@ Trk::GaussianSumFitter::fit(const Trk::Track& inputTrack, /* ================================================================================================================== Fitting of a set of PrepRawData objects -===================================================================================================================== */ +===================================================================================================================== +*/ Trk::Track* Trk::GaussianSumFitter::fit(const Trk::PrepRawDataSet& prepRawDataSet, @@ -404,7 +407,8 @@ Trk::GaussianSumFitter::fit(const Trk::PrepRawDataSet& prepRawDataSet, /* ================================================================================================ Fitting of a set of MeasurementBase objects -============== ==================================================================================== */ +============== ==================================================================================== +*/ Trk::Track* Trk::GaussianSumFitter::fit(const Trk::MeasurementSet& measurementSet, @@ -457,12 +461,12 @@ Trk::GaussianSumFitter::fit(const Trk::MeasurementSet& measurementSet, Trk::MeasurementBaseComparisonFunction measurementBaseComparisonFunction(estimatedParametersNearOrigin.position(), estimatedParametersNearOrigin.momentum()); - sort(sortedMeasurementSet.begin(), sortedMeasurementSet.end(),measurementBaseComparisonFunction); + sort(sortedMeasurementSet.begin(), sortedMeasurementSet.end(), measurementBaseComparisonFunction); } // Perform GSF forwards fit - new memory allocated in forwards fitter ForwardTrajectory* forwardTrajectory = - m_forwardGsfFitter->fitMeasurements(sortedMeasurementSet, - estimatedParametersNearOrigin, particleHypothesis).release(); + m_forwardGsfFitter->fitMeasurements(sortedMeasurementSet, estimatedParametersNearOrigin, particleHypothesis) + .release(); if (!forwardTrajectory) { ATH_MSG_DEBUG("Forward GSF fit failed... Exiting!"); @@ -689,23 +693,21 @@ Trk::GaussianSumFitter::makePerigee(const Trk::SmoothedTrajectory* smoothedTraje const Trk::TrackStateOnSurface* stateOnSurfaceNearestOrigin = smoothedTrajectory->back(); const Trk::MultiComponentStateOnSurface* multiComponentStateOnSurfaceNearestOrigin = dynamic_cast<const Trk::MultiComponentStateOnSurface*>(stateOnSurfaceNearestOrigin); - + const Trk::MultiComponentState* multiComponentState = nullptr; if (!multiComponentStateOnSurfaceNearestOrigin) { - //we need to make a dummy multicomponent surface + // we need to make a dummy multicomponent surface Trk::ComponentParameters dummyComponent(stateOnSurfaceNearestOrigin->trackParameters()->clone(), 1.); auto tmp_multiComponentState = std::make_unique<Trk::MultiComponentState>(); tmp_multiComponentState->push_back(std::move(dummyComponent)); - multiComponentState=tmp_multiComponentState.release(); + multiComponentState = tmp_multiComponentState.release(); } else { multiComponentState = multiComponentStateOnSurfaceNearestOrigin->components(); } // Extrapolate to perigee, taking material effects considerations into account - Trk::MultiComponentState* stateExtrapolatedToPerigee =m_extrapolator->extrapolate(*multiComponentState, - perigeeSurface, - m_directionToPerigee, - false, - particleHypothesis).release(); + Trk::MultiComponentState* stateExtrapolatedToPerigee = + m_extrapolator->extrapolate(*multiComponentState, perigeeSurface, m_directionToPerigee, false, particleHypothesis) + .release(); if (!stateExtrapolatedToPerigee) { ATH_MSG_DEBUG("Track could not be extrapolated to perigee... returning 0"); @@ -741,12 +743,8 @@ Trk::GaussianSumFitter::makePerigee(const Trk::SmoothedTrajectory* smoothedTraje return nullptr; } - const Trk::MultiComponentStateOnSurface* perigeeMultiStateOnSurface = - new MultiComponentStateOnSurface(nullptr, combinedPerigee.release(), - stateExtrapolatedToPerigee, - nullptr, - nullptr, - pattern, modeQoverP); + const Trk::MultiComponentStateOnSurface* perigeeMultiStateOnSurface = new MultiComponentStateOnSurface( + nullptr, combinedPerigee.release(), stateExtrapolatedToPerigee, nullptr, nullptr, pattern, modeQoverP); ATH_MSG_DEBUG("makePerigee() returning sucessfully!"); return perigeeMultiStateOnSurface; } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfBetheHeitlerEffects.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfBetheHeitlerEffects.cxx index 3800514ffe8d50ac3f4923ccdc9a53f1348154b3..3f0a8269a32cb9c72bc256aa51c380707a462ee0 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfBetheHeitlerEffects.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfBetheHeitlerEffects.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -250,8 +250,8 @@ Trk::GsfBetheHeitlerEffects::compute(Cache& cache, // Produce a multi-component State if (pathlengthInX0 > m_singleGaussianRange) { - // If the amount of material is between 0.0001 and 0.01 return the gaussian approximation to the Bethe-Heitler - // distribution + // If the amount of material is between 0.0001 and 0.01 return the gaussian approximation to the + // Bethe-Heitler distribution if (pathlengthInX0 < m_lowerRange) { ATH_MSG_DEBUG("Amount of material less than" << m_lowerRange << "... Parameterising Bethe-Heitler as Gaussian"); @@ -305,7 +305,8 @@ Trk::GsfBetheHeitlerEffects::compute(Cache& cache, if (m_correctionFlag == 2) { mixture[0].mean = correctedFirstMean(pathlengthInX0, mixture); mixture[0].variance = correctedFirstVariance(pathlengthInX0, mixture); - // msg(MSG::VERBOSE) << "Corrected mean/variance: " << mixture[0].mean << " / " << mixture[0].variance << endmsg; + // msg(MSG::VERBOSE) << "Corrected mean/variance: " << mixture[0].mean << " / " << + // mixture[0].variance << endmsg; } int componentIndex = 0; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfCombinedMaterialEffects.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfCombinedMaterialEffects.cxx index 7db2c588fb1730d6137647bd0853984b36859e77..bbc08a681eaf942e71762f6b19bc7e9ff7b83e46 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfCombinedMaterialEffects.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfCombinedMaterialEffects.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -93,7 +93,8 @@ Trk::GsfCombinedMaterialEffects::compute(IMultiStateMaterialEffects::Cache& cach ======================================================================== */ IMultiStateMaterialEffects::Cache cache_multipleScatter; - m_multipleScatterEffects->compute(cache_multipleScatter, componentParameters, materialProperties, pathLength, direction, particleHypothesis); + m_multipleScatterEffects->compute( + cache_multipleScatter, componentParameters, materialProperties, pathLength, direction, particleHypothesis); // Protect if there are no new components if (cache_multipleScatter.weights.empty()) { @@ -119,8 +120,8 @@ Trk::GsfCombinedMaterialEffects::compute(IMultiStateMaterialEffects::Cache& cach } else if (particleHypothesis != nonInteracting) { ATH_MSG_VERBOSE("Considering standard energy loss effects"); - m_energyLossEffects->compute(cache_energyLoss, componentParameters, materialProperties, pathLength, direction, particleHypothesis); - + m_energyLossEffects->compute( + cache_energyLoss, componentParameters, materialProperties, pathLength, direction, particleHypothesis); } // Protect if there are no new components diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfEnergyLossEffects.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfEnergyLossEffects.cxx index f784410d7fa904365e3e568166f569db9fdb6f3f..ca04ae587fd6654075894a8dd49af2a69d5a7033 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfEnergyLossEffects.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfEnergyLossEffects.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -44,7 +44,7 @@ Trk::GsfEnergyLossEffects::initialize() ATH_MSG_FATAL("Failed to retrieve tool " << m_EnergyLossUpdator << ". No energy effects will be taken into account."); return StatusCode::FAILURE; - } else{ + } else { ATH_MSG_INFO("Retrieved tool " << m_EnergyLossUpdator); } ATH_MSG_INFO("Initialisation of " << name() << " was successful"); @@ -54,17 +54,17 @@ Trk::GsfEnergyLossEffects::initialize() StatusCode Trk::GsfEnergyLossEffects::finalize() { - ATH_MSG_INFO("Finalisation of " << name() << " was successful" ); + ATH_MSG_INFO("Finalisation of " << name() << " was successful"); return StatusCode::SUCCESS; } - -void Trk::GsfEnergyLossEffects::compute(IMultiStateMaterialEffects::Cache& cache, - const ComponentParameters& componentParameters, - const MaterialProperties& materialProperties, - double pathLength, - PropDirection direction, - ParticleHypothesis particleHypothesis) const +void +Trk::GsfEnergyLossEffects::compute(IMultiStateMaterialEffects::Cache& cache, + const ComponentParameters& componentParameters, + const MaterialProperties& materialProperties, + double pathLength, + PropDirection direction, + ParticleHypothesis particleHypothesis) const { // Reset the cache cache.reset(); @@ -74,11 +74,10 @@ void Trk::GsfEnergyLossEffects::compute(IMultiStateMaterialEffects::Cache& cache const AmgSymMatrix(5)* measuredCov = trackParameters->covariance(); if (!measuredCov) { - ATH_MSG_DEBUG("No measurement on track parameters... returning original track parameters"); - return; + ATH_MSG_DEBUG("No measurement on track parameters... returning original track parameters"); + return; } - double pathcorrection = pathLength / materialProperties.thickness(); const Amg::Vector3D& globalMomentum = trackParameters->momentum(); @@ -104,9 +103,7 @@ void Trk::GsfEnergyLossEffects::compute(IMultiStateMaterialEffects::Cache& cache deltaCov->setZero(); (*deltaCov)(Trk::qOverP, Trk::qOverP) += sigmaQoverP * sigmaQoverP; - cache.weights.push_back(1.); cache.deltaPs.push_back(deltaE); cache.deltaCovariances.push_back(std::move(deltaCov)); - } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx index 9ab28c138a0a22cdfcd265b8239629428270e088..3599c81022c16d7a943910590e343108c111ca1e 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfExtrapolator.cxx @@ -13,8 +13,8 @@ decription : Implementation code for GsfExtrapolator class #include <utility> -#include "TrkGaussianSumFilter/GsfExtrapolator.h" #include "TrkExInterfaces/IMultipleScatteringUpdator.h" +#include "TrkGaussianSumFilter/GsfExtrapolator.h" #include "TrkGaussianSumFilter/IMaterialMixtureConvolution.h" #include "TrkGaussianSumFilter/IMultiComponentStateMerger.h" @@ -75,8 +75,8 @@ Trk::GsfExtrapolator::initialize() ATH_MSG_INFO("Retrieved tools " << m_propagators); unsigned int retrievedPropagators = m_propagators.size(); if (!retrievedPropagators) { - ATH_MSG_WARNING( - "None of the specified propagators could be retrieved! Extrapolators will operate in unconfigured mode."); + ATH_MSG_WARNING("None of the specified propagators could be retrieved! Extrapolators will " + "operate in unconfigured mode."); m_propagatorConfigurationLevel = 10; } else { // Set the configuration level for the retrieved propagators @@ -114,7 +114,8 @@ Trk::GsfExtrapolator::finalize() ATH_MSG_INFO(" * - Number of navigation distance check breaks: " << m_navigationDistanceIncreaseBreaks); ATH_MSG_INFO(" * - Number of volume boundary search failures: " << m_missedVolumeBoundary); ATH_MSG_INFO(" * - Number of tracking volume oscillation breaks: " << m_oscillationBreaks); - ATH_MSG_INFO("***************************************************************************************************"); + ATH_MSG_INFO("***********************************************************************************" + "****************"); ATH_MSG_INFO("Finalisation of " << name() << " was successful"); return StatusCode::SUCCESS; @@ -135,14 +136,15 @@ Trk::GsfExtrapolator::extrapolateImpl(Cache& cache, { auto buff_extrapolateCalls = m_extrapolateCalls.buffer(); - // If the extrapolation is to be without material effects simply revert to the extrapolateDirectly method + // If the extrapolation is to be without material effects simply revert to the extrapolateDirectly + // method if (particleHypothesis == Trk::nonInteracting) { return extrapolateDirectly(propagator, multiComponentState, surface, direction, boundaryCheck, particleHypothesis); } // Surface based material effects (assumes all material is on active sensor elements) if (m_surfaceBasedMaterialEffects) { - return extrapolateSurfaceBasedMaterialEffects(propagator, multiComponentState, surface, - direction, boundaryCheck, particleHypothesis); + return extrapolateSurfaceBasedMaterialEffects( + propagator, multiComponentState, surface, direction, boundaryCheck, particleHypothesis); } // statistics ++buff_extrapolateCalls; @@ -170,7 +172,8 @@ Trk::GsfExtrapolator::extrapolateImpl(Cache& cache, const Trk::MultiComponentState* currentState = &multiComponentState; - /* Define the initial distance between destination and current position. Destination should be determined from either + /* Define the initial distance between destination and current position. Destination should be + determined from either - reference parameters (prefered if they exist) or - destination surface */ @@ -292,9 +295,8 @@ Trk::GsfExtrapolator::extrapolateImpl(Cache& cache, if (!foundFinalBoundary) { ATH_MSG_DEBUG("Could not find final boundary switch to direct EXTRAPOLATION"); - std::unique_ptr<Trk::MultiComponentState> bailOutState = multiStatePropagate(propagator, *currentState, surface, - Trk::anyDirection, boundaryCheck, - particleHypothesis); + std::unique_ptr<Trk::MultiComponentState> bailOutState = + multiStatePropagate(propagator, *currentState, surface, Trk::anyDirection, boundaryCheck, particleHypothesis); if (!bailOutState) { ATH_MSG_DEBUG("Fallback to propagation failed... Returning 0"); @@ -323,24 +325,24 @@ Trk::GsfExtrapolator::extrapolateImpl(Cache& cache, boundaryCheck, particleHypothesis); - // FALLBACK POINT: Crisis if extrapolation fails here... As per extrapolation to volume boundary, in emergency revert - // to extrapolateDirectly - - //if we end up going nowhere, we do not own the current state + // FALLBACK POINT: Crisis if extrapolation fails here... As per extrapolation to volume boundary, + // in emergency revert to extrapolateDirectly + + // if we end up going nowhere, we do not own the current state if (destinationState.get() == currentState) { destinationState.reset(); } - //or we failed to reach the target + // or we failed to reach the target if (destinationState && &((*(destinationState->begin())).first->associatedSurface()) != &surface) { ATH_MSG_DEBUG("Failed to reach destination surface ... reached some other surface"); if (destinationState.get() != currentState) destinationState.reset(); } - //Gaudi counter buffer + // Gaudi counter buffer auto buff_extrapolateDirectlyFallbacks = m_extrapolateDirectlyFallbacks.buffer(); - + if (!destinationState) { ATH_MSG_DEBUG("extrapolateInsideVolume() failed... falling back to direct propagation"); destinationState = @@ -429,7 +431,6 @@ Trk::GsfExtrapolator::extrapolateDirectly(const Trk::IPropagator& propagator, return nullptr; } return multiStatePropagate(propagator, multiComponentState, surface, direction, boundaryCheck, particleHypothesis); - } /* @@ -492,7 +493,8 @@ Trk::GsfExtrapolator::extrapolateM(const Trk::MultiComponentState& mcsparameters Cache cache{}; cache.m_matstates.reset(); // collect the material - std::unique_ptr<MultiComponentState> parameterAtDestination = extrapolateImpl(cache, mcsparameters, sf, dir, bcheck, particle); + std::unique_ptr<MultiComponentState> parameterAtDestination = + extrapolateImpl(cache, mcsparameters, sf, dir, bcheck, particle); // there are no parameters if (!parameterAtDestination) { // loop over and clean up @@ -502,11 +504,12 @@ Trk::GsfExtrapolator::extrapolateM(const Trk::MultiComponentState& mcsparameters emptyGarbageBins(cache); return nullptr; } else { - cache.m_matstates->push_back(new TrackStateOnSurface(nullptr, parameterAtDestination->begin()->first->clone(), nullptr, nullptr)); + cache.m_matstates->push_back( + new TrackStateOnSurface(nullptr, parameterAtDestination->begin()->first->clone(), nullptr, nullptr)); parameterAtDestination.reset(); } // assign the temporary states - std::unique_ptr<std::vector<const Trk::TrackStateOnSurface*>> tmpMatStates= std::move(cache.m_matstates); + std::unique_ptr<std::vector<const Trk::TrackStateOnSurface*>> tmpMatStates = std::move(cache.m_matstates); emptyGarbageBins(cache); // return the material states return tmpMatStates; @@ -532,7 +535,6 @@ Trk::GsfExtrapolator::extrapolateToVolumeBoundary(Cache& cache, Trk::ParticleHypothesis particleHypothesis) const { - // MultiComponentState propagation and material effects const Trk::MultiComponentState* currentState = &multiComponentState; @@ -543,7 +545,7 @@ Trk::GsfExtrapolator::extrapolateToVolumeBoundary(Cache& cache, return; } - const Trk::TrackParameters* combinedState = currentState->begin()->first.get(); + const Trk::TrackParameters* combinedState = currentState->begin()->first.get(); const Trk::Layer* associatedLayer = layer; if (!associatedLayer) { @@ -564,7 +566,7 @@ Trk::GsfExtrapolator::extrapolateToVolumeBoundary(Cache& cache, if (updatedState) { addMaterialtoVector(cache, layer, currentState->begin()->first.get()); currentState = updatedState.release(); - } + } } // Clean up memory used by the combiner @@ -579,8 +581,8 @@ Trk::GsfExtrapolator::extrapolateToVolumeBoundary(Cache& cache, cache, propagator, *currentState, trackingVolume, associatedLayer, nullptr, direction, particleHypothesis); // Make sure reduced state is added to the list of garbage to be collected - if (nextState){ - if( nextState != currentState && currentState != &multiComponentState) + if (nextState) { + if (nextState != currentState && currentState != &multiComponentState) delete currentState; // Refresh the current state pointer currentState = nextState; @@ -593,7 +595,7 @@ Trk::GsfExtrapolator::extrapolateToVolumeBoundary(Cache& cache, Trk::NavigationCell nextNavigationCell(nullptr, nullptr); - combinedState = currentState->begin()->first->clone(); + combinedState = currentState->begin()->first->clone(); const Trk::TrackingVolume* nextVolume = nullptr; const Trk::TrackParameters* navigationParameters = cache.m_stateAtBoundarySurface.navigationParameters @@ -669,7 +671,8 @@ Trk::GsfExtrapolator::extrapolateToVolumeBoundary(Cache& cache, if (layerAtBoundary->layerMaterialProperties()) { ATH_MSG_DEBUG("Boundary surface has material - updating properties"); assert(currentState); - matUpdatedState = m_materialUpdator->postUpdate(*currentState, *layerAtBoundary, direction, particleHypothesis).release(); + matUpdatedState = + m_materialUpdator->postUpdate(*currentState, *layerAtBoundary, direction, particleHypothesis).release(); } } @@ -697,13 +700,13 @@ Trk::GsfExtrapolator::extrapolateToVolumeBoundary(Cache& cache, // Update the boundary information cache.m_stateAtBoundarySurface.updateBoundaryInformation(currentState, navigationParameters, nextVolume); - // Make sure navigation parameters and current state are added to the list of garbage to be collected + // Make sure navigation parameters and current state are added to the list of garbage to be + // collected throwIntoGarbageBin(cache, navigationParameters); if (currentState != &multiComponentState) { throwIntoGarbageBin(cache, currentState); } - - } +} /* * Extrapolate inside volume to destination surface! @@ -762,19 +765,16 @@ Trk::GsfExtrapolator::extrapolateInsideVolume(Cache& cache, else if (associatedLayer != destinationLayer && trackingVolume.confinedLayers() && associatedLayer->layerMaterialProperties()) { - + std::unique_ptr<Trk::MultiComponentState> updatedState = m_materialUpdator->postUpdate(*currentState, *associatedLayer, direction, particleHypothesis); - - if ( updatedState ){ + if (updatedState) { addMaterialtoVector(cache, associatedLayer, currentState->begin()->first.get()); - + // Refresh the current state pointer - currentState = updatedState.release(); - + currentState = updatedState.release(); } - } // Reset combined state target @@ -793,8 +793,8 @@ Trk::GsfExtrapolator::extrapolateInsideVolume(Cache& cache, particleHypothesis); // Memory clean-up - if (nextState){ - if(nextState != currentState && currentState != &multiComponentState) + if (nextState) { + if (nextState != currentState && currentState != &multiComponentState) delete currentState; // Refresh the current state pointer currentState = nextState; @@ -802,24 +802,24 @@ Trk::GsfExtrapolator::extrapolateInsideVolume(Cache& cache, } // Final extrapolation to destination surface - std::unique_ptr<Trk::MultiComponentState> returnState = extrapolateToDestinationLayer(cache, - propagator, - *currentState, - surface, - *destinationLayer, - // trackingVolume, - associatedLayer, - direction, - boundaryCheck, - particleHypothesis); + std::unique_ptr<Trk::MultiComponentState> returnState = extrapolateToDestinationLayer(cache, + propagator, + *currentState, + surface, + *destinationLayer, + // trackingVolume, + associatedLayer, + direction, + boundaryCheck, + particleHypothesis); /* Memory clean-up - * Here we can delete the currentState except if it still points to the input which we do not own - * or is the same as returnState which we want to return + * Here we can delete the currentState except if it still points to the input which we do not + * own or is the same as returnState which we want to return */ - if (currentState && currentState != &multiComponentState && returnState.get()!=currentState) { + if (currentState && currentState != &multiComponentState && returnState.get() != currentState) { delete currentState; - currentState=nullptr; + currentState = nullptr; } // Set the information for the current layer, surface, tracking volume setRecallInformation(cache, surface, *destinationLayer, trackingVolume); @@ -828,19 +828,19 @@ Trk::GsfExtrapolator::extrapolateInsideVolume(Cache& cache, } // FALLBACK POINT: If no destination layer is found fall-back and extrapolate directly - ATH_MSG_DEBUG("extrapolateInsideVolume() could not find the destination layer... propagating directly to surface"); + ATH_MSG_DEBUG("extrapolateInsideVolume() could not find the destination layer... propagating " + "directly to surface"); - std::unique_ptr<Trk::MultiComponentState> returnState =multiStatePropagate(propagator, *currentState, - surface, direction, boundaryCheck, - particleHypothesis); + std::unique_ptr<Trk::MultiComponentState> returnState = + multiStatePropagate(propagator, *currentState, surface, direction, boundaryCheck, particleHypothesis); /* Memory clean-up - * Here we can delete the currentState except if it still points to the input which we do not own - * or is the same as returnState which we want to return + * Here we can delete the currentState except if it still points to the input which we do not own + * or is the same as returnState which we want to return */ - if (currentState && currentState != &multiComponentState && returnState.get()!=currentState) { - delete currentState; - currentState=nullptr; - } + if (currentState && currentState != &multiComponentState && returnState.get() != currentState) { + delete currentState; + currentState = nullptr; + } // No destination layer exists so layer recall method cannot be used and should be reset resetRecallInformation(cache); @@ -852,7 +852,8 @@ Trk::GsfExtrapolator::extrapolateInsideVolume(Cache& cache, * Extrapolate from Layer to Layer */ -//Ok this can return its input this will need a change in logic for this to return a unique pointer +// Ok this can return its input this will need a change in logic for this to return a unique +// pointer const Trk::MultiComponentState* Trk::GsfExtrapolator::extrapolateFromLayerToLayer(Cache& cache, const IPropagator& propagator, @@ -864,17 +865,15 @@ Trk::GsfExtrapolator::extrapolateFromLayerToLayer(Cache& cache, ParticleHypothesis particleHypothesis) const { - const Trk::Layer* currentLayer = startLayer; std::unique_ptr<Trk::MultiComponentState> currentState = nullptr; const Trk::TrackParameters* combinedState = multiComponentState.begin()->first.get(); - Amg::Vector3D currentPosition = combinedState->position(); + Amg::Vector3D currentPosition = combinedState->position(); Amg::Vector3D currentDirection = direction * combinedState->momentum().unit(); // No need to extrapolate to start layer, find the next one - const Trk::Layer* nextLayer = - currentLayer->nextLayer(currentPosition, currentDirection); + const Trk::Layer* nextLayer = currentLayer->nextLayer(currentPosition, currentDirection); std::set<const Trk::Layer*> layersHit; layersHit.insert(currentLayer); @@ -883,34 +882,35 @@ Trk::GsfExtrapolator::extrapolateFromLayerToLayer(Cache& cache, while (nextLayer && nextLayer != destinationLayer) { layersHit.insert(nextLayer); - // Only extrapolate to an intermediate layer if it requires material update... otherwise step over it + // Only extrapolate to an intermediate layer if it requires material update... otherwise step + // over it if (nextLayer && nextLayer->layerMaterialProperties()) { - - if( currentState ){ - currentState=extrapolateToIntermediateLayer(cache, propagator, *currentState, - *nextLayer, trackingVolume, direction, particleHypothesis); + + if (currentState) { + currentState = extrapolateToIntermediateLayer( + cache, propagator, *currentState, *nextLayer, trackingVolume, direction, particleHypothesis); } else { - currentState=extrapolateToIntermediateLayer(cache, propagator, multiComponentState, - *nextLayer, trackingVolume, direction, particleHypothesis); + currentState = extrapolateToIntermediateLayer( + cache, propagator, multiComponentState, *nextLayer, trackingVolume, direction, particleHypothesis); } } - if(currentState){ - combinedState = currentState->begin()->first.get(); - currentPosition = combinedState->position(); + if (currentState) { + combinedState = currentState->begin()->first.get(); + currentPosition = combinedState->position(); currentDirection = direction * combinedState->momentum().unit(); } // Find the next layer currentLayer = nextLayer; nextLayer = currentLayer->nextLayer(currentPosition, currentDirection); - if(layersHit.find(nextLayer)!=layersHit.end()){ + if (layersHit.find(nextLayer) != layersHit.end()) { ATH_MSG_DEBUG("All ready been to NextLayer -- bail out"); break; } } - if (destinationLayer && nextLayer != destinationLayer && currentState != nullptr ) { + if (destinationLayer && nextLayer != destinationLayer && currentState != nullptr) { ATH_MSG_DEBUG("extrapolateFromLayerToLayer failed to reach destination layer.. return nullptr"); ATH_MSG_DEBUG("Current layer " << layerRZoutput(currentLayer)); ATH_MSG_DEBUG("NextLayer layer " << layerRZoutput(nextLayer)); @@ -920,15 +920,16 @@ Trk::GsfExtrapolator::extrapolateFromLayerToLayer(Cache& cache, if (!currentState) return &multiComponentState; - else - return currentState.release(); + else + return currentState.release(); } /* * Extrapolate to Intermediate Layer */ -std::unique_ptr<Trk::MultiComponentState> Trk::GsfExtrapolator::extrapolateToIntermediateLayer(Cache& cache, +std::unique_ptr<Trk::MultiComponentState> +Trk::GsfExtrapolator::extrapolateToIntermediateLayer(Cache& cache, const Trk::IPropagator& propagator, const Trk::MultiComponentState& multiComponentState, const Trk::Layer& layer, @@ -957,8 +958,9 @@ std::unique_ptr<Trk::MultiComponentState> Trk::GsfExtrapolator::extrapolateToInt return nullptr; } - // the layer has been intersected ------------------------------------------------------------------------ - // check for radial direction change --------------------------------------------------------------------- + // the layer has been intersected + // ------------------------------------------------------------------------ check for radial + // direction change --------------------------------------------------------------------- int rDirection = radialDirection(multiComponentState, direction); int newrDirection = radialDirection(*destinationState, direction); if (newrDirection != rDirection && doPerpCheck) { @@ -979,21 +981,21 @@ std::unique_ptr<Trk::MultiComponentState> Trk::GsfExtrapolator::extrapolateToInt std::unique_ptr<Trk::MultiComponentState> updatedState = m_materialUpdator->update(*destinationState, layer, direction, particleHypothesis); - - if( !updatedState ) + + if (!updatedState) return destinationState; addMaterialtoVector(cache, &layer, updatedState->begin()->first.get(), direction, particleHypothesis); return updatedState; - } /*=================================================================================================================== Extrapolate to Destination Layer -==================================================================================================================== */ +==================================================================================================================== +*/ std::unique_ptr<Trk::MultiComponentState> Trk::GsfExtrapolator::extrapolateToDestinationLayer(Cache& cache, @@ -1015,7 +1017,8 @@ Trk::GsfExtrapolator::extrapolateToDestinationLayer(Cache& cache, std::unique_ptr<Trk::MultiComponentState> destinationState = multiStatePropagate(propagator, multiComponentState, surface, direction, boundaryCheck, particleHypothesis); - // Require a fall-back if the initial state is close to the destination surface then a fall-back solution is required + // Require a fall-back if the initial state is close to the destination surface then a fall-back + // solution is required if (!destinationState) { @@ -1043,13 +1046,12 @@ Trk::GsfExtrapolator::extrapolateToDestinationLayer(Cache& cache, (startLayer != &layer) ? m_materialUpdator->preUpdate(*destinationState, layer, direction, particleHypothesis) : nullptr; - if(!updatedState) + if (!updatedState) return destinationState; addMaterialtoVector(cache, &layer, updatedState->begin()->first.get(), direction, particleHypothesis); - - return updatedState; + return updatedState; } /* @@ -1077,8 +1079,8 @@ Trk::GsfExtrapolator::extrapolateSurfaceBasedMaterialEffects(const IPropagator& // const Trk::TrackingVolume* currentVolume = m_navigator->highestVolume(); - std::unique_ptr<Trk::MultiComponentState> lastState = multiStatePropagate(propagator, multiComponentState, surface, - direction, boundaryCheck, particleHypothesis); + std::unique_ptr<Trk::MultiComponentState> lastState = + multiStatePropagate(propagator, multiComponentState, surface, direction, boundaryCheck, particleHypothesis); if (!lastState) { ATH_MSG_DEBUG("Propagated state is empty... returning 0"); @@ -1091,8 +1093,8 @@ Trk::GsfExtrapolator::extrapolateSurfaceBasedMaterialEffects(const IPropagator& std::unique_ptr<Trk::MultiComponentState> finalState = m_materialUpdator->simplifiedMaterialUpdate(*lastState, direction, particleHypothesis); - if(!finalState){ - ATH_MSG_DEBUG("Simple material effects updator failed" ); + if (!finalState) { + ATH_MSG_DEBUG("Simple material effects updator failed"); return lastState; } @@ -1167,8 +1169,9 @@ Trk::GsfExtrapolator::propagatorType(const Trk::TrackingVolume& trackingVolume) // Determine what sort of magnetic field is present unsigned int magneticFieldMode = m_fieldProperties.magneticFieldMode(); - // Chose between runge-kutta and step propagators depending on field magnetic field and material properties - // ST : the following check may fail as the dEdX is often dummy for dense volumes - switch to rho or zOverAtimesRho ? + // Chose between runge-kutta and step propagators depending on field magnetic field and material + // properties ST : the following check may fail as the dEdX is often dummy for dense volumes - + // switch to rho or zOverAtimesRho ? unsigned int propagatorMode = (magneticFieldMode > 1 && fabs(trackingVolume.dEdX) < 10e-2) ? 2 : 3; unsigned int returnType = @@ -1200,7 +1203,7 @@ Trk::GsfExtrapolator::initialiseNavigation(Cache& cache, // Empty the garbage bin ATH_MSG_DEBUG("Destination to surface [r,z] [" << surface.center().perp() << ",\t" << surface.center().z() << ']'); emptyGarbageBins(cache); - const Trk::TrackParameters* combinedState = multiComponentState.begin()->first.get(); + const Trk::TrackParameters* combinedState = multiComponentState.begin()->first.get(); /* ============================================= Look for current volume ============================================= */ @@ -1234,7 +1237,8 @@ Trk::GsfExtrapolator::initialiseNavigation(Cache& cache, ATH_MSG_DEBUG("Any direction initialisation"); } referenceParameters = - currentVolume ? propagator.propagateParameters(*combinedState, surface, direction, false, m_fieldProperties) : nullptr; + currentVolume ? propagator.propagateParameters(*combinedState, surface, direction, false, m_fieldProperties) + : nullptr; // These parameters will need to be deleted later. Add to list of garbage to be collected throwIntoGarbageBin(cache, referenceParameters); if (referenceParameters) { @@ -1283,7 +1287,7 @@ Trk::GsfExtrapolator::initialiseNavigation(Cache& cache, destinationVolume = m_navigator->volume(surface.globalReferencePoint()); } } - } +} /* * addMaterialtoVector @@ -1323,7 +1327,8 @@ Trk::GsfExtrapolator::addMaterialtoVector(Cache& cache, pathcorr = materialProperties ? 1. / fabs(surface->normal().dot(nextPar->momentum().unit())) : 0.; } - // Check that the material properties have been defined - if not define them from the layer information + // Check that the material properties have been defined - if not define them from the layer + // information materialProperties = materialProperties ? materialProperties : nextLayer->fullUpdateMaterialProperties(*nextPar); if (!materialProperties) { diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialEffectsUpdator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialEffectsUpdator.cxx index 96f6ddc4cdb0d9158c83131ccdf2793950561abd..888d2e1865e0300e2ee858c697cdfc977f1e376a 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialEffectsUpdator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialEffectsUpdator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*********************************************************************************** @@ -63,12 +63,12 @@ Trk::GsfMaterialEffectsUpdator::updateState(const Trk::ComponentParameters& comp { const Trk::TrackParameters* trackParameters = componentParameters.first.get(); - + if (!trackParameters) { - ATH_MSG_ERROR( "Trying to update component without trackParameters!!!!" ); + ATH_MSG_ERROR("Trying to update component without trackParameters!!!!"); return nullptr; } - const double weight=componentParameters.second; + const double weight = componentParameters.second; // Extract the material properties from the layer const Trk::MaterialProperties* materialProperties(nullptr); double pathCorrection(0.); @@ -92,13 +92,14 @@ Trk::GsfMaterialEffectsUpdator::updateState(const Trk::ComponentParameters& comp } } - // Check that the material properties have been defined - if not define them from the layer information + // Check that the material properties have been defined - if not define them from the layer + // information materialProperties = materialProperties ? materialProperties : layer.fullUpdateMaterialProperties(*trackParameters); // Bail out if still no material properties can be found if (!materialProperties) { auto clonedMultiComponentState = std::make_unique<Trk::MultiComponentState>(); - clonedMultiComponentState->push_back(Trk::ComponentParameters(trackParameters->clone(),weight)); + clonedMultiComponentState->push_back(Trk::ComponentParameters(trackParameters->clone(), weight)); return clonedMultiComponentState; } @@ -120,11 +121,11 @@ Trk::GsfMaterialEffectsUpdator::updateState(const Trk::ComponentParameters& comp ============================================================================ */ std::unique_ptr<Trk::MultiComponentState> - Trk::GsfMaterialEffectsUpdator::updateState(const Trk::ComponentParameters& componentParameters, - const Trk::MaterialProperties& materialProperties, - double pathLength, - Trk::PropDirection direction, - Trk::ParticleHypothesis particleHypothesis) const +Trk::GsfMaterialEffectsUpdator::updateState(const Trk::ComponentParameters& componentParameters, + const Trk::MaterialProperties& materialProperties, + double pathLength, + Trk::PropDirection direction, + Trk::ParticleHypothesis particleHypothesis) const { auto updatedState = compute(componentParameters, materialProperties, pathLength, direction, particleHypothesis); return updatedState; @@ -182,7 +183,8 @@ Trk::GsfMaterialEffectsUpdator::preUpdateState(const Trk::ComponentParameters& c } } - // Check that the material properties have been defined - if not define them from the layer information + // Check that the material properties have been defined - if not define them from the layer + // information materialProperties = materialProperties ? materialProperties : layer.fullUpdateMaterialProperties(*trackParameters); // Bail out if still no material properties can be found @@ -204,8 +206,7 @@ Trk::GsfMaterialEffectsUpdator::preUpdateState(const Trk::ComponentParameters& c // The pathlength ( in mm ) is the path correction * the thickness of the material double pathLength = pathCorrection * materialProperties->thickness(); - auto updatedState = - compute(componentParameters, *materialProperties, pathLength, direction, particleHypothesis); + auto updatedState = compute(componentParameters, *materialProperties, pathLength, direction, particleHypothesis); return updatedState; } @@ -227,7 +228,7 @@ Trk::GsfMaterialEffectsUpdator::postUpdateState(const Trk::ComponentParameters& Trk::TrackParameters* trackParameters = componentParameters.first.get(); if (!trackParameters) { - ATH_MSG_ERROR( "Trying to update component without trackParameters... returing component!" ); + ATH_MSG_ERROR("Trying to update component without trackParameters... returing component!"); return nullptr; } @@ -261,7 +262,8 @@ Trk::GsfMaterialEffectsUpdator::postUpdateState(const Trk::ComponentParameters& } } - // Check that the material properties have been defined - if not define them from the layer information + // Check that the material properties have been defined - if not define them from the layer + // information materialProperties = materialProperties ? materialProperties : layer.fullUpdateMaterialProperties(*trackParameters); // Bail out if still no material properties can be found @@ -281,8 +283,7 @@ Trk::GsfMaterialEffectsUpdator::postUpdateState(const Trk::ComponentParameters& // The pathlength ( in mm ) is the path correction * the thickness of the material double pathLength = pathCorrection * materialProperties->thickness(); - auto updatedState = - compute(componentParameters, *materialProperties, pathLength, direction, particleHypothesis); + auto updatedState = compute(componentParameters, *materialProperties, pathLength, direction, particleHypothesis); return updatedState; } @@ -304,7 +305,7 @@ Trk::GsfMaterialEffectsUpdator::compute(const Trk::ComponentParameters& componen if (momentum <= m_momentumCut) { ATH_MSG_DEBUG("Ignoring material effects... Momentum too low"); auto clonedMultiComponentState = std::make_unique<Trk::MultiComponentState>(); - clonedMultiComponentState->emplace_back(componentParameters.first->clone(),componentParameters.second); + clonedMultiComponentState->emplace_back(componentParameters.first->clone(), componentParameters.second); return clonedMultiComponentState; } @@ -325,15 +326,16 @@ Trk::GsfMaterialEffectsUpdator::compute(const Trk::ComponentParameters& componen return nullptr; } - std::unique_ptr<Trk::MultiComponentState> computedState= std::make_unique<Trk::MultiComponentState>(); + std::unique_ptr<Trk::MultiComponentState> computedState = std::make_unique<Trk::MultiComponentState>(); computedState->reserve(cache.weights.size()); // Prepare an output state unsigned int componentIndex = 0; for (; componentIndex < cache.weights.size(); ++componentIndex) { - AmgVector(5) updatedStateVector=trackParameters->parameters(); + AmgVector(5) updatedStateVector = trackParameters->parameters(); - // Adjust the momentum of the component's parameters vector here. Check to make sure update is good. + // Adjust the momentum of the component's parameters vector here. Check to make sure update is + // good. if (!updateP(updatedStateVector, cache.deltaPs[componentIndex])) { ATH_MSG_ERROR("Cannot update state vector momentum!!! return nullptr"); return nullptr; @@ -362,7 +364,7 @@ Trk::GsfMaterialEffectsUpdator::compute(const Trk::ComponentParameters& componen ============================================================================ */ bool -Trk::GsfMaterialEffectsUpdator::updateP(AmgVector(5)& stateVector, double deltaP) const +Trk::GsfMaterialEffectsUpdator::updateP(AmgVector(5) & stateVector, double deltaP) const { double p = 1. / fabs(stateVector[Trk::qOverP]); p += deltaP; diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx index d9c2256893877e35eadc6c3f1417f68164432a23..2c548b752cae9bb0825e45aec4ef137cdf77b25f 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMaterialMixtureConvolution.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /************************************************************************************* @@ -12,9 +12,9 @@ decription : Implementation code for GSF material mixture convolution ************************************************************************************/ #include "TrkGaussianSumFilter/GsfMaterialMixtureConvolution.h" +#include "TrkGaussianSumFilter/IMultiStateMaterialEffectsUpdator.h" #include "TrkGaussianSumFilter/MultiComponentStateAssembler.h" #include "TrkGaussianSumFilter/MultiComponentStateCombiner.h" -#include "TrkGaussianSumFilter/IMultiStateMaterialEffectsUpdator.h" #include "TrkGeometry/Layer.h" #include "TrkGeometry/MaterialProperties.h" @@ -42,12 +42,12 @@ Trk::GsfMaterialMixtureConvolution::initialize() return StatusCode::FAILURE; } - // Retrieve the state merge + // Retrieve the state merge if (m_stateMerger.retrieve().isFailure()) { ATH_MSG_ERROR("Could not retrieve the multi-component state merger... Exiting"); return StatusCode::FAILURE; } - + return StatusCode::SUCCESS; } @@ -81,10 +81,9 @@ Trk::GsfMaterialMixtureConvolution::update(const Trk::MultiComponentState& multi // Assembler Cache MultiComponentStateAssembler::Cache cache; - // Reset the assembler + // Reset the assembler MultiComponentStateAssembler::reset(cache); - // Check the multi-component state is populated if (multiComponentState.empty()) { ATH_MSG_DEBUG("Multi component state passed to extrapolateInsideVolume is not populated... returning 0"); @@ -99,7 +98,7 @@ Trk::GsfMaterialMixtureConvolution::update(const Trk::MultiComponentState& multi std::unique_ptr<Trk::MultiComponentState> updatedState = m_updator->updateState(*component, layer, direction, particleHypothesis); - if(!updatedState) + if (!updatedState) continue; bool componentAdded = MultiComponentStateAssembler::addMultiState(cache, std::move(*updatedState)); @@ -109,8 +108,8 @@ Trk::GsfMaterialMixtureConvolution::update(const Trk::MultiComponentState& multi } } - std::unique_ptr<Trk::MultiComponentState> mergedState = m_stateMerger->merge( std::move(cache.multiComponentState) ); - + std::unique_ptr<Trk::MultiComponentState> mergedState = m_stateMerger->merge(std::move(cache.multiComponentState)); + if (!mergedState) { return nullptr; } @@ -155,7 +154,7 @@ Trk::GsfMaterialMixtureConvolution::preUpdate(const Trk::MultiComponentState& mu std::unique_ptr<Trk::MultiComponentState> updatedState = m_updator->preUpdateState(*component, layer, direction, particleHypothesis); - if(!updatedState) + if (!updatedState) continue; bool componentAdded = MultiComponentStateAssembler::addMultiState(cache, std::move(*updatedState)); @@ -163,9 +162,9 @@ Trk::GsfMaterialMixtureConvolution::preUpdate(const Trk::MultiComponentState& mu if (!componentAdded) ATH_MSG_WARNING("Component could not be added to the state in the assembler"); } - - std::unique_ptr<Trk::MultiComponentState> mergedState = m_stateMerger->merge( std::move(cache.multiComponentState) ); - + + std::unique_ptr<Trk::MultiComponentState> mergedState = m_stateMerger->merge(std::move(cache.multiComponentState)); + if (!mergedState) { return nullptr; } @@ -212,7 +211,7 @@ Trk::GsfMaterialMixtureConvolution::postUpdate(const Trk::MultiComponentState& m std::unique_ptr<Trk::MultiComponentState> updatedState = m_updator->postUpdateState(*component, layer, direction, particleHypothesis); - if(!updatedState) + if (!updatedState) continue; bool componentAdded = MultiComponentStateAssembler::addMultiState(cache, std::move(*updatedState)); @@ -222,8 +221,8 @@ Trk::GsfMaterialMixtureConvolution::postUpdate(const Trk::MultiComponentState& m } } - std::unique_ptr<Trk::MultiComponentState> mergedState = m_stateMerger->merge( std::move(cache.multiComponentState) ); - + std::unique_ptr<Trk::MultiComponentState> mergedState = m_stateMerger->merge(std::move(cache.multiComponentState)); + if (!mergedState) { return nullptr; } @@ -255,7 +254,7 @@ Trk::GsfMaterialMixtureConvolution::simplifiedMaterialUpdate(const Trk::MultiCom } // Hardwired material effects based on approximate material distribution - std::unique_ptr<Trk::TrackParameters> combinedState =MultiComponentStateCombiner::combine(multiComponentState); + std::unique_ptr<Trk::TrackParameters> combinedState = MultiComponentStateCombiner::combine(multiComponentState); const Amg::Vector3D& globalPosition = combinedState->position(); const Trk::MaterialProperties* materialProperties = nullptr; @@ -271,8 +270,7 @@ Trk::GsfMaterialMixtureConvolution::simplifiedMaterialUpdate(const Trk::MultiCom } if (!materialProperties) { - return std::unique_ptr<Trk::MultiComponentState>( - MultiComponentStateHelpers::clone(multiComponentState)); + return std::unique_ptr<Trk::MultiComponentState>(MultiComponentStateHelpers::clone(multiComponentState)); ; } @@ -284,8 +282,7 @@ Trk::GsfMaterialMixtureConvolution::simplifiedMaterialUpdate(const Trk::MultiCom } if (perigeeSurface) { delete materialProperties; - return std::unique_ptr<Trk::MultiComponentState>( - MultiComponentStateHelpers::clone(multiComponentState)); + return std::unique_ptr<Trk::MultiComponentState>(MultiComponentStateHelpers::clone(multiComponentState)); } // Assume tracks normal to detector surface. Approximation resonable for the CTB @@ -298,7 +295,7 @@ Trk::GsfMaterialMixtureConvolution::simplifiedMaterialUpdate(const Trk::MultiCom std::unique_ptr<Trk::MultiComponentState> updatedState = m_updator->updateState(*component, *materialProperties, pathLength, direction, particleHypothesis); - if(!updatedState) + if (!updatedState) continue; bool componentAdded = MultiComponentStateAssembler::addMultiState(cache, std::move(*updatedState)); @@ -309,8 +306,8 @@ Trk::GsfMaterialMixtureConvolution::simplifiedMaterialUpdate(const Trk::MultiCom } // end loop over components - std::unique_ptr<Trk::MultiComponentState> mergedState = m_stateMerger->merge( std::move(cache.multiComponentState) ); - + std::unique_ptr<Trk::MultiComponentState> mergedState = m_stateMerger->merge(std::move(cache.multiComponentState)); + if (!mergedState) { return nullptr; } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx index c797543df483810534735c8dae06309fa89c8176..68b32c12f8b3928c5429b87d823ac8a3d505b2fe 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfMeasurementUpdator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -12,11 +12,11 @@ decription : Implementation code for GsfMeasurementUpdator class *********************************************************************************/ #include "TrkGaussianSumFilter/GsfMeasurementUpdator.h" -#include "TrkGaussianSumFilter/MultiComponentStateAssembler.h" #include "GaudiKernel/Chrono.h" #include "GaudiKernel/IChronoStatSvc.h" #include "TrkEventPrimitives/FitQuality.h" #include "TrkEventPrimitives/LocalParameters.h" +#include "TrkGaussianSumFilter/MultiComponentStateAssembler.h" #include "TrkMeasurementBase/MeasurementBase.h" #include "TrkGaussianSumFilter/PosteriorWeightsCalculator.h" @@ -54,14 +54,14 @@ Trk::GsfMeasurementUpdator::update(Trk::MultiComponentState&& stateBeforeUpdate, const Trk::MeasurementBase& measurement) const { std::unique_ptr<MultiComponentState> updatedState = nullptr; - // Point to the correct member function of the linear fitter measurement updator for fitting in the direction of - // momentum + // Point to the correct member function of the linear fitter measurement updator for fitting in + // the direction of momentum Updator updator = &Trk::IUpdator::addToState; // Check all components have associated error matricies Trk::MultiComponentState::iterator component = stateBeforeUpdate.begin(); bool rebuildStateWithErrors = false; - // Perform initial check of state awaiting update. If all states have associated error matricies then no need to - // perform the rebuild + // Perform initial check of state awaiting update. If all states have associated error matricies + // then no need to perform the rebuild for (; component != stateBeforeUpdate.end(); ++component) { rebuildStateWithErrors = rebuildStateWithErrors || invalidComponent(component->first.get()); } @@ -105,7 +105,8 @@ Trk::GsfMeasurementUpdator::fitQuality(const MultiComponentState& updatedState, const MeasurementBase& measurement) const { - // Fit quality assumes that a state that has been updated by the measurement updator has been supplied to it + // Fit quality assumes that a state that has been updated by the measurement updator has been + // supplied to it if (updatedState.empty()) { ATH_MSG_WARNING("Attempting to calculate chi2 of a hit with respect to an empty multiple-component state"); @@ -119,9 +120,9 @@ Trk::GsfMeasurementUpdator::fitQuality(const MultiComponentState& updatedState, for (; component != updatedState.end(); ++component) { const Trk::TrackParameters* trackParameters = component->first.get(); - // IUpdator interface change (27/09/2005) to allow for fit quality calculations depending on if the track parameters - // incorporate the information contained in the measurement. I ALWAYS do this - hence the fullStateFitQuality method - // is used + // IUpdator interface change (27/09/2005) to allow for fit quality calculations depending on if + // the track parameters incorporate the information contained in the measurement. I ALWAYS do + // this - hence the fullStateFitQuality method is used const Trk::FitQualityOnSurface* componentFitQuality = m_updator->fullStateFitQuality(*trackParameters, measurement.localParameters(), measurement.localCovariance()); @@ -173,7 +174,7 @@ Trk::GsfMeasurementUpdator::calculateFilterStep(Trk::MultiComponentState&& state Trk::MultiComponentState::const_iterator component = stateWithNewWeights->begin(); for (; component != stateWithNewWeights->end(); ++component) { - + Trk::FitQualityOnSurface* fitQuality = nullptr; // Track updates using a pointer to the member function @@ -229,8 +230,8 @@ Trk::GsfMeasurementUpdator::update(Trk::MultiComponentState&& stateBeforeUpdate, bool rebuildStateWithErrors = false; - // Perform initial check of state awaiting update. If all states have associated error matricies then no need to - // perform the rebuild + // Perform initial check of state awaiting update. If all states have associated error matricies + // then no need to perform the rebuild for (; component != stateBeforeUpdate.end(); ++component) { rebuildStateWithErrors = rebuildStateWithErrors || invalidComponent(component->first.get()); } @@ -382,7 +383,7 @@ Trk::GsfMeasurementUpdator::rebuildState(Trk::MultiComponentState&& stateBeforeU for (; component != stateBeforeUpdate.end(); ++component) { const Trk::TrackParameters* trackParameters = component->first.get(); - double weight = component->second; + double weight = component->second; bool rebuildCov = invalidComponent(trackParameters); if (rebuildCov) { AmgSymMatrix(5)* bigNewCovarianceMatrix = new AmgSymMatrix(5); diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfSmoother.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfSmoother.cxx index 1f09a2b3d230a35d38f75777d82bfb0ba2e6c529..20fcb79618d156d9b97bb45adcf85dc5f5932ab3 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfSmoother.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/GsfSmoother.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /* ******************************************************************************* @@ -15,9 +15,9 @@ decription : Implementation code for the class GsfSmoother #include "GaudiKernel/ToolHandle.h" #include "TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h" #include "TrkDetElementBase/TrkDetElementBase.h" -#include "TrkGaussianSumFilter/MultiComponentStateCombiner.h" #include "TrkGaussianSumFilter/IMultiStateExtrapolator.h" #include "TrkGaussianSumFilter/IMultiStateMeasurementUpdator.h" +#include "TrkGaussianSumFilter/MultiComponentStateCombiner.h" #include "TrkMeasurementBase/MeasurementBase.h" #include "TrkMultiComponentStateOnSurface/MultiComponentStateOnSurface.h" #include "TrkParameters/TrackParameters.h" @@ -80,12 +80,11 @@ Trk::GsfSmoother::fit(const ForwardTrajectory& forwardTrajectory, /* Instansiate the return trajectory. This is a vectory of TrackStateOnSurface object In the GSF Smoother these TrackStateOnSurface objects are the base class for the - MultiComponentStateOnSurface. This memory should be freed by the fitter / smoother master method */ - - + MultiComponentStateOnSurface. This memory should be freed by the fitter / smoother master + method */ /* - * In general for things we want to control their lifetime locally + * In general for things we want to control their lifetime locally * we use unique_ptr * For things where we get or pass ownership to a multistate and then continue * use them we opt for const ptr* @@ -104,61 +103,59 @@ Trk::GsfSmoother::fit(const ForwardTrajectory& forwardTrajectory, */ const Trk::MultiComponentStateOnSurface* smootherPredictionMultiStateOnSurface = dynamic_cast<const Trk::MultiComponentStateOnSurface*>(smootherPredictionStateOnSurface); - + if (!smootherPredictionMultiStateOnSurface) { ATH_MSG_DEBUG("GSF smoother has a single component state as starting point"); auto dummyMultiState = std::make_unique<Trk::MultiComponentState>(); - Trk::ComponentParameters dummyParams (smootherPredictionStateOnSurface->trackParameters()->clone(), 1.0); + Trk::ComponentParameters dummyParams(smootherPredictionStateOnSurface->trackParameters()->clone(), 1.0); dummyMultiState->push_back(std::move(dummyParams)); smootherPredictionMultiState = std::move(dummyMultiState); } else { - smootherPredictionMultiState = Trk::MultiComponentStateHelpers::clone( - *(smootherPredictionMultiStateOnSurface->components())); + smootherPredictionMultiState = + Trk::MultiComponentStateHelpers::clone(*(smootherPredictionMultiStateOnSurface->components())); } - + /* * Perform the measurement update - * The first smoother prediction state is equivalent to the last forwards prediction + * The first smoother prediction state is equivalent to the last forwards prediction * updated with the last measurement * Retrieve the first MeasurementBase object for the smoother */ - + std::unique_ptr<Trk::FitQualityOnSurface> fitQuality; /* - * The following 2 pointers if not null will be owned by the + * The following 2 pointers if not null will be owned by the * MultiComponentStateOnSurface* updatedStateOnSurface * at the end of the code and we need to re-use them. * - * So const ptr + * So const ptr */ const Trk::MeasurementBase* firstSmootherMeasurementOnTrack = smootherPredictionStateOnSurface->measurementOnTrack()->clone(); if (!firstSmootherMeasurementOnTrack) { - ATH_MSG_WARNING( - "Initial state on surface in smoother does not have an associated MeasurementBase object... returning 0"); + ATH_MSG_WARNING("Initial state on surface in smoother does not have an associated " + "MeasurementBase object... returning 0"); return nullptr; } const Trk::MultiComponentState* firstSmoothedState = m_updator->update(std::move(*smootherPredictionMultiState), *firstSmootherMeasurementOnTrack, fitQuality).release(); - + if (!firstSmoothedState) { ATH_MSG_DEBUG("First GSF smoothing update failed... Exiting!"); delete firstSmootherMeasurementOnTrack; return nullptr; } - + /*Get the first fitQuality*/ - std::unique_ptr<Trk::TrackParameters> combinedFirstSmoothedState = MultiComponentStateCombiner::combine(*firstSmoothedState, true); + std::unique_ptr<Trk::TrackParameters> combinedFirstSmoothedState = + MultiComponentStateCombiner::combine(*firstSmoothedState, true); /*owned be the tragectory*/ - const Trk::MultiComponentStateOnSurface* updatedStateOnSurface - = new MultiComponentStateOnSurface(firstSmootherMeasurementOnTrack, - combinedFirstSmoothedState.release(), - firstSmoothedState, - fitQuality.release()); + const Trk::MultiComponentStateOnSurface* updatedStateOnSurface = new MultiComponentStateOnSurface( + firstSmootherMeasurementOnTrack, combinedFirstSmoothedState.release(), firstSmoothedState, fitQuality.release()); smoothedTrajectory->push_back(updatedStateOnSurface); /* * Reset ptr - * first the const ptr + * first the const ptr */ smootherPredictionStateOnSurface = nullptr; updatedStateOnSurface = nullptr; @@ -175,12 +172,11 @@ Trk::GsfSmoother::fit(const ForwardTrajectory& forwardTrajectory, /* * Generate prediction by scaling the covariance of all components in the initial state * - * Generate a large prediction for extrapolation. This way there is no dependance on error of prediction - * NB local Y and theta are not blown out too much to help in the TRT + * Generate a large prediction for extrapolation. This way there is no dependance on error of + * prediction NB local Y and theta are not blown out too much to help in the TRT */ - std::unique_ptr<Trk::MultiComponentState> smoothedStateWithScaledError = - std::unique_ptr<Trk::MultiComponentState>( - MultiComponentStateHelpers::cloneWithScaledError(*firstSmoothedState, 15., 5., 15., 5., 15.)); + std::unique_ptr<Trk::MultiComponentState> smoothedStateWithScaledError = std::unique_ptr<Trk::MultiComponentState>( + MultiComponentStateHelpers::cloneWithScaledError(*firstSmoothedState, 15., 5., 15., 5., 15.)); if (!smoothedStateWithScaledError) { ATH_MSG_WARNING("Covariance scaling could not be performed... returning 0"); @@ -188,9 +184,9 @@ Trk::GsfSmoother::fit(const ForwardTrajectory& forwardTrajectory, } // Perform a measurement update on this new state - - std::unique_ptr<Trk::MultiComponentState> updatedState= m_updator->update(std::move(*smoothedStateWithScaledError), - *firstSmootherMeasurementOnTrack); + + std::unique_ptr<Trk::MultiComponentState> updatedState = + m_updator->update(std::move(*smoothedStateWithScaledError), *firstSmootherMeasurementOnTrack); if (!updatedState) { ATH_MSG_WARNING("Smoother prediction could not be determined... returning 0"); @@ -206,8 +202,8 @@ Trk::GsfSmoother::fit(const ForwardTrajectory& forwardTrajectory, Trk::ForwardTrajectory::const_reverse_iterator trackStateOnSurface = forwardTrajectory.rbegin() + 1; Trk::ForwardTrajectory::const_reverse_iterator lasttrackStateOnSurface = forwardTrajectory.rend() - 1; - // TSOS that the cluster measuremenet will added on after .. can’t be teh last as the impact parameters will be - // compromised + // TSOS that the cluster measuremenet will added on after .. can’t be teh last as the impact + // parameters will be compromised Trk::ForwardTrajectory::const_reverse_iterator secondLastTrackStateOnSurface = forwardTrajectory.rend() - 2; for (; trackStateOnSurface != forwardTrajectory.rend(); ++trackStateOnSurface) { @@ -239,14 +235,18 @@ Trk::GsfSmoother::fit(const ForwardTrajectory& forwardTrajectory, std::bitset<TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> type(0); type.set(TrackStateOnSurface::Outlier); - Trk::MultiComponentStateOnSurface* updatedStateOnSurface = new Trk::MultiComponentStateOnSurface( - measurement.release(), MultiComponentStateHelpers::clone(*updatedState).release(), new FitQuality(1, 1), nullptr, type); + Trk::MultiComponentStateOnSurface* updatedStateOnSurface = + new Trk::MultiComponentStateOnSurface(measurement.release(), + MultiComponentStateHelpers::clone(*updatedState).release(), + new FitQuality(1, 1), + nullptr, + type); smoothedTrajectory->push_back(updatedStateOnSurface); continue; } // Update newly extrapolated state with MeasurementBase measurement - updatedState =m_updator->update(std::move(*extrapolatedState), *measurement, fitQuality); + updatedState = m_updator->update(std::move(*extrapolatedState), *measurement, fitQuality); if (!updatedState) { ATH_MSG_WARNING("Could not update the multi-component state... rejecting track!"); return nullptr; @@ -294,25 +294,22 @@ Trk::GsfSmoother::fit(const ForwardTrajectory& forwardTrajectory, const Trk::MultiComponentStateOnSurface* updatedStateOnSurface = nullptr; if (trackStateOnSurface == lasttrackStateOnSurface) { - std::unique_ptr<Trk::TrackParameters> combinedLastState = MultiComponentStateCombiner::combine(*updatedState, true); + std::unique_ptr<Trk::TrackParameters> combinedLastState = + MultiComponentStateCombiner::combine(*updatedState, true); if (combinedLastState) - updatedStateOnSurface = new Trk::MultiComponentStateOnSurface( - measurement.release(), - combinedLastState.release(), - MultiComponentStateHelpers::clone(*updatedState).release(), - fitQuality.release()); + updatedStateOnSurface = + new Trk::MultiComponentStateOnSurface(measurement.release(), + combinedLastState.release(), + MultiComponentStateHelpers::clone(*updatedState).release(), + fitQuality.release()); else updatedStateOnSurface = new Trk::MultiComponentStateOnSurface( - measurement.release(), - MultiComponentStateHelpers::clone(*updatedState).release(), - fitQuality.release()); + measurement.release(), MultiComponentStateHelpers::clone(*updatedState).release(), fitQuality.release()); } else { updatedStateOnSurface = new Trk::MultiComponentStateOnSurface( - measurement.release(), - MultiComponentStateHelpers::clone(*updatedState).release(), - fitQuality.release()); + measurement.release(), MultiComponentStateHelpers::clone(*updatedState).release(), fitQuality.release()); } smoothedTrajectory->push_back(updatedStateOnSurface); @@ -323,9 +320,8 @@ Trk::GsfSmoother::fit(const ForwardTrajectory& forwardTrajectory, if (ccot && trackStateOnSurface == secondLastTrackStateOnSurface) { - auto ccotState = std::unique_ptr<Trk::MultiComponentState>( - addCCOT(updatedStateOnSurface, ccot, smoothedTrajectory.get()) - ); + auto ccotState = + std::unique_ptr<Trk::MultiComponentState>(addCCOT(updatedStateOnSurface, ccot, smoothedTrajectory.get())); if (ccotState) { updatedState = std::move(ccotState); } @@ -394,10 +390,12 @@ Trk::GsfSmoother::combine(const Trk::MultiComponentState& forwardsMultiState, newParameters[Trk::theta], newParameters[Trk::qOverP], covarianceOfNewParameters); - // Covariance matrix object now owned by TrackParameters object. Reset pointer to prevent delete + // Covariance matrix object now owned by TrackParameters object. Reset pointer to prevent + // delete covarianceOfNewParameters = nullptr; const AmgSymMatrix(5) invertedSummedCovariance = summedCovariance.inverse(); - // Determine the scaling factor for the new weighting. Determined from the PDF of the many-dimensional gaussian + // Determine the scaling factor for the new weighting. Determined from the PDF of the + // many-dimensional gaussian double exponent = parametersDiff.transpose() * invertedSummedCovariance * parametersDiff; double weightScalingFactor = exp(-0.5 * exponent); double combinedWeight = smootherComponent.second * forwardsComponent.second * weightScalingFactor; @@ -433,11 +431,14 @@ Trk::GsfSmoother::addCCOT(const Trk::TrackStateOnSurface* currentState, if (measurement) { currentSurface = &(measurement->associatedSurface()); } - Trk::MultiComponentState* extrapolatedState=nullptr; + Trk::MultiComponentState* extrapolatedState = nullptr; // Extrapolate to the Calo if (currentSurface) { - extrapolatedState = m_extrapolator->extrapolateDirectly( - *currentMultiComponentState, ccot->associatedSurface(), Trk::alongMomentum, false, Trk::nonInteracting).release(); + extrapolatedState = + m_extrapolator + ->extrapolateDirectly( + *currentMultiComponentState, ccot->associatedSurface(), Trk::alongMomentum, false, Trk::nonInteracting) + .release(); } // Extrapolation Failed continue @@ -463,8 +464,10 @@ Trk::GsfSmoother::addCCOT(const Trk::TrackStateOnSurface* currentState, new Trk::MultiComponentStateOnSurface(ccot->clone(), updatedState, fitQuality.release()); // Extrapolate back to the surface nearest the origin - extrapolatedState = m_extrapolator->extrapolateDirectly( - *updatedState, *currentSurface, Trk::oppositeMomentum, false, Trk::nonInteracting).release(); + extrapolatedState = + m_extrapolator + ->extrapolateDirectly(*updatedState, *currentSurface, Trk::oppositeMomentum, false, Trk::nonInteracting) + .release(); if (!extrapolatedState || extrapolatedState == updatedState) { ATH_MSG_DEBUG("Extrapolation from CCOT to 1st measurement failed .. now not being taken in account"); @@ -492,9 +495,8 @@ Trk::GsfSmoother::addCCOT(const Trk::TrackStateOnSurface* currentState, const Trk::FitQualityOnSurface* combinedFitQuality = m_updator->fitQuality(*extrapolatedState, *ccot); // Build a TSOS using the dummy measurement and combined state - Trk::MultiComponentStateOnSurface* final = - new Trk::MultiComponentStateOnSurface(pseudoMeasurement, combinedState.release(), - extrapolatedState, combinedFitQuality); + Trk::MultiComponentStateOnSurface* final = new Trk::MultiComponentStateOnSurface( + pseudoMeasurement, combinedState.release(), extrapolatedState, combinedFitQuality); smoothedTrajectory->push_back(updatedMCSOS); smoothedTrajectory->push_back(final); ATH_MSG_DEBUG("Successfully added CCOT "); diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx index 3a7306b4059a58832410d032312e10a8dab807aa..705330d8f963ed39b6e26691bdd64c44fdf3255a 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/KLGaussianMixtureReduction.cxx @@ -16,9 +16,7 @@ #endif void -GSFUtils::resetDistances(floatPtrRestrict distancesIn, - const int mini, - const int n) +GSFUtils::resetDistances(floatPtrRestrict distancesIn, const int mini, const int n) { float* distances = (float*)__builtin_assume_aligned(distancesIn, alignment); @@ -36,10 +34,10 @@ GSFUtils::resetDistances(floatPtrRestrict distancesIn, void GSFUtils::calculateAllDistances(floatPtrRestrict qonpIn, - floatPtrRestrict qonpCovIn, - floatPtrRestrict qonpGIn, - floatPtrRestrict distancesIn, - int n) + floatPtrRestrict qonpCovIn, + floatPtrRestrict qonpGIn, + floatPtrRestrict distancesIn, + int n) { float* qonp = (float*)__builtin_assume_aligned(qonpIn, alignment); @@ -60,18 +58,19 @@ GSFUtils::calculateAllDistances(floatPtrRestrict qonpIn, distances[indexConst + j] = covarianceDifference * G_difference + parametersDifference * G_sum * parametersDifference; - //\log \frac{\sigma_2}{\sigma_1} + \frac{\sigma_1^2 + (\mu_1 - \mu_2)^2}{2 \sigma_2^2} - \frac{1}{2} + //\log \frac{\sigma_2}{\sigma_1} + \frac{\sigma_1^2 + (\mu_1 - \mu_2)^2}{2 \sigma_2^2} - + //\frac{1}{2} } } } int GSFUtils::recalculateDistances(floatPtrRestrict qonpIn, - floatPtrRestrict qonpCovIn, - floatPtrRestrict qonpGIn, - floatPtrRestrict distancesIn, - int mini, - int n) + floatPtrRestrict qonpCovIn, + floatPtrRestrict qonpGIn, + floatPtrRestrict distancesIn, + int mini, + int n) { float* qonp = (float*)__builtin_assume_aligned(qonpIn, alignment); @@ -122,7 +121,7 @@ GSFUtils::recalculateDistances(floatPtrRestrict qonpIn, } std::pair<int, int> -GSFUtils::findMinimumIndex(const floatPtrRestrict distancesIn, const int n) +GSFUtils::findMinimumIndex(const floatPtrRestrict distancesIn, const int n) { float* distances = (float*)__builtin_assume_aligned(distancesIn, alignment); @@ -137,7 +136,7 @@ GSFUtils::findMinimumIndex(const floatPtrRestrict distancesIn, const int n) minDistance2 = minDistance; mini = i; minDistance = distances[i]; - } else if (distances[i] < minDistance2){ + } else if (distances[i] < minDistance2) { mini2 = i; minDistance2 = distances[i]; } @@ -145,5 +144,3 @@ GSFUtils::findMinimumIndex(const floatPtrRestrict distancesIn, const int n) return std::make_pair(mini, mini2); } - - diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateAssembler.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateAssembler.cxx index 2fd87d4446502fad49612d808b94192026e6acd0..c14c6897c3c6f85fe6cad87f628003d188e773b4 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateAssembler.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateAssembler.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -19,9 +19,8 @@ namespace { class SortByLargerSimpleComponentWeight { public: - SortByLargerSimpleComponentWeight()= default; - bool operator()(const Trk::ComponentParameters& firstComponent, - const Trk::ComponentParameters& secondComponent) const + SortByLargerSimpleComponentWeight() = default; + bool operator()(const Trk::ComponentParameters& firstComponent, const Trk::ComponentParameters& secondComponent) const { return firstComponent.second > secondComponent.second; @@ -176,7 +175,7 @@ Trk::MultiComponentStateAssembler::doStateAssembly(Cache& cache, const double ne std::unique_ptr<Trk::MultiComponentState> assembledState = std::make_unique<Trk::MultiComponentState>(); double scalingFactor = cache.validWeightSum > 0. ? newWeight / cache.validWeightSum : 1.; for (auto& component : cache.multiComponentState) { - assembledState->emplace_back(component.first.release(), component.second*scalingFactor); + assembledState->emplace_back(component.first.release(), component.second * scalingFactor); } // Reset the cache before leaving diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateCombiner.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateCombiner.cxx index f5c5c74615dae6946f49114817660f1da2591b22..47f200c427aeb22fd18ab075a0be96a6dd2ee045 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateCombiner.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateCombiner.cxx @@ -20,8 +20,7 @@ Trk::MultiComponentStateCombiner::combine(const Trk::MultiComponentState& uncomb const bool useMode, const double fractionPDFused) { - std::unique_ptr<Trk::ComponentParameters> combinedComponent = - compute(&uncombinedState, useMode, fractionPDFused); + std::unique_ptr<Trk::ComponentParameters> combinedComponent = compute(&uncombinedState, useMode, fractionPDFused); return std::move(combinedComponent->first); } @@ -191,8 +190,7 @@ Trk::MultiComponentStateCombiner::compute(const Trk::MultiComponentState* uncomb if (remainingComponentIterator == component) continue; - AmgVector(5) parameterDifference = - parameters - ((*remainingComponentIterator).first)->parameters(); + AmgVector(5) parameterDifference = parameters - ((*remainingComponentIterator).first)->parameters(); double remainingComponentIteratorWeight = (*remainingComponentIterator).second; @@ -226,7 +224,7 @@ Trk::MultiComponentStateCombiner::compute(const Trk::MultiComponentState* uncomb if (useMode && dimension == 5) { // Calculate the mode of the q/p distribution - std::array<double,10> modes = Trk::MultiComponentStateModeCalculator::calculateMode(*uncombinedState); + std::array<double, 10> modes = Trk::MultiComponentStateModeCalculator::calculateMode(*uncombinedState); // Replace mean with mode if qOverP mode is not 0 if (modes[4] != 0) { @@ -292,11 +290,11 @@ Trk::MultiComponentStateCombiner::compute(const Trk::MultiComponentState* uncomb double theta = mean[Trk::theta]; double qoverp = mean[Trk::qOverP]; if (firstMeasuredCov) - combinedTrackParameters.reset(firstParameters->associatedSurface().createTrackParameters( - loc1, loc2, phi, theta, qoverp, covariance)); + combinedTrackParameters.reset( + firstParameters->associatedSurface().createTrackParameters(loc1, loc2, phi, theta, qoverp, covariance)); else { - combinedTrackParameters.reset(firstParameters->associatedSurface().createTrackParameters( - loc1, loc2, phi, theta, qoverp, nullptr)); + combinedTrackParameters.reset( + firstParameters->associatedSurface().createTrackParameters(loc1, loc2, phi, theta, qoverp, nullptr)); delete covariance; } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx index 955955c7c071ec88cf7f1a9fa1b480b2f5437cb6..20f0115c47bc54634ff54314c9a69e306ef15d02 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultiComponentStateModeCalculator.cxx @@ -19,11 +19,10 @@ namespace { const double invsqrt2PI = 1. / sqrt(2. * M_PI); } -std::array<double,10> -Trk::MultiComponentStateModeCalculator::calculateMode( - const Trk::MultiComponentState& multiComponentState) +std::array<double, 10> +Trk::MultiComponentStateModeCalculator::calculateMode(const Trk::MultiComponentState& multiComponentState) { - std::array<double,10> modes{}; + std::array<double, 10> modes{}; // Check to see if the multi-component state is measured if (!MultiComponentStateHelpers::isMeasured(multiComponentState)) { return modes; @@ -36,20 +35,20 @@ Trk::MultiComponentStateModeCalculator::calculateMode( /* loop over the 5 direction , d0,z0,phi,theta,qOverP*/ for (int i = 0; i < 5; i++) { - - double largerPdfComponent=0.0; - double largerMeanComponent=0.0; + + double largerPdfComponent = 0.0; + double largerMeanComponent = 0.0; /* * Loop over the mixture in the ith direction and find the component * whose mean give the larger value for the Gaussian Mixture pdf. * This should be a good enough starting point for the mode * finding in this direction */ - for (const Component& component : mixture[i]){ - double pdfValue =pdf(component.mean, i, mixture); - if(pdfValue>largerPdfComponent){ - largerPdfComponent=pdfValue; - largerMeanComponent=component.mean; + for (const Component& component : mixture[i]) { + double pdfValue = pdf(component.mean, i, mixture); + if (pdfValue > largerPdfComponent) { + largerPdfComponent = pdfValue; + largerMeanComponent = component.mean; } } modes[i] = findMode(largerMeanComponent, i, mixture); @@ -102,9 +101,8 @@ Trk::MultiComponentStateModeCalculator::calculateMode( } void -Trk::MultiComponentStateModeCalculator::fillMixture( - const Trk::MultiComponentState& multiComponentState, - std::array<std::vector<Component>, 5>& mixture) +Trk::MultiComponentStateModeCalculator::fillMixture(const Trk::MultiComponentState& multiComponentState, + std::array<std::vector<Component>, 5>& mixture) { for (int i = 0; i < 5; i++) { @@ -144,7 +142,7 @@ Trk::MultiComponentStateModeCalculator::fillMixture( mixture[i].push_back(comp); } } - } +} double Trk::MultiComponentStateModeCalculator::findMode(double xStart, @@ -219,9 +217,7 @@ Trk::MultiComponentStateModeCalculator::findModeGlobal(double mean, } double -Trk::MultiComponentStateModeCalculator::pdf(double x, - int i, - const std::array<std::vector<Component>, 5>& mixture) +Trk::MultiComponentStateModeCalculator::pdf(double x, int i, const std::array<std::vector<Component>, 5>& mixture) { double pdf(0.); @@ -235,9 +231,7 @@ Trk::MultiComponentStateModeCalculator::pdf(double x, } double -Trk::MultiComponentStateModeCalculator::d1pdf(double x, - int i, - const std::array<std::vector<Component>, 5>& mixture) +Trk::MultiComponentStateModeCalculator::d1pdf(double x, int i, const std::array<std::vector<Component>, 5>& mixture) { double result(0.); @@ -248,17 +242,14 @@ Trk::MultiComponentStateModeCalculator::d1pdf(double x, double z = (x - component->mean) / component->sigma; - result += - -1. * component->weight * z * gaus(x, component->mean, component->sigma) / component->sigma; + result += -1. * component->weight * z * gaus(x, component->mean, component->sigma) / component->sigma; } return result; } double -Trk::MultiComponentStateModeCalculator::d2pdf(double x, - int i, - const std::array<std::vector<Component>, 5>& mixture) +Trk::MultiComponentStateModeCalculator::d2pdf(double x, int i, const std::array<std::vector<Component>, 5>& mixture) { double result(0.); @@ -292,8 +283,7 @@ Trk::MultiComponentStateModeCalculator::gaus(double x, double mean, double sigma } double -Trk::MultiComponentStateModeCalculator::width(int i, - const std::array<std::vector<Component>, 5>& mixture) +Trk::MultiComponentStateModeCalculator::width(int i, const std::array<std::vector<Component>, 5>& mixture) { double pdf(0.); diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultipleScatteringEffects.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultipleScatteringEffects.cxx index 5fe5fba46c1f902b352dc57cbf489111e6736d4c..05290c8304246c1c9b73e3432ae3bc27752b70b8 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultipleScatteringEffects.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/MultipleScatteringEffects.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -22,8 +22,8 @@ decription : Implementation code for multiple scatter effects #include <cmath> Trk::MultipleScatteringEffects::MultipleScatteringEffects(const std::string& type, - const std::string& name, - const IInterface* parent) + const std::string& name, + const IInterface* parent) : AthAlgTool(type, name, parent) , m_multipleScatterLogTermOn(true) { @@ -48,13 +48,13 @@ Trk::MultipleScatteringEffects::finalize() return StatusCode::SUCCESS; } - -void Trk::MultipleScatteringEffects::compute(IMultiStateMaterialEffects::Cache& cache, - const ComponentParameters& componentParameters, - const MaterialProperties& materialProperties, - double pathLength, - PropDirection /*direction*/, - ParticleHypothesis /*particleHypothesis*/) const +void +Trk::MultipleScatteringEffects::compute(IMultiStateMaterialEffects::Cache& cache, + const ComponentParameters& componentParameters, + const MaterialProperties& materialProperties, + double pathLength, + PropDirection /*direction*/, + ParticleHypothesis /*particleHypothesis*/) const { // Reset the cache cache.reset(); @@ -66,7 +66,7 @@ void Trk::MultipleScatteringEffects::compute(IMultiStateMaterialEffects::Cache& const AmgSymMatrix(5)* measuredTrackCov = trackParameters->covariance(); if (!measuredTrackCov) { - ATH_MSG_DEBUG( "No measurement associated with track parameters... returning original parameters"); + ATH_MSG_DEBUG("No measurement associated with track parameters... returning original parameters"); return; } @@ -82,7 +82,7 @@ void Trk::MultipleScatteringEffects::compute(IMultiStateMaterialEffects::Cache& MaterialProperties mprop(materialProperties.thicknessInX0(), 1., 0., 0., 0., 0.); double angularVariation = m_msUpdator->sigmaSquare(mprop, p, pathcorrection, Trk::muon); ATH_MSG_DEBUG("Sigma squared multiple scattering: " << angularVariation); - + std::unique_ptr<AmgSymMatrix(5)> deltaCov = std::make_unique<AmgSymMatrix(5)>(); deltaCov->setZero(); @@ -94,6 +94,5 @@ void Trk::MultipleScatteringEffects::compute(IMultiStateMaterialEffects::Cache& cache.weights.push_back(1.); cache.deltaPs.push_back(0.); - cache.deltaCovariances.push_back( std::move(deltaCov) ); - + cache.deltaCovariances.push_back(std::move(deltaCov)); } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/PosteriorWeightsCalculator.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/PosteriorWeightsCalculator.cxx index 3f819eddc8fb65ff8fc6086caec592a4925610c8..ed9350003ce55c9bfd8f9bf233def815e46e1d92 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/PosteriorWeightsCalculator.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/PosteriorWeightsCalculator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -18,21 +18,20 @@ description : Implementation code for PosteriorWeightsCalculator class #include "TrkParameters/TrackParameters.h" std::unique_ptr<std::vector<Trk::ComponentParameters>> -Trk::PosteriorWeightsCalculator::weights(MultiComponentState&& predictedState, - const MeasurementBase& measurement) const +Trk::PosteriorWeightsCalculator::weights(MultiComponentState&& predictedState, const MeasurementBase& measurement) const { - const size_t predictedStateSize=predictedState.size(); - if (predictedStateSize==0) { + const size_t predictedStateSize = predictedState.size(); + if (predictedStateSize == 0) { return nullptr; } - auto returnMultiComponentState = std::make_unique<std::vector<Trk::ComponentParameters> >(); + auto returnMultiComponentState = std::make_unique<std::vector<Trk::ComponentParameters>>(); std::vector<double> componentDeterminantR; std::vector<double> componentChi2; returnMultiComponentState->reserve(predictedStateSize); componentDeterminantR.reserve(predictedStateSize); componentChi2.reserve(predictedStateSize); - + // Calculate chi2 and determinant of each component. double minimumChi2(10.e10); // Initalise high @@ -129,12 +128,11 @@ Trk::PosteriorWeightsCalculator::weights(MultiComponentState&& predictedState, double chi2 = componentChi2[index] - minimumChi2; double updatedWeight(0.); - // Determinant can not be belowe 1e-19 in CLHEP .... rather ugly but protect against 0 determinants - // Normally occur when the component is a poor fit - if (componentDeterminantR[index] > 1e-20){ + // Determinant can not be belowe 1e-19 in CLHEP .... rather ugly but protect against 0 + // determinants Normally occur when the component is a poor fit + if (componentDeterminantR[index] > 1e-20) { updatedWeight = priorWeight * sqrt(1. / componentDeterminantR[index]) * exp(-0.5 * chi2); - } - else{ + } else { updatedWeight = 1e-10; } returnMultiComponentState->emplace_back(component->first.release(), updatedWeight); @@ -148,8 +146,7 @@ Trk::PosteriorWeightsCalculator::weights(MultiComponentState&& predictedState, for (; returnComponent != returnMultiComponentState->end(); ++returnComponent, ++component) { (*returnComponent).second /= sumWeights; } - } - else { + } else { for (; returnComponent != returnMultiComponentState->end(); ++returnComponent, ++component) { (*returnComponent).second = component->second; } @@ -177,15 +174,15 @@ Trk::PosteriorWeightsCalculator::calculateWeight_1D(const TrackParameters* compo // Calculate the residual const double r = measPar - (componentTrackParameters->parameters())(mk); - // Residual covariance. Posterior weights is calculated used predicted state and measurement. + // Residual covariance. Posterior weights is calculated used predicted state and measurement. // Therefore add covariances const double R = measCov + (*predictedCov)(mk, mk); if (R == 0) { - return std::pair<double,double>(0,0); + return std::pair<double, double>(0, 0); } // Compute Chi2 - return std::pair<double,double>(R,r * r / R); + return std::pair<double, double>(R, r * r / R); } std::pair<double, double> @@ -196,15 +193,15 @@ Trk::PosteriorWeightsCalculator::calculateWeight_2D_3(const TrackParameters* com { // Calculate the residual AmgVector(2) r = measPar - componentTrackParameters->parameters().block<2, 1>(0, 0); - // Residual covariance. Posterior weights is calculated used predicted state and measurement. Therefore add - // covariances + // Residual covariance. Posterior weights is calculated used predicted state and measurement. + // Therefore add covariances AmgSymMatrix(2) R(measCov + predictedCov->block<2, 2>(0, 0)); // compute determinant of residual - const double det = R.determinant(); - if (det== 0) { + const double det = R.determinant(); + if (det == 0) { // ATH_MSG_WARNING( "Determinant is 0, cannot invert matrix... Ignoring component" ); - return std::pair<double,double>(0,0); + return std::pair<double, double>(0, 0); } // Compute Chi2 - return std::pair<double,double> (det,0.5 * ((r.transpose() * R.inverse() * r)(0, 0))); + return std::pair<double, double>(det, 0.5 * ((r.transpose() * R.inverse() * r)(0, 0))); } diff --git a/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx b/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx index fd414401e69adad5a7904b92e0ef7ae36a0780da..c92e2145c800998337803d33e9e33801559bc990 100644 --- a/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx +++ b/Tracking/TrkFitter/TrkGaussianSumFilter/src/QuickCloseComponentsMultiStateMerger.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /********************************************************************************* @@ -13,14 +13,14 @@ decription : Implementation code for QuickCloseComponentsMultiStateMer *********************************************************************************/ #include "TrkGaussianSumFilter/QuickCloseComponentsMultiStateMerger.h" -#include "TrkGaussianSumFilter/MultiComponentStateCombiner.h" -#include "TrkGaussianSumFilter/KLGaussianMixtureReduction.h" +#include "GaudiKernel/Chrono.h" #include "TrkGaussianSumFilter/AllignedDynArray.h" +#include "TrkGaussianSumFilter/KLGaussianMixtureReduction.h" +#include "TrkGaussianSumFilter/MultiComponentStateCombiner.h" #include "TrkParameters/TrackParameters.h" -#include "GaudiKernel/Chrono.h" #include <limits> -using namespace GSFUtils; +using namespace GSFUtils; Trk::QuickCloseComponentsMultiStateMerger::QuickCloseComponentsMultiStateMerger(const std::string& type, const std::string& name, @@ -45,7 +45,6 @@ Trk::QuickCloseComponentsMultiStateMerger::initialize() } else ATH_MSG_INFO("Retrieved service " << m_chronoSvc); - if (m_maximumNumberOfComponents <= 0) { ATH_MSG_FATAL("Attempting to merge multi-state into zero components... stop being silly!"); return StatusCode::FAILURE; @@ -63,16 +62,16 @@ Trk::QuickCloseComponentsMultiStateMerger::finalize() } std::unique_ptr<Trk::MultiComponentState> -Trk::QuickCloseComponentsMultiStateMerger::merge( Trk::MultiComponentState statesToMerge ) const +Trk::QuickCloseComponentsMultiStateMerger::merge(Trk::MultiComponentState statesToMerge) const { // Assembler Cache MultiComponentStateAssembler::Cache cache; if (statesToMerge.size() <= m_maximumNumberOfComponents) { - MultiComponentStateAssembler::addMultiState( cache, std::move(statesToMerge) ); + MultiComponentStateAssembler::addMultiState(cache, std::move(statesToMerge)); return MultiComponentStateAssembler::assembledState(cache); } - + // Scan all components for covariance matrices. If one or more component // is missing an error matrix, component reduction is impossible. bool componentWithoutMeasurement = false; @@ -89,7 +88,7 @@ Trk::QuickCloseComponentsMultiStateMerger::merge( Trk::MultiComponentState state std::sort(statesToMerge.begin(), statesToMerge.end(), [](const ComponentParameters& x, const ComponentParameters& y) { return x.second > y.second; }); - + Trk::ComponentParameters dummyCompParams(statesToMerge.begin()->first->clone(), 1.); auto returnMultiState = std::make_unique<Trk::MultiComponentState>(); returnMultiState->push_back(std::move(dummyCompParams)); @@ -101,19 +100,19 @@ Trk::QuickCloseComponentsMultiStateMerger::merge( Trk::MultiComponentState state std::unique_ptr<Trk::MultiComponentState> Trk::QuickCloseComponentsMultiStateMerger::mergeFullDistArray(MultiComponentStateAssembler::Cache& cache, - Trk::MultiComponentState& statesToMerge ) const + Trk::MultiComponentState& statesToMerge) const { /* * Allocate, and initialize the needed arrays */ const int n = statesToMerge.size(); const int nn2 = (n + 1) * n / 2; - AlignedDynArray<float,alignment> distances(nn2); // Array to store all of the distances between components - AlignedDynArray<float,alignment> qonp(n); // Array of qonp for each component - AlignedDynArray<float,alignment> qonpCov(n); // Array of Cov(qonp,qonp) for each component - AlignedDynArray<float,alignment> qonpG(n); // Array of 1/Cov(qonp,qonp) for each component + AlignedDynArray<float, alignment> distances(nn2); // Array to store all of the distances between components + AlignedDynArray<float, alignment> qonp(n); // Array of qonp for each component + AlignedDynArray<float, alignment> qonpCov(n); // Array of Cov(qonp,qonp) for each component + AlignedDynArray<float, alignment> qonpG(n); // Array of 1/Cov(qonp,qonp) for each component - // Initialize all values + // Initialize all values for (int i = 0; i < n; ++i) { qonp[i] = 0; qonpCov[i] = 0; @@ -123,8 +122,8 @@ Trk::QuickCloseComponentsMultiStateMerger::mergeFullDistArray(MultiComponentStat distances[i] = std::numeric_limits<float>::max(); } - //Needed to convert the triangular index to (i,j) - std::vector<triangularToIJ> convert(nn2,{-1,-1}); + // Needed to convert the triangular index to (i,j) + std::vector<triangularToIJ> convert(nn2, { -1, -1 }); // Calculate indicies for (int i = 0; i < n; ++i) { const int indexConst = (i + 1) * i / 2; @@ -141,9 +140,9 @@ Trk::QuickCloseComponentsMultiStateMerger::mergeFullDistArray(MultiComponentStat const AmgVector(5) parameters = statesToMerge[i].first->parameters(); // Fill in infomation qonp[i] = parameters[Trk::qOverP]; - qonpCov[i] = measuredCov ? (*measuredCov)(Trk::qOverP, Trk::qOverP): -1.; + qonpCov[i] = measuredCov ? (*measuredCov)(Trk::qOverP, Trk::qOverP) : -1.; qonpG[i] = qonpCov[i] > 0 ? 1. / qonpCov[i] : 1e10; - } + } // Calculate distances for all pairs // This loop can be vectorised calculateAllDistances(qonp, qonpCov, qonpG, distances, n); @@ -243,5 +242,3 @@ Trk::QuickCloseComponentsMultiStateMerger::mergeFullDistArray(MultiComponentStat return mergedState; } - - diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GXFTrackState.h b/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GXFTrackState.h index 52907bd0ddb8674c3a5497c80830806edb32eaaf..fc315640e83c0b347a0a92024a35f59ac43ba321 100755 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GXFTrackState.h +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GXFTrackState.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -32,9 +32,9 @@ namespace Trk { GXFTrackState(GXFTrackState &); ~GXFTrackState(); - GXFTrackState(const MeasurementBase *, const TrackParameters * trackpar = 0, bool ownmb = false); + GXFTrackState(const MeasurementBase *, const TrackParameters * trackpar = nullptr, bool ownmb = false); GXFTrackState(const TrackParameters *); - GXFTrackState(GXFMaterialEffects *, const TrackParameters * trackpar = 0); + GXFTrackState(GXFMaterialEffects *, const TrackParameters * trackpar = nullptr); GXFTrackState & operator=(GXFTrackState & rhs); void setMeasurement(const MeasurementBase *); diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h b/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h index 253f23ae28038d5556257214cd1f71e6b914902c..e4f068089c3b40503f4c7b05642f2a09157d03fd 100755 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/TrkGlobalChi2Fitter/GlobalChi2Fitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef GLOBALCHI2FITTER_H @@ -261,7 +261,7 @@ namespace Trk { Cache &, GXFTrajectory &, const MeasurementBase *, - const TrackParameters * trackpar = 0, + const TrackParameters * trackpar = nullptr, bool isoutlier = false, int index = -1 ) const; diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrackState.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrackState.cxx index a56e912a9fca81ea1809bd36de8e385a30a6bb3d..73093240403c4146e512abfb6c44149c5977c2a7 100644 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrackState.cxx +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrackState.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -242,9 +242,9 @@ namespace Trk { void GXFTrackState::setMaterialEffects(GXFMaterialEffects * mef) { - if (m_materialEffects != nullptr) { + delete m_materialEffects; - } + m_materialEffects = mef; } @@ -260,7 +260,7 @@ namespace Trk { void GXFTrackState::setDerivatives(Amg::MatrixX & deriv) { - if (m_derivs != nullptr) + delete m_derivs; m_derivs = new Amg::MatrixX(deriv); @@ -297,7 +297,7 @@ namespace Trk { const Surface *GXFTrackState::surface() { if (m_measurement != nullptr) { return &m_measurement->associatedSurface(); - } else if (m_trackpar != nullptr) { + } if (m_trackpar != nullptr) { return &m_trackpar->associatedSurface(); } else if (m_materialEffects != nullptr) { return m_materialEffects->surface(); @@ -339,8 +339,8 @@ namespace Trk { if (m_tsType == TrackState::Fittable || m_tsType == TrackState::GeneralOutlier) { - for (int i = 0; i < 5; i++) { - if (m_measerror[i] > 0) { + for (double i : m_measerror) { + if (i > 0) { nmeas++; } } @@ -352,7 +352,7 @@ namespace Trk { const Amg::Vector3D & GXFTrackState::position() { if (m_trackpar != nullptr) { return m_trackpar->position(); - } else if (m_measurement != nullptr) { + } if (m_measurement != nullptr) { return m_measurement->globalPosition(); } // return surface()->center(); // Better than nothing... diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrajectory.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrajectory.cxx index 9e85507aaf300dd2ecd1465e68399acf4f383b0c..82f3e06279bf38c41bbe45a32771e34c967496d2 100644 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrajectory.cxx +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GXFTrajectory.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkGlobalChi2Fitter/GXFTrajectory.h" @@ -85,16 +85,16 @@ namespace Trk { m_caloelossstate = nullptr; if (rhs.m_caloelossstate != nullptr) { - for (int i = 0; i < (int) m_states.size(); i++) { - GXFMaterialEffects *meff = m_states[i]->materialEffects(); - const TrackParameters *par = m_states[i]->trackParameters(); + for (auto & state : m_states) { + GXFMaterialEffects *meff = state->materialEffects(); + const TrackParameters *par = state->trackParameters(); if ( (meff != nullptr) && (par != nullptr) && meff->sigmaDeltaE() > 0 && meff->sigmaDeltaPhi() == 0 && (par->position().perp() > 1400 || std::abs(par->position().z()) > 3700) ) { - m_caloelossstate = m_states[i]; + m_caloelossstate = state; } } } @@ -107,8 +107,8 @@ namespace Trk { delete m_refpar; } - for (int i = 0; i < (int) m_states.size(); i++) { - delete m_states[i]; + for (auto & state : m_states) { + delete state; } } @@ -138,8 +138,8 @@ namespace Trk { delete m_refpar; m_refpar = rhs.m_ownrefpar ? rhs.m_refpar->clone() : rhs.m_refpar; - for (int i = 0; i < (int) m_states.size(); i++) { - delete m_states[i]; + for (auto & state : m_states) { + delete state; } m_states = rhs.m_states; @@ -161,14 +161,14 @@ namespace Trk { m_caloelossstate = nullptr; if (rhs.m_caloelossstate != nullptr) { - for (int i = 0; i < (int) m_states.size(); i++) { - GXFMaterialEffects *meff = m_states[i]->materialEffects(); - const TrackParameters *par = m_states[i]->trackParameters(); + for (auto & state : m_states) { + GXFMaterialEffects *meff = state->materialEffects(); + const TrackParameters *par = state->trackParameters(); if ( (meff != nullptr) && (par != nullptr) && meff->sigmaDeltaE() > 0 && meff->sigmaDeltaPhi() == 0 && (par->position().perp() > 1400 || std::abs(par->position().z()) > 3700) ) { - m_caloelossstate = m_states[i]; + m_caloelossstate = state; } } } @@ -255,7 +255,8 @@ namespace Trk { } } else { m_states.insert(m_states.begin() + index, state); - int previousscats = 0, previousbrems = 0; + int previousscats = 0; + int previousbrems = 0; for (int i = 0; i < index; i++) { if (m_states[i]->trackStateType() == TrackState::Scatterer) { @@ -308,7 +309,8 @@ namespace Trk { m_refpar = per; m_nupstreamstates = m_nupstreamscatterers = m_nupstreamcaloscatterers = m_nupstreambrems = 0; - std::vector < GXFTrackState * >::iterator it = m_states.begin(), it2 = m_states.begin(); + std::vector < GXFTrackState * >::iterator it = m_states.begin(); + std::vector < GXFTrackState * >::iterator it2 = m_states.begin(); while (it2 != m_states.end()) { double distance = 0; @@ -544,17 +546,16 @@ namespace Trk { m_scatteringsigmas.clear(); m_scatteringsigmas.reserve(numberOfScatterers()); m_scatteringangles.reserve(numberOfScatterers()); - for (std::vector < GXFTrackState * >::iterator it = m_states.begin(); - it != m_states.end(); it++) { - if ((**it).trackStateType() == TrackState::Scatterer - && ((m_prefit == 0) || (**it).materialEffects()->deltaE() == 0)) { - double scatphi = (**it).materialEffects()->deltaPhi(); - double scattheta = (**it).materialEffects()->deltaTheta(); - m_scatteringangles.push_back(std::make_pair(scatphi, scattheta)); - double sigmascatphi = (**it).materialEffects()->sigmaDeltaPhi(); - double sigmascattheta = (**it).materialEffects()->sigmaDeltaTheta(); + for (auto & state : m_states) { + if ((*state).trackStateType() == TrackState::Scatterer + && ((m_prefit == 0) || (*state).materialEffects()->deltaE() == 0)) { + double scatphi = (*state).materialEffects()->deltaPhi(); + double scattheta = (*state).materialEffects()->deltaTheta(); + m_scatteringangles.emplace_back(scatphi, scattheta); + double sigmascatphi = (*state).materialEffects()->sigmaDeltaPhi(); + double sigmascattheta = (*state).materialEffects()->sigmaDeltaTheta(); m_scatteringsigmas. - push_back(std::make_pair(sigmascatphi, sigmascattheta)); + emplace_back(sigmascatphi, sigmascattheta); } } } @@ -579,13 +580,12 @@ namespace Trk { double > >&scatteringangles) { m_scatteringangles = scatteringangles; int scatno = 0; - for (std::vector < GXFTrackState * >::iterator it = m_states.begin(); - it != m_states.end(); it++) { - if ((**it).trackStateType() == TrackState::Scatterer - && ((m_prefit == 0) || (**it).materialEffects()->deltaE() == 0)) { + for (auto & state : m_states) { + if ((*state).trackStateType() == TrackState::Scatterer + && ((m_prefit == 0) || (*state).materialEffects()->deltaE() == 0)) { double scatphi = scatteringangles[scatno].first; double scattheta = scatteringangles[scatno].second; - (**it).materialEffects()->setScatteringAngles(scatphi, scattheta); + (*state).materialEffects()->setScatteringAngles(scatphi, scattheta); scatno++; } } @@ -596,11 +596,10 @@ namespace Trk { // if (m_prefit==1) return; m_brems = brems; int bremno = 0; - for (std::vector < GXFTrackState * >::iterator it = m_states.begin(); - it != m_states.end(); it++) { - if (((**it).materialEffects() != nullptr) - && (**it).materialEffects()->sigmaDeltaE() > 0) { - (**it).materialEffects()->setdelta_p(brems[bremno]); + for (auto & state : m_states) { + if (((*state).materialEffects() != nullptr) + && (*state).materialEffects()->sigmaDeltaE() > 0) { + (*state).materialEffects()->setdelta_p(brems[bremno]); bremno++; } } @@ -645,8 +644,8 @@ namespace Trk { int nfitpar = numberOfFitParameters(); // std::cout << "capacity: " << m_resderiv.capacity() << " nbrems: " << numberOfBrems() << " ndof: " << m_ndof << // " perpars: " << m_nperpars << " noutl: " << m_nmeasoutl << std::endl; - for (unsigned int i = 0; i < m_weightresderiv.size(); i++) { - m_weightresderiv[i].resize(nfitpar); + for (auto & i : m_weightresderiv) { + i.resize(nfitpar); } } return m_weightresderiv; diff --git a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx index 28b474d217fe7332ab25f5c94beb1127f91b6284..3e6e5106e80eb8d5f931319848af77addff25d94 100644 --- a/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx +++ b/Tracking/TrkFitter/TrkGlobalChi2Fitter/src/GlobalChi2Fitter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkFitterUtils/TrackFitInputPreparator.h" @@ -71,15 +71,16 @@ #include "EventPrimitives/EventPrimitivesToStringConverter.h" #include <exception> +#include <memory> using CLHEP::MeV; using CLHEP::mm; namespace { - double getDistance(Trk::DistanceSolution distsol) { + double getDistance(const Trk::DistanceSolution& distsol) { if (distsol.numberOfSolutions() == 1) { return distsol.first(); - } else if (distsol.numberOfSolutions() == 2) { + } if (distsol.numberOfSolutions() == 2) { return ( std::abs(distsol.first()) < std::abs(distsol.second()) ? distsol.first() : @@ -91,7 +92,8 @@ namespace { } std::pair<const Trk::TrackParameters *, const Trk::TrackParameters *> getFirstLastIdPar(const Trk::Track & track) { - const Trk::TrackParameters *firstidpar = nullptr, *lastidpar = nullptr; + const Trk::TrackParameters *firstidpar = nullptr; + const Trk::TrackParameters *lastidpar = nullptr; DataVector<const Trk::TrackParameters>::const_iterator parit = track.trackParameters()->begin(); @@ -890,7 +892,8 @@ namespace Trk { return nullptr; } - TransportJacobian *jac1 = nullptr, *jac2 = nullptr; + TransportJacobian *jac1 = nullptr; + TransportJacobian *jac2 = nullptr; std::unique_ptr<const TrackParameters> elosspar; double firstscatphi = 0; @@ -1561,7 +1564,8 @@ namespace Trk { std::unique_ptr<GXFMaterialEffects> elossmeff(new GXFMaterialEffects(&calomeots[1])); std::unique_ptr<GXFMaterialEffects> secondscatmeff(new GXFMaterialEffects(&calomeots[2])); - double dp = 0, sigmadp = 0; + double dp = 0; + double sigmadp = 0; sigmadp = calomeots[1].energyLoss()->sigmaDeltaE(); elossmeff->setSigmaDeltaE(sigmadp); @@ -1573,10 +1577,13 @@ namespace Trk { trajectory.addMaterialState(new GXFTrackState(secondscatmeff.release(), lastscatpar.release()), -1, true); GXFTrackState *secondscatstate = trajectory.trackStates().back(); - const Surface *triggersurf1 = nullptr, *triggersurf2 = nullptr; - Amg::Vector3D triggerpos1(0, 0, 0), triggerpos2(0, 0, 0); + const Surface *triggersurf1 = nullptr; + const Surface *triggersurf2 = nullptr; + Amg::Vector3D triggerpos1(0, 0, 0); + Amg::Vector3D triggerpos2(0, 0, 0); - bool seenmdt = false, mdtbetweenphihits = false; + bool seenmdt = false; + bool mdtbetweenphihits = false; int nphi = 0; for ( @@ -1642,8 +1649,10 @@ namespace Trk { } } - double mdttrig1 = 999999, mdttrig2 = 999999; - const Surface *mdtsurf1 = nullptr, *mdtsurf2 = nullptr; + double mdttrig1 = 999999; + double mdttrig2 = 999999; + const Surface *mdtsurf1 = nullptr; + const Surface *mdtsurf2 = nullptr; for ( itStates2 = (!firstismuon ? beginStates2 : endState - 1); @@ -1693,8 +1702,11 @@ namespace Trk { } } - GXFTrackState *pseudostate1 = nullptr, *pseudostate2 = nullptr, *firstpseudostate = nullptr; - std::vector<GXFTrackState *> outlierstates, outlierstates2; + GXFTrackState *pseudostate1 = nullptr; + GXFTrackState *pseudostate2 = nullptr; + GXFTrackState *firstpseudostate = nullptr; + std::vector<GXFTrackState *> outlierstates; + std::vector<GXFTrackState *> outlierstates2; outlierstates.reserve(10); outlierstates2.reserve(10); @@ -1944,11 +1956,11 @@ namespace Trk { Cache cache(this); - if(alignCache.m_derivMatrix != nullptr) + delete alignCache.m_derivMatrix; alignCache.m_derivMatrix = nullptr; - if(alignCache.m_fullCovarianceMatrix != nullptr) + delete alignCache.m_fullCovarianceMatrix; alignCache.m_fullCovarianceMatrix = nullptr; alignCache.m_iterationsOfLastFit = 0; @@ -2014,9 +2026,14 @@ namespace Trk { trajectory.trackStates().reserve(inputTrack.trackStateOnSurfaces()->size()); - const Surface *firsthitsurf = nullptr, *lasthitsurf = nullptr; - bool hasid = false, hasmuon = false; - bool iscombined = false, seenphimeas = false, phiem = false, phibo = false; + const Surface *firsthitsurf = nullptr; + const Surface *lasthitsurf = nullptr; + bool hasid = false; + bool hasmuon = false; + bool iscombined = false; + bool seenphimeas = false; + bool phiem = false; + bool phibo = false; for (; itStates != endState; ++itStates) { if ( @@ -2303,13 +2320,13 @@ namespace Trk { if (track != nullptr) { incrementFitStatus(S_SUCCESSFUL_FITS); - const TrackInfo old_info = inputTrack.info(); + const TrackInfo& old_info = inputTrack.info(); track->info().addPatternReco(old_info); } - if (tmptrack != nullptr) { + delete tmptrack; - } + return track; } @@ -2323,8 +2340,8 @@ namespace Trk { ATH_MSG_DEBUG("--> entering GlobalChi2Fitter::fit(PRDS,TP,)"); MeasurementSet rots; - for (PrepRawDataSet::const_iterator it = prds.begin(); it != prds.end(); it++) { - const Surface & prdsurf = (**it).detectorElement()->surface((**it).identify()); + for (auto prd : prds) { + const Surface & prdsurf = (*prd).detectorElement()->surface((*prd).identify()); const RIO_OnTrack *rot = nullptr; const PlaneSurface *plsurf = nullptr; @@ -2341,7 +2358,7 @@ namespace Trk { } if (!m_broadROTcreator.empty() && (slsurf != nullptr)) { - rot = m_broadROTcreator->correct(**it, param); + rot = m_broadROTcreator->correct(*prd, param); } else if (slsurf != nullptr) { AtaStraightLine atasl( slsurf->center(), @@ -2350,7 +2367,7 @@ namespace Trk { param.parameters()[Trk::qOverP], *slsurf ); - rot = m_ROTcreator->correct(**it, atasl); + rot = m_ROTcreator->correct(*prd, atasl); } else if (plsurf != nullptr) { if (param.covariance() != nullptr) { AtaPlane atapl( @@ -2361,7 +2378,7 @@ namespace Trk { *plsurf, new AmgSymMatrix(5)(*param.covariance()) ); - rot = m_ROTcreator->correct(**it, atapl); + rot = m_ROTcreator->correct(*prd, atapl); } else { AtaPlane atapl( plsurf->center(), @@ -2370,7 +2387,7 @@ namespace Trk { param.parameters()[Trk::qOverP], *plsurf ); - rot = m_ROTcreator->correct(**it, atapl); + rot = m_ROTcreator->correct(*prd, atapl); } } @@ -2495,8 +2512,8 @@ namespace Trk { MeasurementSet rots; const TrackParameters *hitparam = intrk.trackParameters()->back(); - for (PrepRawDataSet::const_iterator it = prds.begin(); it != prds.end(); it++) { - const Surface & prdsurf = (**it).detectorElement()->surface((**it).identify()); + for (auto prd : prds) { + const Surface & prdsurf = (*prd).detectorElement()->surface((*prd).identify()); Amg::VectorX parameterVector = hitparam->parameters(); std::unique_ptr<const TrackParameters>trackparForCorrect( @@ -2513,9 +2530,9 @@ namespace Trk { const RIO_OnTrack *rot = nullptr; if (!m_broadROTcreator.empty() && prdsurf.type() == Trk::Surface::Line) { - rot = m_broadROTcreator->correct(**it, *hitparam); + rot = m_broadROTcreator->correct(*prd, *hitparam); } else { - rot = m_ROTcreator->correct(**it, *trackparForCorrect); + rot = m_ROTcreator->correct(*prd, *trackparForCorrect); } if (rot != nullptr) { @@ -3108,8 +3125,8 @@ namespace Trk { const std::vector<SharedObject<const BoundarySurface<TrackingVolume>>> & bsurf = tvol->boundarySurfaces(); - for (std::vector<SharedObject<const BoundarySurface<TrackingVolume>>>::const_iterator it = bsurf.begin(); it != bsurf.end(); it++) { - const Layer *layer = (*it)->surfaceRepresentation().materialLayer(); + for (const auto & it : bsurf) { + const Layer *layer = it->surfaceRepresentation().materialLayer(); if (layer == nullptr) continue; @@ -3174,7 +3191,7 @@ namespace Trk { return true; } - class GXFlayersort: public std::binary_function<const std::pair<const Layer *, const Layer *>&, const std::pair<const Layer *, const Layer *> &, bool> { + class GXFlayersort { public: /** Default Constructor */ GXFlayersort() {} @@ -3250,7 +3267,7 @@ namespace Trk { } }; - class GXFlayersort2: public std::binary_function<const Layer *, const Layer *, bool> { + class GXFlayersort2 { public: /** Default Constructor */ GXFlayersort2() {} @@ -3326,9 +3343,12 @@ namespace Trk { std::stable_sort(cache.m_barrelcylinders.begin(), cache.m_barrelcylinders.end(), GXFlayersort2()); } - const TrackParameters *refpar = refpar2, *firstsipar = nullptr, *lastsipar = nullptr; + const TrackParameters *refpar = refpar2; + const TrackParameters *firstsipar = nullptr; + const TrackParameters *lastsipar = nullptr; bool hasmat = false; - int indexoffset = 0, lastmatindex = 0; + int indexoffset = 0; + int lastmatindex = 0; std::vector < GXFTrackState * >oldstates = trajectory.trackStates(); std::vector < GXFTrackState * >&states = trajectory.trackStates(); GXFTrackState *lastsistate = nullptr; @@ -3395,7 +3415,8 @@ namespace Trk { double firstr = firstsipar->position().perp(); double firstz2 = hasmat ? lastsipar->position().z() : firstsipar->position().z(); double firstr2 = hasmat ? lastsipar->position().perp() : firstsipar->position().perp(); - double lastz, lastr; + double lastz; + double lastr; GXFTrackState *firststate = oldstates.front(); GXFTrackState *laststate = oldstates.back(); @@ -3412,7 +3433,8 @@ namespace Trk { double slope = (tantheta != 0) ? 1 / tantheta : 0; // (lastz-firstz)/(lastr-firstr); if (slope != 0) { - std::vector < const Layer *>::const_iterator it, itend; + std::vector < const Layer *>::const_iterator it; + std::vector < const Layer *>::const_iterator itend; if (lastz > 0) { it = cache.m_posdiscs.begin(); @@ -3450,7 +3472,7 @@ namespace Trk { fabs((*it)->surfaceRepresentation().center().z()) < fabs(firstz) || (*it) == startlayer ) { - upstreamlayers.push_back(std::make_pair((Layer *) nullptr, (*it))); + upstreamlayers.emplace_back((Layer *) nullptr, (*it)); } if ( @@ -3458,7 +3480,7 @@ namespace Trk { (fabs((*it)->surfaceRepresentation().center().z()) > fabs(firstz2) || (*it) == startlayer2) ) { - layers.push_back(std::make_pair((Layer *) nullptr, (*it))); + layers.emplace_back((Layer *) nullptr, (*it)); } } } @@ -3486,7 +3508,7 @@ namespace Trk { (*it)->surfaceRepresentation().bounds().r() < firstr || (*it) == startlayer ) { - upstreamlayers.push_back(std::make_pair((*it), (Layer *) nullptr)); + upstreamlayers.emplace_back((*it), (Layer *) nullptr); } if ( @@ -3494,7 +3516,7 @@ namespace Trk { ((*it)->surfaceRepresentation().bounds().r() > firstr2 || (*it) == startlayer2) ) { - layers.push_back(std::make_pair((*it), (Layer *) nullptr)); + layers.emplace_back((*it), (Layer *) nullptr); } } @@ -3713,9 +3735,9 @@ namespace Trk { } } - if (eloss != nullptr) { + delete eloss; - } + GXFTrackState *matstate = new GXFTrackState(meff); matstate->setPosition(intersect); @@ -3743,10 +3765,16 @@ namespace Trk { return; } ATH_MSG_VERBOSE("GlobalChi2Fitter::addMaterial, refpar=" << *refpar2); - const MeasurementBase *firstmuonhit = nullptr, *lastmuonhit = nullptr, *firstidhit = - nullptr, *lastidhit = nullptr, *firsthit = nullptr, *lasthit = nullptr; + const MeasurementBase *firstmuonhit = nullptr; + const MeasurementBase *lastmuonhit = nullptr; + const MeasurementBase *firstidhit = + nullptr; + const MeasurementBase *lastidhit = nullptr; + const MeasurementBase *firsthit = nullptr; + const MeasurementBase *lasthit = nullptr; std::vector < GXFTrackState * >&states = trajectory.trackStates(); - std::vector < GXFTrackState * >matstates, newstates; + std::vector < GXFTrackState * > matstates; + std::vector < GXFTrackState * > newstates; std::unique_ptr< const std::vector < const TrackStateOnSurface *>, void (*)(const std::vector<const TrackStateOnSurface *> *) > matvec(nullptr,&Trk::GlobalChi2Fitter::Cache::objVectorDeleter<TrackStateOnSurface>); @@ -3763,7 +3791,8 @@ namespace Trk { const TrackParameters *firstmuonpar = nullptr; const TrackParameters *lastmuonpar = nullptr; - int npseudomuon1 = 0, npseudomuon2 = 0; + int npseudomuon1 = 0; + int npseudomuon2 = 0; for (auto & state : states) { TrackState::MeasurementType meastype = state->measurementType(); @@ -3960,9 +3989,9 @@ namespace Trk { if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) ); matvec.reset( m_extrapolator->extrapolateM(*startmatpar1, *destsurf, oppositeMomentum, false, matEffects) ); matvec_used=false; - if (tmppar != nullptr) { + delete tmppar; - } + if (matvec && !matvec->empty()) { for (int i = (int)matvec->size() - 1; i > -1; i--) { @@ -4062,13 +4091,13 @@ namespace Trk { matvec.reset( m_extrapolator->extrapolateM(*startmatpar2, *destsurf, alongMomentum, false, matEffects) ); matvec_used=false; - if (tmppar != nullptr) { + delete tmppar; - } - if (calosurf != nullptr) { + + delete calosurf; - } + if (matvec && !matvec->empty()) { for (auto & i : *matvec) { @@ -4523,7 +4552,8 @@ namespace Trk { std::vector < GXFTrackState * >oldstates = states; trajectory.setTrackStates(newstates); states.reserve(oldstates.size() + matstates.size()); - int layerno = 0, firstlayerno = -1; + int layerno = 0; + int firstlayerno = -1; if (cache.m_acceleration) { states.push_back(oldstates[0]); @@ -4614,8 +4644,7 @@ namespace Trk { delete refpar; if (matvec_used) cache.m_matTempStore.push_back( std::move(matvec) ); - return; - } + } const TrackParameters *GlobalChi2Fitter::makePerigee( Cache & cache, @@ -4749,7 +4778,8 @@ namespace Trk { Amg::Vector3D vertex; if (trajectory.numberOfScatterers() >= 2) { - GXFTrackState *scatstate = nullptr, *scatstate2 = nullptr; + GXFTrackState *scatstate = nullptr; + GXFTrackState *scatstate2 = nullptr; int scatindex = 0; for (std::vector < GXFTrackState * >::iterator it = trajectory.trackStates().begin(); it != trajectory.trackStates().end(); it++) { @@ -4788,44 +4818,40 @@ namespace Trk { double mindist = 99999; std::vector < GXFTrackState * >mymatvec; - for ( - std::vector < GXFTrackState * >::iterator it = trajectory.trackStates().begin(); - it != trajectory.trackStates().end(); - it++ - ) { - if ((**it).trackParameters() == nullptr) { + for (auto & it : trajectory.trackStates()) { + if ((*it).trackParameters() == nullptr) { continue; } - double distance = persurf.straightLineDistanceEstimate((**it).trackParameters()->position(),(**it).trackParameters()->momentum().unit()).first(); + double distance = persurf.straightLineDistanceEstimate((*it).trackParameters()->position(),(*it).trackParameters()->momentum().unit()).first(); bool insideid = ( (cache.m_caloEntrance == nullptr) || - cache.m_caloEntrance->inside((**it).trackParameters()->position()) + cache.m_caloEntrance->inside((*it).trackParameters()->position()) ); if ( - (((**it).measurement() != nullptr) && insideid) || ( - ((**it).materialEffects() != nullptr) && + (((*it).measurement() != nullptr) && insideid) || ( + ((*it).materialEffects() != nullptr) && distance > 0 && ( - (**it).materialEffects()->deltaE() == 0 || - ((**it).materialEffects()->sigmaDeltaPhi() == 0 && + (*it).materialEffects()->deltaE() == 0 || + ((*it).materialEffects()->sigmaDeltaPhi() == 0 && !insideid) || - (**it).materialEffects()->deltaPhi() != 0 + (*it).materialEffects()->deltaPhi() != 0 ) ) ) { - double dist = ((**it).trackParameters()->position() - vertex).perp(); + double dist = ((*it).trackParameters()->position() - vertex).perp(); if (dist < mindist) { mindist = dist; - nearestpar = (**it).trackParameters(); + nearestpar = (*it).trackParameters(); mymatvec.clear(); continue; } } - if (((**it).materialEffects() != nullptr) && distance > 0) { - mymatvec.push_back(*it); + if (((*it).materialEffects() != nullptr) && distance > 0) { + mymatvec.push_back(it); } } @@ -4994,7 +5020,8 @@ namespace Trk { int nscat = trajectory.numberOfScatterers(); int nbrem = trajectory.numberOfBrems(); - Eigen::MatrixXd a, a_inv; + Eigen::MatrixXd a; + Eigen::MatrixXd a_inv; a.resize(nfitpar, nfitpar); Amg::VectorX b(nfitpar); @@ -5216,7 +5243,9 @@ namespace Trk { std::vector < GXFTrackState * >&states = trajectory.trackStates(); double chi2 = 0; - int scatno = 0, bremno = 0, measno = 0; + int scatno = 0; + int bremno = 0; + int measno = 0; int nbrem = trajectory.numberOfBrems(); int nperpars = trajectory.numberOfPerigeeParameters(); int nfitpars = trajectory.numberOfFitParameters(); @@ -5523,7 +5552,9 @@ namespace Trk { ATH_MSG_DEBUG("fillDerivatives"); std::vector < GXFTrackState * >&states = trajectory.trackStates(); - int scatno = 0, bremno = 0, measno = 0; + int scatno = 0; + int bremno = 0; + int measno = 0; int nscatupstream = trajectory.numberOfUpstreamScatterers(); int nbremupstream = trajectory.numberOfUpstreamBrems(); int nscat = trajectory.numberOfScatterers(); @@ -5651,7 +5682,8 @@ namespace Trk { } if ((state->materialEffects() != nullptr) && state->materialEffects()->sigmaDeltaE() > 0) { - double qoverp = 0, qoverpbrem = 0; + double qoverp = 0; + double qoverpbrem = 0; qoverpbrem = 1000 * state->trackParameters()->parameters()[Trk::qOverP]; qoverp = qoverpbrem - state->materialEffects()->delta_p(); @@ -5719,7 +5751,9 @@ namespace Trk { int nbrem = trajectory.numberOfBrems(); double oldchi2 = trajectory.chi2(); double oldredchi2 = (trajectory.nDOF() > 0) ? oldchi2 / trajectory.nDOF() : 0; - int nsihits = trajectory.numberOfSiliconHits(), ntrthits = trajectory.numberOfTRTHits(), nhits = trajectory.numberOfHits(); + int nsihits = trajectory.numberOfSiliconHits(); + int ntrthits = trajectory.numberOfTRTHits(); + int nhits = trajectory.numberOfHits(); if (cache.m_phiweight.empty()) { cache.m_phiweight.assign(trajectory.trackStates().size(), 1); @@ -5766,7 +5800,8 @@ namespace Trk { cache.m_lastmeasurement[i] = nmeas - nbrem; } measno = 0; - int scatno = 0, bremno = 0; + int scatno = 0; + int bremno = 0; for (int i = 0; i < (int) trajectory.trackStates().size(); i++) { GXFTrackState *state = trajectory.trackStates()[i]; GXFMaterialEffects *meff = state->materialEffects(); @@ -5811,7 +5846,8 @@ namespace Trk { } for (int k = 0; k < nfitpars; k++) { - int minmeas = 0, maxmeas = nmeas - nbrem; + int minmeas = 0; + int maxmeas = nmeas - nbrem; maxmeas = cache.m_lastmeasurement[k]; minmeas = cache.m_firstmeasurement[k]; @@ -6104,8 +6140,10 @@ namespace Trk { int nperpars = trajectory.numberOfPerigeeParameters(); int nscats = trajectory.numberOfScatterers(); - int hitno = 0, measno = 0; - bool outlierremoved = false, hitrecalibrated = false; + int hitno = 0; + int measno = 0; + bool outlierremoved = false; + bool hitrecalibrated = false; for (int stateno = 0; stateno < (int) states.size(); stateno++) { GXFTrackState *state = states[stateno]; @@ -6279,7 +6317,8 @@ namespace Trk { } double maxsipull = -1; - int hitno = 0, hitno_maxsipull = -1; + int hitno = 0; + int hitno_maxsipull = -1; int measno_maxsipull = -1; int stateno_maxsipull = 0; GXFTrackState *state_maxsipull = nullptr; @@ -6391,7 +6430,11 @@ namespace Trk { double newerror[5]; newerror[0] = newerror[1] = newerror[2] = newerror[3] = newerror[4] = -1; - double newpull = -1, newpull1 = -1, newpull2 = -1, newres1 = -1, newres2 = -1; + double newpull = -1; + double newpull1 = -1; + double newpull2 = -1; + double newres1 = -1; + double newres2 = -1; double newsinstereo = 0; if ( @@ -6546,7 +6589,7 @@ namespace Trk { newb = b; newap = &newa; newbp = &newb; - cleanup_newtrajectory.reset(new GXFTrajectory(*oldtrajectory)); + cleanup_newtrajectory = std::make_unique<GXFTrajectory>(*oldtrajectory); newtrajectory = cleanup_newtrajectory.get(); if (newa.cols() != nfitpars) { @@ -6744,7 +6787,7 @@ namespace Trk { typePattern.set(TrackStateOnSurface::CaloDeposit); } else { typePattern.set(TrackStateOnSurface::BremPoint); - if (matEffects == electron && (trackpar != nullptr) && false) { + if (false) { double pafter = std::abs(1 / trackpar->parameters()[Trk::qOverP]); double pbefore = std::abs(1 / (trackpar->parameters()[Trk::qOverP] - .001 * gxfmeff->delta_p())); double mass = m_particleMasses.mass[matEffects]; @@ -6816,7 +6859,8 @@ namespace Trk { cache.m_derivmat.resize(nrealmeas, oldtrajectory.numberOfFitParameters()); cache.m_derivmat.setZero(); - int measindex = 0, measindex2 = 0; + int measindex = 0; + int measindex2 = 0; int nperpars = oldtrajectory.numberOfPerigeeParameters(); int nscat = oldtrajectory.numberOfScatterers(); @@ -6845,7 +6889,8 @@ namespace Trk { } } - GXFTrackState *firstmeasstate = nullptr, *lastmeasstate = nullptr; + GXFTrackState *firstmeasstate = nullptr; + GXFTrackState *lastmeasstate = nullptr; bool foundbrem = false; for (auto & hit : states) { @@ -7181,9 +7226,9 @@ namespace Trk { ATH_MSG_DEBUG("propagation failed, prev par: " << *prevtrackpar << " pos: " << prevtrackpar->position() << " destination surface: " << *surf); - if (jac != nullptr) { + delete jac; - } + if ( hitno != nstatesupstream - 1 && @@ -7258,7 +7303,7 @@ namespace Trk { newphi, newtheta, newqoverp, - NULL + nullptr ); } @@ -7364,9 +7409,9 @@ namespace Trk { ATH_MSG_DEBUG("propagation failed, prev par: " << *prevtrackpar << " pos: " << prevtrackpar-> position() << " destination surface: " << *surf); - if (jac != nullptr) { + delete jac; - } + return FitterStatusCode::ExtrapolationFailure; } @@ -7485,7 +7530,8 @@ namespace Trk { 4, 4, 4, 4, 5 }; std::vector < EigenRM55 > jacbrem(trajectory.numberOfBrems(), initialjac); - GXFTrackState *prevstate = nullptr, *state = nullptr; + GXFTrackState *prevstate = nullptr; + GXFTrackState *state = nullptr; for (int hitno = nstatesupstream - 1; hitno >= 0; hitno--) { state = states[hitno]; bool fillderivmat = false; @@ -7493,7 +7539,10 @@ namespace Trk { if (tstype != TrackState::Scatterer && tstype != TrackState::Brem) { fillderivmat = true; } - int jmin = 0, jmax = 4, jminbrem = 0, jmaxbrem = 4; + int jmin = 0; + int jmax = 4; + int jminbrem = 0; + int jmaxbrem = 4; if (hitno == 0) { if (!fillderivmat) { break; @@ -7640,7 +7689,10 @@ namespace Trk { if (tstype != TrackState::Scatterer && tstype != TrackState::Brem) { fillderivmat = true; } - int jmin = 0, jmax = 4, jminbrem = 0, jmaxbrem = 4; + int jmin = 0; + int jmax = 4; + int jminbrem = 0; + int jmaxbrem = 4; if (hitno == (int) states.size() - 1) { if (!fillderivmat) { break; @@ -7793,7 +7845,8 @@ namespace Trk { int nscats = trajectory.numberOfScatterers(); int nperpars = trajectory.numberOfPerigeeParameters(); int hitno = 0; - int scatno = nscatupstream, bremno = nbremupstream; + int scatno = nscatupstream; + int bremno = nbremupstream; std::vector < int >indices(states.size()); GXFTrackState *prevstate = nullptr; int i = nstatesupstream; @@ -7806,8 +7859,8 @@ namespace Trk { } } std::vector < int >rowindices[5]; - for (int i = 0; i < 5; i++) { - rowindices[i].reserve(nfitpars); + for (auto & rowindice : rowindices) { + rowindice.reserve(nfitpars); } for (int stateno = 0; stateno < (int) states.size(); stateno++) { if (stateno == 0 || stateno == nstatesupstream) { @@ -7940,7 +7993,8 @@ namespace Trk { trackerrmat(4, 4) = 1e-20; } - const TrackParameters *trackpar = nullptr, *tmptrackpar = + const TrackParameters *trackpar = nullptr; + const TrackParameters *tmptrackpar = state->trackParameters(); AmgMatrix(5, 5) * trkerrmat = state->trackCovariance(true); @@ -8134,10 +8188,7 @@ namespace Trk { if (phi < -M_PI) { phi += 2 * M_PI; } - if (theta < 0 || theta > M_PI || phi < -M_PI || phi > M_PI) { - return false; - } - return true; + return !(theta < 0 || theta > M_PI || phi < -M_PI || phi > M_PI); } void @@ -8192,7 +8243,9 @@ namespace Trk { // Project global error matrix onto current state double tmp3 = 0; - int j, k, rowindex; + int j; + int k; + int rowindex; for (int l = 0; l <= maxl; l++) { for (int m = minm[l]; m < l; m++) { diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx index 03e4542c290db743cf7a577584177a3ccac8c9fe..56251cfc47c4740b6e738aef357a3d8e6770f77f 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierLogic.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -29,7 +29,29 @@ #include "TrkFitterUtils/SensorBoundsCheck.h" #include "CLHEP/GenericFunctions/CumulativeChiSquare.hh" #include "TrkSurfaces/TrapezoidBounds.h" -#include <ext/algorithm> +#include <algorithm> + +namespace{ //anonymous namespace for comparison helper + bool + minChi2State(const Trk::Trajectory::iterator & pFirst, Trk::Trajectory::iterator & pSecond){ + auto dof = [](const Trk::Trajectory::iterator & pTrajectory)->int{ + return pTrajectory->fitQuality()->numberDoF(); + }; + auto itsTrapezoid = [](const Trk::Trajectory::iterator & pTrajectory)->bool{ + return dynamic_cast<const Trk::TrapezoidBounds*>(&pTrajectory->measurement()->associatedSurface().bounds()) != nullptr; + }; + int dof1{dof(pFirst)}; + int dof2{dof(pSecond)}; + if (dof1 == 2 and itsTrapezoid(pFirst)) dof1 = 1; + if (dof2 == 2 and itsTrapezoid(pSecond)) dof2 = 1; + auto chiSq =[](const Trk::Trajectory::iterator & pTrajectory, const int trueDof){ + return pTrajectory->fitQuality()->chiSquared() * trueDof; + }; + // X1^2/DoF1 > X2^2/DoF2, but do multiplication to be faster + return (chiSq(pFirst, dof2) > chiSq(pSecond, dof1)); + } + +} // constructor Trk::KalmanOutlierLogic::KalmanOutlierLogic(const std::string& t,const std::string& n,const IInterface* p) : @@ -105,22 +127,6 @@ StatusCode Trk::KalmanOutlierLogic::configureWithTools(Trk::IExtrapolator* extra return StatusCode::SUCCESS; } -// helper operator for STL min_element -struct minChi2State : public std::binary_function<Trk::Trajectory::iterator, Trk::Trajectory::iterator, bool> { - bool operator() (Trk::Trajectory::iterator one, Trk::Trajectory::iterator two) const { - // once more, correct ndof for rotated 1D measurements (SCT endcap, TGC strip) - int trueNumberDoF1 = one->fitQuality()->numberDoF(); - if (trueNumberDoF1 == 2 && dynamic_cast<const Trk::TrapezoidBounds*> - (&one->measurement()->associatedSurface().bounds())) trueNumberDoF1 = 1; - int trueNumberDoF2 = two->fitQuality()->numberDoF(); - if (trueNumberDoF2 == 2 && dynamic_cast<const Trk::TrapezoidBounds*> - (&two->measurement()->associatedSurface().bounds())) trueNumberDoF2 = 1; - - return (one->fitQuality()->chiSquared() * trueNumberDoF2 - > - two->fitQuality()->chiSquared() * trueNumberDoF1 ); - }; -}; // BKS-cov at 1st meas: 0.000378 0.00539 1.28e-05 1.37e-05 9.00e-10 // 200*cov : 0.0750 1.00000 2.56e-03 2.74e-03 1.80e-08 @@ -171,8 +177,6 @@ bool Trk::KalmanOutlierLogic::flagNewOutliers(Trk::Trajectory& T, ATH_MSG_VERBOSE ("-O- state #" << it->positionOnTrajectory() << " at r=" << it->smoothedTrackParameters()->position().perp() << " z=" << it->smoothedTrackParameters()->position().z()<< " fails boundary check"); - // m_log << MSG::VERBOSE << "-O- " << it->measurement()->associatedSurface().bounds() << endmsg; - // m_log << MSG::VERBOSE << "-O- " << it->measurement()->associatedSurface().center() << endmsg; it->isOutlier(Trk::TrackState::SensorOutlier, fitIteration); numberOfRejections++; numberOfSensorOutliers++; chi2GainFromSensorOutliers += it->fitQuality()->chiSquared(); @@ -285,10 +289,9 @@ bool Trk::KalmanOutlierLogic::flagNewOutliers(Trk::Trajectory& T, // search for worst states - do this via an STL sort so to be able to do more checks std::vector<Trk::Trajectory::iterator> bestStates(0); - for(Trk::Trajectory::iterator it = T.begin(); it!=T.end(); it++) + for(auto it = T.begin(); it!=T.end(); ++it) if ( it->measurement() && !it->isOutlier() ) bestStates.push_back(it); - if ( ! is_sorted( bestStates.begin(), bestStates.end(), minChi2State() ) ) - sort( bestStates.begin(), bestStates.end(), minChi2State() ); + std::sort( bestStates.begin(), bestStates.end(), minChi2State ); //can use partial sort? if (numberOfRejections == 0 ) { ATH_MSG_VERBOSE ("-O- No outlier found so far, taking state with highest chi2/NDF instead."); @@ -329,21 +332,26 @@ bool Trk::KalmanOutlierLogic::flagNewOutliers(Trk::Trajectory& T, } } else { if (m_utility->numberOfSpecificStates(T,Trk::TrackState::TRT,Trk::TrackState::Fittable)>4) { - //Trk::Trajectory::iterator states = *(bestStates.begin()); - bool found=false; unsigned int i=0; - while (i < bestStates.size() && !found) { - if (bestStates.at(i)->measurementType()==Trk::TrackState::TRT && - !(bestStates.at(i)->isOutlier()) && - fabs(bestStates.at(i)->measurement()->localParameters()[Trk::locR]) > 0.01) { - int pos = bestStates.at(i)->positionOnTrajectory(); + auto itsTRT = [](const Trk::Trajectory::iterator & pTrajectory){ + return (pTrajectory->measurementType()==Trk::TrackState::TRT); + }; + auto isAnOutlier = [](const Trk::Trajectory::iterator & pTrajectory){ + return pTrajectory->isOutlier(); + }; + auto absR_CutPasses = [](const Trk::Trajectory::iterator & pTrajectory){ + return (std::fabs(pTrajectory->measurement()->localParameters()[Trk::locR]) > 0.01); + }; + + for (const auto & state: bestStates){ + if (itsTRT(state) and not isAnOutlier(state) and absR_CutPasses(state)){ + const int pos = state->positionOnTrajectory(); ATH_MSG_DEBUG ("Outliers found as sensor outliers but they " << "did not contribute to the chi2. Now remove " << pos << - " with chi2 contrib " << *(bestStates.at(i)->fitQuality()) ); + " with chi2 contrib " << *(state->fitQuality()) ); firstStateWithOutlier = std::min(pos,firstStateWithOutlier); - bestStates.at(i)->isOutlier(Trk::TrackState::TrackOutlier,fitIteration); - found = true; + state->isOutlier(Trk::TrackState::TrackOutlier,fitIteration); + break; } - ++i; } } } @@ -364,12 +372,6 @@ bool Trk::KalmanOutlierLogic::flagNewOutliers(Trk::Trajectory& T, //////////////////////////////////////////////////////////////////////////////// bool Trk::KalmanOutlierLogic::reject(const Trk::FitQuality& fitQuality) const { - // use chi2 value - // if ( fitQuality.chiSquared() > m_Trajectory_Chi2PerNdfCut * fabs(fitQuality.numberDoF()) ) { - // if (m_outputlevel <= 0) m_log << MSG::DEBUG << "-O- trajectory with total chi2/ndf=" - // << fitQuality.chiSquared()/fabs(fitQuality.numberDoF()) - // << " fails quality cut" << endmsg; - // use probablity if (fitQuality.numberDoF() > 0 && fitQuality.chiSquared() > 0) { double prob = 1.0-Genfun::CumulativeChiSquare(fitQuality.numberDoF())(fitQuality.chiSquared()); diff --git a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx index c1ecc354a472b12b1a855db9802fc0d2fa09df15..70d50cea5ef85c2ed87237e970f959e8c479923e 100755 --- a/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx +++ b/Tracking/TrkFitter/TrkKalmanFitter/src/KalmanOutlierRecovery_InDet.cxx @@ -103,7 +103,7 @@ StatusCode Trk::KalmanOutlierRecovery_InDet::configureWithTools(Trk::IExtrapolat } // helper operator for STL min_element -struct minChi2State : public std::binary_function<Trk::Trajectory::iterator, Trk::Trajectory::iterator, bool> { +struct minChi2State { bool operator() (Trk::Trajectory::iterator one, Trk::Trajectory::iterator two) const { // once more, correct ndof for rotated 1D measurements (SCT endcap, TGC strip) int trueNumberDoF1 = one->fitQuality()->numberDoF(); diff --git a/Tracking/TrkFitter/TrkiPatFitter/CMakeLists.txt b/Tracking/TrkFitter/TrkiPatFitter/CMakeLists.txt index 1da3edb21cd4f20daa1fc2122cc8a201cdf87b36..569e9d6ab9ad635dca88a6162d7b50c472de89dc 100644 --- a/Tracking/TrkFitter/TrkiPatFitter/CMakeLists.txt +++ b/Tracking/TrkFitter/TrkiPatFitter/CMakeLists.txt @@ -15,6 +15,8 @@ atlas_depends_on_subdirs( PUBLIC Tracking/TrkDetDescr/TrkGeometry Tracking/TrkFitter/TrkFitterInterfaces Tracking/TrkFitter/TrkiPatFitterUtils + Tracking/TrkTools/TrkToolInterfaces + Tracking/TrkEvent/TrkTrackSummary PRIVATE Event/EventPrimitives Tracking/TrkDetDescr/TrkDetDescrInterfaces diff --git a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h index 47d174b41df3384ca4a7ee6f64e161b9cf2dbc29..58a50d2357a2f02c366734212b05d387e95c78f7 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h +++ b/Tracking/TrkFitter/TrkiPatFitter/TrkiPatFitter/iPatFitter.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -28,6 +28,8 @@ #include "TrkTrack/Track.h" #include "TrkTrack/TrackInfo.h" #include "TrkGeometry/MagneticFieldProperties.h" +#include "TrkToolInterfaces/IExtendedTrackSummaryTool.h" +#include "TrkTrackSummary/MuonTrackSummary.h" //<<<<<< CLASS DECLARATIONS >>>>>> @@ -47,6 +49,7 @@ class PerigeeSurface; class TrackingVolume; class TrackStateOnSurface; class Volume; +class IExtendedTrackSummaryTool; /** Main Fitter tool providing the implementation for the different * fitting, extension and refitting use cases. @@ -210,6 +213,7 @@ private: ToolHandle<IPropagator> m_stepPropagator; ToolHandle<IIntersector> m_straightLineIntersector; ServiceHandle<ITrackingVolumesSvc> m_trackingVolumesSvc; + ToolHandle<Trk::IExtendedTrackSummaryTool> m_trackSummaryTool; // configurable tolerances, warnings Gaudi::Property<double> m_orderingTolerance {this, "OrderingTolerance", 1. * Gaudi::Units::mm}; diff --git a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx index e2ef8d2a935f8771de83342cafb8a363dfca98a6..be44c482115bd43f5d5186839d568eea198aa385 100755 --- a/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx +++ b/Tracking/TrkFitter/TrkiPatFitter/src/iPatFitter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -54,6 +54,7 @@ namespace Trk m_stepPropagator("Trk::STEP_Propagator/AtlasSTEP_Propagator", this), m_straightLineIntersector("Trk::StraightLineIntersector/StraightLineIntersector", this), m_trackingVolumesSvc("TrackingVolumesSvc/TrackingVolumesSvc", name), + m_trackSummaryTool("MuonTrackSummaryTool"), m_stepField(Trk::MagneticFieldProperties(Trk::FullField)) { m_messageHelper = std::make_unique<MessageHelper>(*this); declareInterface<ITrackFitter>(this); @@ -62,6 +63,7 @@ namespace Trk declareProperty("SolenoidalIntersector", m_solenoidalIntersector); declareProperty("StraightLineIntersector", m_straightLineIntersector); declareProperty("TrackingVolumesSvc", m_trackingVolumesSvc); + declareProperty("TrackSummaryTool", m_trackSummaryTool ); } iPatFitter::~iPatFitter (void) @@ -149,6 +151,8 @@ namespace Trk m_trackingVolumesSvc->volume(ITrackingVolumesSvc::CalorimeterEntryLayer)); } + ATH_CHECK(m_trackSummaryTool.retrieve()); + // can now create FitProcedure class m_fitProcedure = std::make_unique<FitProcedure>( m_constrainedAlignmentEffects, @@ -1081,6 +1085,11 @@ namespace Trk } } + // generate a track summary for this candidate + if ( (m_trackSummaryTool.isEnabled()) && (fittedTrack!=nullptr) ) { + m_trackSummaryTool->computeAndReplaceTrackSummary(*fittedTrack, nullptr, false); + } + return fittedTrack.release(); } diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx index 1811dad05bc90c64e67f756d2dce424eac8dd1d5..0292578c9a4c60e97b16356ad08bca18e5b66241 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityProcessorTool.cxx @@ -168,8 +168,7 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::statistics() m_stat.dump(out, m_tryBremFit); out << endmsg; } - return; -} + } void Trk::DenseEnvironmentsAmbiguityProcessorTool::TrackStat::dump(MsgStream &out, bool try_brem_fit) const { @@ -375,8 +374,7 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::addTrack(Trk::Track* track, c // @TODO can delete this track ? cleanup_tracks.push_back(std::unique_ptr<const Trk::Track>(track) ); } - return; -} + } //================================================================================================== @@ -498,8 +496,6 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::solveTracks(const TracksScore } ATH_MSG_DEBUG ("Finished, number of track on output: "<<finalTracks.size()); - - return; } @@ -509,7 +505,7 @@ Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitTrack( const Trk: Trk::PRDtoTrackMap &prd_to_track_map, Trk::DenseEnvironmentsAmbiguityProcessorTool::TrackStat &stat) const { - Trk::Track* newTrack = 0; + Trk::Track* newTrack = nullptr; if (!m_suppressTrackFit){ if (m_refitPrds) { @@ -552,7 +548,7 @@ Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitTrack( const Trk: newTrack = new Trk::Track(info, vecTsos, fq); } - if (newTrack!=0) + if (newTrack!=nullptr) { ATH_MSG_DEBUG ("New track "<<newTrack<<" successfully fitted from "<<track); } @@ -574,25 +570,25 @@ Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitPrds( const Trk:: // @TODO ensured that prds on track are registered for this track ? std::vector<const Trk::PrepRawData*> prds = m_assoTool->getPrdsOnTrack(prd_to_track_map,*track); - if ( 0==prds.size() ) { + if ( prds.empty() ) { ATH_MSG_WARNING( "No PRDs on track"); - return 0; + return nullptr; } ATH_MSG_VERBOSE ("Track "<<track<<"\t has "<<prds.size()<<"\t PRDs"); const TrackParameters* par = track->perigeeParameters(); - if (par==0) { + if (par==nullptr) { ATH_MSG_DEBUG ("Track ("<<track<<") has no perigee! Try any other ?"); par = track->trackParameters()->front(); - if (par==0) { + if (par==nullptr) { ATH_MSG_DEBUG ("Track ("<<track<<") has no Track Parameters ! No refit !"); - return 0; + return nullptr; } } // refit using first parameter, do outliers - Trk::Track* newTrack = 0; + Trk::Track* newTrack = nullptr; if (m_tryBremFit && track->info().trackProperties(Trk::TrackInfo::BremFit)) { @@ -629,7 +625,7 @@ Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitPrds( const Trk:: if(newTrack) { stat.increment_by_eta(TrackStat::kNgoodFits,newTrack); //keeping the track of previously accumulated TrackInfo - const Trk::TrackInfo old_info = track->info(); + const Trk::TrackInfo& old_info = track->info(); newTrack->info().addPatternReco(old_info); } else { @@ -647,7 +643,7 @@ Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitRots(const Trk::T ATH_MSG_VERBOSE ("Refit track "<<track); // refit using first parameter, do outliers - Trk::Track* newTrack = 0; + Trk::Track* newTrack = nullptr; if (m_tryBremFit && track->info().trackProperties(Trk::TrackInfo::BremFit)) @@ -677,7 +673,7 @@ Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitRots(const Trk::T { stat.increment_by_eta(TrackStat::kNgoodFits,newTrack); //keeping the track of previously accumulated TrackInfo - const Trk::TrackInfo old_info = track->info(); + const Trk::TrackInfo& old_info = track->info(); newTrack->info().addPatternReco(old_info); } else { @@ -778,7 +774,7 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::storeTrkDistanceMapdR( TrackC std::pair<float,float> min (mindX, mindZ); ret = dRMapHandle->insert ( std::pair<const InDet::PixelCluster*,std::pair<float,float> >(pixel,min)); // if we already have a dR for this prd, we update it, if current value is smaller - if (ret.second==false) { + if (!ret.second) { InDet::DRMap::iterator it; it = dRMapHandle->find(pixel); if(sqrt(pow((*it).second.first,2)+pow((*it).second.second,2)) > (float)mindR) { @@ -789,8 +785,7 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::storeTrkDistanceMapdR( TrackC } if(refit) refit_tracks_out.push_back(track); } - return; -} + } //============================================================================================================ bool Trk::DenseEnvironmentsAmbiguityProcessorTool::decideIfInHighPtBROI(const Trk::Track* ptrTrack) const @@ -816,9 +811,11 @@ bool Trk::DenseEnvironmentsAmbiguityProcessorTool::decideIfInHighPtBROI(const Tr //============================================================================================================ bool Trk::DenseEnvironmentsAmbiguityProcessorTool::isHadCaloCompatible(const Trk::TrackParameters& Tp) const { - const double pi = M_PI, pi2 = 2.*M_PI; + const double pi = M_PI; + const double pi2 = 2.*M_PI; if(m_hadF.empty()) return false; - auto f = m_hadF.begin(), fe = m_hadF.end(); + auto f = m_hadF.begin(); + auto fe = m_hadF.end(); auto e = m_hadE.begin(); auto r = m_hadR.begin(); auto z = m_hadZ.begin(); @@ -870,7 +867,7 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::removeInnerHits(std::vector<c int count = 0; for (size_t i=0; i < measurements.size(); ++i){ const Trk::RIO_OnTrack* rio = dynamic_cast <const Trk::RIO_OnTrack*>(measurements.at(i)); - if (rio != 0) { + if (rio != nullptr) { const Identifier& surfaceID = (rio->identify()) ; if(m_idHelper->is_pixel(surfaceID) && count ==0){ //Only do this if we want to remove the pixel hits @@ -894,11 +891,11 @@ void Trk::DenseEnvironmentsAmbiguityProcessorTool::removeInnerHits(std::vector<c Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitTracksFromB(const Trk::Track* track, double fitQualityOriginal) const { const Trk::TrackParameters* par = track->perigeeParameters(); - if (par==0) { + if (par==nullptr) { par = track->trackParameters()->front(); - if (par==0) { + if (par==nullptr) { ATH_MSG_DEBUG ("Track ("<<track<<") has no Track Parameters ! No refit !"); - return 0; + return nullptr; } } @@ -914,7 +911,7 @@ Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitTracksFromB(const if ( (*trackStateOnSurface)->measurementOnTrack() ){ if ( (*trackStateOnSurface)->type( Trk::TrackStateOnSurface::Measurement) ){ const Trk::RIO_OnTrack* rio = dynamic_cast <const Trk::RIO_OnTrack*>( (*trackStateOnSurface)->measurementOnTrack() ); - if (rio != 0) { + if (rio != nullptr) { const Identifier& surfaceID = (rio->identify()) ; if(m_idHelper->is_pixel(surfaceID)|| m_idHelper->is_sct(surfaceID)) { measurementSet.push_back( (*trackStateOnSurface)->measurementOnTrack() ); @@ -938,12 +935,12 @@ Trk::Track* Trk::DenseEnvironmentsAmbiguityProcessorTool::refitTracksFromB(const } } if (previousMeasSize == measurementSet.size()){ - return 0; + return nullptr; } previousMeasSize = measurementSet.size(); } else { //cannot refit the track because we do not have enough measurements - return 0; + return nullptr; } } } diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx index 73403a01711423afa9e08da3999740de9551b0ad..41e9bcbe367e2813444b6bdd43bf55854c6a080b 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/DenseEnvironmentsAmbiguityScoreProcessorTool.cxx @@ -166,8 +166,7 @@ void Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::process(std::vector<cons } } - return; -} + } //================================================================================================== @@ -190,7 +189,7 @@ void Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::addNewTracks(std::vector float score = m_scoringTool->score( *a_track, true); ATH_MSG_DEBUG ("Track Score is "<< score); // veto tracks with score 0 - bool reject = (score==0) ? true:false; + bool reject = score==0; // double track rejection if (!reject) { @@ -222,8 +221,7 @@ void Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::addNewTracks(std::vector m_stat += stat; } - return; -} + } //================================================================================================== void Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::updatePixelSplitInformationForCluster(const std::pair<const InDet::PixelCluster* const, @@ -368,6 +366,5 @@ void Trk::DenseEnvironmentsAmbiguityScoreProcessorTool::overlappingTracks(const } } - return ; -} + } diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx index dc951b235a752df62ff815d06a5a6254b1a98297..35b8aaa868a1d84ae586d7450261ce989ab818ce 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/SimpleAmbiguityProcessorTool.cxx @@ -3,17 +3,18 @@ */ #include "SimpleAmbiguityProcessorTool.h" -#include "TrackScoringTool.h" -#include "TrkToolInterfaces/IPRD_AssociationTool.h" -#include "TrkTrack/TrackCollection.h" +#include "AtlasDetDescr/AtlasDetectorID.h" #include "GaudiKernel/MsgStream.h" +#include "TrackScoringTool.h" #include "TrkParameters/TrackParameters.h" #include "TrkRIO_OnTrack/RIO_OnTrack.h" -#include "AtlasDetDescr/AtlasDetectorID.h" +#include "TrkToolInterfaces/IPRD_AssociationTool.h" +#include "TrkTrack/TrackCollection.h" #include "TrkTrack/TrackInfo.h" -#include <map> #include <ext/functional> #include <iterator> +#include <map> +#include <memory> //================================================================================================== Trk::SimpleAmbiguityProcessorTool::SimpleAmbiguityProcessorTool(const std::string& t, @@ -352,8 +353,6 @@ void Trk::SimpleAmbiguityProcessorTool::addNewTracks(const std::vector<const Tra ATH_MSG_DEBUG ("Number of tracks in map:"<<trackScoreTrackMap.size()); DEBUG_CODE( countTrueTracksInMap( trackScoreTrackMap ) ); - - return; } //================================================================================================== @@ -453,8 +452,7 @@ void Trk::SimpleAmbiguityProcessorTool::addTrack(Trk::Track* in_track, DEBUG_CODE( rejectedTrack(atrack.get(), prd_to_track_map) ); cleanup_tracks.push_back(std::move(atrack)); } - return; -} + } //================================================================================================== TrackCollection *Trk::SimpleAmbiguityProcessorTool::solveTracks(TrackScoreMap& trackScoreTrackMap, @@ -520,7 +518,7 @@ TrackCollection *Trk::SimpleAmbiguityProcessorTool::solveTracks(TrackScoreMap& t } // delete original copy } - else if ( cleanedTrack.get() ) + else if ( cleanedTrack ) { DEBUG_CODE(newCleanedTrack(cleanedTrack.get(), atrack.track()) ); @@ -616,7 +614,7 @@ void Trk::SimpleAmbiguityProcessorTool::refitTrack( const Trk::Track* track, newInfo.setPatternRecognitionInfo(Trk::TrackInfo::SimpleAmbiguityProcessorTool); info.addPatternReco(newInfo); - newTrack.reset( new Trk::Track(info, vecTsos, fq) ); + newTrack = std::make_unique<Trk::Track>( info, vecTsos, fq ); } if (newTrack) @@ -631,8 +629,7 @@ void Trk::SimpleAmbiguityProcessorTool::refitTrack( const Trk::Track* track, ATH_MSG_DEBUG ("Fit failed !"); } - return; -} + } //================================================================================================== @@ -644,7 +641,7 @@ Trk::Track* Trk::SimpleAmbiguityProcessorTool::refitPrds( const Trk::Track* trac // get vector of PRDs std::vector<const Trk::PrepRawData*> prds = m_assoTool->getPrdsOnTrack(prd_to_track_map,*track); - if ( 0==prds.size() ) { + if ( prds.empty() ) { msg(MSG::WARNING) << "No PRDs on track"<<endmsg; return nullptr; } @@ -698,7 +695,7 @@ Trk::Track* Trk::SimpleAmbiguityProcessorTool::refitPrds( const Trk::Track* trac increment_by_eta(Counter::kNgoodFits,stat,newTrack); //keeping the track of previously accumulated TrackInfo - const Trk::TrackInfo old_info = track->info(); + const Trk::TrackInfo& old_info = track->info(); newTrack->info().addPatternReco(old_info); } else @@ -718,7 +715,7 @@ Trk::Track* Trk::SimpleAmbiguityProcessorTool::refitRots( const Trk::Track* trac ATH_MSG_VERBOSE ("Refit track "<<track); // refit using first parameter, do outliers - Trk::Track* newTrack = 0; + Trk::Track* newTrack = nullptr; if (m_tryBremFit && track->info().trackProperties(Trk::TrackInfo::BremFit)) @@ -755,7 +752,7 @@ Trk::Track* Trk::SimpleAmbiguityProcessorTool::refitRots( const Trk::Track* trac increment_by_eta(Counter::kNgoodFits,stat,newTrack); //keeping the track of previously accumulated TrackInfo - const Trk::TrackInfo old_info = track->info(); + const Trk::TrackInfo& old_info = track->info(); newTrack->info().addPatternReco(old_info); } else @@ -784,7 +781,6 @@ void Trk::SimpleAmbiguityProcessorTool::dumpTracks( const TrackCollection& track totalScore+=score; } ATH_MSG_DEBUG ("Total event score : "<<totalScore); - return; } diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx index 18cf1bee0f6800754294430850094e2fdad52def..f7bf61dde11fd830fe1c394e52d016b490cbea71 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackScoringTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -84,7 +84,7 @@ StatusCode Trk::TrackScoringTool::finalize() Trk::TrackScore Trk::TrackScoringTool::score( const Track& track, const bool suppressHoleSearch ) const { - const TrackSummary* summary = 0; + const TrackSummary* summary = nullptr; if (suppressHoleSearch) summary = m_trkSummaryTool->createSummaryNoHoleSearch(track); else @@ -109,7 +109,7 @@ Trk::TrackScore Trk::TrackScoringTool::simpleScore( const Track& track, const Tr TrackScore score(100); // score of 100 per track // --- prob(chi2,NDF), protect for chi2<0 - if (track.fitQuality()!=0 && track.fitQuality()->chiSquared() > 0 && track.fitQuality()->numberDoF() > 0) { + if (track.fitQuality()!=nullptr && track.fitQuality()->chiSquared() > 0 && track.fitQuality()->numberDoF() > 0) { score+= log10(1.0-Genfun::CumulativeChiSquare(track.fitQuality()->numberDoF())(track.fitQuality()->chiSquared())); } diff --git a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackSelectionProcessorTool.cxx b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackSelectionProcessorTool.cxx index aa9b4a5bff30bb2630094392404e0073fbb4a000..bba26bb5167e8dac146605f0667dddc40190d45a 100644 --- a/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackSelectionProcessorTool.cxx +++ b/Tracking/TrkTools/TrkAmbiguityProcessor/src/TrackSelectionProcessorTool.cxx @@ -185,8 +185,6 @@ void Trk::TrackSelectionProcessorTool::addNewTracks(TrackScoreMap &trackScoreTra } ATH_MSG_DEBUG ("Number of tracks in map:"<<trackScoreTrackMap.size()); - - return; } void Trk::TrackSelectionProcessorTool::solveTracks(TrackScoreMap &trackScoreTrackMap, @@ -219,7 +217,7 @@ void Trk::TrackSelectionProcessorTool::solveTracks(TrackScoreMap &trackScoreTrac // add to output list final_tracks.push_back( const_cast<Track*>(atrack.track()) ); - }else if ( !cleanedTrack.get() ) { + }else if ( !cleanedTrack ) { // track should be discarded ATH_MSG_DEBUG ("Track "<< atrack.track() << " doesn't meet the cuts of the AmbiTrack Selection tool"); @@ -236,8 +234,6 @@ void Trk::TrackSelectionProcessorTool::solveTracks(TrackScoreMap &trackScoreTrac } ATH_MSG_DEBUG ("Finished, number of track on output: "<<final_tracks.size()); - - return; } //================================================================================================== @@ -258,5 +254,4 @@ void Trk::TrackSelectionProcessorTool::dumpTracks( const TrackCollection& tracks totalScore+=score; } ATH_MSG_DEBUG ("Total event score : "<<totalScore); - return; } diff --git a/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx b/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx index 11de33a56b380d035416389658d04ef63b676e3f..eb552def3c8bf35c951b0f4d967cb70a75eb8eb3 100755 --- a/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx +++ b/Tracking/TrkTools/TrkAssociationTools/src/PRD_AssociationTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkAssociationTools/PRD_AssociationTool.h" @@ -201,7 +201,7 @@ Trk::PRD_AssociationTool::getPrdsOnTrack(const Maps& maps, return itvec->second; } - if (track.measurementsOnTrack()==0) { + if (track.measurementsOnTrack()==nullptr) { ATH_MSG_WARNING ("Track has no RoTs"); return PRDs_t(); } diff --git a/Tracking/TrkTools/TrkAssociationTools/src/PRDtoTrackMapTool.cxx b/Tracking/TrkTools/TrkAssociationTools/src/PRDtoTrackMapTool.cxx index a9f2ab46ce0409e09fa6a29dd829a052aaf48527..ce7a3723521b87fbe22720c68774907bd5e47a25 100644 --- a/Tracking/TrkTools/TrkAssociationTools/src/PRDtoTrackMapTool.cxx +++ b/Tracking/TrkTools/TrkAssociationTools/src/PRDtoTrackMapTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkAssociationTools/PRDtoTrackMapTool.h" @@ -135,7 +135,7 @@ Trk::PRDtoTrackMapTool::getPrdsOnTrack(Trk::PRDtoTrackMap &virt_prd_to_track_map return itvec->second; } - if (track.measurementsOnTrack()==0) { + if (track.measurementsOnTrack()==nullptr) { ATH_MSG_WARNING ("Track has no RoTs"); return PRDs_t(); } diff --git a/Tracking/TrkTools/TrkCompetingRIOsOnTrackTool/src/CompetingRIOsOnTrackTool.cxx b/Tracking/TrkTools/TrkCompetingRIOsOnTrackTool/src/CompetingRIOsOnTrackTool.cxx index 142b7f1f55afc8412ea65e6c232892226f0b128b..696aeb5d7e6c0c1c56493c71d2a2d60e44fc30b9 100755 --- a/Tracking/TrkTools/TrkCompetingRIOsOnTrackTool/src/CompetingRIOsOnTrackTool.cxx +++ b/Tracking/TrkTools/TrkCompetingRIOsOnTrackTool/src/CompetingRIOsOnTrackTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -76,7 +76,7 @@ StatusCode Trk::CompetingRIOsOnTrackTool::initialize() { } } else { ATH_MSG_DEBUG("No Tool for making CompetingPixelClustersOnTrack given."); - m_compPixelTool = 0; + m_compPixelTool = nullptr; } if ( ! m_compSCT_Tool.empty() ) { @@ -154,7 +154,7 @@ const Trk::CompetingRIOsOnTrack* Trk::CompetingRIOsOnTrackTool::createCompetingR // --- this is not necessarily a problem or a wrong configuration, e.g. the DAF can // --- operate in a mode, where annealing is just performed for some of the sub-detectors // simply return a NULL pointer: - return 0; + return nullptr; } @@ -195,7 +195,6 @@ void Trk::CompetingRIOsOnTrackTool::updateCompetingROT( // --- its assignment probabilities ATH_MSG_WARNING( "could not identify CompetingROT as one of those with a detector-specific tool given!"); ATH_MSG_WARNING( "PRD with identifier " << m_idHelper->print_to_string(id)); - return; } StatusCode Trk::CompetingRIOsOnTrackTool::updateCompetingROTprobs( @@ -244,29 +243,29 @@ Trk::CompetingRIOsOnTrackTool::createSimpleCompetingROT if (mtype == Trk::TrackState::Pixel || (mtype==Trk::TrackState::unidentified && m_idHelper->is_pixel(id)) ) { - if (!m_compPixelTool) return 0; + if (!m_compPixelTool) return nullptr; std::list< const Trk::PrepRawData* > plist; plist.push_back(&prd); return m_compPixelTool->createCompetingROT(plist,trkPar,beta); } if (mtype == Trk::TrackState::SCT || (mtype==Trk::TrackState::unidentified && m_idHelper->is_sct(id)) ) { - if (m_compSCT_Tool.empty()) return 0; + if (m_compSCT_Tool.empty()) return nullptr; std::list< const Trk::PrepRawData* > plist; plist.push_back(&prd); return m_compSCT_Tool->createCompetingROT(plist,trkPar,beta); } if (mtype == Trk::TrackState::TRT || (mtype==Trk::TrackState::unidentified && m_idHelper->is_trt(id)) ) - return (m_compTRT_Tool.empty() ? 0 : + return (m_compTRT_Tool.empty() ? nullptr : m_compTRT_Tool->createSimpleCompetingROT(prd,trkPar,beta) ); if (mtype == Trk::TrackState::MDT || (mtype==Trk::TrackState::unidentified && m_idHelper->is_mdt(id)) ) - return (m_compMuonDriftCircleTool.empty() ? 0 : + return (m_compMuonDriftCircleTool.empty() ? nullptr : m_compMuonDriftCircleTool->createSimpleCompetingROT(prd,trkPar,beta)); - return (m_compMuonClusterTool.empty() ? 0 : + return (m_compMuonClusterTool.empty() ? nullptr : m_compMuonClusterTool->createSimpleCompetingROT(prd,trkPar,beta)); } diff --git a/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h b/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h index 80d601ec278c4ed6b101a10dfa33c657ffebcff7..eb25be2f906a271699860f7f59b60e3fcd05bb03 100644 --- a/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h +++ b/Tracking/TrkTools/TrkMaterialProvider/TrkMaterialProvider/TrkMaterialProviderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -73,14 +73,14 @@ namespace Trk{ void updateCaloTSOS(Trk::Track& idTrack, Trk::Track& extrapolatedTrack) const; /** Update Calorimeter TSOS from input MS/CB track*/ - void updateCaloTSOS(Trk::Track& track, const Trk::TrackParameters* startParamaters=0) const; + void updateCaloTSOS(Trk::Track& track, const Trk::TrackParameters* startParamaters=nullptr) const; /** Get Calorimeter MEOT*/ void getCaloMEOT(const Trk::Track& idTrack, const Trk::Track& msTrack, std::vector<MaterialEffectsOnTrack>& calomeots) const; /** Retrieve Calorimeter TSOS from TG and apply corrections*/ std::vector<const Trk::TrackStateOnSurface*>* - getCaloTSOS (const Trk::TrackParameters& parm, const Trk::Track &muonTrack, const Trk::TrackParameters* parms=0) const; + getCaloTSOS (const Trk::TrackParameters& parm, const Trk::Track &muonTrack, const Trk::TrackParameters* parms=nullptr) const; /** Retrieve a clone of the parametrised energy loss*/ CaloEnergy* getParamCaloELoss(Trk::Track* track) const; @@ -97,7 +97,7 @@ namespace Trk{ double& Eloss, double& X0ScaleMS, double& ElossScaleMS, - const Trk::TrackParameters* parms=0, + const Trk::TrackParameters* parms=nullptr, bool boundaryCheck=false, bool removeOoC=false) const; @@ -132,7 +132,7 @@ namespace Trk{ void deleteTSOS(DataVector<const Trk::TrackStateOnSurface>* vecTSOS) const; //** Helper to printout TSOS details*/ - void printTSOS(const Trk::TrackStateOnSurface* m, std::string tag) const; + void printTSOS(const Trk::TrackStateOnSurface* m, const std::string& tag) const; /** Function to modify TSOS doing repositioning, aggregation and corrections*/ DataVector<const Trk::TrackStateOnSurface>* diff --git a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx index 78b57f2203419255d10eac666d2dfbb32423b3da..e50d835097a262e47bb394c2cd9adbc90394797b 100644 --- a/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx +++ b/Tracking/TrkTools/TrkMaterialProvider/src/TrkMaterialProviderTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkMaterialProvider/TrkMaterialProviderTool.h" @@ -47,9 +47,9 @@ Trk::TrkMaterialProviderTool::TrkMaterialProviderTool(const std::string& t, cons m_caloMeasTool ("Rec::MuidCaloEnergyMeas/MuidCaloEnergyMeas"), m_caloParamTool ("Rec::MuidCaloEnergyParam/MuidCaloEnergyParam"), m_trackIsolationTool ("Rec::MuidTrackIsolation/MuidTrackIsolation"), - m_DetID(0), - m_calorimeterVolume(0), - m_indetVolume(0), + m_DetID(nullptr), + m_calorimeterVolume(nullptr), + m_indetVolume(nullptr), m_magFieldSvc ("AtlasFieldSvc",n), m_maxNTracksIso(2), m_paramPtCut(15.0*Gaudi::Units::GeV), @@ -241,7 +241,7 @@ void Trk::TrkMaterialProviderTool::updateCaloTSOS(Trk::Track& track, const Trk:: Trk::alongMomentum, Trk::muon, Eloss, X0ScaleMS, ElossScaleMS, - (firstMSwP == inputTSOS->end()) ? 0 : (*firstMSwP)->trackParameters(), + (firstMSwP == inputTSOS->end()) ? nullptr : (*firstMSwP)->trackParameters(), false, true); @@ -261,13 +261,6 @@ void Trk::TrkMaterialProviderTool::updateCaloTSOS(Trk::Track& track, const Trk:: // update the original vector this->updateVector(inputTSOS, firstCALO, firstMS, caloTSOS); myLocal_resetTrack(track); - -#ifdef DEBUGON - ATH_MSG_VERBOSE("NEW TSOS multiplicity : " << inputTSOS->size()); - for(auto m : *inputTSOS) this->printTSOS(m, "NEW TSOS"); -#endif - - return; } @@ -371,7 +364,7 @@ void Trk::TrkMaterialProviderTool::updateCaloTSOS(Trk::Track& idTrack, Trk::Trac Trk::alongMomentum, Trk::muon, Eloss, X0ScaleMS, ElossScaleMS, - (firstMSwP == inputTSOS_MS->end()) ? 0 : (*firstMSwP)->trackParameters(), + (firstMSwP == inputTSOS_MS->end()) ? nullptr : (*firstMSwP)->trackParameters(), false, true); @@ -395,13 +388,6 @@ void Trk::TrkMaterialProviderTool::updateCaloTSOS(Trk::Track& idTrack, Trk::Trac this->updateVector(inputTSOS_MS, firstCALO, firstMS, caloTSOS); myLocal_resetTrack(extrapolatedTrack); - -#ifdef DEBUGON - ATH_MSG_VERBOSE("NEW-MS TSOS multiplicity : " << inputTSOS_MS->size()); - for(auto m : *inputTSOS_MS) printTSOS(m, "NEW-MS TSOS"); -#endif - - return; } @@ -500,7 +486,7 @@ void Trk::TrkMaterialProviderTool::getCaloMEOT(const Trk::Track& idTrack, const Trk::alongMomentum, Trk::muon, Eloss, X0ScaleMS, ElossScaleMS, - (firstMSwP == inputTSOS_MS->end()) ? 0 : (*firstMSwP)->trackParameters(), + (firstMSwP == inputTSOS_MS->end()) ? nullptr : (*firstMSwP)->trackParameters(), false, true); @@ -527,11 +513,11 @@ void Trk::TrkMaterialProviderTool::getCaloMEOT(const Trk::Track& idTrack, const } double sintheta=std::sin((*caloTSOS)[i]->trackParameters()->parameters()[Trk::theta]); double qoverp=(*caloTSOS)[i]->trackParameters()->parameters()[Trk::qOverP]; - const CaloEnergy *eloss=0; + const CaloEnergy *eloss=nullptr; if (meot) eloss=dynamic_cast<const CaloEnergy *>(meot->energyLoss()); - Trk::EnergyLoss *neweloss=0; - Trk::ScatteringAngles *newsa=0; + Trk::EnergyLoss *neweloss=nullptr; + Trk::ScatteringAngles *newsa=nullptr; if (eloss) neweloss = new CaloEnergy(*eloss); else{ Trk::MaterialProperties matprop(meot->thicknessInX0(),1.,0.,0.,0.,0.); @@ -543,8 +529,6 @@ void Trk::TrkMaterialProviderTool::getCaloMEOT(const Trk::Track& idTrack, const delete (*caloTSOS)[i]; } delete caloTSOS; - - return; } @@ -791,8 +775,8 @@ Trk::TrkMaterialProviderTool::getCaloTSOS (const Trk::TrackParameters& parm, #endif - DataVector<const Trk::TrackStateOnSurface>* finalCaloTSOS = 0; - if(caloTSOS->size()<1||Eloss<1000.) { + DataVector<const Trk::TrackStateOnSurface>* finalCaloTSOS = nullptr; + if(caloTSOS->empty()||Eloss<1000.) { if(dir==Trk::alongMomentum&&pOri>4000.) { ATH_MSG_WARNING("Unable to retrieve Calorimeter TSOS from extrapolateM caloTSOS->size() "<< caloTSOS->size() << " Eloss " << Eloss ); ATH_MSG_WARNING(" momentum of track " << pOri); @@ -910,7 +894,7 @@ Trk::TrkMaterialProviderTool::getCaloTSOS (const Trk::TrackParameters& parm, // // sigmaElossIoni should be scaled by 0.45 to go to Landau this is later done in updateEloss // - if(muonTrack.trackParameters() && muonTrack.trackParameters()->size()>0) + if(muonTrack.trackParameters() && !muonTrack.trackParameters()->empty()) m_muonCaloEnergyTool->calculateMuonEnergies( &muonTrack, totalEloss, meanElossIoni, 0.45*sigmaElossIoni, measCaloEnergy, measCaloEnergyError, fsrCaloEnergy, e_exp, @@ -1003,7 +987,7 @@ CaloEnergy* Trk::TrkMaterialProviderTool::getParamCaloELoss(Trk::Track* track) c } } } - return (CaloEnergy*)(0x0); + return (CaloEnergy*)nullptr; } @@ -1012,7 +996,7 @@ CaloEnergy* Trk::TrkMaterialProviderTool::getParamCaloELoss(Trk::Track* track) c /**Helper to get last calo TSOS with TP*/ const Trk::TrackStateOnSurface* Trk::TrkMaterialProviderTool::getCaloExitTSOS(const std::vector<const Trk::TrackStateOnSurface*>* caloTSOS, Trk::PropDirection dir) const { - const Trk::TrackStateOnSurface* tsosAtCaloExit = 0; + const Trk::TrackStateOnSurface* tsosAtCaloExit = nullptr; if(dir==Trk::alongMomentum) { std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator it = caloTSOS->rbegin(); std::vector<const Trk::TrackStateOnSurface*>::const_reverse_iterator itEnd = caloTSOS->rend(); @@ -1041,7 +1025,7 @@ const Trk::TrackStateOnSurface* Trk::TrkMaterialProviderTool::getCaloExitTSOS(co /**Helper to get first calo TSOS with TP*/ const Trk::TrackStateOnSurface* Trk::TrkMaterialProviderTool::getCaloEntryTSOS(const std::vector<const Trk::TrackStateOnSurface*>* caloTSOS, Trk::PropDirection dir) const { - const Trk::TrackStateOnSurface* tsosAtCaloEntry = 0; + const Trk::TrackStateOnSurface* tsosAtCaloEntry = nullptr; if(dir==Trk::alongMomentum) { std::vector<const Trk::TrackStateOnSurface*>::const_iterator it = caloTSOS->begin(); std::vector<const Trk::TrackStateOnSurface*>::const_iterator itEnd = caloTSOS->end(); @@ -1205,10 +1189,10 @@ void Trk::TrkMaterialProviderTool::updateVectorMS(DataVector<const Trk::TrackSta Trk::EnergyLoss* energyLossNew = new EnergyLoss(deltaE, sigmaDeltaE, sigmaMinusDeltaE, sigmaPlusDeltaE, deltaE_ioni, sigmaDeltaE_ioni, deltaE_rad, sigmaDeltaE_rad, depth ) ; const Trk::Surface& surf = meot->associatedSurface(); const Trk::MaterialEffectsOnTrack* newMeot = new Trk::MaterialEffectsOnTrack(X0ScaleMS*meot->thicknessInX0(), scatNew, energyLossNew, surf, meotPattern); - const Trk::TrackParameters* pars = 0; + const Trk::TrackParameters* pars = nullptr; if((*it)->trackParameters()) pars = (*it)->trackParameters()->clone(); // make new TSOS - const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( 0, pars, 0, newMeot, typePattern ); + const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( nullptr, pars, nullptr, newMeot, typePattern ); DataVector<const Trk::TrackStateOnSurface>* newTSOSvector = new DataVector<const Trk::TrackStateOnSurface>(SG::VIEW_ELEMENTS); newTSOSvector->push_back(&(*newTSOS)); // replace TSOS in MS with new one @@ -1242,8 +1226,7 @@ void Trk::TrkMaterialProviderTool::updateVectorMS(DataVector<const Trk::TrackSta } // end debug - return; - + } //* Helper to indentify detector volume**/ @@ -1288,7 +1271,7 @@ void Trk::TrkMaterialProviderTool::deleteTSOS(DataVector<const Trk::TrackStateOn //** Helper to printout TSOS details*/ -void Trk::TrkMaterialProviderTool::printTSOS(const Trk::TrackStateOnSurface* m, std::string tag) const +void Trk::TrkMaterialProviderTool::printTSOS(const Trk::TrackStateOnSurface* m, const std::string& tag) const { unsigned int ivolGeo = getVolumeByGeo(m); @@ -1405,9 +1388,9 @@ Trk::TrkMaterialProviderTool::modifyTSOSvector(const std::vector<const Trk::Trac double deltaE_rad_tot = 0.; double sigmaDeltaE_rad_tot =0.; - const Trk::TrackStateOnSurface* mprevious = 0; - const Trk::TrackStateOnSurface* mfirst = 0; - const Trk::TrackStateOnSurface* mlast = 0; + const Trk::TrackStateOnSurface* mprevious = nullptr; + const Trk::TrackStateOnSurface* mfirst = nullptr; + const Trk::TrackStateOnSurface* mlast = nullptr; Amg::Vector3D posFirst(0.,0.,0.); // double distLast = 0.; double deltaEFirst = 0.; @@ -1449,8 +1432,8 @@ Trk::TrkMaterialProviderTool::modifyTSOSvector(const std::vector<const Trk::Trac if(m->materialEffectsOnTrack()) { double X0 = m->materialEffectsOnTrack()->thicknessInX0(); const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(m->materialEffectsOnTrack()); - const Trk::EnergyLoss* energyLoss = 0; - const Trk::ScatteringAngles* scat = 0; + const Trk::EnergyLoss* energyLoss = nullptr; + const Trk::ScatteringAngles* scat = nullptr; if(meot) { energyLoss = meot->energyLoss(); if (!energyLoss) { @@ -1537,7 +1520,7 @@ Trk::TrkMaterialProviderTool::modifyTSOSvector(const std::vector<const Trk::Trac const Trk::TrackParameters* pars = m->trackParameters()->clone(); // make new TSOS - const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( 0, pars, 0, meotLast, typePattern ); + const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( nullptr, pars, nullptr, meotLast, typePattern ); newTSOSvector->push_back(newTSOS); ATH_MSG_VERBOSE(" NO aggregation and NO reposition TSOS type " << newTSOS->dumpType() << " TSOS surface " << newTSOS->trackParameters()->associatedSurface() << " position x " << newTSOS->trackParameters()->position().x() << " y " << newTSOS->trackParameters()->position().y() << " z " << newTSOS->trackParameters()->position().z() << " direction x " << newTSOS->trackParameters()->momentum().unit().x() << " y " << newTSOS->trackParameters()->momentum().unit().y() << " z " << newTSOS->trackParameters()->momentum().unit().z() << " p " << newTSOS->trackParameters()->momentum().mag() << " X0 " << X0_tot << " deltaE " << caloEnergyNew->deltaE() << " sigma deltaTheta " << scatNew->sigmaDeltaTheta() ); @@ -1571,7 +1554,7 @@ Trk::TrkMaterialProviderTool::modifyTSOSvector(const std::vector<const Trk::Trac const Trk::MaterialEffectsOnTrack* meotLast = new Trk::MaterialEffectsOnTrack(X0_tot, scatNew, caloEnergyNew, surf, meotPattern); const Trk::TrackParameters* pars = m->trackParameters()->clone(); // make new TSOS - const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( 0, pars, 0, meotLast, typePattern ); + const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( nullptr, pars, nullptr, meotLast, typePattern ); newTSOSvector->push_back(newTSOS); ATH_MSG_VERBOSE(" NO aggregation and WITH reposition Thin Scatterer TSOS type " << newTSOS->dumpType() << " TSOS surface " << newTSOS->trackParameters()->associatedSurface() << " position x " << newTSOS->trackParameters()->position().x() << " y " << newTSOS->trackParameters()->position().y() << " z " << newTSOS->trackParameters()->position().z() << " direction x " << newTSOS->trackParameters()->momentum().unit().x() << " y " << newTSOS->trackParameters()->momentum().unit().y() << " z " << newTSOS->trackParameters()->momentum().unit().z() << " p " << newTSOS->trackParameters()->momentum().mag() << " X0 " << meotLast->thicknessInX0() << " deltaE " << caloEnergyNew->deltaE() << " sigma deltaTheta " << scatNew->sigmaDeltaTheta() ); @@ -1625,8 +1608,8 @@ Trk::TrkMaterialProviderTool::modifyTSOSvector(const std::vector<const Trk::Trac const Trk::TrackParameters* parsLast = surfLast->createParameters<5,Trk::Charged>(0.,0.,dir.phi(),dir.theta(),qOverPNew); // make TSOS // - const Trk::TrackStateOnSurface* newTSOSFirst = new Trk::TrackStateOnSurface( 0, parsFirst, 0, meotFirst, typePattern ); - const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( 0, parsLast, 0, meotLast, typePattern ); + const Trk::TrackStateOnSurface* newTSOSFirst = new Trk::TrackStateOnSurface( nullptr, parsFirst, nullptr, meotFirst, typePattern ); + const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( nullptr, parsLast, nullptr, meotLast, typePattern ); ATH_MSG_VERBOSE(" first NO aggregation and WITH reposition TSOS type " << newTSOSFirst->dumpType() << " TSOS surface " << newTSOSFirst->trackParameters()->associatedSurface() << " position x " << newTSOSFirst->trackParameters()->position().x() << " y " << newTSOSFirst->trackParameters()->position().y() << " z " << newTSOSFirst->trackParameters()->position().z() << " direction x " << newTSOSFirst->trackParameters()->momentum().unit().x() << " y " << newTSOSFirst->trackParameters()->momentum().unit().y() << " z " << newTSOSFirst->trackParameters()->momentum().unit().z() << " p " << newTSOSFirst->trackParameters()->momentum().mag() << " X0 " << meotFirst->thicknessInX0() << " deltaE " << energyLoss0->deltaE() << " sigma deltaTheta " << scatFirst->sigmaDeltaTheta() ); ATH_MSG_VERBOSE(" second NO aggregation and WITH reposition TSOS type " << newTSOS->dumpType() << " TSOS surface " << newTSOS->trackParameters()->associatedSurface() << " position x " << newTSOS->trackParameters()->position().x() << " y " << newTSOS->trackParameters()->position().y() << " z " << newTSOS->trackParameters()->position().z() << " direction x " << newTSOS->trackParameters()->momentum().unit().x() << " y " << newTSOS->trackParameters()->momentum().unit().y() << " z " << newTSOS->trackParameters()->momentum().unit().z() << " p " << newTSOS->trackParameters()->momentum().mag() << " X0 " << meotLast->thicknessInX0() << " deltaE " << caloEnergyNew->deltaE() << " sigma deltaTheta " << scatNew->sigmaDeltaTheta() ); @@ -1765,13 +1748,13 @@ Trk::TrkMaterialProviderTool::modifyTSOSvector(const std::vector<const Trk::Trac // make two scattering planes and TSOS // // prepare for first MaterialEffectsOnTrack with X0 = X0/2 Eloss = 0 and scattering2 = total2 / 2. depth = 0 - const Trk::MaterialEffectsOnTrack* meotFirst = new Trk::MaterialEffectsOnTrack(X0_tot/2., scatFirst, 0, *surfFirst, meotPattern); + const Trk::MaterialEffectsOnTrack* meotFirst = new Trk::MaterialEffectsOnTrack(X0_tot/2., scatFirst, nullptr, *surfFirst, meotPattern); // prepare for second MaterialEffectsOnTrack with X0 = X0/2 Eloss = Eloss total and scattering2 = total2 / 2. depth = 0 const Trk::MaterialEffectsOnTrack* meotLast = new Trk::MaterialEffectsOnTrack(X0_tot/2., scatNew, caloEnergyNew, *surfLast, meotPattern); // // - const Trk::TrackStateOnSurface* newTSOSFirst = new Trk::TrackStateOnSurface( 0, parsFirst, 0, meotFirst, typePattern ); - const Trk::TrackStateOnSurface* newTSOS = (elossFlag!=0 ? new Trk::TrackStateOnSurface( 0, parsLast, 0, meotLast, typePatternDeposit ) : new Trk::TrackStateOnSurface( 0, parsLast, 0, meotLast, typePattern )) ; + const Trk::TrackStateOnSurface* newTSOSFirst = new Trk::TrackStateOnSurface( nullptr, parsFirst, nullptr, meotFirst, typePattern ); + const Trk::TrackStateOnSurface* newTSOS = (elossFlag!=0 ? new Trk::TrackStateOnSurface( nullptr, parsLast, nullptr, meotLast, typePatternDeposit ) : new Trk::TrackStateOnSurface( nullptr, parsLast, nullptr, meotLast, typePattern )) ; ATH_MSG_VERBOSE(" first WITH aggregation and WITH reposition TSOS type " << newTSOSFirst->dumpType() << " TSOS surface " << newTSOSFirst->trackParameters()->associatedSurface() << " position x " << newTSOSFirst->trackParameters()->position().x() << " y " << newTSOSFirst->trackParameters()->position().y() << " z " << newTSOSFirst->trackParameters()->position().z() << " direction x " << newTSOSFirst->trackParameters()->momentum().unit().x() << " y " << newTSOSFirst->trackParameters()->momentum().unit().y() << " z " << newTSOSFirst->trackParameters()->momentum().unit().z() << " p " << newTSOSFirst->trackParameters()->momentum().mag() << " X0 " << meotFirst->thicknessInX0() << " deltaE 0 " << " sigma deltaTheta " << scatFirst->sigmaDeltaTheta() ); ATH_MSG_VERBOSE(" second WITH aggregation and WITH reposition TSOS type " << newTSOS->dumpType() << " TSOS surface " << newTSOS->trackParameters()->associatedSurface() << " position x " << newTSOS->trackParameters()->position().x() << " y " << newTSOS->trackParameters()->position().y() << " z " << newTSOS->trackParameters()->position().z() << " direction x " << newTSOS->trackParameters()->momentum().unit().x() << " y " << newTSOS->trackParameters()->momentum().unit().y() << " z " << newTSOS->trackParameters()->momentum().unit().z() << " p " << newTSOS->trackParameters()->momentum().mag() << " X0 " << meotLast->thicknessInX0() << " deltaE " << caloEnergyNew->deltaE() << " sigma deltaTheta " << scatNew->sigmaDeltaTheta() ); newTSOSvector->push_back(newTSOSFirst); @@ -1785,17 +1768,17 @@ Trk::TrkMaterialProviderTool::modifyTSOSvector(const std::vector<const Trk::Trac const Trk::TrackParameters* pars = surf->createParameters<5,Trk::Charged>(0.,0.,dir.phi(),dir.theta(),qOverPNew); // prepare for first MaterialEffectsOnTrack with X0 = X0/2 Eloss = 0 and scattering2 = total2 / 2. depth = 0 - const Trk::MaterialEffectsOnTrack* meotFirst = new Trk::MaterialEffectsOnTrack(X0_tot/2., scatFirst, 0, *surfFirst, meotPattern); + const Trk::MaterialEffectsOnTrack* meotFirst = new Trk::MaterialEffectsOnTrack(X0_tot/2., scatFirst, nullptr, *surfFirst, meotPattern); // prepare for middle MaterialEffectsOnTrack with X0 = 0 Eloss = ElossNew and scattering2 = 0. depth = 0 - const Trk::MaterialEffectsOnTrack* meot = new Trk::MaterialEffectsOnTrack(0., 0, caloEnergyNew, *surf, meotPattern); + const Trk::MaterialEffectsOnTrack* meot = new Trk::MaterialEffectsOnTrack(0., nullptr, caloEnergyNew, *surf, meotPattern); // prepare for last MaterialEffectsOnTrack with X0 = X0/2 Eloss = 0 total and scattering2 = total2 / 2. depth = 0 - const Trk::MaterialEffectsOnTrack* meotLast = new Trk::MaterialEffectsOnTrack(X0_tot/2., scatNew, 0, *surfLast, meotPattern); + const Trk::MaterialEffectsOnTrack* meotLast = new Trk::MaterialEffectsOnTrack(X0_tot/2., scatNew, nullptr, *surfLast, meotPattern); - const Trk::TrackStateOnSurface* newTSOSFirst = new Trk::TrackStateOnSurface( 0, parsFirst, 0, meotFirst, typePatternScat ); - const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( 0, pars, 0, meot, typePatternDeposit ); - const Trk::TrackStateOnSurface* newTSOSLast = new Trk::TrackStateOnSurface( 0, parsLast, 0, meotLast, typePatternScat ); + const Trk::TrackStateOnSurface* newTSOSFirst = new Trk::TrackStateOnSurface( nullptr, parsFirst, nullptr, meotFirst, typePatternScat ); + const Trk::TrackStateOnSurface* newTSOS = new Trk::TrackStateOnSurface( nullptr, pars, nullptr, meot, typePatternDeposit ); + const Trk::TrackStateOnSurface* newTSOSLast = new Trk::TrackStateOnSurface( nullptr, parsLast, nullptr, meotLast, typePatternScat ); newTSOSvector->push_back(newTSOSFirst); newTSOSvector->push_back(newTSOS); @@ -1852,7 +1835,7 @@ void Trk::TrkMaterialProviderTool::getMopAndIoniEnergyLoss(const std::vector<con } if(m->materialEffectsOnTrack()) { const Trk::MaterialEffectsOnTrack* meot = dynamic_cast<const Trk::MaterialEffectsOnTrack*>(m->materialEffectsOnTrack()); - const Trk::EnergyLoss* energyLoss = 0; + const Trk::EnergyLoss* energyLoss = nullptr; if(meot) { energyLoss = meot->energyLoss(); if (!energyLoss) { @@ -1907,8 +1890,7 @@ bool Trk::TrkMaterialProviderTool::isIsolatedTrack(double eta, double phi) const ATH_MSG_VERBOSE("Isolation : Number of tracks in cone " << nTracks << " cut < " << m_maxNTracksIso); - if (nTracks > m_maxNTracksIso) return false; - return true; + return nTracks <= m_maxNTracksIso; } /** Function to get calorimeter measured energy loss*/ diff --git a/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdator.h b/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdator.h index 4bfe9846720b29d7035cee8b8cfbec77a855cd7d..039aaf707bd9dac51757bd2ff141ebc6097c1909 100755 --- a/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdator.h +++ b/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -145,10 +145,10 @@ class KalmanUpdator : virtual public IUpdator, public AthAlgTool { const Amg::MatrixX&, const int&, Trk::FitQualityOnSurface*&, bool ) const override final - {return 0;} + {return nullptr;} //! gives back how updator is configured for inital covariances - virtual const std::vector<double> initialErrors() const override final; + virtual std::vector<double> initialErrors() const override final; private: //! Common maths calculation code for addToState and removeFromState - Amg::Vector2D interface. diff --git a/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdatorAmg.h b/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdatorAmg.h index d2728ee96727cd0dba60ce8bb59edf82e4a4f6d9..6a311d6e11c24222201cf6fcbe6773c6c7090267 100755 --- a/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdatorAmg.h +++ b/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdatorAmg.h @@ -137,7 +137,7 @@ class KalmanUpdatorAmg : virtual public IUpdator, public AthAlgTool { Trk::FitQualityOnSurface*&, bool ) const override final; //!< give back how updator is configured for inital covariances - virtual const std::vector<double> initialErrors() const override final; + virtual std::vector<double> initialErrors() const override final; private: //!< common code analysing the measurement's rank and calling the appropriate implementation for this rank. diff --git a/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdatorSMatrix.h b/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdatorSMatrix.h index 1b54a336c95b84a58e94ab6a3b2a9545af800d79..464b1e51a9c7ebbbae6eb775168525a9ab30cabe 100755 --- a/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdatorSMatrix.h +++ b/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanUpdatorSMatrix.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -158,10 +158,10 @@ class KalmanUpdatorSMatrix : virtual public IUpdator, public AthAlgTool { const int&, Trk::FitQualityOnSurface*&, bool ) const override final - {return 0;} + {return nullptr;} //! give back how updator is configured for inital covariances - virtual const std::vector<double> initialErrors() const override final; + virtual std::vector<double> initialErrors() const override final; private: //! common code analysing the measurement's rank and calling the appropriate implementation for this rank. diff --git a/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanWeightUpdator.h b/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanWeightUpdator.h index f976665c4d4f6f97e9c100b05c08b0a1700e0ae9..8a27235a154a4817b46dcd0a9766f2c98b612c6b 100755 --- a/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanWeightUpdator.h +++ b/Tracking/TrkTools/TrkMeasurementUpdator/TrkMeasurementUpdator/KalmanWeightUpdator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -111,10 +111,10 @@ public: //! interface for update for reference-track KF, not implemented. virtual std::pair<AmgVector(5), AmgSymMatrix(5)>* updateParameterDifference (const AmgVector(5)&, const AmgSymMatrix(5)&, const Amg::VectorX&, const Amg::MatrixX&, - const int&, Trk::FitQualityOnSurface*&, bool ) const override final {return 0;} + const int&, Trk::FitQualityOnSurface*&, bool ) const override final {return nullptr;} //! give back how updator is configured for inital weights - virtual const std::vector<double> initialErrors() const override final; + virtual std::vector<double> initialErrors() const override final; private: //! common maths calculation code for addToState and removeFromState diff --git a/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdator.cxx b/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdator.cxx index 83cc39b17b78ee6b08ba0d53446fd2dfa4d79d56..4ef2d6f98e6b4cb5786b2d822e49924b8a309f02 100755 --- a/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdator.cxx +++ b/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -78,7 +78,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::addToState (const Trk::TrackParameters const Amg::Vector2D& measmtPos, const Amg::MatrixX& measmtErr) const { if (m_outputlevel <= 0) logStart("addToState(TP,LPOS,ERR)",trkPar); - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; return calculateFilterStep (trkPar, measmtPos, measmtErr,1,fitQoS,false); } @@ -87,7 +87,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::addToState (const Trk::TrackParameters const LocalParameters& measmtPar, const Amg::MatrixX& measmtErr) const { if (m_outputlevel <= 0) logStart("addToState(TP,LPAR,ERR)",trkPar); - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; return calculateFilterStep (trkPar, measmtPar, measmtErr,1,fitQoS, false); } // updator #3 for Kalman Fitter - version with Amg::Vector2D (for example for PrepRawData) @@ -99,7 +99,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::addToState (const Trk::TrackParameters if (fitQoS) { ATH_MSG_WARNING( "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" ); - return 0; + return nullptr; } else { return calculateFilterStep (trkPar, measmtPos, measmtErr, 1, fitQoS, true); } @@ -114,7 +114,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::addToState (const Trk::TrackParameters if (fitQoS) { ATH_MSG_WARNING( "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" ); - return 0; + return nullptr; } else { return calculateFilterStep (trkPar, measmtPar, measmtErr, 1, fitQoS, true); } @@ -125,7 +125,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::removeFromState (const Trk::TrackParam const Amg::Vector2D& measmtPos, const Amg::MatrixX& measmtErr) const { if (m_outputlevel<=0) logStart("removeFromState(TP,LPOS,ERR)",trkPar); - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; return calculateFilterStep (trkPar, measmtPos, measmtErr,-1,fitQoS, false); } @@ -134,7 +134,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::removeFromState (const Trk::TrackParam const LocalParameters& measmtPar, const Amg::MatrixX& measmtErr) const { if (m_outputlevel) logStart("removeFromState(TP,LPAR,ERR)",trkPar); - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; return calculateFilterStep (trkPar, measmtPar, measmtErr,-1,fitQoS, false); } @@ -147,7 +147,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::removeFromState (const Trk::TrackParam if (fitQoS) { ATH_MSG_WARNING( "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" ); - return 0; + return nullptr; } else { return calculateFilterStep (trkPar, measmtPos, measmtErr, -1, fitQoS, true); } @@ -162,7 +162,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::removeFromState (const Trk::TrackParam if (fitQoS) { ATH_MSG_WARNING( "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" ); - return 0; + return nullptr; } else { return calculateFilterStep (trkPar, measmtPar, measmtErr, -1, fitQoS, true); } @@ -175,7 +175,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::combineStates (const Trk::TrackParamet if (!one.covariance() && !two.covariance()) { ATH_MSG_WARNING( "both parameters have no errors, invalid " << "use of Updator::combineStates()" ); - return 0; + return nullptr; } // if only one of two has an error, return that one if (!one.covariance()) { @@ -207,7 +207,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::combineStates (const Trk::TrackParamet if ( (!thetaPhiWithinRange(par)) ? !correctThetaPhiRange(par,*covPar,false) : false ) { delete covPar; ATH_MSG_WARNING( "combineStates(TP,TP): could not combine angular values." ); - return 0; + return nullptr; } // return cloned version of Track Parameters (MeasuredPerigee, MeasuredAtA...) @@ -226,12 +226,12 @@ Trk::TrackParameters* Trk::KalmanUpdator::combineStates (const Trk::TrackParamet if (!one.covariance() && !two.covariance()) { ATH_MSG_WARNING( "both parameters have no errors, invalid " << "use of Updator::combineStates()" ); - return 0; + return nullptr; } if (fitQoS) { ATH_MSG_WARNING( "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" ); - return 0; + return nullptr; } else { // if only one of two has an error, return that one if (!one.covariance()) { @@ -262,7 +262,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::combineStates (const Trk::TrackParamet AmgSymMatrix(5)* covPar = new AmgSymMatrix(5)(K * covTrkTwo); if ( (!thetaPhiWithinRange(par)) ? !correctThetaPhiRange(par,*covPar) : false ) { ATH_MSG_WARNING( "combineStates(TP,TP,FQ): could not combine angular values." ); - delete covPar; return 0; + delete covPar; return nullptr; } // compute fit quality @@ -288,7 +288,7 @@ Trk::KalmanUpdator::fullStateFitQuality (const Trk::TrackParameters& trkPar, // try if Track Parameters are measured ones ? if (!trkPar.covariance()) { ATH_MSG_ERROR( "updated smoother/trajectory has no error matrix" ); - return 0; + return nullptr; } // covariance matrix for prediction const AmgSymMatrix(5)& covTrk = (*trkPar.covariance()); @@ -323,15 +323,15 @@ Trk::KalmanUpdator::fullStateFitQuality (const Trk::TrackParameters& trkPar, // try if Track Parameters are measured ones ? if (!trkPar.covariance()) { ATH_MSG_ERROR( "updated smoother/trajectory has no error matrix" ); - return 0; + return nullptr; } - if ( !consistentParamDimensions(rioPar,rioErr.cols()) ) return 0; + if ( !consistentParamDimensions(rioPar,rioErr.cols()) ) return nullptr; // covariance matrix for prediction const AmgSymMatrix(5)& covTrk = (*trkPar.covariance()); // State to measurement dimensional reduction Matrix ( n x m ) - Amg::MatrixX H(rioPar.expansionMatrix()); + const Amg::MatrixX& H(rioPar.expansionMatrix()); // residuals Amg::VectorX r = rioPar; @@ -349,14 +349,14 @@ Trk::KalmanUpdator::predictedStateFitQuality (const Trk::TrackParameters& predPa const Amg::MatrixX& rioLocErr) const { ATH_MSG_VERBOSE( "--> entered KalmanUpdator::predictedStateFitQuality(TP,LPOS,ERR)" ); // try if Track Parameters are measured ones ? - if (predPar.covariance() == NULL) { + if (predPar.covariance() == nullptr) { #if 0 if (&predPar == NULL) ATH_MSG_WARNING( "input state is NULL in predictedStateFitQuality()" ); else #endif ATH_MSG_WARNING( "input state has no error matrix in predictedStateFitQuality()" ); - return 0; + return nullptr; } // covariance matrix for prediction const AmgSymMatrix(5)& covPred = (*predPar.covariance()); @@ -388,23 +388,23 @@ Trk::KalmanUpdator::predictedStateFitQuality (const Trk::TrackParameters& predPa ATH_MSG_VERBOSE( "--> entered KalmanUpdator::predictedStateFitQuality(TP,LPAR,ERR)" ); // try if Track Parameters are measured ones ? - if (predPar.covariance() == NULL) { + if (predPar.covariance() == nullptr) { #if 0 if (&predPar == NULL) ATH_MSG_WARNING( "input state is NULL in predictedStateFitQuality()" ); else #endif ATH_MSG_WARNING( "input state has no error matrix in predictedStateFitQuality()" ); - return 0; + return nullptr; } - if ( ! consistentParamDimensions(rioPar,rioErr.cols()) ) return 0; + if ( ! consistentParamDimensions(rioPar,rioErr.cols()) ) return nullptr; // covariance matrix for prediction const AmgSymMatrix(5)& covPred = (*predPar.covariance()); // State to measurement dimensional reduction Matrix ( n x m ) - Amg::MatrixX H(rioPar.expansionMatrix()); + const Amg::MatrixX& H(rioPar.expansionMatrix()); // residuals Amg::VectorX r = rioPar; @@ -424,7 +424,7 @@ Trk::KalmanUpdator::predictedStateFitQuality (const Trk::TrackParameters& one, if (!one.covariance() && !two.covariance()) { ATH_MSG_WARNING( "both parameters have no errors, invalid " << "use of Updator::fitQuality()" ); - return 0; + return nullptr; } // if only one of two has an error, place a message. if (!one.covariance() || !two.covariance()) { @@ -444,7 +444,7 @@ Trk::KalmanUpdator::predictedStateFitQuality (const Trk::TrackParameters& one, return new FitQualityOnSurface(chiSquared, 5); } -const std::vector<double> Trk::KalmanUpdator::initialErrors() const { +std::vector<double> Trk::KalmanUpdator::initialErrors() const { std::vector<double> E(5); for (int i=0; i<5; ++i) E[i] = sqrt(m_cov0[i]); return E; @@ -464,7 +464,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::calculateFilterStep (const Trk::TrackP if (sign<0) { ATH_MSG_WARNING( "MeasuredTrackParameters == Null, can not calculate " << "updated parameter state" ); - return 0; + return nullptr; } else { // no error given - use a huge error matrix for the time // covTrk = Amg::MatrixX(5, 1) * 1000.f; @@ -486,7 +486,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::calculateFilterStep (const Trk::TrackP if (!thetaPhiWithinRange(parTrk)) { ATH_MSG_WARNING( (sign>0?"addToState(TP,LPOS,ERR..)":"removeFromState(TP,LPOS,ERR..)") << ": undefined phi,theta range in input parameters." ); - return 0; + return nullptr; } // measurement vector of RIO_OnTrack - needs more care for # local par? @@ -534,7 +534,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::calculateFilterStep (const Trk::TrackP if ( (!thetaPhiWithinRange(par)) ? !correctThetaPhiRange(par,*covPar) : false ) { ATH_MSG_WARNING( "calculateFS(TP,LPOS,ERR): bad angles in filtered state!" ); delete covPar; - return 0; + return nullptr; } if (m_outputlevel<=0) logResult(createFQoS? (sign>0?"addToState(TP,LPOS,ERR,FQ)":"removeFromState(TP,LPOS,ERR,FQ)"): @@ -573,7 +573,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::calculateFilterStep (const Trk::TrackP if (sign<0) { ATH_MSG_WARNING( "MeasuredTrackParameters == Null, can not calculate " << "updated parameter state." ); - return 0; + return nullptr; } else { // no error given - use a huge error matrix for the time // covTrk = Amg::MatrixX(5, 1) * 1000.f; @@ -594,17 +594,17 @@ Trk::TrackParameters* Trk::KalmanUpdator::calculateFilterStep (const Trk::TrackP if (!thetaPhiWithinRange(parTrk)) { ATH_MSG_WARNING( (sign>0?"addToState(TP,LPAR,ERR..)":"removeFromState(TP,LPAR,ERR..)") << ": undefined phi,theta range in input parameters." ); - return 0; + return nullptr; } if (!thetaPhiWithinRange(rioPar,rioPar.parameterKey())) { ATH_MSG_WARNING( (sign>0?"addToState(TP,LPAR,ERR..)":"removeFromState(TP,LPAR,ERR..)") << ": undefined phi,theta range in input measurement !!" ); - return 0; + return nullptr; } // measurement vector of RIO_OnTrack - needs more care for # local par? int nLocCoord = covRio.cols(); - if ( ! consistentParamDimensions(rioPar,covRio.cols()) ) return 0; + if ( ! consistentParamDimensions(rioPar,covRio.cols()) ) return nullptr; if (m_outputlevel<0) logInputCov(covTrk,rioPar,covRio); // State to measurement dimensional reduction Matrix ( n x m ) @@ -638,7 +638,7 @@ Trk::TrackParameters* Trk::KalmanUpdator::calculateFilterStep (const Trk::TrackP if ( (!thetaPhiWithinRange(par)) ? !correctThetaPhiRange(par,*covPar) : false ) { ATH_MSG_WARNING( "calculateFS(TP,LPAR,ERR): bad angles in filtered state!" ); delete covPar; - return 0; + return nullptr; } if (m_outputlevel<=0) logResult(createFQoS? (sign>0?"addToState(TP,LPAR,ERR,FQ)":"removeFromState(TP,LPAR,ERR,FQ)"): @@ -697,7 +697,8 @@ bool Trk::KalmanUpdator::correctThetaPhiRange(Amg::VectorX& V, AmgSymMatrix(5)& const bool isDifference, const int key) const { // get phi and theta coordinate - int jphi = -1, jtheta = -1; + int jphi = -1; + int jtheta = -1; double thetaMin = (isDifference ? -M_PI : 0); if (key == 31) jphi = Trk::phi; else if (key & 4) { // phi is within localParameter and a measured coordinate @@ -780,7 +781,8 @@ bool Trk::KalmanUpdator::correctThetaPhiRange(Amg::VectorX& V, Amg::MatrixX& C, const bool isDifference, const int key) const { // get phi and theta coordinate - int jphi = -1, jtheta = -1; + int jphi = -1; + int jtheta = -1; double thetaMin = (isDifference ? -M_PI : 0); if (key == 31) jphi = Trk::phi; else if (key & 4) { // phi is within localParameter and a measured coordinate diff --git a/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdatorAmg.cxx b/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdatorAmg.cxx index d328f5a52e2c4057143965cc05cf83e7b8a1cf26..0e976bf29614d5e1e386e281e3f96dacfb6a9240 100755 --- a/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdatorAmg.cxx +++ b/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdatorAmg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -30,7 +30,7 @@ const Trk::ParamDefsAccessor Trk::KalmanUpdatorAmg::s_enumAccessor; Trk::KalmanUpdatorAmg::KalmanUpdatorAmg(const std::string& t,const std::string& n,const IInterface* p) : AthAlgTool (t,n,p), m_cov_stdvec(std::vector<double>{250.,250.,0.25,0.25,0.000001}), - m_covariance0(0), + m_covariance0(nullptr), m_thetaGainDampingValue(0.1), m_unitMatrix(AmgMatrix(5,5)::Identity()), m_reMatrices(5) @@ -82,12 +82,12 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::addToState (const Trk::TrackParamet const Amg::MatrixX& measLocCov) const { if (msgLvl(MSG::VERBOSE)) {logStart("addToState(TP,LPOS,ERR)",trkPar.parameters());} - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; const int updatingSign = 1; // get the Start covariance matrix const AmgSymMatrix(5)* trkCov = getStartCov(trkPar,updatingSign); - if (!trkCov) return 0; + if (!trkCov) return nullptr; int nLocCoord = measLocCov.cols(); if (nLocCoord == 1) { @@ -101,7 +101,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::addToState (const Trk::TrackParamet } ATH_MSG_WARNING(" number (" << nLocCoord << ") of local coordinates must be 1 or 2, can not update!"); - return 0; + return nullptr; } // updator #2 for Kalman Fitter - version with LocalParameters (MeasurementBase method) @@ -110,7 +110,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::addToState (const Trk::TrackParamet const Amg::MatrixX& measmtCov) const { if (msgLvl(MSG::VERBOSE)) {logStart("addToState(TP,LPAR,ERR)",trkPar.parameters());} - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; return prepareFilterStep (trkPar, measmtPar, measmtCov, 1, fitQoS, false); } @@ -124,11 +124,11 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::addToState (const Trk::TrackParamet if (msgLvl(MSG::VERBOSE)) {logStart("addToState(TP,LPOS,ERR,FQ)",trkPar.parameters());} if (fitQoS) { ATH_MSG_WARNING("expect nil FitQuality pointer, refuse operation to avoid mem leak!"); - return 0; + return nullptr; } else { // get the Start covariance matrix const AmgSymMatrix(5)* trkCov = getStartCov(trkPar,updatingSign); - if (!trkCov) return 0; + if (!trkCov) return nullptr; if (msgLvl(MSG::VERBOSE)) {logInputCov(*trkCov,measLocPos,measLocCov);} int nLocCoord = measLocCov.cols(); if (nLocCoord == 1) { @@ -141,7 +141,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::addToState (const Trk::TrackParamet updatingSign,fitQoS,true); } else { ATH_MSG_WARNING(" number (" << nLocCoord << ") of local coordinates must be 1 or 2, can not update!"); - return 0; + return nullptr; } } } @@ -155,7 +155,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::addToState (const Trk::TrackParamet if (msgLvl(MSG::VERBOSE)) {logStart("addToState(TP,LPAR,ERR,FQ)",trkPar.parameters());} if (fitQoS) { ATH_MSG_WARNING("expect nil FitQuality pointer, refuse operation to avoid mem leak!"); - return 0; + return nullptr; } else { return prepareFilterStep (trkPar, measmtPar, measmtCov, 1, fitQoS, true); } @@ -166,12 +166,12 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::removeFromState (const Trk::TrackPa const Amg::Vector2D& measLocPos, const Amg::MatrixX& measLocCov) const { if (msgLvl(MSG::VERBOSE)) {logStart("removeFromState(TP,LPOS,ERR)",trkPar.parameters());} - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; const int updatingSign = -1; // get the Start covariance matrix const AmgSymMatrix(5)* trkCov = getStartCov(trkPar,updatingSign); - if (!trkCov) return 0; + if (!trkCov) return nullptr; if (msgLvl(MSG::VERBOSE)) {logInputCov(*trkCov,measLocPos,measLocCov);} @@ -186,7 +186,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::removeFromState (const Trk::TrackPa updatingSign,fitQoS,false); } else { ATH_MSG_WARNING(" number (" << nLocCoord << ") of local coordinates must be 1 or 2, can not un-update!"); - return 0; + return nullptr; } } @@ -195,7 +195,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::removeFromState (const Trk::TrackPa const LocalParameters& measmtPar, const Amg::MatrixX& measmtCov) const { if (msgLvl(MSG::DEBUG)) {logStart("removeFromState(TP,LPAR,ERR)",trkPar.parameters());} - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; return prepareFilterStep (trkPar, measmtPar, measmtCov,-1,fitQoS, false); } @@ -209,12 +209,12 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::removeFromState (const Trk::TrackPa if (fitQoS) { ATH_MSG_WARNING("expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!"); - return 0; + return nullptr; } else { // get the Start covariance matrix const AmgSymMatrix(5)* trkCov = getStartCov(trkPar,updatingSign); - if (!trkCov) return 0; + if (!trkCov) return nullptr; if (msgLvl(MSG::VERBOSE)) {logInputCov(*trkCov,measLocPos,measLocCov);} @@ -229,7 +229,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::removeFromState (const Trk::TrackPa updatingSign,fitQoS,true); } else { ATH_MSG_WARNING(" number (" << nLocCoord << ") of local coordinates must be 1 or 2, can not un-update!"); - return 0; + return nullptr; } } } @@ -243,7 +243,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::removeFromState(const Trk::TrackPar if (msgLvl(MSG::VERBOSE)) logStart("removeFromState(TP,LPAR,ERR,FQ)",trkPar.parameters()); if (fitQoS) { ATH_MSG_WARNING("expect nil FitQuality pointer, refuse operation to avoid mem leak!"); - return 0; + return nullptr; } else { return prepareFilterStep (trkPar, measmtPar, measmtCov, -1, fitQoS, true); } @@ -259,7 +259,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::combineStates (const Trk::TrackPara // remember, either one OR two might have no error, but not both ! if (!covOne && ! covTwo) { ATH_MSG_WARNING("both parameters have no errors, invalid use of Updator::combineStates()"); - return 0; + return nullptr; } // if only one of two has an error, return that one if (!covOne) { @@ -271,7 +271,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::combineStates (const Trk::TrackPara return one.clone(); } - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; return calculateFilterStep_5D(one,*covOne,two.parameters(),*covTwo,+1,fitQoS,false); } @@ -286,11 +286,11 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::combineStates (const Trk::TrackPara // remember, either one OR two might have no error, but not both ! if (!covOne && ! covTwo) { ATH_MSG_WARNING("both parameters have no errors, invalid use of Updator::combineStates()"); - return 0; + return nullptr; } if (fitQoS) { ATH_MSG_WARNING("expect nil FitQuality pointer, refuse operation to avoid mem leak!"); - return 0; + return nullptr; } // if only one of two has an error, return that one if (!covOne) { @@ -315,7 +315,7 @@ Trk::KalmanUpdatorAmg::stateFitQuality (const Trk::TrackParameters& trkPar, // try if Track Parameters are measured ones ? if (!trkPar.covariance()) { ATH_MSG_ERROR("updated track state has no error matrix, return 0."); - return 0; + return nullptr; } // For the LocalPos. version, need to get # meas. coord. from covariance matrix. int nLocCoord = rioCov.cols(); @@ -327,7 +327,7 @@ Trk::KalmanUpdatorAmg::stateFitQuality (const Trk::TrackParameters& trkPar, rioLocPos,rioCov.block<2,2>(0,0), 3,fullPred); } else { ATH_MSG_WARNING("Error in local position - must be 1D or 2D!"); - return 0; + return nullptr; } } @@ -365,10 +365,10 @@ Trk::KalmanUpdatorAmg::stateFitQuality (const Trk::TrackParameters& trkPar, // try if Track Parameters are measured ones ? if (!trkPar.covariance()) { ATH_MSG_ERROR("updated track state has no error matrix, return 0."); - return 0; + return nullptr; } int nLocCoord = parRio.dimension(); - if ( ! consistentParamDimensions(parRio,rioCov.cols()) ) return 0; + if ( ! consistentParamDimensions(parRio,rioCov.cols()) ) return nullptr; if (nLocCoord == 1) { return makeChi2_1D(trkPar.parameters(),(*trkPar.covariance()), parRio(0),rioCov(0,0),parRio.parameterKey(),fullPred); @@ -390,7 +390,7 @@ Trk::KalmanUpdatorAmg::stateFitQuality (const Trk::TrackParameters& trkPar, parRio.block<5,1>(0,0),rioCov.block<5,5>(0,0), parRio.parameterKey(),fullPred); } ATH_MSG_ERROR("Dimension error in KalmanUpdatorAmg::stateFitQuality(TP,LPAR,ERR)."); - return 0; + return nullptr; } @@ -431,7 +431,7 @@ Trk::KalmanUpdatorAmg::predictedStateFitQuality (const Trk::TrackParameters& trk // remember, either one OR two might have no error, but not both ! if (!covOne && ! covTwo) { ATH_MSG_WARNING("both parameters have no errors, invalid use of Updator::fitQuality()"); - return 0; + return nullptr; } // if only one of two has an error, place a message. if (!covOne || !covTwo) { @@ -442,7 +442,7 @@ Trk::KalmanUpdatorAmg::predictedStateFitQuality (const Trk::TrackParameters& trk trkParTwo.parameters(),*covTwo, 31, +1); } -const std::vector<double> Trk::KalmanUpdatorAmg::initialErrors() const { +std::vector<double> Trk::KalmanUpdatorAmg::initialErrors() const { std::vector<double> E(5); for (int i=0; i<5; ++i) E[i] = sqrt(m_cov0Vec(i)); return E; @@ -458,10 +458,10 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::prepareFilterStep (const Trk::Track // get the Start covariance matrix const AmgSymMatrix(5)* trkCov = getStartCov(trkPar,sign); - if (!trkCov) return 0; + if (!trkCov) return nullptr; int nLocCoord = rioCov.cols(); - if ( ! consistentParamDimensions(parRio,nLocCoord) ) return 0; + if ( ! consistentParamDimensions(parRio,nLocCoord) ) return nullptr; if (msgLvl(MSG::VERBOSE)) logInputCov(*trkCov,parRio,rioCov); if (nLocCoord==1) return calculateFilterStep_1D (trkPar,*trkCov, @@ -483,7 +483,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorAmg::prepareFilterStep (const Trk::Track if (nLocCoord==5) return calculateFilterStep_5D(trkPar,*trkCov, parRio.block<5,1>(0,0),rioCov.block<5,5>(0,0), sign,fitQoS,createFQoS); - return 0; + return nullptr; } // updator interface for reference-track KF on pure AMG matrices @@ -516,7 +516,7 @@ std::pair<AmgVector(5), AmgSymMatrix(5)>* Trk::KalmanUpdatorAmg::updateParameter if (nLocCoord==5) return calculateFilterStep_5D(trkParV,trkCov, parRio.block<5,1>(0,0),covRio.block<5,5>(0,0), fitQoS,createFQoS); - return 0; + return nullptr; } @@ -542,7 +542,7 @@ Trk::KalmanUpdatorAmg::calculateFilterStep_1D (const TrackParameters& TP, const double R = (sign * measCov) + trkCov(mk,mk); if (R == 0.0) { ATH_MSG_DEBUG("inversion of the error-on-the-residual failed."); - return 0; + return nullptr; } else R = 1./R; // --- compute Kalman gain matrix AmgMatrix(5,1) K = trkCov.block<5,1>(0,mk) * R; @@ -582,7 +582,7 @@ Trk::KalmanUpdatorAmg::calculateFilterStep_1D (const TrackParameters& TP, const if ( (!thetaPhiWithinRange_5D(newPar, Trk::KalmanUpdatorAmg::absoluteCheck)) ? !correctThetaPhiRange_5D(newPar, newCov, Trk::KalmanUpdatorAmg::absoluteCheck) : false ) { ATH_MSG_WARNING("calculateFS_1D(): bad angles in filtered state!"); - return 0; + return nullptr; } if (createFQoS) { @@ -613,13 +613,14 @@ Trk::KalmanUpdatorAmg::calculateFilterStep_1D(const AmgVector(5)& trkPar, const FitQualityOnSurface*& fQ, bool createFQoS) const { ATH_MSG_DEBUG("--> entered KalmanUpdatorAmg::calculateFilterStep_1D "); - int mk=0, sign=1; + int mk=0; + int sign=1; if (paramKey!=1) for (int i=0; i<5; ++i) if (paramKey & (1<<i)) { mk=i; break; } double r = measPar - trkPar(mk); double R = (sign * measCov) + trkCov(mk,mk); if (R == 0.0) { ATH_MSG_DEBUG("inversion of the error-on-the-residual failed."); - return 0; + return nullptr; } else R = 1./R; // --- compute Kalman gain matrix AmgMatrix(5,1) K = trkCov.block<5,1>(0,mk) * R; @@ -657,7 +658,7 @@ Trk::KalmanUpdatorAmg::calculateFilterStep_1D(const AmgVector(5)& trkPar, const if ( (!thetaPhiWithinRange_5D(newPar, Trk::KalmanUpdatorAmg::differentialCheck)) ? !correctThetaPhiRange_5D(newPar, newCov, Trk::KalmanUpdatorAmg::differentialCheck) : false ) { ATH_MSG_WARNING("calculateFS_1D(): bad angles in filtered state!"); - return 0; + return nullptr; } if (createFQoS) { @@ -779,7 +780,7 @@ Trk::FitQualityOnSurface* Trk::KalmanUpdatorAmg::makeChi2_1D(const AmgVector(5)& double chiSquared = rioCov + sign * trkCov(mk,mk); if (chiSquared == 0.0) { ATH_MSG_DEBUG( "inversion of the error-on-the-residual failed for 1D measurement, set chi2 to zero."); - return 0; + return nullptr; } else { chiSquared = r*r/chiSquared; } @@ -799,7 +800,8 @@ Trk::KalmanUpdatorAmg::convertToClonedTrackPars(const Trk::TrackParameters& TP, TP.associatedSurface().createTrackParameters(par[0],par[1],par[2],par[3],par[4],new AmgSymMatrix(5)(covPar)); // screen output if (msgLvl(MSG::VERBOSE) && resultPar) { - char reportCalledInterface[80], ndtext2[5]; + char reportCalledInterface[80]; + char ndtext2[5]; memset(ndtext2, '\0', 5 ); ndtext.copy(ndtext2,2); // convert char to string if (sign>0) sprintf(reportCalledInterface,"%s-%s,%s)", @@ -822,7 +824,7 @@ const AmgSymMatrix(5)* Trk::KalmanUpdatorAmg::getStartCov(const Trk::TrackParame if (!covariance) { if (isign<0) { ATH_MSG_WARNING ("-U- no trkCov in fit iteration, can not calculate updated parameter state."); - return 0; + return nullptr; } else { // no error given - use a huge error matrix for the time ATH_MSG_VERBOSE ("-U- no trkCov at input - assign large error matrix for the time being."); diff --git a/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdatorSMatrix.cxx b/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdatorSMatrix.cxx index 28db2ab0edac2666a9627de56820c3c64115218b..a2906979a99d80778fa0d803f446f58cae0f45d3 100755 --- a/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdatorSMatrix.cxx +++ b/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanUpdatorSMatrix.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -93,11 +93,11 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::addToState (const Trk::TrackPar const Amg::Vector2D& measLocPos, const Amg::MatrixX& measLocCov) const { if (msgLvl(MSG::VERBOSE)) logStart("addToState(TP,LPOS,ERR)",inputTrkPar); - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; const int updatingSign = 1; SCovMatrix5 covTrk; - if (!getStartCov(covTrk,inputTrkPar,updatingSign)) return 0; + if (!getStartCov(covTrk,inputTrkPar,updatingSign)) return nullptr; //if (msgLvl(MSG::VERBOSE)) logInputCov(covTrk,(const HepVector&)measLocPos,measLocCov); @@ -115,7 +115,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::addToState (const Trk::TrackPar updatingSign,fitQoS,false); } else { msg(MSG::WARNING) << " number (" << nLocCoord << ") of local coordinates " - << "must be 1 or 2, can not update!" << endmsg; return 0; + << "must be 1 or 2, can not update!" << endmsg; return nullptr; } } @@ -124,7 +124,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::addToState (const Trk::TrackPar const LocalParameters& measmtPar, const Amg::MatrixX& measmtCov) const { if (msgLvl(MSG::VERBOSE)) logStart("addToState(TP,LPAR,ERR)",trkPar); - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; return prepareFilterStep (trkPar, measmtPar, measmtCov, 1, fitQoS, false); } @@ -138,11 +138,11 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::addToState (const Trk::TrackPar if (fitQoS) { msg(MSG::WARNING) << "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" << endmsg; - return 0; + return nullptr; } else { SCovMatrix5 covTrk; - if (!getStartCov(covTrk,inputTP,updatingSign)) return 0; + if (!getStartCov(covTrk,inputTP,updatingSign)) return nullptr; //if (msgLvl(MSG::VERBOSE)) logInputCov(covTrk,(const HepVector&)measLocPos,measLocCov); @@ -160,7 +160,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::addToState (const Trk::TrackPar updatingSign,fitQoS,true); } else { msg(MSG::WARNING) << " number (" << nLocCoord << ") of local coordinates" - << " must be 1 or 2, can not update!" << endmsg; return 0; + << " must be 1 or 2, can not update!" << endmsg; return nullptr; } } } @@ -174,7 +174,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::addToState (const Trk::TrackPar if (fitQoS) { msg(MSG::WARNING) << "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" << endmsg; - return 0; + return nullptr; } else { return prepareFilterStep (trkPar, measmtPar, measmtCov, 1, fitQoS, true); } @@ -185,10 +185,10 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::removeFromState (const Trk::Tra const Amg::Vector2D& measLocPos, const Amg::MatrixX& measLocCov) const { if (msgLvl(MSG::VERBOSE)) logStart("removeFromState(TP,LPOS,ERR)",inputTP); - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; const int updatingSign = -1; SCovMatrix5 covTrk; - if (!getStartCov(covTrk,inputTP,updatingSign)) return 0; + if (!getStartCov(covTrk,inputTP,updatingSign)) return nullptr; //if (msgLvl(MSG::VERBOSE)) logInputCov(covTrk,(const HepVector&)measLocPos,measLocCov); int nLocCoord = measLocCov.cols(); @@ -205,7 +205,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::removeFromState (const Trk::Tra updatingSign,fitQoS,false); } else { msg(MSG::WARNING) << " number (" << nLocCoord << ") of local coordinates " - << "must be 1 or 2, can not un-update!" << endmsg; return 0; + << "must be 1 or 2, can not un-update!" << endmsg; return nullptr; } } @@ -214,7 +214,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::removeFromState (const Trk::Tra const LocalParameters& measmtPar, const Amg::MatrixX& measmtCov) const { if (msgLvl(MSG::DEBUG)) logStart("removeFromState(TP,LPAR,ERR)",trkPar); - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; return prepareFilterStep (trkPar, measmtPar, measmtCov,-1,fitQoS, false); } @@ -228,11 +228,11 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::removeFromState (const Trk::Tra if (fitQoS) { msg(MSG::WARNING) << "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" << endmsg; - return 0; + return nullptr; } else { SCovMatrix5 covTrk; - if (!getStartCov(covTrk,inputTP,updatingSign)) return 0; + if (!getStartCov(covTrk,inputTP,updatingSign)) return nullptr; //if (msgLvl(MSG::VERBOSE)) logInputCov(covTrk,(const HepVector&)measLocPos,measLocCov); int nLocCoord = measLocCov.cols(); @@ -249,7 +249,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::removeFromState (const Trk::Tra updatingSign,fitQoS,true); } else { msg(MSG::WARNING) << " number (" << nLocCoord << ") of local coordinates" - << " must be 1 or 2, can not un-update!" << endmsg; return 0; + << " must be 1 or 2, can not un-update!" << endmsg; return nullptr; } } } @@ -263,7 +263,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::removeFromState (const Trk::Tra if (fitQoS) { msg(MSG::WARNING) << "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" << endmsg; - return 0; + return nullptr; } else { return prepareFilterStep (trkPar, measmtPar, measmtCov, -1, fitQoS, true); } @@ -280,7 +280,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::combineStates (const Trk::Track if (!covOne && ! covTwo) { msg(MSG::WARNING) << "both parameters have no errors, invalid " << "use of Updator::combineStates()" << endmsg; - return 0; + return nullptr; } // if only one of two has an error, return that one if (!covOne) { @@ -302,7 +302,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::combineStates (const Trk::Track covOneSM(j,i) = (*covOne)(j,i); } - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; return calculateFilterStep_5D(one,SParVector5(&one.parameters()[0],5),covOneSM, SParVector5(&two.parameters()[0],5), *covTwo, @@ -321,13 +321,13 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::combineStates (const Trk::Track if (!covOne && ! covTwo) { msg(MSG::WARNING) << "both parameters have no errors, invalid " << "use of Updator::combineStates()" << endmsg; - return 0; + return nullptr; } if (fitQoS) { msg(MSG::WARNING) << "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" << endmsg; - return 0; + return nullptr; } // if only one of two has an error, return that one @@ -366,7 +366,7 @@ Trk::KalmanUpdatorSMatrix::fullStateFitQuality (const Trk::TrackParameters& trkP // try if Track Parameters are measured ones ? if (!trkPar.covariance()) { msg(MSG::ERROR) << "updated track state has no error matrix" << endmsg; - return 0; + return nullptr; } // For the LocalPos. version, need to get # meas. coord. from covariance matrix. int nLocCoord = covRio.cols(); @@ -386,7 +386,7 @@ Trk::KalmanUpdatorSMatrix::fullStateFitQuality (const Trk::TrackParameters& trkP SmeasCov, 2,-1); } else { msg(MSG::WARNING) << "Error in local position - must be 1D or 2D!" << endmsg; - return 0; + return nullptr; } } @@ -404,10 +404,10 @@ Trk::KalmanUpdatorSMatrix::fullStateFitQuality (const Trk::TrackParameters& trkP // try if Track Parameters are measured ones ? if (!trkPar.covariance()) { msg(MSG::ERROR) << "updated track state has no error matrix" << endmsg; - return 0; + return nullptr; } int nLocCoord = parRio.dimension(); - if ( ! consistentParamDimensions(parRio,covRio.cols()) ) return 0; + if ( ! consistentParamDimensions(parRio,covRio.cols()) ) return nullptr; // local params can NOT be accessed like vector[i], therefore need some acrobatics: ROOT::Math::SVector<int,5> intAccessor; for (int i=0,k=0; i<5; ++i) { if (parRio.parameterKey() & (1<<i)) intAccessor(k++)=i; } @@ -469,7 +469,7 @@ Trk::KalmanUpdatorSMatrix::predictedStateFitQuality (const Trk::TrackParameters& else #endif msg(MSG::WARNING) << "input state has no error matrix in predictedStateFitQuality()" << endmsg; - return 0; + return nullptr; } // For the LocalPos. version, need to get # meas. coord. from covariance matrix. int nLocCoord = covRio.cols(); @@ -489,7 +489,7 @@ Trk::KalmanUpdatorSMatrix::predictedStateFitQuality (const Trk::TrackParameters& SmeasCov, 2,+1); } else { msg(MSG::WARNING) << "Error in local position - must be 1D or 2D!" << endmsg; - return 0; + return nullptr; } } @@ -511,10 +511,10 @@ Trk::KalmanUpdatorSMatrix::predictedStateFitQuality (const Trk::TrackParameters& else #endif msg(MSG::WARNING) << "input state has no error matrix in predictedStateFitQuality()" << endmsg; - return 0; + return nullptr; } int nLocCoord = parRio.dimension(); - if ( ! consistentParamDimensions(parRio,covRio.cols()) ) return 0; + if ( ! consistentParamDimensions(parRio,covRio.cols()) ) return nullptr; ROOT::Math::SVector<int,5> intAccessor; for (int i=0,k=0; i<5; ++i) { if (parRio.parameterKey() & (1<<i)) intAccessor(k++)=i; } @@ -574,7 +574,7 @@ Trk::KalmanUpdatorSMatrix::predictedStateFitQuality (const Trk::TrackParameters& if (!covOne && ! covTwo) { msg(MSG::WARNING) << "both parameters have no errors, invalid " << "use of Updator::fitQuality()" << endmsg; - return 0; + return nullptr; } // if only one of two has an error, place a message. if (!covOne || ! covTwo) { @@ -588,7 +588,7 @@ Trk::KalmanUpdatorSMatrix::predictedStateFitQuality (const Trk::TrackParameters& *covTwo, +1); } -const std::vector<double> Trk::KalmanUpdatorSMatrix::initialErrors() const { +std::vector<double> Trk::KalmanUpdatorSMatrix::initialErrors() const { std::vector<double> E(5); for (int i=0; i<5; ++i) E[i] = sqrt(m_cov0(i)); return E; @@ -604,10 +604,10 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::prepareFilterStep (const Trk::T // try if Track Parameters are measured ones ? SCovMatrix5 covTrk; - if (!getStartCov(covTrk,inputTrkPar,sign)) return 0; + if (!getStartCov(covTrk,inputTrkPar,sign)) return nullptr; int nLocCoord = covRio.cols(); - if ( ! consistentParamDimensions(parRio,nLocCoord) ) return 0; + if ( ! consistentParamDimensions(parRio,nLocCoord) ) return nullptr; // << "-- cancel " << (sign>0?"update":"removal") << endmsg; if (msgLvl(MSG::VERBOSE)) logInputCov(covTrk,parRio,covRio); @@ -633,7 +633,7 @@ Trk::TrackParameters* Trk::KalmanUpdatorSMatrix::prepareFilterStep (const Trk::T if (nLocCoord==5) return calculateFilterStep_5D (inputTrkPar,SParVector5(&inputTrkPar.parameters()[0],5),covTrk, SParVector5(&(parRio[Trk::loc1]),5),covRio, sign,fitQoS,createFQoS); - return 0; + return nullptr; } // calculations for Kalman updator and inverse Kalman filter @@ -656,7 +656,7 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_1D (const TrackParameters& TP, double R = (sign * measCov(0,0)) + trkCov(mk,mk); if (R == 0.0) { if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "inversion of the error-on-the-residual failed." << endmsg; - return 0; + return nullptr; } else R = 1./R; // --- compute Kalman gain matrix @@ -725,7 +725,7 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_1D (const TrackParameters& TP, if ( (!thetaPhiWithinRange_5D(newPar, Trk::absoluteCheck)) ? !correctThetaPhiRange_5D(newPar, newCov, Trk::absoluteCheck) : false ) { msg(MSG::WARNING) << "calculateFS_1D(): bad angles in filtered state!" << endmsg; - return 0; + return nullptr; } @@ -782,7 +782,7 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_2D (const TrackParameters& TP, SCovMatrix2 R = sign * SmeasCov + projection_2D(trkCov,paramKey); if (!R.Invert()) { if (msgLvl(MSG::DEBUG)) msg( MSG::DEBUG) << "inversion of residual error matrix (2D) failed." << endmsg; - return 0; + return nullptr; } // --- compute Kalman gain matrix @@ -848,7 +848,7 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_2D (const TrackParameters& TP, if ( (!thetaPhiWithinRange_5D(newPar, Trk::absoluteCheck)) ? !correctThetaPhiRange_5D(newPar, newCov, Trk::absoluteCheck) : false ) { msg(MSG::WARNING) << "calculateFS_2D(): bad angles in filtered state!" << endmsg; - return 0; + return nullptr; } if (createFQoS) { // get chi2 = r.T() * R2^-1 * r @@ -895,7 +895,7 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_3D (const TrackParameters& TP, SCovMatrix3 R = sign * SmeasCov + projection_3D(trkCov,measPar.parameterKey()); if (!R.Invert()) { if (msgLvl(MSG::DEBUG)) msg( MSG::DEBUG) << "inversion of residual error matrix (3D) failed." << endmsg; - return 0; + return nullptr; } // compute Kalman gain matrix @@ -929,7 +929,7 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_3D (const TrackParameters& TP, if ( (!thetaPhiWithinRange_5D(newPar,Trk::absoluteCheck)) ? !correctThetaPhiRange_5D(newPar,newCov,Trk::absoluteCheck) : false ) { msg(MSG::WARNING) << "calculateFS_3D(): bad angles in filtered state!" << endmsg; - return 0; + return nullptr; } if (createFQoS) { @@ -992,7 +992,7 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_4D (const TrackParameters& TP, SCovMatrix4 R = sign * SmeasCov + projection_4D(trkCov,measPar.parameterKey()); if (!R.Invert()) { if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "inversion of residual error matrix (4D) failed." << endmsg; - return 0; + return nullptr; } // compute Kalman gain matrix @@ -1026,7 +1026,7 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_4D (const TrackParameters& TP, if ( (!thetaPhiWithinRange_5D(newPar,Trk::absoluteCheck)) ? !correctThetaPhiRange_5D(newPar,newCov,Trk::absoluteCheck) : false ) { msg(MSG::WARNING) << "calculateFS_4D(): bad angles in filtered state!" << endmsg; - return 0; + return nullptr; } if (createFQoS) { @@ -1076,14 +1076,14 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_5D (const TrackParameters& TP, SCovMatrix5 R = sign * trkCovTwo + trkCovOne; if (!R.Invert()) { if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "inversion of residual error matrix (5D) failed." << endmsg; - return 0; + return nullptr; } SParVector5 r = trkParTwo - trkParOne; if ( (!thetaPhiWithinRange_5D(r,Trk::differentialCheck)) ? !correctThetaPhiRange_5D(r,R,Trk::differentialCheck) : false ) { msg(MSG::WARNING) << "calculateFS_5D(): bad angles in intermediate residual!" << endmsg; - return 0; + return nullptr; } SGenMatrix5 K = trkCovOne * R; if (msgLvl(MSG::VERBOSE)) logGainForm (5, r, R, K); @@ -1105,7 +1105,7 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_5D (const TrackParameters& TP, if ( (!thetaPhiWithinRange_5D(newPar,Trk::absoluteCheck)) ? !correctThetaPhiRange_5D(newPar,newCov,Trk::absoluteCheck) : false ) { msg(MSG::WARNING) << "calculateFS_5D(): bad angles in filtered state!" << endmsg; - return 0; + return nullptr; } bool goodMatrix(true); @@ -1126,7 +1126,7 @@ Trk::KalmanUpdatorSMatrix::calculateFilterStep_5D (const TrackParameters& TP, msg(MSG::DEBUG)<<"calculateFS_5D(): unphysical cov!"<<endmsg; std::cout << newCov << std::endl; } - return 0; + return nullptr; } } } @@ -1160,7 +1160,7 @@ Trk::FitQualityOnSurface* Trk::KalmanUpdatorSMatrix::makeChi2_1D(const SParVecto double chiSquared = covRio + sign * covTrk(mk,mk); if (chiSquared == 0.0) { if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "inversion of the error-on-the-residual failed." << endmsg; - return 0; + return nullptr; } else { chiSquared = r*r/chiSquared; } @@ -1202,7 +1202,8 @@ Trk::FitQualityOnSurface* Trk::KalmanUpdatorSMatrix::makeChi2_5D(const SParVecto const int& sign) const { // sign: -1 = updated, +1 = predicted parameters. - SCovMatrix5 ScovOne,ScovTwo; // trafo EDM to new math lib + SCovMatrix5 ScovOne; + SCovMatrix5 ScovTwo; // trafo EDM to new math lib for (int i=0; i<5; ++i) for (int j=0; j<=i; ++j) { ScovOne(i,j) = covOne(i,j); @@ -1242,7 +1243,8 @@ Trk::KalmanUpdatorSMatrix::convertToClonedTrackPars(const Trk::TrackParameters& TP.associatedSurface().createTrackParameters(par[0],par[1],par[2],par[3],par[4],C); if (msgLvl(MSG::VERBOSE) && resultPar) { - char reportCalledInterface[80], ndtext2[5]; + char reportCalledInterface[80]; + char ndtext2[5]; memset(ndtext2, '\0', 5 ); ndtext.copy(ndtext2,2); // convert char to string if (sign>0) sprintf(reportCalledInterface,"%s-%s,%s)", diff --git a/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanWeightUpdator.cxx b/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanWeightUpdator.cxx index b47b4cd8a46b68e8ed9d917342e7bbb15f181f57..d6867c80ac4b4ec893fb2dc854422a761fe7d7f6 100755 --- a/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanWeightUpdator.cxx +++ b/Tracking/TrkTools/TrkMeasurementUpdator/src/KalmanWeightUpdator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -69,7 +69,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::addToState ( const Trk::TrackPa const Amg::Vector2D& measmtPos, const Amg::MatrixX& measmtErr) const { - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; Trk::TrackParameters* outPar = calculateFilterStep (trkPar, measmtPos, measmtErr,1,fitQoS, false); if (m_outputlevel <= 0 && outPar) logResult("addToState(TP,LPOS,ERR)",*outPar); @@ -81,7 +81,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::addToState ( const Trk::TrackPa const LocalParameters& measmtPar, const Amg::MatrixX& measmtErr) const { - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; Trk::TrackParameters* outPar = calculateFilterStep (trkPar, measmtPar, measmtErr,1,fitQoS, false); if (m_outputlevel <= 0 && outPar) logResult("addToState(TP,LPAR,ERR)",*outPar); @@ -97,11 +97,11 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::addToState ( const Trk::TrackPa if (fitQoS) { ATH_MSG_WARNING( "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" ); - return 0; + return nullptr; } else { Trk::TrackParameters* outPar = calculateFilterStep (trkPar, measmtPos, measmtErr, 1, fitQoS, true); if (!outPar) - fitQoS = 0; + fitQoS = nullptr; if (m_outputlevel <= 0 && outPar) logResult("addToState(TP,LPOS,ERR,FQ)",*outPar); return outPar; @@ -116,11 +116,11 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::addToState ( const Trk::TrackPa if (fitQoS) { ATH_MSG_WARNING( "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" ); - return 0; + return nullptr; } else { Trk::TrackParameters* outPar = calculateFilterStep (trkPar, measmtPar, measmtErr, 1, fitQoS, true); if (!outPar) - fitQoS = 0; + fitQoS = nullptr; if (m_outputlevel <= 0 && outPar) logResult("addToState(TP,LPAR,ERR,FQ)",*outPar); return outPar; @@ -131,7 +131,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::addToState ( const Trk::TrackPa Trk::TrackParameters* Trk::KalmanWeightUpdator::removeFromState ( const Trk::TrackParameters& trkPar, const Amg::Vector2D& measmtPos, const Amg::MatrixX& measmtErr) const { - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; Trk::TrackParameters* outPar = calculateFilterStep (trkPar, measmtPos, measmtErr,-1,fitQoS, false); if (m_outputlevel<=0 && outPar) logResult("removeFromState(TP,LPOS,ERR)",*outPar); @@ -143,7 +143,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::removeFromState ( const Trk::Tra const LocalParameters& measmtPar, const Amg::MatrixX& measmtErr) const { - FitQualityOnSurface* fitQoS = 0; + FitQualityOnSurface* fitQoS = nullptr; Trk::TrackParameters* outPar = calculateFilterStep (trkPar, measmtPar, measmtErr,-1,fitQoS,false); if (m_outputlevel && outPar) logResult("removeFromState(TP,LPAR,ERR)",*outPar); @@ -158,11 +158,11 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::removeFromState ( const Trk::Tra if (fitQoS) { ATH_MSG_WARNING( "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" ); - return 0; + return nullptr; } else { Trk::TrackParameters* outPar = calculateFilterStep (trkPar, measmtPos, measmtErr, -1, fitQoS, true); if (!outPar) - fitQoS = 0; + fitQoS = nullptr; if (m_outputlevel<=0 && outPar) logResult("removeFromState(TP,LPOS,ERR,FQ)",*outPar); return outPar; @@ -177,11 +177,11 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::removeFromState ( const Trk::Tra if (fitQoS) { ATH_MSG_WARNING( "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" ); - return 0; + return nullptr; } else { Trk::TrackParameters* outPar = calculateFilterStep (trkPar, measmtPar, measmtErr, -1, fitQoS, true); if (!outPar) - fitQoS = 0; + fitQoS = nullptr; if (m_outputlevel<=0 && outPar) logResult("removeFrommState(TP,LPAR,ERR,FQ)",*outPar); return outPar; @@ -195,7 +195,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::combineStates ( const Trk::Tra if (!one.covariance() && !two.covariance()) { ATH_MSG_WARNING( "both parameters have no errors, invalid " << "use of Updator::combineStates(TP,TP)" ); - return 0; + return nullptr; } // if only one of two has an error, return that one if (!one.covariance()) { @@ -235,7 +235,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::combineStates ( const Trk::Tra if ( (!thetaPhiWithinRange(p)) ? !correctThetaPhiRange(p) : false ) { ATH_MSG_WARNING( "combineStates(TP,TP): could not combine angular values." ); delete covNew; - return 0; + return nullptr; } // return cloned version of Track Parameters (MeasuredPerigee, MeasuredAtA...) TrackParameters* comb = one.associatedSurface().createTrackParameters(p[Trk::loc1],p[Trk::loc2], @@ -254,12 +254,12 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::combineStates ( const Trk::Tra if (!one.covariance() && !two.covariance()) { ATH_MSG_WARNING( "both parameters have no errors, invalid " << "use of Updator::combineStates(TP,TP,FQ)" ); - return 0; + return nullptr; } if (fitQoS) { ATH_MSG_WARNING( "expect nil FitQuality pointer, refuse operation to" << " avoid mem leak!" ); - return 0; + return nullptr; } // if only one of two has an error, return that one if (!one.covariance()) { @@ -299,7 +299,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::combineStates ( const Trk::Tra if ( (!thetaPhiWithinRange(p)) ? !correctThetaPhiRange(p) : false ) { ATH_MSG_WARNING( "combineStates(TP,TP): could not combine angular values." ); delete covNew; - return 0; + return nullptr; } // return cloned version of Track Parameters (MeasuredPerigee, MeasuredAtA...) TrackParameters* comb = one.associatedSurface().createTrackParameters(p[Trk::loc1],p[Trk::loc2], @@ -328,7 +328,7 @@ Trk::KalmanWeightUpdator::fullStateFitQuality ( const Trk::TrackParameters& trkP // try if Track Parameters are measured ones ? if (!trkPar.covariance()) { ATH_MSG_ERROR( "updated smoother/trajectory has no error matrix" ); - return 0; + return nullptr; } // covariance matrix for prediction const AmgSymMatrix(5)& covTrk = *trkPar.covariance(); @@ -364,13 +364,13 @@ Trk::KalmanWeightUpdator::fullStateFitQuality ( const Trk::TrackParameters& trkP // try if Track Parameters are measured ones ? if (!trkPar.covariance()) { ATH_MSG_ERROR( "updated smoother/trajectory has no error matrix" ); - return 0; + return nullptr; } // covariance matrix for prediction const AmgSymMatrix(5)& covTrk = *trkPar.covariance(); // State to measurement dimensional reduction Matrix ( n x m ) - Amg::MatrixX H(rioPar.expansionMatrix()); + const Amg::MatrixX& H(rioPar.expansionMatrix()); // residuals Amg::VectorX r = rioPar - H * trkPar.parameters(); @@ -389,7 +389,7 @@ Trk::KalmanWeightUpdator::predictedStateFitQuality ( const Trk::TrackParamete // try if Track Parameters are measured ones ? if (!predPar.covariance()) { ATH_MSG_ERROR( "input trajectory state has no error matrix" ); - return 0; + return nullptr; } // covariance matrix for prediction const AmgSymMatrix(5)& covPred = *predPar.covariance(); @@ -424,13 +424,13 @@ Trk::KalmanWeightUpdator::predictedStateFitQuality ( const Trk::TrackParamete // try if Track Parameters are measured ones ? if (!predPar.covariance()) { ATH_MSG_ERROR( "input trajectory state has no error matrix" ); - return 0; + return nullptr; } // covariance matrix for prediction const AmgSymMatrix(5)& covPred = *predPar.covariance(); // State to measurement dimensional reduction Matrix ( n x m ) - Amg::MatrixX H(rioPar.expansionMatrix()); + const Amg::MatrixX& H(rioPar.expansionMatrix()); // residuals Amg::VectorX r = rioPar - H * predPar.parameters(); @@ -449,7 +449,7 @@ Trk::KalmanWeightUpdator::predictedStateFitQuality ( const Trk::TrackParamete if (!one.covariance() && !two.covariance()) { ATH_MSG_WARNING( "both parameters have no errors, invalid " << "use of Updator::fitQuality()" ); - return 0; + return nullptr; } // if only one of two has an error, place a message. if (!one.covariance() || !two.covariance()) { @@ -472,7 +472,7 @@ Trk::KalmanWeightUpdator::predictedStateFitQuality ( const Trk::TrackParamete return new FitQualityOnSurface(chiSquared, 5); } -const std::vector<double> Trk::KalmanWeightUpdator::initialErrors() const { +std::vector<double> Trk::KalmanWeightUpdator::initialErrors() const { std::vector<double> E(5); for (int i=0; i<5; ++i) E[i] = (m_weight[i]!=0.) ? sqrt(1./m_weight[i]) : 1E5 ; @@ -509,7 +509,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::calculateFilterStep ( const Trk: if (sign<0) { ATH_MSG_ERROR( "MeasuredTrackParameters == Null, can not calculate " << "updated track state" ); - return 0; + return nullptr; } else { // no error given - use zero weight for the time GOld.setZero(); @@ -530,7 +530,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::calculateFilterStep ( const Trk: if (!thetaPhiWithinRange(pOld)) { ATH_MSG_WARNING( (sign>0?"addToState(TP,LPOS,ERR..)":"removeFromState(TP,LPOS,ERR..)") << ": undefined phi,theta range in input parameters." ); - return 0; + return nullptr; } // measurement vector of RIO_OnTrack - needs more care for # local par? @@ -562,7 +562,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::calculateFilterStep ( const Trk: Amg::VectorX pNew = (*covNew) * weightedSum; if ( (!thetaPhiWithinRange(pNew)) ? !correctThetaPhiRange(pNew) : false ) { ATH_MSG_WARNING( "calculateFS(TP,LPAR,ERR): bad angles in filtered state!" ); - return 0; + return nullptr; } // compute chi2 if needed @@ -610,7 +610,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::calculateFilterStep ( const Trk: if (sign<0) { ATH_MSG_ERROR( "MeasuredTrackParameters == Null, can not calculate " << "updated track state" ); - return 0; + return nullptr; } else { // no error given - use zero weight for the time GOld.setZero(); @@ -630,12 +630,12 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::calculateFilterStep ( const Trk: if (!thetaPhiWithinRange(pOld)) { ATH_MSG_WARNING( (sign>0?"addToState(TP,LPAR,ERR..)":"removeFromState(TP,LPAR,ERR..)") << ": undefined phi,theta range in input parameters." ); - return 0; + return nullptr; } if (!thetaPhiWithinRange(m, m.parameterKey())) { ATH_MSG_WARNING( (sign>0?"addToState(TP,LPAR,ERR..)":"removeFromState(TP,LPAR,ERR..)") << ": undefined phi,theta range in input measurement !!" ); - return 0; + return nullptr; } // measurement vector of RIO_OnTrack - needs more care for # local par? @@ -662,7 +662,7 @@ Trk::TrackParameters* Trk::KalmanWeightUpdator::calculateFilterStep ( const Trk: ATH_MSG_VERBOSE( "FS: pNew: (" << pNew[0] << "," << pNew[1] << "," << pNew[2] << "," << pNew[3] << "," << pNew[4] << ")" ); if ( (!thetaPhiWithinRange(pNew)) ? !correctThetaPhiRange(pNew) : false ) { ATH_MSG_WARNING( "calculateFS(TP,LPAR,ERR): bad angles in filtered state!" ); - return 0; + return nullptr; } if (m_outputlevel <= 0) { logOutputCov(pNew, *Cnew); @@ -827,7 +827,8 @@ bool Trk::KalmanWeightUpdator::correctThetaPhiRange(Amg::VectorX& V, const bool // get phi and theta coordinate. // The case of no angles among meas'coordinates should have been blocked // by inline function thetaPhiWithinRange() - but is caught also here ("-1") - int jphi = -1, jtheta = -1; + int jphi = -1; + int jtheta = -1; double thetaMin = (isDifference ? -M_PI : 0); if (key == 31) jphi = Trk::phi; else if (key & 4) // phi is within localParameter and a measured coordinate diff --git a/Tracking/TrkTools/TrkMeasurementUpdator_xk/TrkMeasurementUpdator_xk/KalmanUpdator_xk.h b/Tracking/TrkTools/TrkMeasurementUpdator_xk/TrkMeasurementUpdator_xk/KalmanUpdator_xk.h index dc490d0cd4002ce07b935d601b2cdbc1cfb703e4..d6e5427c64393436266e3521b6b79251aad6c0e2 100755 --- a/Tracking/TrkTools/TrkMeasurementUpdator_xk/TrkMeasurementUpdator_xk/KalmanUpdator_xk.h +++ b/Tracking/TrkTools/TrkMeasurementUpdator_xk/TrkMeasurementUpdator_xk/KalmanUpdator_xk.h @@ -188,7 +188,7 @@ namespace Trk { // precision for non-measured track parameters are configured /////////////////////////////////////////////////////////////////// - virtual const std::vector<double> initialErrors() const override final; + virtual std::vector<double> initialErrors() const override final; protected: diff --git a/Tracking/TrkTools/TrkMeasurementUpdator_xk/src/KalmanUpdator_xk.cxx b/Tracking/TrkTools/TrkMeasurementUpdator_xk/src/KalmanUpdator_xk.cxx index e5783483db4a6c653a85fb7df9bf7459e25cfcfc..7c5e2bb592e50cdf2660d077e3043f8baae8eb0e 100755 --- a/Tracking/TrkTools/TrkMeasurementUpdator_xk/src/KalmanUpdator_xk.cxx +++ b/Tracking/TrkTools/TrkMeasurementUpdator_xk/src/KalmanUpdator_xk.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -87,7 +87,7 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::addToState const Amg::Vector2D & P, const Amg::MatrixX & E) const { - Trk::FitQualityOnSurface* Q=0; + Trk::FitQualityOnSurface* Q=nullptr; return update(T,P,E,Q, 1,false); } @@ -125,7 +125,7 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::removeFromState const Amg::Vector2D & P, const Amg::MatrixX & E) const { - Trk::FitQualityOnSurface* Q=0; + Trk::FitQualityOnSurface* Q=nullptr; return update(T,P,E,Q,-1,false); } @@ -151,7 +151,7 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::addToState const Trk::LocalParameters& P, const Amg::MatrixX & E) const { - Trk::FitQualityOnSurface* Q=0; + Trk::FitQualityOnSurface* Q=nullptr; return update(T,P,E,Q, 1,false); } @@ -177,7 +177,7 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::removeFromState const Trk::LocalParameters& P, const Amg::MatrixX & E) const { - Trk::FitQualityOnSurface* Q=0; + Trk::FitQualityOnSurface* Q=nullptr; return update(T,P,E,Q,-1,false); } @@ -287,12 +287,13 @@ std::pair<AmgVector(5),AmgSymMatrix(5)>* Trk::KalmanUpdator_xk::updateParameterD Trk::FitQualityOnSurface*& Q , bool X) const { - Q = 0; + Q = nullptr; // Conversion local parameters // - int n = Ep.cols(); if(n==0 || n>5) return 0; - double m[5],mv[15]; + int n = Ep.cols(); if(n==0 || n>5) return nullptr; + double m[5]; + double mv[15]; m [ 0]=P (0 ); mv[ 0]=Ep(0,0); @@ -337,7 +338,7 @@ std::pair<AmgVector(5),AmgSymMatrix(5)>* Trk::KalmanUpdator_xk::updateParameterD update = updateWithAnyDim(1,X,m,mv,p,pv,x2,n,K); if(update && X) Q = new Trk::FitQualityOnSurface(x2,n); } - if(!update) return 0; + if(!update) return nullptr; testAngles(p,pv); @@ -398,8 +399,10 @@ bool Trk::KalmanUpdator_xk::removeFromState Trk::TrackParameters* Trk::KalmanUpdator_xk::combineStates (const Trk::TrackParameters& T1, const Trk::TrackParameters& T2) const { - double M[5],MV[15]; if(!trackParametersToUpdator(T1,M,MV)) return 0; - double P[5],PV[15]; if(!trackParametersToUpdator(T2,P,PV)) return 0; + double M[5]; + double MV[15]; if(!trackParametersToUpdator(T1,M,MV)) return nullptr; + double P[5]; + double PV[15]; if(!trackParametersToUpdator(T2,P,PV)) return nullptr; double x2; double* m; double* mv; double* p; double* pv; if(MV[14] > PV[14]) {m = &M[0]; mv = &MV[0]; p = &P[0]; pv = &PV[0];} @@ -408,7 +411,7 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::combineStates if(updateWithFiveDim(false,m,mv,p,pv,x2)) { testAngles(p,pv); return updatorToTrackParameters(T1,p,pv); } - return 0; + return nullptr; } /////////////////////////////////////////////////////////////////// @@ -418,8 +421,10 @@ bool Trk::KalmanUpdator_xk::combineStates Trk::PatternTrackParameters& T2, Trk::PatternTrackParameters& T3) const { - double M[5],MV[15]; bool q1 = trackParametersToUpdator(T1,M,MV); - double P[5],PV[15]; bool q2 = trackParametersToUpdator(T2,P,PV); + double M[5]; + double MV[15]; bool q1 = trackParametersToUpdator(T1,M,MV); + double P[5]; + double PV[15]; bool q2 = trackParametersToUpdator(T2,P,PV); if(q1 && q2) { @@ -448,8 +453,10 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::combineStates (const TrackParameters& T1, const TrackParameters& T2, FitQualityOnSurface*& Q) const { - double M[5],MV[15]; if(!trackParametersToUpdator(T1,M,MV)) return 0; - double P[5],PV[15]; if(!trackParametersToUpdator(T2,P,PV)) return 0; + double M[5]; + double MV[15]; if(!trackParametersToUpdator(T1,M,MV)) return nullptr; + double P[5]; + double PV[15]; if(!trackParametersToUpdator(T2,P,PV)) return nullptr; double x2; double* m; double* mv; double* p; double* pv; if(MV[14] > PV[14]) {m = &M[0]; mv = &MV[0]; p = &P[0]; pv = &PV[0];} @@ -459,7 +466,7 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::combineStates Q = new Trk::FitQualityOnSurface(x2,5); testAngles(p,pv); return updatorToTrackParameters(T1,p,pv); } - return 0; + return nullptr; } /////////////////////////////////////////////////////////////////// @@ -471,8 +478,10 @@ bool Trk::KalmanUpdator_xk::combineStates double & Q ) const { - double M[5],MV[15]; bool q1 = trackParametersToUpdator(T1,M,MV); - double P[5],PV[15]; bool q2 = trackParametersToUpdator(T2,P,PV); + double M[5]; + double MV[15]; bool q1 = trackParametersToUpdator(T1,M,MV); + double P[5]; + double PV[15]; bool q2 = trackParametersToUpdator(T2,P,PV); if(q1 && q2) { @@ -503,14 +512,14 @@ Trk::KalmanUpdator_xk::predictedStateFitQuality const Amg::MatrixX & E) const { const AmgSymMatrix(5)* v = T.covariance(); - if(!v) return 0; + if(!v) return nullptr; double t[5] = {T.parameters()[0],T.parameters()[1], (*v)(0,0),(*v)(1,0),(*v)(1,1)}; int N; double x2; if(predictedStateFitQuality(t,P,E,N,x2)) return new Trk::FitQualityOnSurface(x2,N); - return 0; + return nullptr; } /////////////////////////////////////////////////////////////////// @@ -542,17 +551,22 @@ Trk::KalmanUpdator_xk::predictedStateFitQuality { // Conversion track parameters // - double p[5],pv[15]; if(!trackParametersToUpdator(T,p,pv)) return 0; + double p[5]; + double pv[15]; if(!trackParametersToUpdator(T,p,pv)) return nullptr; // Conversion local parameters // - int n,k; - double m[5],mv[15]; if(!localParametersToUpdator(P,E,n,k,m,mv)) return 0; + int n; + int k; + double m[5]; + double mv[15]; if(!localParametersToUpdator(P,E,n,k,m,mv)) return nullptr; // Xi2 calculation // - double r[5],w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.}; - int ib = m_key[k], ie=m_key[k+1]; + double r[5]; + double w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.}; + int ib = m_key[k]; + int ie=m_key[k+1]; for(int i=ib; i!=ie; ++i) {w[i-ib] = mv[i-ib]+pv[m_map[i]];} bool q=true; if(n!=1) q=invert(n,w,w); else w[0]=1./w[0]; @@ -561,7 +575,7 @@ Trk::KalmanUpdator_xk::predictedStateFitQuality differenceParLoc(k,m,p,r); return new Trk::FitQualityOnSurface(Xi2(n,r,w),n); } - return 0; + return nullptr; } /////////////////////////////////////////////////////////////////// @@ -575,17 +589,22 @@ bool Trk::KalmanUpdator_xk::predictedStateFitQuality { // Conversion track parameters // - double p[5],pv[15]; if(!trackParametersToUpdator(T,p,pv)) return false; + double p[5]; + double pv[15]; if(!trackParametersToUpdator(T,p,pv)) return false; // Conversion local parameters // - int n,k; - double m[5],mv[15]; if(!localParametersToUpdator(P,E,n,k,m,mv)) return false; + int n; + int k; + double m[5]; + double mv[15]; if(!localParametersToUpdator(P,E,n,k,m,mv)) return false; // Xi2 calculation // - double r[5],w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.}; - int ib = m_key[k], ie=m_key[k+1]; + double r[5]; + double w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.}; + int ib = m_key[k]; + int ie=m_key[k+1]; for(int i=ib; i!=ie; ++i) {w[i-ib] = mv[i-ib]+pv[m_map[i]];} bool q=true; if(n!=1) q=invert(n,w,w); else w[0]=1./w[0]; @@ -606,13 +625,13 @@ Trk::KalmanUpdator_xk::fullStateFitQuality const Amg::MatrixX & E) const { const AmgSymMatrix(5)* v = T.covariance(); - if(!v) return 0; + if(!v) return nullptr; double t[5] = {T.parameters()[0],T.parameters()[1], (*v)(0,0),(*v)(1,0),(*v)(1,1)}; int N; double x2; if(fullStateFitQuality(t,P,E,N,x2)) return new Trk::FitQualityOnSurface(x2,N); - return 0; + return nullptr; } /////////////////////////////////////////////////////////////////// @@ -643,16 +662,21 @@ const Trk::FitQualityOnSurface* Trk::KalmanUpdator_xk::fullStateFitQuality { // Conversion track parameters // - double p[5],pv[15]; if(!trackParametersToUpdator(T,p,pv)) return 0; + double p[5]; + double pv[15]; if(!trackParametersToUpdator(T,p,pv)) return nullptr; // Conversion local parameters // - int n,k; - double m[5],mv[15]; if(!localParametersToUpdator(P,E,n,k,m,mv)) return 0; + int n; + int k; + double m[5]; + double mv[15]; if(!localParametersToUpdator(P,E,n,k,m,mv)) return nullptr; // Xi2 calculation // - double r[5],w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.}; - int ib = m_key[k], ie=m_key[k+1]; + double r[5]; + double w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.}; + int ib = m_key[k]; + int ie=m_key[k+1]; for(int i=ib; i!=ie; ++i) {w[i-ib] = mv[i-ib]-pv[m_map[i]];} bool q=true; if(n!=1) q=invert(n,w,w); else w[0]=1./w[0]; @@ -676,17 +700,21 @@ bool Trk::KalmanUpdator_xk::fullStateFitQuality // Conversion track parameters // N = 0; - double p[5],pv[15]; if(!trackParametersToUpdator(T,p,pv)) return false; + double p[5]; + double pv[15]; if(!trackParametersToUpdator(T,p,pv)) return false; // Conversion local parameters // int k; - double m[5],mv[15]; if(!localParametersToUpdator(P,E,N,k,m,mv)) return false; + double m[5]; + double mv[15]; if(!localParametersToUpdator(P,E,N,k,m,mv)) return false; // Xi2 calculation // - double r[5],w[15]; - int ib = m_key[k], ie=m_key[k+1]; + double r[5]; + double w[15]; + int ib = m_key[k]; + int ie=m_key[k+1]; for(int i=ib; i!=ie; ++i) {w[i-ib] = mv[i-ib]-pv[m_map[i]];} bool q=true; if(N!=1) q=invert(N,w,w); else w[0]=1./w[0]; @@ -703,9 +731,12 @@ const Trk::FitQualityOnSurface* Trk::KalmanUpdator_xk::predictedStateFitQuality (const Trk::TrackParameters& T1, const Trk::TrackParameters& T2) const { - const double pi2 = 2.*M_PI , pi = M_PI; - double m[5],mv[15]; if(!trackParametersToUpdator(T1,m,mv)) return 0; - double p[5],pv[15]; if(!trackParametersToUpdator(T2,p,pv)) return 0; + const double pi2 = 2.*M_PI ; + const double pi = M_PI; + double m[5]; + double mv[15]; if(!trackParametersToUpdator(T1,m,mv)) return nullptr; + double p[5]; + double pv[15]; if(!trackParametersToUpdator(T2,p,pv)) return nullptr; double r[5] = {m [ 0]-p [ 0], m [ 1]-p [ 1], m [ 2]-p [ 2], @@ -734,7 +765,7 @@ const Trk::FitQualityOnSurface* Trk::KalmanUpdator_xk::predictedStateFitQuality mv[14]+pv[14]}; if(invert(5,w,w)) return new Trk::FitQualityOnSurface(Xi2(5,r,w),5); - return 0; + return nullptr; } /////////////////////////////////////////////////////////////////// @@ -744,9 +775,12 @@ bool Trk::KalmanUpdator_xk::predictedStateFitQuality const Trk::PatternTrackParameters& T2, double & X2) const { - const double pi2 = 2.*M_PI,pi = M_PI; - double m[5],mv[15]; if(!trackParametersToUpdator(T1,m,mv)) return 0; - double p[5],pv[15]; if(!trackParametersToUpdator(T2,p,pv)) return 0; + const double pi2 = 2.*M_PI; + const double pi = M_PI; + double m[5]; + double mv[15]; if(!trackParametersToUpdator(T1,m,mv)) return 0; + double p[5]; + double pv[15]; if(!trackParametersToUpdator(T2,p,pv)) return 0; double r[5] = {m [ 0]-p [ 0], m [ 1]-p [ 1], m [ 2]-p [ 2], @@ -783,7 +817,7 @@ bool Trk::KalmanUpdator_xk::predictedStateFitQuality // precision for non-measured track parameters are configured /////////////////////////////////////////////////////////////////// -const std::vector<double> Trk::KalmanUpdator_xk::initialErrors() const +std::vector<double> Trk::KalmanUpdator_xk::initialErrors() const { std::vector<double> errors(5); @@ -814,8 +848,9 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::update { // Measurement information preparation // - double m[2],mv[3]; - int n = E.rows(); if(n<=0) return 0; + double m[2]; + double mv[3]; + int n = E.rows(); if(n<=0) return nullptr; m [0] = P[0]; mv[0] = E(0,0); if(n==2) { @@ -826,7 +861,8 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::update // Conversion track parameters to updator presentation // - double p[5],pv[15]; bool measured = trackParametersToUpdator(T,p,pv); + double p[5]; + double pv[15]; bool measured = trackParametersToUpdator(T,p,pv); bool update = false; if(measured) { @@ -842,12 +878,12 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::update if(update) { testAngles(p,pv); return updatorToTrackParameters(T,p,pv); } - return 0; + return nullptr; } // For no measured track parameters // - if(O<0) return 0; + if(O<0) return nullptr; if (n==1) { update = updateNoMeasuredWithOneDim(m,mv,p,pv); @@ -859,7 +895,7 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::update } if(update) return updatorToTrackParameters(T,p,pv); - return 0; + return nullptr; } /////////////////////////////////////////////////////////////////// @@ -876,7 +912,8 @@ bool Trk::KalmanUpdator_xk::update { // Measurement information preparation // - double m[2],mv[3]; + double m[2]; + double mv[3]; N = E.rows(); if(N<=0) return false; m [0] = P[0]; mv[0] = E(0,0); @@ -888,7 +925,8 @@ bool Trk::KalmanUpdator_xk::update // Conversion track parameters to updator presentation // - double p[5],pv[15]; bool measured = trackParametersToUpdator(T,p,pv); + double p[5]; + double pv[15]; bool measured = trackParametersToUpdator(T,p,pv); bool update = false; if(measured) { @@ -927,7 +965,8 @@ bool Trk::KalmanUpdator_xk::updateOneDimension { // Measurement information preparation // - double m[2],mv[3]; + double m[2]; + double mv[3]; int N = E.rows(); if(N!=2 ) return false; m [0] = P[0]; m [1] = P[1]; @@ -937,7 +976,8 @@ bool Trk::KalmanUpdator_xk::updateOneDimension // Conversion track parameters to updator presentation // - double p[5],pv[15]; bool measured = trackParametersToUpdator(T,p,pv); + double p[5]; + double pv[15]; bool measured = trackParametersToUpdator(T,p,pv); bool update = false; if(measured) { @@ -980,12 +1020,15 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::update { // Conversion local parameters // - int n,k; - double m[5],mv[15]; if(!localParametersToUpdator(P,E,n,k,m,mv)) return 0; + int n; + int k; + double m[5]; + double mv[15]; if(!localParametersToUpdator(P,E,n,k,m,mv)) return nullptr; // Conversion track parameters to updator presentation // - double p[5],pv[15]; bool measured = trackParametersToUpdator(T,p,pv); + double p[5]; + double pv[15]; bool measured = trackParametersToUpdator(T,p,pv); bool update = false; if(measured) { @@ -1004,12 +1047,12 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::update if(update && X && !Q) Q = new Trk::FitQualityOnSurface(x2,n); } if(update) {testAngles(p,pv); return updatorToTrackParameters(T,p,pv);} - return 0; + return nullptr; } // For no measured track parameters // - if(O<0) return 0; + if(O<0) return nullptr; if (n==1 && k==1) { update = updateNoMeasuredWithOneDim(m,mv,p,pv); if(update && X && !Q) Q = new Trk::FitQualityOnSurface(0.,1); @@ -1023,7 +1066,7 @@ Trk::TrackParameters* Trk::KalmanUpdator_xk::update if(update && X && !Q) Q = new Trk::FitQualityOnSurface(0.,n); } if(update) return updatorToTrackParameters(T,p,pv); - return 0; + return nullptr; } /////////////////////////////////////////////////////////////////// @@ -1041,11 +1084,13 @@ bool Trk::KalmanUpdator_xk::update // Conversion local parameters // int k; - double m[5],mv[15]; if(!localParametersToUpdator(P,E,N,k,m,mv)) return false; + double m[5]; + double mv[15]; if(!localParametersToUpdator(P,E,N,k,m,mv)) return false; // Conversion track parameters to updator presentation // - double p[5],pv[15]; bool measured = trackParametersToUpdator(T,p,pv); + double p[5]; + double pv[15]; bool measured = trackParametersToUpdator(T,p,pv); bool update = false; if(measured) { @@ -1084,7 +1129,8 @@ bool Trk::KalmanUpdator_xk::predictedStateFitQuality { // Measurement information preparation // - double m[2],mv[3]; X2 = 0.; + double m[2]; + double mv[3]; X2 = 0.; N = E.rows(); if(N<=0) return false; m [0] = P[0]-T[0]; mv[0] = E(0,0)+T[2]; @@ -1117,7 +1163,8 @@ bool Trk::KalmanUpdator_xk::fullStateFitQuality { // Measurement information preparation // - double m[2],mv[3]; X2 = 0.; + double m[2]; + double mv[3]; X2 = 0.; N = E.rows(); if(N<=0) return false; m [0] = P[0]-T[0]; mv[0] = E(0,0)-T[2]; @@ -1206,7 +1253,8 @@ bool Trk::KalmanUpdator_xk::updateNoMeasuredWithAnyDim (double* M,double* MV,double* P,double* PV,int K) const { - int i=0,j=0; + int i=0; + int j=0; while(K) {if(K&1) P[i]=M[j++]; K>>=1; ++i;} if(i==0) return false; PV[ 0] = m_cov0[0]; @@ -1352,9 +1400,7 @@ bool Trk::KalmanUpdator_xk::updateWithOneDimWithBoundary PV[ 3]-= (k2*PV[ 0]); if((PV[ 2]-= (k1*PV[ 1]))<=0.) return false; PV[ 1]-= (k1*PV[ 0]); - if((PV[ 0]-= (k0*PV[ 0]))<=0.) return false; - - return true; + return (PV[ 0]-= (k0*PV[ 0])) > 0.; } /////////////////////////////////////////////////////////////////// @@ -1366,7 +1412,9 @@ bool Trk::KalmanUpdator_xk::updateWithOneDimWithBoundary bool Trk::KalmanUpdator_xk::updateWithTwoDim (int O,bool X,double* M,double* MV,double* P, double* PV,double& xi2) const { - double v0,v1,v2; + double v0; + double v1; + double v2; if(O>0) {v0 = MV[0]+PV[0]; v1 = MV[1]+PV[1]; v2 = MV[2]+PV[2];} else {v0 = MV[0]-PV[0]; v1 = MV[1]-PV[1]; v2 = MV[2]-PV[2];} @@ -1379,11 +1427,16 @@ bool Trk::KalmanUpdator_xk::updateWithTwoDim // K matrix with (5x2) size // - double k0 = PV[ 0]*w0+PV[ 1]*w1, k1 = PV[ 0]*w1+PV[ 1]*w2; - double k2 = PV[ 1]*w0+PV[ 2]*w1, k3 = PV[ 1]*w1+PV[ 2]*w2; - double k4 = PV[ 3]*w0+PV[ 4]*w1, k5 = PV[ 3]*w1+PV[ 4]*w2; - double k6 = PV[ 6]*w0+PV[ 7]*w1, k7 = PV[ 6]*w1+PV[ 7]*w2; - double k8 = PV[10]*w0+PV[11]*w1, k9 = PV[10]*w1+PV[11]*w2; + double k0 = PV[ 0]*w0+PV[ 1]*w1; + double k1 = PV[ 0]*w1+PV[ 1]*w2; + double k2 = PV[ 1]*w0+PV[ 2]*w1; + double k3 = PV[ 1]*w1+PV[ 2]*w2; + double k4 = PV[ 3]*w0+PV[ 4]*w1; + double k5 = PV[ 3]*w1+PV[ 4]*w2; + double k6 = PV[ 6]*w0+PV[ 7]*w1; + double k7 = PV[ 6]*w1+PV[ 7]*w2; + double k8 = PV[10]*w0+PV[11]*w1; + double k9 = PV[10]*w1+PV[11]*w2; if(O<0) { k0=-k0; k1=-k1; k2=-k2; k3=-k3; k4=-k4; @@ -1431,7 +1484,9 @@ bool Trk::KalmanUpdator_xk::updateWithTwoDim bool Trk::KalmanUpdator_xk::updateWithTwoDimParameters (int O,bool X,double* M,double* MV,double* P, double* PV,double& xi2) const { - double v0,v1,v2; + double v0; + double v1; + double v2; if(O>0) {v0 = MV[0]+PV[0]; v1 = MV[1]+PV[1]; v2 = MV[2]+PV[2];} else {v0 = MV[0]-PV[0]; v1 = MV[1]-PV[1]; v2 = MV[2]-PV[2];} @@ -1444,11 +1499,16 @@ bool Trk::KalmanUpdator_xk::updateWithTwoDimParameters // K matrix with (5x2) size // - double k0 = PV[ 0]*w0+PV[ 1]*w1, k1 = PV[ 0]*w1+PV[ 1]*w2; - double k2 = PV[ 1]*w0+PV[ 2]*w1, k3 = PV[ 1]*w1+PV[ 2]*w2; - double k4 = PV[ 3]*w0+PV[ 4]*w1, k5 = PV[ 3]*w1+PV[ 4]*w2; - double k6 = PV[ 6]*w0+PV[ 7]*w1, k7 = PV[ 6]*w1+PV[ 7]*w2; - double k8 = PV[10]*w0+PV[11]*w1, k9 = PV[10]*w1+PV[11]*w2; + double k0 = PV[ 0]*w0+PV[ 1]*w1; + double k1 = PV[ 0]*w1+PV[ 1]*w2; + double k2 = PV[ 1]*w0+PV[ 2]*w1; + double k3 = PV[ 1]*w1+PV[ 2]*w2; + double k4 = PV[ 3]*w0+PV[ 4]*w1; + double k5 = PV[ 3]*w1+PV[ 4]*w2; + double k6 = PV[ 6]*w0+PV[ 7]*w1; + double k7 = PV[ 6]*w1+PV[ 7]*w2; + double k8 = PV[10]*w0+PV[11]*w1; + double k9 = PV[10]*w1+PV[11]*w2; if(O<0) { k0=-k0; k1=-k1; k2=-k2; k3=-k3; k4=-k4; @@ -1555,7 +1615,8 @@ bool Trk::KalmanUpdator_xk::updateWithTwoDimWithBoundary bool Trk::KalmanUpdator_xk::updateWithFiveDim (bool X,double* M,double* MV,double* P, double* PV,double& xi2) const { - const double pi2 = 2.*M_PI, pi = M_PI; + const double pi2 = 2.*M_PI; + const double pi = M_PI; double w[15]={MV[ 0]+PV[ 0],MV[ 1]+PV[ 1],MV[ 2]+PV[ 2], MV[ 3]+PV[ 3],MV[ 4]+PV[ 4],MV[ 5]+PV[ 5], @@ -1658,8 +1719,10 @@ bool Trk::KalmanUpdator_xk::updateWithAnyDim (int O,bool X,double* M,double* MV,double* P, double* PV,double& xi2, int N,int K) const { - double s,w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.}; - int ib = m_key[K], ie=m_key[K+1]; + double s; + double w[15]={1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.,1.}; + int ib = m_key[K]; + int ie=m_key[K+1]; if(O>0) {s= 1.; for(int i=ib; i!=ie; ++i) {w[i-ib] = MV[i-ib]+PV[m_map[i]];}} else {s=-1.; for(int i=ib; i!=ie; ++i) {w[i-ib] = MV[i-ib]-PV[m_map[i]];}} @@ -2174,7 +2237,8 @@ double Trk::KalmanUpdator_xk::Xi2for5(double* R,double* W) const int Trk::KalmanUpdator_xk::differenceParLoc (int K,double* L,double* T, double* R) const { - const double pi2 = 2.*M_PI, pi = M_PI; + const double pi2 = 2.*M_PI; + const double pi = M_PI; int i = 0; if(K & 1) {R[i]=L[i]-T[0]; ++i;} @@ -2203,7 +2267,8 @@ int Trk::KalmanUpdator_xk::differenceParLoc void Trk::KalmanUpdator_xk::differenceLocPar (int K,double* L,double* T, double* R) const { - const double pi2 = 2.*M_PI, pi = M_PI; + const double pi2 = 2.*M_PI; + const double pi = M_PI; int i = 0; R[0]=0.; if(K & 1) R[0]=L[i++]-T[0]; R[1]=0.; if(K & 2) R[1]=L[i++]-T[1]; @@ -2230,7 +2295,8 @@ void Trk::KalmanUpdator_xk::mapKeyProduction() for(int K=1; K!= 32; ++K) { - unsigned int I[5]={0,0,0,0,0}, m=0; + unsigned int I[5]={0,0,0,0,0}; + unsigned int m=0; for(int i=0; i!=5; ++i) {if((K>>i)&1) I[i]=1;} for(int i=0; i!=5; ++i) { @@ -2248,7 +2314,8 @@ void Trk::KalmanUpdator_xk::mapKeyProduction() void Trk::KalmanUpdator_xk::testAngles(double* p,double* v) const { - const double pi2 = 2.*M_PI, pi = M_PI; + const double pi2 = 2.*M_PI; + const double pi = M_PI; // Polar angle check // diff --git a/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx b/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx index 3af186ba37cdeefa8c635b2436e951bd9ba093ee..f2c574050717e0624c711472554536f9aa256df7 100644 --- a/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx +++ b/Tracking/TrkTools/TrkParticleCreator/src/TrackParticleCreatorTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /*************************************************************************** @@ -45,10 +45,11 @@ #include "AtlasDetDescr/AtlasDetectorID.h" #include "BeamSpotConditionsData/BeamSpotData.h" -#include <map> -#include <vector> #include <algorithm> #include <cassert> +#include <map> +#include <memory> +#include <vector> // helper methods to print messages template<class T> @@ -247,8 +248,8 @@ namespace Trk errors.push_back(eprob_to_copy); } else { - m_decorateSummaryTypes.push_back( std::make_pair(SG::AuxElement::Decorator<uint8_t>(extra_summary_type_iter->first), - extra_summary_type_iter->second)); + m_decorateSummaryTypes.emplace_back(SG::AuxElement::Decorator<uint8_t>(extra_summary_type_iter->first), + extra_summary_type_iter->second); } } else { @@ -256,7 +257,7 @@ namespace Trk m_copyEProbabilities.push_back(eprob_iter->second.first); } else{ - m_decorateEProbabilities.push_back( std::make_pair(SG::AuxElement::Decorator<float>(eprob_iter->first),eprob_iter->second.first)); + m_decorateEProbabilities.emplace_back(SG::AuxElement::Decorator<float>(eprob_iter->first),eprob_iter->second.first); } } } @@ -368,7 +369,7 @@ namespace Trk m_trackSummaryTool->updateTrack(nonConstTrack); } summary.reset(m_trackSummaryTool->createSummary(*track)); - if (summary.get() == nullptr) { + if (summary == nullptr) { ATH_MSG_DEBUG ("No proper TrackSummary was returned. Creating TrackParticle with a dummy TrackSummary"); summary = std::make_unique<Trk::TrackSummary>(); } // else ATH_MSG_VERBOSE("Got Summary for Track" ); @@ -378,7 +379,7 @@ namespace Trk summary = std::make_unique<Trk::TrackSummary>(*track->trackSummary()); } else { ATH_MSG_VERBOSE("No proper TrackSummaryTool found. Creating TrackParticle with a dummy TrackSummary"); - summary.reset(new Trk::TrackSummary); + summary = std::make_unique<Trk::TrackSummary>(); } } if (m_forceTrackSummaryUpdate || m_updateTrack) { @@ -466,7 +467,7 @@ namespace Trk << ", Z " << tsos->trackParameters()->position().z() ); // we are not interested in keeping measurement parameters after any second perigee - if (parameters.size() > 0) haveFirstMeasurementParameters = true; + if (!parameters.empty()) haveFirstMeasurementParameters = true; } } @@ -625,10 +626,10 @@ namespace Trk float theta = -1000; if (element) { - Amg::Vector3D my_track = tp->momentum(); - Amg::Vector3D my_normal = element->normal(); - Amg::Vector3D my_phiax = element->phiAxis(); - Amg::Vector3D my_etaax = element->etaAxis(); + const Amg::Vector3D& my_track = tp->momentum(); + const Amg::Vector3D& my_normal = element->normal(); + const Amg::Vector3D& my_phiax = element->phiAxis(); + const Amg::Vector3D& my_etaax = element->etaAxis(); // track component on etaAxis: float trketacomp = my_track.dot(my_etaax); // track component on phiAxis: @@ -657,7 +658,7 @@ namespace Trk surfaceID = mesb->associatedSurface().associatedDetectorElement()->identify(); if (m_detID->is_pixel(surfaceID)) { - InDet::SiWidth width = pixelCluster->width(); + const InDet::SiWidth& width = pixelCluster->width(); zWidth = static_cast<int>(width.colRow().y()); } @@ -760,7 +761,7 @@ namespace Trk << ", Z " << tsos->trackParameters()->position().z() ); // we are not interested in keeping measurement parameters after any second perigee - if (parameters.size() > 0) haveFirstMeasurementParameters = true; + if (!parameters.empty()) haveFirstMeasurementParameters = true; } } @@ -814,7 +815,7 @@ namespace Trk if (!trackparticle){ ATH_MSG_WARNING( "WARNING: Problem creating TrackParticle - Returning 0"); - return 0; + return nullptr; } trackparticle->setTrackLink( *(trackParticle.trackElementLink()) ); @@ -834,7 +835,7 @@ namespace Trk if (!trackparticle){ ATH_MSG_WARNING( "WARNING: Problem creating TrackParticle - Returning 0"); - return 0; + return nullptr; } trackparticle->setTrackLink( trackLink ); @@ -852,7 +853,7 @@ namespace Trk xAOD::TrackParticle* trackparticle = new xAOD::TrackParticle; if (!trackparticle){ ATH_MSG_WARNING( "WARNING: Problem creating TrackParticle - Returning 0"); - return 0; + return nullptr; } /* * The following needs care as in one case the ownership @@ -906,7 +907,7 @@ namespace Trk const Trk::Perigee* &aPer) const { aPer = track->perigeeParameters(); - if (aPer==0) + if (aPer==nullptr) { ATH_MSG_VERBOSE ("Track has no perigee parameters."); return false; diff --git a/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/KitManager.cxx b/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/KitManager.cxx index fbaac89f13ce2e79b7462993dadc726d5abe1eed..ef3026908652352ef3eb53b267c8e1affbeb77d4 100644 --- a/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/KitManager.cxx +++ b/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/KitManager.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "KitManager.h" #include <sstream> @@ -12,7 +12,7 @@ const void *KitManagerBase::kitPtr(const std::string &name) const { return m_registry.at(name); } -bool KitManagerBase::registerKit(std::string name, const void *a_kit) { +bool KitManagerBase::registerKit(const std::string& name, const void *a_kit) { std::pair<std::string, const void *> elm = std::make_pair(name, a_kit); if (!m_registry.insert(elm).second) { std::stringstream message; diff --git a/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/KitManager.h b/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/KitManager.h index dae728ea22db23f2a6b5a676855ba64548d1d63d..dae3f24c8fee8c677190b63f9b738f12cf6dc916 100644 --- a/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/KitManager.h +++ b/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/KitManager.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef _KitManager_H_ #define _KitManager_H_ @@ -17,7 +17,7 @@ protected: const void *kitPtr(const std::string &name) const; - bool registerKit(std::string name, const void *a_kit); + bool registerKit(const std::string& name, const void *a_kit); std::map<std::string, const void * > m_registry; public: @@ -36,7 +36,7 @@ public: } } - bool registerKit(std::string name, const T_KitInterface *a_kit) { + bool registerKit(const std::string& name, const T_KitInterface *a_kit) { return KitManagerBase::registerKit(name, static_cast< const void *>(a_kit)); } diff --git a/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/RIO_OnTrackErrorScalingCondAlg.cxx b/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/RIO_OnTrackErrorScalingCondAlg.cxx index 44a00b20652f67e18277862c165a70a00a4fd223..22622f0d57c19293b46dd03fb5c0fd21fc8de0a1 100644 --- a/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/RIO_OnTrackErrorScalingCondAlg.cxx +++ b/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/RIO_OnTrackErrorScalingCondAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkRIO_OnTrack/RIO_OnTrackErrorScaling.h" @@ -45,7 +45,7 @@ StatusCode RIO_OnTrackErrorScalingCondAlg::initialize ATLAS_NOT_THREAD_SAFE() { } -void RIO_OnTrackErrorScalingCondAlg::registerAttribute(std::string name, unsigned int type_idx, unsigned int param_idx) { +void RIO_OnTrackErrorScalingCondAlg::registerAttribute(const std::string& name, unsigned int type_idx, unsigned int param_idx) { if (!m_attributeMap.insert( std::make_pair(name, std::make_pair(type_idx,param_idx)) ).second) { std::stringstream message; message << "Failed to add RIO_OnTrackErrorScaling paramter : " << name << "."; diff --git a/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/RIO_OnTrackErrorScalingCondAlg.h b/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/RIO_OnTrackErrorScalingCondAlg.h index 97a6dbcfd6ff370efcf0ae5933a23ff94fa8bedc..3900549600efe18e0ed4e77eb5c7a048882f242e 100644 --- a/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/RIO_OnTrackErrorScalingCondAlg.h +++ b/Tracking/TrkTools/TrkRIO_OnTrackCreator/src/RIO_OnTrackErrorScalingCondAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef _RIO_OnTrackErrorScalingCondAlg_H_ @@ -30,7 +30,7 @@ class RIO_OnTrackErrorScalingCondAlg : public AthAlgorithm private: StatusCode addErrorScaling ATLAS_NOT_THREAD_SAFE (const std::string &type_name); - void registerAttribute(std::string name, unsigned int type_idx, unsigned int param_idx); + void registerAttribute(const std::string& name, unsigned int type_idx, unsigned int param_idx); SG::ReadCondHandleKey<CondAttrListCollection> m_readKey {this, "ReadKey", "/Indet/TrkErrorScaling", "Conditions folder namer for innder detector error scaling parameters."}; diff --git a/Tracking/TrkTools/TrkResidualPullCalculator/src/ResidualPullCalculator.cxx b/Tracking/TrkTools/TrkResidualPullCalculator/src/ResidualPullCalculator.cxx index 82674f3f5c5d5a8d382076df3d1387d9740a69ee..9413c76e82860da4bbecedb2681a970a535ddf82 100644 --- a/Tracking/TrkTools/TrkResidualPullCalculator/src/ResidualPullCalculator.cxx +++ b/Tracking/TrkTools/TrkResidualPullCalculator/src/ResidualPullCalculator.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -33,7 +33,7 @@ Trk::ResidualPullCalculator::ResidualPullCalculator(const std::string& type, con m_SCTresidualTool("InDet::SCT_ResidualPullCalculator/SCT_ResidualPullCalculator"), m_RPCresidualTool("Muon::RPC_ResidualPullCalculator/RPC_ResidualPullCalculator"), m_TGCresidualTool("Muon::TGC_ResidualPullCalculator/TGC_ResidualPullCalculator"), -m_idHelper(0) { +m_idHelper(nullptr) { declareInterface<IResidualPullCalculator>(this); declareProperty("ResidualPullCalculatorForSCT", m_SCTresidualTool, "Tool to calculate residuals and pulls in the SCT (including module rotation)"); declareProperty("ResidualPullCalculatorForRPC", m_RPCresidualTool, "Tool to calculate residuals and pulls in the RPC (including phi/eta detection)"); @@ -186,7 +186,7 @@ const Trk::ResidualPull* Trk::ResidualPullCalculator::residualPull( const Trk::ResidualPull::ResidualType resType, const Trk::TrackState::MeasurementType detType) const { - if (!measurement || !trkPar) return 0; + if (!measurement || !trkPar) return nullptr; // if no covariance for the track parameters is given the pull calculation is not valid bool pullIsValid = trkPar->covariance(); @@ -253,7 +253,7 @@ const Trk::ResidualPull* Trk::ResidualPullCalculator::residualPull( return m_SCTresidualTool->residualPull(measurement, trkPar, resType, Trk::TrackState::SCT); } else { ATH_MSG_WARNING ("No SCT ResidualPullCalculator given, cannot calculate residual and pull for SCT measurement!"); - return 0; + return nullptr; } break; case Trk::TrackState::RPC: @@ -263,7 +263,7 @@ const Trk::ResidualPull* Trk::ResidualPullCalculator::residualPull( return m_RPCresidualTool->residualPull(measurement, trkPar, resType, Trk::TrackState::RPC); } else { ATH_MSG_WARNING ("No RPC ResidualPullCalculator given, cannot calculate residual and pull for RPC measurement!"); - return 0; + return nullptr; } break; case Trk::TrackState::TGC: @@ -273,7 +273,7 @@ const Trk::ResidualPull* Trk::ResidualPullCalculator::residualPull( return m_TGCresidualTool->residualPull(measurement, trkPar, resType, Trk::TrackState::TGC); } else { ATH_MSG_WARNING ("No TGC ResidualPullCalculator given, cannot calculate residual and pull for TGC measurement!"); - return 0; + return nullptr; } break; case Trk::TrackState::Segment: diff --git a/Tracking/TrkTools/TrkSegmentConverter/src/TrkSegmentConverter.cxx b/Tracking/TrkTools/TrkSegmentConverter/src/TrkSegmentConverter.cxx index 7aec7c7414c209de220f7b76db0fa2a3ab282f69..092910d52b6507c36b0a8a77bf7e05d756d9fd6f 100755 --- a/Tracking/TrkTools/TrkSegmentConverter/src/TrkSegmentConverter.cxx +++ b/Tracking/TrkTools/TrkSegmentConverter/src/TrkSegmentConverter.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -94,7 +94,7 @@ StatusCode Trk::TrkSegmentConverter::finalize() Trk::Track* Trk::TrkSegmentConverter::convert(const Trk::Segment& segment) { - Track* track=0; + Track* track=nullptr; if(m_useFitter) track=convertWithFitter(segment); else @@ -106,7 +106,7 @@ Trk::Track* Trk::TrkSegmentConverter::convert(const Trk::Segment& segment) //================ Convert with a TrackFitter ====================================== Trk::Track* Trk::TrkSegmentConverter::convertWithFitter(const Trk::Segment& segment) { - Track* track=0; + Track* track=nullptr; MeasurementSet myset; int nROTs=segment.numberOfMeasurementBases(); @@ -118,7 +118,7 @@ Trk::Track* Trk::TrkSegmentConverter::convertWithFitter(const Trk::Segment& segm ATH_MSG_DEBUG (" numberOfContainedRots: " << nROTs ); - Amg::Vector3D inputMatchingPos(segment.globalPosition()); + const Amg::Vector3D& inputMatchingPos(segment.globalPosition()); ATH_MSG_DEBUG (" created inputMatchingPos " ); @@ -161,7 +161,7 @@ Trk::Track* Trk::TrkSegmentConverter::convertBruteForce(const Trk::Segment& tS) DataVector<const Trk::TrackStateOnSurface>* ntsos = new DataVector<const Trk::TrackStateOnSurface>; //Get the track segment fit quality. If not there drop segment - const Trk::FitQuality* fq = tS.fitQuality() ? tS.fitQuality()->clone() : 0; + const Trk::FitQuality* fq = tS.fitQuality() ? tS.fitQuality()->clone() : nullptr; //if(!fq) {if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Segment has no fit quality!Discard..." << endmsg; return 0;} //Get the track segment information and build the initial track parameters @@ -173,12 +173,12 @@ Trk::Track* Trk::TrkSegmentConverter::convertBruteForce(const Trk::Segment& tS) if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Initial TRT Segment Parameters for refitting " << (*segPar) << endmsg; }else{ if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Could not get initial TRT segment parameters! " << endmsg; - return 0; + return nullptr; } for(int it=0; it<int(tS.numberOfMeasurementBases()); it++){ // on first measurement add parameters - const Trk::TrackStateOnSurface* seg_tsos = 0; + const Trk::TrackStateOnSurface* seg_tsos = nullptr; if ( dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(tS.measurement(it)) ) { Amg::Vector3D perigeePosition(0.,0.,0.); @@ -186,18 +186,18 @@ Trk::Track* Trk::TrkSegmentConverter::convertBruteForce(const Trk::Segment& tS) Trk::PerigeeSurface perigeeSurface(perigeePosition); const Trk::TrackParameters* parm = m_extrapolator->extrapolate(*segPar, perigeeSurface); const Trk::Perigee* perParm = dynamic_cast<const Trk::Perigee*>(parm); - if(!perParm) {if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Failed to build perigee parameters.Discard..." << endmsg; delete ntsos; return 0;} + if(!perParm) {if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "Failed to build perigee parameters.Discard..." << endmsg; delete ntsos; return nullptr;} std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Perigee); - seg_tsos = new Trk::TrackStateOnSurface(0,perParm,0,0,typePattern); + seg_tsos = new Trk::TrackStateOnSurface(nullptr,perParm,nullptr,nullptr,typePattern); } if(it>=1){ std::bitset<Trk::TrackStateOnSurface::NumberOfTrackStateOnSurfaceTypes> typePattern; typePattern.set(Trk::TrackStateOnSurface::Measurement); if(it==1) { - seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(),segPar,0,0,typePattern); + seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(),segPar,nullptr,nullptr,typePattern); }else{ - seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(),0,0,0,typePattern); + seg_tsos = new Trk::TrackStateOnSurface(tS.measurement(it)->clone(),nullptr,nullptr,nullptr,typePattern); } } ntsos->push_back(seg_tsos); diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ICompetingRIOsOnTrackTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ICompetingRIOsOnTrackTool.h index 44697a8b71ba43a89778910c40724f8bd3e9c16f..0a0e57078f8286b7b81dbc7fd4b7f8c9bc784320 100755 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ICompetingRIOsOnTrackTool.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ICompetingRIOsOnTrackTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -112,7 +112,7 @@ inline const Trk::CompetingRIOsOnTrack* Trk::ICompetingRIOsOnTrackTool::createSi const Trk::TrackState::MeasurementType) const { std::cout << "CONFIGURATION WARNING: dummy version of single-hit CompetingRIOsOnTrack maker called." << std::endl; - return 0; + return nullptr; } inline void Trk::ICompetingRIOsOnTrackTool::reequipCompetingROT @@ -123,7 +123,6 @@ inline void Trk::ICompetingRIOsOnTrackTool::reequipCompetingROT const Trk::TrackState::MeasurementType) const { std::cout << "CONFIGURATION WARNING: dummy version of single-hit CompROT re-equipping called." << std::endl; - return; } diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IResidualPullCalculator.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IResidualPullCalculator.h index 98905005ef85ebdd50682728506bd31c5d3ef309..d84b25dd2b7c732561b633284e69f8d90d148d27 100755 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IResidualPullCalculator.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IResidualPullCalculator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ public: const Trk::TrackParameters* , const Trk::ResidualPull::ResidualType , const Trk::TrackState::MeasurementType, - const std::vector<const Trk::AlignmentEffectsOnTrack*>& ) const { return (Trk::ResidualPull*) 0; } + const std::vector<const Trk::AlignmentEffectsOnTrack*>& ) const { return (Trk::ResidualPull*) nullptr; } /** This function is a light-weight version of the function above, designed for track fitters * where speed is critical. The user has to provide a std::vector of size 5, which gets diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackParticleCreatorTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackParticleCreatorTool.h index 463f862f5b5456b433de04c2e4170d2b7dc3caeb..43b524f7e4982d5f3c7835224b662d8342c99860 100755 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackParticleCreatorTool.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrackParticleCreatorTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -52,14 +52,14 @@ namespace Trk so they should be passed by reference. */ virtual Rec::TrackParticle* createParticle( const Trk::Track* track, - const Trk::VxCandidate* vxCandidate = 0, + const Trk::VxCandidate* vxCandidate = nullptr, Trk::TrackParticleOrigin prtOrigin = Trk::NoVtx) const =0; // @TODO can this be removed ? /** Method to construct a xAOD::TrackParticle from a Rec::TrackParticle. @param track particle @param TrackParticleContainer needed to have an AuxStore, if provided particle will be added to store which takes ownership */ - virtual xAOD::TrackParticle* createParticle( const Rec::TrackParticle& trackParticle, xAOD::TrackParticleContainer* container=0 ) const = 0; + virtual xAOD::TrackParticle* createParticle( const Rec::TrackParticle& trackParticle, xAOD::TrackParticleContainer* container=nullptr ) const = 0; /** Method to construct a TrackParticle from a passed Track. Currently, it will ONLY fill the MeasuredPerigee i.e. the TrackParticle will not be complete @@ -70,8 +70,8 @@ namespace Trk @param prd_to_track_map an optional PRD-to-track map to compute shared hits. */ virtual xAOD::TrackParticle* createParticle( const Trk::Track& track, - xAOD::TrackParticleContainer* container=0, - const xAOD::Vertex* vxCandidate = 0, + xAOD::TrackParticleContainer* container=nullptr, + const xAOD::Vertex* vxCandidate = nullptr, xAOD::ParticleHypothesis prtOrigin = xAOD::noHypothesis, const Trk::PRDtoTrackMap *prd_to_track_map = nullptr) const =0; @@ -84,8 +84,8 @@ namespace Trk @param prd_to_track_map an optional PRD-to-track map to compute shared hits. */ virtual xAOD::TrackParticle* createParticle( const ElementLink<TrackCollection>& trackLink, - xAOD::TrackParticleContainer* container=0, - const xAOD::Vertex* vxCandidate = 0, + xAOD::TrackParticleContainer* container=nullptr, + const xAOD::Vertex* vxCandidate = nullptr, xAOD::ParticleHypothesis prtOrigin = xAOD::noHypothesis, const Trk::PRDtoTrackMap *prd_to_track_map = nullptr) const =0; @@ -95,7 +95,7 @@ namespace Trk const std::vector<const Trk::TrackParameters*>& parameters, const std::vector< xAOD::ParameterPosition>& positions, xAOD::ParticleHypothesis prtOrigin = xAOD::noHypothesis, - xAOD::TrackParticleContainer* container = 0 ) const = 0; + xAOD::TrackParticleContainer* container = nullptr ) const = 0; /** Convenience method to retrieve Beamspot Data object -- cache this once per event for optimal performance */ virtual const InDet::BeamSpotData* CacheBeamSpotData(const EventContext &ctx) const =0; diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrkMaterialProviderTool.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrkMaterialProviderTool.h index 1547632ffe288a2297a53a9d95106a23af56bb4b..db53bb4ca5e70cf3b109dd08637e9633f8d29978 100644 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrkMaterialProviderTool.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/ITrkMaterialProviderTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef ITRKMATERIALPROVIDERTOOL_H @@ -36,14 +36,14 @@ namespace Trk { virtual void updateCaloTSOS(Trk::Track& idTrack, Trk::Track& extrapolatedTrack) const = 0; /** Update Calorimeter TSOS from input MS tracks*/ - virtual void updateCaloTSOS(Trk::Track& msTrack, const Trk::TrackParameters* startParamaters=0) const = 0; + virtual void updateCaloTSOS(Trk::Track& msTrack, const Trk::TrackParameters* startParamaters=nullptr) const = 0; /** Get Calorimeter MEOT*/ virtual void getCaloMEOT(const Trk::Track& idTrack, const Trk::Track& msTrack, std::vector<MaterialEffectsOnTrack>& calomeots) const = 0; /** Retrieve Calorimeter TSOS from TG and apply corrections*/ virtual std::vector<const Trk::TrackStateOnSurface*>* - getCaloTSOS (const Trk::TrackParameters& parm, const Trk::Track& muonTrack, const Trk::TrackParameters* parms=0) const = 0; + getCaloTSOS (const Trk::TrackParameters& parm, const Trk::Track& muonTrack, const Trk::TrackParameters* parms=nullptr) const = 0; /** Retrieve a clone of the parametrised energy loss*/ virtual CaloEnergy* getParamCaloELoss(Trk::Track* track) const = 0; diff --git a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IUpdator.h b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IUpdator.h index 7ec82dea1905a9838804527b6a774afd2fddadc2..3ded01052df5c6bf71eab90a8d5fa49289166a4a 100755 --- a/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IUpdator.h +++ b/Tracking/TrkTools/TrkToolInterfaces/TrkToolInterfaces/IUpdator.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ ////////////////////////////////////////////////////////////////// @@ -151,7 +151,7 @@ public: /** let the client tools know how the assumptions on the initial precision for non-measured track parameters are configured */ - virtual const std::vector<double> initialErrors() const = 0; + virtual std::vector<double> initialErrors() const = 0; }; diff --git a/Tracking/TrkTools/TrkTrackFieldIntegralTools/src/FieldIntegralByTrackQueryTool.cxx b/Tracking/TrkTools/TrkTrackFieldIntegralTools/src/FieldIntegralByTrackQueryTool.cxx index b139b244d6a8ce792983f6360060078f64261915..90524a3a00ca1cd111c504b20e1bcbd5d0dd8d8f 100755 --- a/Tracking/TrkTools/TrkTrackFieldIntegralTools/src/FieldIntegralByTrackQueryTool.cxx +++ b/Tracking/TrkTools/TrkTrackFieldIntegralTools/src/FieldIntegralByTrackQueryTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -25,8 +25,8 @@ Trk::FieldIntegralByTrackQueryTool::FieldIntegralByTrackQueryTool(const std::str : AthAlgTool(t,name,poff), m_trackingVolumesSvc("TrackingVolumesSvc/TrackingVolumesSvc",name), - m_indetVolume(0), - m_caloVolume(0) + m_indetVolume(nullptr), + m_caloVolume(nullptr) { declareInterface<ITrackMagneticFieldIntegrator>(this); @@ -95,7 +95,7 @@ double Trk::FieldIntegralByTrackQueryTool::fieldIntegral(const Trk::Track& track bool haveMeasurements = false; Amg::Vector3D integratedMomentumKick = Amg::Vector3D(0.,0.,0.); const Trk::TrackParameters* parameters = track.perigeeParameters(); - if (parameters == NULL) { + if (parameters == nullptr) { ATH_MSG_INFO ("no perigee on track: convention violation or missing code "<< "in this tool. Will bail out..."); return 0.0; @@ -103,18 +103,18 @@ double Trk::FieldIntegralByTrackQueryTool::fieldIntegral(const Trk::Track& track // advance track parameters such that field integration can start in either ID or MS if (takeMS && m_indetVolume->inside(parameters->position()) ) { - parameters = NULL; + parameters = nullptr; // there is no defined state for MS entrance? Instead search a bit on the parameter vector... for (DataVector<const Trk::TrackStateOnSurface>::const_iterator s = track.trackStateOnSurfaces()->begin(); s != track.trackStateOnSurfaces()->end(); ++s) { - if ((**s).trackParameters() == NULL) continue; + if ((**s).trackParameters() == nullptr) continue; if ( !m_caloVolume->inside((**s).trackParameters()->position()) && (**s).type(Trk::TrackStateOnSurface::Measurement) && !(**s).type(Trk::TrackStateOnSurface::Outlier) && - dynamic_cast<const Trk::PseudoMeasurementOnTrack*>((**s).measurementOnTrack())==NULL) break; + dynamic_cast<const Trk::PseudoMeasurementOnTrack*>((**s).measurementOnTrack())==nullptr) break; parameters = (**s).trackParameters(); // gets us the pars before 1st MS meas't } } diff --git a/Tracking/TrkTools/TrkTrackSlimmingTool/src/TrackSlimmingTool.cxx b/Tracking/TrkTools/TrkTrackSlimmingTool/src/TrackSlimmingTool.cxx index 0b216dad577f4bf3b9dab10b927c9732760b1b0d..e60c880542475c49633d8deda6ccb58894c48137 100755 --- a/Tracking/TrkTools/TrkTrackSlimmingTool/src/TrackSlimmingTool.cxx +++ b/Tracking/TrkTools/TrkTrackSlimmingTool/src/TrackSlimmingTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ /////////////////////////////////////////////////////////////////// @@ -137,14 +137,14 @@ Trk::Track* Trk::TrackSlimmingTool::slim(const Trk::Track& track) const } // We only keep TSOS if they either contain a perigee, OR are a measurement - if ((*itTSoS)->measurementOnTrack()==0 && !(*itTSoS)->type(TrackStateOnSurface::Perigee)) continue; + if ((*itTSoS)->measurementOnTrack()==nullptr && !(*itTSoS)->type(TrackStateOnSurface::Perigee)) continue; keepParameter=keepParameters((*itTSoS),firstValidIDTSOS, lastValidIDTSOS,firstValidMSTSOS,lastValidMSTSOS); if (keepParameter) { parameters=(*itTSoS)->trackParameters(); } - if ( (*itTSoS)->measurementOnTrack()!=0 && + if ( (*itTSoS)->measurementOnTrack()!=nullptr && ( (*itTSoS)->type(TrackStateOnSurface::Measurement) || ( m_keepOutliers && (*itTSoS)->type(TrackStateOnSurface::Outlier) ) ) ) { rot=(*itTSoS)->measurementOnTrack(); @@ -204,11 +204,11 @@ std::unique_ptr<Trk::Track> Trk::TrackSlimmingTool::slimCopy(const Trk::Track& t const MaterialEffectsOnTrack* meot = dynamic_cast<const MaterialEffectsOnTrack*>((**itTSoS).materialEffectsOnTrack()); if (meot && meot->energyLoss()){ - trackStates->push_back(new TrackStateOnSurface(0, + trackStates->push_back(new TrackStateOnSurface(nullptr, (**itTSoS).trackParameters()->clone(), - 0, + nullptr, new MaterialEffectsOnTrack(meot->thicknessInX0(), - 0, + nullptr, new EnergyLoss(*meot->energyLoss()), meot->associatedSurface()), (**itTSoS).types())); @@ -222,7 +222,7 @@ std::unique_ptr<Trk::Track> Trk::TrackSlimmingTool::slimCopy(const Trk::Track& t --itTSoS; } // We only keep TSOS if they either contain a perigee, OR are a measurement - if ((*itTSoS)->measurementOnTrack()==0 && !(*itTSoS)->type(TrackStateOnSurface::Perigee)){ + if ((*itTSoS)->measurementOnTrack()==nullptr && !(*itTSoS)->type(TrackStateOnSurface::Perigee)){ continue; } typePattern.reset(); @@ -246,7 +246,7 @@ std::unique_ptr<Trk::Track> Trk::TrackSlimmingTool::slimCopy(const Trk::Track& t Trk::TrackStateOnSurface* newTSOS = nullptr; if (rot!=nullptr || parameters!=nullptr) { - newTSOS = new Trk::TrackStateOnSurface(rot, parameters, 0, 0, typePattern); + newTSOS = new Trk::TrackStateOnSurface(rot, parameters, nullptr, nullptr, typePattern); trackStates->push_back( newTSOS ); } } @@ -264,8 +264,8 @@ std::unique_ptr<Trk::Track> Trk::TrackSlimmingTool::slimCopy(const Trk::Track& t } void Trk::TrackSlimmingTool::checkForValidMeas(const Trk::TrackStateOnSurface* tsos, bool& isIDmeas, bool& isMSmeas) const { - if (tsos->measurementOnTrack()!=0){ - bool isPseudo = (dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(tsos->measurementOnTrack())!=0); + if (tsos->measurementOnTrack()!=nullptr){ + bool isPseudo = (dynamic_cast<const Trk::PseudoMeasurementOnTrack*>(tsos->measurementOnTrack())!=nullptr); // Handle horrible cROTs const Trk::CompetingRIOsOnTrack* cROT = dynamic_cast<const Trk::CompetingRIOsOnTrack*>(tsos->measurementOnTrack()); Identifier id; @@ -275,7 +275,7 @@ void Trk::TrackSlimmingTool::checkForValidMeas(const Trk::TrackStateOnSurface* t id = tsos->measurementOnTrack()->associatedSurface().associatedDetectorElementIdentifier(); } isIDmeas = !isPseudo && m_detID->is_indet(id ); - isMSmeas = tsos->measurementOnTrack()!=0 && !isPseudo && m_detID->is_muon(id ); + isMSmeas = tsos->measurementOnTrack()!=nullptr && !isPseudo && m_detID->is_muon(id ); } } @@ -286,7 +286,7 @@ void Trk::TrackSlimmingTool::findLastValidTSoS(const DataVector<const Trk::Track for ( DataVector<const TrackStateOnSurface>::const_reverse_iterator rItTSoS = oldTrackStates->rbegin(); rItTSoS != oldTrackStates->rend(); ++rItTSoS){ if ( (*rItTSoS)->type(TrackStateOnSurface::Measurement) && - (*rItTSoS)->trackParameters()!=0 && (*rItTSoS)->measurementOnTrack()!=0 && + (*rItTSoS)->trackParameters()!=nullptr && (*rItTSoS)->measurementOnTrack()!=nullptr && !(*rItTSoS)->measurementOnTrack()->type(Trk::MeasurementBaseType::PseudoMeasurementOnTrack)){ if (m_detID->is_indet((*rItTSoS)->trackParameters()->associatedSurface().associatedDetectorElementIdentifier())) { diff --git a/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx b/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx index 846e707cc6abf5c4616fa312b79179e7fe0f9e57..4f06504fd714ec2d3bf5048291eaef9a3f84674f 100755 --- a/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx +++ b/Tracking/TrkTools/TrkTrackSummaryTool/src/TrackSummaryTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkTrackSummaryTool/TrackSummaryTool.h" @@ -268,7 +268,7 @@ Trk::TrackSummaryTool::createSummary( const Track& track, ATH_MSG_DEBUG ("Produce summary for: "<<track.info().dumpInfo()); - if (track.trackStateOnSurfaces()!=0) + if (track.trackStateOnSurfaces()!=nullptr) { information[Trk::numberOfOutliersOnTrack] = 0; processTrackStates(track,prd_to_track_map, track.trackStateOnSurfaces(), information, hitPattern, @@ -343,7 +343,6 @@ void Trk::TrackSummaryTool::updateSharedHitCount(const Track& track, const Trk:: { // first check if track has no summary - then it is recreated m_idTool->updateSharedHitCount(track, prd_to_track_map, summary); - return; } void Trk::TrackSummaryTool::updateAdditionalInfo(const Track& track, const Trk::PRDtoTrackMap *prd_to_track_map, TrackSummary &summary, bool initialise_to_zero) const @@ -388,7 +387,6 @@ void Trk::TrackSummaryTool::updateAdditionalInfo(const Track& track, const Trk:: m_idTool->updateExpectedHitInfo(track, summary); if (m_addInDetDetailedSummary) m_idTool->addDetailedTrackSummary(track,summary); - return; } void Trk::TrackSummaryTool::processTrackStates(const Track& track, @@ -401,9 +399,12 @@ void Trk::TrackSummaryTool::processTrackStates(const Track& track, { ATH_MSG_DEBUG ("Starting to process " << tsos->size() << " track states"); - int measCounter = 0, cntAddChi2 = 0; - float chi2Sum = 0, chi2Sum2 = 0; - DataVector<const TrackStateOnSurface>::const_iterator it = tsos->begin(), itEnd = tsos->end(); + int measCounter = 0; + int cntAddChi2 = 0; + float chi2Sum = 0; + float chi2Sum2 = 0; + DataVector<const TrackStateOnSurface>::const_iterator it = tsos->begin(); + DataVector<const TrackStateOnSurface>::const_iterator itEnd = tsos->end(); for ( ; it!=itEnd; ++it){ if ((*it)->type(Trk::TrackStateOnSurface::Measurement) || (*it)->type(Trk::TrackStateOnSurface::Outlier)){ ++measCounter; @@ -437,7 +438,7 @@ void Trk::TrackSummaryTool::processTrackStates(const Track& track, if ( (*it)->type(Trk::TrackStateOnSurface::Hole) && (*it)->trackParameters() ){ if (!doHolesInDet || !doHolesMuon ){ // no dedicated hole search via extrapolation, but take what might be on the track already. - if ( (*it)->trackParameters()->associatedSurface().associatedDetectorElement()!=0 ) { + if ( (*it)->trackParameters()->associatedSurface().associatedDetectorElement()!=nullptr ) { const Identifier& id = (*it)->trackParameters()->associatedSurface().associatedDetectorElementIdentifier(); if ( !doHolesInDet && m_detID->is_pixel( id ) ) ++information[Trk::numberOfPixelHoles]; if ( !doHolesInDet && m_detID->is_sct( id ) ) ++information[Trk::numberOfSCTHoles]; @@ -450,8 +451,6 @@ void Trk::TrackSummaryTool::processTrackStates(const Track& track, float varChi2 = 0; if (cntAddChi2>0) varChi2=chi2Sum2/cntAddChi2 - (chi2Sum/cntAddChi2) *(chi2Sum/cntAddChi2) ; if (varChi2>0 && varChi2<1.e13) information[Trk::standardDeviationOfChi2OS] = int(sqrt(varChi2)*100); - - return; } void Trk::TrackSummaryTool::processMeasurement(const Track& track, @@ -466,7 +465,7 @@ void Trk::TrackSummaryTool::processMeasurement(const Track& track, if ( rot ){ // have RIO_OnTrack const Trk::IExtendedTrackSummaryHelperTool* tool = getTool(rot->identify()); - if (tool==0){ + if (tool==nullptr){ ATH_MSG_WARNING("Cannot find tool to match ROT. Skipping."); } else { @@ -480,7 +479,7 @@ void Trk::TrackSummaryTool::processMeasurement(const Track& track, // if this works we have a CompetingRIOsOnTrack. rot = &compROT->rioOnTrack(0); // get 1st rot const Trk::IExtendedTrackSummaryHelperTool* tool = getTool(rot->identify()); // Use 'main' ROT to get detector type - if (tool==0){ + if (tool==nullptr){ ATH_MSG_WARNING("Cannot find tool to match cROT. Skipping."); } else { tool->analyse(track,prd_to_track_map, compROT,tsos,information, hitPattern); @@ -507,7 +506,7 @@ Trk::TrackSummaryTool::getTool(const Identifier& id) } else { ATH_MSG_WARNING("getTool: Identifier is of unknown type! id: "<<id.getString()); } - return 0; + return nullptr; } const Trk::IExtendedTrackSummaryHelperTool* @@ -528,7 +527,7 @@ Trk::TrackSummaryTool::getTool(const Identifier& id) const } else { ATH_MSG_WARNING("getTool: Identifier is of unknown type! id: "<<id.getString()); } - return 0; + return nullptr; } void Trk::TrackSummaryTool::searchHolesStepWise( const Trk::Track& track, @@ -539,7 +538,7 @@ void Trk::TrackSummaryTool::searchHolesStepWise( const Trk::Track& track, ATH_MSG_VERBOSE ("Entering Trk::TrackSummaryTool::searchHolesStepWise"); // -------- obtain hits in Pixel and SCT only - if (track.trackStateOnSurfaces()==0) + if (track.trackStateOnSurfaces()==nullptr) { ATH_MSG_DEBUG ("No trackStatesOnSurface!!!!"); information [numberOfPixelHoles] = -1; @@ -596,6 +595,5 @@ void Trk::TrackSummaryTool::searchHolesStepWise( const Trk::Track& track, m_muonTool->searchForHoles(track,information,Trk::muon) ; } } - return; -} + } diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DetailedTrackTruthBuilder.h b/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DetailedTrackTruthBuilder.h index 57a403822bed8fc35fffa617e13633e18cb05245..2f59eec9f4d1863a42961ed5cf6de10085b3cc88 100755 --- a/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DetailedTrackTruthBuilder.h +++ b/Tracking/TrkTools/TrkTruthCreatorTools/TrkTruthCreatorTools/DetailedTrackTruthBuilder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Dear emacs, this is -*-c++-*- @@ -42,7 +42,7 @@ namespace Trk { ToolHandle<Trk::ITruthTrajectoryBuilder> m_truthTrajBuilder; - SubDetHitStatistics::SubDetType findSubDetType(Identifier id) const; + SubDetHitStatistics::SubDetType findSubDetType(const Identifier& id) const; void addTrack(DetailedTrackTruthCollection *output, const ElementLink<DataVector<Trk::Track> > &track, diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx index b6e4a28646ba7355aac7f354d03cd602de016e8d..bf98d4704c9e45c5422b1905a9c790449f270703 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx +++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/DecayInFlyTruthTrajectoryBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Andrei Gaponenko, 2008 @@ -40,7 +40,8 @@ buildTruthTrajectory(TruthTrajectory *result, const HepMC::GenParticle *input) c { result->clear(); if(input) { - const HepMC::GenParticle *next(0), *current = input; + const HepMC::GenParticle *next(nullptr); + const HepMC::GenParticle *current = input; // Extend trajectory outwards. The last particle should go at [0] // in the TruthTrajectory, so we need to use a tmp storage while @@ -70,7 +71,8 @@ buildTruthTrajectory(TruthTrajectory *result, const HepMC::GenParticle *input) c DecayInFlyTruthTrajectoryBuilder::MotherDaughter DecayInFlyTruthTrajectoryBuilder::truthTrajectoryCuts(const HepMC::GenVertex *vtx) const { - const HepMC::GenParticle *mother(0), *daughter(0); + const HepMC::GenParticle *mother(nullptr); + const HepMC::GenParticle *daughter(nullptr); // only truth vertices with 1 incoming particle if(vtx && (vtx->particles_in_size() == 1)) { @@ -90,7 +92,7 @@ DecayInFlyTruthTrajectoryBuilder::truthTrajectoryCuts(const HepMC::GenVertex *vt if (vtx->particles_out_size() <= 2) { int num_passed_cuts = 0; - const HepMC::GenParticle *passed_cuts(0); + const HepMC::GenParticle *passed_cuts(nullptr); for(HepMC::GenVertex::particles_in_const_iterator it = vtx->particles_out_const_begin(); it != vtx->particles_out_const_end(); ++it) { @@ -128,7 +130,7 @@ DecayInFlyTruthTrajectoryBuilder::truthTrajectoryCuts(const HepMC::GenVertex *vt //================================================================ const HepMC::GenParticle* DecayInFlyTruthTrajectoryBuilder::getDaughter(const HepMC::GenParticle* mother) const { - const HepMC::GenParticle *daughter = 0; + const HepMC::GenParticle *daughter = nullptr; if(mother) { @@ -145,7 +147,7 @@ const HepMC::GenParticle* DecayInFlyTruthTrajectoryBuilder::getDaughter(const He //================================================================ const HepMC::GenParticle* DecayInFlyTruthTrajectoryBuilder::getMother(const HepMC::GenParticle* daughter) const { - const HepMC::GenParticle *mother = 0; + const HepMC::GenParticle *mother = nullptr; if(daughter) { diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx index 5f1f849ca381a72ba1b608bb5825f610d804c387..de9afca2ba19a259af696dd1fb8e9d875dda9339 100755 --- a/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx +++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/DetailedTrackTruthBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkTruthCreatorTools/DetailedTrackTruthBuilder.h" @@ -76,7 +76,7 @@ namespace Trk { //================================================================ DetailedTrackTruthBuilder::DetailedTrackTruthBuilder(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type,name,parent) - , m_idHelper(0) + , m_idHelper(nullptr) , m_truthTrajBuilder("Trk::ElasticTruthTrajectoryBuilder") { declareInterface<IDetailedTrackTruthBuilder>(this); @@ -180,7 +180,7 @@ buildDetailedTrackTruth(DetailedTrackTruthCollection *output, // (no way to reuse its private function PrepRawDataCollectionType() ) SubDetHitStatistics::SubDetType -DetailedTrackTruthBuilder::findSubDetType(Identifier id) const { +DetailedTrackTruthBuilder::findSubDetType(const Identifier& id) const { if (m_idHelper->is_pixel(id)) return SubDetHitStatistics::Pixel; if (m_idHelper->is_sct(id)) @@ -272,7 +272,8 @@ void DetailedTrackTruthBuilder::addTrack(DetailedTrackTruthCollection *output, if (n == 0) { ATH_MSG_VERBOSE("--> no link, noise ? PRD-ID:"<<id<<" subdet:"<<subdet); // add barcode 0 to pairs, we like to keep track of fake fakes - unsigned int BC(0),EV(0); + unsigned int BC(0); + unsigned int EV(0); pairStat[HepMcParticleLink(BC,EV)].subDetHits[subdet].insert(id); } } // orderedPRD_Truth[] available @@ -420,7 +421,7 @@ void DetailedTrackTruthBuilder::makeTruthToRecMap( PRD_InverseTruth& result, con // to allow lookup of all Identifiers produced by a given HepMcParticleLink. // the result is only used in countPRDsOnTruth. since that code ignores // geantinos, don't bother to sort the geantinos here. - for( auto i : rec2truth ) { + for( const auto& i : rec2truth ) { // i.first = Identifier // i.second = HepMcParticleLink const HepMC::GenParticle* pa = i.second.cptr(); diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/ElasticTruthTrajectoryBuilder.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/ElasticTruthTrajectoryBuilder.cxx index fa801a318d9d1d79421a77d6109e1b20d10546a0..ff1b382a17c046027e543827cc21dd342253c4bf 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/src/ElasticTruthTrajectoryBuilder.cxx +++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/ElasticTruthTrajectoryBuilder.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // Andrei Gaponenko, 2008 @@ -40,7 +40,8 @@ buildTruthTrajectory(TruthTrajectory *result, const HepMC::GenParticle *input) c { result->clear(); if(input) { - const HepMC::GenParticle *next(0), *current = input; + const HepMC::GenParticle *next(nullptr); + const HepMC::GenParticle *current = input; // Extend trajectory outwards. The last particle should go at [0] // in the TruthTrajectory, so we need to use a tmp storage while @@ -70,7 +71,8 @@ buildTruthTrajectory(TruthTrajectory *result, const HepMC::GenParticle *input) c ElasticTruthTrajectoryBuilder::MotherDaughter ElasticTruthTrajectoryBuilder::truthTrajectoryCuts(const HepMC::GenVertex *vtx) const { - const HepMC::GenParticle *mother(0), *daughter(0); + const HepMC::GenParticle *mother(nullptr); + const HepMC::GenParticle *daughter(nullptr); // only truth vertices with 1 incoming particle if(vtx && (vtx->particles_in_size() == 1)) { @@ -90,7 +92,7 @@ ElasticTruthTrajectoryBuilder::MotherDaughter if (vtx->particles_out_size() <= 2) { int num_passed_cuts = 0; - const HepMC::GenParticle *passed_cuts(0); + const HepMC::GenParticle *passed_cuts(nullptr); for(HepMC::GenVertex::particles_in_const_iterator it = vtx->particles_out_const_begin(); it != vtx->particles_out_const_end(); ++it) { @@ -122,7 +124,7 @@ ElasticTruthTrajectoryBuilder::MotherDaughter //================================================================ const HepMC::GenParticle* ElasticTruthTrajectoryBuilder::getDaughter(const HepMC::GenParticle* mother) const { - const HepMC::GenParticle *daughter = 0; + const HepMC::GenParticle *daughter = nullptr; if(mother) { @@ -139,7 +141,7 @@ const HepMC::GenParticle* ElasticTruthTrajectoryBuilder::getDaughter(const HepMC //================================================================ const HepMC::GenParticle* ElasticTruthTrajectoryBuilder::getMother(const HepMC::GenParticle* daughter) const { - const HepMC::GenParticle *mother = 0; + const HepMC::GenParticle *mother = nullptr; if(daughter) { diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/TruthMatchRatio.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/TruthMatchRatio.cxx index 67fc6812792ee7034e5cea7c633b231f12005bc8..bff23b52078108c6251a365a9a3aea70b3b5eeb0 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/src/TruthMatchRatio.cxx +++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/TruthMatchRatio.cxx @@ -18,7 +18,8 @@ TruthMatchRatio::TruthMatchRatio(const std::string& type, const std::string& nam //================================================================ double TruthMatchRatio::trackTruthSimilarity(const DetailedTrackTruth& dt) const { - double prd_track=0, prd_common=0; + double prd_track=0; + double prd_common=0; for(unsigned i=0; i<SubDetHitStatistics::NUM_SUBDETECTORS; i++) { prd_common += m_subDetWeights[i] * dt.statsCommon()[SubDetHitStatistics::SubDetType(i)]; prd_track += m_subDetWeights[i] * dt.statsTrack()[SubDetHitStatistics::SubDetType(i)]; diff --git a/Tracking/TrkTools/TrkTruthCreatorTools/src/TruthMatchTanimoto.cxx b/Tracking/TrkTools/TrkTruthCreatorTools/src/TruthMatchTanimoto.cxx index 9677e6ba946ec6fed791bb73dd30ba024f279a1f..2b3e1f1aab55ef2972b8401b0d44b3d4e523e09d 100644 --- a/Tracking/TrkTools/TrkTruthCreatorTools/src/TruthMatchTanimoto.cxx +++ b/Tracking/TrkTools/TrkTruthCreatorTools/src/TruthMatchTanimoto.cxx @@ -18,7 +18,9 @@ TruthMatchTanimoto::TruthMatchTanimoto(const std::string& type, const std::strin //================================================================ double TruthMatchTanimoto::trackTruthSimilarity(const DetailedTrackTruth& dt) const { - double prd_truth=0, prd_track=0, prd_common=0; + double prd_truth=0; + double prd_track=0; + double prd_common=0; for(unsigned i=0; i<SubDetHitStatistics::NUM_SUBDETECTORS; i++) { prd_common += m_subDetWeights[i] * dt.statsCommon()[SubDetHitStatistics::SubDetType(i)]; prd_track += m_subDetWeights[i] * dt.statsTrack()[SubDetHitStatistics::SubDetType(i)]; diff --git a/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthTrackRecordToTrack.h b/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthTrackRecordToTrack.h index 59090b926c722b225f6a9f4bb4dfa4a5cce01504..d5ee8457ed042d307409c3f8a4661711c6268871 100755 --- a/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthTrackRecordToTrack.h +++ b/Tracking/TrkTools/TrkTruthToTrack/TrkTruthToTrack/TruthTrackRecordToTrack.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRUTHRECORDTOTRACK_H @@ -69,8 +69,8 @@ namespace Trk { /** Forbid copying of Truth...ToTrack to not mess with the internal pointers. */ - TruthTrackRecordToTrack(const TruthTrackRecordToTrack&); - TruthTrackRecordToTrack& operator=(const TruthTrackRecordToTrack&); + TruthTrackRecordToTrack(const TruthTrackRecordToTrack&) = delete; + TruthTrackRecordToTrack& operator=(const TruthTrackRecordToTrack&) = delete; }; } diff --git a/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx b/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx index a4058aaa5d63c973c012b7af90d6dc313d134d4f..098416438bf7e58d60c48f6101a6b1359b2588df 100755 --- a/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx +++ b/Tracking/TrkTools/TrkTruthToTrack/src/TruthToTrack.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #define TRUTHTOTRACK_IMP @@ -30,7 +30,7 @@ //================================================================ Trk::TruthToTrack::TruthToTrack(const std::string& type, const std::string& name, const IInterface* parent) : ::AthAlgTool(type,name,parent) - , m_particleDataTable(0) + , m_particleDataTable(nullptr) , m_extrapolator("Trk::Extrapolator/AtlasExtrapolator") { declareInterface<ITruthToTrack>(this); @@ -40,7 +40,7 @@ Trk::TruthToTrack::TruthToTrack(const std::string& type, const std::string& name //================================================================ StatusCode Trk::TruthToTrack::initialize() { // get the Particle Properties Service - IPartPropSvc* partPropSvc = 0; + IPartPropSvc* partPropSvc = nullptr; StatusCode sc = service("PartPropSvc", partPropSvc, true); if (sc.isFailure()) { ATH_MSG_ERROR("Could not initialize Particle Properties Service"); @@ -62,16 +62,16 @@ StatusCode Trk::TruthToTrack::initialize() { //================================================================ const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(const HepMC::GenParticle* part) const { - Trk::TrackParameters *result = 0; + Trk::TrackParameters *result = nullptr; if(part && part->production_vertex() && m_particleDataTable) { HepMC::ThreeVector tv = part->production_vertex()->point3d(); Amg::Vector3D hv(tv.x(),tv.y(),tv.z()); - Amg::Vector3D globalPos = hv; + const Amg::Vector3D& globalPos = hv; - HepMC::FourVector fv = part->momentum(); + const HepMC::FourVector& fv = part->momentum(); Amg::Vector3D hv2(fv.px(),fv.py(),fv.pz()); - Amg::Vector3D globalMom = hv2; + const Amg::Vector3D& globalMom = hv2; int id = part->pdg_id(); // the table seems to lack antiparticles, thus the use of abs() @@ -97,14 +97,14 @@ const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(const He //================================================================ const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(const xAOD::TruthParticle* part) const { - Trk::TrackParameters *result = 0; + Trk::TrackParameters *result = nullptr; if(part && part->hasProdVtx() && m_particleDataTable) { Amg::Vector3D hv(part->prodVtx()->x(),part->prodVtx()->y(),part->prodVtx()->z()); - Amg::Vector3D globalPos = hv; + const Amg::Vector3D& globalPos = hv; Amg::Vector3D hv2(part->p4().Px(),part->p4().Py(),part->p4().Pz()); - Amg::Vector3D globalMom = hv2; + const Amg::Vector3D& globalMom = hv2; int id = part->pdgId(); // the table seems to lack antiparticles, thus the use of abs() @@ -131,11 +131,11 @@ const Trk::TrackParameters* Trk::TruthToTrack::makeProdVertexParameters(const xA //================================================================ const Trk::TrackParameters* Trk::TruthToTrack::makePerigeeParameters(const HepMC::GenParticle* part) const { - const Trk::TrackParameters* generatedTrackPerigee = 0; + const Trk::TrackParameters* generatedTrackPerigee = nullptr; if(part && part->production_vertex() && m_particleDataTable && m_extrapolator) { - std::auto_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) ); + std::unique_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) ); if(productionVertexTrackParams.get()) { // Extrapolate the TrackParameters object to the perigee. Direct extrapolation, @@ -155,11 +155,11 @@ const Trk::TrackParameters* Trk::TruthToTrack::makePerigeeParameters(const HepMC //================================================================ const Trk::TrackParameters* Trk::TruthToTrack::makePerigeeParameters(const xAOD::TruthParticle* part) const { - const Trk::TrackParameters* generatedTrackPerigee = 0; + const Trk::TrackParameters* generatedTrackPerigee = nullptr; if(part && part->hasProdVtx() && m_particleDataTable && m_extrapolator) { - std::auto_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) ); + std::unique_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) ); if(productionVertexTrackParams.get()) { // Extrapolate the TrackParameters object to the perigee. Direct extrapolation, diff --git a/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx b/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx index 6ee4eeb61a98588789f638ab5d1d5345ef03ebe0..cbd2ff666a3cd7a987660376a8f7a1091dae63e0 100755 --- a/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx +++ b/Tracking/TrkTools/TrkTruthToTrack/src/TruthTrackRecordToTrack.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "TrkTruthToTrack/TruthTrackRecordToTrack.h" @@ -31,7 +31,7 @@ Trk::TruthTrackRecordToTrack::TruthTrackRecordToTrack(const std::string& type, const std::string& name, const IInterface* parent) : AthAlgTool(type,name,parent), - m_particleDataTable(0), + m_particleDataTable(nullptr), m_extrapolator("Trk::Extrapolator/AtlasExtrapolator") { declareInterface<ITruthToTrack>(this); @@ -44,7 +44,7 @@ Trk::TruthTrackRecordToTrack::TruthTrackRecordToTrack(const std::string& type, c StatusCode Trk::TruthTrackRecordToTrack::initialize() { // get the Particle Properties Service - IPartPropSvc* partPropSvc = 0; + IPartPropSvc* partPropSvc = nullptr; StatusCode sc = service("PartPropSvc", partPropSvc, true); if (sc.isFailure()) { ATH_MSG_ERROR ("Could not initialize Particle Properties Service"); @@ -67,15 +67,15 @@ StatusCode Trk::TruthTrackRecordToTrack::initialize() { //================================================================ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParameters(const HepMC::GenParticle* part) const { - if (part == NULL || m_particleDataTable==NULL) return 0; + if (part == nullptr || m_particleDataTable==nullptr) return nullptr; - Trk::TrackParameters *result = 0; + Trk::TrackParameters *result = nullptr; Amg::Vector3D prodVertexVector; Amg::Vector3D globalPos; Amg::Vector3D globalMom; int id=0; double charge = 0.0; - const HepPDT::ParticleData* pd = 0; + const HepPDT::ParticleData* pd = nullptr; /* // -- backup: get the genparticle prod vertex if(part->production_vertex()) { @@ -97,11 +97,11 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete if (recordCollection.isValid()) { ATH_MSG_ERROR ("Could not get track record!"); - return 0; + return nullptr; } ATH_MSG_DEBUG("reading from track record, size=" << recordCollection->size()); - if (recordCollection->size() == 0) ATH_MSG_WARNING ("action required but record size is 0"); + if (recordCollection->empty()) ATH_MSG_WARNING ("action required but record size is 0"); for (TrackRecordCollection::const_iterator record = recordCollection->begin(); record != recordCollection->end();++record){ @@ -153,26 +153,26 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete //================================================================ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParameters(const xAOD::TruthParticle* part) const { - if (part == NULL || m_particleDataTable==NULL) return 0; + if (part == nullptr || m_particleDataTable==nullptr) return nullptr; - Trk::TrackParameters *result = 0; + Trk::TrackParameters *result = nullptr; Amg::Vector3D prodVertexVector; Amg::Vector3D globalPos; Amg::Vector3D globalMom; int id=0; double charge = 0.0; - const HepPDT::ParticleData* pd = 0; + const HepPDT::ParticleData* pd = nullptr; SG::ReadHandle<TrackRecordCollection> recordCollection(m_reccollkey); if (recordCollection.isValid()) { ATH_MSG_ERROR ("Could not get track record!"); - return 0; + return nullptr; } ATH_MSG_DEBUG("reading from track record, size=" << recordCollection->size()); - if (recordCollection->size() == 0) ATH_MSG_WARNING ("action required but record size is 0"); + if (recordCollection->empty()) ATH_MSG_WARNING ("action required but record size is 0"); for (TrackRecordCollection::const_iterator record = recordCollection->begin(); record != recordCollection->end();++record){ @@ -223,13 +223,13 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makeProdVertexParamete //================================================================ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makePerigeeParameters(const HepMC::GenParticle* part) const { - const Trk::TrackParameters* generatedTrackPerigee = 0; + const Trk::TrackParameters* generatedTrackPerigee = nullptr; if(part && part->production_vertex() && m_particleDataTable && m_extrapolator) { MsgStream log(msgSvc(), name()); - std::auto_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) ); + std::unique_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) ); if(productionVertexTrackParams.get()) { // Extrapolate the TrackParameters object to the perigee. Direct extrapolation, @@ -247,13 +247,13 @@ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makePerigeeParameters( //================================================================ const Trk::TrackParameters* Trk::TruthTrackRecordToTrack::makePerigeeParameters(const xAOD::TruthParticle* part) const { - const Trk::TrackParameters* generatedTrackPerigee = 0; + const Trk::TrackParameters* generatedTrackPerigee = nullptr; if(part && part->hasProdVtx() && m_particleDataTable && m_extrapolator) { MsgStream log(msgSvc(), name()); - std::auto_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) ); + std::unique_ptr<const Trk::TrackParameters> productionVertexTrackParams( makeProdVertexParameters(part) ); if(productionVertexTrackParams.get()) { // Extrapolate the TrackParameters object to the perigee. Direct extrapolation, diff --git a/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveMultiVertexFitter.cxx b/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveMultiVertexFitter.cxx index 8555c345384e923223b1bf50a9ca2bae16653f43..6b25f6024ea29b44a1118d67a91783452d5a49e4 100755 --- a/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveMultiVertexFitter.cxx +++ b/Tracking/TrkVertexFitter/TrkVertexFitters/src/AdaptiveMultiVertexFitter.cxx @@ -397,7 +397,7 @@ namespace Trk if (num_steps>=m_maxIterations) { - msg(MSG::WARNING) << "Didn't converge fully after " << num_steps << endmsg; + msg(MSG::DEBUG) << "Didn't converge fully after " << num_steps << endmsg; } msg(MSG::VERBOSE) << "In principle the big multivertex fit step is finished now..." << endmsg; diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/FullCaloCellContMaker.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/FullCaloCellContMaker.cxx index 21c9912bdff1566f7f89a23f355f5dd2f2d3545d..2d63792add36e00b28249703ac5707804ad85204 100755 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/FullCaloCellContMaker.cxx +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/FullCaloCellContMaker.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -197,13 +197,6 @@ StatusCode FullCaloCellContMaker::addFullLArCells(CaloCellContainer& pCaloCellCo // noise suppression if(m_do_LArCells_noise_suppression!=0){ - //const CaloDetDescrManager* m_CaloDetDescrManager = CaloDetDescrManager::instance(); - //if ( m_CaloDetDescrManager == 0 ) - // { - //std::cout << "ERROR : cannot allocate CaloDetDescrManager" - // << endmsg; -// return StatusCode::FAILURE; - // } for(m_it = m_iBegin;m_it != m_iEnd; ++m_it) { // Main Loop //const CaloDetDescrElement* caloDDE = (*m_it)->caloDDE(); diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/RoIFCalEmCellContMaker.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/RoIFCalEmCellContMaker.cxx index ddaaca1c5903f9382733444f857046a12e78c056..5bfc91407f132fecf358ff1f5bd430c07e3d6984 100644 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/RoIFCalEmCellContMaker.cxx +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/RoIFCalEmCellContMaker.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -126,10 +126,6 @@ StatusCode RoIFCalEmCellContMaker::execute(CaloCellContainer &pCaloCellContainer if (m_do_LArCells_noise_suppression!=0){ - //const CaloDetDescrManager* m_CaloDetDescrManager = CaloDetDescrManager::instance(); - //if ( m_CaloDetDescrManager == 0 ) { - // return StatusCode::FAILURE; - //} for(it = m_iBegin;it != m_iEnd; ++it) { //const CaloDetDescrElement* caloDDE = (*it)->caloDDE(); diff --git a/Trigger/TrigAlgorithms/TrigCaloRec/src/RoIFCalHadCellContMaker.cxx b/Trigger/TrigAlgorithms/TrigCaloRec/src/RoIFCalHadCellContMaker.cxx index cd016d670e8a847062c36ba94fd2e89fb0e8d214..f9af4f1a67251647a1c45d24b84bdad03bea0367 100644 --- a/Trigger/TrigAlgorithms/TrigCaloRec/src/RoIFCalHadCellContMaker.cxx +++ b/Trigger/TrigAlgorithms/TrigCaloRec/src/RoIFCalHadCellContMaker.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // ******************************************************************** @@ -120,10 +120,6 @@ StatusCode RoIFCalHadCellContMaker::execute(CaloCellContainer &pCaloCellContaine if (m_do_LArCells_noise_suppression!=0){ - //const CaloDetDescrManager* m_CaloDetDescrManager = CaloDetDescrManager::instance(); - //if ( m_CaloDetDescrManager == 0 ) { - // return StatusCode::FAILURE; - //} for(it = m_iBegin;it != m_iEnd; ++it) { //const CaloDetDescrElement* caloDDE = (*it)->caloDDE(); diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt b/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt index 8e8d884dbd095d60000790b864c34812656022c5..7af6a493ee1f1565b5cb85d5a0b840bbb4f440eb 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( Event/xAOD/xAODCaloEvent Event/xAOD/xAODJet Event/xAOD/xAODTrigMissingET + Event/xAOD/xAODPFlow Event/FourMomUtils GaudiKernel LArCalorimeter/LArIdentifier @@ -82,6 +83,7 @@ atlas_add_component( TrigEFMissingET src/CellFex.cxx src/MHTFex.cxx src/TCFex.cxx + src/PFSumFex.cxx src/TCPufitFex.cxx src/components/TrigEFMissingET_entries.cxx src/components/TrigEFMissingET_load.cxx @@ -90,7 +92,7 @@ atlas_add_component( TrigEFMissingET TrigEFMissingETLib AthenaBaseComps CaloDetDescrLib CaloEvent CaloGeoHelpers CaloIdentifier CxxUtils EventKernel GaudiKernel Identifier - JetEvent LArIdentifier PathResolver JetEDM + JetEvent LArIdentifier PathResolver JetEDM xAODPFlow TrigCaloEvent TrigInterfacesLib TrigMissingEtEvent TrigMuonEvent TrigParticle TrigSteeringEvent TrigT1Interfaces TrigT2CaloCommonLib TrigTimeAlgsLib xAODCaloEvent xAODEventInfo xAODJet xAODTrigMissingET diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/doc/pufit.md b/Trigger/TrigAlgorithms/TrigEFMissingET/doc/pufit.md index dfd9aafc465ab6681b178434d183072de9b95fb9..24de9b75d3d45ffd954c5ef654e2fe66d14615e5 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/doc/pufit.md +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/doc/pufit.md @@ -95,15 +95,15 @@ yields and therefore ```math - 0 = s{\mathbf{\Phi}_j}^\mathrm{T}{V_\mu}^{-1}(\mathbf{E_T}_\mu + \mathbf{\Phi}_k\mathcal{E}_k) + \delta_{jk}\mathcal{E}_k - {\langle E_T \rangle}_\mathrm{tower} \\ - 0 = (s{\mathbf{\Phi}_j}^\mathrm{T}{V_\mu}^{-1}\mathbf{\Phi}_k + \delta_{jk})\mathcal{E}_k + s{\mathbf{\Phi}_j}^\mathrm{T}{V_\mu}^{-1}\mathbf{E_T}_\mu - {\langle E_T \rangle}_\mathrm{tower}. + 0 = s{\mathbf{\Phi}_j}^\mathrm{T}{V_\mu}^{-1}(\mathbf{E_T}_\mu + \mathbf{\Phi}_k\mathcal{E}_k) + \frac{\delta_{jk}\mathcal{E}_k}{V_\mathrm{tower}} - \frac{{\langle E_T \rangle}_\mathrm{tower}}{V_\mathrm{tower}} \\ + 0 = (s{\mathbf{\Phi}_j}^\mathrm{T}{V_\mu}^{-1}\mathbf{\Phi}_k + \frac{\delta_{jk}}{V_\mathrm{tower}})\mathcal{E}_k + s{\mathbf{\Phi}_j}^\mathrm{T}{V_\mu}^{-1}\mathbf{E_T}_\mu - \frac{{\langle E_T \rangle}_\mathrm{tower}}{V_{tower}}. ``` The minimisation solution can therefore be written as the matrix equation ```math X_{ij}\mathcal{E}_j = c_i \\ - X_{ij} = s{\mathbf{\Phi}_i}^\mathrm{T}{V_\mu}^{-1}\mathbf{\Phi}_j + \delta_{ij} \\ - c_i = {\langle E_T \rangle}_\mathrm{tower} - s{\mathbf{\Phi}_j}^\mathrm{T}{V_\mu}^{-1}\mathbf{E_T}_\mu \\ + X_{ij} = s{\mathbf{\Phi}_i}^\mathrm{T}{V_\mu}^{-1}\mathbf{\Phi}_j + \frac{\delta_{ij}}{V_\mathrm{tower}} \\ + c_i = \frac{{\langle E_T \rangle}_\mathrm{tower}}{V_\mathrm{tower}} - s{\mathbf{\Phi}_j}^\mathrm{T}{V_\mu}^{-1}\mathbf{E_T}_\mu \\ \mathcal{E}_j = X_{ij}^{-1} c_{i} ``` These corrections can then be applied to the original hard-scatter objects diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/PFSumFex.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/PFSumFex.cxx new file mode 100644 index 0000000000000000000000000000000000000000..d884b86edb6a8ebdecf6eabae5a31d611dfb7d7a --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/PFSumFex.cxx @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + */ + +/****************************************************************************** + * @package Trigger/TrigAlgorithms/TrigEFMissingET + * @file PFSumFex.cxx + * + * Implementation of the PFlow fex class + * @author Jon Burr + *****************************************************************************/ + +#include "PFSumFex.h" +#include "TrigEFMissingET/METComponent.h" +#include <array> + +namespace HLT { namespace MET { + + PFSumFex::PFSumFex(const std::string& name, ISvcLocator* pSvcLocator) : + FexBase(name, pSvcLocator) + {} + + StatusCode PFSumFex::initialize() + { + CHECK( m_neutralPFOKey.initialize() ); + CHECK( m_chargedPFOKey.initialize() ); + return initializeBase({"NeutralPFOs", "ChargedHSPFOs", "ChargedPUPFOs"}); + } + + StatusCode PFSumFex::fillMET( + xAOD::TrigMissingET& met, + const EventContext& context, + MonGroupBuilder&) const + { + auto charged = SG::makeHandle(m_chargedPFOKey, context); + auto neutral = SG::makeHandle(m_neutralPFOKey, context); + + std::array<METComponent, 3> pfoSums; + for (const xAOD::PFO* ipfo : *neutral) + // 0 is the 'NeutralPFOs' component + pfoSums.at(0) += *ipfo; + const static SG::AuxElement::ConstAccessor<char> PVMatchedAcc("matchedToPV"); + for (const xAOD::PFO* ipfo : *charged) + // 1 is the 'ChargedHSPFOs' component, 2 is the 'ChargedPUPFOs' component + (PVMatchedAcc(*ipfo) ? pfoSums.at(1) : pfoSums.at(2) ) += *ipfo; + + // Sum together the components + METComponent total = pfoSums.at(0) + pfoSums.at(1); + if (!m_chargedOnlyFromPV) + total += pfoSums.at(2); + total.fillMET(met); + for (std::size_t ii = 0; ii < 3; ++ii) + pfoSums.at(ii).fillMETComponent(ii, met); + return StatusCode::SUCCESS; + } +} } //> end namespace HLT::MET diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/PFSumFex.h b/Trigger/TrigAlgorithms/TrigEFMissingET/src/PFSumFex.h new file mode 100644 index 0000000000000000000000000000000000000000..abaf8efec21b42ebf9a4dfe21267829ed7d066c5 --- /dev/null +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/PFSumFex.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration + */ + +/****************************************************************************** + * @package Trigger/TrigAlgorithms/TrigEFMissingET + * @class PFSumFex + * + * @brief Fex class for the basic PFlow algorithm + * @author Jon Burr + *****************************************************************************/ + +#ifndef TRIGEFMISSINGET_PFSUMFEX_H +#define TRIGEFMISSINGET_PFSUMFEX_H + +#include "FexBase.h" +#include "xAODPFlow/PFOContainer.h" + +namespace HLT { namespace MET { + /**************************************************************************** + * @class PFSumFex + * + * Class to create output from the PFlow algorithm + * + * tc calculates the MET with a sum over trigger-level PFOs. + ***************************************************************************/ + class PFSumFex : public FexBase + { + public: + /// Constructor + PFSumFex(const std::string& name, ISvcLocator* pSvcLocator); + + /// Initialize the fex + virtual StatusCode initialize() override; + + private: + /************************************************************************ + * Properties + ***********************************************************************/ + /// Input neutral PFOs + SG::ReadHandleKey<xAOD::PFOContainer> m_neutralPFOKey{ + this, "NeutralPFOName", "neutralPFOs", "Input neutral PFO collection"}; + /// Input charged PFOs + SG::ReadHandleKey<xAOD::PFOContainer> m_chargedPFOKey{ + this, "ChargedPFOName", "chargedPFOs", "Input charged PFO collection"}; + /// Whether to only include charged PFOs that are matched to the PV vertex + Gaudi::Property<bool> m_chargedOnlyFromPV{ + this, "ChargedOnlyFromPV", true, "Only use charged PFOs from the PV"}; + + /************************************************************************ + * Internal functions + ***********************************************************************/ + /** + * @brief Calculate and fill the output MET value + * @param met The object to fill + * @param context The event context + * @param monitors[out] Any extra monitors to fill + */ + virtual StatusCode fillMET( + xAOD::TrigMissingET& met, + const EventContext& context, + MonGroupBuilder& monitors) const override; + }; //> end class PFSumFex +} } //> end namespace HLT::MET + +#endif //> !TRIGEFMISSINGET_PFSUMFEX_H diff --git a/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_entries.cxx b/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_entries.cxx index 6e9969a757b4b270b4610d2a90bb7289ee469090..96a1ea112c8c506c3d8f2fab5b92ebd1036d1c43 100644 --- a/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_entries.cxx +++ b/Trigger/TrigAlgorithms/TrigEFMissingET/src/components/TrigEFMissingET_entries.cxx @@ -17,6 +17,7 @@ #include "../MHTFex.h" #include "../TCFex.h" #include "../TCPufitFex.h" +#include "../PFSumFex.h" DECLARE_COMPONENT( EFMissingET ) DECLARE_COMPONENT( EFMissingETBaseTool ) @@ -36,3 +37,4 @@ DECLARE_COMPONENT( HLT::MET::CellFex ) DECLARE_COMPONENT( HLT::MET::MHTFex ) DECLARE_COMPONENT( HLT::MET::TCFex ) DECLARE_COMPONENT( HLT::MET::TCPufitFex ) +DECLARE_COMPONENT( HLT::MET::PFSumFex ) diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py b/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py index ce15acea18e54feda1da3e5341119090cd462882..91fd431f7f5569ec52c1981bf116c3f6e515e515 100644 --- a/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py +++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/python/TrigHLTJetRecConfig.py @@ -810,6 +810,12 @@ def _getJetTrimmerTool2 (merge_param, make heavy use of dynamic stores, so all modifiers other than calibration are currently disabled.""" + # Output collection name isn't needed here since only calibration modifiers + # are used, but the function below requires one even if it won't be used. + # No need for a nicer solution since this whole config should be deprecated + # and phased out by 2021. + output = "DummyCollectionName" + # declare jtm as global as this function body may modify it # with the += operator @@ -877,6 +883,7 @@ def _getJetTrimmerTool2 (merge_param, try: # Ask the jtm to creat and register the trimmer jetTrimmerTool = jtm.addTriggerJetTrimmer( + output, name, rclus, ptfrac, diff --git a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTJetDSSelector.cxx b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTJetDSSelector.cxx index 2a5522432ff50465ef418a8990d7f213db12d325..1aea01b3acd588d736bc59137d9565a62a6aa6d7 100644 --- a/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTJetDSSelector.cxx +++ b/Trigger/TrigAlgorithms/TrigHLTJetRec/src/TrigHLTJetDSSelector.cxx @@ -17,7 +17,7 @@ ///Helpers //this function also exists in TrigEFJetHypo.cxx -struct DescendingEt:std::binary_function<const xAOD::Jet*, const xAOD::Jet*, bool> { +struct DescendingEt{ bool operator()(const xAOD::Jet* l, const xAOD::Jet* r) const { return l->p4().Et() > r->p4().Et(); diff --git a/Trigger/TrigAlgorithms/TrigL2LongLivedParticles/src/TrigBHremoval.cxx b/Trigger/TrigAlgorithms/TrigL2LongLivedParticles/src/TrigBHremoval.cxx index 290a9bf79fe13c9096c5881e6ccdbd5a37d95179..542d3df3503fef3e5a5e5b8b6b4d7922023184df 100755 --- a/Trigger/TrigAlgorithms/TrigL2LongLivedParticles/src/TrigBHremoval.cxx +++ b/Trigger/TrigAlgorithms/TrigL2LongLivedParticles/src/TrigBHremoval.cxx @@ -24,7 +24,7 @@ //** ----------------------------------------------------------------------------------------------------------------- **// -struct DescendingEt:std::binary_function<const xAOD::Jet*, const xAOD::Jet*, bool> { +struct DescendingEt { bool operator()(const xAOD::Jet* l, const xAOD::Jet* r) const { return l->p4().Et() > r->p4().Et(); } diff --git a/Trigger/TrigAlgorithms/TrigL2LongLivedParticles/src/TrigJetSplitter.cxx b/Trigger/TrigAlgorithms/TrigL2LongLivedParticles/src/TrigJetSplitter.cxx index 2ac5db57d9172515ffd2af103d4352c8f1537a9a..275db04d23dcae21f118194cc6c47e58ac53f272 100755 --- a/Trigger/TrigAlgorithms/TrigL2LongLivedParticles/src/TrigJetSplitter.cxx +++ b/Trigger/TrigAlgorithms/TrigL2LongLivedParticles/src/TrigJetSplitter.cxx @@ -24,7 +24,7 @@ //** ----------------------------------------------------------------------------------------------------------------- **// -struct DescendingEt:std::binary_function<const xAOD::Jet*, const xAOD::Jet*, bool> { +struct DescendingEt{ bool operator()(const xAOD::Jet* l, const xAOD::Jet* r) const { return l->p4().Et() > r->p4().Et(); } diff --git a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx index 05e35cce2fb18587f5c4f4f017f4fbf176a0f6b1..bbcfff28451bb0d6ee2783b25619fedd16919439 100644 --- a/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx +++ b/Trigger/TrigAlgorithms/TrigMuonEF/src/TrigMuonEFStandaloneTrackTool.cxx @@ -2540,7 +2540,7 @@ int TrigMuonEFStandaloneTrackTool::segmentMonitoring(const std::vector< const Mu }//if FitQuality() valid int nMdt = 0; int nCsc = 0; int nRpc = 0; int nTgc = 0; for(unsigned int irio=0; irio < (*segment)->numberOfContainedROTs(); ++irio) { - + Trk::RIO_OnTrack* rio = const_cast<Trk::RIO_OnTrack*> ((*segment)->rioOnTrack(irio)); if(!rio) continue; Identifier rioId = rio->identify(); diff --git a/Trigger/TrigAlgorithms/TrigT2BeamSpot/src/T2Vertex.cxx b/Trigger/TrigAlgorithms/TrigT2BeamSpot/src/T2Vertex.cxx index 8256fec4f0c98737f7d753c51a07280f9390666c..059cb9f72e4d01e61e36369a39896d618bc9b6d9 100644 --- a/Trigger/TrigAlgorithms/TrigT2BeamSpot/src/T2Vertex.cxx +++ b/Trigger/TrigAlgorithms/TrigT2BeamSpot/src/T2Vertex.cxx @@ -20,7 +20,6 @@ #include <cmath> using Gaudi::Units::GeV; using std::unary_function; -using std::binary_function; using std::accumulate; @@ -48,7 +47,7 @@ namespace PESA } template <class T> - struct TrkSumOf : public binary_function< double, Trk::Track, double > + struct TrkSumOf { double operator()( double x, const Trk::Track* track ) { return x + T()( track ); } }; diff --git a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py index ed66bdd43a62aba4a5dcb443c4cc1d231b34cd09..b9929ca697df573739f685efdea973ace1789978 100644 --- a/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py +++ b/Trigger/TrigAlgorithms/TrigTauRec/python/TrigTauAlgorithmsHolder.py @@ -338,13 +338,9 @@ def getTauVertexVariables(): from tauRecTools.tauRecToolsConf import TauVertexVariables TauVertexVariables = TauVertexVariables( name = _name, - Key_vertexInputContainer = "", TrackToVertexIPEstimator = getTauTrackToVertexIPEstimator(), VertexFitter = getTauAdaptiveVertexFitter(), - #VertexFitter = "Trk::AdaptiveVertexFitter/InDetAdaptiveVxFitterTool", SeedFinder = getTauCrossDistancesSeedFinder(), - Key_trackPartInputContainer = "" # ATM only needed in case old API is used - #OutputLevel = 2 ) cached_instances[_name] = TauVertexVariables diff --git a/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx b/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx index e19071be75259a2a5d5c73da20d088be95af8842..713bea86c18656931c97ab1f2d11a929b2dd1947 100644 --- a/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx +++ b/Trigger/TrigAlgorithms/TrigTauRec/src/TrigTauRecMergedMT.cxx @@ -458,6 +458,10 @@ StatusCode TrigTauRecMergedMT::execute() firstTool = m_tools.begin(); lastTool = m_tools.end(); processStatus = StatusCode::SUCCESS; + + // dummy container passed to TauVertexVariables, not used in trigger though + xAOD::VertexContainer dummyVxCont; + ATH_MSG_DEBUG("Starting tool loop with seed jet"); while ( ! processStatus.isFailure() && firstTool != lastTool ) { // loop stops only when Failure indicated by one of the tools @@ -465,7 +469,11 @@ StatusCode TrigTauRecMergedMT::execute() // time in the various tools ++toolnum; - processStatus = (*firstTool)->execute( *p_tau ); + if ( (*firstTool)->type() == "TauVertexVariables") + processStatus = (*firstTool)->executeVertexVariables(*p_tau, dummyVxCont); + else + processStatus = (*firstTool)->execute( *p_tau ); + if ( !processStatus.isFailure() ) { ATH_MSG_DEBUG(" "<< (*firstTool)->name() << " executed successfully "); ATH_MSG_DEBUG(" Roi: " << roiDescriptor->roiId() diff --git a/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileLookForMuAlgConfig.py b/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileLookForMuAlgConfig.py index 9d5c4729e4dafd91d1c0bba6c41b83dbf0d93352..ace6a5264b60ed4913876af98e8f050652989d2c 100755 --- a/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileLookForMuAlgConfig.py +++ b/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileLookForMuAlgConfig.py @@ -1,13 +1,6 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -try: - from TrigTileMuId.TrigTileMuIdConf import TrigTileLookForMuAlg -except: - mlog.error("could not load TrigTileMuIdConf") - import traceback - print traceback.format_exc() - from AthenaCommon.SystemOfUnits import MeV diff --git a/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileMuFexConfig.py b/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileMuFexConfig.py index d77570b3bc13d3960aa8a1c09e38b40732680abb..b6865f2149fd340d9e7bce09a77ac6986eadfdf4 100755 --- a/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileMuFexConfig.py +++ b/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileMuFexConfig.py @@ -1,18 +1,10 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration #from TrigTileMuId.TrigTileMuIdConf import TrigTileMuFex from AthenaCommon.GlobalFlags import globalflags from AthenaCommon.AppMgr import ServiceMgr from TrigTileMuId.TrigTileMuIdMonitoring import * -#from AthenaCommon.AppMgr import * -try: - from TrigTileMuId.TrigTileMuIdConf import TrigTileMuFex -except: - mlog.error("could not load TrigTileMuIdConf") - import traceback - print traceback.format_exc() - class TrigTileMuFexConfig (TrigTileMuFex): __slot__ = [] diff --git a/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileRODMuAlgConfig.py b/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileRODMuAlgConfig.py index 52d49d1f633130c133e80e9dc059464dd7234b9d..2dacb30c122df3b008c44e1ae672ad74188ef97c 100755 --- a/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileRODMuAlgConfig.py +++ b/Trigger/TrigAlgorithms/TrigTileMuId/python/TrigTileRODMuAlgConfig.py @@ -1,12 +1,4 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - - -try: - from TrigTileMuId.TrigTileMuIdConf import TrigTileRODMuAlg -except: - mlog.error("could not load TrigTileMuIdConf") - import traceback - print traceback.format_exc() +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration class TrigTileRODMuAlg_L2(TrigTileRODMuAlg): diff --git a/Trigger/TrigConfiguration/TrigConfData/src/Logic.cxx b/Trigger/TrigConfiguration/TrigConfData/src/Logic.cxx index cc28f765d1c0c1570bf9aa12c21871a82d843256..8c4f3c15c47c43a0cfd48e0d197d27dad708b8ae 100644 --- a/Trigger/TrigConfiguration/TrigConfData/src/Logic.cxx +++ b/Trigger/TrigConfiguration/TrigConfData/src/Logic.cxx @@ -1,3 +1,7 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + #include "TrigConfData/Logic.h" #include <iostream> diff --git a/Trigger/TrigConfiguration/TrigConfData/src/LogicParser.cxx b/Trigger/TrigConfiguration/TrigConfData/src/LogicParser.cxx index 76ae29288ae7a8451a992d37e2a3e605ecd8d97f..a60a5eae44b442a234b11db499bc47e1722a0a93 100644 --- a/Trigger/TrigConfiguration/TrigConfData/src/LogicParser.cxx +++ b/Trigger/TrigConfiguration/TrigConfData/src/LogicParser.cxx @@ -1,11 +1,54 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ #include "TrigConfData/LogicParser.h" #include <boost/tokenizer.hpp> +#include <iostream> +#include <string> +#include <iterator> TrigConf::LogicParser::LogicParser() {} +namespace { + void printSubExpr(const std::string & id, const std::vector<std::string> & tokExpr, size_t & front, const size_t back) { + std::cout << id << ": "; + for(size_t i = front; i<=back; i++) { + std::cout << tokExpr[i] << " "; + } + std::cout << std::endl; + } + + size_t findMatchingClosingParenthesis(const std::vector<std::string> & tokExpr, size_t front, size_t back) { + if(tokExpr[front]!="(") { + throw TrigConf::LogicParsingException(std::string("Looking for closing parenthesis, but not starting with '(', but '") + tokExpr[front] + "'"); + } + size_t pos(front); + size_t parCount = 1; + size_t matchingClosingPar = 0; + while(++pos <= back) { + if(tokExpr[pos]=="(") { + parCount++; + } + if(tokExpr[pos]==")") { + parCount--; + } + if(parCount==0) { + matchingClosingPar = pos; + break; + } + } + if( matchingClosingPar == 0 ) { + printSubExpr("Search for matching parenthesis", tokExpr, front, back); + throw TrigConf::LogicParsingException("Found no closing parenthesis, matching '('"); + } + return matchingClosingPar; + } + +} + std::shared_ptr<TrigConf::Logic> TrigConf::LogicParser::parse(const std::string & expr) { std::unique_ptr<TrigConf::Logic> node( nullptr ); @@ -38,8 +81,7 @@ TrigConf::LogicParser::buildTree(const std::vector<std::string> & tokExpr) const size_t front = 0; size_t back = tokExpr.size()-1; - auto logic = buildNode(tokExpr,front,back); - return logic; + return buildNode(tokExpr,front,back); } @@ -99,8 +141,7 @@ TrigConf::LogicParser::findSubExpr(const std::vector<std::string> & tokExpr, siz } logic->setNegate(); } else if(token=="(") { - size_t parEnd = front; - while(tokExpr[++parEnd] != ")"); + size_t parEnd = findMatchingClosingParenthesis(tokExpr, front, back); logic = buildNode(tokExpr,front+1,parEnd-1); front = parEnd + 1; } else { diff --git a/Trigger/TrigConfiguration/TrigConfData/test/testLogicParser.cxx b/Trigger/TrigConfiguration/TrigConfData/test/testLogicParser.cxx index d5e5750fc78f513ec516c955c075feb2fdc589cf..f291b2a33c31eb02f19ab588294d2571a4f90104 100644 --- a/Trigger/TrigConfiguration/TrigConfData/test/testLogicParser.cxx +++ b/Trigger/TrigConfiguration/TrigConfData/test/testLogicParser.cxx @@ -48,7 +48,11 @@ int main() { std::map<std::string,bool> state { {"EM3", true}, {"MU6", false}, - {"MU20", true} + {"MU20", true}, + {"TAU6", true}, + {"J100", false}, + {"BGRP0", true}, + {"BGRP1", true} }; bool success = true; @@ -60,10 +64,11 @@ int main() { tests.emplace_back("EM3 & (!MU6 & MU20)"); // false tests.emplace_back("!EM3 | (MU6 & MU20)"); // true tests.emplace_back("!EM3 | MU6 | !MU20"); // false + tests.emplace_back("((EM3&MU6)|(TAU6&J100))&BGRP0&BGRP1)"); // false auto result1 = testPatterns(tests, state); - success = success && (result1 == std::vector<bool>{1,0,0,1,0,0}); + success = success && (result1 == std::vector<bool>{1,0,0,1,0,0,0}); // test 2: give multiplicity cout << endl; @@ -92,6 +97,7 @@ int main() { multiplicityTests.emplace_back("EM3[x1] & TOPO_300INVM9999-AJ30s6-AJ20s6[x1]"); multiplicityTests.emplace_back("EM18VHI[x1] & RNDM0"); + auto result2 = testPatterns(multiplicityTests, multiplicity); success = success && (result2 == std::vector<bool>{1,0,1,1,1,1,0,1,1}); diff --git a/Trigger/TrigConfiguration/TrigConfIO/python/MenuXML2JSONConverter.py b/Trigger/TrigConfiguration/TrigConfIO/python/MenuXML2JSONConverter.py index 843d3e22053305132cba7f06d00d6bf4f7c96483..11c4b2d6872a12ab29091bf2009e165da5032471 100755 --- a/Trigger/TrigConfiguration/TrigConfIO/python/MenuXML2JSONConverter.py +++ b/Trigger/TrigConfiguration/TrigConfIO/python/MenuXML2JSONConverter.py @@ -1,6 +1,7 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration - -import sys,os +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +from __future__ import print_function +import sys +import os class XML2JsonConverter(object): def __init__(self, tabsize = 4, **args): @@ -14,7 +15,7 @@ class XML2JsonConverter(object): def convertFile(self, inputfilename, jsonfilename = None ): if not inputfilename.endswith(".xml"): - print "judging by the suffix, %s is not an xml file" % inputfilename + print("judging by the suffix, %s is not an xml file" % inputfilename) return 1 self.parseXMLFile( inputfilename ) self.writeJsonFile( jsonfilename ) @@ -24,7 +25,7 @@ class XML2JsonConverter(object): import xml.etree.cElementTree as ET self.doc = ET.parse(filename) self.root = self.doc.getroot() - print "Parsed file %s" % filename + print("Parsed file %s" % filename) return self.doc def loadRules(self,docname): @@ -133,7 +134,7 @@ class XML2JsonConverter(object): "Fixed" : "fixedParameters", "Input" : "inputs", "Output" : "outputs", "Generic" : "generics", "Variable" : "variableParameters", "Parameter" : "parameters"} else: - print "Unknown document with root element %s" % docname + print("Unknown document with root element %s" % docname) return 1 return 0 @@ -195,27 +196,27 @@ class XML2JsonConverter(object): FH = open(filename, "w") json.dump(d, FH, indent=self.tabsize, separators=(',', ': ')) FH.close() - print "Wrote file %s" % filename + print("Wrote file %s" % filename) def checkJsonConformity(self, filename): - print "Checking json conformity", + print("Checking json conformity", end=' ') import json FH = open(filename, "rb") try: json.load(FH) - print " ... OK" - except ValueError, e: - print " ... FAILED" - print e + print(" ... OK") + except ValueError as e: + print(" ... FAILED") + print(e) FH.close() def test(): if len(sys.argv)<=1: - print "please specify xml file for conversion" + print("please specify xml file for conversion") return 1 converter = XML2JsonConverter() diff --git a/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/EnhancedBiasWeighter.h b/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/EnhancedBiasWeighter.h index c330031086695ffd206e8b296e538b1616e5e81b..f051cde92806ec5c1261b24367092fff63d4f6ff 100644 --- a/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/EnhancedBiasWeighter.h +++ b/Trigger/TrigCost/EnhancedBiasWeighter/EnhancedBiasWeighter/EnhancedBiasWeighter.h @@ -171,6 +171,7 @@ class EnhancedBiasWeighter: public asg::AsgTool, public virtual IEnhancedBiasWei Gaudi::Property<double> m_mcCrossSection{this, "MCCrossSection", 0.0, "If running over MC. The process cross section in nb (AMI gives thins in nb)"}; Gaudi::Property<double> m_mcFilterEfficiency{this, "MCFilterEfficiency", 1.0, "If running over MC. The process filter efficiency (0.0-1.0)"}; Gaudi::Property<double> m_mcKFactor{this, "MCKFactor", 1.0, "If running over MC. The process filter efficiency (0.0-1.0)"}; + Gaudi::Property<bool> m_mcIgnoreGeneratorWeights{this, "MCIgnoreGeneratorWeights", false, "If running over MC. Flag to ignore the generator weight."}; Gaudi::Property<double> m_inelasticCrossSection{this, "InelasticCrossSection", 8e-26, "Inelastic cross section in units cm^2. Default 80 mb at 13 TeV."}; double m_deadtime; //!< Online deadtime to correct for in rate prediction. Currently a constant for the EB period diff --git a/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx b/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx index d4a64d2369ed55977e8160b7cf662fed7e7645a8..f4aaf2d7588ee20e42e6dcb9b60481d0fbd5c6b9 100644 --- a/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx +++ b/Trigger/TrigCost/EnhancedBiasWeighter/Root/EnhancedBiasWeighter.cxx @@ -410,8 +410,14 @@ double EnhancedBiasWeighter::getEBWeight(const xAOD::EventInfo* eventInfo) const if (m_isMC) { + if (m_mcIgnoreGeneratorWeights) { + return 1.; + } + const std::vector<float> weights = eventInfo->mcEventWeights(); - if (weights.size() > 0) return weights[0]; + if (weights.size() > 0) { + return weights[0]; + } return 1.; } else { // isData diff --git a/Trigger/TrigCost/RatesAnalysis/CMakeLists.txt b/Trigger/TrigCost/RatesAnalysis/CMakeLists.txt index 456fed105a2db430757c0f516b8f612768c6cd0a..f1953494930bf33c154c18b3f1511a6b1382b3ac 100644 --- a/Trigger/TrigCost/RatesAnalysis/CMakeLists.txt +++ b/Trigger/TrigCost/RatesAnalysis/CMakeLists.txt @@ -12,7 +12,8 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigAnalysis/TrigDecisionTool Trigger/TrigCost/EnhancedBiasWeighter PRIVATE - Event/xAOD/xAODEventInfo ) + Event/xAOD/xAODEventInfo + Trigger/TrigConfiguration/TrigConfL1Data ) # External dependencies: find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) @@ -29,7 +30,7 @@ atlas_add_library( RatesAnalysisLib atlas_add_component( RatesAnalysis src/FullMenu.cxx src/components/RatesAnalysis_entries.cxx - LINK_LIBRARIES GaudiKernel RatesAnalysisLib ) + LINK_LIBRARIES GaudiKernel RatesAnalysisLib TrigConfL1Data ) atlas_add_test( RatesAnalysis_test SOURCES test/RatesAnalysis_test.cxx @@ -37,4 +38,4 @@ atlas_add_test( RatesAnalysis_test # Install files from the package: atlas_install_python_modules( python/*.py ) -atlas_install_scripts( share/RatesAnalysisFullMenu.py ) +atlas_install_scripts( share/RatesAnalysisFullMenu.py share/RatesAnalysisPostProcessing.py ) diff --git a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesAnalysisAlg.h b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesAnalysisAlg.h index a12de7ed902be4480d61e371cce4173c4aec9fab..cdec26d779d7c4ca41163f8731e97b2e4add23a4 100644 --- a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesAnalysisAlg.h +++ b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesAnalysisAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef RATESANALYSIS_RATESANALYSISALG_H @@ -16,8 +16,14 @@ #include "RatesScanTrigger.h" #include "RatesGroup.h" +#include "TTree.h" + #include <unordered_set> +namespace TrigConf { + class ITrigConfigSvc; +} + /** * @brief virtual analysis class for performing rates studies on AOD * Pure virtual base class for trigger rate studies on EnhancedBias or MC AOD files. @@ -129,7 +135,7 @@ class RatesAnalysisAlg: public ::AthAnalysisAlgorithm { * @param name Name of the registered trigger * @param triggerIsPassed Trigger decision. */ - StatusCode setTriggerDesicison(const std::string& name, const bool triggerIsPassed = true); + StatusCode setTriggerDesicison(const std::string& name, const bool triggerIsPassed = true, const bool triggerIsActive = true); /** * Set the pass threshold for a Scan Trigger item. @@ -204,6 +210,8 @@ class RatesAnalysisAlg: public ::AthAnalysisAlgorithm { void printStatistics() const; //!< Print some extra statistics on events processed void printTarget() const; //!< Print the target instantaneous luminosity, mu and number of bunches. + void writeMetadata(); //!< Write to outpute tree (if any) the metadata needed downstream. + /** * @brief String match coherent prescale groups. @@ -239,7 +247,9 @@ class RatesAnalysisAlg: public ::AthAnalysisAlgorithm { std::unordered_set<RatesGroup*> m_activeGroups; //!< All groups which are enabled (PS >= 1) std::unordered_map<size_t, double> m_lowestPrescale; //!< Lowest prescale within a CPS group, key is the hash of the CPS group name. std::vector<std::string> m_autoTriggers; //!< List of triggers which it is up to us to the algorithm to work out the pass/fail for + std::unordered_map<std::string, const Trig::ChainGroup*> m_existingTriggers; //!< Map of triggers which we ask the TDT ChainGroup for the pass/fail + std::unordered_map<std::string, std::string> m_lowerTrigger; //!< Map of triggers lower chain, to tell if a HLT trigger ran or not. std::unordered_map<std::string, ChainDetail> m_loadedXML; //!< Details loaded from a prescale XML are stored here @@ -249,6 +259,7 @@ class RatesAnalysisAlg: public ::AthAnalysisAlgorithm { ToolHandle<IEnhancedBiasWeighter> m_enhancedBiasRatesTool{this, "EnhancedBiasRatesTool", "EnhancedBiasWeighter/EnhancedBiasRatesTool"}; ToolHandle<Trig::TrigDecisionTool> m_tdt{this, "TrigDecisionTool", "Trig::TrigDecisionTool/TrigDecisionTool"}; + ServiceHandle<TrigConf::ITrigConfigSvc> m_configSvc{this, "TrigConfigSvc", ""}; Gaudi::Property<double> m_expoScalingFactor{this, "ExpoScalingFactor", 0.1, "Optional. Exponential factor if using exponential-mu rates scaling."}; Gaudi::Property<double> m_inelasticCrossSection{this, "InelasticCrossSection", 8e-26, "Inelastic cross section in units cm^2. Default 80 mb at 13 TeV."}; @@ -273,6 +284,8 @@ class RatesAnalysisAlg: public ::AthAnalysisAlgorithm { TH1D* m_scalingHist; //!< One-bin histogram to store the normalisation of the sample, for use in later combinations TH1D* m_bcidHist; //!< Histogram of the BCIDs distribution of the processing + TTree* m_metadataTree; //!< Used to write out some metadata needed by post-processing (e.g. bunchgroup, lumi) + WeightingValuesSummary_t m_weightingValues; //!< Possible weighting & lumi extrapolation values for the current event }; diff --git a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesGroup.h b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesGroup.h index 10258b0e50ad5bbe83e058bb819f09b15a494fdb..9d3cac92df8851cbfd1123c043f0a30edef31824 100644 --- a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesGroup.h +++ b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesGroup.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef RATESANALYSIS_RATESTGROUP_H @@ -79,13 +79,13 @@ class RatesGroup : public RatesHistoBase { */ void execute(const WeightingValuesSummary_t& weights); - void setExpressGroup(const bool i) { m_isExpressGroup = i; } //!< Flag this group as the express group (modifies group trigger's prescales) - void setDoCachedWeights(const bool i) { m_doCachedWeights = i; } //!< Flag group to cache weights. Called only on the Master group - void setUseCachedWeights(const bool i) { m_useCachedWeights = i; } //!< Set to use cached weights from the Master group (need ptr to m_masterGroup) - void duplicateChildren(const RatesGroup* toDuplicate) { m_children = toDuplicate->getChildren(); m_masterGroup = toDuplicate; } //!< Copy in triggers from another group. Sets my master - double getCachedWeight(const size_t l1Hash) const { return m_cachedWeights.at(l1Hash); } //!< Get cached weight from triggers seeding from a given L1 item. - void setUniqueTrigger(RatesTrigger* trigger) { m_uniqueTrigger = trigger; } //!< Set trigger I am doing unique rates for - RatesTrigger* getUniqueTrigger() { return m_uniqueTrigger; } //!< Get the trigger I am doing unique rates for + void setExpressGroup(const bool i); //!< Flag this group as the express group (modifies group trigger's prescales) + void setDoCachedWeights(const bool i); //!< Flag group to cache weights. Called only on the Master group + void setUseCachedWeights(const bool i); //!< Set to use cached weights from the Master group (need ptr to m_masterGroup) + void duplicateChildren(const RatesGroup* toDuplicate); //!< Copy in triggers from another group. Sets my master + double getCachedWeight(const size_t l1Hash) const; //!< Get cached weight from triggers seeding from a given L1 item. + void setUniqueTrigger(RatesTrigger* trigger); //!< Set trigger I am doing unique rates for + RatesTrigger* getUniqueTrigger(); //!< Get the trigger I am doing unique rates for /** * @brief Get the unique rate of a unique-rate group @@ -95,7 +95,7 @@ class RatesGroup : public RatesHistoBase { */ double getUniqueWeight(const double ratesDenominator) const; - const std::unordered_map<size_t, std::set<const RatesTrigger*>>& getChildren() const { return m_children; } //<! Return all triggers in the group, ordered by common L1 + const std::unordered_map<size_t, std::set<const RatesTrigger*>>& getChildren() const; //<! Return all triggers in the group, ordered by common L1 const std::string printConfig() const; //!< Prints the RatesGroup's configuration diff --git a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesHistoBase.h b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesHistoBase.h index 1e8e213a8a96b7c759fbd988a2b48d8608fb5735..61a20677cbc0263a3e9ce9005723453e03aed5c8 100644 --- a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesHistoBase.h +++ b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesHistoBase.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef RATESANALYSIS_RATESHISTOBASE_H @@ -38,8 +38,11 @@ enum ExtrapStrat_t{ * Lables a bin in a histogram. */ enum RatesBinIdentifier_t{ - kRATE_BIN_OR, //!< Bin used to store the total rate (OR) - kRATE_BIN_AND, //!< Bin used to store the total rate (AND) + kACTIVE_RAW_BIN, //!< Bin used to store the raw total events in which the trigger was active + kACTIVE_WEIGHTED_BIN, //!< Bin used to store the weighted events in which the trigger was active + kPASS_RAW_BIN, //!< Bin used to store the raw total events in which the trigger passed + kPASS_WEIGHTED_OR_BIN, //!< Bin used to store the total rate (OR) + kPASS_WEIGHTED_AND_BIN, //!< Bin used to store the total rate (AND) kEXPRESS_BIN, //!< Bin used to store the express rate. kUNIQUE_BIN, //!< Bin used to store data needed to get the unique rate kNRATES_BINS //!< Must always come last diff --git a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesTrigger.h b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesTrigger.h index 6ffccd3301688073c1c2439706053224ac017370..66b0e86c2b41fdc7d385d35b674a260d1270de24 100644 --- a/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesTrigger.h +++ b/Trigger/TrigCost/RatesAnalysis/RatesAnalysis/RatesTrigger.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef RATESANALYSIS_RATESTRIGGER_H @@ -41,18 +41,18 @@ class RatesTrigger : public RatesHistoBase { RatesTrigger& operator=(const RatesTrigger&) = delete; - virtual void reset() { m_pass = false; } //!< If I was used in an event, reset me. + virtual void reset(); //!< If I was used in an event, reset me. - void setSeedsFromRandom(const bool i) { m_seedsFromRandom = i; } //!< Set if this trigger is to behave as if it seeds from a random L1 item + void setSeedsFromRandom(const bool i); //!< Set if this trigger is to behave as if it seeds from a random L1 item - void setPassed(const bool i = true, const bool unbiasedEvent = false); //!< Set the pass/fail bool. Execute needs to be called separately afterwards. + void setPassed(const bool passed = true, const bool active = true, const bool unbiasedEvent = false); //!< Set the pass/fail bool. Execute needs to be called separately afterwards. /** * @brief Set the pass/fail bool and immediately call execute. Should only be done once per event. * @param i If the trigger passed or failed the event * @weights Struct of weighting information for the event */ - void setPassedAndExecute(const bool i, const WeightingValuesSummary_t& weights); + void setPassedAndExecute(const bool passed, const bool active, const WeightingValuesSummary_t& weights); /** * @brief Execute trigger rate emulation. If the trigger passed, add to its rate the effective number of events it is accepting. @@ -61,15 +61,15 @@ class RatesTrigger : public RatesHistoBase { */ virtual void execute(const WeightingValuesSummary_t& weights); - size_t getSeedHash() const { return m_seedHash; } //<! Get the hash of the name of the seed of this trigger. + size_t getSeedHash() const; //<! Get the hash of the name of the seed of this trigger. - const std::string& getSeedName() const { return m_seed; } //!< Get the name of the seed of this trigger + const std::string& getSeedName() const; //!< Get the name of the seed of this trigger - double getSeedPrescale() const { return m_seedPrescale; } //!< Get the prescale of the seed of this trigger + double getSeedPrescale() const; //!< Get the prescale of the seed of this trigger - size_t getHash() const { return m_nameHash; } //!< Get the hash of the name of this trigger + size_t getHash() const; //!< Get the hash of the name of this trigger - const std::string& getName() const { return m_name; } //!< Get the name of this trigger + const std::string& getName() const; //!< Get the name of this trigger /** * @brief Gets the triggers prescale @@ -77,19 +77,21 @@ class RatesTrigger : public RatesHistoBase { */ double getPrescale(const bool includeExpress = false) const; - bool getPassed() const { return m_pass; } //!< If the trigger passed in the event + bool getPassed() const; //!< If the trigger passed in the event - bool getDisabled() const { return (isZero(m_prescale) || isZero(m_seedPrescale)); } //!< If I or my seed were prescaled out + bool getActive() const; //!< If the trigger passed in the event - void setUniqueGroup(const RatesGroup* unique) { m_uniqueGroup = unique; } //!< If I have a group which is calculating my unique rate. + bool getDisabled() const; //!< If I or my seed were prescaled out - void setCoherentFactor(const double lowestCommonPrescale) { m_coherentFactor = lowestCommonPrescale; } //!< If i'm in a CPS group, set the lowest commons PS factor of the group + void setUniqueGroup(const RatesGroup* unique); //!< If I have a group which is calculating my unique rate. - void setCPS(const std::string& group) { m_CPSID = std::hash<std::string>{}(group); } //!< If I'm in a CPS group, set the group name (I'll keep a copy of the hash) + void setCoherentFactor(const double lowestCommonPrescale); //!< If i'm in a CPS group, set the lowest commons PS factor of the group + + void setCPS(const std::string& group); //!< If I'm in a CPS group, set the group name (I'll keep a copy of the hash) - size_t getCPSID() const { return m_CPSID; } //!< Get the hash of my CPS group name + size_t getCPSID() const; //!< Get the hash of my CPS group name - double getCoherentFactor() const { return m_coherentFactor; } //!< Get the lowest common prescale factor of all triggers in my CPS group + double getCoherentFactor() const; //!< Get the lowest common prescale factor of all triggers in my CPS group const std::string printConfig() const; //!< Prints the RatesTrigger's configuration @@ -110,11 +112,14 @@ class RatesTrigger : public RatesHistoBase { protected: bool m_pass; //!< Did the trigger pass or not? + bool m_active; //!< Was the trigger active? (Did it run) bool m_seedsFromRandom; //!< Does this trigger seed from a random trigger? If so it should only be exposed to unbiased events double m_rateAccumulator; //!< Weighted events passed double m_rateAccumulator2; //!< Weighted events passed squared double m_rateExpressAccumulator; //!< Weighted express stream events double m_rateExpressAccumulator2; //!< Weighted express stream events squared + double m_ratesActive; // Active events + double m_ratesActive2; // Active events squared size_t m_CPSID; //!< If I'm in a coherent prescale group, my group's ID (hash of the group name) double m_coherentFactor; //!< If I'm in a coherent prescale group, the prescale of the lowest non-disabled chain in the group @@ -135,6 +140,5 @@ class RatesTrigger : public RatesHistoBase { }; - #endif //> !RATESANALYSIS_RATESTRIGGER_H diff --git a/Trigger/TrigCost/RatesAnalysis/python/RatesTrigger.py b/Trigger/TrigCost/RatesAnalysis/python/RatesTrigger.py new file mode 100644 index 0000000000000000000000000000000000000000..ddca3a1a28a5bbce5de90fe9dfbfd0207a09b01c --- /dev/null +++ b/Trigger/TrigCost/RatesAnalysis/python/RatesTrigger.py @@ -0,0 +1,101 @@ +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# + +''' +@file RatesTrigger.py +@brief Accumulator class to buffer data for a single trigger and export this to JSON or CSV +''' + +import ROOT +import math +from enum import Enum + +class RatesBins(Enum): + ACTIVE_RAW_BIN = 1 + ACTIVE_WEIGHTED_BIN = 2 + PASS_RAW_BIN = 3 + PASS_WEIGHTED_OR_BIN = 4 + PASS_WEIGHTED_AND_BIN = 5 + EXPRESS_BIN = 6 + UNIQUE_BIN = 7 + +class RatesTrigger: + def __init__(self, name, metadata, data, masterGroup): + self.name = name + # Total weighted events passing the trigger + self.passWeighted = data.GetBinContent(RatesBins.PASS_WEIGHTED_OR_BIN.value) + self.passWeightedErr = data.GetBinError(RatesBins.PASS_WEIGHTED_OR_BIN.value) + + # Total un-weighted events passing the trigger + self.passRaw = data.GetBinContent(RatesBins.PASS_RAW_BIN.value) + + # Total weighted events passing the trigger, using the express prescale + self.passExpressWeighted = data.GetBinContent(RatesBins.EXPRESS_BIN.value) + self.passExpressWeightedErr = data.GetBinError(RatesBins.EXPRESS_BIN.value) + + # Total weighted events passing a full hypothetical menu which *excluded* this trigger + self.passUniqueWeighted = data.GetBinContent(RatesBins.UNIQUE_BIN.value) + self.passUniqueWeightedErr = data.GetBinError(RatesBins.UNIQUE_BIN.value) + + # Total weighted events passing the full menu (full L1 for L1 chains, full HLT for HLT chains) + self.passMasterWeighted = masterGroup.GetBinContent(RatesBins.PASS_WEIGHTED_OR_BIN.value) + + # Total un-weighted number of events in which the trigger was active (always active if L1) + self.activeRaw = data.GetBinContent(RatesBins.ACTIVE_RAW_BIN.value) + + # Total weighted number of events in which the trigger was active + self.activeWeighted = data.GetBinContent(RatesBins.ACTIVE_WEIGHTED_BIN.value) + self.activeWeightedErr = data.GetBinError(RatesBins.ACTIVE_WEIGHTED_BIN.value) + + # Wall-time in seconds. No error on this. + self.rateDenominator = metadata['normalisation'] + + # Trigger's rate is total weighted passing events normalised to wall-time + self.rate = self.passWeighted / self.rateDenominator + self.rateErr = self.passWeightedErr / self.rateDenominator + + # Trigger's efficiency is the fraction of active events which are passed. Error propagated. + self.efficiency = self.passWeighted / self.activeWeighted + self.efficiencyErr = 0 + if self.passWeighted != 0 and self.activeWeighted != 0: + fracErr = math.sqrt( math.pow(self.passWeightedErr/self.passWeighted,2) + math.pow(self.activeWeightedErr/self.activeWeighted,2) ) + self.efficiencyErr = self.efficiency * fracErr + + # Rate using express prescales + self.rateExpress = self.passExpressWeighted / self.rateDenominator + self.rateExpressErr = self.passExpressWeightedErr / self.rateDenominator + + # Unique rate requires the subtraction of the (all minus this trigger) total from the (all triggers) total + # The error is taken as a fractional error on the main rate calc + self.rateUnique = (self.passMasterWeighted - self.passUniqueWeighted) / self.rateDenominator + self.rateUniqueErr = 0 + if self.passWeighted != 0: + self.rateUniqueErr = (self.passWeightedErr / self.passWeighted) * self.rateUnique + + # The total rate of all triggers + self.masterRate = self.passMasterWeighted / self.rateDenominator + + # What fraction of the total rate is unique to this trigger + self.uniqueFraction = 0 if self.masterRate == 0 else self.rateUnique / self.masterRate + + # Some menu-derived metadata + prescales = metadata['prescales'] + lowers = metadata['lowers'] + self.prescale = prescales[name] + self.lower = lowers[name] + + def export(self, exportDict): + myDict = {} + myDict['express_stream'] = self.rateExpress + myDict['chain_prescale'] = self.prescale + myDict['lower_chain_name'] = self.lower + myDict['evts_passed'] = self.passRaw + myDict['evts_passed_weighted'] = self.passWeighted + myDict['efficiency'] = self.efficiency + myDict['efficiency_err'] = self.efficiencyErr + myDict['rate'] = self.rate + myDict['rate_err'] = self.rateErr + myDict['unique_fraction'] = self.uniqueFraction + myDict['unique_rate'] = self.rateUnique + exportDict[self.name] = myDict diff --git a/Trigger/TrigCost/RatesAnalysis/python/Util.py b/Trigger/TrigCost/RatesAnalysis/python/Util.py new file mode 100644 index 0000000000000000000000000000000000000000..7353d93ebff3e9c14142e00d7e419fc4758b30bb --- /dev/null +++ b/Trigger/TrigCost/RatesAnalysis/python/Util.py @@ -0,0 +1,94 @@ +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# + +''' +@file Util.py +@brief Utility functions used by RatesPostProcessing +''' + +def toJson(fileName, metadata, L1Triggers, HLTTriggers): + import json + l1 = {} + for trig in L1Triggers: + trig.export(l1) + hlt = {} + for trig in HLTTriggers: + trig.export(hlt) + + level = {} + level['L1'] = l1 + level['HLT'] = hlt + + jsonDict = {} + jsonDict['PredictionLumi'] = metadata['targetLumi'] + jsonDict['n_evts'] = metadata['n_evts'] + jsonDict['AtlasProject'] = metadata['AtlasProject'] + jsonDict['AtlasVersion'] = metadata['AtlasVersion'] + jsonDict['triggerMenuSetup'] = metadata['masterKey'] + jsonDict['L1PrescaleSet'] = metadata['lvl1PrescaleKey'] + jsonDict['HLTPrescaleSet'] = metadata['hltPrescaleKey'] + jsonDict['bunchgroup'] = metadata['bunchGroups'] + jsonDict['level'] = level + + with open(fileName, 'w') as outFile: + json.dump(obj=jsonDict, fp=outFile, indent=2, sort_keys=True) + + +def getMetadata(inputFile): + metatree = inputFile.Get("metadata"); + if metatree == None: + return None + + metatree.GetEntry(0) + metadata = {} + + metadata['targetMu'] = metatree.targetMu + metadata['targetBunches'] = metatree.targetBunches + metadata['targetLumi'] = metatree.targetLumi + + metadata['masterKey'] = metatree.masterKey + metadata['lvl1PrescaleKey'] = metatree.lvl1PrescaleKey + metadata['hltPrescaleKey'] = metatree.hltPrescaleKey + + metadata['AtlasProject'] = str(metatree.AtlasProject) + metadata['AtlasVersion'] = str(metatree.AtlasVersion) + + prescales = {} + lowers = {} + for i in range(0, metatree.triggers.size()): + prescales[metatree.triggers.at(i)] = metatree.prescales.at(i) + lowers[metatree.triggers.at(i)] = str(metatree.lowers.at(i)) + metadata['prescales'] = prescales + metadata['lowers'] = lowers + + bunchGroups = [] + for bg in metatree.bunchGroups: + bunchGroups.append(bg) + metadata['bunchGroups'] = bunchGroups + + return metadata + + +def populateTriggers(inputFile, metadata, globalGroup, filter): + from .RatesTrigger import RatesTrigger + triggerList = [] + for key in inputFile.GetListOfKeys(): + if key.GetName() == 'Triggers': + for triggerKey in key.ReadObj().GetListOfKeys(): + if triggerKey.GetName().startswith(filter): + for hist in triggerKey.ReadObj().GetListOfKeys(): + if hist.GetName() == 'data': + triggerList.append( RatesTrigger(triggerKey.GetName(), metadata, hist.ReadObj(), globalGroup) ) + return triggerList + + +def getGlobalGroup(inputFile, filter): + for key in inputFile.GetListOfKeys(): + if key.GetName() == 'Globals': + for globalsKey in key.ReadObj().GetListOfKeys(): + if globalsKey.GetName() == filter: + for hist in globalsKey.ReadObj().GetListOfKeys(): + if hist.GetName() == 'data': + return hist.ReadObj() diff --git a/Trigger/TrigCost/RatesAnalysis/python/__init__.py b/Trigger/TrigCost/RatesAnalysis/python/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..d05209a04d1460972fcb346e962d5d25b7c8b4bb --- /dev/null +++ b/Trigger/TrigCost/RatesAnalysis/python/__init__.py @@ -0,0 +1,5 @@ +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# +# Trigger/TrigCost/RatesAnalysis/ diff --git a/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisFullMenu.py b/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisFullMenu.py index 80460c2e76bbedcf02c657b7089c570a0ee43a3b..0b73cf1b596f56acf914272a04e5c06afc7c3948 100755 --- a/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisFullMenu.py +++ b/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisFullMenu.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # if __name__=='__main__': @@ -26,6 +26,7 @@ if __name__=='__main__': parser.add_argument('--MCCrossSection', default=0.0, type=float, help='For MC input: Cross section of process in nb') parser.add_argument('--MCFilterEfficiency', default=1.0, type=float, help='For MC input: Filter efficiency of any MC filter (0.0 - 1.0)') parser.add_argument('--MCKFactor', default=1.0, type=float, help='For MC input: Additional multiplicitive fudge-factor to the supplied cross section.') + parser.add_argument('--MCIgnoreGeneratorWeights', action='store_true', help='For MC input: Flag to disregard any generator weights.') # parser.add_argument('--maxEvents', type=int, help='Maximum number of events to process') parser.add_argument('--loglevel', type=int, default=3, help='Verbosity level') @@ -71,7 +72,7 @@ if __name__=='__main__': cfg.merge(MetaDataSvcCfg(ConfigFlags)) cfgsvc = CompFactory.TrigConf__xAODConfigSvc('xAODConfigSvc') - cfg.addService(cfg) + cfg.addService(cfgsvc) from TrigEDMConfig.TriggerEDM import EDMLibraries tdt = CompFactory.Trig__TrigDecisionTool('TrigDecisionTool') @@ -103,6 +104,7 @@ if __name__=='__main__': ebw.MCCrossSection = xsec ebw.MCFilterEfficiency = fEff ebw.MCKFactor = args.MCKFactor + ebw.MCIgnoreGeneratorWeights = args.MCIgnoreGeneratorWeights cfg.addPublicTool(ebw) from RatesAnalysis.RatesAnalysisConf import FullMenu @@ -119,6 +121,7 @@ if __name__=='__main__': rates.EnableLumiExtrapolation = args.disableLumiExtrapolation rates.EnhancedBiasRatesTool = ebw rates.TrigDecisionTool = tdt + rates.TrigConfigSvc = cfgsvc cfg.addEventAlgo(rates) # Setup for accessing bunchgroup data from the DB diff --git a/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisPostProcessing.py b/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisPostProcessing.py new file mode 100755 index 0000000000000000000000000000000000000000..80a0818f18cdb7b6b9846949fb92cebee6e70ded --- /dev/null +++ b/Trigger/TrigCost/RatesAnalysis/share/RatesAnalysisPostProcessing.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python +# +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# + +''' +@file RatesPostProcessing.py +@author T. Martin +@date 2020-02-04 +@brief Script to consume merged rates histograms from the RatesAnalysis package and produce structured CSV, JSON output. +''' + +import ROOT +from RatesAnalysis.RatesTrigger import RatesTrigger +from RatesAnalysis.Util import getMetadata, populateTriggers, getGlobalGroup, toJson +from AthenaCommon.Logging import logging + +def main(): + import sys + from argparse import ArgumentParser + parser = ArgumentParser() + parser.add_argument('--file', default='RatesHistograms.root', + help='Input ROOT file to generate output from, run hadd first if you have more than one') + parser.add_argument('--outputTag', default='LOCAL', + help='Tag identifying this processing to be used in the output folder name (any underscores will be removed)') + parser.add_argument('--outputJSONFile', default='rates.json', + help='JSON file of rates for use with the RuleBook') + parser.add_argument('--userDetails', + help='User supplied metadata string giving any extra details about this run.') + args = parser.parse_args() + log = logging.getLogger('RatesPostProcessing') + + inputFile = ROOT.TFile(args.file, 'READ') + + metadata = getMetadata(inputFile) + normHist = inputFile.Get('normalisation') + + if normHist is None or metadata is None: + log.error('Cannot locate normHist, or metadata in top level of ntuple.') + exit() + + metadata['normalisation'] = normHist.GetBinContent(1) + metadata['n_evts'] = normHist.GetBinContent(2) + + HLTGlobalGroup = getGlobalGroup(inputFile, 'Main') + HLTExpressGroup = getGlobalGroup(inputFile, 'Express') + L1GlobalGroup = getGlobalGroup(inputFile, 'L1') + + L1Triggers = populateTriggers(inputFile, metadata, L1GlobalGroup, 'L1_') + HLTTriggers = populateTriggers(inputFile, metadata, HLTGlobalGroup, 'HLT_') + + log.info("Exporting " + args.outputJSONFile) + toJson(args.outputJSONFile, metadata, L1Triggers, HLTTriggers) + +if __name__== "__main__": + main() diff --git a/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx b/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx index b3be62eebdc93327a522086f530926b81265e080..5d9595a3a40f3843ef7964337301cabca90e0d9d 100644 --- a/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx +++ b/Trigger/TrigCost/RatesAnalysis/src/RatesAnalysisAlg.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // RatesAnalysis includes @@ -8,6 +8,8 @@ #include "xAODEventInfo/EventInfo.h" +#include "TrigConfL1Data/BunchGroupSet.h" + //uncomment the line below to use the HistSvc for outputting trees and histograms #include "GaudiKernel/ITHistSvc.h" #include "TH1.h" @@ -23,7 +25,8 @@ RatesAnalysisAlg::RatesAnalysisAlg( const std::string& name, ISvcLocator* pSvcLo m_eventCounter(0), m_weightedEventCounter(0), m_scalingHist(nullptr), - m_bcidHist(nullptr) + m_bcidHist(nullptr), + m_metadataTree(nullptr) {} RatesAnalysisAlg::~RatesAnalysisAlg() {} @@ -136,6 +139,7 @@ StatusCode RatesAnalysisAlg::newTrigger(const std::string& name, m_autoTriggers.push_back(name); } else if (method == kEXISTING) { m_existingTriggers[name] = m_tdt->getChainGroup(name); + m_lowerTrigger[name] = seedName; } // Add this trigger to its groups @@ -284,16 +288,16 @@ StatusCode RatesAnalysisAlg::checkExistingTrigger(const std::string& name, const return StatusCode::SUCCESS; } -StatusCode RatesAnalysisAlg::setTriggerDesicison(const std::string& name, const bool triggerIsPassed) { +StatusCode RatesAnalysisAlg::setTriggerDesicison(const std::string& name, const bool triggerIsPassed, const bool triggerIsActive) { // Currently - we call execute on setPassed, so the user would be unable to overwrite a decision set e.g. by the TDT. // so for now we only accept positive decisions here. - if (triggerIsPassed) { + if (triggerIsPassed || triggerIsActive) { const auto iterator = m_triggers.find(name); if (iterator == m_triggers.end()) { ATH_MSG_ERROR("Cannot find trigger " << name << " did you call newTrigger for this in initialize?"); return StatusCode::FAILURE; } - iterator->second->setPassedAndExecute(triggerIsPassed, m_weightingValues); // There is logic in the RatesTrigger to prevent multiple calls per event by accident. + iterator->second->setPassedAndExecute(triggerIsPassed, triggerIsActive, m_weightingValues); // There is logic in the RatesTrigger to prevent multiple calls per event by accident. m_activatedTriggers.insert( iterator->second.get() ); } return StatusCode::SUCCESS; @@ -317,6 +321,10 @@ StatusCode RatesAnalysisAlg::initialize() { ATH_CHECK( m_tdt.retrieve() ); m_tdt->ExperimentalAndExpertMethods()->enable(); + if(!m_configSvc.empty()) { + ATH_CHECK( m_configSvc.retrieve() ); + } + ATH_CHECK( m_enhancedBiasRatesTool.retrieve() ); if (m_doUniqueRates && !m_doGlobalGroups) { @@ -406,10 +414,13 @@ StatusCode RatesAnalysisAlg::populateTriggers() { if (m_doHistograms) { ATH_MSG_DEBUG("################## Registering normalisation histogram:"); - m_scalingHist = new TH1D("normalisation","normalisation;;sample walltime [s]",1,0.,1.); - ATH_CHECK( histSvc()->regHist(std::string("/RATESTREAM/normalisation"), m_scalingHist) ); + m_scalingHist = new TH1D("normalisation",";;",3,0.,3.); + ATH_CHECK( histSvc()->regHist("/RATESTREAM/normalisation", m_scalingHist) ); m_bcidHist = new TH1D("bcid",";BCID;Events",3565,-.5,3564.5); - ATH_CHECK( histSvc()->regHist(std::string("/RATESTREAM/bcid"), m_bcidHist) ); + ATH_CHECK( histSvc()->regHist("/RATESTREAM/bcid", m_bcidHist) ); + ATH_MSG_DEBUG("################## Registering metadata tree histogram:"); + ATH_CHECK( histSvc()->regTree("/RATESTREAM/metadata", std::make_unique<TTree>("metadata", "metadata")) ); + ATH_CHECK( histSvc()->getTree("/RATESTREAM/metadata", m_metadataTree) ); if (m_triggers.size()) { ATH_MSG_DEBUG("################## Registering trigger histograms:"); for (const auto& trigger : m_triggers) { @@ -510,7 +521,9 @@ StatusCode RatesAnalysisAlg::execute() { if (m_doHistograms) { m_bcidHist->Fill(eventInfo->bcid(), m_weightingValues.m_enhancedBiasWeight); - m_scalingHist->Fill(m_weightingValues.m_eventLiveTime); + m_scalingHist->Fill(0.5, m_weightingValues.m_eventLiveTime); // Walltime + m_scalingHist->Fill(1.5, 1.); // Total events + m_scalingHist->Fill(2.5, m_weightingValues.m_enhancedBiasWeight); // Total events weighted } // Some debug info @@ -524,7 +537,13 @@ StatusCode RatesAnalysisAlg::execute() { StatusCode RatesAnalysisAlg::executeTrigDecisionToolTriggers() { for (const auto& trigger : m_existingTriggers) { - ATH_CHECK( setTriggerDesicison(trigger.first, trigger.second->isPassed()) ); + const bool passed = trigger.second->isPassed(); + // L1 chains are always active, HLT chains are active if their L1 passed. + const std::string& lower = m_lowerTrigger[trigger.first]; + // Expect this find operation to fail for L1 chains (lower = "") + const std::unordered_map<std::string, const Trig::ChainGroup*>::const_iterator it = m_existingTriggers.find(lower); + const bool active = (it == m_existingTriggers.end() ? true : it->second->isPassed()); + ATH_CHECK( setTriggerDesicison(trigger.first, passed, active) ); } return StatusCode::SUCCESS; } @@ -569,6 +588,8 @@ StatusCode RatesAnalysisAlg::finalize() { printStatistics(); ATH_MSG_INFO("##################"); + writeMetadata(); + return StatusCode::SUCCESS; } @@ -668,3 +689,63 @@ uint32_t RatesAnalysisAlg::getLevel(const std::string& name) const { if (name.find("L1_") != std::string::npos) return 1; return 2; } + +void RatesAnalysisAlg::writeMetadata() { + if (!m_metadataTree) { + return; + } + + m_metadataTree->Branch("targetMu", &m_targetMu); + m_metadataTree->Branch("targetBunches", &m_targetBunches); + m_metadataTree->Branch("targetLumi", &m_targetLumi); + + std::vector<std::string> triggers; + std::vector<std::string> lowers; + std::vector<double> prescales; + triggers.reserve(m_existingTriggers.size()); + lowers.reserve(m_existingTriggers.size()); + prescales.reserve(m_existingTriggers.size()); + for (const auto& entry : m_existingTriggers) { + triggers.push_back( entry.first ); + lowers.push_back( m_lowerTrigger[entry.first] ); + prescales.push_back( entry.second->getPrescale() ); + } + m_metadataTree->Branch("triggers", &triggers); + m_metadataTree->Branch("lowers", &lowers); + m_metadataTree->Branch("prescales", &prescales); + + std::vector<int32_t> bunchGroups; + bunchGroups.reserve(16); + uint32_t masterKey = 0; + uint32_t hltPrescaleKey = 0; + uint32_t lvl1PrescaleKey = 0; + + if(m_configSvc.isValid()) { + const TrigConf::BunchGroupSet* bgs = m_configSvc->bunchGroupSet(); + for (const TrigConf::BunchGroup& bg : bgs->bunchGroups()) { + bunchGroups.push_back(bg.bunches().size()); + } + masterKey = m_configSvc->masterKey(); + hltPrescaleKey = m_configSvc->hltPrescaleKey(); + lvl1PrescaleKey = m_configSvc->lvl1PrescaleKey(); + } + + if (bunchGroups.size() == 0) { + for (size_t i = 0; i < 16; ++i) { + bunchGroups.push_back(0); + } + } + m_metadataTree->Branch("bunchGroups", &bunchGroups); + + m_metadataTree->Branch("masterKey", &masterKey); + m_metadataTree->Branch("lvl1PrescaleKey", &lvl1PrescaleKey); + m_metadataTree->Branch("hltPrescaleKey", &hltPrescaleKey); + + std::string atlasProject = std::getenv("AtlasProject"); + std::string atlasVersion = std::getenv("AtlasVersion"); + m_metadataTree->Branch("AtlasProject", &atlasProject); + m_metadataTree->Branch("AtlasVersion", &atlasVersion); + + m_metadataTree->Fill(); + +} diff --git a/Trigger/TrigCost/RatesAnalysis/src/RatesGroup.cxx b/Trigger/TrigCost/RatesAnalysis/src/RatesGroup.cxx index 6ff11843b9517854f9dfdd25a61db7c183f6d6c4..0bebdfc9092fc636233d396399bfc7eaf14afbe4 100644 --- a/Trigger/TrigCost/RatesAnalysis/src/RatesGroup.cxx +++ b/Trigger/TrigCost/RatesAnalysis/src/RatesGroup.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RatesAnalysis/RatesGroup.h" @@ -96,7 +96,7 @@ void RatesGroup::execute(const WeightingValuesSummary_t& weights) { double weightHLT_AND = 1.; std::unordered_map<size_t, RatesCPS> weightHLT_CPS; // Map of CPS-group-hash to RatesCPS accumulators - for (const auto& trigger : triggers) { // + for (const auto& trigger : triggers) { // if (trigger->getPassed()) { const double trigPrescaleReciprocal = 1. / trigger->getPrescale( m_isExpressGroup ); @@ -165,8 +165,8 @@ void RatesGroup::execute(const WeightingValuesSummary_t& weights) { m_rateVsTrainCachedPtr->Fill(weights.m_distanceInTrain, wOR); } if (m_dataCachedPtr != nullptr) { - m_dataCachedPtr->Fill(RatesBinIdentifier_t::kRATE_BIN_OR, wOR); - m_dataCachedPtr->Fill(RatesBinIdentifier_t::kRATE_BIN_AND, wAND); + if (!isZero(wOR)) m_dataCachedPtr->Fill(RatesBinIdentifier_t::kPASS_WEIGHTED_OR_BIN, wOR); + if (!isZero(wAND)) m_dataCachedPtr->Fill(RatesBinIdentifier_t::kPASS_WEIGHTED_AND_BIN, wAND); } if (m_uniqueTrigger != nullptr && m_uniqueTrigger->getDataHist() != nullptr) { @@ -180,3 +180,24 @@ double RatesGroup::getUniqueWeight(const double ratesDenominator) const { if (isZero(diff)) return 0.; return diff / ratesDenominator; } + +void RatesGroup::setExpressGroup(const bool i) { m_isExpressGroup = i; } + +void RatesGroup::setDoCachedWeights(const bool i) { m_doCachedWeights = i; } + +void RatesGroup::setUseCachedWeights(const bool i) { m_useCachedWeights = i; } + +void RatesGroup::duplicateChildren(const RatesGroup* toDuplicate) { + m_children = toDuplicate->getChildren(); m_masterGroup = toDuplicate; +} + +double RatesGroup::getCachedWeight(const size_t l1Hash) const { return m_cachedWeights.at(l1Hash); } + +void RatesGroup::setUniqueTrigger(RatesTrigger* trigger) { m_uniqueTrigger = trigger; } + +RatesTrigger* RatesGroup::getUniqueTrigger() { return m_uniqueTrigger; } + +const std::unordered_map<size_t, std::set<const RatesTrigger*>>& RatesGroup::getChildren() const { + return m_children; +} + diff --git a/Trigger/TrigCost/RatesAnalysis/src/RatesHistoBase.cxx b/Trigger/TrigCost/RatesAnalysis/src/RatesHistoBase.cxx index de0df84496f34a34d987babe6d73f9176f4abdf3..a79705714d1e42dc95de742d26035bb7ceb61295 100644 --- a/Trigger/TrigCost/RatesAnalysis/src/RatesHistoBase.cxx +++ b/Trigger/TrigCost/RatesAnalysis/src/RatesHistoBase.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RatesAnalysis/RatesHistoBase.h" @@ -16,14 +16,17 @@ RatesHistoBase::RatesHistoBase(const std::string& name, const MsgStream& log, co if (doHistograms) { m_rateVsMu = std::make_unique<TH1D>("",TString(name + ";#mu;Rate / Unit #mu [Hz]"),226,-.5,225.5); m_rateVsMu->Sumw2(true); + m_rateVsMu->SetName("rateVsMu"); m_rateVsMuCachedPtr = m_rateVsMu.get(); m_rateVsTrain = std::make_unique<TH1D>("",TString(name + ";Distance Into Train;Rate / BCID [Hz]"),100,-0.5,99.5); m_rateVsTrain->Sumw2(true); + m_rateVsTrain->SetName("rateVsTrain"); m_rateVsTrainCachedPtr = m_rateVsTrain.get(); m_data = std::make_unique<TH1D>("",TString(";Variable;Raw Data"), RatesBinIdentifier_t::kNRATES_BINS, -.5, RatesBinIdentifier_t::kNRATES_BINS - .5); m_data->Sumw2(true); + m_data->SetName("data"); m_dataCachedPtr = m_data.get(); } diff --git a/Trigger/TrigCost/RatesAnalysis/src/RatesTrigger.cxx b/Trigger/TrigCost/RatesAnalysis/src/RatesTrigger.cxx index 30ebd1922356c5abdf56bcaaf2e7493ffe78952e..9d1ee4b1e88436e3fb6c30bd6f36a7fc9be102c7 100644 --- a/Trigger/TrigCost/RatesAnalysis/src/RatesTrigger.cxx +++ b/Trigger/TrigCost/RatesAnalysis/src/RatesTrigger.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "RatesAnalysis/RatesTrigger.h" @@ -8,8 +8,9 @@ RatesTrigger::RatesTrigger(const std::string& name, const MsgStream& log, const double prescale, const double expressPrescale, const std::string& seedName, const double seedPrescale, const bool doHistograms, const ExtrapStrat_t extrapolation) : - RatesHistoBase(name, log, (prescale < 1. || seedPrescale < 1. ? false : doHistograms)), + RatesHistoBase(name, log, doHistograms), m_pass(false), + m_active(false), m_seedsFromRandom(false), m_rateAccumulator(0.), m_rateAccumulator2(0.), @@ -32,36 +33,60 @@ RatesTrigger::RatesTrigger(const std::string& name, const MsgStream& log, const RatesTrigger::~RatesTrigger() {} -void RatesTrigger::setPassed(const bool i, const bool unbiasedEvent) { +void RatesTrigger::setPassed(const bool passed, const bool active, const bool unbiasedEvent) { if (m_seedsFromRandom == true && unbiasedEvent == false) return; - m_pass = i; + if (m_active && !m_pass) throw std::runtime_error("Cannot pass if not active"); + m_pass = passed; + m_active = active; } -void RatesTrigger::setPassedAndExecute(const bool i, const WeightingValuesSummary_t& weights) { +void RatesTrigger::setPassedAndExecute(const bool passed, const bool active, const WeightingValuesSummary_t& weights) { if (m_seedsFromRandom == true && weights.m_isUnbiased == false) return; - if (m_pass == false) { // Protect against two positive calls/event - m_pass = i; + if (m_pass == false && m_active == false) { // Protect against two positive calls/event + if (m_active && !m_pass) throw std::runtime_error("Cannot pass if not active"); + m_pass = passed; + m_active = active; execute(weights); } } + void RatesTrigger::execute(const WeightingValuesSummary_t& weights) { - if (m_pass == false) return; - double w = m_totalPrescaleWeight * weights.m_enhancedBiasWeight; - // The vs. mu histogram is a property of the INPUT event so we don't apply any L scaling here - if (m_rateVsMuCachedPtr != nullptr) m_rateVsMuCachedPtr->Fill(weights.m_eventMu, w); - w *= getExtrapolationFactor(weights, m_extrapolationStrategy); - // The vs. position in train is agnostic to INPUT event & TARGET conditions - i.e. the bunch train structure is not - // re-weighted in any way. Hence we can apply whatever extrapolation strategy we want here. - if (m_rateVsTrainCachedPtr != nullptr) m_rateVsTrainCachedPtr->Fill(weights.m_distanceInTrain, w); - m_rateAccumulator += w; - m_rateAccumulator2 += w * w; - if (m_dataCachedPtr != nullptr) m_dataCachedPtr->Fill(RatesBinIdentifier_t::kRATE_BIN_OR, w); - if (m_expressPrescale >= 1) { - const double wExp = m_totalPrescaleWeightExpress * weights.m_enhancedBiasWeight * getExtrapolationFactor(weights, m_extrapolationStrategy); - m_rateExpressAccumulator += wExp; - m_rateExpressAccumulator2 += wExp * wExp; - if (m_dataCachedPtr != nullptr) m_dataCachedPtr->Fill(RatesBinIdentifier_t::kEXPRESS_BIN, wExp); + // Efficiency + if (getDisabled()) { + return; + } + + const double w_noLScale = m_totalPrescaleWeight * weights.m_enhancedBiasWeight; + const double w = w_noLScale * getExtrapolationFactor(weights, m_extrapolationStrategy); + const double wExp = m_totalPrescaleWeightExpress * weights.m_enhancedBiasWeight * getExtrapolationFactor(weights, m_extrapolationStrategy); + + if (m_active) { + m_ratesActive += w; + m_ratesActive2 += w * w; + if (m_dataCachedPtr != nullptr) { + m_dataCachedPtr->Fill(RatesBinIdentifier_t::kACTIVE_RAW_BIN, 1.); + m_dataCachedPtr->Fill(RatesBinIdentifier_t::kACTIVE_WEIGHTED_BIN, w); + } + } + + if (m_pass) { + // The vs. mu histogram is a property of the INPUT event so we don't apply any L scaling here + if (m_rateVsMuCachedPtr != nullptr) m_rateVsMuCachedPtr->Fill(weights.m_eventMu, w_noLScale); + // The vs. position in train is agnostic to INPUT event & TARGET conditions - i.e. the bunch train structure is not + // re-weighted in any way. Hence we can apply whatever extrapolation strategy we want here. + if (m_rateVsTrainCachedPtr != nullptr) m_rateVsTrainCachedPtr->Fill(weights.m_distanceInTrain, w); + m_rateAccumulator += w; + m_rateAccumulator2 += w * w; + if (m_dataCachedPtr != nullptr) { + m_dataCachedPtr->Fill(RatesBinIdentifier_t::kPASS_RAW_BIN, 1.); + m_dataCachedPtr->Fill(RatesBinIdentifier_t::kPASS_WEIGHTED_OR_BIN, w); + } + if (m_expressPrescale >= 1) { + m_rateExpressAccumulator += wExp; + m_rateExpressAccumulator2 += wExp * wExp; + if (m_dataCachedPtr != nullptr) m_dataCachedPtr->Fill(RatesBinIdentifier_t::kEXPRESS_BIN, wExp); + } } } @@ -113,3 +138,32 @@ const std::string RatesTrigger::printExpressRate(const double ratesDenominator) return ss.str(); } +void RatesTrigger::reset() { m_pass = false; m_active = false; } + +void RatesTrigger::setSeedsFromRandom(const bool i) { m_seedsFromRandom = i; } + +size_t RatesTrigger::getSeedHash() const { return m_seedHash; } + +const std::string& RatesTrigger::getSeedName() const { return m_seed; } + +double RatesTrigger::getSeedPrescale() const { return m_seedPrescale; } + +size_t RatesTrigger::getHash() const { return m_nameHash; } + +const std::string& RatesTrigger::getName() const { return m_name; } + +bool RatesTrigger::getPassed() const { return m_pass; } + +bool RatesTrigger::getActive() const { return m_active; } + +bool RatesTrigger::getDisabled() const { return (isZero(m_prescale) || isZero(m_seedPrescale)); } + +void RatesTrigger::setUniqueGroup(const RatesGroup* unique) { m_uniqueGroup = unique; } + +void RatesTrigger::setCoherentFactor(const double lowestCommonPrescale) { m_coherentFactor = lowestCommonPrescale; } + +void RatesTrigger::setCPS(const std::string& group) { m_CPSID = std::hash<std::string>{}(group); } + +size_t RatesTrigger::getCPSID() const { return m_CPSID; } + +double RatesTrigger::getCoherentFactor() const { return m_coherentFactor; } diff --git a/Trigger/TrigCost/RatesAnalysis/test/RatesAnalysis_test.cxx b/Trigger/TrigCost/RatesAnalysis/test/RatesAnalysis_test.cxx index 6897e217e6439e81b139ba553c718a53bb180b3d..769dc3a68f7f0dbaf8afff8cd5b1cec428b075eb 100644 --- a/Trigger/TrigCost/RatesAnalysis/test/RatesAnalysis_test.cxx +++ b/Trigger/TrigCost/RatesAnalysis/test/RatesAnalysis_test.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "../RatesAnalysis/RatesTrigger.h" @@ -42,10 +42,11 @@ int main() { // simulate event one - triggerA1->setPassedAndExecute(true, wvs); - triggerA2->setPassedAndExecute(true, wvs); - triggerB1->setPassedAndExecute(true, wvs); - triggerB2->setPassedAndExecute(true, wvs); + triggerA1->setPassedAndExecute(true, true, wvs); + triggerA2->setPassedAndExecute(true, true, wvs); + + triggerB1->setPassedAndExecute(true, true, wvs); + triggerB2->setPassedAndExecute(true, true, wvs); groupA->execute(wvs); groupB->execute(wvs); @@ -59,23 +60,35 @@ int main() { wvs.m_enhancedBiasWeight = 1000; - triggerA1->setPassedAndExecute(true, wvs); - triggerA2->setPassedAndExecute(true, wvs); + triggerA1->setPassedAndExecute(true, true, wvs); + triggerA2->setPassedAndExecute(true, true, wvs); + + triggerB1->setPassedAndExecute(false, false, wvs); + triggerB2->setPassedAndExecute(false, false, wvs); groupA->execute(wvs); + groupB->execute(wvs); triggerA1->reset(); triggerA2->reset(); + triggerB1->reset(); + triggerB2->reset(); // simulate event three wvs.m_enhancedBiasWeight = 500; - triggerB1->setPassedAndExecute(true, wvs); - triggerB2->setPassedAndExecute(true, wvs); + triggerA1->setPassedAndExecute(false, false, wvs); + triggerA2->setPassedAndExecute(false, false, wvs); + + triggerB1->setPassedAndExecute(true, true, wvs); + triggerB2->setPassedAndExecute(true, true, wvs); + groupA->execute(wvs); groupB->execute(wvs); + triggerA1->reset(); + triggerA2->reset(); triggerB1->reset(); triggerB2->reset(); @@ -83,14 +96,19 @@ int main() { wvs.m_enhancedBiasWeight = 10; - triggerA1->setPassedAndExecute(true, wvs); - triggerB1->setPassedAndExecute(true, wvs); + triggerA1->setPassedAndExecute(true, true, wvs); + triggerA2->setPassedAndExecute(false, true, wvs); + + triggerB1->setPassedAndExecute(true, true, wvs); + triggerB2->setPassedAndExecute(false, true, wvs); groupA->execute(wvs); groupB->execute(wvs); triggerA1->reset(); + triggerA2->reset(); triggerB1->reset(); + triggerB2->reset(); // end diff --git a/Trigger/TrigFTK/FTK_DataProviderSvc/CMakeLists.txt b/Trigger/TrigFTK/FTK_DataProviderSvc/CMakeLists.txt index 67b020acafa89f84c4f449d5d36b046ca69960d6..aecfadda81e75b6fef91b13e0ca163f6b2f67076 100644 --- a/Trigger/TrigFTK/FTK_DataProviderSvc/CMakeLists.txt +++ b/Trigger/TrigFTK/FTK_DataProviderSvc/CMakeLists.txt @@ -34,6 +34,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/PixelConditionsTools InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetRecTools/InDetRecToolInterfaces Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkParameters @@ -60,12 +61,12 @@ atlas_add_library( FTK_DataProviderSvcLib PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps xAODTracking GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkTrack FTK_DataProviderInterfaces TrigFTK_RawData StoreGateLib SGtests - PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AtlasDetDescr GeoPrimitives IRegionSelector RoiDescriptor EventInfo GeneratorObjects InDetIdentifier InDetReadoutGeometry InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces TrkVertexFitterInterfaces TrkFitterUtils TrkToolInterfaces PixelConditionsData) + PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AtlasDetDescr GeoPrimitives IRegionSelector RoiDescriptor EventInfo GeneratorObjects InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces TrkVertexFitterInterfaces TrkFitterUtils TrkToolInterfaces PixelConditionsData) atlas_add_component( FTK_DataProviderSvc src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps StoreGateLib SGtests xAODTracking GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkTrack FTK_DataProviderInterfaces TrigFTK_RawData AtlasDetDescr GeoPrimitives IRegionSelector RoiDescriptor EventInfo GeneratorObjects InDetIdentifier InDetReadoutGeometry InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces TrkVertexFitterInterfaces TrkFitterUtils TrkToolInterfaces FTK_DataProviderSvcLib PixelConditionsData) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps StoreGateLib SGtests xAODTracking GaudiKernel InDetPrepRawData InDetRIO_OnTrack TrkTrack FTK_DataProviderInterfaces TrigFTK_RawData AtlasDetDescr GeoPrimitives IRegionSelector RoiDescriptor EventInfo GeneratorObjects InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry InDetRecToolInterfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTrackSummary TrkTruthData TrkFitterInterfaces TrkVertexFitterInterfaces TrkFitterUtils TrkToolInterfaces FTK_DataProviderSvcLib PixelConditionsData) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx b/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx index d69956cb9dddcfabadd30f62dcfb65eba53bfda4..04f9d71d1eed450a1b18f2cd44d7aa492704a89e 100644 --- a/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx +++ b/Trigger/TrigFTK/FTK_DataProviderSvc/src/FTK_DataProviderSvc.cxx @@ -8,7 +8,7 @@ #include "InDetIdentifier/PixelID.h" #include "StoreGate/ReadCondHandle.h" #include "InDetBeamSpotService/IBeamCondSvc.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SCT_ModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_BarrelModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_ForwardModuleSideDesign.h" diff --git a/Trigger/TrigFTK/FTK_RecTools/CMakeLists.txt b/Trigger/TrigFTK/FTK_RecTools/CMakeLists.txt index c04aedccbae556bffdef78d5810395d33f513e82..9f72cb8b24ac1bafc3b61c98d5e7043b743e3d8d 100644 --- a/Trigger/TrigFTK/FTK_RecTools/CMakeLists.txt +++ b/Trigger/TrigFTK/FTK_RecTools/CMakeLists.txt @@ -34,6 +34,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/PixelConditionsData InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetDetDescr/PixelGeoModel InnerDetector/InDetRecTools/SiClusterizationTool Tracking/TrkDetDescr/TrkSurfaces ) @@ -50,12 +51,12 @@ atlas_add_library( FTK_RecToolsLib PUBLIC_HEADERS FTK_RecTools INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives xAODTracking TrkTrack VxVertex FTK_DataProviderInterfaces TrigFTK_RawData TrkVxEdmCnvLib TrigFTKSimLib InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry SiClusterizationToolLib TrkSurfaces PixelConditionsData) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives xAODTracking TrkTrack VxVertex FTK_DataProviderInterfaces TrigFTK_RawData TrkVxEdmCnvLib TrigFTKSimLib InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SiClusterizationToolLib TrkSurfaces PixelConditionsData) atlas_add_component( FTK_RecTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives xAODTracking TrkTrack VxVertex TrkVxEdmCnvLib FTK_DataProviderInterfaces TrigFTK_RawData TrigFTKSimLib TrkParameters FTK_RecToolsLib InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry SiClusterizationToolLib TrkSurfaces PixelConditionsData) + LINK_LIBRARIES ${ROOT_LIBRARIES} ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GeoPrimitives xAODTracking TrkTrack VxVertex TrkVxEdmCnvLib FTK_DataProviderInterfaces TrigFTK_RawData TrigFTKSimLib TrkParameters FTK_RecToolsLib InDetPrepRawData InDetRIO_OnTrack TrkParameters TrkToolInterfaces TrkAmbiguityProcessorLib StoreGateLib SGtests EventPrimitives InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SiClusterizationToolLib TrkSurfaces PixelConditionsData) diff --git a/Trigger/TrigFTK/FTK_RecTools/src/FTK_HashIDTool.cxx b/Trigger/TrigFTK/FTK_RecTools/src/FTK_HashIDTool.cxx index caae36097a95c5b0aef49257962c380a5fcd40e0..9b23a9351d6076c60662e7fb72db333c686baf2d 100644 --- a/Trigger/TrigFTK/FTK_RecTools/src/FTK_HashIDTool.cxx +++ b/Trigger/TrigFTK/FTK_RecTools/src/FTK_HashIDTool.cxx @@ -13,7 +13,7 @@ #include "AtlasDetDescr/AtlasDetectorID.h" #include "InDetIdentifier/SCT_ID.h" #include "InDetIdentifier/PixelID.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SCT_ModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_BarrelModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_ForwardModuleSideDesign.h" diff --git a/Trigger/TrigFTK/FTK_RecTools/src/FTK_PixelClusterOnTrackTool.cxx b/Trigger/TrigFTK/FTK_RecTools/src/FTK_PixelClusterOnTrackTool.cxx index f56b243a47562f9c12c8c22cbaaa40554c4d27fb..87cdc8273b6bc48a9883d6d09f6a6cd391869845 100644 --- a/Trigger/TrigFTK/FTK_RecTools/src/FTK_PixelClusterOnTrackTool.cxx +++ b/Trigger/TrigFTK/FTK_RecTools/src/FTK_PixelClusterOnTrackTool.cxx @@ -12,7 +12,7 @@ /////////////////////////////////////////////////////////////////// #include "FTK_RecTools/FTK_PixelClusterOnTrackTool.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetIdentifier/PixelID.h" #include "TrkSurfaces/PlaneSurface.h" #include "EventPrimitives/EventPrimitives.h" diff --git a/Trigger/TrigFTK/TrigFTK_RawDataAlgs/CMakeLists.txt b/Trigger/TrigFTK/TrigFTK_RawDataAlgs/CMakeLists.txt index c8acfcaa426e35acd46ea28543206603cec3efb2..07fd249e4f216575cbe2d96b67b3886abea483b0 100644 --- a/Trigger/TrigFTK/TrigFTK_RawDataAlgs/CMakeLists.txt +++ b/Trigger/TrigFTK/TrigFTK_RawDataAlgs/CMakeLists.txt @@ -26,6 +26,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetRecEvent/InDetRIO_OnTrack InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDecr/PixelReadoutGeometry Tracking/TrkEvent/TrkTrack Tracking/TrkEvent/TrkTrackSummary Trigger/TrigFTK/FTK_RecToolInterfaces @@ -40,12 +41,12 @@ atlas_add_library( TrigFTK_RawDataAlgsLib PUBLIC_HEADERS TrigFTK_RawDataAlgs INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps GaudiKernel TrkEventPrimitives FTK_DataProviderInterfaces TrigFTKPool TrigFTK_RawData PileUpToolsLib TrigFTKSimLib InDetRIO_OnTrack - PRIVATE_LINK_LIBRARIES AtlasDetDescr EventInfo xAODTracking xAODTruth InDetIdentifier InDetReadoutGeometry TrkTrack TrkTrackSummary TrkToolInterfaces VxVertex PixelConditionsData ) + PRIVATE_LINK_LIBRARIES AtlasDetDescr EventInfo xAODTracking xAODTruth InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry TrkTrack TrkTrackSummary TrkToolInterfaces VxVertex PixelConditionsData ) atlas_add_component( TrigFTK_RawDataAlgs src/components/*.cxx INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} - LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps PileUpToolsLib GaudiKernel TrkEventPrimitives FTK_DataProviderInterfaces TrigFTKPool TrigFTKSimLib InDetRIO_OnTrack TrigFTK_RawData AtlasDetDescr EventInfo xAODTracking xAODTruth InDetIdentifier InDetReadoutGeometry TrkTrack TrkTrackSummary VxVertex TrigFTK_RawDataAlgsLib PixelConditionsData TrkToolInterfaces) + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps PileUpToolsLib GaudiKernel TrkEventPrimitives FTK_DataProviderInterfaces TrigFTKPool TrigFTKSimLib InDetRIO_OnTrack TrigFTK_RawData AtlasDetDescr EventInfo xAODTracking xAODTruth InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry TrkTrack TrkTrackSummary VxVertex TrigFTK_RawDataAlgsLib PixelConditionsData TrkToolInterfaces) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTKTrackMakerMT.cxx b/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTKTrackMakerMT.cxx index 4b0c7f6c6c524a4bf7b461f9e7e6b8066194e029..7804c07f41135836a347802e1c469e8b6d3d046a 100644 --- a/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTKTrackMakerMT.cxx +++ b/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTKTrackMakerMT.cxx @@ -22,7 +22,7 @@ #include "InDetIdentifier/SCT_ID.h" #include "InDetIdentifier/PixelID.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SCT_ModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_BarrelModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_ForwardModuleSideDesign.h" diff --git a/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTK_RDO_MonitorAlgo.cxx b/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTK_RDO_MonitorAlgo.cxx index 97b9db6ae4b10bb038f897da88ef2973b2d87bb2..923b3d5880fa2de1714675b226a9276f459f3687 100644 --- a/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTK_RDO_MonitorAlgo.cxx +++ b/Trigger/TrigFTK/TrigFTK_RawDataAlgs/src/FTK_RDO_MonitorAlgo.cxx @@ -10,7 +10,7 @@ #include "InDetIdentifier/PixelID.h" #include "InDetIdentifier/SCT_ID.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SCT_BarrelModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_ForwardModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_ModuleSideDesign.h" diff --git a/Trigger/TrigHypothesis/TrigAFPHypo/src/TrigAFPJetAllTE.cxx b/Trigger/TrigHypothesis/TrigAFPHypo/src/TrigAFPJetAllTE.cxx index 0407bacb0f39ccb0b7eccd6d19f04e1f72431bda..4a4db0ee8534e893af9a39484be2594e6b4801e3 100644 --- a/Trigger/TrigHypothesis/TrigAFPHypo/src/TrigAFPJetAllTE.cxx +++ b/Trigger/TrigHypothesis/TrigAFPHypo/src/TrigAFPJetAllTE.cxx @@ -109,9 +109,7 @@ HLT::ErrorCode TrigAFPJetAllTE::hltInitialize() { return HLT::OK; } -struct DescendingEt: std::binary_function<const xAOD::Jet*, - const xAOD::Jet*, - bool> { +struct DescendingEt { bool operator () (const xAOD::Jet* l, const xAOD::Jet* r) const { return l->p4().Et() > r->p4().Et(); } diff --git a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFMtAllTE.cxx b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFMtAllTE.cxx index 4e680975f39167283de908749b53ddeaa54b1e69..548b711e6ec9ec84c27a13d05078f8ea5a4ffd5a 100755 --- a/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFMtAllTE.cxx +++ b/Trigger/TrigHypothesis/TrigEgammaHypo/src/TrigEFMtAllTE.cxx @@ -21,9 +21,7 @@ using namespace std; -struct DescendingEt:std::binary_function<const xAOD::Electron*, - const xAOD::Electron*, - bool> { +struct DescendingEt { bool operator()(const xAOD::Electron* l, const xAOD::Electron* r) const { return l->p4().Et() > r->p4().Et(); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DescendingEt.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DescendingEt.h index 6a88c24eb365f8b154b66b0c6de40fda0a0b1251..92d2ef0f1411c6a4c9b114ba826fa801da7fb625 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DescendingEt.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/TrigHLTJetHypo/TrigHLTJetHypoUtils/DescendingEt.h @@ -17,8 +17,7 @@ #include "TrigHLTJetHypo/TrigHLTJetHypoUtils/HypoJetDefs.h" -struct DescendingEt: - public std::binary_function<pHypoJet, pHypoJet, bool> +struct DescendingEt { bool operator()(pHypoJet l, pHypoJet r) const; }; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFDPhiMetJetAllTE.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFDPhiMetJetAllTE.cxx index e027e7ba83a85cc17453f7c6a9e4ee95e9951d5b..d7d1642b07dde6f04560566d2f13ad3da7299362 100755 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFDPhiMetJetAllTE.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/TrigEFDPhiMetJetAllTE.cxx @@ -66,9 +66,7 @@ HLT::ErrorCode TrigEFDPhiMetJetAllTE::hltInitialize() return HLT::OK; } -struct DescendingEt:std::binary_function<const xAOD::Jet*, - const xAOD::Jet*, - bool> { +struct DescendingEt { bool operator()(const xAOD::Jet* l, const xAOD::Jet* r) const { return l->p4().Et() > r->p4().Et(); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_av_times.py b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_av_times.py index 08ea2c3e22c05752f78d4621da2c8a22a61d5f92..4c68e7deb34f2ff9feb6cd35ee6c52ddb9909983 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_av_times.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_av_times.py @@ -1,3 +1,4 @@ +from __future__ import print_function from plot_times import times import pylab as pl import sys @@ -5,7 +6,7 @@ import os import glob if len(sys.argv) < 3: - print 'Please supply an input file name stub to glob on the command line, and an output file name' + print('Please supply an input file name stub to glob on the command line, and an output file name') sys.exit(0) @@ -14,9 +15,9 @@ outname = sys.argv[2] if not outname.endswith('.pdf'): outname += '.pdf' fns = glob.glob(stub) -print 'glob found %d files: %s for stub %s' % (len(fns), str(fns), stub) +print('glob found %d files: %s for stub %s' % (len(fns), str(fns), stub)) if not fns: - print 'no files found for stub', stub + print('no files found for stub', stub) sys.exit() def get_av(fn): @@ -26,12 +27,12 @@ def get_av(fn): av_times = [get_av(fn) for fn in fns] def get_nbkgd(fn): - print fn + print(fn) x = fn.split('.')[0] # remove .log toks = x.split('_') x = [t for t in toks if t.startswith('b')][0] x = x[1:] # remove 'b' - print x + print(x) return float(x) n_bkgd = [get_nbkgd(fn) for fn in fns] diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_times.py b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_times.py index dcbd0ca98fdaa2130be6aad234cdaf1a0e0b8d33..7acac9d6a44b573b98dac5144a5dc947ad8fd158 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_times.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_times.py @@ -1,3 +1,4 @@ +from __future__ import print_function import pylab as pl import sys import os @@ -19,13 +20,13 @@ def times(fn): if __name__ == '__main__': if len(sys.argv) < 2: - print 'Please supply an input file name on the command line' + print('Please supply an input file name on the command line') sys.exit(0) fn = sys.argv[1] if not os.path.exists(fn): - print 'unknown file. giving up: ', fn + print('unknown file. giving up: ', fn) sys.exit(0) x = times(fn) # print x diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_tot_times.py b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_tot_times.py index 1d4beb41a57a82e68e4f68bd1f030c67a9f02480..ef4c961c30233268245ac597c68e3d2fcffb941d 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_tot_times.py +++ b/Trigger/TrigHypothesis/TrigHLTJetHypoUnitTests/python/plot_tot_times.py @@ -1,3 +1,4 @@ +from __future__ import print_function from plot_times import times import pylab as pl import sys @@ -7,7 +8,7 @@ from collections import defaultdict import itertools if len(sys.argv) < 3: - print 'Please supply an input file name stub to glob on the command line, and an output file name' + print('Please supply an input file name stub to glob on the command line, and an output file name') sys.exit(0) @@ -16,29 +17,29 @@ outname = sys.argv[2] if not outname.endswith('.pdf'): outname += '.pdf' fns = glob.glob(stub) -print 'glob found %d files: %s for stub %s' % (len(fns), str(fns), stub) +print('glob found %d files: %s for stub %s' % (len(fns), str(fns), stub)) if not fns: - print 'no files found for stub', stub + print('no files found for stub', stub) sys.exit() def get_tot(fn): - print 'processing ', fn + print('processing ', fn) t = times(fn) # return sum(t)/float(len(t)) return sum(t) def get_nbkgd(fn): - print fn + print(fn) x = fn.split('.')[0] # remove .log toks = x.split('_') x = [t for t in toks if t.startswith('b')][0] x = x[1:] # remove 'b' - print x + print(x) return float(x) def plot_by_fn_type(fn_list, marker, label): - print 'plotting', fn_list + print('plotting', fn_list) tot_times = [get_tot(fn) for fn in fn_list] n_bkgd = [get_nbkgd(fn) for fn in fn_list] @@ -54,17 +55,17 @@ for fn in fns: fn_types[key].append(fn) markers = itertools.cycle(('ro','bo')) -print -print 'fn_types:' +print() +print('fn_types:') for k, v in fn_types.items(): - print k - print ' ', v + print(k) + print(' ', v) -print +print() for k, v in fn_types.items(): - print k - print ' ' + str(v) - plot_by_fn_type(v, markers.next(), label=k) + print(k) + print(' ' + str(v)) + plot_by_fn_type(v, next(markers), label=k) pl.suptitle(outname[:-4]) diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/CMakeLists.txt b/Trigger/TrigHypothesis/TrigMuonHypoMT/CMakeLists.txt index 3c41eeeac2a79f511ea8261eaaaabb725586bb9f..77a69834bcd2aa667cf632466c50ae79e956de46 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/CMakeLists.txt +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/CMakeLists.txt @@ -14,6 +14,7 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigT1/TrigT1Interfaces Control/AthenaMonitoringKernel Event/xAOD/xAODMuon + PhysicsAnalysis/Interfaces/MuonAnalysisInterfaces GaudiKernel ) # External dependencies: diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/python/TrigMuonHypoMTConfig.py b/Trigger/TrigHypothesis/TrigMuonHypoMT/python/TrigMuonHypoMTConfig.py index d3e8914c8ff91bc2a1fa1612165d4c512c26634b..135eb8f7611a43416320ec84aeadc2e68965348f 100755 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/python/TrigMuonHypoMTConfig.py +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/python/TrigMuonHypoMTConfig.py @@ -390,6 +390,7 @@ def TrigmuCombHypoToolFromDict( chainDict ): thresholds = ['passthrough'] else: thresholds = getThresholdsFromDict( chainDict ) + config = TrigmuCombHypoConfig() tight = False # can be probably decoded from some of the proprties of the chain, expert work @@ -434,7 +435,6 @@ class TrigmuCombHypoConfig(object): tool.MaxChi2IDPik = 3.5 except LookupError: raise Exception('MuComb Hypo Misconfigured: threshold %r not supported' % thvaluename) - return tool @@ -551,8 +551,14 @@ def TrigMuonEFCombinerHypoToolFromDict( chainDict ) : thresholds = ['passthrough'] else: thresholds = getThresholdsFromDict( chainDict ) + + if 'muonqual' in chainDict['chainParts'][0]['chainPartName']: + muonquality = True + else: + muonquality = False + config = TrigMuonEFCombinerHypoConfig() - tool = config.ConfigurationHypoTool( chainDict['chainName'], thresholds ) + tool = config.ConfigurationHypoTool( chainDict['chainName'], thresholds , muonquality) addMonitoring( tool, TrigMuonEFCombinerHypoMonitoring, "TrigMuonEFCombinerHypoTool", chainDict['chainName'] ) return tool @@ -573,8 +579,14 @@ def TrigMuonEFCombinerHypoToolFromName(chainDict): if 'noL1' in part: thr =thr.replace('noL1','') thresholds.append(thr) + if 'muonqual' in chainName: + muonquality = True + else: + muonquality = False + config = TrigMuonEFCombinerHypoConfig() - tool = config.ConfigurationHypoTool(chainDict['chainName'], thresholds) + + tool = config.ConfigurationHypoTool(chainDict['chainName'], thresholds, muonquality) addMonitoring( tool, TrigMuonEFCombinerHypoMonitoring, "TrigMuonEFCombinerHypoTool", chainDict['chainName'] ) return tool @@ -582,7 +594,7 @@ class TrigMuonEFCombinerHypoConfig(object): log = logging.getLogger('TrigMuonEFCombinerHypoConfig') - def ConfigurationHypoTool( self, thresholdHLT, thresholds ): + def ConfigurationHypoTool( self, thresholdHLT, thresholds, muonquality ): tool = TrigMuonEFCombinerHypoTool( thresholdHLT ) @@ -590,7 +602,8 @@ class TrigMuonEFCombinerHypoConfig(object): log.debug('Set %d thresholds', nt) tool.PtBins = [ [ 0, 2.5 ] ] * nt tool.PtThresholds = [ [ 5.49 * GeV ] ] * nt - + + tool.MuonQualityCut = muonquality for th, thvalue in enumerate(thresholds): thvaluename = thvalue + 'GeV_v15a' diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFCombinerHypoTool.cxx b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFCombinerHypoTool.cxx index 95281a8a1f5c91c91f4f02790a1d9a23b47155bf..c74888aeba070263039bbefcf028de5013afb582 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFCombinerHypoTool.cxx +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFCombinerHypoTool.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "DecisionHandling/Combinators.h" @@ -13,6 +13,14 @@ TrigMuonEFCombinerHypoTool::TrigMuonEFCombinerHypoTool(const std::string & type, TrigMuonEFCombinerHypoTool::~TrigMuonEFCombinerHypoTool(){ } StatusCode TrigMuonEFCombinerHypoTool::initialize(){ + + if(m_muonqualityCut) { + if(m_muonSelTool.retrieve().isFailure()) { + ATH_MSG_ERROR("Unable to retrieve " << m_muonSelTool); + return StatusCode::FAILURE; + } + } else m_muonSelTool.disable(); + if(m_acceptAll) { ATH_MSG_INFO("Accepting all the events!"); } else { @@ -85,6 +93,8 @@ bool TrigMuonEFCombinerHypoTool::decideOnSingleObject(TrigMuonEFCombinerHypoTool selEta.push_back(tr->eta()); selPhi.push_back(tr->phi()); result = true; + // If trigger path name includes "muonqual", check whether the muon passes those criteria + if(m_muonqualityCut == true) result = passedQualityCuts(muon); } ATH_MSG_DEBUG(" REGTEST muon pt is " << tr->pt()/CLHEP::GeV << " GeV " << " with Charge " << tr->charge() @@ -94,6 +104,28 @@ bool TrigMuonEFCombinerHypoTool::decideOnSingleObject(TrigMuonEFCombinerHypoTool } return result; } + +bool TrigMuonEFCombinerHypoTool::passedQualityCuts(const xAOD::Muon* muon) const { + bool passCut = false; + const xAOD::TrackParticle* idtrack = muon->trackParticle( xAOD::Muon::InnerDetectorTrackParticle ); + const xAOD::TrackParticle* metrack = muon->trackParticle( xAOD::Muon::ExtrapolatedMuonSpectrometerTrackParticle ); + float mePt = -999999., idPt = -999999.; + + float reducedChi2 = -10, qOverPsignif = -10; + + if(idtrack && metrack) { + mePt = metrack->pt(); + idPt = idtrack->pt(); + float meP = 1.0 / ( sin(metrack->theta()) / mePt); + float idP = 1.0 / ( sin(idtrack->theta()) / idPt); + qOverPsignif = std::abs( (metrack->charge() / meP) - (idtrack->charge() / idP) ) / sqrt( idtrack->definingParametersCovMatrix()(4,4) + metrack->definingParametersCovMatrix()(4,4) ); + reducedChi2 = muon->primaryTrackParticle()->chiSquared()/muon->primaryTrackParticle()->numberDoF(); + // Selection criteria based on the requirements that are part of the muon quality working points (offline) + if(std::abs(reducedChi2) < 8.0 && !m_muonSelTool->isBadMuon(*muon) && qOverPsignif<7.0 && muon->author()==xAOD::Muon::MuidCo) passCut = true; + } + + return passCut; +} StatusCode TrigMuonEFCombinerHypoTool::decide(std::vector<MuonEFInfo>& toolInput) const { size_t numTrigger = m_ptBins.size(); diff --git a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFCombinerHypoTool.h b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFCombinerHypoTool.h index 9e4e5c6a81319d8681615efb591dc10a44eff8d7..28201db477db6f46cea558c048889d289c233537 100644 --- a/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFCombinerHypoTool.h +++ b/Trigger/TrigHypothesis/TrigMuonHypoMT/src/TrigMuonEFCombinerHypoTool.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGMUONHYPOMT_TRIGMUONEFCOMBINERHYPOTOOL_H @@ -9,13 +9,17 @@ #include "AthenaMonitoringKernel/GenericMonitoringTool.h" #include "xAODMuon/MuonContainer.h" #include "CLHEP/Units/SystemOfUnits.h" + +// include Muon SelectionTool for quality criteria +#include "MuonAnalysisInterfaces/IMuonSelectionTool.h" + class StoreGateSvc; class TrigMuonEFCombinerHypoTool: public ::AthAlgTool { enum { MaxNumberTools = 20 }; public: TrigMuonEFCombinerHypoTool(const std::string& type, const std::string & name, const IInterface* parent); ~TrigMuonEFCombinerHypoTool(); - + struct MuonEFInfo { MuonEFInfo( TrigCompositeUtils::Decision* d, const TrigRoiDescriptor* r, @@ -36,12 +40,15 @@ class TrigMuonEFCombinerHypoTool: public ::AthAlgTool { virtual StatusCode initialize() override; StatusCode decide(std::vector<TrigMuonEFCombinerHypoTool::MuonEFInfo>& toolInput) const ; private: + bool passedQualityCuts(const xAOD::Muon* muon) const; bool decideOnSingleObject(TrigMuonEFCombinerHypoTool::MuonEFInfo& input, size_t cutIndex) const; StatusCode inclusiveSelection(std::vector<TrigMuonEFCombinerHypoTool::MuonEFInfo>& toolInput) const; StatusCode multiplicitySelection(std::vector<TrigMuonEFCombinerHypoTool::MuonEFInfo>& toolInput) const; HLT::Identifier m_decisionId; // Properties: + Gaudi::Property< bool > m_muonqualityCut { + this, "MuonQualityCut", false, "Ignore selection" }; Gaudi::Property< std::vector<std::vector<double>> > m_ptBins { this, "PtBins", { {0, 2.5} }, "Bins range of each pT threshold" }; Gaudi::Property< std::vector<std::vector<double>> > m_ptThresholds { @@ -53,5 +60,8 @@ class TrigMuonEFCombinerHypoTool: public ::AthAlgTool { // Other members: std::vector<size_t> m_bins={0}; ToolHandle< GenericMonitoringTool > m_monTool { this, "MonTool", "", "Monitoring tool" }; + ToolHandle<CP::IMuonSelectionTool> m_muonSelTool{this, "MuonSelectionTool", "CP::MuonSelectionTool/MuonSelectionTool", "Tool for muon quality selection"}; + + }; #endif diff --git a/Trigger/TrigMonitoring/TrigBphysMonitoring/src/TrigBphysMonitorAlgorithm.cxx b/Trigger/TrigMonitoring/TrigBphysMonitoring/src/TrigBphysMonitorAlgorithm.cxx index c9f4ff430ba1be331ca53ca768d709a118546d07..b85366ffb95d12eb1c219e2f3b8b972d72053a0a 100644 --- a/Trigger/TrigMonitoring/TrigBphysMonitoring/src/TrigBphysMonitorAlgorithm.cxx +++ b/Trigger/TrigMonitoring/TrigBphysMonitoring/src/TrigBphysMonitorAlgorithm.cxx @@ -29,8 +29,9 @@ StatusCode TrigBphysMonitorAlgorithm::initialize() { ATH_CHECK( BphysContainerKey.initialize() ); m_TrigBphysContainerKeys.push_back(BphysContainerKey); } + ATH_CHECK( AthMonitorAlgorithm::initialize() ); m_mainGMT = getGroup("TrigBphysMonitor"); - return AthMonitorAlgorithm::initialize(); + return StatusCode::SUCCESS; } diff --git a/Trigger/TrigMonitoring/TrigCaloMonitoring/python/TrigCaloMonitorAlgorithm.py b/Trigger/TrigMonitoring/TrigCaloMonitoring/python/TrigCaloMonitorAlgorithm.py index b181d5d5c30f0caa05c5df6a5e07de09dd4a3b82..84150b71d18fd8a606a4e4fd14b743d3b64b07cf 100644 --- a/Trigger/TrigMonitoring/TrigCaloMonitoring/python/TrigCaloMonitorAlgorithm.py +++ b/Trigger/TrigMonitoring/TrigCaloMonitoring/python/TrigCaloMonitorAlgorithm.py @@ -12,6 +12,7 @@ def TrigCaloMonConfig(inputFlags): '''Function to configures some algorithms in the monitoring system.''' + import math # The following class will make a sequence, configure algorithms, and link # them to GenericMonitoringTools @@ -57,13 +58,13 @@ def TrigCaloMonConfig(inputFlags): L2CaloEMClustersMonGroup.defineHistogram('HLT_num',title='Number of HLT Clusters; Num Clusters; Entries', path=hist_path,xbins=51,xmin=-0.5,xmax=50.5) L2CaloEMClustersMonGroup.defineHistogram('HLT_eta,HLT_phi',title='Number of HLT Clusters; #eta; #phi; ', type='TH2F', - path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('HLT_et',title='HLT Clusters E_{T}; E_{T} [GeV]; Entries', path=hist_path,xbins=100,xmin=0.0,xmax=100.0) L2CaloEMClustersMonGroup.defineHistogram('HLT_eta',title='HLT Clusters #eta; #eta; Entries', path=hist_path,xbins=50,xmin=-5.0,xmax=5.0) L2CaloEMClustersMonGroup.defineHistogram('HLT_phi',title='HLT Cluster #phi; #phi; Entries', - path=hist_path,xbins=64,xmin=-3.14153,xmax=3.14153) + path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('HLT_size',title='HLT Cluster Size; Number of Cells; Entries', path=hist_path,xbins=91,xmin=-10.0,xmax=1810.0) @@ -71,13 +72,13 @@ def TrigCaloMonConfig(inputFlags): L2CaloEMClustersMonGroup.defineHistogram('HLT_barrel_high_et_num',title='Number of high-E_{T} HLT Clusters; Num Clusters; Entries', path=hist_path,xbins=101,xmin=-0.5,xmax=100.5) L2CaloEMClustersMonGroup.defineHistogram('HLT_barrel_high_et_eta,HLT_barrel_high_et_phi',title='Number of high-E_{T} HLT Clusters; #eta; #phi; ', type='TH2F', - path=hist_path,xbins=50,xmin=-1.5,xmax=1.5,ybins=64,ymin=-3.14153,ymax=3.14153) + path=hist_path,xbins=50,xmin=-1.5,xmax=1.5,ybins=64,ymin=-math.pi,ymax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('HLT_barrel_high_et_et',title='high-E_{T} HLT Clusters E_{T}; E_{T} [GeV]; Entries', path=hist_path,xbins=100,xmin=0.0,xmax=100.0) L2CaloEMClustersMonGroup.defineHistogram('HLT_barrel_high_et_eta',title='high-E_{T} HLT Clusters #eta; #eta; Entries', path=hist_path,xbins=50,xmin=-1.5,xmax=1.5) L2CaloEMClustersMonGroup.defineHistogram('HLT_barrel_high_et_phi',title='high-E_{T} HLT Cluster #phi; #phi; Entries', - path=hist_path,xbins=64,xmin=-3.14153,xmax=3.14153) + path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('HLT_barrel_high_et_size',title='high-E_{T} HLT Cluster Size; Number of Cells; Entries', path=hist_path,xbins=91,xmin=-10.0,xmax=1810.0) @@ -90,13 +91,13 @@ def TrigCaloMonConfig(inputFlags): L2CaloEMClustersMonGroup.defineHistogram('OFF_num',title='Number of OFF Clusters; Num Clusters; Entries', path=hist_path,xbins=101,xmin=-1.0,xmax=201.0) L2CaloEMClustersMonGroup.defineHistogram('OFF_eta,OFF_phi',title='Number of OFF Clusters; #eta; #phi; ', type='TH2F', - path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('OFF_et',title='OFF Clusters E_{T}; E_{T} [GeV]; Entries', path=hist_path,xbins=100,xmin=0.0,xmax=100.0) L2CaloEMClustersMonGroup.defineHistogram('OFF_eta',title='OFF Clusters #eta; #eta; Entries', path=hist_path,xbins=50,xmin=-5.0,xmax=5.0) L2CaloEMClustersMonGroup.defineHistogram('OFF_phi',title='OFF Cluster #phi; #phi; Entries', - path=hist_path,xbins=64,xmin=-3.14153,xmax=3.14153) + path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('OFF_type',title='OFF Cluster Type; Size Enum; Entries', path=hist_path,xbins=16,xmin=0.5,xmax=16.5) @@ -123,33 +124,33 @@ def TrigCaloMonConfig(inputFlags): L2CaloEMClustersMonGroup.defineHistogram('HLT_with_OFF_match_eta,HLT_vs_OFF_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', path=hist_path,xbins=20,xmin=-5.0,xmax=5.0) L2CaloEMClustersMonGroup.defineHistogram('HLT_with_OFF_match_phi,HLT_vs_OFF_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #phi_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', - path=hist_path,xbins=16,xmin=-3.14153,xmax=3.14153) + path=hist_path,xbins=16,xmin=-math.pi,xmax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('HLT_with_OFF_match_eta,HLT_with_OFF_match_phi,HLT_vs_OFF_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta; #phi', type='TProfile2D', - path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) # Declare OFF histograms with HLT matches L2CaloEMClustersMonGroup.defineHistogram('HLT_with_OFF_match_num',title='Number of HLT Clusters (With OFF Matches); Num Clusters; Entries', path=hist_path,xbins=101,xmin=-1.0,xmax=201.0) L2CaloEMClustersMonGroup.defineHistogram('HLT_with_OFF_match_eta,HLT_with_OFF_match_phi',title='Number of HLT Clusters (With OFF Matches); #eta; #phi; ', type='TH2F', - path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('HLT_with_OFF_match_et',title='HLT Clusters E_{T} (With OFF Matches); E_{T} [GeV]; Entries', path=hist_path,xbins=100,xmin=0.0,xmax=100.0) L2CaloEMClustersMonGroup.defineHistogram('HLT_with_OFF_match_eta',title='HLT Clusters #eta (With OFF Matches); #eta; Entries', path=hist_path,xbins=50,xmin=-5.0,xmax=5.0) L2CaloEMClustersMonGroup.defineHistogram('HLT_with_OFF_match_phi',title='HLT Cluster #phi (With OFF Matches); #phi; Entries', - path=hist_path,xbins=64,xmin=-3.14153,xmax=3.14153) + path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi) # Declare OFF histograms without HLT matches L2CaloEMClustersMonGroup.defineHistogram('HLT_no_OFF_match_num',title='Number of HLT Clusters (No OFF Matches); Num Clusters; Entries', path=hist_path,xbins=101,xmin=-1.0,xmax=201.0) L2CaloEMClustersMonGroup.defineHistogram('HLT_no_OFF_match_eta,HLT_no_OFF_match_phi',title='Number of HLT Clusters (No OFF Matches); #eta; #phi; ', type='TH2F', - path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('HLT_no_OFF_match_et',title='HLT Clusters E_{T} (No OFF Matches); E_{T} [GeV]; Entries', path=hist_path,xbins=100,xmin=0.0,xmax=100.0) L2CaloEMClustersMonGroup.defineHistogram('HLT_no_OFF_match_eta',title='HLT Clusters #eta (No OFF Matches); #eta; Entries', path=hist_path,xbins=50,xmin=-5.0,xmax=5.0) L2CaloEMClustersMonGroup.defineHistogram('HLT_no_OFF_match_phi',title='HLT Cluster #phi (No OFF Matches); #phi; Entries', - path=hist_path,xbins=64,xmin=-3.14153,xmax=3.14153) + path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi) ######################## # OFF matched to HLT # @@ -174,21 +175,21 @@ def TrigCaloMonConfig(inputFlags): L2CaloEMClustersMonGroup.defineHistogram('OFF_with_HLT_match_eta,OFF_vs_HLT_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', path=hist_path,xbins=20,xmin=-5.0,xmax=5.0) L2CaloEMClustersMonGroup.defineHistogram('OFF_with_HLT_match_phi,OFF_vs_HLT_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #phi_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', - path=hist_path,xbins=16,xmin=-3.14153,xmax=3.14153) + path=hist_path,xbins=16,xmin=-math.pi,xmax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('OFF_with_HLT_match_eta,OFF_with_HLT_match_phi,OFF_vs_HLT_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta; #phi', type='TProfile2D', - path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) # Declare OFF histograms with HLT matches L2CaloEMClustersMonGroup.defineHistogram('OFF_with_HLT_match_num',title='Number of OFF Clusters (With HLT Matches); Num Clusters; Entries', path=hist_path,xbins=101,xmin=-1.0,xmax=201.0) L2CaloEMClustersMonGroup.defineHistogram('OFF_with_HLT_match_eta,OFF_with_HLT_match_phi',title='Number of OFF Clusters (With HLT Matches); #eta; #phi; ', type='TH2F', - path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('OFF_with_HLT_match_et',title='OFF Clusters E_{T} (With HLT Matches); E_{T} [GeV]; Entries', path=hist_path,xbins=100,xmin=0.0,xmax=100.0) L2CaloEMClustersMonGroup.defineHistogram('OFF_with_HLT_match_eta',title='OFF Clusters #eta (With HLT Matches); #eta; Entries', path=hist_path,xbins=50,xmin=-5.0,xmax=5.0) L2CaloEMClustersMonGroup.defineHistogram('OFF_with_HLT_match_phi',title='OFF Cluster #phi (With HLT Matches); #phi; Entries', - path=hist_path,xbins=64,xmin=-3.14153,xmax=3.14153) + path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('OFF_with_HLT_match_type',title='OFF Cluster Type (With HLT Matches); Size Enum; Entries', path=hist_path,xbins=16,xmin=0.5,xmax=16.5) @@ -196,13 +197,13 @@ def TrigCaloMonConfig(inputFlags): L2CaloEMClustersMonGroup.defineHistogram('OFF_no_HLT_match_num',title='Number of OFF Clusters (No HLT Matches); Num Clusters; Entries', path=hist_path,xbins=101,xmin=-1.0,xmax=201.0) L2CaloEMClustersMonGroup.defineHistogram('OFF_no_HLT_match_eta,OFF_no_HLT_match_phi',title='Number of OFF Clusters (No HLT Matches); #eta; #phi; ', type='TH2F', - path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + path=hist_path,xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('OFF_no_HLT_match_et',title='OFF Clusters E_{T} (No HLT Matches); E_{T} [GeV]; Entries', path=hist_path,xbins=100,xmin=0.0,xmax=100.0) L2CaloEMClustersMonGroup.defineHistogram('OFF_no_HLT_match_eta',title='OFF Clusters #eta (No HLT Matches); #eta; Entries', path=hist_path,xbins=50,xmin=-5.0,xmax=5.0) L2CaloEMClustersMonGroup.defineHistogram('OFF_no_HLT_match_phi',title='OFF Cluster #phi (No HLT Matches); #phi; Entries', - path=hist_path,xbins=64,xmin=-3.14153,xmax=3.14153) + path=hist_path,xbins=64,xmin=-math.pi,xmax=math.pi) L2CaloEMClustersMonGroup.defineHistogram('OFF_no_HLT_match_type',title='OFF Cluster Type (No HLT Matches); Size Enum; Entries', path=hist_path,xbins=16,xmin=0.5,xmax=16.5) @@ -251,13 +252,13 @@ def TrigCaloMonConfig(inputFlags): TopoCaloClustersMonGroup[i].defineHistogram('HLT_num',title='Number of HLT Clusters; Num Clusters; Entries', path=path_names[i]+'/HLT_Clusters',xbins=101,xmin=-10.0,xmax=2010.0) TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_phi',title='Number of HLT Clusters; #eta; #phi; ', type='TH2F', - path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) TopoCaloClustersMonGroup[i].defineHistogram('HLT_et',title='HLT Clusters E_{T}; E_{T} [GeV]; Entries', path=path_names[i]+'/HLT_Clusters',xbins=100,xmin=0.0,xmax=100.0) TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta',title='HLT Clusters #eta; #eta; Entries', path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=-5.0,xmax=5.0) TopoCaloClustersMonGroup[i].defineHistogram('HLT_phi',title='HLT Cluster #phi; #phi; Entries', - path=path_names[i]+'/HLT_Clusters',xbins=64,xmin=-3.14153,xmax=3.14153) + path=path_names[i]+'/HLT_Clusters',xbins=64,xmin=-math.pi,xmax=math.pi) TopoCaloClustersMonGroup[i].defineHistogram('HLT_type',title='HLT Cluster Type; Size Enum; Entries', path=path_names[i]+'/HLT_Clusters',xbins=16,xmin=0.5,xmax=16.5) TopoCaloClustersMonGroup[i].defineHistogram('HLT_time',title='HLT Cluster time; time; Entries', @@ -270,21 +271,21 @@ def TrigCaloMonConfig(inputFlags): # Declare high-ET HLT histograms TopoCaloClustersMonGroup[i].defineHistogram('HLT_barrel_high_et_num',title='Number of high-E_{T} HLT Clusters; Num Clusters; Entries', path=path_names[i]+'/HLT_Clusters',xbins=101,xmin=-0.5,xmax=100.5) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_barrel_high_et_eta,HLT_barrel_high_et_phi',title='Number of high-E_{T} HLT Clusters; #eta; #phi; ', type='TH2F', - path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=-1.5,xmax=1.5,ybins=64,ymin=-3.14153,ymax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_barrel_high_et_et',title='high-E_{T} HLT Clusters E_{T}; E_{T} [GeV]; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_phi;HLT_barrel_high_et_phi_vs_HLT_barrel_high_et_eta',cutmask="HLT_barrel_high_et",title='Number of high-E_{T} HLT Clusters; #eta; #phi; ', type='TH2F', + path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=-1.5,xmax=1.5,ybins=64,ymin=-math.pi,ymax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('HLT_et;HLT_barrel_high_et_et',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Clusters E_{T}; E_{T} [GeV]; Entries', path=path_names[i]+'/HLT_Clusters',xbins=100,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_barrel_high_et_eta',title='high-E_{T} HLT Clusters #eta; #eta; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta;HLT_barrel_high_et_eta',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Clusters #eta; #eta; Entries', path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=-1.5,xmax=1.5) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_barrel_high_et_phi',title='high-E_{T} HLT Cluster #phi; #phi; Entries', - path=path_names[i]+'/HLT_Clusters',xbins=64,xmin=-3.14153,xmax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_barrel_high_et_type',title='high-E_{T} HLT Cluster Type; Size Enum; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_phi;HLT_barrel_high_et_phi',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Cluster #phi; #phi; Entries', + path=path_names[i]+'/HLT_Clusters',xbins=64,xmin=-math.pi,xmax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('HLT_type;HLT_barrel_high_et_type',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Cluster Type; Size Enum; Entries', path=path_names[i]+'/HLT_Clusters',xbins=16,xmin=0.5,xmax=16.5) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_barrel_high_et_time',title='high-E_{T} HLT Cluster time; time; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_time;HLT_barrel_high_et_time',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Cluster time; time; Entries', path=path_names[i]+'/HLT_Clusters',xbins=60,xmin=-10.0,xmax=10.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_barrel_high_et_et,HLT_barrel_high_et_time',title='Number of high-E_{T} HLT Clusters; E_{T} [GeV]; Time', type='TProfile', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,HLT_time;HLT_barrel_high_et_time_vs_HLT_barrel_high_et_et',cutmask="HLT_barrel_high_et",title='Number of high-E_{T} HLT Clusters; E_{T} [GeV]; Time', type='TProfile', path=path_names[i]+'/HLT_Clusters',xbins=50,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_barrel_high_et_size',title='high-E_{T} HLT Cluster Size; Number of Cells; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_size;HLT_barrel_high_et_size',cutmask="HLT_barrel_high_et",title='high-E_{T} HLT Cluster Size; Number of Cells; Entries', path=path_names[i]+'/HLT_Clusters',xbins=91,xmin=-10.0,xmax=1810.0) ######################## @@ -295,13 +296,13 @@ def TrigCaloMonConfig(inputFlags): TopoCaloClustersMonGroup[i].defineHistogram('OFF_num',title='Number of OFF Clusters; Num Clusters; Entries', path=path_names[i]+'/OFF_Clusters',xbins=101,xmin=-10.0,xmax=2010.0) TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta,OFF_phi',title='Number of OFF Clusters; #eta; #phi; ', type='TH2F', - path=path_names[i]+'/OFF_Clusters',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + path=path_names[i]+'/OFF_Clusters',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) TopoCaloClustersMonGroup[i].defineHistogram('OFF_et',title='OFF Clusters E_{T}; E_{T} [GeV]; Entries', path=path_names[i]+'/OFF_Clusters',xbins=100,xmin=0.0,xmax=100.0) TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta',title='OFF Clusters #eta; #eta; Entries', path=path_names[i]+'/OFF_Clusters',xbins=50,xmin=-5.0,xmax=5.0) TopoCaloClustersMonGroup[i].defineHistogram('OFF_phi',title='OFF Cluster #phi; #phi; Entries', - path=path_names[i]+'/OFF_Clusters',xbins=64,xmin=-3.14153,xmax=3.14153) + path=path_names[i]+'/OFF_Clusters',xbins=64,xmin=-math.pi,xmax=math.pi) TopoCaloClustersMonGroup[i].defineHistogram('OFF_time',title='OFF Cluster time; time; Entries', path=path_names[i]+'/OFF_Clusters',xbins=75,xmin=-25.0,xmax=25.0) TopoCaloClustersMonGroup[i].defineHistogram('OFF_et,OFF_time',title='Number of OFF Clusters; E_{T} [GeV]; Time', type='TProfile', @@ -318,59 +319,59 @@ def TrigCaloMonConfig(inputFlags): path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=0.0,xmax=1.0) TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_minimum_delta_r',title='HLT vs OFF Cluster #DeltaR; #DeltaR; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=0.0,xmax=0.1) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_delta_eta',title='HLT vs OFF Cluster #Delta#eta; #eta_{_{OFF}} - #eta_{_{HLT}}; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_delta_eta',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster #Delta#eta; #eta_{_{OFF}} - #eta_{_{HLT}}; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-0.2,xmax=0.2) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_delta_phi',title='HLT vs OFF Cluster #Delta#phi; #phi_{_{OFF}} - #phi_{_{HLT}}; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_delta_phi',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster #Delta#phi; #phi_{_{OFF}} - #phi_{_{HLT}}; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=0.0,xmax=0.02) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_delta_time',title='HLT vs OFF Cluster time; Time; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_delta_time',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster time; Time; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=80,xmin=-20.0,xmax=20.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_et,OFF_match_et',title='HLT vs OFF Cluster E_{T}; E_{T_{OFF}} [GeV]; E_{T_{HLT}} [GeV]', type='TH2F', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,OFF_match_et;OFF_match_et_vs_HLT_with_OFF_match_et',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster E_{T}; E_{T_{OFF}} [GeV]; E_{T_{HLT}} [GeV]', type='TH2F', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=0.0,xmax=100.0, ybins=100,ymin=0.0,ymax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_resolution',title='HLT vs OFF Cluster #DeltaE_{T} / E_{T}; E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} [%]; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_vs_OFF_resolution',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster #DeltaE_{T} / E_{T}; E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} [%]; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=-60.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_et,HLT_vs_OFF_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; E_{T,HLT} [GeV]; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_et',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; E_{T,HLT} [GeV]; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_eta,HLT_vs_OFF_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=20,xmin=-5.0,xmax=5.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_phi,HLT_vs_OFF_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #phi_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', - path=path_names[i]+'/HLT_Matched_to_OFF',xbins=16,xmin=-3.14153,xmax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_eta,HLT_with_OFF_match_phi,HLT_vs_OFF_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta; #phi', type='TProfile2D', - path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + TopoCaloClustersMonGroup[i].defineHistogram('HLT_phi,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_phi',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #phi_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', + path=path_names[i]+'/HLT_Matched_to_OFF',xbins=16,xmin=-math.pi,xmax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_phi,HLT_vs_OFF_resolution;HLT_vs_OFF_resolution_vs_HLT_with_OFF_match_phi_vs_HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta; #phi', type='TProfile2D', + path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) # Declare HLT histograms with OFF matches TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_num',title='Number of HLT Clusters (With OFF Matches); Num Clusters; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=101,xmin=-10.0,xmax=2010.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_eta,HLT_with_OFF_match_phi',title='Number of HLT Clusters (With OFF Matches); #eta; #phi; ', type='TH2F', - path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_et',title='HLT Clusters E_{T} (With OFF Matches); E_{T} [GeV]; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_phi;HLT_with_OFF_match_phi_vs_HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='Number of HLT Clusters (With OFF Matches); #eta; #phi; ', type='TH2F', + path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('HLT_et;HLT_with_OFF_match_et',cutmask='HLT_with_OFF_match',title='HLT Clusters E_{T} (With OFF Matches); E_{T} [GeV]; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_eta',title='HLT Clusters #eta (With OFF Matches); #eta; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta;HLT_with_OFF_match_eta',cutmask='HLT_with_OFF_match',title='HLT Clusters #eta (With OFF Matches); #eta; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_phi',title='HLT Cluster #phi (With OFF Matches); #phi; Entries', - path=path_names[i]+'/HLT_Matched_to_OFF',xbins=64,xmin=-3.14153,xmax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_time',title='HLT Cluster time (With OFF Matches); time; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_phi;HLT_with_OFF_match_phi',cutmask='HLT_with_OFF_match',title='HLT Cluster #phi (With OFF Matches); #phi; Entries', + path=path_names[i]+'/HLT_Matched_to_OFF',xbins=64,xmin=-math.pi,xmax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('HLT_time;HLT_with_OFF_match_time',cutmask='HLT_with_OFF_match',title='HLT Cluster time (With OFF Matches); time; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=75,xmin=-25.0,xmax=25.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_et,HLT_with_OFF_match_time',title='Number of HLT Clusters (With OFF Matches); E_{T} [GeV]; Time', type='TProfile', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,HLT_time;HLT_with_OFF_match_time_vs_HLT_with_OFF_match_et',cutmask='HLT_with_OFF_match',title='Number of HLT Clusters (With OFF Matches); E_{T} [GeV]; Time', type='TProfile', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_with_OFF_match_type',title='HLT Cluster Type (With OFF Matches); Size Enum; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_type;HLT_with_OFF_match_type',cutmask='HLT_with_OFF_match',title='HLT Cluster Type (With OFF Matches); Size Enum; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=16,xmin=0.5,xmax=16.5) # Declare HLT histograms without OFF matches TopoCaloClustersMonGroup[i].defineHistogram('HLT_no_OFF_match_num',title='Number of HLT Clusters (No OFF Matches); Num Clusters; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=101,xmin=-10.0,xmax=2010.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_no_OFF_match_eta,HLT_no_OFF_match_phi',title='Number of HLT Clusters (No OFF Matches); #eta; #phi; ', type='TH2F', - path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_no_OFF_match_et',title='HLT Clusters E_{T} (No OFF Matches); E_{T} [GeV]; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta,HLT_phi;HLT_no_OFF_match_phi_vs_HLT_no_OFF_match_eta',cutmask='HLT_no_OFF_match',title='Number of HLT Clusters (No OFF Matches); #eta; #phi; ', type='TH2F', + path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('HLT_et;HLT_no_OFF_match_et',cutmask='HLT_no_OFF_match',title='HLT Clusters E_{T} (No OFF Matches); E_{T} [GeV]; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=100,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_no_OFF_match_eta',title='HLT Clusters #eta (No OFF Matches); #eta; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_eta;HLT_no_OFF_match_eta',cutmask='HLT_no_OFF_match',title='HLT Clusters #eta (No OFF Matches); #eta; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=-5.0,xmax=5.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_no_OFF_match_phi',title='HLT Cluster #phi (No OFF Matches); #phi; Entries', - path=path_names[i]+'/HLT_Matched_to_OFF',xbins=64,xmin=-3.14153,xmax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_no_OFF_match_time',title='HLT Cluster time (No OFF Matches); time; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_phi;HLT_no_OFF_match_phi',cutmask='HLT_no_OFF_match',title='HLT Cluster #phi (No OFF Matches); #phi; Entries', + path=path_names[i]+'/HLT_Matched_to_OFF',xbins=64,xmin=-math.pi,xmax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('HLT_time;HLT_no_OFF_match_time',cutmask='HLT_no_OFF_match',title='HLT Cluster time (No OFF Matches); time; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=75,xmin=-25.0,xmax=25.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_no_OFF_match_et,HLT_no_OFF_match_time',title='Number of HLT Clusters (No OFF Matches); E_{T} [GeV]; Time', type='TProfile', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_et,HLT_time;HLT_no_OFF_match_time_vs_HLT_no_OFF_match_et',cutmask='HLT_no_OFF_match',title='Number of HLT Clusters (No OFF Matches); E_{T} [GeV]; Time', type='TProfile', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=50,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('HLT_no_OFF_match_type',title='HLT Cluster Type (No OFF Matches); Size Enum; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('HLT_type;HLT_no_OFF_match_type',cutmask='HLT_no_OFF_match',title='HLT Cluster Type (No OFF Matches); Size Enum; Entries', path=path_names[i]+'/HLT_Matched_to_OFF',xbins=16,xmin=0.5,xmax=16.5) ######################## @@ -382,59 +383,59 @@ def TrigCaloMonConfig(inputFlags): path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=0.0,xmax=1.0) TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_minimum_delta_r',title='HLT vs OFF Cluster #DeltaR; #DeltaR; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=0.0,xmax=0.1) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_delta_eta',title='HLT vs OFF Cluster #Delta#eta; #eta_{_{OFF}} - #eta_{_{HLT}}; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_delta_eta',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster #Delta#eta; #eta_{_{OFF}} - #eta_{_{HLT}}; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-0.2,xmax=0.2) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_delta_phi',title='HLT vs OFF Cluster #Delta#phi; #phi_{_{OFF}} - #phi_{_{HLT}}; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_delta_phi',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster #Delta#phi; #phi_{_{OFF}} - #phi_{_{HLT}}; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=0.0,xmax=0.02) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_delta_time',title='HLT vs OFF Cluster time; Time; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_delta_time',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster time; Time; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=80,xmin=-20.0,xmax=20.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_et,HLT_match_et',title='HLT vs OFF Cluster E_{T}; E_{T_{OFF}} [GeV]; E_{T_{HLT}} [GeV]', type='TH2F', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_et,HLT_match_et;HLT_match_et_vs_OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster E_{T}; E_{T_{OFF}} [GeV]; E_{T_{HLT}} [GeV]', type='TH2F', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=0.0,xmax=100.0, ybins=100,ymin=0.0,ymax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_resolution',title='HLT vs OFF Cluster #DeltaE_{T} / E_{T}; E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} [%]; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_vs_HLT_resolution',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster #DeltaE_{T} / E_{T}; E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} [%]; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=-60.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_et,OFF_vs_HLT_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; E_{T,OFF} [GeV]; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_et,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; E_{T,OFF} [GeV]; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_eta,OFF_vs_HLT_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=20,xmin=-5.0,xmax=5.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_phi,OFF_vs_HLT_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #phi_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', - path=path_names[i]+'/OFF_Matched_to_HLT',xbins=16,xmin=-3.14153,xmax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_eta,OFF_with_HLT_match_phi,OFF_vs_HLT_resolution',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta; #phi', type='TProfile2D', - path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) + TopoCaloClustersMonGroup[i].defineHistogram('OFF_phi,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_phi',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #phi_{_{ OFF}}; < E_{T_{OFF}} - E_{T_{HLT}} / E_{T_{OFF}} >', type='TProfile', + path=path_names[i]+'/OFF_Matched_to_HLT',xbins=16,xmin=-math.pi,xmax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta,OFF_phi,OFF_vs_HLT_resolution;OFF_vs_HLT_resolution_vs_OFF_with_HLT_match_phi_vs_OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='HLT vs OFF Cluster < #DeltaE_{T} / E_{T} >; #eta; #phi', type='TProfile2D', + path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) # Declare OFF histograms with HLT matches TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_num',title='Number of OFF Clusters (With HLT Matches); Num Clusters; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=101,xmin=-10.0,xmax=2010.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_eta,OFF_with_HLT_match_phi',title='Number of OFF Clusters (With HLT Matches); #eta; #phi; ', type='TH2F', - path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_et',title='OFF Clusters E_{T} (With HLT Matches); E_{T} [GeV]; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta,OFF_phi;OFF_with_HLT_match_phi_vs_OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='Number of OFF Clusters (With HLT Matches); #eta; #phi; ', type='TH2F', + path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('OFF_et;OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='OFF Clusters E_{T} (With HLT Matches); E_{T} [GeV]; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_eta',title='OFF Clusters #eta (With HLT Matches); #eta; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta;OFF_with_HLT_match_eta',cutmask='OFF_with_HLT_match',title='OFF Clusters #eta (With HLT Matches); #eta; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_phi',title='OFF Cluster #phi (With HLT Matches); #phi; Entries', - path=path_names[i]+'/OFF_Matched_to_HLT',xbins=64,xmin=-3.14153,xmax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_time',title='OFF Cluster time (With HLT Matches); time; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_phi;OFF_with_HLT_match_phi',cutmask='OFF_with_HLT_match',title='OFF Cluster #phi (With HLT Matches); #phi; Entries', + path=path_names[i]+'/OFF_Matched_to_HLT',xbins=64,xmin=-math.pi,xmax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('OFF_time;OFF_with_HLT_match_time',cutmask='OFF_with_HLT_match',title='OFF Cluster time (With HLT Matches); time; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=75,xmin=-25.0,xmax=25.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_et,OFF_with_HLT_match_time',title='Number of OFF Clusters (With HLT Matches); E_{T} [GeV]; Time', type='TProfile', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_et,OFF_time;OFF_with_HLT_match_time_vs_OFF_with_HLT_match_et',cutmask='OFF_with_HLT_match',title='Number of OFF Clusters (With HLT Matches); E_{T} [GeV]; Time', type='TProfile', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_with_HLT_match_type',title='OFF Cluster Type (With HLT Matches); Size Enum; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_type;OFF_with_HLT_match_type',cutmask='OFF_with_HLT_match',title='OFF Cluster Type (With HLT Matches); Size Enum; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=16,xmin=0.5,xmax=16.5) # Declare OFF histograms without HLT matches TopoCaloClustersMonGroup[i].defineHistogram('OFF_no_HLT_match_num',title='Number of OFF Clusters (No HLT Matches); Num Clusters; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=101,xmin=-10.0,xmax=2010.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_no_HLT_match_eta,OFF_no_HLT_match_phi',title='Number of OFF Clusters (No HLT Matches); #eta; #phi; ', type='TH2F', - path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-3.14153,ymax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_no_HLT_match_et',title='OFF Clusters E_{T} (No HLT Matches); E_{T} [GeV]; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta,OFF_phi;OFF_no_HLT_match_phi_vs_OFF_no_HLT_match_eta',cutmask='OFF_no_HLT_match',title='Number of OFF Clusters (No HLT Matches); #eta; #phi; ', type='TH2F', + path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0,ybins=64,ymin=-math.pi,ymax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('OFF_et;OFF_no_HLT_match_et',cutmask='OFF_no_HLT_match',title='OFF Clusters E_{T} (No HLT Matches); E_{T} [GeV]; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=100,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_no_HLT_match_eta',title='OFF Clusters #eta (No HLT Matches); #eta; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_eta;OFF_no_HLT_match_eta',cutmask='OFF_no_HLT_match',title='OFF Clusters #eta (No HLT Matches); #eta; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=-5.0,xmax=5.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_no_HLT_match_phi',title='OFF Cluster #phi (No HLT Matches); #phi; Entries', - path=path_names[i]+'/OFF_Matched_to_HLT',xbins=64,xmin=-3.14153,xmax=3.14153) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_no_HLT_match_time',title='OFF Cluster time (No HLT Matches); time; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_phi;OFF_no_HLT_match_phi',cutmask='OFF_no_HLT_match',title='OFF Cluster #phi (No HLT Matches); #phi; Entries', + path=path_names[i]+'/OFF_Matched_to_HLT',xbins=64,xmin=-math.pi,xmax=math.pi) + TopoCaloClustersMonGroup[i].defineHistogram('OFF_time;OFF_no_HLT_match_time',cutmask='OFF_no_HLT_match',title='OFF Cluster time (No HLT Matches); time; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=75,xmin=-25.0,xmax=25.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_no_HLT_match_et,OFF_no_HLT_match_time',title='Number of OFF Clusters (No HLT Matches); E_{T} [GeV]; Time', type='TProfile', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_et,OFF_time;OFF_no_HLT_match_time_vs_OFF_no_HLT_match_et',cutmask='OFF_no_HLT_match',title='Number of OFF Clusters (No HLT Matches); E_{T} [GeV]; Time', type='TProfile', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=50,xmin=0.0,xmax=100.0) - TopoCaloClustersMonGroup[i].defineHistogram('OFF_no_HLT_match_type',title='OFF Cluster Type (No HLT Matches); Size Enum; Entries', + TopoCaloClustersMonGroup[i].defineHistogram('OFF_type;OFF_no_HLT_match_type',cutmask='OFF_no_HLT_match',title='OFF Cluster Type (No HLT Matches); Size Enum; Entries', path=path_names[i]+'/OFF_Matched_to_HLT',xbins=16,xmin=0.5,xmax=16.5) diff --git a/Trigger/TrigMonitoring/TrigCaloMonitoring/src/HLTCalo_TopoCaloClustersMonitor.cxx b/Trigger/TrigMonitoring/TrigCaloMonitoring/src/HLTCalo_TopoCaloClustersMonitor.cxx index 997195b30e7da0e9d55c0c1d8a79fefc112ce0c9..beec81d2c52bea30f6cb9ed8ec18410128aff45d 100644 --- a/Trigger/TrigMonitoring/TrigCaloMonitoring/src/HLTCalo_TopoCaloClustersMonitor.cxx +++ b/Trigger/TrigMonitoring/TrigCaloMonitoring/src/HLTCalo_TopoCaloClustersMonitor.cxx @@ -1,9 +1,16 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "HLTCalo_TopoCaloClustersMonitor.h" +struct clus_kin { + double et; + double eta; + double phi; + const xAOD::CaloCluster* parent; +}; + HLTCalo_TopoCaloClustersMonitor::HLTCalo_TopoCaloClustersMonitor( const std::string& name, ISvcLocator* pSvcLocator ) : AthMonitorAlgorithm(name,pSvcLocator) { @@ -49,6 +56,40 @@ StatusCode HLTCalo_TopoCaloClustersMonitor::fillHistograms( const EventContext& return StatusCode::FAILURE; } + // Cache expensive et, eta, phi calculations for the clusters + // prepare HLT clusters + std::vector<clus_kin> vec_hlt_clusters; + for (const auto& hlt_cluster : *hltCluster_readHandle) { + auto hlt_clus_et = hlt_cluster->et(); + if (hlt_clus_et < m_HLT_min_et) continue; + + bool HLT_type_match = false; + + for (unsigned int n = 0; n < m_HLT_types.size(); ++n) { + if(hlt_cluster->clusterSize() == m_HLT_types[n]) { HLT_type_match = true; break; } + } + + if (!m_HLT_types.empty() && !HLT_type_match) continue; + vec_hlt_clusters.push_back({hlt_clus_et, hlt_cluster->eta(), hlt_cluster->phi(), hlt_cluster}); + } + + // prepare OFF clusters + std::vector<clus_kin> vec_off_clusters; + for (const auto& off_cluster : *offCluster_readHandle) { + auto off_clus_et = off_cluster->et(); + if (off_clus_et < m_OFF_min_et) continue; + + bool OFF_type_match = false; + + for (unsigned int n = 0; n < m_OFF_types.size(); ++n) { + if(off_cluster->clusterSize() == m_OFF_types[n]) { OFF_type_match = true; break; } + } + + if (!m_OFF_types.empty() && !OFF_type_match) continue; + vec_off_clusters.push_back({off_clus_et, off_cluster->eta(), off_cluster->phi(), off_cluster}); + } + + ////////////////// // HLT CLUSTERS // ////////////////// @@ -70,39 +111,15 @@ StatusCode HLTCalo_TopoCaloClustersMonitor::fillHistograms( const EventContext& auto HLT_size = Monitored::Collection("HLT_size", vec_hlt_size); auto HLT_time = Monitored::Collection("HLT_time", vec_hlt_time); - // Only High-ET clusters - std::vector<float> vec_hlt_barrel_high_et_et, vec_hlt_barrel_high_et_eta, vec_hlt_barrel_high_et_phi, vec_hlt_barrel_high_et_size, vec_hlt_barrel_high_et_time; - std::vector<int> vec_hlt_barrel_high_et_type; + // HLT cut masks + std::vector<char> vec_hlt_barrel_high_et, vec_hlt_no_off_match, vec_hlt_with_off_match; + auto HLT_barrel_high_et = Monitored::Collection("HLT_barrel_high_et", vec_hlt_barrel_high_et); + auto HLT_no_OFF_match = Monitored::Collection("HLT_no_OFF_match", vec_hlt_no_off_match); + auto HLT_with_OFF_match = Monitored::Collection("HLT_with_OFF_match", vec_hlt_with_off_match); auto HLT_barrel_high_et_num = Monitored::Scalar<int>("HLT_barrel_high_et_num",0); - auto HLT_barrel_high_et_et = Monitored::Collection("HLT_barrel_high_et_et", vec_hlt_barrel_high_et_et); - auto HLT_barrel_high_et_eta = Monitored::Collection("HLT_barrel_high_et_eta", vec_hlt_barrel_high_et_eta); - auto HLT_barrel_high_et_phi = Monitored::Collection("HLT_barrel_high_et_phi", vec_hlt_barrel_high_et_phi); - auto HLT_barrel_high_et_type = Monitored::Collection("HLT_barrel_high_et_type", vec_hlt_barrel_high_et_type); - auto HLT_barrel_high_et_size = Monitored::Collection("HLT_barrel_high_et_size", vec_hlt_barrel_high_et_size); - auto HLT_barrel_high_et_time = Monitored::Collection("HLT_barrel_high_et_time", vec_hlt_barrel_high_et_time); - - // HLT cluster without OFF match - std::vector<float> vec_hlt_no_off_match_et, vec_hlt_no_off_match_eta, vec_hlt_no_off_match_phi, vec_hlt_no_off_match_time; - std::vector<int> vec_hlt_no_off_match_type; - auto HLT_no_OFF_match_num = Monitored::Scalar<int>("HLT_no_OFF_match_num",0); - auto HLT_no_OFF_match_et = Monitored::Collection("HLT_no_OFF_match_et", vec_hlt_no_off_match_et); - auto HLT_no_OFF_match_eta = Monitored::Collection("HLT_no_OFF_match_eta", vec_hlt_no_off_match_eta); - auto HLT_no_OFF_match_phi = Monitored::Collection("HLT_no_OFF_match_phi", vec_hlt_no_off_match_phi); - auto HLT_no_OFF_match_time = Monitored::Collection("HLT_no_OFF_match_time", vec_hlt_no_off_match_time); - auto HLT_no_OFF_match_type = Monitored::Collection("HLT_no_OFF_match_type", vec_hlt_no_off_match_type); - - // HLT cluster with OFF match - std::vector<float> vec_hlt_with_off_match_et, vec_hlt_with_off_match_eta, vec_hlt_with_off_match_phi, vec_hlt_with_off_match_time; - std::vector<int> vec_hlt_with_off_match_type; - auto HLT_with_OFF_match_num = Monitored::Scalar<int>("HLT_with_OFF_match_num",0); - auto HLT_with_OFF_match_et = Monitored::Collection("HLT_with_OFF_match_et", vec_hlt_with_off_match_et); - auto HLT_with_OFF_match_eta = Monitored::Collection("HLT_with_OFF_match_eta", vec_hlt_with_off_match_eta); - auto HLT_with_OFF_match_phi = Monitored::Collection("HLT_with_OFF_match_phi", vec_hlt_with_off_match_phi); - auto HLT_with_OFF_match_time = Monitored::Collection("HLT_with_OFF_match_time", vec_hlt_with_off_match_time); - auto HLT_with_OFF_match_type = Monitored::Collection("HLT_with_OFF_match_type", vec_hlt_with_off_match_type); // HLT clusters vs. OFF clusters std::vector<float> vec_hlt_vs_off_minimum_delta_r, vec_hlt_vs_off_delta_eta, vec_hlt_vs_off_delta_phi, vec_hlt_vs_off_delta_time, vec_hlt_vs_off_resolution, vec_off_match_et; @@ -115,71 +132,44 @@ StatusCode HLTCalo_TopoCaloClustersMonitor::fillHistograms( const EventContext& auto HLT_vs_OFF_resolution = Monitored::Collection("HLT_vs_OFF_resolution", vec_hlt_vs_off_resolution); auto OFF_match_et = Monitored::Collection("OFF_match_et", vec_off_match_et); - const xAOD::CaloCluster *off_match = nullptr; // For matching + const clus_kin *off_match = nullptr; // For matching // Loop over HLT clusters - for (const auto& hlt_cluster : *hltCluster_readHandle) { - - if (hlt_cluster->et() < m_HLT_min_et) continue; - - bool HLT_type_match = false; - - for (unsigned int n = 0; n < m_HLT_types.size(); ++n) { - if(hlt_cluster->clusterSize() == m_HLT_types[n]) { HLT_type_match = true; break; } - } - - if (!m_HLT_types.empty() && !HLT_type_match) continue; + for (const auto& hlt_cluster : vec_hlt_clusters) { ++n_hlt_clusters; - vec_hlt_et.push_back(hlt_cluster->et() * 0.001); - vec_hlt_eta.push_back(hlt_cluster->eta()); - vec_hlt_phi.push_back(hlt_cluster->phi()); - vec_hlt_type.push_back(hlt_cluster->clusterSize()); - vec_hlt_time.push_back(hlt_cluster->time()); - if (hlt_cluster->isAvailable<int>("nCells")) { - vec_hlt_size.push_back(hlt_cluster->auxdata<int>("nCells")); - } + vec_hlt_et.push_back(hlt_cluster.et * 0.001); + vec_hlt_eta.push_back(hlt_cluster.eta); + vec_hlt_phi.push_back(hlt_cluster.phi); + vec_hlt_type.push_back(hlt_cluster.parent->clusterSize()); + vec_hlt_time.push_back(hlt_cluster.parent->time()); + if (hlt_cluster.parent->isAvailable<int>("nCells")) { + vec_hlt_size.push_back(hlt_cluster.parent->auxdata<int>("nCells")); + } else { + vec_hlt_size.push_back(0); + } // high-ET clusters - if (hlt_cluster->et() > m_HLT_high_et && fabs(hlt_cluster->eta()) < 1.4) { - + if (hlt_cluster.et > m_HLT_high_et && fabs(hlt_cluster.eta) < 1.4) { ++n_hlt_barrel_high_et_clusters; - - vec_hlt_barrel_high_et_et.push_back(hlt_cluster->et() * 0.001); - vec_hlt_barrel_high_et_eta.push_back(hlt_cluster->eta()); - vec_hlt_barrel_high_et_phi.push_back(hlt_cluster->phi()); - vec_hlt_barrel_high_et_type.push_back(hlt_cluster->clusterSize()); - vec_hlt_barrel_high_et_time.push_back(hlt_cluster->time()); - if (hlt_cluster->isAvailable<int>("nCells")) { - vec_hlt_barrel_high_et_size.push_back(hlt_cluster->auxdata<int>("nCells")); - } - - } + vec_hlt_barrel_high_et.push_back(1); + } else { + vec_hlt_barrel_high_et.push_back(0); + } // matching HLT clusters to OFF clusters float min_delta_r = 999999.9; - for (const auto& off_cluster : *offCluster_readHandle) { - - if (off_cluster->et() < m_OFF_min_et) continue; - - bool OFF_type_match = false; - - for (unsigned int n = 0; n < m_OFF_types.size(); ++n) { - if(off_cluster->clusterSize() == m_OFF_types[n]) { OFF_type_match = true; break; } - } - - if (!m_OFF_types.empty() && !OFF_type_match) continue; - - float delta_r = calculateDeltaR(m_max_delta_r, hlt_cluster->eta(), hlt_cluster->phi(), off_cluster->eta(), off_cluster->phi()); + for (const auto& off_cluster : vec_off_clusters) { + float delta_r = calculateDeltaR(m_max_delta_r, hlt_cluster.eta, hlt_cluster.phi, off_cluster.eta, off_cluster.phi); if (delta_r < min_delta_r) { min_delta_r = delta_r; - off_match = off_cluster; + off_match = &off_cluster; } } // End loop over OFF clusters @@ -191,12 +181,15 @@ StatusCode HLTCalo_TopoCaloClustersMonitor::fillHistograms( const EventContext& ++n_hlt_clusters_no_match; - vec_hlt_no_off_match_et.push_back(hlt_cluster->et()*0.001); - vec_hlt_no_off_match_eta.push_back(hlt_cluster->eta()); - vec_hlt_no_off_match_phi.push_back(hlt_cluster->phi()); - vec_hlt_no_off_match_time.push_back(hlt_cluster->time()); - vec_hlt_no_off_match_type.push_back(hlt_cluster->clusterSize()); + vec_off_match_et.push_back(0.); + + vec_hlt_vs_off_resolution.push_back(0.); + vec_hlt_vs_off_delta_eta.push_back(0.); + vec_hlt_vs_off_delta_phi.push_back(0.); + vec_hlt_vs_off_delta_time.push_back(0.); + vec_hlt_no_off_match.push_back(1); + vec_hlt_with_off_match.push_back(0); } // With OFF match @@ -204,19 +197,16 @@ StatusCode HLTCalo_TopoCaloClustersMonitor::fillHistograms( const EventContext& ++n_hlt_clusters_with_match; - vec_hlt_with_off_match_et.push_back(hlt_cluster->et()*0.001); - vec_hlt_with_off_match_eta.push_back(hlt_cluster->eta()); - vec_hlt_with_off_match_phi.push_back(hlt_cluster->phi()); - vec_hlt_with_off_match_time.push_back(hlt_cluster->time()); - vec_hlt_with_off_match_type.push_back(hlt_cluster->clusterSize()); - vec_off_match_et.push_back(off_match->et() * 0.001); + vec_off_match_et.push_back(off_match->et * 0.001); - vec_hlt_vs_off_resolution.push_back(((off_match->et() - hlt_cluster->et()) / off_match->et()) * 100); - vec_hlt_vs_off_delta_eta.push_back(off_match->eta() - hlt_cluster->eta()); - vec_hlt_vs_off_delta_phi.push_back(calculateDeltaPhi(off_match->phi(), hlt_cluster->phi())); - vec_hlt_vs_off_delta_time.push_back(off_match->time() - hlt_cluster->time()); + vec_hlt_vs_off_resolution.push_back(((off_match->et - hlt_cluster.et) / off_match->et) * 100); + vec_hlt_vs_off_delta_eta.push_back(off_match->eta - hlt_cluster.eta); + vec_hlt_vs_off_delta_phi.push_back(calculateDeltaPhi(off_match->phi, hlt_cluster.phi)); + vec_hlt_vs_off_delta_time.push_back(off_match->parent->time() - hlt_cluster.parent->time()); - } + vec_hlt_no_off_match.push_back(0); + vec_hlt_with_off_match.push_back(1); + } } // End loop over HLT clusters @@ -245,27 +235,13 @@ StatusCode HLTCalo_TopoCaloClustersMonitor::fillHistograms( const EventContext& auto OFF_time = Monitored::Collection("OFF_time", vec_off_time); auto OFF_type = Monitored::Collection("OFF_type", vec_off_type); - // OFF cluster without HLT match - std::vector<float> vec_off_no_hlt_match_et, vec_off_no_hlt_match_eta, vec_off_no_hlt_match_phi, vec_off_no_hlt_match_time; - std::vector<int> vec_off_no_hlt_match_type; + // cut masks + std::vector<char> vec_off_no_hlt_match, vec_off_with_hlt_match, vec_off_vs_hlt_delta; + auto OFF_no_HLT_match = Monitored::Collection("OFF_no_HLT_match", vec_off_no_hlt_match); + auto OFF_with_HLT_match = Monitored::Collection("OFF_with_HLT_match", vec_off_with_hlt_match); auto OFF_no_HLT_match_num = Monitored::Scalar<int>("OFF_no_HLT_match_num",0); - auto OFF_no_HLT_match_et = Monitored::Collection("OFF_no_HLT_match_et", vec_off_no_hlt_match_et); - auto OFF_no_HLT_match_eta = Monitored::Collection("OFF_no_HLT_match_eta", vec_off_no_hlt_match_eta); - auto OFF_no_HLT_match_phi = Monitored::Collection("OFF_no_HLT_match_phi", vec_off_no_hlt_match_phi); - auto OFF_no_HLT_match_time = Monitored::Collection("OFF_no_HLT_match_time", vec_off_no_hlt_match_time); - auto OFF_no_HLT_match_type = Monitored::Collection("OFF_no_HLT_match_type", vec_off_no_hlt_match_type); - - // OFF cluster with HLT match - std::vector<float> vec_off_with_hlt_match_et, vec_off_with_hlt_match_eta, vec_off_with_hlt_match_phi, vec_off_with_hlt_match_time; - std::vector<int> vec_off_with_hlt_match_type; - auto OFF_with_HLT_match_num = Monitored::Scalar<int>("OFF_with_HLT_match_num",0); - auto OFF_with_HLT_match_et = Monitored::Collection("OFF_with_HLT_match_et", vec_off_with_hlt_match_et); - auto OFF_with_HLT_match_eta = Monitored::Collection("OFF_with_HLT_match_eta", vec_off_with_hlt_match_eta); - auto OFF_with_HLT_match_phi = Monitored::Collection("OFF_with_HLT_match_phi", vec_off_with_hlt_match_phi); - auto OFF_with_HLT_match_time = Monitored::Collection("OFF_with_HLT_match_time", vec_off_with_hlt_match_time); - auto OFF_with_HLT_match_type = Monitored::Collection("OFF_with_HLT_match_type", vec_off_with_hlt_match_type); // OFF clusters vs. HLT clusters std::vector<float> vec_off_vs_hlt_minimum_delta_r, vec_off_vs_hlt_delta_eta, vec_off_vs_hlt_delta_phi, vec_off_vs_hlt_delta_time, vec_off_vs_hlt_resolution, vec_hlt_match_et; @@ -278,52 +254,31 @@ StatusCode HLTCalo_TopoCaloClustersMonitor::fillHistograms( const EventContext& auto OFF_vs_HLT_resolution = Monitored::Collection("OFF_vs_HLT_resolution", vec_off_vs_hlt_resolution); auto HLT_match_et = Monitored::Collection("HLT_match_et", vec_hlt_match_et); - const xAOD::CaloCluster *hlt_match = nullptr; // For matching + const clus_kin *hlt_match = nullptr; // For matching // Loop over OFF clusters - for (const auto& off_cluster : *offCluster_readHandle) { - - if (off_cluster->et() < m_OFF_min_et) continue; - - bool OFF_type_match = false; - - for (unsigned int n = 0; n < m_OFF_types.size(); n++) { - if (off_cluster->clusterSize() == m_OFF_types[n]) { OFF_type_match = true; break; } - } - - if (!m_OFF_types.empty() && !OFF_type_match) continue; + for (const auto& off_cluster: vec_off_clusters) { ++n_off_clusters; - - vec_off_et.push_back(off_cluster->et()*0.001); - vec_off_eta.push_back(off_cluster->eta()); - vec_off_phi.push_back(off_cluster->phi()); - vec_off_time.push_back(off_cluster->time()); - vec_off_type.push_back(off_cluster->clusterSize()); + vec_off_et.push_back(off_cluster.et*0.001); + vec_off_eta.push_back(off_cluster.eta); + vec_off_phi.push_back(off_cluster.phi); + vec_off_time.push_back(off_cluster.parent->time()); + vec_off_type.push_back(off_cluster.parent->clusterSize()); // matching OFF clusters to HLT clusters float min_delta_r = 999999.9; - for (const auto& hlt_cluster : *hltCluster_readHandle) { - - if (hlt_cluster->et() < m_HLT_min_et) continue; + for (const auto& hlt_cluster : vec_hlt_clusters) { - bool HLT_type_match = false; - - for (unsigned int n = 0; n < m_HLT_types.size(); ++n) { - if(hlt_cluster->clusterSize() == m_HLT_types[n]) { HLT_type_match = true; break; } - } - - if (!m_HLT_types.empty() && !HLT_type_match) continue; - - float delta_r = calculateDeltaR(m_max_delta_r, off_cluster->eta(), off_cluster->phi(), hlt_cluster->eta(), hlt_cluster->phi()); + float delta_r = calculateDeltaR(m_max_delta_r, off_cluster.eta, off_cluster.phi, hlt_cluster.eta, hlt_cluster.phi); if (delta_r < min_delta_r) { min_delta_r = delta_r; - hlt_match = hlt_cluster; // avoid HLT double counts? + hlt_match = &hlt_cluster; // avoid HLT double counts? } } // End loop over HLT clusters @@ -335,31 +290,30 @@ StatusCode HLTCalo_TopoCaloClustersMonitor::fillHistograms( const EventContext& ++n_off_clusters_no_match; - vec_off_no_hlt_match_et.push_back(off_cluster->et()*0.001); - vec_off_no_hlt_match_eta.push_back(off_cluster->eta()); - vec_off_no_hlt_match_phi.push_back(off_cluster->phi()); - vec_off_no_hlt_match_time.push_back(off_cluster->time()); - vec_off_no_hlt_match_type.push_back(off_cluster->clusterSize()); + vec_hlt_match_et.push_back(0.); - } + vec_off_vs_hlt_resolution.push_back(0.); + vec_off_vs_hlt_delta_eta.push_back(0.); + vec_off_vs_hlt_delta_phi.push_back(0.); + vec_off_vs_hlt_delta_time.push_back(0.); + vec_off_no_hlt_match.push_back(1); + vec_off_with_hlt_match.push_back(0); + } // With HLT match else { ++n_off_clusters_with_match; - vec_off_with_hlt_match_et.push_back(off_cluster->et()*0.001); - vec_off_with_hlt_match_eta.push_back(off_cluster->eta()); - vec_off_with_hlt_match_phi.push_back(off_cluster->phi()); - vec_off_with_hlt_match_time.push_back(off_cluster->time()); - vec_off_with_hlt_match_type.push_back(off_cluster->clusterSize()); - vec_hlt_match_et.push_back(hlt_match->et() * 0.001); + vec_hlt_match_et.push_back(hlt_match->et * 0.001); - vec_off_vs_hlt_resolution.push_back(((off_cluster->et() - hlt_match->et()) / off_cluster->et()) * 100); - vec_off_vs_hlt_delta_eta.push_back(off_cluster->eta() - hlt_match->eta()); - vec_off_vs_hlt_delta_phi.push_back(calculateDeltaPhi(off_cluster->phi(), hlt_match->phi())); - vec_off_vs_hlt_delta_time.push_back(off_cluster->time() - hlt_match->time()); + vec_off_vs_hlt_resolution.push_back(((off_cluster.et - hlt_match->et) / off_cluster.et) * 100); + vec_off_vs_hlt_delta_eta.push_back(off_cluster.eta - hlt_match->eta); + vec_off_vs_hlt_delta_phi.push_back(calculateDeltaPhi(off_cluster.phi, hlt_match->phi)); + vec_off_vs_hlt_delta_time.push_back(off_cluster.parent->time() - hlt_match->parent->time()); + vec_off_no_hlt_match.push_back(0); + vec_off_with_hlt_match.push_back(1); } } // End loop over OFF clusters @@ -374,21 +328,29 @@ StatusCode HLTCalo_TopoCaloClustersMonitor::fillHistograms( const EventContext& // Fill everything fill(m_mongroup_name, // HLT clusters - HLT_num, HLT_et, HLT_eta, HLT_phi, HLT_time, HLT_type, HLT_size, HLT_barrel_high_et_num, HLT_barrel_high_et_et, HLT_barrel_high_et_eta, HLT_barrel_high_et_phi, - HLT_barrel_high_et_time, HLT_barrel_high_et_type, HLT_barrel_high_et_size, + HLT_num, HLT_et, HLT_eta, HLT_phi, HLT_time, HLT_type, HLT_size, + HLT_barrel_high_et_num, + + // HLT cutmasks + HLT_barrel_high_et, HLT_no_OFF_match, HLT_with_OFF_match, // OFF clusters OFF_num, OFF_et, OFF_eta, OFF_phi, OFF_time, OFF_type, + // OFF cutmasks + OFF_no_HLT_match, OFF_with_HLT_match, + // HLT matched to OFF - HLT_matched_fraction, HLT_no_OFF_match_num, HLT_vs_OFF_minimum_delta_r, HLT_no_OFF_match_et, HLT_no_OFF_match_eta, HLT_no_OFF_match_phi, HLT_no_OFF_match_time, - HLT_no_OFF_match_type, HLT_with_OFF_match_num, HLT_with_OFF_match_et, OFF_match_et, HLT_with_OFF_match_eta, HLT_with_OFF_match_phi, HLT_with_OFF_match_time, - HLT_with_OFF_match_type, HLT_vs_OFF_resolution, HLT_vs_OFF_delta_eta, HLT_vs_OFF_delta_phi, HLT_vs_OFF_delta_time, + HLT_matched_fraction, HLT_no_OFF_match_num, HLT_vs_OFF_minimum_delta_r, + HLT_with_OFF_match_num, + OFF_match_et, + HLT_vs_OFF_resolution, HLT_vs_OFF_delta_eta, HLT_vs_OFF_delta_phi, HLT_vs_OFF_delta_time, // OFF matched to HLT - OFF_matched_fraction, OFF_no_HLT_match_num, OFF_vs_HLT_minimum_delta_r, OFF_no_HLT_match_et, OFF_no_HLT_match_eta, OFF_no_HLT_match_phi, OFF_no_HLT_match_time, - OFF_no_HLT_match_type, OFF_with_HLT_match_num, OFF_with_HLT_match_et, HLT_match_et, OFF_with_HLT_match_eta, OFF_with_HLT_match_phi, OFF_with_HLT_match_time, - OFF_with_HLT_match_type, OFF_vs_HLT_resolution, OFF_vs_HLT_delta_eta, OFF_vs_HLT_delta_phi, OFF_vs_HLT_delta_time + OFF_matched_fraction, OFF_no_HLT_match_num, OFF_vs_HLT_minimum_delta_r, + OFF_with_HLT_match_num, + HLT_match_et, + OFF_vs_HLT_resolution, OFF_vs_HLT_delta_eta, OFF_vs_HLT_delta_phi, OFF_vs_HLT_delta_time ); return StatusCode::SUCCESS; diff --git a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/TrigHLTMonCommon_jobOptions.py b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/TrigHLTMonCommon_jobOptions.py index c58c17a0bc061932061763c5d14bb46d29089845..79cc8819bae691dedb8cf87895f321edf5e6cfae 100755 --- a/Trigger/TrigMonitoring/TrigHLTMonitoring/share/TrigHLTMonCommon_jobOptions.py +++ b/Trigger/TrigMonitoring/TrigHLTMonitoring/share/TrigHLTMonCommon_jobOptions.py @@ -116,23 +116,27 @@ if data_type == 'pool': if hasattr(runArgs,"maxEvents"): theApp.EvtMax=runArgs.maxEvents + + from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter + cfg = TriggerConfigGetter() from TrigDecisionTool.TrigDecisionToolConf import Trig__TrigDecisionTool from AthenaCommon.AppMgr import ToolSvc ToolSvc += Trig__TrigDecisionTool( "TrigDecisionTool" ) from TrigEDMConfig.TriggerEDM import EDMLibraries ToolSvc.TrigDecisionTool.Navigation.Dlls = [e for e in EDMLibraries if 'TPCnv' not in e] + from TriggerJobOpts.TriggerFlags import TriggerFlags + if TriggerFlags.doMT() or TriggerFlags.EDMDecodingVersion() == 3: + ToolSvc.TrigDecisionTool.NavigationFormat="TrigComposite" - if hasattr(runArgs,"useDB"): - if runArgs.useDB: - from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter - cfg = TriggerConfigGetter() - ToolSvc.TrigDecisionTool.TrigConfigSvc = "Trig::TrigConfigSvc/TrigConfigSvc" + if hasattr(runArgs,"useDB") and runArgs.useDB: + ToolSvc.TrigDecisionTool.TrigConfigSvc = "Trig::TrigConfigSvc/TrigConfigSvc" else: log.info("Configure TrigConfigSvc by default") - from TriggerJobOpts.TriggerConfigGetter import TriggerConfigGetter - cfg = TriggerConfigGetter() - ToolSvc.TrigDecisionTool.TrigConfigSvc = "Trig::TrigConfigSvc/TrigConfigSvc" + if not hasattr(svcMgr, 'xAODConfigSvc'): + from TrigConfxAOD.TrigConfxAODConf import TrigConf__xAODConfigSvc + svcMgr += TrigConf__xAODConfigSvc('xAODConfigSvc') + ToolSvc.TrigDecisionTool.TrigConfigSvc = svcMgr.xAODConfigSvc # enable slices for monitoring # otherwise enable slices via monFlags @@ -191,6 +195,9 @@ if hasattr(runArgs,"useDB"): tool_prop = tool.getDefaultProperties() for prop,value in tool_prop.iteritems(): if prop == "TrigConfigTool": - log.info("Set TrigConfigTool %s",tool.getName()) + log.info("Set xAOD::TrigConfigTool %s",tool.getName()) tool.TrigConfigTool="TrigConf::xAODConfigTool" + if prop == "TrigConfigSvc": + log.info("Set xAOD::TrigConfigSvc %s",tool.getName()) + tool.TrigConfigTool="TrigConf::xAODConfigSvc" diff --git a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/CMakeLists.txt b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/CMakeLists.txt index cbafb87b3121163c180b2b08547788e964d9f0e7..34166e6b77f273e28c63a125144b08826e36c3d3 100644 --- a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/CMakeLists.txt +++ b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/CMakeLists.txt @@ -27,8 +27,7 @@ atlas_depends_on_subdirs( PUBLIC TileCalorimeter/TileEvent Trigger/TrigEvent/TrigCaloEvent Trigger/TrigEvent/TrigInDetEvent - Control/AthenaMonitroing - Control/AthenaMOnitoringKernel ) + Control/AthenaMonitoringKernel ) # External dependencies: find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread MathMore Minuit Minuit2 Matrix Physics HistPainter Rint Graf Graf3d Gpad Html Postscript Gui GX11TTF GX11 ) diff --git a/Trigger/TrigMonitoring/TrigStatsFromCool/CMakeLists.txt b/Trigger/TrigMonitoring/TrigStatsFromCool/CMakeLists.txt deleted file mode 100644 index 7e7bb37654bfe5e8f3ca374f415fa14d16f3f9bf..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigStatsFromCool/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -################################################################################ -# Package: TrigStatsFromCool -################################################################################ - -# Declare the package name: -atlas_subdir( TrigStatsFromCool ) - -# Install files from the package: -atlas_install_python_modules( python/*.py ) - diff --git a/Trigger/TrigMonitoring/TrigStatsFromCool/python/HLTRatesCoolReader.py b/Trigger/TrigMonitoring/TrigStatsFromCool/python/HLTRatesCoolReader.py deleted file mode 100755 index b2307ab98b756499dd0c7fd3ac95cf37a6a34579..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigStatsFromCool/python/HLTRatesCoolReader.py +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import sys -from collections import namedtuple,defaultdict -from struct import unpack_from, unpack -from PyCool import cool -from CoolRunQuery.AtlRunQueryTimer import timer -from TrigStatsFromCool.HLTTriggerNamesReader import getSMK,getTriggerNames -import TrigConfStorage.FastBlobReader - - -CountRec = namedtuple('CountRec','ChainCounter Input AfterPrecale Raw Total') -LBI = namedtuple('LBI','lb starttime duration') - -# timers are switched on by setting env ARQDEBUG=1 - - -def getL2Counts(runs,pattern=None): - return __getCounts(runs=runs,pattern=pattern, levels=0x1) - -def getEFCounts(runs,pattern=None): - return __getCounts(runs=runs,pattern=pattern, levels=0x2) - -def getCounts(runs,pattern=None): - return __getCounts(runs=runs,pattern=pattern, levels=0x3) - - - -class TriggerRates: - def __init__(self,level,triggernames,rates): - self._level = level - self._rates = rates - self._triggers = dict([(tn.name,tn) for tn in triggernames]) - for tn in triggernames: - self._rates[tn.counter].triggername=tn.name - - def __repr__(self): - return "Trigger rates for %s\n%r" % (self._level,self._rates) - - def triggers(self): - """list of all triggers that match pattern""" - return self._triggers - - def triggernames(self): - """names of all triggers that match pattern""" - return self._triggers.keys() - - def triggercounters(self): - """counters of all triggers where the name matches pattern""" - return self._rates.keys() - - def __getitem__(self,k): - """access to rates for any trigger, where k can be the trigger name or counter""" - if type(k)==int: - return self._rates[k] - if type(k)==str: - return self._rates[self._triggers[k].counter] - - - -class TriggerRate: - def __init__(self): - self._triggername = "not existing" - self._rates = [] - self._totalcount = 0 - self._totalduration = 0 - - def add(self,rate): - idx = rate.lb()-1 # LB 0 doesn't exist - self._rates.extend( (1+idx-len(self._rates))*[None]) - if self._rates[idx] != None: - raise RuntimeError("Found twice data for the same trigger and same LB") - self._rates[idx] = rate - self._totalcount += rate.counts(0) - self._totalduration += rate.duration() - - def __repr__(self): - return "%s (%i/%1.fsec)" % (self._triggername,self._totalcount,self._totalduration) - - def rates(self): - return self._rates - - - -class Rate: - def __init__(self,lbinfo,countrecord): - self._lbinfo = lbinfo - self._countrecord = countrecord - - def __str__(self): - return "%r" % self - - def __repr__(self): - if self._countrecord: - return "%1.fHz (%i/%1.fs)" % (self.rate(), self.counts(), self._lbinfo.duration) - return "0Hz (0L1A/%1.fs)" % self._lbinfo.duration - - def rate(self,type=0): - return self.counts(type) / self._lbinfo.duration - - def lb(self): - return self._lbinfo.lb - - def duration(self): - return self._lbinfo.duration - - def counts(self,type=0): - if self._countrecord: - return self._countrecord.Total - return 0 - - def hasL1A(self): - return self._countrecord != None - - - - - - -def __findPos(chaincounters, buf): - counterpositions = [] - ndata = len(buf)/20 - for pos in xrange(ndata): - entryCounter = unpack_from('I', buf, 20*pos)[0] # get counter that is at position 'pos' - if entryCounter in chaincounters: - counterpositions += [(entryCounter,pos)] - return counterpositions - - - -def __decodeCounts(pos, buf): - if not pos or 20*pos>=len(buf): return None - return CountRec._make( unpack_from('IIIII', buf, 20*pos) ) - - - -def __printCounts(buf): - ndata = len(buf)/20 - print unpack(ndata*'IIIII', buf) - - -def _getLBInfo(runlist, folder): - lbinfo = {} - with timer("read the lbinfo"): - for run in runlist: - start = run<<32 - end = ((run+1)<<32)-1 - objs = folder.browseObjects(start,end,cool.ChannelSelection(0,0,cool.ChannelSelection.sinceBeforeChannel)) - lbinfo[run] = [0]+[ LBI(o.since()&0xFFFFFFFF, int(o.payload()['StartTime']/1.e9), int( (o.payload()['EndTime']-o.payload()['StartTime'])/1.e9 ) ) for o in objs ] - return lbinfo - - -def __getCounts(runs,pattern=None, levels=0x3): - - if type(runs)==int: runs = [runs] - smks = getSMK(runs) - - triggernames = getTriggerNames(smks.values(),pattern) - - return __getCountsForSMKandTrigNames(smks,triggernames, levels) - - -def __getCountsForSMKandTrigNames(smkByRun, triggerNames, levels): - - doL2 = (levels & 1) != 0 - doEF = (levels & 2) != 0 - - if doL2: - l2Names = {} - l2counts = {} - - if doEF: - efNames = {} - efcounts = {} - - runlist = sorted(smkByRun.keys()) - smks = set(smkByRun.values()) - if doL2: - for smk in smks: - l2Names[smk] = [tn for tn in triggerNames[smk] if tn.level=='L2'] - if doEF: - for smk in smks: - efNames[smk] = [tn for tn in triggerNames[smk] if tn.level=='EF'] - - from CoolConvUtilities.AtlCoolLib import indirectOpen - conn = indirectOpen( "COOLONL_TRIGGER/COMP200", True, True, False) - if doL2: l2folder=conn.getFolder("/TRIGGER/LUMI/LVL2COUNTERS") - if doEF: effolder=conn.getFolder("/TRIGGER/LUMI/EFCOUNTERS") - lbfolder=conn.getFolder("/TRIGGER/LUMI/LBLB") - - lbinfo = _getLBInfo(runlist, lbfolder) - - for run in runlist: - smk = smkByRun[run] - if doL2: - l2names_thissmk = l2Names[smk] - if l2names_thissmk: - l2counts[run] = TriggerRates("L2", l2names_thissmk, _getCountsInFolder(run, -1, [tn.counter for tn in l2names_thissmk], l2folder, lbinfo[run])) - if doEF: - efnames_thissmk = efNames[smk] - if efnames_thissmk: - efcounts[run] = TriggerRates("EF", efnames_thissmk, _getCountsInFolder(run, -1, [tn.counter for tn in efnames_thissmk], effolder, lbinfo[run])) - - if levels&3==1: - return l2counts - elif levels&3==2: - return efcounts - elif levels&3==3: - return l2counts, efcounts - return None - - -def _getCountsInFolder(run, lb, chainCounters, folder, lbinfo): - """ - returns a list of Run/LB indexed CountRec objects - if lb<0 then the list contains the entire run, otherwise it has just one entry for the given run/lb - """ - - with timer("access COOL"): - if lb>=0: - runlb = ( run<<32 ) + lb - objs = [ folder.findObject(runlb,0) ] - else: - start = run<<32 - end = ((run+1)<<32)-1 - objs = folder.browseObjects(start,end,cool.ChannelSelection(0,0,cool.ChannelSelection.sinceBeforeChannel)) - - res = defaultdict(TriggerRate) - pos = None - nocounts = [] - - with timer("read the blob for run %i" % run): - sl = [ (o.since(), o.payload()['Data'].read()) for o in objs ] - - with timer("unpack"): - for (runlb,s) in sl: - #run = runlb>>32 - lb = runlb&0xFFFFFFFF - - lbinfo_thislb = lbinfo[lb] - if lbinfo_thislb.lb != lb: - print "LBInfo",lbinfo_thislb,"is at the wrong place in the array",lb - sys.exit(1) - - if len(s)==0: - nocounts += [ Rate(lbinfo_thislb, None) ] - else: - if len(s)%20 != 0: - raise RuntimeError, "the length of the data vector %i is not a multiple of 20" % len(s) - - #__printCounts(s) - if pos==None: - counterpositions = __findPos(chainCounters, s) - - for counter,pos in counterpositions: - res[counter].add( Rate(lbinfo_thislb, __decodeCounts(pos,s)) ) - - for trigrates in res.values(): - for r in nocounts: - trigrates.add( r ) - return res - - -if __name__=="__main__": - - run = 166786 - triggerpattern = "L2_2e" - - l2rates, efrates = getCounts(run, triggerpattern) - - print l2rates[run].triggernames() - - for r in l2rates[run]['L2_2e5_tight'].rates(): - #print "LB = %3i: %r" % (r.lb(),r) - print "LB=",r.lb(),", rate=",r.rate(),", counts=",r.counts(),", duration=",r.duration() - diff --git a/Trigger/TrigMonitoring/TrigStatsFromCool/python/HLTRatesPlotter.py b/Trigger/TrigMonitoring/TrigStatsFromCool/python/HLTRatesPlotter.py deleted file mode 100755 index 0ea6b49038db003c17f384f8c7520472c0b0534e..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigStatsFromCool/python/HLTRatesPlotter.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - - -from ROOT import TGraph, TH1F - -def plot(runlist, countsl2,countsef): - - print "Start plotting" - - for run in runlist: - - print "Run",run - - example = countsef[run] - - - gr = TGraph( len(example) ) - #gr.SetName ( "graph%i" % (ik+1) ) - #gr.SetTitle( varnames[ik] ) - - for i, (lbinfo, lbcounts) in enumerate(example): - total = lbcounts.Total if lbcounts else 0 - print "%i/%i: %1.1f Hz" % (run, lbinfo.lb, float(total)/lbinfo.duration) - - gr.SetPoint( i, lbinfo.lb, total ) - - - - #gr.Draw("") - - h = TH1F("h","h",10,0,10) - h.Fill(5) - h.Draw() diff --git a/Trigger/TrigMonitoring/TrigStatsFromCool/python/HLTTriggerNamesReader.py b/Trigger/TrigMonitoring/TrigStatsFromCool/python/HLTTriggerNamesReader.py deleted file mode 100755 index 9eb0a0dde79484520627cc823b271d858f527574..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigStatsFromCool/python/HLTTriggerNamesReader.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python - -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration - -import sys -from collections import namedtuple -from PyCool import cool -from CoolRunQuery.AtlRunQueryTimer import timer - -def getDataPeriods(): - runlistdir = '/afs/cern.ch/atlas/www/GROUPS/DATAPREPARATION/DataPeriods' - d = {} - for p in range(ord('A'),ord('J')): - fh = open('%s/data10_7TeV.period%c.runs.list' % (runlistdir,chr(p)) ) - lines = fh.readlines() - d[chr(p)] = [int(l.rstrip('\n')) for l in lines] - fh.close() - return d - - -def getSMK(runlist): - from CoolConvUtilities.AtlCoolLib import indirectOpen - conn = indirectOpen( "COOLONL_TRIGGER/COMP200", True, True, False) - folder = conn.getFolder("/TRIGGER/HLT/HltConfigKeys") - - smk = {} - - for run in runlist: - runlb = ( run<<32 ) - obj = folder.findObject(runlb,0) - smk[run] = obj.payload()['MasterConfigurationKey'] - - return smk - - -def executeQuery(cursor, output, condition, schemaname, tables, bindvars=(), order=None): - from TrigConfigSvc.TrigConfigSvcUtils import getUsedTables - - s_output = ', '.join(output) - s_tables = ', '.join(getUsedTables(output, condition, schemaname, tables)) - s_condition = ' and '.join(condition) - s_order = 'order by %s' % order if order else '' - - - query = 'select distinct %s from %s where %s %s' % \ - (s_output, s_tables, s_condition, s_order ) - #print (str(query)) - if len(bindvars)==0: - cursor.execute(str(query)) - else: - cursor.execute(str(query),bindvars) - return cursor.fetchall() - - -def getTriggerNames(smks, pattern=None): - - if type(smks)==int: smks=set([smks]) - if type(smks)==list: smks=set(smks) - - from TrigConfigSvc.TrigConfigSvcUtils import getTriggerDBCursor - cursor,schemaname = getTriggerDBCursor("TRIGGERDB") - - if not '.' in schemaname: schemaname += '.' - - tn = {} - - tables = { - 'SM' : 'SUPER_MASTER_TABLE', - 'HM' : 'HLT_MASTER_TABLE', - 'TM' : 'HLT_TRIGGER_MENU', - 'M2C': 'HLT_TM_TO_TC', - 'TC' : 'HLT_TRIGGER_CHAIN' - } - - condition = [ - 'SM.SMT_ID = :smk', - 'SM.SMT_HLT_MASTER_TABLE_ID = HM.HMT_ID', - 'HM.HMT_TRIGGER_MENU_ID = M2C.HTM2TC_TRIGGER_MENU_ID', - 'M2C.HTM2TC_TRIGGER_CHAIN_ID = TC.HTC_ID' - ] - - if pattern: - condition += [ "TC.HTC_NAME like '%%%s%%'" % pattern ] - - output = ['TC.HTC_NAME', 'TC.HTC_L2_OR_EF', 'TC.HTC_CHAIN_COUNTER'] - - order = 'TC.HTC_L2_OR_EF desc, TC.HTC_NAME' - - TC = namedtuple('TC','name level counter') - - for smk in smks: - bindvars = { "smk": smk } - - res = executeQuery(cursor, output, condition, schemaname, tables, bindvars, order) - - tn[smk] = [TC._make(r) for r in res] - - return tn - - - -if __name__=="__main__": - dp= getDataPeriods() - - #smkByRun = getSMK(dp['G']) - - #smks = set(smkByRun.values()) - - print getTriggerNames(910,'EF_tauNo') diff --git a/Trigger/TrigMonitoring/TrigStatsFromCool/share/Example_ReadHLTRatesFromCool.py b/Trigger/TrigMonitoring/TrigStatsFromCool/share/Example_ReadHLTRatesFromCool.py deleted file mode 100755 index 2d41cca5f06b6f1b9474fa2a3fde77f2688a4360..0000000000000000000000000000000000000000 --- a/Trigger/TrigMonitoring/TrigStatsFromCool/share/Example_ReadHLTRatesFromCool.py +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env python - -if __name__=="__main__": - - """example how to get the HLT rates from COOL""" - - runs = [165815, 165817] - triggerpattern = "L2_e5" - - from TrigStatsFromCool.HLTRatesCoolReader import getCounts, getL2Counts, getEFCounts - - # getCounts returns L2 and EF rates - l2rates, efrates = getCounts(runs, triggerpattern) - - # one can also do just one level (faster) - # l2rates = getL2Counts(runs, triggerpattern) - - for run in runs: - print "Run",run,"with triggers",l2rates[run].triggernames() - - for r in l2rates[run]['L2_e5_medium'].rates(): - print "LB=",r.lb(),", rate=",r.rate(),"Hz, counts=",r.counts(),", duration=",r.duration(),"sec","*" if not r.hasL1A() else "" - diff --git a/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool.cxx b/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool.cxx index 445077c4084adfafc76e8d38f2d6452aac01c690..cfba7ef87d1652e398b9185014ee0724bb8e79e8 100755 --- a/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool.cxx +++ b/Trigger/TrigMonitoring/TrigTauMonitoring/src/HLTTauMonTool.cxx @@ -815,7 +815,7 @@ StatusCode HLTTauMonTool::fillHistogramsForItem(const std::string & trigItem){ } else { // TrigComposite const std::vector< TrigCompositeUtils::LinkInfo<xAOD::TauJetContainer> > featuresPreselect - = getTDT()->features<xAOD::TauJetContainer>( trig_item_EF, m_HLTTriggerCondition, "TrigTauRecPreselection"); + = getTDT()->features<xAOD::TauJetContainer>( trig_item_EF, m_HLTTriggerCondition,"HLT_TrigTauRecMerged_MVA"); if(featuresPreselect.size() == 0) { ATH_MSG_DEBUG("TrigTauPreselection TauJet container EMPTY in " << trig_item_EF); diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx b/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx index 6bb434ec5bfef1f2854e04c61370d8f10bc2086c..9b146ee19a5c108dfaf9e23deeddecc00b8f485c 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "ComboHypo.h" @@ -10,56 +10,64 @@ #include <sstream> using namespace TrigCompositeUtils; + ComboHypo::ComboHypo(const std::string& name, ISvcLocator* pSvcLocator) : ::AthReentrantAlgorithm(name, pSvcLocator) {} + ComboHypo::~ComboHypo() {} + StatusCode ComboHypo::initialize() { ATH_CHECK( m_outputs.initialize() ); ATH_CHECK( m_inputs.initialize() ); ATH_CHECK( m_inputs.size() == m_outputs.size() ); ATH_MSG_INFO( "with these inputs: "); for (auto inp:m_inputs){ - ATH_MSG_INFO("-- "<< inp.key()); } + ATH_MSG_INFO("-- "<< inp.key()); + } - // find max inputs size auto maxMultEl = std::max_element( m_multiplicitiesReqMap.begin(), m_multiplicitiesReqMap.end(), - []( MultiplicityReqMap::value_type a, MultiplicityReqMap::value_type b ){ - return a.second.size() < b.second.size(); } ); + []( MultiplicityReqMap::value_type a, MultiplicityReqMap::value_type b ){ return a.second.size() < b.second.size(); } + ); const size_t maxMult = maxMultEl->second.size(); if (msgLvl(MSG::INFO)){ ATH_MSG_INFO( "with this multiplicity map: "); - for ( auto m: m_multiplicitiesReqMap ) { - std::ostringstream msg; - std::string mms = "["; - msg<<"["; - for (auto mult: m.second){ - msg<< mult<<", "; - mms+= std::to_string(mult) + ","; + for ( const auto& m : m_multiplicitiesReqMap ) { + std::stringstream msgSS, mmsSS; + msgSS << "["; + mmsSS << "["; + for (const int mult : m.second){ + msgSS << mult << ", "; + mmsSS << std::to_string(mult) << ", "; } - msg<<"]"; - ATH_MSG_INFO("-- "<< m.first<<" multiplicities: "<<msg.str() <<" "<<mms); + msgSS << "]"; + mmsSS << "]"; + ATH_MSG_INFO("-- " << m.first << " multiplicities: " << msgSS.str() << " -> " << mmsSS.str()); } } ATH_CHECK( m_multiplicitiesReqMap.size() != 0 ); + bool errorOccured = false; - for ( auto m: m_multiplicitiesReqMap ) { + for ( const auto& m : m_multiplicitiesReqMap ) { if ( m.second.size() != maxMult ) { errorOccured = true; - ATH_MSG_ERROR( "Chain " << m.first << " configured with input multiplicity " << m.second.size() << " like this: " << m.second << " which is lower than for this chain " << maxMultEl->first << " " << maxMult); + ATH_MSG_ERROR( "Chain " << m.first + << " configured with input multiplicity " << m.second.size() << " like this: " << m.second + << " which is lower than for this chain " << maxMultEl->first << " " << maxMult); } } - return ( errorOccured ? StatusCode::FAILURE : StatusCode::SUCCESS ); + return ( errorOccured ? StatusCode::FAILURE : StatusCode::SUCCESS ); } + StatusCode ComboHypo::finalize() { return StatusCode::SUCCESS; } @@ -71,60 +79,52 @@ StatusCode ComboHypo::copyDecisions( const DecisionIDContainer& passing, const E for ( size_t input_counter = 0; input_counter < m_inputs.size(); ++input_counter ) { // new output decisions - SG::WriteHandle<DecisionContainer> outputHandle = createAndStore(m_outputs[input_counter], context ); + SG::WriteHandle<DecisionContainer> outputHandle = createAndStore(m_outputs.at(input_counter), context ); auto outDecisions = outputHandle.ptr(); - int decCounter = 0; - auto inputHandle = SG::makeHandle( m_inputs[input_counter], context ); + + auto inputHandle = SG::makeHandle( m_inputs.at(input_counter), context ); if ( inputHandle.isValid() ) { - for (const Decision* inputDecision: *inputHandle) { + for (const Decision* inputDecision : *inputHandle) { DecisionIDContainer inputDecisionIDs; decisionIDs( inputDecision, inputDecisionIDs ); - // from all poitive decision in the input only the ones that survived counting are passed over + // from all positive decision in the input only the ones that survived counting are passed over DecisionIDContainer common; std::set_intersection( inputDecisionIDs.begin(), inputDecisionIDs.end(), passing.begin(), passing.end(), std::inserter( common, common.end() ) ); - // collect only chain name from leg name: do not propagate the legdIds? - DecisionIDContainer finalIds; - for (auto c: common){ - finalIds.insert(c); // all Ids used by the Filter, including legs - if (TrigCompositeUtils::isLegId ( HLT::Identifier(c) )){ - auto mainChain = TrigCompositeUtils::getIDFromLeg ( HLT::Identifier(c) ); - finalIds.insert( mainChain.numeric() ); - } - } - - Decision* newDec = newDecisionIn( outDecisions ); + // Propagate chain names as well as leg names + DecisionIDContainer finalIds; + for (const DecisionID c : common){ + const HLT::Identifier cID = HLT::Identifier(c); + finalIds.insert( cID.numeric() ); // all Ids used by the Filter, including legs + if (TrigCompositeUtils::isLegId ( cID )){ + const HLT::Identifier mainChain = TrigCompositeUtils::getIDFromLeg( cID ); + finalIds.insert( mainChain.numeric() ); + } + } + + Decision* newDec = newDecisionIn( outDecisions ); linkToPrevious( newDec, inputDecision, context ); - ATH_MSG_DEBUG("New decision ("<< input_counter<<", "<<decCounter<<") has " - << (TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>( newDec, "initialRoI")).isValid() - << " valid initialRoI and "<< TrigCompositeUtils::getLinkToPrevious(newDec).size() <<" previous decisions; valid Ids="<<finalIds.size()) ; + ATH_MSG_DEBUG("New decision (Container Index:" << input_counter << ", Element Index:"<< newDec->index() <<") has " + << (TrigCompositeUtils::findLink<TrigRoiDescriptorCollection>(newDec, initialRoIString())).isValid() + << " valid initialRoI and "<< TrigCompositeUtils::getLinkToPrevious(newDec).size() <<" previous decisions; valid Ids="<<finalIds.size()) ; insertDecisionIDs( finalIds, newDec ); - - // add View? - if ( inputDecision->hasObjectLink( "view" ) ) { - auto viewEL = inputDecision->objectLink< ViewContainer >( "view" ); - CHECK( viewEL.isValid() ); - newDec->setObjectLink( "view", viewEL ); - } - decCounter++; } } - - if ( msgLvl(MSG::DEBUG) ) { - ATH_MSG_DEBUG(outputHandle.key() <<" with "<< outputHandle->size() <<" decisions:"); - for (auto outdecision: *outputHandle){ - TrigCompositeUtils::DecisionIDContainer objDecisions; - TrigCompositeUtils::decisionIDs( outdecision, objDecisions ); - ATH_MSG_DEBUG("Number of positive decisions for this output: " << objDecisions.size() ); - for ( TrigCompositeUtils::DecisionID id : objDecisions ) { - ATH_MSG_DEBUG( " --- decision " << HLT::Identifier( id ) ); - } + if (msgLvl(MSG::DEBUG)) { + ATH_MSG_DEBUG("Output Handle " << m_outputs.at(input_counter).key() << " with " << outputHandle->size() <<" Decision objects"); + for (const Decision* d : *outputHandle){ + DecisionIDContainer objDecisions; + decisionIDs( d, objDecisions ); + ATH_MSG_DEBUG("Number of positive decisions for Decision object #" << d->index() << ": " << objDecisions.size()); + for (const TrigCompositeUtils::DecisionID id : objDecisions ) { + ATH_MSG_DEBUG(" --- Passes: " << HLT::Identifier( id )); + } } } } @@ -139,144 +139,164 @@ StatusCode ComboHypo::execute(const EventContext& context ) const { DecisionIDContainer passing; // this map is filled with the count of positive decisions from each input CombinationMap dmap; - std::map<TrigCompositeUtils::DecisionID,std::map<int, int>> dmapFeatures; - uint nRequiredUnique; - fillDecisionsMap( dmap, dmapFeatures, context ); - - int nmaps=0; - for ( auto m: m_multiplicitiesReqMap ) { - nRequiredUnique=0; - const DecisionID requiredDecisionID = HLT::Identifier( m.first ).numeric(); + + ATH_CHECK( fillDecisionsMap( dmap, context ) ); + + for ( const auto& m : m_multiplicitiesReqMap ) { + uint32_t nRequiredUnique = 0; + + const HLT::Identifier chain = HLT::Identifier(m.first); + const std::vector<int>& multiplicityPerLeg = m.second; + const DecisionID requiredDecisionID = chain.numeric(); + DecisionIDContainer allDecisionIds; allDecisionIds.insert(requiredDecisionID); bool overallDecision = true; + DecisionIDContainer uniqueDecisions; - std::set< int> uniqueDecisions; - for ( size_t legIndex = 0; legIndex < m.second.size(); ++legIndex ) { - const size_t requiredMultiplicity = m.second[ legIndex ]; + // Check multiplicity of each leg + for ( size_t legIndex = 0; legIndex < multiplicityPerLeg.size(); ++legIndex ) { + const size_t requiredMultiplicity = multiplicityPerLeg.at( legIndex ); nRequiredUnique += requiredMultiplicity; - auto legId = TrigCompositeUtils::createLegName(HLT::Identifier(m.first), legIndex); - if (m.second.size()==1) legId = HLT::Identifier(m.first); // if one part in the menu name, do not use leg00 in name + HLT::Identifier legId = TrigCompositeUtils::createLegName(chain, legIndex); + + // If there is only one leg, then we just use the chain's name. + if (multiplicityPerLeg.size() == 1) { + ATH_MSG_DEBUG(chain << " has multiplicityPerLeg.size() == 1, so we don't use legXXX_HLT_YYY, we just use HLT_YYY"); + legId = chain; + } + const DecisionID requiredDecisionIDLeg = legId.numeric(); - ATH_MSG_DEBUG("Container "<< legIndex<<" Looking at leg : "<<legId ); + ATH_MSG_DEBUG("Container " << legIndex << ", looking at leg : " << legId ); - //check each leg of the chain passes with required multiplicity - size_t observedMultiplicity = 0; - if ( dmap.count(requiredDecisionIDLeg) != 0 ){ - observedMultiplicity = dmap[ requiredDecisionIDLeg ].size(); - ATH_MSG_DEBUG( "Required multiplicity " << requiredMultiplicity << " for leg " << legId.name() << ": observed multiplicity " << observedMultiplicity << " in leg " << legIndex ); + CombinationMap::const_iterator it = dmap.find(requiredDecisionIDLeg); + if ( it == dmap.end() ) { + overallDecision = false; + break; } + + //check this leg of the chain passes with required multiplicity + + const size_t observedMultiplicity = it->second.getCombinations().size(); + ATH_MSG_DEBUG( "Required multiplicity " << requiredMultiplicity << " for leg " << legId + << ": observed multiplicity " << observedMultiplicity << " in leg " << legIndex ); + if ( observedMultiplicity < requiredMultiplicity ) { - overallDecision = false; - break; + overallDecision = false; + break; } - - - const size_t uniqueDecisionsInLeg = dmapFeatures[requiredDecisionIDLeg].size(); - - //check that the multiplicity of unique features is high enough - ATH_MSG_DEBUG("Number of unique decisions per Leg: "<<uniqueDecisionsInLeg<<", number of required decisions: "<<requiredMultiplicity); - if(uniqueDecisionsInLeg<requiredMultiplicity) overallDecision=false; - else - allDecisionIds.insert(requiredDecisionIDLeg); - for (auto feat: dmapFeatures[requiredDecisionIDLeg]){ - uniqueDecisions.insert( feat.first ); + + //keep track of the number of unique features + + for (const auto& entry : it->second.getFeatures()){ + if (entry.first == 0) { + ATH_MSG_WARNING("Disregarding feature hash of zero"); + continue; + } + uniqueDecisions.insert( entry.first ); + // TODO - do something with entry.second (the ROI) } + + allDecisionIds.insert(requiredDecisionIDLeg); } //check that the multiplicity of unique features is high enough - ATH_MSG_DEBUG("Number of unique decisions: "<<uniqueDecisions.size()<<", number of required unique decisions: "<<nRequiredUnique); - if (uniqueDecisions.size()<nRequiredUnique) overallDecision=false; + ATH_MSG_DEBUG("Number of unique decisions: " << uniqueDecisions.size() << ", number of required unique decisions: " << nRequiredUnique); + if ( uniqueDecisions.size() < nRequiredUnique ) { + overallDecision = false; + } //Overall chain decision - ATH_MSG_DEBUG( "Chain " << m.first << ( overallDecision ? " is accepted" : " is rejected") ); + ATH_MSG_DEBUG( "Chain " << chain << ( overallDecision ? " is accepted" : " is rejected") ); if ( overallDecision == true ) { - for (auto decID: allDecisionIds) - passing.insert( passing.end(), decID ); + for (auto decID: allDecisionIds) { + passing.insert( passing.end(), decID ); + ATH_MSG_DEBUG(" Passing " << HLT::Identifier(decID)); + } } - nmaps++; } - if (msgLvl(MSG::DEBUG)){ - for (auto p: passing) - ATH_MSG_DEBUG("Passing "<<HLT::Identifier(p)); - } ATH_CHECK( copyDecisions( passing, context ) ); return StatusCode::SUCCESS; } -void ComboHypo::fillDecisionsMap( CombinationMap & dmap, std::map<TrigCompositeUtils::DecisionID,std::map<int,int>> & featureMap, const EventContext& context) const { - /* pair<index_of_input, index_of_decision> - map <decision_id, vector<pairs<>> list of all decisions of that leg-decID - vector < map<> > = list of all leg-decID, one element per legID - leg0 leg1 - */ - - for ( size_t i = 0; i < m_inputs.size(); ++i ) { - auto inputHandle = SG::makeHandle( m_inputs.at(i), context ); - if ( inputHandle.isValid() ) { - ATH_MSG_DEBUG( "Found implicit RH from " << inputHandle.key() <<" with "<< inputHandle->size() << " elements:" ); - std::map<TrigCompositeUtils::DecisionID,std::map<int,int>> thisFeatureMap; - int decCounter = 0; - for ( const Decision* decision : *inputHandle.cptr() ) { - ATH_MSG_DEBUG( "Input Decision "<<decCounter <<" with "<< decisionIDs( decision ).size() << " active chains IDs" ); - for ( DecisionID id: decisionIDs( decision ) ) { - for ( auto m: m_multiplicitiesReqMap ) { - // search for the chain name in the list of active ones (including legs) - if (HLT::Identifier(id).name().find(m.first) != std::string::npos){ - ATH_MSG_DEBUG( " +++ " << HLT::Identifier( id ) ); - std::pair <int,int> combinationIndex = std::make_pair(i, decCounter); - dmap[id].push_back(combinationIndex); - ATH_MSG_DEBUG("Added in map: "<<dmap[id]); - - //Map features to make sure we are considering unique objects. decision->linkColKeys()[idx] - //is the feature collection's name-hash, which is unique per-RoI. Adding the object index - //allows to correctly identify different objects within the same RoI (example: EF muons) - //or different objects produced per event (example: MET) as being unique - auto features = decision->linkColNames(); - int idx=-1; - for(uint f=0; f<features.size(); f++){ - if(features[f]==featureString()){ - idx=f; - break; - } - } - if(idx>=0){ - featureMap[id][decision->linkColKeys()[idx]+decision->linkColIndices()[idx]] ++; - } - else ATH_MSG_DEBUG("Did not find "<<featureString()); - } - }} - decCounter ++; - } +StatusCode ComboHypo::extractFeatureAndRoI(const Decision* d, const std::string& input, + uint32_t& featureKey, uint16_t& featureIndex, uint32_t& roiKey, uint16_t& roiIndex) const +{ + uint32_t featureClid = 0; // Note: Unused. We don't care what the type of the feature is here + const bool result = d->typelessGetObjectLink(featureString(), featureKey, featureClid, featureIndex); + if (!result) { + ATH_MSG_ERROR("Did not find the feature for Input:" << input << " Element:" << d->index()); + } + // Try and get seeding ROI data too. Don't need to be type-less here + if (m_requireUniqueROI) { + LinkInfo<TrigRoiDescriptorCollection> roiSeedLI = findLink<TrigRoiDescriptorCollection>(d, initialRoIString()); + if (roiSeedLI.isValid()) { + roiKey = roiSeedLI.link.key(); + roiIndex = roiSeedLI.link.index(); } else { - ATH_MSG_DEBUG( "No implicit RH from " << inputHandle.key() ); - //dmap empty in this case + ATH_MSG_ERROR("Did not find a seeding ROI for Input:" << input << " Element:" << d->index()); } } + return StatusCode::SUCCESS; +} + +StatusCode ComboHypo::fillDecisionsMap( CombinationMap & dmap, const EventContext& context) const { + for ( size_t inputContainerIndex = 0; inputContainerIndex < m_inputs.size(); ++inputContainerIndex ) { + auto inputHandle = SG::makeHandle( m_inputs.at(inputContainerIndex), context ); + if ( !inputHandle.isValid() ) { + ATH_MSG_ERROR( "No input ReadHandle from " << inputHandle.key() ); + return StatusCode::FAILURE; + } + ATH_MSG_DEBUG( "Found ReadHandle from " << inputHandle.key() <<" with "<< inputHandle->size() << " elements:" ); + for ( const Decision* decision : *inputHandle ) { + ATH_MSG_DEBUG( "Input Decision #"<< decision->index() <<" with "<< decisionIDs( decision ).size() << " active IDs" ); + for ( const DecisionID id: decisionIDs( decision ) ) { + for ( const auto& m : m_multiplicitiesReqMap ) { + // Search for this ID in the list of active chains processed by this ComboHypo + // Note: We do a find() check rather than require equality as m_multiplicitiesReqMap is configured by chain name + // whereas id is here the per-leg name. The chain name is a sub-string of the leg name. + if (HLT::Identifier(id).name().find( m.first ) == std::string::npos){ + continue; + } + ATH_MSG_DEBUG( " +++ " << HLT::Identifier( id ) ); + + // Obtain unique but type-less key & index identifiers for this Decision node's "Feature" + // and (if m_requireUniqueROI) its initialRoI. + // Allows us to check object uniqueness and prevent multiple objects from the same RoI satisfying one leg. + uint32_t featureKey = 0, roiKey = 0; + uint16_t featureIndex = 0, roiIndex = 0; + ATH_CHECK( extractFeatureAndRoI(decision, inputHandle.key(), featureKey, featureIndex, roiKey, roiIndex) ); + + dmap[id].add(inputContainerIndex, decision->index(), featureKey, featureIndex, roiKey, roiIndex); + } + } + } + } if (msgLvl(MSG::DEBUG)){ ATH_MSG_DEBUG( "Decision map filled :" ); - int legcount=0; - for (auto m: dmap){ - ATH_MSG_DEBUG("leg ["<<legcount<<"]: "); - std::vector<std::pair<int,int>> combinations = m.second; - ATH_MSG_DEBUG(" +++ " << HLT::Identifier( m.first ) <<" mult: "<<combinations.size()); - for (auto comb: combinations){ - ATH_MSG_DEBUG(" Comb: ("<<comb.first<<", "<<comb.second<<")"); + size_t legCount = 0; + for (const auto& entry: dmap){ + ATH_MSG_DEBUG("leg ["<<legCount<<"]: "); + const std::vector<std::pair<uint32_t,uint16_t>>& combinations = entry.second.getCombinations(); + ATH_MSG_DEBUG(" +++ " << HLT::Identifier( entry.first ) <<" mult: "<< combinations.size()); + for (const auto& comb : combinations){ + ATH_MSG_DEBUG(" Comb: (ContainerIndex:"<<comb.first<<", DecisionElementIndex:"<<comb.second<<")"); } - - ATH_MSG_DEBUG("FeatureMap: found "<<featureMap[m.first].size()<<" entries"); - for (auto feat:featureMap[m.first]) - ATH_MSG_DEBUG(" Feature Id "<<feat.first<<", mult "<<feat.second); - legcount++; + const std::vector<std::pair<uint32_t,uint32_t>>& featureMap = entry.second.getFeatures(); + ATH_MSG_DEBUG("FeatureMap: found " << featureMap.size() << " entries"); + for (const auto& feat : featureMap) { + ATH_MSG_DEBUG(" Unique Feature Identifier:" << feat.first << ", From ROI Identifier: " << feat.second); + } + legCount++; } } - + return StatusCode::SUCCESS; } diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h b/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h index c36140fcbb38b7f4847e358c8ff1a94f412b9341..04b4f704d75e588ca0fc655dd2317bcf869ea6d6 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h +++ b/Trigger/TrigSteer/DecisionHandling/src/ComboHypo.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef DECISIONHANDLING_COMBOHYPO_H #define DECISIONHANDLING_COMBOHYPO_H @@ -8,13 +8,15 @@ #include "AthenaBaseComps/AthReentrantAlgorithm.h" #include "DecisionHandling/TrigCompositeUtils.h" +#include "ComboHypoCombination.h" + // STL includes #include <string> #include <utility> /** * @class ComboHypo for combined hypotheses required only counting (multiplicity requirements) - * @warning while configuring it the order of specified multiplicities has to mach order of input decision containers + * @warning while configuring it the order of specified multiplicities has to match order of input decision containers * i.e. if feed with: * electronDecisions * muonDecisions @@ -31,22 +33,45 @@ public: virtual StatusCode execute(const EventContext& context) const override; virtual StatusCode finalize() override; - private: + SG::ReadHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_inputs { this, "HypoInputDecisions", {}, "Input Decisions" }; SG::WriteHandleKeyArray<TrigCompositeUtils::DecisionContainer> m_outputs { this, "HypoOutputDecisions", {}, "Ouput Decisions" }; + Gaudi::Property<bool> m_requireUniqueROI {this, "RequireUniqueROI", false, + "Require each Feature in each leg of the combination to come from a unique L1 seeding ROI."}; + typedef std::map<std::string, std::vector<int>> MultiplicityReqMap; - Gaudi::Property< MultiplicityReqMap > m_multiplicitiesReqMap{this, "MultiplicitiesMap", {}, "Map from the chain name to implicities required at each input"}; + Gaudi::Property< MultiplicityReqMap > m_multiplicitiesReqMap{this, "MultiplicitiesMap", {}, + "Map from the chain name to multiplicities required at each input"}; - //!< iterates over the inputs and for every object (no filtering) crates output object linked to input moving the decisions that are mentioned in the passing set + /** + * @brief iterates over the inputs and for every object (no filtering) crates output object linked to input moving + * the decisions that are mentioned in the passing set + **/ StatusCode copyDecisions( const TrigCompositeUtils::DecisionIDContainer& passing, const EventContext& context ) const; - //!< iterates over all inputs filling the multiplicity map for each input collection - typedef std::map<TrigCompositeUtils::DecisionID, int> MultiplicityMap; - typedef std::map<TrigCompositeUtils::DecisionID, std::vector<std::pair<int,int>>> CombinationMap; - void fillDecisionsMap( CombinationMap & dmap, std::map<TrigCompositeUtils::DecisionID,std::map<int,int>> & featureMap, const EventContext& context) const; + /** + * @brief For a given Decision node from a HypoAlg, extracts type-less identification data on the node's Feature and seeding ROI. + * @param[in] d The Decision node from the HypoAlg, expected to have a "feature" link attached to it. + * Expected to be able to locate a "initialRoI" in its history if RequireUniqueROI=True. + * @param[in] input Name of the collection the Decision comes from, used for error printing only. + * @param[out] featureKey Type-less SG Key hash of the collection hosting the Decision node's feature . + * @param[out] featureIndex Index inside the featureKey collection. + * @param[out] roiKey Type-less SG Key hash of the collection hosting the Decision node's initial ROI collection. + * @param[out] roiIndex Index inside the roiKey collection. + **/ + StatusCode extractFeatureAndRoI(const TrigCompositeUtils::Decision* d, const std::string& input, + uint32_t& featureKey, uint16_t& featureIndex, uint32_t& roiKey, uint16_t& roiIndex) const; + + + /** + * @brief iterates over all inputs filling the multiplicity map for each input collection + **/ + typedef std::map<TrigCompositeUtils::DecisionID, ComboHypoCombination> CombinationMap; + StatusCode fillDecisionsMap( CombinationMap& dmap, const EventContext& context) const; }; + #endif // DECISIONHANDLING_COMBOHYPO_H diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypoCombination.cxx b/Trigger/TrigSteer/DecisionHandling/src/ComboHypoCombination.cxx new file mode 100644 index 0000000000000000000000000000000000000000..3ccebbd064166969394bfa9cb0ac3ee4999df6f7 --- /dev/null +++ b/Trigger/TrigSteer/DecisionHandling/src/ComboHypoCombination.cxx @@ -0,0 +1,28 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#include "ComboHypoCombination.h" + +void ComboHypoCombination::add(const uint32_t inputContainerID, const uint16_t decisionElementID, + const uint32_t featureContainerKey, const uint16_t featureIndex, + const uint32_t roiContainerKey, const uint16_t roiIndex) +{ + m_combinations.push_back( std::make_pair(inputContainerID, decisionElementID) ); + + const uint32_t featureMapLocation = combineKeyAndIndex(featureContainerKey, featureIndex); + const uint32_t roiPayload = combineKeyAndIndex(roiContainerKey, roiIndex); + m_features.push_back( std::make_pair(featureMapLocation, roiPayload) ); +} + +uint32_t ComboHypoCombination::combineKeyAndIndex(const uint32_t key, const uint16_t index) { + return (key + index); +} + +const std::vector< std::pair<uint32_t,uint16_t> >& ComboHypoCombination::getCombinations() const { + return m_combinations; +} + +const std::vector< std::pair<uint32_t,uint32_t> >& ComboHypoCombination::getFeatures() const { + return m_features; +} diff --git a/Trigger/TrigSteer/DecisionHandling/src/ComboHypoCombination.h b/Trigger/TrigSteer/DecisionHandling/src/ComboHypoCombination.h new file mode 100644 index 0000000000000000000000000000000000000000..57d8f68da6120300036bda8a7fb52c6965555525 --- /dev/null +++ b/Trigger/TrigSteer/DecisionHandling/src/ComboHypoCombination.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef DECISIONHANDLING_COMBOHYPOCOMBINATION_H +#define DECISIONHANDLING_COMBOHYPOCOMBINATION_H + +// STL includes +#include <map> +#include <utility> // std::pair +#include <vector> + +/** +* @brief Utility class to assist with the bookkeeping when counting Decision objects which pass +* specific chain-leg requirements. Here Decision nodes are identified by abstract key and index pairs, and these +* node's "Feature" and "initialRoI" by hash values. +* +* This suffices to perform Decision node multiplicity counting, and "Feature"/"initialRoI" uniqueness checks. +**/ +class ComboHypoCombination { +public: + + /** + * @brief Compresses the Feature and ROI type-less ID data into single uint32_t hash values + * and stores this along with the Decision node's key & index in two parallel vectors. + **/ + void add(const uint32_t inputContainerID, const uint16_t decisionElementID, + const uint32_t featureContainerKey, const uint16_t featureIndex, + const uint32_t roiContainerKey, const uint16_t roiIndex); + + /** + * @brief Get the node vector. Each entry corresponds to a Decision node (first: key, second: index) + **/ + const std::vector< std::pair<uint32_t,uint16_t> >& getCombinations() const; + + /** + * @brief Get the features vector. Each entry corresponds to a Decision node's Feature & ROI (first: feature, second: roi) + **/ + const std::vector< std::pair<uint32_t,uint32_t> >& getFeatures() const; + +private: + + /** + * @brief key is a SG hash, so is already well distributed. The hash is incremented by the index + * to create a new per-object hash + **/ + uint32_t combineKeyAndIndex(const uint32_t key, const uint16_t index); + + /** + * @brief Each entry corresponds to a Decision node. + * The first element in the pair is the SG key of the node's collection. + * The second element in the pair is the index inside the collection. + **/ + std::vector< std::pair<uint32_t,uint16_t> > m_combinations; + /** + * @brief Each entry corresponds to the Feature of the node in the parallel m_combinations vector. + * The first element in the pair is a combined hash of the SG key & index of the node's Feature. + * The second element in the pair is a combined hash of the SG key & index of the node's initialRoI + **/ + std::vector< std::pair<uint32_t,uint32_t> > m_features; + +}; + + +#endif // DECISIONHANDLING_COMBOHYPOCOMBINATION_H diff --git a/Trigger/TrigSteer/DecisionHandling/src/HypoBase.cxx b/Trigger/TrigSteer/DecisionHandling/src/HypoBase.cxx index 89a1f4d476abb9458f87bc37bbac3cbdcc0d23ef..90160eb461b61565aa5bb0a79387fcae5aa9fd17 100644 --- a/Trigger/TrigSteer/DecisionHandling/src/HypoBase.cxx +++ b/Trigger/TrigSteer/DecisionHandling/src/HypoBase.cxx @@ -252,7 +252,7 @@ StatusCode HypoBase::printDebugInformation(SG::WriteHandle<DecisionContainer>& o decisionIDs( d, objDecisions ); msg() << "Number of positive decisions for Decision object #" << count++ << ": " << objDecisions.size() << endmsg; for (const TrigCompositeUtils::DecisionID id : objDecisions ) { - msg() << " --- Passes chain: " << HLT::Identifier( id ) << endmsg; + msg() << " --- Passes: " << HLT::Identifier( id ) << endmsg; } } } diff --git a/Trigger/TrigSteer/TrigCompositeUtils/CMakeLists.txt b/Trigger/TrigSteer/TrigCompositeUtils/CMakeLists.txt index 07ea6b7a6f23c3c71f717e61ac5f8f0352895be5..1b6d33e2290827f5a77e05fe99ba57cb65e4ac1d 100644 --- a/Trigger/TrigSteer/TrigCompositeUtils/CMakeLists.txt +++ b/Trigger/TrigSteer/TrigCompositeUtils/CMakeLists.txt @@ -17,7 +17,7 @@ atlas_depends_on_subdirs( PUBLIC Control/CxxUtils Event/xAOD/xAODBase Event/xAOD/xAODMuon - Event/xAOD/xEGamma + Event/xAOD/xAODEgamma AtlasTest/TestTools Control/StoreGate ) @@ -25,8 +25,7 @@ atlas_depends_on_subdirs( PUBLIC atlas_add_library( TrigCompositeUtilsLib Root/*.cxx PUBLIC_HEADERS TrigCompositeUtils - LINK_LIBRARIES xAODTrigger GaudiKernel - PRIVATE_LINK_LIBRARIES AthenaBaseComps CxxUtils ) + PRIVATE_LINK_LIBRARIES AthenaBaseComps CxxUtils GaudiKernel xAODTrigger ) atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigSteer/TrigOutputHandling/python/TrigOutputHandlingConfig.py b/Trigger/TrigSteer/TrigOutputHandling/python/TrigOutputHandlingConfig.py index 7bdf1cc6c954c629990977a208bbbeb645926e25..fce5de0c7d2713a70980cc5202527cf7e901ad7e 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/python/TrigOutputHandlingConfig.py +++ b/Trigger/TrigSteer/TrigOutputHandling/python/TrigOutputHandlingConfig.py @@ -1,7 +1,8 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +from builtins import str def HLTResultMTMakerCfg(name="HLTResultMTMaker"): - from TrigOutputHandlingConf import HLTResultMTMaker + from TrigOutputHandling.TrigOutputHandlingConf import HLTResultMTMaker from AthenaMonitoringKernel.GenericMonitoringTool import GenericMonitoringTool, defineHistogram m = HLTResultMTMaker(name) @@ -80,7 +81,7 @@ def TriggerEDMSerialiserToolCfg(name="TriggerEDMSerialiserTool"): when it gets to setting the serialiser property """ def __repr__(self): - return '[' +','.join( ['"'+str(typekey)+';'+','.join(map( lambda _:str(_), ids) )+'"' for typekey,ids in self.iteritems()] ) + ']' + return '[' +','.join( ['"'+str(typekey)+';'+','.join([str(_) for _ in ids] )+'"' for typekey,ids in self.items()] ) + ']' def __str__(self): return self.__repr__() diff --git a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerBitsMakerTool.cxx b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerBitsMakerTool.cxx index f4689c8b14102fa1ab7ebfbbe66169dc80b4d2d0..a1995535bb537afdd8f8f32e2fdafb35bacf3333 100644 --- a/Trigger/TrigSteer/TrigOutputHandling/src/TriggerBitsMakerTool.cxx +++ b/Trigger/TrigSteer/TrigOutputHandling/src/TriggerBitsMakerTool.cxx @@ -26,6 +26,7 @@ StatusCode TriggerBitsMakerTool::start() { ATH_CHECK( hltMenuHandle.isValid() ); ATH_MSG_INFO("Configuring from " << m_HLTMenuKey << " with " << hltMenuHandle->size() << " chains"); + m_mapping.clear(); m_largestBit = 0; for (const TrigConf::Chain& ch : *hltMenuHandle) { ATH_MSG_DEBUG( "Chain " << ch.name() << " will flip " << ch.counter() << " bit" ); diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py b/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py index aea0fe426f7160e0a816799cf90910ec383734df..847c5d98b9bba06979c06f3a9fd3ead545e143cb 100644 --- a/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py +++ b/Trigger/TrigT1/TrigT1CTMonitoring/share/TrigT1CTMonitoringJobOptions_forRecExCommission.py @@ -196,10 +196,13 @@ if not isOnline: from AthenaMonitoring.DQMonFlags import DQMonFlags histbase = "/" + DQMonFlags.monManFileKey() + "/" - if DQMonFlags.monManRun(): - histbase += "run_RUNNR/" + # temporary disable until solution is found how to provide metadata + #if DQMonFlags.monManRun(): + # from RecExConfig.AutoConfiguration import GetRunNumber + # histbase += "run_%i/" % GetRunNumber() + histbase += "L1/" try: - topSequence.CTPSimulation.HistBase = histbase + topSequence.CTPSimulation.HistPath = histbase except AttributeError as ex: printfunc (ex," ignore for now") import traceback diff --git a/Trigger/TrigT1/TrigT1CTMonitoring/src/BSMonitoring.cxx b/Trigger/TrigT1/TrigT1CTMonitoring/src/BSMonitoring.cxx index a96097d02bd81bbec320087412dabd77be331d01..4ea0c83628ae625d512db3b4d54ddae2deb58d41 100644 --- a/Trigger/TrigT1/TrigT1CTMonitoring/src/BSMonitoring.cxx +++ b/Trigger/TrigT1/TrigT1CTMonitoring/src/BSMonitoring.cxx @@ -23,9 +23,6 @@ #include "TrigConfL1Data/Menu.h" #include "TrigConfStorage/TrigConfCoolFolderSpec.h" -// CTP simulation includes -#include "TrigT1CTP/ThresholdMap.h" - // COOL includes #include "CoraCool/CoraCoolDatabaseSvcFactory.h" #include "CoraCool/CoraCoolDatabaseSvc.h" diff --git a/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt b/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt index 805362b4a871581a827afe8fd182bfb66bbb7b1d..0bcd2c4101cab3c8d896eae6fc9f2e272712fb31 100644 --- a/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt +++ b/Trigger/TrigT1/TrigT1CTP/CMakeLists.txt @@ -16,14 +16,14 @@ atlas_depends_on_subdirs( PUBLIC Trigger/TrigSteer/TrigInterfaces PRIVATE Control/AthenaKernel - Control/AthenaMonitoring Database/AthenaPOOL/AthenaPoolUtilities Event/EventInfo Tools/PathResolver Trigger/TrigConfiguration/TrigConfStorage Trigger/TrigT1/L1Topo/L1TopoConfig Trigger/TrigT1/TrigT1Interfaces - Trigger/TrigT1/TrigT1Result ) + Trigger/TrigT1/TrigT1Result + Trigger/TrigT1/TrigT1CaloUtils ) # External dependencies: find_package( Boost COMPONENTS filesystem thread system ) @@ -36,7 +36,7 @@ atlas_add_component( TrigT1CTP src/*.cxx src/components/*.cxx INCLUDE_DIRS ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GaudiKernel TrigConfData TrigConfL1Data TrigInterfacesLib AthenaKernel AthenaMonitoringLib AthenaPoolUtilities EventInfo PathResolver TrigConfStorage L1TopoConfig TrigT1Interfaces TrigT1Result ) + LINK_LIBRARIES ${Boost_LIBRARIES} ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps StoreGateLib SGtests GaudiKernel TrigConfData TrigConfL1Data TrigInterfacesLib AthenaKernel AthenaPoolUtilities EventInfo PathResolver TrigConfStorage L1TopoConfig TrigT1Interfaces TrigT1Result TrigT1CaloUtilsLib AthenaMonitoringLib ) # Install files from the package: atlas_install_headers( TrigT1CTP ) diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ATLAS_CHECK_THREAD_SAFETY b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ATLAS_CHECK_THREAD_SAFETY new file mode 100644 index 0000000000000000000000000000000000000000..4c5f908d77cb0b55852f896ce7866f81f05ca410 --- /dev/null +++ b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ATLAS_CHECK_THREAD_SAFETY @@ -0,0 +1 @@ +Trigger/TrigT1/TrigT1CTP \ No newline at end of file diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/BunchGroupTrigger.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/BunchGroupTrigger.h deleted file mode 100755 index 06f70f36d9d0b71bd13b5af395c63993980c6533..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/BunchGroupTrigger.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGT1CTP_BUNCH_GROUP_TRIGGER_H -#define TRIGT1CTP_BUNCH_GROUP_TRIGGER_H - -// Base class: -#include "TrigT1CTP/SpecialTrigger.h" - -// STL include(s): -#include <vector> -#include <string> - -namespace LVL1CTP { - - /** - * - * @short Class for simulating the internal bunch group trigger - * Note that a dedicated class to deal with the real bunch group trigger is in TrigT1Interfaces - * @see LVL1CTP::ISpecialTrigger - * @see LVL1CTP::SpecialTrigger - * @see LVL1CTP::PrescaledClockTrigger - * @see LVL1CTP::RandomTrigger - * - * @author Wolfgang Ehrenfeld, University of Hamburg, Germany - * - * @version \$Id: BunchGroupTrigger.h,v 1.4 2008-09-24 16:15:20 efeld Exp $ - * - */ - - class BunchGroupTrigger : public SpecialTrigger { - - public: - - //! default constructor - BunchGroupTrigger(); - //! constructor setting the internal trigger type and rate - BunchGroupTrigger(unsigned int bgrp_number, const std::vector<int>&,unsigned int ctpVersionNumber); - - //! virtual empty destructor - virtual ~BunchGroupTrigger() {} - - virtual StatusCode execute(int bcid); //!< @copydoc LVL1CTP::ISpecialTrigger::execute - virtual bool evaluate() const; //!< @copydoc LVL1CTP::ISpecialTrigger::evaluate - - virtual std::string print() const; //!< @copydoc LVL1CTP::SpecialTrigger::print - virtual std::string dump() const; //!< @copydoc LVL1CTP::SpecialTrigger::dump - - private: - - //! list of bunch IDs - std::vector<int> m_bunches; - - }; // class BunchGroupTrigger - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_BUNCH_GROUP_TRIGGER_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPConstants.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPConstants.h deleted file mode 100755 index c2c28ea07f2a314fe1dec4a707a01734acabd052..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPConstants.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef TRIGT1CTP_CTPCONSTANTS_H -#define TRIGT1CTP_CTPCONSTANTS_H - -#include <string> - -namespace LVL1CTP { - - /** - * - * @short Commonly used constants of the CTP simulation - * - * It seemed reasonable to put all the contants in one place, so that it would be - * easier to change them later on. - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version $Id: CTPConstants.h,v 1.5 2008-02-01 17:20:18 efeld Exp $ - * - */ - - class CTPConstants { - - public: - static const int MAXIMUM_ITEM_COUNT; //!< maximum number of items - static const int MAXIMUM_THRESHOLD_COUNT; //!< maximum number of thresholds - - static const std::string DEFAULT_MuonConfigLocation; //!< location of legacy muon configuration in StoreGate - static const std::string DEFAULT_CaloConfigLocation; //!< location of legacy calo configuration in StoreGate - static const std::string DEFAULT_JEConfigLocation; //!< location of legacy jet energy configuration in StoreGate - - }; // class CTPConstants - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_CTPCONSTANTS_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPDataDumper.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPDataDumper.h deleted file mode 100755 index 6b6ee13bdd9b00ed12f6956d5ef5b06ff5a7cf04..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPDataDumper.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef TRIGT1CTP_CTPDATADUMPER_H -#define TRIGT1CTP_CTPDATADUMPER_H - -// STL include(s): -#include <string> - -// Basic includes: -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ServiceHandle.h" - -// Namespace for the CTP related classes -namespace LVL1CTP { - - /** - * - * @short CTP Data Dumper for CTP releated objects - * - * Dumps object content of CTP related object: - * CTPSLink, CTP_RDO, EventInfo - * - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: CTPDataDumper.h,v 1.5 2009-01-29 21:14:24 efeld Exp $ - * - */ - - class CTPDataDumper : public AthAlgorithm { - - public: - - CTPDataDumper( const std::string& name, ISvcLocator* pSvcLocator ); - ~CTPDataDumper(); - - StatusCode initialize(); - StatusCode execute(); - StatusCode finalize(); - - private: - - // dumper methods - StatusCode dumpCTP_RDO(); //!< dump content of CTP_RDO object - StatusCode dumpCTPSLink(); //!< dump content of CTPSLink object - StatusCode dumpEventInfo(); //!< dump content of EventInfo object - - // Properties: stearing flags - bool m_rawFormat; //!< property, see @link CTPDataDumper::CTPDataDumper @endlink - bool m_prettyFormat; //!< property, see @link CTPDataDumper::CTPDataDumper @endlink - - // Properties: StoreGate location of output - std::string m_roiLoc; //!< property, see @link CTPDataDumper::CTPDataDumper @endlink - std::string m_rdoLoc; //!< property, see @link CTPDataDumper::CTPDataDumper @endlink - - }; // class CTPDataDumper - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_CTPDATADUMPER_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPSimulation.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPSimulation.h deleted file mode 100755 index 16ef3aa09011b9a6545f0dab3b4d4175b90357a6..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPSimulation.h +++ /dev/null @@ -1,243 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGT1CTP_CTPSIMULATION_H -#define TRIGT1CTP_CTPSIMULATION_H - -// Basic includes: -#include "AthenaBaseComps/AthAlgorithm.h" -#include "GaudiKernel/ServiceHandle.h" -#include "GaudiKernel/ToolHandle.h" -#include "GaudiKernel/Property.h" -#include "StoreGate/DataHandle.h" -#include "StoreGate/ReadCondHandleKey.h" - -// monitoring from HLT -#include "TrigInterfaces/IMonitoredAlgo.h" -#include "GaudiKernel/IIncidentListener.h" -#include "TrigConfInterfaces/ILVL1ConfigSvc.h" -#include "TrigT1Interfaces/TrigT1StoreGateKeys.h" -#include "TrigT1Interfaces/MuCTPICTP.h" - -// local includes: -#include "TrigT1CTP/ISpecialTrigger.h" - -// For handling different CTP versions: -#include "CTPfragment/CTPdataformatVersion.h" - -#include "StoreGate/ReadHandleKey.h" -#include "TrigConfData/L1Menu.h" - -// Forward includes: -class IAtRndmGenSvc; -class IMonitorToolBase; -class TH1I; -class ITHistSvc; - -namespace TrigConf { - class PIT; - class ILVL1ConfigSvc; - class TrigConfCoolFolderSpec; - class BunchGroup; -} - -namespace LVL1 { - class MuCTPICTP; - class EmTauCTP; - class JetCTP; - class EnergyCTP; - class MbtsCTP; - class BcmCTP; - class LucidCTP; - class ZdcCTP; - class BptxCTP; - class NimCTP; - class FrontPanelCTP; -} - -namespace LVL1MUCTPI{ - -} - -/// Namespace for the CTP related classes -namespace LVL1CTP { - - // Forward include(s) in local namespace: - class ThresholdMap; - class ItemMap; - class ResultBuilder; - - /** - * - * @short CTP simulation algorithm - * - * This is the simulation of the final CTP hardware's functions. It is not an actual - * hardware simulation (unlike that of the MuCTPI), "only" the functioning of the CTP is - * simulated. The algorithm was developed to be used with the interface to the trigger - * configuration database. - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: CTPSimulation.h,v 1.20 2009-01-29 21:14:24 efeld Exp $ - * - */ - - class CTPSimulation : public AthAlgorithm, virtual public IMonitoredAlgo, virtual public IIncidentListener { - - public: - - CTPSimulation( const std::string& name, ISvcLocator* pSvcLocator ); - ~CTPSimulation(); - - virtual StatusCode initialize(); - virtual StatusCode start(); - virtual StatusCode execute(); - virtual StatusCode finalize(); - virtual StatusCode callback(IOVSVC_CALLBACK_ARGS_P(idx, keys)); - //! handle to result builder (for easy data access) - const ResultBuilder* resultBuilder() const; - - virtual void handle(const Incident& incident); - - private: - StatusCode loadFixedConditions(); - //! Function pointer to the correct multiplicity extraction function: - StatusCode ( LVL1CTP::CTPSimulation::*m_extractFunction ) ( void ); - - //! Function to extract the multiplicity information sent by the sub-systems - StatusCode extractMultiplicities(); - StatusCode LoadBunchGroups(); - - void collectStatistic(); - - StatusCode bookHists(); - - // Needed services: - ServiceHandle<ITHistSvc> m_histSvc; - ServiceHandle<TrigConf::ILVL1ConfigSvc> m_configSvc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - ServiceHandle<IAtRndmGenSvc> m_rndmSvc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_rndmEngineName; //!< property, see @link CTPSimulation::CTPSimulation @endlink - // Needed tools: - ToolHandleArray < IMonitorToolBase > m_monitors; //!< property, see @link CTPSimulation::CTPSimulation @endlink - - // Inputs to the CTP: - const DataHandle< LVL1::EmTauCTP > m_emtauCTP; //!< EmTau input - const DataHandle< LVL1::JetCTP > m_jetCTP; //!< Jet input - const DataHandle< LVL1::EnergyCTP > m_energyCTP; //!< Energy input - const DataHandle< LVL1::MbtsCTP > m_mbtsACTP; //!< MBTSA input - const DataHandle< LVL1::MbtsCTP > m_mbtsCCTP; //!< MBTSC input - const DataHandle< LVL1::BcmCTP > m_bcmCTP; //!< BCM input - const DataHandle< LVL1::LucidCTP > m_lucidCTP; //!< LUCID input - const DataHandle< LVL1::ZdcCTP > m_zdcCTP; //!< ZDC input - const DataHandle< LVL1::NimCTP > m_nimCTP; //!< NIM input - const DataHandle< LVL1::BptxCTP > m_bptxCTP; //!< BPTX input - const DataHandle< LVL1::FrontPanelCTP > m_topoCTP; //!< Topo input - - // Maps between the different trigger objects: - ThresholdMap* m_decisionMap; //!< pointer to threshold map - ItemMap* m_itemMap; //!< pointer to item map - InternalTriggerMap m_internalTrigger; //!< pointer to internal trigger map - - // Properties: stearing flags - unsigned int m_ctpVersion; - bool m_doL1Topo; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doCalo; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doMBTS; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doMBTSSI; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doMuon; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doBCM; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doLUCID; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doZDC; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doBPTX; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doNIM; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doRNDM; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_doPSCL; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_IsData; //!< property, see @link CTPSimulation::CTPSimulation @endlink - Gaudi::CheckedProperty<int> m_prescaleMode; //!< property, see @link CTPSimulation::CTPSimulation @endlink - // Properties: StoreGate location of input - std::string m_jetEnergyConfLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_muonCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_emTauCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_jetCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_energyCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_mbtsACTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_mbtsCCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_bcmCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_lucidCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_zdcCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_bptxCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_nimCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_topoCTPLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - - - SG::ReadHandleKey<LVL1::MuCTPICTP> m_muctpiInputKey { LVL1MUCTPI::DEFAULT_MuonCTPLocation }; - - - // Properties: StoreGate location of output - std::string m_roiOutputLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_roiOutputLoc_Rerun; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_rdoOutputLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - std::string m_rdoOutputLoc_Rerun; //!< property, see @link CTPSimulation::CTPSimulation @endlink - // properties: flags for internal triggers - bool m_applyDeadTime; //!< property, see @link CTPSimulation::CTPSimulation @endlink - bool m_applyBunchGroup; //!< property, see @link CTPSimulation::CTPSimulation @endlink - // Properties: detectorStore location of bunchgroups - std::string m_BunchGroupLoc; //!< property, see @link CTPSimulation::CTPSimulation @endlink - - std::string m_histbase { "/EXPERT/" }; - /** - * If IntroduceArtificialTriggerOffsets is set to true, and a text - * file with the configuration of the trigger offsets is defined via - * OffsetConfigFile, a readout window of m_readoutWindow BCs is - * introduced to insert artificial trigger offsets in the simulated - * bytestream data to mimic timing problems that might ocurr in real data. - */ - uint32_t m_readoutWindow; //!< size of readout window to be inserted in BCs - bool m_introduceArtificialTriggerOffsets; //!< status flag for introducing artificial trigger offsets - std::string m_offsetConfigFile; //!< path to configuration file for trigger offsets - - CTPdataformatVersion* m_ctpDataformat; //!< version of the ctp to be used - - ResultBuilder* m_resultBuilder; //!< handle to result builder (for easy data access) - - // additional monitoring variables - std::vector<float> m_prescales; //!< prescale set (for monitoring) - - std::vector<int> m_countsBP; //!< Counts for summary BP - std::vector<int> m_countsAP; //!< Counts for summary AP - std::vector<int> m_countsAV; //!< Counts for summary AV - - // histograms - TH1I * m_HistL1TopoDecisionCable0 { nullptr }; - TH1I * m_HistL1TopoDecisionCable1 { nullptr }; - TH1I * m_itemAcceptBP { nullptr }; - TH1I * m_itemAcceptAP { nullptr }; - TH1I * m_itemAcceptAV { nullptr }; - - TH1I* m_thrEMMult { nullptr }; - TH1I* m_thrHAMult { nullptr }; - TH1I* m_thrJET1Mult { nullptr }; - TH1I* m_thrJET2Mult { nullptr }; - TH1I* m_thrMUMult { nullptr }; - TH1I* m_thrTEMult { nullptr }; - TH1I* m_thrXEMult { nullptr }; - TH1I* m_thrXSMult { nullptr }; - - TH1I* m_thrEMTot { nullptr }; - TH1I* m_thrHATot { nullptr }; - TH1I* m_thrJETTot { nullptr }; - TH1I* m_thrMUTot { nullptr }; - TH1I* m_thrTETot { nullptr }; - TH1I* m_thrXETot { nullptr }; - TH1I* m_thrXSTot { nullptr }; - - bool m_useCondL1Menu { false }; //!< flag to enable/disable use of new conditions-based configuration - SG::ReadCondHandleKey<TrigConf::L1Menu> m_l1MenuKey { "L1Menu" }; - - }; // class CTPSimulation - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_CTPSIMULATION_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPTriggerItem.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPTriggerItem.h deleted file mode 100755 index 70d98fe340c9a52c62a043bf5e1fd598e3fe9df7..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPTriggerItem.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef TRIGT1CTP_CTPTRIGGERITEM_H -#define TRIGT1CTP_CTPTRIGGERITEM_H - -// Forward include(s): -namespace TrigConf { - class TriggerItem; -} - -namespace LVL1CTP { - - /** - * - * @short Class storing information helping to make the CTP decision - * - * The trigger configuration classes can't contain all the information - * that would make creating the CTP decision simple, so I define a few - * additional classes, like this one. One such object always belongs to - * exactly one TrigConf::TriggerItem object. - * It contains the prescale (value and counter) and (for historic reasons) - * the item position. - * - * @see TrigConf::TriggerItem - * @see LVL1CTP::ItemMap - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: CTPTriggerItem.h,v 1.3 2007-06-15 16:15:59 efeld Exp $ - * - */ - - class CTPTriggerItem { - - public: - /// constructor setting trigger item and corresponding prescale - CTPTriggerItem( const TrigConf::TriggerItem* parent, int prescale ); - /// default destructor - ~CTPTriggerItem(); - - /// Returns pointer to associated TrigConf::TriggerItem object - const TrigConf::TriggerItem* item() const; - - // Accessor functions: - int prescale() const; //!< get prescale value - - int prescaleCounter() const; //!< get counter for prescale - void setPrescaleCounter( int counter ); //!< set counter for prescale - - unsigned int itemPos() const; //!< get item position as in CTP hardware - void setItemPos( unsigned int position ); //!< set item position as in CTP hardware - - private: - const TrigConf::TriggerItem* m_parent; //!< pointer to associated TrigConf::TriggerItem object - const int m_prescale; //!< prescale value - int m_counter; //!< counter for prescale - unsigned int m_position; //!< item position in CTP hardware - - }; // class CTPTriggerItem - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_CTPTRIGGERITEM_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPTriggerItemNode.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPTriggerItemNode.h deleted file mode 100755 index 3d21f009acb3929677b866dcf08500989e6819ac..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPTriggerItemNode.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef TRIGT1CTP_CTPTRIGGERITEMNODE_H -#define TRIGT1CTP_CTPTRIGGERITEMNODE_H - -#include "TrigT1CTP/ISpecialTrigger.h" - -namespace TrigConf { - class TriggerItemNode; -} - -namespace LVL1CTP { - - class ThresholdMap; - - /** - * @short Class making decision about a whole trigger item - * - * The decision about a single trigger item can be made with one recursive - * function, but for future flexibility it seemed wise to create a class around - * that function... - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: CTPTriggerItemNode.h,v 1.4 2007-06-15 16:15:59 efeld Exp $ - * - */ - - class CTPTriggerItemNode { - - public: - /// Make decision about trigger item - static bool evaluate( const TrigConf::TriggerItemNode* node, const ThresholdMap* map, const InternalTriggerMap* internalTrigger ); - - }; // class CTPTriggerItemNode - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_CTPTRIGGERITEMNODE_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPTriggerThreshold.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPTriggerThreshold.h deleted file mode 100755 index a38508a79b7b0add0cc138d7d9cb67f69dbc2760..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPTriggerThreshold.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef TRIGT1CTP_CTPTRIGGERTHRESHOLD_H -#define TRIGT1CTP_CTPTRIGGERTHRESHOLD_H - -// Forward include(s): -namespace TrigConf { - class TriggerThreshold; -} - -namespace LVL1CTP { - - /** - * - * @short Helper class holding trigger threshold multiplicity - * - * For each TrigConf::TriggerThreshold object, I create one of these objects. - * I use it to determine the multiplicity for the referenced threshold in the given event. - * For convinience the object knows which TriggerThreshold object it belongs to. However, - * as most of the time one wants to find the CTPTriggerThreshold object belonging - * to a given TriggerThreshold (when making the CTP decision), the DecisionThresholdMap - * can be used to do that kind of association. - * - * @see TrigConf::TriggerThreshold - * @see ThresholdMap - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: CTPTriggerThreshold.h,v 1.3 2007-06-15 16:15:59 efeld Exp $ - * - */ - - class CTPTriggerThreshold { - - public: - /// constructor setting the TrigConf::TriggerThreshold - CTPTriggerThreshold( const TrigConf::TriggerThreshold* parent ); - /// default destructor - ~CTPTriggerThreshold(); - - /// Function returning a pointer to the referenced TriggerThreshold object - const TrigConf::TriggerThreshold* threshold() const; - - /// Get multiplicity of the threshold - int value() const; - /// Set the multiplicity of the threshold - void setValue( int value ); - - /// Get the start position of the threshold - unsigned int startBit() const; - /// Set the start position of the threshold - void setStartBit( unsigned int start ); - - /// Get the end position of the threshold - unsigned int endBit() const; - /// Set the end position of the threshold - void setEndBit( unsigned int end ); - - - // - // /// Get the start position of the threshold on the PIT bus - // int pitStart() const; - // /// Set the start position of the threshold on the PIT bus - // void setPitStart( int pit_start ); - // - // /// Get the end position of the threshold on the PIT bus - // int pitEnd() const; - // /// Set the end position of the threshold on the PIT bus - // void setPitEnd( int pit_end ); - - private: - const TrigConf::TriggerThreshold* m_parent {nullptr}; //!< associated TrigConf::TriggerThreshold - int m_value {0}; //!< multiplicity of threshold - unsigned int m_start_bit {0}; //!< start position of threshold - unsigned int m_end_bit {0}; //!< end position of threshold - // int m_pit_start; //!< start position of threshold on PIT bus - // int m_pit_end; //!< end position of threshold on PIT bus - - }; // class CTPTriggerThreshold - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_CTPTRIGGERTHRESHOLD_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CustomBit.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CustomBit.h deleted file mode 100644 index 1ed211e19a5b59e600fc3fa74019bea7b6cf873a..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CustomBit.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef TRIGT1CTP_CUSTOMBIT_H -#define TRIGT1CTP_CUSTOMBIT_H - -// STL includes: -#include <bitset> - -// monitoring from HLT -#include "TrigInterfaces/IMonitoredAlgo.h" - -// Local includes: -#include "TrigT1CTP/ResultBuilder.h" - -namespace LVL1CTP { - - // Forward include(s) in local namespace: - class CTPSimulation; - - /** - * - * @short Helper class for monitoring CTP results - * - * Helper classs for monitoring CTP results (PIT, TBP, TAP, TAV). - * Data access is via the LVL1::ResultBuilder class. - * - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: CustomBit.h,v 1.2 2008-09-24 15:12:12 efeld Exp $ - * - */ - - class CustomBit : public IMonitoredAlgo::IGetter { - - public: - - //! default constructor, not implemented! - CustomBit() - : m_algo(0), m_func(0), m_resultBuilder(0), m_result(0) {} - //! constructor - CustomBit(const CTPSimulation* algo, Result func) - : m_algo(algo), m_func(func), m_resultBuilder(0), m_result(0) {} - - //! return size of data - /* function performs caching of result bit vector and must be - called always before CustomBit::get() function. This is the - case for the usage in TrigGenericMonitoringTool class. */ - virtual unsigned int size() const; - //! indexed access to data - inline virtual double get(unsigned pos) const; - - private: - - const CTPSimulation* m_algo; //!< pointer to algorithm - const Result m_func; //!< pointer to data access function - - mutable const ResultBuilder* m_resultBuilder; //!< cache for pointer to current ResultBuilder object - mutable std::bitset<512> m_result; //!< cache for result bitset - - }; - - // inline member functions - - double CustomBit::get(unsigned pos) const { return m_result[pos] ? pos : -1.; } - -} - -#endif // TRIGT1CTP_CUSTOMBIT_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/EventInfo.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/EventInfo.h deleted file mode 100755 index 08cfed385cfe3cdb636ea1e11bd6d16b8f53598b..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/EventInfo.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGT1CTP_EVENTINFO_H -#define TRIGT1CTP_EVENTINFO_H - -// STL include(s): -#include <string> -#include <memory> - -namespace LVL1CTP { - - /** - * - * @short Just an idea of how to store event related information in the CTP sim... - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: EventInfo.h,v 1.6 2009-01-18 04:35:55 ssnyder Exp $ - * - */ - - class EventInfo { - - public: - - static EventInfo& instance(); //!< get singleton instance - - void clear(); //!< clear all data members - const std::string dump() const; //!< dump all data members to string - - unsigned int runNumber() const; //!< get run number - void setRunNumber( unsigned int value ); //!< set run number - - unsigned int eventNumber() const; //!< get event number - void setEventNumber( unsigned int value ); //!< set event number - - unsigned int eventType() const; //!< get LVL1 event type - void setEventType( unsigned int type ); //!< set LVL1 event type - - unsigned int triggerType() const; //!< get LVL1 trigger type - void setTriggerType( unsigned int type ); //!< set LVL1 trigger type - - unsigned int extendedL1ID() const; //!< get extended LVL1 ID - void setExtendedL1ID( unsigned int l1id ); //!< set extended LVL1 ID - - unsigned int bcid() const; //!< get bunch crossing ID - void setBCID( unsigned int bcid ); //!< set bunch crossing ID - - unsigned int time() const; //!< get time in sec - void setTime( unsigned int time ); //!< set time in sec - - unsigned int timeNs() const; //!< get time offset in ns - void setTimeNs( unsigned int time ); //!< set time offset in ns - - protected: - - //! default constructor - EventInfo(); - - private: - - static std::auto_ptr<EventInfo> m_instance; - - unsigned int m_runNumber; //!< run number - unsigned int m_eventNumber; //!< event number - unsigned int m_eventType; //!< LVL1 event type - unsigned int m_triggerType; //!< LVL1 trigger type - unsigned int m_l1id; //!< extended LVL1 ID - unsigned int m_bcid; //!< bunch crossing ID - unsigned int m_utcTime; //!< universal time in sec - unsigned int m_timeNsOffset; //!< time offset in ns - - }; // class EventInfo - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_EVENTINFO_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ISpecialTrigger.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ISpecialTrigger.h deleted file mode 100755 index 7fff61f754075020c484bb3f9fb03d7f3c906c8e..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ISpecialTrigger.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGT1CTP_ISPECIAL_TRIGGER_H -#define TRIGT1CTP_ISPECIAL_TRIGGER_H - -// STL include(s): -#include <string> -#include <map> - -// LVL1 include(s): -#include "TrigConfL1Data/L1DataDef.h" - -// Forward includes: -class StatusCode; - -namespace LVL1CTP { - - /** - * @short Interface for internal trigger classes - * - * @author Wolfgang Ehrenfeld, University of Hamburg, Germany - * - * @version \$Id: ISpecialTrigger.h,v 1.7 2009-01-29 20:54:31 efeld Exp $ - * - */ - - class ISpecialTrigger { - - public: - - //! virtual empty destructor - virtual ~ISpecialTrigger() {} - - virtual unsigned int rate() const = 0; //!< get rate of internal trigger - virtual std::string name() const = 0; //!< get name of internal trigger - virtual unsigned int pit() const = 0; //!< get signal position on PIT bus - - virtual StatusCode execute(int bcid=1) = 0; //!< execute trigger simulation - - virtual bool evaluate() const = 0; //!< test, if internal trigger fires - virtual std::string print() const = 0; //!< print configuration to string - virtual std::string dump() const = 0; //!< dump raw configuration to string - - private: - - }; // class ISpecialTrigger - - /// typedef for internal trigger type - //typedef TrigConf::L1DataDef::InternalTriggerType InternalTriggerType; - /// typedef for map between internal trigger type and internal trigger class - typedef std::map< std::pair<TrigConf::L1DataDef::TriggerType, unsigned int>, ISpecialTrigger*> InternalTriggerMap; - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_ISPECIAL_TRIGGER_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ItemMap.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ItemMap.h deleted file mode 100755 index 190e64f1c9acfdd466b5a13c6b927e8c224f458e..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ItemMap.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef TRIGT1CTP_ITEMMAP_H -#define TRIGT1CTP_ITEMMAP_H - -// STL include(s): -#include <vector> -#include <map> - -// local include(s): -#include "TrigT1CTP/MsgLogger.h" -#include "TrigT1CTP/ISpecialTrigger.h" -#include "TrigConfL1Data/Menu.h" - -// Forward include(s): -namespace CLHEP { - class HepRandomEngine; -} -namespace TrigConf { - class TriggerItem; - class PrescaleSet; -} - -namespace LVL1CTP { - - // forward includes in namespace LVL1CTP - class CTPTriggerItem; - class ThresholdMap; - - //! helper struct for sorting the keys in the ItemMap - struct ItemMapCmp { - bool operator()(const TrigConf::TriggerItem* t1, const TrigConf::TriggerItem* t2) const { - return t1->ctpId() < t2->ctpId(); - } - }; - - /** - * - * @short Map associating TrigConf::TriggerItem objects to CTPTriggerItem objects - * - * This object can be used to create and maintain CTPTriggerItem objects for each - * of the TrigConf::TriggerItem ones. - * - * @see TrigConf::TriggerItem - * @see CTPTriggerItem - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: ItemMap.h,v 1.6 2008-07-08 21:35:10 efeld Exp $ - * - */ - - class ItemMap { - - public: - //! constructor setting list of trigger items and associated prescales (random prescale offset if randEngine is given) - ItemMap( const TrigConf::ItemContainer& item_vector, const TrigConf::PrescaleSet& prescales, - CLHEP::HepRandomEngine* randEng = 0 ); - //! default destructor - ~ItemMap(); - - /// Get pointer to associated CTPTriggerItem object - CTPTriggerItem* getItem( const TrigConf::TriggerItem* item ) const; - - //! update prescales (either by one or randomly if randEngine is given) - void updatePrescaleCounters( const ThresholdMap* decisionMap, const InternalTriggerMap* internalTrigger, CLHEP::HepRandomEngine* randEngine = 0 ); - - private: - - /// map between TrigConf::TriggerItem and CTPTriggerItem - std::map< const TrigConf::TriggerItem*, CTPTriggerItem*, ItemMapCmp > m_map; - /// message logger - MsgLogger m_logger; - - }; // class ItemMap - -} // namespace LVL1CTP -#endif // TRIGT1CTP_ITEMMAP_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/MsgLogger.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/MsgLogger.h deleted file mode 100755 index 55bcaa610095d42fa01f6cf540b1a9cde0472ec4..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/MsgLogger.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGT1CTP_MSGLOGGER_H -#define TRIGT1CTP_MSGLOGGER_H - -// STL include(s): -#include <string> - -// Gaudi include(s): -#include "GaudiKernel/IMessageSvc.h" - -namespace LVL1CTP { - - // Forward declaration(s) in namespace LVL1CTP - class MsgWriter; - - /** - * - * @short This class should be used to do all printouts in the simulation. - * - * One shouldn't use the standard output in the simulation, - * altough it's still used in some places. Instead this class - * should be used, as it will automatically redirect the - * messages to the correct output. - * - * @see MsgWriter - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: MsgLogger.h,v 1.3 2007-06-15 16:15:59 efeld Exp $ - * - */ - - class MsgLogger { - - public: - /// Constructor with the message source defined by 'source'. - MsgLogger( const std::string& source ); - /// default destructor - ~MsgLogger(); - - /// Send a message of type 'type' to the output. - void send( MSG::Level type, const std::string& message ) const; - - bool - msgLvl (const MSG::Level lvl) const; - - private: - const std::string m_source; //!< name of originating class - MsgWriter* m_msgWriter; //!< handle to message write class - - }; // class MsgLogger - - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_MSGLOGGER_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/MsgWriter.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/MsgWriter.h deleted file mode 100755 index 35f1c1f00e8e01b94f0bd59d2d369528ca34051e..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/MsgWriter.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGT1CTP_MSGWRITER_H -#define TRIGT1CTP_MSGWRITER_H - -// STL include(s): -#include <string> - -// Gaudi include(s): -#include "GaudiKernel/IMessageSvc.h" - -// Forward declaration(s): -class MsgStream; - -namespace LVL1CTP { - - /** - * - * @short Singleton class responsible for showing messages - * - * It is easier to provide a common logging facility for all the - * classes in the CTP simulation. This class is part of that facility. - * - * @see MsgLogger - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: MsgWriter.h,v 1.3 2007-06-15 16:15:59 efeld Exp $ - * - */ - - class MsgWriter { - - public: - /// Singleton method for requesting the one and only object. - static MsgWriter* instance(); - /// default destructor - ~MsgWriter(); - - /** @brief Test the output level - * @param lvl The message level to test against - * @return boolean Indicting if messages at given level will be printed - * @retval true Messages at level "lvl" will be printed - */ - bool - msgLvl (const MSG::Level lvl) const; - - /// Write the message given in 'line' having a priority defined by 'type'. - void write( MSG::Level type, const std::string& line ); - - /// Set the name under which to send messages. - void setName( const std::string& name ); - - protected: - /// Singleton design, the constructor is protected. - MsgWriter(); - - private: - /// The pointer to the only instance of the object. - static MsgWriter* m_instance; - MsgStream* m_stream; - - }; // class MsgWriter - - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_MSGWRITER_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/PrescaledClockTrigger.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/PrescaledClockTrigger.h deleted file mode 100755 index 6488c87406f4c53e8505989023e53fd118225b71..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/PrescaledClockTrigger.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGT1CTP_PRESCALED_CLOCK_TRIGGER_H -#define TRIGT1CTP_PRESCALED_CLOCK_TRIGGER_H - -// Base class: -#include "TrigT1CTP/SpecialTrigger.h" - -namespace LVL1CTP { - - /** - * - * @short Class for simulating the internal prescaled clock trigger - * - * @see LVL1CTP::ISpecialTrigger - * @see LVL1CTP::SpecialTrigger - * @see LVL1CTP::BunchGroupTrigger - * @see LVL1CTP::RandomTrigger - * - * @author Wolfgang Ehrenfeld, University of Hamburg, Germany - * - * @version \$Id: PrescaledClockTrigger.h,v 1.4 2007-06-15 16:14:01 efeld Exp $ - * - */ - - class PrescaledClockTrigger : public SpecialTrigger { - - public: - - //! default constructor - PrescaledClockTrigger(); - //! constructor setting the internal trigger type and rate - PrescaledClockTrigger(unsigned int clock_number, const unsigned int, unsigned int ctpVersionNumber); - - virtual StatusCode execute(int /*bcid*/); //!< @copydoc LVL1CTP::ISpecialTrigger::execute - virtual bool evaluate() const; //!< @copydoc LVL1CTP::ISpecialTrigger::evaluate - - private: - - }; // class PrescaledClockTrigger - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_PRESCALED_CLOCK_TRIGGER_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/RandomTrigger.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/RandomTrigger.h deleted file mode 100755 index 0788d4f3100af4a6ebecb8c3827dca07ba4ce004..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/RandomTrigger.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGT1CTP_RANDOM_TRIGGER_H -#define TRIGT1CTP_RANDOM_TRIGGER_H - -// Base class: -#include "TrigT1CTP/SpecialTrigger.h" - - -// Forward include(s): -namespace CLHEP { - class HepRandomEngine; -} - -namespace LVL1CTP { - - /** - * - * @short Class for simulating the internal random trigger - * - * @see LVL1CTP::ISpecialTrigger - * @see LVL1CTP::SpecialTrigger - * @see LVL1CTP::BunchGroupTrigger - * @see LVL1CTP::PrescaledClockTrigger - * - * @author Wolfgang Ehrenfeld, University of Hamburg, Germany - * - * @version \$Id: RandomTrigger.h,v 1.6 2007-06-15 16:14:01 efeld Exp $ - * - */ - - class RandomTrigger : public SpecialTrigger { - - public: - - //! default constructor - RandomTrigger(); - //! constructor setting the internal trigger type and random number engine - RandomTrigger(unsigned int rand_number, const unsigned int,unsigned int ctpVersionNumber, CLHEP::HepRandomEngine* randEng = 0); - - //! destructor - virtual ~RandomTrigger(); - - virtual StatusCode execute(int /*bcid*/); //!< @copydoc LVL1CTP::ISpecialTrigger::execute - virtual bool evaluate() const; //!< @copydoc LVL1CTP::ISpecialTrigger::evaluate - - private: - - //! initialisation of random trigger - virtual void Init(); - - //! random generator - CLHEP::HepRandomEngine* m_randEngine; - - }; // class RandomTrigger - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_RANDOM_TRIGGER_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ResultBuilder.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ResultBuilder.h deleted file mode 100755 index 28aa9c214e3cd991c9f4457f70a9da6f6809c038..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ResultBuilder.h +++ /dev/null @@ -1,213 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef TRIGT1CTP_RESULTBUILDER_H -#define TRIGT1CTP_RESULTBUILDER_H - -// local include(s): -#include "TrigT1CTP/MsgLogger.h" -#include "TrigT1CTP/ISpecialTrigger.h" - -#include <stdint.h> - -// For handling different CTP versions: -#include "CTPfragment/CTPdataformatVersion.h" - -// Forward declaration(s): -//class CTPdataformatVersion; -namespace TrigConf { - class CTPConfig; -} -class CTP_RDO; - -namespace LVL1CTP { - - // Forward declaration(s) in local namespace: - class CTPSLink; - class ThresholdMap; - class ItemMap; - - /** - * - * @short Class used to create the CTP output (RDO, SLink and TriggerInfo) - * - * This object recieves the extracted information, and - * creates the CTP's output to the DAQ system (CTP_RDO) and - * to the RoIBuilder (LVL1CTP::CTP_SLink). It also creates - * the extended LVL1 ID and the trigger type stored in the - * LVL1 part of the TriggerInfo used in the EventInfo - * class. - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: ResultBuilder.h,v 1.13 2008-06-10 13:49:28 efeld Exp $ - * - */ - - class ResultBuilder { - - public: - - //! constructor setting configuration, decision, items and internal triggers - ResultBuilder( unsigned int ctpVersionNumber, const TrigConf::CTPConfig* ctpConfig, const ThresholdMap* decisionMap, const ItemMap* itemMap, const InternalTriggerMap* internalTrigger, const uint32_t readoutWindow = 1); - //! default destructor - ~ResultBuilder(); - - //! build RoI result (LVL1CTP::CTPSLink) - const CTPSLink* constructRoIResult() const; - //! build RDO result (CTP_RDO) - const CTP_RDO* constructRDOResult() const; - - //! get extendedLevel1ID - uint32_t extendedLevel1ID() const; - - //! get TIP words - std::vector<uint32_t> tip() const; - - //! get full trigger result before prescale - std::vector<uint32_t> triggerResult() const { return tav(); }; - //! get full trigger result before prescale - std::vector<uint32_t> tbp() const; - //! get full trigger result after prescale - std::vector<uint32_t> tap() const; - //! get full trigger result after veto - std::vector<uint32_t> tav() const; - - //! get trigger type before prescale - uint32_t triggerType() const { return ttav(); }; - //! get trigger type before prescale - uint32_t ttbp() const; - //! get trigger type after prescale - uint32_t ttap() const; - //! get trigger type after veto - uint32_t ttav() const; - - //! read configuration for trigger offsets - bool readOffsetConfig(const std::string& filename); - - private: - - enum WrdType { - TBP, //!< Trigger Before Prescale - TAP, //!< Trigger After Prescale - TAV //!< Trigger After Veto - }; - - /** map of items and their offsets (in units of BCs). The item - * number is the key, the offset to be applied to that item is - * the value. - */ - typedef std::map<unsigned short, int> OffsetMap; - - /** map of fired items and the item and offset pairs that are - * supposed to be realised if the item fired. The fired item - * number is the key, the value is the map of items and the - * offsets that are supposed to be added to the latter - * items. Example: when item no 1 fired, item no 4 is supposed to - * be delayed by 3 BCs, item no 6 by 1 BC. This would correspond - * to an entry in ChangeRulesMap like : - * < key: 1 | value: < - * key: 4 | value: 3; - * key: 6 | value: 1 - * > - * >. - * Note: the offsets are always in units of BCs - */ - typedef std::map<unsigned short, OffsetMap> ChangeRulesMap; //!< data type for static trigger offset configuration - - /** Introduces artificial offsets in the trigger result words - in order to simulate not timed-in sub detectors. - */ - void changeTriggerWords(std::vector<uint32_t>& triggerWords) const; - - /** Function that introduces artificial offsets in the RoI - * result. In order to mimic real data as closely as possible, - * one can introduce a window of BCs into the CTP simulation, - * just like the real hardware can perform a readout in a window - * around the actual L1A. Based on a text configuration file - * (cf. data/TriggerOffsets.cfg), the trigger items that fired a - * trigger can be shifted relative to each other, as if a - * certain trigger input is not correctly timed in. The RoI of - * the CTP contains only the BC of the L1A, hence this function - * may only shift certain bits out of the trigger pattern of the - * RoI. - */ - void changeRoIResult(std::vector<uint32_t>& roi_vector) const; - - /** Function that introduces a readout window and artificial - * offsets in the RDO result. In order to mimic real data as - * closely as possible, one can introduce a window of BCs into - * the CTP simulation, just like the real hardware can perform a - * readout in a window around the actual L1A. Based on a text - * configuration file (cf. data/TriggerOffsets.cfg), the trigger - * items that fired a trigger can be shifted relative to each - * other, as if a certain trigger input is not correctly timed - * in. - */ - void changeRDOResult(CTP_RDO*& result) const; - - //! build thresholds bits of trigger inputs - uint32_t constructTIPWord( unsigned int wrd_num ) const; - //! set fired items in result word - uint32_t constructResultWord( unsigned int wrd_num, WrdType type ) const; - - //! build LVL1 trigger type for result word - uint32_t constructTriggerType(const std::vector<uint32_t>& triggerWords) const; - //! build list of fired items and dump to string - std::vector<std::string> firedItems(const std::vector<uint32_t>& triggerWords) const; - - const TrigConf::CTPConfig* m_ctpConfig; - const ThresholdMap* m_decisionMap; - const ItemMap* m_itemMap; - const InternalTriggerMap* m_internalTrigger; - unsigned int m_ctpVersionNumber; - CTPdataformatVersion* m_ctpDataFormat; - - MsgLogger m_logger; //!< instance of private message logger - - std::vector<uint32_t> m_tip; //!< TIP words - std::vector<uint32_t> m_tbp; //!< result words for trigger before prescale - std::vector<uint32_t> m_tap; //!< result words for trigger after prescale - std::vector<uint32_t> m_tav; //!< result words for trigger after veto - - const uint32_t m_readoutWindow; //!< size of readout window in BCs - - /** - * Configuration for static trigger offsets in case mis-timing - * offsets are artificially added in the simulation - */ - ChangeRulesMap m_changeRules; - /** Active parser for config file, which is read in recursively. */ - bool (LVL1CTP::ResultBuilder::*m_parseLine)(const std::string& line); - /** config file parser that finds sections */ - bool findSectionParser(const std::string& line); - /** config file parser that reads StaticOffsetMap section */ - bool staticOffsetParser(const std::string& line); - - }; // class ResultBuilder - - - // typedefs - - // generic typedef for easy access to TIP/TBP/TAP/TAV information - typedef std::vector<uint32_t> (ResultBuilder::*Result)() const; - - - // inline functions - - inline std::vector<uint32_t> ResultBuilder::tip() const { return m_tip; } - inline std::vector<uint32_t> ResultBuilder::tbp() const { return m_tbp; } - inline std::vector<uint32_t> ResultBuilder::tap() const { return m_tap; } - inline std::vector<uint32_t> ResultBuilder::tav() const { return m_tav; } - - inline uint32_t ResultBuilder::ttbp() const { return constructTriggerType(tbp()); } - inline uint32_t ResultBuilder::ttap() const { return constructTriggerType(tap()); } - inline uint32_t ResultBuilder::ttav() const { return constructTriggerType(tav()); } - - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_RESULTBUILDER_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/SpecialTrigger.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/SpecialTrigger.h deleted file mode 100755 index b5036cd5d0509b0254c381a93a1e92db3c32d499..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/SpecialTrigger.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef TRIGT1CTP_SPECIAL_TRIGGER_H -#define TRIGT1CTP_SPECIAL_TRIGGER_H - -// Base class: -#include "TrigT1CTP/ISpecialTrigger.h" - -// LVL1 include(s): -#include "TrigConfL1Data/L1DataDef.h" -#include "CTPfragment/CTPdataformatVersion.h" - - -namespace LVL1CTP { - - /** - * @short Common class for internal triggers implementation - * - * @author Wolfgang Ehrenfeld, University of Hamburg, Germany - * - * @version \$Id: SpecialTrigger.h,v 1.4 2007-06-15 16:14:01 efeld Exp $ - * - */ - - class SpecialTrigger : public ISpecialTrigger { - - public: - - //! default constructors - SpecialTrigger(); - - //! constructors setting the internal trigger type - SpecialTrigger(TrigConf::L1DataDef::TriggerType tt, unsigned int thrnumber, unsigned int ctpVersionNumber); - - //! constructors setting the internal trigger type and rate - SpecialTrigger(TrigConf::L1DataDef::TriggerType tt, unsigned int thrnumber, unsigned int ctpVersionNumber, const unsigned int); - - //! destructor - virtual ~SpecialTrigger(); - - // access functions - virtual std::string name() const; //!< @copydoc LVL1CTP::ISpecialTrigger::name - virtual unsigned int rate() const; //!< @copydoc LVL1CTP::ISpecialTrigger::rate - - virtual unsigned int pit() const; //!< @copydoc LVL1CTP::ISpecialTrigger::pit - - virtual std::string print() const; //!< @copydoc LVL1CTP::ISpecialTrigger::print - virtual std::string dump() const; //!< @copydoc LVL1CTP::ISpecialTrigger::dump - - protected: - - // data members - unsigned int m_rate; //!< rate for this internal trigger - double m_counter; //!< counter for rate - - TrigConf::L1DataDef::TriggerType m_type; //!< trigger type - unsigned int m_thrNumber; //!< threshold number (e.g. 0 or 1 for the PSCK triggers) - - unsigned int m_ctpVersionNumber; - CTPdataformatVersion * m_ctpVersion; - - - }; // class SpecialTrigger - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_SPECIAL_TRIGGER_H diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ThresholdMap.h b/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ThresholdMap.h deleted file mode 100755 index 169cf5efe62ea64b0f50e1a53ebc2fb02fea07b5..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/ThresholdMap.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#ifndef TRIGT1CTP_THRESHOLDMAP_H -#define TRIGT1CTP_THRESHOLDMAP_H - -// STL include(s): -#include <vector> -#include <map> - -// local include(s): -#include "TrigT1CTP/MsgLogger.h" - -// Forward declarations: -namespace TrigConf { - class TriggerThreshold; - class PIT; - class TIP; -} - -namespace LVL1CTP { - - // Forward declarations in LVL1CTP namespace: - class CTPTriggerThreshold; - - /** - * - * @short Class glueing TrigConf::TriggerThreshold and LVL1CTP::DecisionTriggerThreshold object together - * - * This class automatically generates and manages CTPTriggerThreshold objects belonging - * to each and every TriggerThreshold object given to it in it's constructor. It is important - * therefore that the user of the class doesn't delete a CTPTriggerThreshold object - * returned by this class. (This can't be prevented, as the user has to modify the - * CTPTriggerThreshold objects himself.) - * - * @see CTPTriggerThreshold - * - * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - * @author Wolfgang Ehrenfeld <Wolfgang.Ehrenfeld@desy.de> - * - * @version \$Id: ThresholdMap.h,v 1.3 2007-06-15 16:15:59 efeld Exp $ - * - */ - - class ThresholdMap { - - public: - //assign default pit mapping to threshold objects - ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector); - //assign correct pit mapping to threshold objects (for versions of run-I only) - ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector, const std::vector< TrigConf::PIT* >& pit_vector); - //assign correct tip mapping to threshold objects (for newer version direct inputs have to be dealt with, too) - ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector, const std::vector< TrigConf::TIP* >& pit_vector ); - /// default destructor - ~ThresholdMap(); - - /// Function returning the CTPTriggerThreshold object belonging to the given TriggerThreshold object - CTPTriggerThreshold* decision( const TrigConf::TriggerThreshold* threshold ) const; - /// Function that clears the multiplicities in each DecisionTriggerThreshold object - void clear(); - - private: - /// map storing the accosiation between TrigConf::TriggerThreshold and CTPTriggerThreshold - std::map< const TrigConf::TriggerThreshold*, CTPTriggerThreshold* > m_map; - /// message logger - MsgLogger m_logger; - - }; // class ThresholdMap - -} // namespace LVL1CTP - -#endif // TRIGT1CTP_THRESHOLDMAP_H diff --git a/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPAlgorithmConfig.py b/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPAlgorithmConfig.py index fb8ab68c1502933bd502adae19903c5ca3ab9ba1..803cd5412c970a8f756a9ef716e53cc0b3eada0c 100755 --- a/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPAlgorithmConfig.py +++ b/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPAlgorithmConfig.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration ## get a handle to the default top-level algorithm sequence from AthenaCommon.AlgSequence import AlgSequence diff --git a/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPConfig.py b/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPConfig.py index 3dbfcce895319355cc7deb6061f45e23dcbb5356..89bd2e4c6edbb4874d0bbf5a6445c9b1480947f3 100755 --- a/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPConfig.py +++ b/Trigger/TrigT1/TrigT1CTP/python/TrigT1CTPConfig.py @@ -1,61 +1,23 @@ -# Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration - +# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration from TrigT1CTP.TrigT1CTPConf import * +from AthenaCommon.Constants import DEBUG, INFO class DefaultCTPSimulation(LVL1CTP__CTPSimulation): - __slots__ = [] - + def __init__(self, name = "DefaultCTPSimulation"): super( DefaultCTPSimulation, self ).__init__( name ) from AthenaCommon.Logging import logging - log = logging.getLogger( 'CTPSimulation' ) - - - # set properties - self.PrescaleMode = 2 # random prescales - self.UseDeadTime = False # no dead time simulation - self.IsData = False # default is to run on MC file + self.log = logging.getLogger( 'CTPSimulation' ) - self.RndmEngine = 'CTPSimulation' - - ### this should not be done at all, since it instantiates a config svc without proper configuration!! - ### LVL1ConfigSvc - ##from AthenaCommon.AppMgr import ServiceMgr - ##if not hasattr( ServiceMgr, 'LVL1ConfigSvc' ): - ## log.info("will setup LVL1ConfigSvc and add instance to ServiceMgr") - ## from TrigConfigSvc.TrigConfigSvcConfig import LVL1ConfigSvc - ## LVL1ConfigSvc = LVL1ConfigSvc('LVL1ConfigSvc') - ## ServiceMgr += LVL1ConfigSvc + self.AthenaMonTools = [] - def setDefaults(self, handle): - from AthenaCommon.DetFlags import DetFlags - handle.DoCalo = DetFlags.simulateLVL1.Calo_on() - handle.DoMuon = DetFlags.simulateLVL1.Muon_on() - handle.DoBCM = DetFlags.simulateLVL1.BCM_on() - handle.DoLUCID = DetFlags.simulateLVL1.Lucid_on() - handle.DoZDC = DetFlags.simulateLVL1.ZDC_on() - - def setDefaultRandomService(self, rndmSvc = 'AtRanluxGenSvc'): - from AthenaCommon.Logging import logging - log = logging.getLogger( 'CTPSimulation' ) - - # instruct CTP simulation to use given random generator service - self.RndmSvc = rndmSvc + self.OutputLevel = INFO - # set up random generator service if not done before - from AthenaCommon.AppMgr import ServiceMgr - if not hasattr( ServiceMgr, rndmSvc): - log.debug( 'adding %s RndmSvc to ServiceMgr' % rndmSvc ) - - from AthenaServices.AthenaServicesConf import AtRndmGenSvc, AtRanluxGenSvc - randomSvc = eval(rndmSvc)(rndmSvc) - ServiceMgr += randomSvc - - # init random number seeds - log.info( 'will setup seeds for RndmSvc %s' % rndmSvc ) - getattr(ServiceMgr, rndmSvc).Seeds += [ str(self.RndmEngine) + " 1979283043 1924452189" ] + def setDefaultRandomService(self, rndmSvc = 'AtRanluxGenSvc'): + # Random service is not needed anymore in Run 3 for CTP + pass class CTPSimulation(DefaultCTPSimulation): __slots__ = [] diff --git a/Trigger/TrigT1/TrigT1CTP/src/BunchGroupTrigger.cxx b/Trigger/TrigT1/TrigT1CTP/src/BunchGroupTrigger.cxx deleted file mode 100755 index 1eac40d958e0596f02a1414e06c714725386afc8..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/src/BunchGroupTrigger.cxx +++ /dev/null @@ -1,60 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - -#include "TrigT1CTP/BunchGroupTrigger.h" -#include "TrigT1CTP/MsgWriter.h" - -#include <sstream> - -// gaudi includes -#include "GaudiKernel/StatusCode.h" -#include "GaudiKernel/MsgStream.h" - -LVL1CTP::BunchGroupTrigger::BunchGroupTrigger() : SpecialTrigger() -{} - -LVL1CTP::BunchGroupTrigger::BunchGroupTrigger(unsigned int bgrp_number, const std::vector<int>& bunches, unsigned int ctpVersionNumber) : - SpecialTrigger(TrigConf::L1DataDef::BGRP, bgrp_number, ctpVersionNumber), - m_bunches(bunches) -{} - -StatusCode -LVL1CTP::BunchGroupTrigger::execute(int bcid=1) { - //nominal bcid is set to 1 unless explicit value is given - m_counter = bcid; - return StatusCode::SUCCESS; -} - -bool -LVL1CTP::BunchGroupTrigger::evaluate() const { - for (std::vector<int>::const_iterator iter(m_bunches.begin()); iter != m_bunches.end(); ++iter) - if (m_counter == *iter) return true; - return false; -} - -std::string -LVL1CTP::BunchGroupTrigger::print() const { - std::ostringstream s; - - s << "Name: " << this->name() << " Bunch Group ID: " << m_counter << " - "; - for (size_t i(0); i < m_bunches.size(); ++i) { - s << m_bunches[i] << " "; - } - s << ( this->evaluate() ? "ACTIVE" : "INACTIVE" ); - - return s.str(); -} - -std::string -LVL1CTP::BunchGroupTrigger::dump() const { - std::ostringstream s; - - s << this->name() << " " << m_counter << " "; - for (size_t i(0); i < m_bunches.size(); ++i) { - s << m_bunches[i] << " "; - } - s << this->evaluate(); - - return s.str(); -} diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPConstants.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPConstants.cxx deleted file mode 100755 index 0be2fb746310851998b9f4ab5db85f0ad6a743b7..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/src/CTPConstants.cxx +++ /dev/null @@ -1,17 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#include "TrigT1CTP/CTPConstants.h" - -namespace LVL1CTP { - - const int CTPConstants::MAXIMUM_ITEM_COUNT = 256; // This is limited by the CTP design - const int CTPConstants::MAXIMUM_THRESHOLD_COUNT = 54; // This is just the current number... - - const std::string CTPConstants::DEFAULT_MuonConfigLocation = "/Run/MuonTrigConfig"; - const std::string CTPConstants::DEFAULT_CaloConfigLocation = "/Run/CaloTrigConfig"; - const std::string CTPConstants::DEFAULT_JEConfigLocation = "/Run/JetEnergyTrigConfig"; - -} // namespace LVL1CTP diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPDataDumper.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPDataDumper.cxx deleted file mode 100755 index 53e0173335215760a899a47e8da61872e84fe7d0..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/src/CTPDataDumper.cxx +++ /dev/null @@ -1,161 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -// this class header file -#include "TrigT1CTP/CTPDataDumper.h" - -// STL includes: -#include <vector> -#include <iomanip> - -// Athena/Gaudi includes: -#include "StoreGate/DataHandle.h" -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -#include "EventInfo/TriggerInfo.h" - -// Common interface includes: -#include "TrigT1Interfaces/TrigT1StoreGateKeys.h" -#include "TrigT1Interfaces/CTPSLink.h" - -// CTP DAQ output: -#include "TrigT1Result/CTP_RDO.h" -#include "TrigT1Result/Header.h" -#include "TrigT1Result/Trailer.h" - - - -namespace LVL1CTP { - - CTPDataDumper::CTPDataDumper( const std::string& name, ISvcLocator* pSvcLocator ) - : AthAlgorithm( name, pSvcLocator ) - { - - // Property setting general behaviour: - declareProperty( "RawFormat", m_rawFormat = false, "Dump data content in raw, compressed format" ); - declareProperty( "PrettyFormat", m_prettyFormat = true, "Dump data content in human understandable format" ); - - // Properties setting up the locations of the objects: - declareProperty( "RoILocation", m_roiLoc = LVL1CTP::DEFAULT_CTPSLinkLocation, - "StoreGate location of CTP RoI"); - declareProperty( "RDOLocation", m_rdoLoc = LVL1CTP::DEFAULT_RDOOutputLocation, - "StoreGate location of CTP RDO" ); - - } - - CTPDataDumper::~CTPDataDumper() { - - } - - StatusCode CTPDataDumper::initialize() { - - ATH_MSG_INFO("Initializing " << name() << " - package version " << PACKAGE_VERSION); - - return StatusCode::SUCCESS; - } - - StatusCode CTPDataDumper::finalize() { - - ATH_MSG_INFO("Finalizing " << name() << " - package version " << PACKAGE_VERSION); - - return StatusCode::SUCCESS; - } - - StatusCode CTPDataDumper::execute() { - - ATH_MSG_DEBUG("Executing CTPDataDumper algorithm"); - - // dump content of CTP_RDO - StatusCode sc = dumpCTP_RDO(); - if (sc.isFailure()) { - ATH_MSG_WARNING("Couldn't dump CTP_RDO object from StoreGate"); - } - - // dump content of CTPSLink - sc = dumpCTPSLink(); - if (sc.isFailure()) { - ATH_MSG_WARNING("Couldn't dump CTPSLink object from StoreGate"); - } - - // dump content of EventInfo - sc = dumpEventInfo(); - if (sc.isFailure()) { - ATH_MSG_WARNING("Couldn't dump EventInfo object from StoreGate"); - } - - return StatusCode::SUCCESS; - } - - - StatusCode CTPDataDumper::dumpCTPSLink() { - - // get object from StoreGate - const DataHandle<CTPSLink> ctpSLink; - StatusCode sc = evtStore()->retrieve(ctpSLink, m_roiLoc); - - if (sc.isFailure()) { - ATH_MSG_WARNING("No CTP SLink found in TES at: " << m_roiLoc); - } else { - - if (m_rawFormat) { - ATH_MSG_DEBUG(std::endl << ctpSLink->dump()); - } - if (m_prettyFormat) { - ATH_MSG_DEBUG(std::endl << ctpSLink->print()); - } - - } - - return StatusCode::SUCCESS; - } - - - StatusCode CTPDataDumper::dumpCTP_RDO() { - - // get object from StoreGate - const DataHandle<CTP_RDO> ctpRDO; - StatusCode sc = evtStore()->retrieve(ctpRDO, m_rdoLoc); - - if (sc.isFailure()) { - ATH_MSG_WARNING("No CTP RDO found in TES at: " << m_rdoLoc); - } else { - - if (m_rawFormat) { - ATH_MSG_DEBUG("CTP_RDO: " << ctpRDO->dump()); - } - if (m_prettyFormat) { - ATH_MSG_DEBUG("CTP_RDO: " << ctpRDO->print()); - } - - } - - return StatusCode::SUCCESS; - } - - - StatusCode CTPDataDumper::dumpEventInfo() { - - // get object from StoreGate - const DataHandle< ::EventInfo > eventInfo; - StatusCode sc = evtStore()->retrieve( eventInfo ); - - if( sc.isFailure() ) { - ATH_MSG_WARNING("No EventInfo found in TES"); - } - else { - if (m_rawFormat) { - } - if (m_prettyFormat) { - ATH_MSG_DEBUG("EventInfo dump:" - << "\nEventID: " << *eventInfo->event_ID() - // << "\nEventInfo: " << eventInfo->event_Type(); - << "\nTriggerInfo: " << *eventInfo->trigger_info()); - } - } - - return StatusCode::SUCCESS; - } - -} // namespace LVL1CTP diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.cxx old mode 100755 new mode 100644 index e55258d884db56988bb4a085b3e3aebd120b7759..f1ca065c8b2245ebb489e9f3a3ea8dbcb65cecef --- a/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.cxx +++ b/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.cxx @@ -1,1813 +1,1291 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// STL includes: -#include <vector> -#include <iomanip> - -#include "TH1.h" -#include "GaudiKernel/ITHistSvc.h" - -// Athena/Gaudi includes: -#include "EventInfo/EventInfo.h" -#include "EventInfo/EventID.h" -#include "EventInfo/TriggerInfo.h" -#include "AthenaKernel/IAtRndmGenSvc.h" -#include "AthenaMonitoring/IMonitorToolBase.h" -#include "AthenaMonitoring/AthenaMonManager.h" -#include "PathResolver/PathResolver.h" - -// Trigger configuration interface includes: -#include "L1TopoConfig/L1TopoMenu.h" -#include "L1TopoConfig/L1TopoConfigOutputList.h" +#include "./CTPSimulation.h" +#include "TrigConfData/L1Menu.h" #include "TrigConfL1Data/CTPConfig.h" -#include "TrigConfL1Data/Menu.h" -#include "TrigConfL1Data/PrescaleSet.h" -#include "TrigConfL1Data/BunchGroupSet.h" -#include "TrigConfL1Data/BunchGroup.h" -#include "TrigConfL1Data/PrescaledClock.h" -#include "TrigConfL1Data/DeadTime.h" -#include "TrigConfL1Data/Random.h" -#include "TrigConfL1Data/TriggerItem.h" -#include "TrigConfL1Data/TriggerItemNode.h" -#include "TrigConfL1Data/TriggerThreshold.h" - -// TrigConfStorage includes -#include "TrigConfStorage/TrigConfCoolL1PayloadConverters.h" - -// Common interface includes: +#include "TrigConfL1Data/L1DataDef.h" +#include "TrigConfL1Data/ClusterThresholdValue.h" #include "TrigT1Interfaces/TrigT1StoreGateKeys.h" -#include "TrigT1Interfaces/TrigT1CaloDefs.h" -#include "TrigT1Interfaces/TrigT1CTPDefs.h" -#include "TrigT1Interfaces/CTPSLink.h" -// Inputs to the CTP: -#include "TrigT1Interfaces/EmTauCTP.h" -#include "TrigT1Interfaces/JetCTP.h" -#include "TrigT1Interfaces/EnergyCTP.h" -#include "TrigT1Interfaces/MbtsCTP.h" -#include "TrigT1Interfaces/BcmCTP.h" -#include "TrigT1Interfaces/LucidCTP.h" -#include "TrigT1Interfaces/ZdcCTP.h" -#include "TrigT1Interfaces/BptxCTP.h" -#include "TrigT1Interfaces/NimCTP.h" -#include "TrigT1Interfaces/FrontPanelCTP.h" - -// CTP DAQ output: +#include "./CTPTriggerThreshold.h" +#include "./CTPTriggerItem.h" +#include "./CTPUtil.h" + #include "TrigT1Result/CTP_RDO.h" -#include "TrigT1Result/CTPResult.h" -#include "TrigT1Result/CTP_Decoder.h" +#include "TrigT1Interfaces/CTPSLink.h" +#include "TrigT1Result/RoIBResult.h" +#include "TrigT1Result/JetEnergyRoI.h" -// Include for the configuration service: -#include "TrigConfInterfaces/ILVL1ConfigSvc.h" -#include "TrigConfL1Data/CTPConfig.h" +#include "TrigT1Interfaces/CPRoIDecoder.h" +#include "TrigT1Interfaces/JEPRoIDecoder.h" +#include "TrigT1CaloUtils/CoordToHardware.h" -// Local includes: -#include "TrigT1CTP/CTPSimulation.h" -#include "TrigT1CTP/ThresholdMap.h" -#include "TrigT1CTP/CTPTriggerThreshold.h" -#include "TrigT1CTP/CTPTriggerItemNode.h" -#include "TrigT1CTP/CTPUtil.h" -#include "TrigT1CTP/ResultBuilder.h" -#include "TrigT1CTP/EventInfo.h" -#include "TrigT1CTP/CTPTriggerItem.h" -#include "TrigT1CTP/ItemMap.h" -#include "TrigT1CTP/MsgWriter.h" -#include "TrigT1CTP/ISpecialTrigger.h" -#include "TrigT1CTP/RandomTrigger.h" -#include "TrigT1CTP/PrescaledClockTrigger.h" -#include "TrigT1CTP/BunchGroupTrigger.h" -#include "TrigT1CTP/CustomBit.h" - -// Move to MT -#include "StoreGate/ReadCondHandle.h" - - -// Facilitate reading from COOL -#include "AthenaPoolUtilities/AthenaAttributeList.h" - -#include "boost/lexical_cast.hpp" - -using namespace std; -using namespace TrigConf; +#include "TH2.h" -namespace LVL1CTP { - //! enumeration for prescale mode - enum PrescaleMode { DEFAULT = 0, OFFSET, RANDOM }; -} +#include <iomanip> +#include <algorithm> +#include <cmath> + +using namespace TrigConf; LVL1CTP::CTPSimulation::CTPSimulation( const std::string& name, ISvcLocator* pSvcLocator ) : - AthAlgorithm( name, pSvcLocator ), - m_histSvc("THistSvc", name), - m_configSvc("TrigConf::TrigConfigSvc/TrigConfigSvc", name), - m_rndmSvc("AtRndmGenSvc",name), - m_rndmEngineName("CTPSimulation"), - m_monitors(this), - m_decisionMap(0), - m_itemMap(0), - m_resultBuilder(0) -{ - // services - declareProperty( "TrigConfigSvc", m_configSvc, "Trig Config Service"); - declareProperty( "RndmSvc", m_rndmSvc, "Random Number Service used in CTP simulation" ); - declareProperty( "RndmEngine", m_rndmEngineName, "Random engine name"); - // Property setting general behaviour: - declareProperty( "CtpVersion", m_ctpVersion = 0, "Version of the CTP to be used: 3 - latest version of run-I, 4 - initial version for run-II. For explanation of the other version see CTPfragment/schema/L1CoreSpecifications.xml." ); - declareProperty( "DoL1Topo", m_doL1Topo = true, "Use inputs from L1Topo system" ); - declareProperty( "DoCalo", m_doCalo = true, "Use inputs (multiplicities) from Calo system" ); - declareProperty( "DoMBTS", m_doMBTS = true, "Use inputs from MBTS system" ); - declareProperty( "DoMBTSSI", m_doMBTSSI = true, "Use single inputs from MBTS system" ); - declareProperty( "DoMuon", m_doMuon = true, "Use inputs (multiplicities) from Muon system" ); - declareProperty( "DoBCM", m_doBCM = true, "Use inputs from BCM system" ); - declareProperty( "DoLUCID", m_doLUCID = true, "Use inputs from LUCID system" ); - declareProperty( "DoZDC", m_doZDC = true, "Use inputs from ZDC system" ); - declareProperty( "DoNIM", m_doNIM = false, "Use inputs from NIM system" ); - declareProperty( "DoBPTX", m_doBPTX = false, "Use inputs from BPTX system" ); - declareProperty( "DoRNDM", m_doRNDM = true, "Simulate internal random trigger" ); - declareProperty( "DoPSCL", m_doPSCL = true, "Simulate internal prescaled clock trigger" ); - declareProperty( "PrescaleMode", m_prescaleMode = RANDOM, "Mode for applying prescale: 0 - as hardware, 1 - random offset, 2 - random prescales"); - m_prescaleMode.verifier().setLower(DEFAULT); m_prescaleMode.verifier().setUpper(RANDOM); - declareProperty( "IsData", m_IsData = false, "Rerun simulation on data" ); - declareProperty( "UseDeadTime", m_applyDeadTime = false, "Simulate DeadTime" ); - declareProperty( "UseBunchGroup", m_applyBunchGroup = true, "Simulate BunchGroup trigger" ); - declareProperty( "BunchGroupLocation", m_BunchGroupLoc="/TRIGGER/LVL1/BunchGroupContent", "Detector store location of bunch groups"); - - // Properties setting up the location of the data sent to the CTP: - declareProperty( "MuonCTPLocation", m_muonCTPLoc = LVL1MUCTPI::DEFAULT_MuonCTPLocation, - "StoreGate location of Muon inputs" ); - declareProperty( "EmTauCTPLocation", m_emTauCTPLoc = LVL1::TrigT1CaloDefs::EmTauCTPLocation, - "StoreGate location of EmTau inputs" ); - declareProperty( "JetCTPLocation", m_jetCTPLoc = LVL1::TrigT1CaloDefs::JetCTPLocation, - "StoreGate location of Jet inputs" ); - declareProperty( "EnergyCTPLocation", m_energyCTPLoc = LVL1::TrigT1CaloDefs::EnergyCTPLocation, - "StoreGate location of Energy inputs" ); - declareProperty( "MbtsACTPLocation", m_mbtsACTPLoc = LVL1::DEFAULT_MbtsACTPLocation, - "StoreGate location of MBTSA inputs" ); - declareProperty( "MbtsCCTPLocation", m_mbtsCCTPLoc = LVL1::DEFAULT_MbtsCCTPLocation, - "StoreGate location of MBTSC inputs" ); - declareProperty( "BcmCTPLocation", m_bcmCTPLoc = LVL1::DEFAULT_BcmCTPLocation, - "StoreGate location of BCM inputs" ); - declareProperty( "LucidCTPLocation", m_lucidCTPLoc = LVL1::DEFAULT_LucidCTPLocation, - "StoreGate location of LUCID inputs" ); - declareProperty( "ZdcCTPLocation", m_zdcCTPLoc = LVL1::DEFAULT_ZdcCTPLocation, - "StoreGate location of ZDC inputs" ); - declareProperty( "BptxCTPLocation", m_bptxCTPLoc = LVL1::DEFAULT_BptxCTPLocation, - "StoreGate location of BPTX inputs" ); - declareProperty( "NimCTPLocation", m_nimCTPLoc = LVL1::DEFAULT_NimCTPLocation, - "StoreGate location of NIM inputs" ); - declareProperty( "TopoCTPLocation", m_topoCTPLoc = LVL1::DEFAULT_L1TopoCTPLocation, - "StoreGate location of topo inputs" ); - - // Properties setting up the locations of the output objects: - declareProperty( "RoIOutputLocation", m_roiOutputLoc = LVL1CTP::DEFAULT_CTPSLinkLocation, "StoreGate location of CTP RoI"); - declareProperty( "RoIOutputLocation_Rerun", m_roiOutputLoc_Rerun = LVL1CTP::DEFAULT_CTPSLinkLocation_Rerun, "StoreGate location of rerun CTP RoI"); - declareProperty( "RDOOutputLocation", m_rdoOutputLoc = LVL1CTP::DEFAULT_RDOOutputLocation, "StoreGate location of CTP RDO" ); - declareProperty( "RDOOutputRerunLocation", m_rdoOutputLoc_Rerun = LVL1CTP::DEFAULT_RDOOutputLocation_Rerun, "StoreGate location of rerun CTP RDO" ); - - // Properties for adding readout window and trigger offsets (as in data) - declareProperty("ReadoutWindow", m_readoutWindow = 1, - "Size of readout window in BCs to be introduced into the bytestream data."); - declareProperty("IntroduceArtificialTriggerOffsets", m_introduceArtificialTriggerOffsets = false, - "(De-)Activate artificial trigger offsets"); - declareProperty("OffsetConfigFile", m_offsetConfigFile = "TriggerOffsets.cfg", - "Configuration file for trigger offsets"); - - // declare monitoring tools - declareProperty( "AthenaMonTools", m_monitors, "List of monitoring tools to be run within this instance, if incorrect then tool is silently skipped."); - - declareProperty("HistBase", m_histbase, "/<stream>/<subdir>"); - - // run 3 - declareProperty( "MuonCTPLoc", m_muctpiInputKey, "Name of input from Muctpi" ); - - declareProperty( "UseCondL1Menu", m_useCondL1Menu=false, "Use the new conditions-base configuration"); - declareProperty( "L1Menu", m_l1MenuKey, "Name of L1 menu configuration"); - - // declare monitoring variables - declareMonitoredCustomVariable("TIP", new CustomBit(this, &ResultBuilder::tip)); // custom monitoring: TIP - // declareMonitoredCustomVariable("TBP", new CustomBit(this, &ResultBuilder::tbp)); // custom monitoring: TBP - // declareMonitoredCustomVariable("TAP", new CustomBit(this, &ResultBuilder::tap)); // custom monitoring: TAP - // declareMonitoredCustomVariable("TAV", new CustomBit(this, &ResultBuilder::tav)); // custom monitoring: TAV - -} + AthReentrantAlgorithm ( name, pSvcLocator ), + m_decoder( new LVL1::CPRoIDecoder() ), + m_jetDecoder( new LVL1::JEPRoIDecoder() ) +{} LVL1CTP::CTPSimulation::~CTPSimulation() {} - StatusCode LVL1CTP::CTPSimulation::initialize() { + ATH_MSG_DEBUG("initialize"); - ATH_MSG_INFO("initializing"); - - // TrigConfigSvc for the trigger configuration - CHECK(m_configSvc.retrieve()); + if( m_isData ) { + CHECK( m_oKeyRDO.assign(LVL1CTP::DEFAULT_RDOOutputLocation_Rerun) ); + CHECK( m_oKeySLink.assign(LVL1CTP::DEFAULT_CTPSLinkLocation_Rerun) ); + } - ServiceHandle<IIncidentSvc> incidentSvc("IncidentSvc", "CTPSimulation"); - CHECK(incidentSvc.retrieve()); - incidentSvc->addListener(this,"BeginRun", 100); - incidentSvc.release().ignore(); + // data links + ATH_CHECK( m_iKeyTopo.initialize() ); + ATH_CHECK( m_iKeyLegacyTopo.initialize() ); + ATH_CHECK( m_iKeyMuctpi.initialize() ); + ATH_CHECK( m_iKeyCtpinEM.initialize() ); + ATH_CHECK( m_iKeyCtpinJet.initialize() ); + ATH_CHECK( m_iKeyCtpinXE.initialize() ); + ATH_CHECK( m_iKeyJFexJets.initialize() ); + ATH_CHECK( m_iKeyJFexLJets.initialize() ); + ATH_CHECK( m_iKeyGFexJets.initialize() ); + ATH_CHECK( m_iKeyGFexMETPufit.initialize() ); + ATH_CHECK( m_iKeyGFexMETRho.initialize() ); + ATH_CHECK( m_iKeyGFexMETJwoJ.initialize() ); + ATH_CHECK( m_iKeyEFexCluster.initialize() ); + ATH_CHECK( m_iKeyEFexTau.initialize() ); + ATH_CHECK( m_oKeyRDO.initialize() ); + ATH_CHECK( m_oKeySLink.initialize() ); + + // services + ATH_CHECK( m_configSvc.retrieve() ); + ATH_CHECK( m_histSvc.retrieve() ); + ATH_CHECK( m_rndmSvc.retrieve() ); + + // tools + ATH_CHECK( m_resultBuilder.retrieve() ); + CLHEP::HepRandomEngine* rndmEngine = m_rndmSvc->GetEngine(m_rndmEngineName); + m_resultBuilder->setRandomEngine( rndmEngine ); + + ATH_MSG_DEBUG("Registering histograms under " << m_histPath << " in " << m_histSvc); - ATH_CHECK( m_muctpiInputKey.initialize() ); + return StatusCode::SUCCESS; +} - if (! m_doMuon) { - renounce( m_muctpiInputKey ); - } +StatusCode +LVL1CTP::CTPSimulation::start() { - if( m_useCondL1Menu ) { - ATH_CHECK( m_l1MenuKey.initialize() ); - } - - // - // Set up the logger object: - // - MsgWriter::instance()->setName( this->name() ); - - // - // Print system info - // - if (m_doL1Topo == false) { - ATH_MSG_INFO("Inputs from L1Topo systems switched off"); - } - if (m_doCalo == false) { - ATH_MSG_INFO("Inputs from LVL1 Calo systems switched off"); - } - if (m_doMBTS == false) { - ATH_MSG_INFO("Inputs from LVL1 MBTS systems switched off"); - } - if (m_doMuon == false) { - ATH_MSG_INFO("Inputs from LVL1 Muon systems switched off"); - } - if (m_doBCM == false) { - ATH_MSG_INFO("Inputs from LVL1 BCM systems switched off"); - } - if (m_doLUCID == false) { - ATH_MSG_INFO("Inputs from LVL1 LUCID systems switched off"); - } - if (m_doZDC == false) { - ATH_MSG_INFO("Inputs from LVL1 ZDC systems switched off"); - } - if (m_doNIM == false) { - ATH_MSG_INFO("Inputs from LVL1 NIM systems switched off"); - } - if (m_doBPTX == false) { - ATH_MSG_INFO("Inputs from LVL1 BPTX systems switched off"); - } - if (m_doRNDM == false) { - ATH_MSG_INFO("Inputs from LVL1 RNDM systems switched off"); - } - - m_extractFunction = &CTPSimulation::extractMultiplicities; - - // Random Number Service - if(m_doRNDM == true){ - CHECK(m_rndmSvc.retrieve()); - } - - // Monitoring Service - CHECK(m_monitors.retrieve()); - - CHECK(m_histSvc.retrieve()); - - // registering with IOVDBSvc to get informed about BG changes - if (m_applyBunchGroup == true) { - // registering callback for bunch group settings - const DataHandle<AthenaAttributeList> dataHandle; - if(detStore()->contains<AthenaAttributeList>(m_BunchGroupLoc)){ - ATH_MSG_DEBUG("Registering callback for " << m_BunchGroupLoc ); - if (StatusCode::SUCCESS!=detStore()->regFcn(&CTPSimulation::callback, this, - dataHandle, m_BunchGroupLoc)) - ATH_MSG_DEBUG("Cannot register callback for bunchgroup content"); + bool delayConfig = false; + + const TrigConf::L1Menu * l1menu = nullptr; + if( m_useNewConfig ) { + ATH_CHECK( m_detStore->retrieve(l1menu) ); + ATH_MSG_INFO( "Use L1 trigger menu from detector store" ); + if(l1menu == nullptr) { // if no L1 configuration is available yet + delayConfig = true; } - else{ - if (StatusCode::SUCCESS!=LoadBunchGroups()) - ATH_MSG_DEBUG("Unable to correctly load bunch groups"); + } else { + ATH_MSG_INFO( "Use L1 trigger menu from L1ConfigSvc" ); + if( (m_configSvc->ctpConfig()==nullptr) || + (m_configSvc->ctpConfig()->menu().itemVector().size() == 0) ) { // if no L1 configuration is available yet + delayConfig = true; } } - ATH_MSG_DEBUG("Done initializing"); - + if( ! delayConfig ) { + // configure the CTP ResultBuilder + // currently both types of configuration can be given (transition period towards Run 3) + + std::call_once(m_onceflag, [this, l1menu]{ + m_resultBuilder->setConfiguration( m_configSvc->ctpConfig(), l1menu ).ignore(); + bookHists().ignore(); + }); + } + return StatusCode::SUCCESS; } +StatusCode +LVL1CTP::CTPSimulation::execute( const EventContext& context ) const { -void LVL1CTP::CTPSimulation::handle(const Incident& incident) { - - if (incident.type()!="BeginRun") return; - ATH_MSG_DEBUG( "In CTPSimulation BeginRun incident"); - - if( loadFixedConditions().isFailure() ) { - ATH_MSG_ERROR( "ERROR in CTPSimulation configuration"); - } -} + std::call_once(m_onceflag, [this]{ + const TrigConf::L1Menu * l1menu = nullptr; + if( m_useNewConfig ) { + m_detStore->retrieve(l1menu).ignore(); + } + m_resultBuilder->setConfiguration( m_configSvc->ctpConfig(), l1menu ).ignore(); + bookHists().ignore(); + }); + fillInputHistograms(context).ignore(); + std::map<std::string, unsigned int> thrMultiMap; + + extractMultiplicities(thrMultiMap, context).ignore(); + + simulateItems(thrMultiMap, context).ignore(); -StatusCode -LVL1CTP::CTPSimulation::callback(IOVSVC_CALLBACK_ARGS_P(/*idx*/,/*keys*/)) { - ATH_MSG_DEBUG("Callback for " << m_BunchGroupLoc << ": Overriding bunch group settings with new bunch group"); - if (StatusCode::SUCCESS!=LoadBunchGroups()) - ATH_MSG_DEBUG("Unable to correctly load bunch groups in callback"); return StatusCode::SUCCESS; } StatusCode -LVL1CTP::CTPSimulation::finalize() { - - ATH_MSG_INFO("Finalizing " << name() << " - package version " << PACKAGE_VERSION); - - for(const TriggerItem * item : m_configSvc->ctpConfig()->menu().itemVector()) { - if(item==nullptr) continue; - ATH_MSG_DEBUG("REGTEST " << item->name() << " TBP " << m_countsBP[item->ctpId()] << " TAP " << m_countsAP[item->ctpId()] << " TAV " << m_countsAV[item->ctpId()]); - } - - // finalize monitoring - for ( auto & mt : m_monitors ) { - mt->finalHists().ignore(); - } - - for (auto & mapentry : m_internalTrigger ) { - delete mapentry.second; - } - - delete m_decisionMap; m_decisionMap = nullptr; - delete m_itemMap; m_itemMap = nullptr; - delete m_ctpDataformat; m_ctpDataformat = nullptr; - - return StatusCode::SUCCESS; -} - - -namespace { - void setThresholdHistLabels(TH1I * hist, TH1I * histtot, const vector<TriggerThreshold*> & thrV, uint maxMult, uint first=0, uint last=100) { - uint bin = 1; - for(const TriggerThreshold * thr: thrV) { - if(thr->mapping()<0 || (uint)thr->mapping()<first || (uint)thr->mapping()>=last) - continue; - for(uint m=0; m<maxMult;++m) - hist->GetXaxis()->SetBinLabel(bin++, (boost::lexical_cast<string,int>(m) + " x " + thr->name()).c_str() ); +LVL1CTP::CTPSimulation::createMultiplicityHist(const ConfigSource & cfgSrc, const std::string & type, TrigConf::L1DataDef::TriggerType tt, unsigned int maxMult ) const { + + StatusCode sc; + const TrigConf::CTPConfig* ctpConfig = cfgSrc.ctpConfig(); + const TrigConf::L1Menu* l1menu = cfgSrc.l1menu(); + if( l1menu ) { + std::map<std::string,std::vector<std::string>> typeMapping = { + { "muon", {"MU"} }, + { "jet", {"JET", "jJ", "gJ"} }, + { "xe", {"XE", "gXE", "jXE"} }, + { "te", {"TE"} }, + { "xs", {"XS"} }, + { "em", {"EM", "eEM"} }, + { "tau", {"TAU", "eTAU"} } + }; + std::vector<TrigConf::L1Threshold> thrV; + for( const std::string & t : typeMapping[type] ) { + const std::vector<TrigConf::L1Threshold> & thrV = l1menu->thresholds(t); + size_t xsize = thrV.empty() ? 1 : thrV.size(); + TH2* hist = new TH2I( Form("%sMult", t.c_str()), + Form("%s threshold multiplicity", t.c_str()), xsize, 0, xsize, maxMult, 0, maxMult); + for(const TrigConf::L1Threshold & thr: thrV) { + hist->GetXaxis()->SetBinLabel(thr.mapping()+1, thr.name().c_str() ); + } + sc = hbook( "/multi/" + type, std::unique_ptr<TH2>(hist)); } - for(const TriggerThreshold * thr: thrV) { - histtot->GetXaxis()->SetBinLabel(thr->mapping()+1, thr->name().c_str() ); + } else { + const auto & thrV = ctpConfig->menu().thresholdConfig().getThresholdVector(tt); + TH2* hist = new TH2I( Form("%sMult", type.c_str()), + Form("%s threshold multiplicity", type.c_str()), thrV.size(), 0, thrV.size(), maxMult, 0, maxMult); + for(const TrigConf::TriggerThreshold * thr: thrV) { + hist->GetXaxis()->SetBinLabel(thr->mapping()+1, thr->name().c_str() ); } + sc = hbook( "/multi/" + type, std::unique_ptr<TH2>(hist)); } + return sc; } StatusCode -LVL1CTP::CTPSimulation::start() { - ATH_MSG_DEBUG("Start"); - return StatusCode::SUCCESS; -} +LVL1CTP::CTPSimulation::hbook(const std::string & path, std::unique_ptr<TH1> hist) const { + const std::string & hname(hist->GetName()); + std::string key(path); + if(key.back()!='/') key += "/"; + key+=hname; -StatusCode -LVL1CTP::CTPSimulation::bookHists() { + if(m_hist1D.find(key)!=m_hist1D.end()) { + ATH_MSG_WARNING("1D-hist " << key << " already exists, won't register it"); + return StatusCode::RECOVERABLE; + } + LockedHandle<TH1> lh; + StatusCode sc = m_histSvc->regShared( m_histPath + name() + path + "/" + hname, std::move(hist), lh ); + if( sc.isSuccess() ) { + ATH_MSG_DEBUG("1D-hist " << hname << " registered with key - " << key); + m_hist1D[key] = lh; + } else { + ATH_MSG_WARNING("Could not register histogram " << hname); + } + return sc; +} - string histstream ( m_histbase ); - - //Check that we didn't already do this, and just return if yes ... - if (m_histSvc->exists(histstream + "CTPSimulation/L1TopoDecisionCable0")){ - ATH_MSG_INFO(histstream+" histograms already exist, returning ..."); - return StatusCode::SUCCESS; - } - +StatusCode +LVL1CTP::CTPSimulation::hbook(const std::string & path, std::unique_ptr<TH2> hist) const { + const std::string & hname(hist->GetName()); - size_t runNrPos = histstream.find("RUNNR"); - if( runNrPos != string::npos ) { + std::string key(path); + if(key.back()!='/') key += "/"; + key+=hname; - string runnr = boost::lexical_cast<string, unsigned int>(Gaudi::Hive::currentContext().eventID().run_number()); - histstream.replace(runNrPos, 5, runnr); + if(m_hist2D.find(key)!=m_hist2D.end()) { + ATH_MSG_WARNING("2D-hist " << key << " already exists, won't register it"); + return StatusCode::RECOVERABLE; } - const TrigConf::ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); - - // booking histograms - // Topo input - m_HistL1TopoDecisionCable0 = new TH1I("L1TopoDecision0","L1Topo Decision Cable 0", 64, 0, 64); - m_HistL1TopoDecisionCable1 = new TH1I("L1TopoDecision1","L1Topo Decision Cable 1", 64, 0, 64); - - for(const TIP * tip : m_configSvc->ctpConfig()->menu().tipVector() ) { - if ( tip->tipNumber() < 384 ) - continue; - unsigned int tipNumber = (unsigned int) ( tip->tipNumber() - 384 ); - switch(tipNumber / 64) { - case 0: - m_HistL1TopoDecisionCable0->GetXaxis()->SetBinLabel(1+ tipNumber % 64, tip->thresholdName().c_str() ); - break; - case 1: - m_HistL1TopoDecisionCable1->GetXaxis()->SetBinLabel(1+ tipNumber % 64, tip->thresholdName().c_str() ); - break; - default: - break; - } + LockedHandle<TH2> lh; + StatusCode sc = m_histSvc->regShared( m_histPath + name() + path + "/" + hname, std::move(hist), lh ); + if( sc.isSuccess() ) { + ATH_MSG_DEBUG("2D-hist " << hname << " registered with key - " << key); + m_hist2D[key] = lh; + } else { + ATH_MSG_WARNING("Could not register histogram " << hname); } - + return sc; +} - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/L1TopoDecisionCable0", m_HistL1TopoDecisionCable0)); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/L1TopoDecisionCable1", m_HistL1TopoDecisionCable1)); - - // threshold input - m_thrEMTot = new TH1I("ThrEM", "Total threshold count EM", 16, 0, 16); - m_thrHATot = new TH1I("ThrHA", "Total threshold count HA", 16, 0, 16); - m_thrJETTot = new TH1I("ThrJET", "Total threshold count JET", 25, 0, 25); - m_thrMUTot = new TH1I("ThrMU", "Total threshold count MU", 6, 0, 6); - m_thrTETot = new TH1I("ThrTE", "Total threshold count TE", 16, 0, 16); - m_thrXETot = new TH1I("ThrXE", "Total threshold count XE", 16, 0, 16); - m_thrXSTot = new TH1I("ThrXS", "Total threshold count XS", 8, 0, 8); - - m_thrEMMult = new TH1I("ThrMultEM", "Cumulative input threshold multiplicity EM", 128, 0, 128); - m_thrHAMult = new TH1I("ThrMultHA", "Cumulative input threshold multiplicity HA", 128, 0, 128); - m_thrJET1Mult = new TH1I("ThrMultJET3b", "Cumulative input threshold multiplicity JET 3b", 80, 0, 80); - m_thrJET2Mult = new TH1I("ThrMultJET2b", "Cumulative input threshold multiplicity JET 2b", 60, 0, 60); - m_thrMUMult = new TH1I("ThrMultMU", "Cumulative input threshold multiplicity MU", 48, 0, 48); - m_thrTEMult = new TH1I("ThrMultTE", "Cumulative input threshold multiplicity TE", 32, 0, 32); - m_thrXEMult = new TH1I("ThrMultXE", "Cumulative input threshold multiplicity XE", 32, 0, 32); - m_thrXSMult = new TH1I("ThrMultXS", "Cumulative input threshold multiplicity XS", 32, 0, 32); - - setThresholdHistLabels(m_thrEMMult, m_thrEMTot, thresholdConfig->getThresholdVector(L1DataDef::EM), 8); - setThresholdHistLabels(m_thrHAMult, m_thrHATot, thresholdConfig->getThresholdVector(L1DataDef::TAU), 8); - setThresholdHistLabels(m_thrMUMult, m_thrMUTot, thresholdConfig->getThresholdVector(L1DataDef::MUON), 8); - setThresholdHistLabels(m_thrJET1Mult, m_thrJETTot, thresholdConfig->getThresholdVector(L1DataDef::JET), 8,0,10); - setThresholdHistLabels(m_thrJET2Mult, m_thrJETTot, thresholdConfig->getThresholdVector(L1DataDef::JET), 4,10,25); - setThresholdHistLabels(m_thrTEMult, m_thrTETot, thresholdConfig->getThresholdVector(L1DataDef::TE), 2); - setThresholdHistLabels(m_thrXEMult, m_thrXETot, thresholdConfig->getThresholdVector(L1DataDef::XE), 2); - setThresholdHistLabels(m_thrXSMult, m_thrXSTot, thresholdConfig->getThresholdVector(L1DataDef::XS), 2); - - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrEM", m_thrEMTot )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrHA", m_thrHATot )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrJET", m_thrJETTot )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrMU", m_thrMUTot )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrTE", m_thrTETot )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrXE", m_thrXETot )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrXS", m_thrXSTot )); - - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrMultEM", m_thrEMMult )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrMultHA", m_thrHAMult )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrMultJET1", m_thrJET1Mult )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrMultJET2", m_thrJET2Mult )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrMultMU", m_thrMUMult )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrMultTE", m_thrTEMult )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrMultXE", m_thrXEMult )); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/ThrMultXS", m_thrXSMult )); - - // Items - m_itemAcceptBP = new TH1I("L1ItemsBP","L1 Items before prescale", 512, 0, 512); - m_itemAcceptAP = new TH1I("L1ItemsAP","L1 Items after prescale", 512, 0, 512); - m_itemAcceptAV = new TH1I("L1ItemsAV","L1 Items after veto", 512, 0, 512); - for(const TriggerItem * item : m_configSvc->ctpConfig()->menu().itemVector()) { - if(item==nullptr) continue; - string label = item->name() + " (CTP ID " + boost::lexical_cast<string,int>(item->ctpId())+ ")"; - m_itemAcceptBP->GetXaxis()->SetBinLabel(item->ctpId()+1,label.c_str()); - m_itemAcceptAP->GetXaxis()->SetBinLabel(item->ctpId()+1,label.c_str()); - m_itemAcceptAV->GetXaxis()->SetBinLabel(item->ctpId()+1,label.c_str()); +LockedHandle<TH1> & +LVL1CTP::CTPSimulation::get1DHist(const std::string & histName) const { + if(m_hist1D.find(histName) == m_hist1D.end()) { + ATH_MSG_ERROR("1D-hist with registration key " << histName << " does not exist"); } - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/L1ItemsBP", m_itemAcceptBP)); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/L1ItemsAP", m_itemAcceptAP)); - CHECK(m_histSvc->regHist( histstream + "CTPSimulation/L1ItemsAV", m_itemAcceptAV)); - - return StatusCode::SUCCESS; + return m_hist1D[histName]; } - -StatusCode -LVL1CTP::CTPSimulation::loadFixedConditions() { - ATH_MSG_DEBUG("loadFixedConditions()"); - - // - // monitoring - // - bookHists().ignore(); - - ToolHandleArray<IMonitorToolBase>::iterator it; - for ( it = m_monitors.begin(); it != m_monitors.end(); ++it ) { - if ( (*it)->bookHists().isFailure() ) { - ATH_MSG_WARNING("Monitoring tool: " << (*it) - << " in Algo: " << name() - << " can't book histograms successfully, remove it or fix booking problem"); - return StatusCode::FAILURE; - } else { - ATH_MSG_DEBUG("Monitoring tool: " << (*it) - << " in Algo: " << name() << " bookHists successful"); - } +LockedHandle<TH2> & +LVL1CTP::CTPSimulation::get2DHist(const std::string & histName) const { + if(m_hist2D.find(histName) == m_hist2D.end()) { + ATH_MSG_ERROR("2D-hist " << histName << " does not exist"); } + return m_hist2D[histName]; +} - // - // Set up the CTP version - cant be done before, callback to DSConfigSvc needs to complete first - // - - unsigned int ctpVersion = ( m_ctpVersion != 0 ? m_ctpVersion : m_configSvc->ctpConfig()->ctpVersion() ); - - //ATH_MSG_INFO("SMK to be simulated: " << m_configSvc->masterKey()); - ATH_MSG_INFO("CTP version from the menu: " << ctpVersion); - - m_ctpDataformat = new CTPdataformatVersion(ctpVersion); - ATH_MSG_DEBUG("Going to use the following for the CTP (version " << ctpVersion << " ):\n" << m_ctpDataformat->dump()); - - m_countsBP.resize(m_ctpDataformat->getMaxTrigItems()); - m_countsAP.resize(m_ctpDataformat->getMaxTrigItems()); - m_countsAV.resize(m_ctpDataformat->getMaxTrigItems()); +StatusCode +LVL1CTP::CTPSimulation::bookHists() const { - // This printout can only be done here, as it relies on the CTP version - if (m_doPSCL == false) { - ATH_MSG_INFO("Inputs from LVL1 PSCL systems switched off"); + const TrigConf::L1Menu * l1menu = nullptr; + if( m_useNewConfig ) { + ATH_CHECK( m_detStore->retrieve(l1menu) ); + ATH_MSG_DEBUG("Calling ::bookHists(). L1 menu " << l1menu->size() << " items" ); } else { - if (ctpVersion>3) { - ATH_MSG_DEBUG("There are no prescaled clock triggers in this version of the CTP (" << ctpVersion << ") any more. Setting m_doPSCL to false."); - m_doPSCL = false; + ATH_MSG_DEBUG("Calling ::bookHists(). ConfigSvc with " << m_configSvc->ctpConfig()->menu().itemVector().size() << " items"); + } + ConfigSource cfgSrc(m_configSvc->ctpConfig(), l1menu); + + // jets + ATH_CHECK ( hbook( "/input/jets/", std::make_unique<TH1I>("jJetPt","Jet p_{T} - jJ", 40, 0, 80) )); + ATH_CHECK ( hbook( "/input/jets/", std::make_unique<TH1I>("jJetEta","Jet #eta - jJ", 64, -3.2, 3.2) )); + ATH_CHECK ( hbook( "/input/jets/", std::make_unique<TH1I>("jJetPhi","Jet #phi - jJ", 64, -3.2, 3.2) )); + ATH_CHECK ( hbook( "/input/jets/", std::make_unique<TH1I>("jLJetPt","Jet p_{T} - jLJ", 40, 0, 80) )); + ATH_CHECK ( hbook( "/input/jets/", std::make_unique<TH1I>("jLJetEta","Jet #eta - jLJ", 64, -3.2, 3.2) )); + ATH_CHECK ( hbook( "/input/jets/", std::make_unique<TH1I>("jLJetPhi","Jet #phi - jLJ", 64, -3.2, 3.2) )); + ATH_CHECK ( hbook( "/input/jets/", std::make_unique<TH1I>("gJetPt","Jet p_{T} - gJ", 40, 0, 80) )); + ATH_CHECK ( hbook( "/input/jets/", std::make_unique<TH1I>("gJetEta","Jet #eta - gJ", 64, -3.2, 3.2) )); + ATH_CHECK ( hbook( "/input/jets/", std::make_unique<TH1I>("gJetPhi","Jet #phi - gJ", 64, -3.2, 3.2) )); + + // MET + ATH_CHECK ( hbook( "/input/met/", std::make_unique<TH1I>("Pufit","Missing ET from algorithm pufit", 40, 0, 80) )); + ATH_CHECK ( hbook( "/input/met/", std::make_unique<TH1I>("PufitPhi","Missing ET PUfit phi", 64, -3.2, 3.2) )); + ATH_CHECK ( hbook( "/input/met/", std::make_unique<TH1I>("Rho","Missing ET from algorithm rhosub", 40, 0, 80) )); + ATH_CHECK ( hbook( "/input/met/", std::make_unique<TH1I>("RhoPhi","Missing ET rhosub phi", 64, -3.2, 3.2) )); + ATH_CHECK ( hbook( "/input/met/", std::make_unique<TH1I>("JwoJ","Missing ET from algorithm jet without jets", 40, 0, 80) )); + ATH_CHECK ( hbook( "/input/met/", std::make_unique<TH1I>("JwoJPhi","Missing ET jet without jet phi", 64, -3.2, 3.2) )); + + // cluster + ATH_CHECK ( hbook( "/input/em/", std::make_unique<TH1I>("et","Cluster et", 40, 0, 40) )); + ATH_CHECK ( hbook( "/input/em/", std::make_unique<TH1I>("eta","Cluster eta ", 64, -3.2, 3.2) )); + ATH_CHECK ( hbook( "/input/em/", std::make_unique<TH1I>("phi","Cluster phi", 64, -3.2, 3.2) )); + + // tau + ATH_CHECK ( hbook( "/input/tau/", std::make_unique<TH1I>("et","Tau et", 40, 0, 40) )); + ATH_CHECK ( hbook( "/input/tau/", std::make_unique<TH1I>("eta","Tau eta ", 64, -3.2, 3.2) )); + ATH_CHECK ( hbook( "/input/tau/", std::make_unique<TH1I>("phi","Tau phi", 64, -3.2, 3.2) )); + ATH_CHECK ( hbook( "/input/tau/", std::make_unique<TH1I>("emIso","Tau em isolation", 40, 0, 1) )); + ATH_CHECK ( hbook( "/input/tau/", std::make_unique<TH1I>("hadIso","Tau hadronic isolation", 40, 0, 1) )); + ATH_CHECK ( hbook( "/input/tau/", std::make_unique<TH1I>("R3ET","Tau eT", 40, 0, 40) )); + ATH_CHECK ( hbook( "/input/tau/", std::make_unique<TH1I>("R3Iso","Tau isolation", 40, 0, 1) )); + + // input counts + ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("jJets","Number of jets (jJ)", 40, 0, 40) )); + ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("jLJets","Number of jets (jLJ)", 40, 0, 40) )); + ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("gJets","Number of jets (gJ)", 40, 0, 40) )); + ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("muons","Number of muons", 10, 0, 10) )); + ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("emcluster","Number of EM clusters", 20, 0, 20) )); + ATH_CHECK ( hbook( "/input/counts/", std::make_unique<TH1I>("taus","Number of TAU candidates", 20, 0, 20) )); + + // threshold multiplicities + ATH_CHECK ( createMultiplicityHist( cfgSrc, "muon", L1DataDef::MUON, 5) ); + ATH_CHECK ( createMultiplicityHist( cfgSrc, "jet", L1DataDef::JET) ); + ATH_CHECK ( createMultiplicityHist( cfgSrc, "xe", L1DataDef::XE, 2) ); + ATH_CHECK ( createMultiplicityHist( cfgSrc, "te", L1DataDef::TE, 2) ); + ATH_CHECK ( createMultiplicityHist( cfgSrc, "xs", L1DataDef::XS, 2) ); + ATH_CHECK ( createMultiplicityHist( cfgSrc, "em", L1DataDef::EM) ); + ATH_CHECK ( createMultiplicityHist( cfgSrc, "tau", L1DataDef::TAU) ); + + // Topo + TH1I* hTopo0 = new TH1I("l1topo0","L1Topo Decision Cable 0", 64, 0, 64); + TH1I* hTopo1 = new TH1I("l1topo1","L1Topo Decision Cable 1", 64, 0, 64); + if ( l1menu ) { + // to be implemented + } else { + for(const TIP * tip : m_configSvc->ctpConfig()->menu().tipVector() ) { + if ( tip->tipNumber() < 384 ) + continue; + unsigned int tipNumber = (unsigned int) ( tip->tipNumber() - 384 ); + switch(tipNumber / 64) { + case 0: + hTopo0->GetXaxis()->SetBinLabel(1+ tipNumber % 64, tip->thresholdName().c_str() ); + break; + case 1: + hTopo1->GetXaxis()->SetBinLabel(1+ tipNumber % 64, tip->thresholdName().c_str() ); + break; + default: + break; + } } } + ATH_CHECK( hbook( "/input/topo/", std::unique_ptr<TH1I>(hTopo0) )); + ATH_CHECK( hbook( "/input/topo/", std::unique_ptr<TH1I>(hTopo1) )); - // - // Find configuration file with trigger offsets - // - if(m_introduceArtificialTriggerOffsets) { - if( m_offsetConfigFile.find("/")==std::string::npos ){ - const std::string packagePrefix("TrigT1CTP/"); - m_offsetConfigFile.insert(0,packagePrefix); - } - m_offsetConfigFile = PathResolverFindDataFile(m_offsetConfigFile); - if (m_offsetConfigFile.empty()){ - ATH_MSG_WARNING("Trigger offset configuration file not found!\n" - << "Size of readout window will be 1"); + + // item decision + TH1I * tbpByID = new TH1I("tbpById", "Items decision (tbp)", 512, 0, 512); + TH1I * tapByID = new TH1I("tapById", "Items decision (tap)", 512, 0, 512); + TH1I * tavByID = new TH1I("tavById", "Items decision (tav)", 512, 0, 512); + + TH1I * tbpByName = new TH1I("tbpByName", "Items decision (tbp)", 512, 0, 512); + TH1I * tapByName = new TH1I("tapByName", "Items decision (tap)", 512, 0, 512); + TH1I * tavByName = new TH1I("tavByName", "Items decision (tav)", 512, 0, 512); + + std::vector<std::string> orderedItemnames; + if( l1menu ) { + orderedItemnames.reserve( l1menu->size() ); + for( const auto & item : *l1menu ) { + orderedItemnames.emplace_back(item.name()); } } else { - m_offsetConfigFile = ""; - } - - - // get random engine - CLHEP::HepRandomEngine* rndmEngine=0; - - if(m_doRNDM == true) { - rndmEngine = m_rndmSvc->GetEngine(m_rndmEngineName); - if (rndmEngine == 0) { - ATH_MSG_ERROR("Could not find RndmEngine : " << m_rndmEngineName); - return StatusCode::FAILURE; - } - - const TrigConf::Random random(m_configSvc->ctpConfig()->random()); - - if (ctpVersion<4) { - std::ostringstream message; - message << "Random trigger definition: " << random.name() << std::setw(8) << random.rate1() << std::setw(8) << random.rate2(); - - ATH_MSG_DEBUG(message.str()); - - - if (random.rate1() < 0) { - ATH_MSG_INFO("Rate factor for random trigger RNDM0 below zero (" << random.rate1() << "): only possible in simulation"); - } - - unsigned int rate1 = (0x1 << (8+random.rate1())) - 1; - ATH_MSG_DEBUG("REGTEST - Rate for random trigger RNDM0: " << rate1 << " / " << 40080./rate1 << " Hz"); - m_internalTrigger[ make_pair(TrigConf::L1DataDef::RNDM,0)] = new RandomTrigger(0, rate1, ctpVersion, rndmEngine); - - if (random.rate2() < 0) { - ATH_MSG_DEBUG("Rate factor for random trigger RNDM1 below zero (" << random.rate2() << "): only possible in simulation"); - } - - unsigned int rate2 = (0x1 << (8+random.rate2())) - 1; - ATH_MSG_DEBUG("REGTEST - Rate for random trigger RNDM1: " << rate2 << " / " << 40080./rate2 << " Hz"); - m_internalTrigger[ make_pair(TrigConf::L1DataDef::RNDM,1)] = new RandomTrigger(1, rate2, ctpVersion, rndmEngine); - - } else {//XXX How to treat random triggers in run-II? - uint32_t cut0 = random.cuts(0); - uint32_t cut1 = random.cuts(1); - uint32_t cut2 = random.cuts(2); - uint32_t cut3 = random.cuts(3); - - std::ostringstream message; - message << "Random trigger definition: " << random.name() << std::setw(8) << hex << cut0 << std::setw(8) << hex << cut1 - << std::setw(8) << hex << cut2 << std::setw(8) << hex << cut3; - - ATH_MSG_DEBUG(message.str()); - - - for(int rndmIdx = 0; rndmIdx<4; rndmIdx++) { - uint32_t cut = random.cuts(rndmIdx); - if(cut>=0x1000000) { cut = 0xFFFFFF; } - if(cut==0) { cut = 0x1; } - double prescale = double(0xFFFFFF) / (0x1000000-cut); - - ATH_MSG_DEBUG("REGTEST - Cut for random trigger RNDM " << rndmIdx << " : " << "0x" << hex << cut << dec << " (" << cut << ")"); - ATH_MSG_DEBUG("REGTEST - PS (from 40.08MHz) " << rndmIdx << " : " << prescale); - ATH_MSG_DEBUG("REGTEST - Rate " << rndmIdx << " : " << 40080./prescale << " kHz"); - m_internalTrigger[ make_pair(TrigConf::L1DataDef::RNDM,rndmIdx)] = new RandomTrigger(rndmIdx, (unsigned int)prescale, ctpVersion, rndmEngine); - } + orderedItemnames.reserve(m_configSvc->ctpConfig()->menu().items().size()); + for( const auto & item : m_configSvc->ctpConfig()->menu().items() ) { + orderedItemnames.emplace_back(item->name()); } } - - if(ctpVersion<4 && m_doPSCL == true){ - const TrigConf::PrescaledClock prescaledClock(m_configSvc->ctpConfig()->prescaledClock()); - - ATH_MSG_DEBUG("REGTEST - Prescaled clock trigger definition: " << prescaledClock.name() - << std::setw(8) << prescaledClock.clock1() << std::setw(8) << prescaledClock.clock2()); - if (prescaledClock.clock1() > 0) { - m_internalTrigger[ make_pair(TrigConf::L1DataDef::PCLK,0)] = new PrescaledClockTrigger(0, prescaledClock.clock1(), ctpVersion); - } else { - ATH_MSG_WARNING("No prescaled clock trigger PCLK0 defined."); - } - if (prescaledClock.clock2() > 0) { - m_internalTrigger[ make_pair(TrigConf::L1DataDef::PCLK,1)] = new PrescaledClockTrigger(1, prescaledClock.clock2(), ctpVersion); + std::sort(orderedItemnames.begin(), orderedItemnames.end()); + + unsigned int bin = 1; + for ( const std::string & itemname : orderedItemnames ) { + unsigned int ctpId(0); + if (l1menu) { + TrigConf::L1Item item = l1menu->item( itemname ); + ctpId = item.ctpId(); } else { - ATH_MSG_WARNING("No prescaled clock trigger PCLK1 defined."); + const TrigConf::TriggerItem * item = m_configSvc->ctpConfig()->menu().item( itemname ); + ctpId = item->ctpId(); } - }else if (ctpVersion>3 && m_doPSCL == true) { - ATH_MSG_DEBUG("There are no prescaled clock triggers in this version of the CTP (" << ctpVersion << ") any more. Setting m_doPSCL to false."); - m_doPSCL=false; - }else { - ATH_MSG_DEBUG("Simulation of prescaled clock triggers is switched off."); - } - - //XXX Maybe remove this since it is probably never gonna be used? - if (m_applyDeadTime == true) { // dead time simulation - ATH_MSG_WARNING("Deadtime not implemented!"); - - const TrigConf::DeadTime deadTime(m_configSvc->ctpConfig()->deadTime()); - ATH_MSG_DEBUG("Config:" << " " << deadTime.simple() - << " " << deadTime.complex1Level() << " " << deadTime.complex1Rate() - << " " << deadTime.complex2Level() << " " << deadTime.complex2Rate()); + tbpByID->GetXaxis()->SetBinLabel( ctpId+1, itemname.c_str() ); + tapByID->GetXaxis()->SetBinLabel( ctpId+1, itemname.c_str() ); + tavByID->GetXaxis()->SetBinLabel( ctpId+1, itemname.c_str() ); + tbpByName->GetXaxis()->SetBinLabel( bin, itemname.c_str() ); + tapByName->GetXaxis()->SetBinLabel( bin, itemname.c_str() ); + tavByName->GetXaxis()->SetBinLabel( bin++, itemname.c_str() ); } - - if (m_doMBTS) { - const TrigConf::ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); - if (thresholdConfig == 0) { - m_doMBTS = false; - ATH_MSG_WARNING("Can't get threshold configuration from Trig Config Service"); - } - else { - const std::vector<TrigConf::TriggerThreshold*>& thresholds = thresholdConfig->getThresholdVector(L1DataDef::MBTS); - unsigned int threshold_a(0), threshold_c(0); - for( TrigConf::TriggerThreshold* thr : thresholds) { - ATH_MSG_DEBUG("MBTS Threshold name=" << thr->name()); - if ( thr->name() == "MBTS_A") ++threshold_a; - if ( thr->name() == "MBTS_C") ++threshold_c; - } - - if (threshold_a == 0 || threshold_c == 0) { - m_doMBTS = false; - ATH_MSG_INFO("MBTS thresholds not set properly:" - << " #a = " << threshold_a << " #c = " << threshold_c); - } - - if (m_doMBTSSI){ - std::vector<TrigConf::TriggerThreshold*> si_thresholds = thresholdConfig->getThresholdVector(L1DataDef::MBTSSI); - unsigned int thresholds_a(0), thresholds_c(0); - - for ( TrigConf::TriggerThreshold* thr : si_thresholds ) { - ATH_MSG_DEBUG("MBTSSI Threshold name=" << thr->name()); - for (unsigned int i=0;i!=16;i++){ - std::ostringstream osa; - osa <<"MBTS_A"<<i; - if ( thr->name() == osa.str()) - thresholds_a++; - std::ostringstream osc; - osc <<"MBTS_C"<<i; - if ( thr->name() == osc.str()) - thresholds_c++; - } - } - if ( (thresholds_a != 16 && thresholds_a != 12) || ( thresholds_a != thresholds_c ) ) { - m_doMBTSSI = false; - ATH_MSG_INFO("MBTSSI thresholds not set properly:" - << " #a = " << thresholds_a << " #c = " << thresholds_c); - } - } - if (m_doMBTS == false) { - ATH_MSG_WARNING("Inputs from LVL1 MBTS systems switched off (system not properly configured)"); - } + + ATH_CHECK ( hbook( "/output/", std::unique_ptr<TH1I>(tbpByID) )); + ATH_CHECK ( hbook( "/output/", std::unique_ptr<TH1I>(tapByID) )); + ATH_CHECK ( hbook( "/output/", std::unique_ptr<TH1I>(tavByID) )); + ATH_CHECK ( hbook( "/output/", std::unique_ptr<TH1I>(tbpByName) )); + ATH_CHECK ( hbook( "/output/", std::unique_ptr<TH1I>(tapByName) )); + ATH_CHECK ( hbook( "/output/", std::unique_ptr<TH1I>(tavByName) )); + + ATH_CHECK ( hbook( "/", std::unique_ptr<TH1I>(new TH1I("bcid", "Bunch crossing ID", 3564, 0, 3564)) )); + + return StatusCode::SUCCESS; +} + + +StatusCode +LVL1CTP::CTPSimulation::fillInputHistograms(const EventContext& context) const { + + ATH_MSG_DEBUG( "fillInputHistograms" ); + + // jFEX jets + auto jFexJets = SG::makeHandle( m_iKeyJFexJets, context ); + if(jFexJets.isValid()) { + get1DHist("/input/counts/jJets")->Fill(jFexJets->size()); + auto h0 = *get1DHist("/input/jets/jJetPt"); // calling operator* to get the Guard outside the filling loop + auto h1 = *get1DHist("/input/jets/jJetEta"); + auto h2 = *get1DHist("/input/jets/jJetPhi"); + for( const auto & jet : *jFexJets ) { + h0->Fill(fabs(jet->et8x8()/1000.)); + h1->Fill(jet->eta()); + h2->Fill(jet->phi()); } + } else { + ATH_MSG_DEBUG("No collection " << m_iKeyJFexJets); } - - if (m_doBCM) { - const TrigConf::ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); - if (thresholdConfig == 0) { - m_doBCM = false; - ATH_MSG_WARNING("Can't get threshold configuration from Trig Config Service"); - } - - else { - std::vector<TrigConf::TriggerThreshold*> thresholds = thresholdConfig->getThresholdVector(L1DataDef::BCM); - unsigned int threshold(0); - for (std::vector<TrigConf::TriggerThreshold*>::iterator iter(thresholds.begin()); - iter != thresholds.end(); ++iter) { - ATH_MSG_DEBUG("BCM Threshold name=" << (*iter)->name()); - - ++threshold; - } - - thresholds = thresholdConfig->getThresholdVector(L1DataDef::BCMCMB); - for (std::vector<TrigConf::TriggerThreshold*>::iterator iter(thresholds.begin()); - iter != thresholds.end(); ++iter) { - ATH_MSG_DEBUG("BCM Threshold name=" << (*iter)->name()); - - ++threshold; - } - - if (threshold == 0) { - m_doBCM = false; - ATH_MSG_INFO("no BCM threshold found: " << threshold); - } + + // jFEX large-R jets + auto jFexLJets = SG::makeHandle( m_iKeyJFexLJets, context ); + if(jFexLJets.isValid()) { + get1DHist("/input/counts/jLets")->Fill(jFexLJets->size()); + auto h0 = *get1DHist("/input/jets/jLJetPt"); + auto h1 = *get1DHist("/input/jets/jLJetEta"); + auto h2 = *get1DHist("/input/jets/jLJetPhi"); + for( const auto & jet : *jFexLJets ) { + h0->Fill(fabs(jet->et8x8()/1000.)); + h1->Fill(jet->eta()); + h2->Fill(jet->phi()); } - if (m_doBCM == false) { - ATH_MSG_WARNING("Inputs from LVL1 BCM systems switched off (system not properly configured)"); - } + } else { + ATH_MSG_DEBUG("No collection " << m_iKeyJFexLJets); } - - if (m_doLUCID) { - const TrigConf::ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); - if (thresholdConfig == 0) { - m_doLUCID = false; - ATH_MSG_WARNING("Can't get threshold configuration from Trig Config Service"); - } - - else { - std::vector<TrigConf::TriggerThreshold*> thresholds = thresholdConfig->getThresholdVector(L1DataDef::LUCID); - unsigned int threshold(0); - for (std::vector<TrigConf::TriggerThreshold*>::iterator iter(thresholds.begin()); - iter != thresholds.end(); ++iter) { - ATH_MSG_DEBUG("LUCID Threshold name=" << (*iter)->name()); - - ++threshold; - } - - if (threshold == 0) { - m_doLUCID = false; - ATH_MSG_WARNING("no LUCID threshold found: " << threshold); - } + + // gFEX jets + auto gFexJets = SG::makeHandle( m_iKeyGFexJets, context ); + if(gFexJets.isValid()) { + get1DHist("/input/counts/gJets")->Fill(gFexJets->size()); + auto h0 = *get1DHist("/input/jets/gJetPt"); + auto h1 = *get1DHist("/input/jets/gJetEta"); + auto h2 = *get1DHist("/input/jets/gJetPhi"); + for( const auto & jet : *gFexJets ) { + h0->Fill(fabs(jet->et8x8()/1000.)); + h1->Fill(jet->eta()); + h2->Fill(jet->phi()); } - if (m_doLUCID == false) { - ATH_MSG_WARNING("Inputs from LVL1 LUCID systems switched off (system not properly configured)"); - } + } else { + ATH_MSG_DEBUG("No collection " << m_iKeyGFexJets); } - - if (m_doZDC) { - const TrigConf::ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); - if (thresholdConfig == 0) { - m_doZDC = false; - ATH_MSG_WARNING("Can't get threshold configuration from Trig Config Service"); - } - - else { - std::vector<TrigConf::TriggerThreshold*> thresholds = thresholdConfig->getThresholdVector(L1DataDef::ZDC); - unsigned int threshold(0); - for (std::vector<TrigConf::TriggerThreshold*>::iterator iter(thresholds.begin()); - iter != thresholds.end(); ++iter) { - ATH_MSG_DEBUG("ZDC Threshold name=" << (*iter)->name()); - - ++threshold; - } - - if (threshold == 0) { - m_doZDC = false; - ATH_MSG_WARNING("no ZDC threshold found: " << threshold); - } - } - - if (m_doZDC == false) { - ATH_MSG_WARNING("Inputs from LVL1 ZDC systems switched off (system not properly configured)"); - } + + // MET + auto gFexMETPufit = SG::makeHandle( m_iKeyGFexMETPufit, context ); + if( gFexMETPufit.isValid() ) { + get1DHist("/input/met/Pufit")->Fill(gFexMETPufit->energyT()/1000.); + get1DHist("/input/met/PufitPhi")->Fill(atan2(gFexMETPufit->energyX(), gFexMETPufit->energyY())); + } else { + ATH_MSG_DEBUG("No collection " << m_iKeyGFexMETPufit); } - - if (m_doNIM) { - const TrigConf::ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); - if (thresholdConfig == 0) { - - m_doNIM = false; - ATH_MSG_WARNING("Can't get threshold configuration from Trig Config Service"); - } - - else { - std::vector<TrigConf::TriggerThreshold*> thresholds = thresholdConfig->getThresholdVector(L1DataDef::NIM); - unsigned int threshold(0); - for (std::vector<TrigConf::TriggerThreshold*>::iterator iter(thresholds.begin()); - iter != thresholds.end(); ++iter) { - if((*iter)==0) continue; - ATH_MSG_DEBUG("NIM Threshold name=" << (*iter)->name()); - - ++threshold; - } - - if (threshold == 0) { - m_doNIM = false; - ATH_MSG_WARNING("no NIM threshold found: " << threshold); - } - } - - if (m_doNIM == false) { - ATH_MSG_WARNING("Inputs from LVL1 NIM systems switched off (system not properly configured)"); - } + auto gFexMETRho = SG::makeHandle( m_iKeyGFexMETRho, context ); + if( gFexMETRho.isValid() ) { + get1DHist("/input/met/Rho")->Fill(gFexMETRho->energyT()/1000.); + get1DHist("/input/met/RhoPhi")->Fill(atan2(gFexMETRho->energyX(), gFexMETRho->energyY())); + } else { + ATH_MSG_DEBUG("No collection " << m_iKeyGFexMETRho); } - - if (m_doBPTX) { - const TrigConf::ThresholdConfig* thresholdConfig = m_configSvc->thresholdConfig(); - if (thresholdConfig == 0) { - m_doBPTX = false; - ATH_MSG_WARNING("Can't get threshold configuration from Trig Config Service"); - } - - else { - std::vector<TrigConf::TriggerThreshold*> thresholds = thresholdConfig->getThresholdVector(L1DataDef::BPTX); - unsigned int threshold(0); - for (std::vector<TrigConf::TriggerThreshold*>::iterator iter(thresholds.begin()); - iter != thresholds.end(); ++iter) { - ATH_MSG_DEBUG("BPTX Threshold name=" << (*iter)->name()); - - ++threshold; - } - - if (threshold == 0) { - m_doBPTX = false; - ATH_MSG_WARNING("no BPTX threshold found: " << threshold); - } - } - - if (m_doBPTX == false) { - ATH_MSG_WARNING("Inputs from LVL1 BPTX systems switched off (system not properly configured)"); - } + auto gFexMETJwoJ = SG::makeHandle( m_iKeyGFexMETJwoJ, context ); + if( gFexMETJwoJ.isValid() ) { + get1DHist("/input/met/JwoJ")->Fill(gFexMETJwoJ->energyT()/1000.); + get1DHist("/input/met/JwoJPhi")->Fill(atan2(gFexMETJwoJ->energyX(), gFexMETJwoJ->energyY())); + } else { + ATH_MSG_DEBUG("No collection " << m_iKeyGFexMETJwoJ); } - - - // - // Construct the map between the configuration and decision threshold objects: - // - if (ctpVersion<4) { //for versions of run-I there are only inputs via PIT bus - - if (m_configSvc->ctpConfig()->menu().pitVector().size()==0) { //assign PIT bits manually - m_decisionMap = new ThresholdMap( m_configSvc->ctpConfig()->menu().thresholdVector()); - }else{ //take PIT assignment from configuration - m_decisionMap = new ThresholdMap( m_configSvc->ctpConfig()->menu().thresholdVector(), - m_configSvc->ctpConfig()->menu().pitVector()); - } - }else {// in newer version there are also direct inputs via CTPCORE+ front panel - - if (m_configSvc->ctpConfig()->menu().tipVector().size()==0) { //assign TIP bits manually - m_decisionMap = new ThresholdMap( m_configSvc->ctpConfig()->menu().thresholdVector()); - } else { //take TIP assignment from configuration - m_decisionMap = new ThresholdMap( m_configSvc->ctpConfig()->menu().thresholdVector(), - m_configSvc->ctpConfig()->menu().tipVector()); + + // EM cluster + auto eFexCluster = SG::makeHandle( m_iKeyEFexCluster, context ); + if( eFexCluster.isValid() ) { + get1DHist( "/input/counts/emcluster")->Fill(eFexCluster->size()); + auto h0 = *get1DHist("/input/em/et"); + auto h1 = *get1DHist("/input/em/eta"); + auto h2 = *get1DHist("/input/em/phi"); + for( const auto & cl : *eFexCluster ) { + h0->Fill(cl->et()); + h1->Fill(cl->eta()); + h2->Fill(cl->phi()); } + } else { + ATH_MSG_DEBUG("No collection " << m_iKeyEFexCluster); } - - ATH_MSG_DEBUG("Mapped decision threshold objects to configuration ones"); - ATH_MSG_DEBUG(" |--------------------------------------------------------|"); - ATH_MSG_DEBUG(" | TIP layout for the thresholds |"); - ATH_MSG_DEBUG(" |--------------------------------------------------------|"); - ATH_MSG_DEBUG(" | Name | startbit | endbit |"); - ATH_MSG_DEBUG(" |--------------------------------------------------------|"); - - for( TrigConf::TriggerThreshold * threshold : m_configSvc->ctpConfig()->menu().thresholdVector() ) { - ATH_MSG_DEBUG( "REGTEST - | " << std::setw( 20 ) << threshold->name() << " | " - << std::setw( 8 ) << m_decisionMap->decision( threshold )->startBit() << " | " - << std::setw( 8 ) << m_decisionMap->decision( threshold )->endBit() << " |"); - } - ATH_MSG_DEBUG(" |--------------------------------------------------------|"); - - for (InternalTriggerMap::value_type internalThr : m_internalTrigger) { - ATH_MSG_DEBUG("REGTEST - | " << std::setw( 20 ) << L1DataDef::typeAsString(internalThr.first.first) << internalThr.first.second << " | " - << std::setw( 8 ) << internalThr.second->pit() << " | " << setw( 8 ) << internalThr.second->pit() << " |"); + + // eFEX Tau + auto eFexTau = SG::makeHandle( m_iKeyEFexTau, context ); + if( eFexTau.isValid() ) { + get1DHist( "/input/counts/taus")->Fill(eFexTau->size()); + auto h0 = *get1DHist("/input/tau/et"); + auto h1 = *get1DHist("/input/tau/eta"); + auto h2 = *get1DHist("/input/tau/phi"); + auto h3 = *get1DHist("/input/tau/emIso"); + auto h4 = *get1DHist("/input/tau/hadIso"); + auto h5 = *get1DHist("/input/tau/R3ClusterET"); + auto h6 = *get1DHist("/input/tau/R3ClusterIso"); + const static SG::AuxElement::ConstAccessor<float> accR3ClET ("R3ClusterET"); + const static SG::AuxElement::ConstAccessor<float> accR3ClIso ("R3ClusterIso"); + for( const auto & tau : *eFexTau ) { + h0->Fill(tau->eT()); + h1->Fill(tau->eta()); + h2->Fill(tau->phi()); + h3->Fill(tau->emIsol()); + h4->Fill(tau->hadIsol()); + h5->Fill(accR3ClET(*tau)/1000.); + h6->Fill(accR3ClIso(*tau)); + } + } else { + ATH_MSG_DEBUG("No collection " << m_iKeyEFexTau); } - - ATH_MSG_DEBUG(" |--------------------------------------------------------|"); - - // - // Construct the map between configuration and decision trigger item objects: - // - m_itemMap = new ItemMap( m_configSvc->ctpConfig()->menu().itemVector(), - m_configSvc->ctpConfig()->prescaleSet(), - ((m_prescaleMode == OFFSET)&&(m_doRNDM)) ? rndmEngine : 0 ); - - ATH_MSG_DEBUG("Mapped decision trigger item objects to configuration ones"); - ATH_MSG_DEBUG(" |---------------------------------------------------------------------------------|"); - ATH_MSG_DEBUG(" | Layout of trigger items in result |"); - ATH_MSG_DEBUG(" |---------------------------------------------------------------------------------|"); - ATH_MSG_DEBUG(" | Name | Position | Prescale | TriggerType |"); - ATH_MSG_DEBUG(" |---------------------------------------------------------------------------------|"); - - for( TrigConf::TriggerItem* item : m_configSvc->ctpConfig()->menu().itemVector()) { - ATH_MSG_DEBUG("REGTEST - | " << std::setw( 40 ) << item->name() - << " | " << std::setw( 7 ) << m_itemMap->getItem( item )->itemPos() - << " | " << std::setw( 7 ) << m_itemMap->getItem( item )->prescale() - << " | 0x" << std::hex << std::setfill('0') << std::setw( 2 ) << item->triggerType() << std::dec << std::setfill(' ') - << " |"); + + // topo + auto topoInput = SG::makeHandle( m_iKeyTopo, context ); + if(topoInput.isValid()) { + ATH_MSG_DEBUG("Retrieved input from L1Topo from StoreGate with key " << m_iKeyTopo); + ATH_MSG_DEBUG("L1Topo0 word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord1(0)); + ATH_MSG_DEBUG("L1Topo0 word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord1(1)); + ATH_MSG_DEBUG("L1Topo1 word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord2(0)); + ATH_MSG_DEBUG("L1Topo1 word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << topoInput->cableWord2(1)); + auto h0 = *get1DHist("/input/topo/l1topo0"); + auto h1 = *get1DHist("/input/topo/l1topo1"); + for(unsigned int i=0; i<32; ++i) { + uint32_t mask = 0x1; mask <<= i; + if( (topoInput->cableWord1(0) & mask) != 0 ) h0->Fill(i); // cable 0, clock 0 + if( (topoInput->cableWord1(1) & mask) != 0 ) h0->Fill(32 + i); // cable 0, clock 1 + if( (topoInput->cableWord2(0) & mask) != 0 ) h1->Fill(i); // cable 1, clock 0 + if( (topoInput->cableWord2(1) & mask) != 0 ) h1->Fill(32 + i); // cable 1, clock 1 + } + } else { + ATH_MSG_DEBUG("No collection " << m_iKeyTopo); } - ATH_MSG_DEBUG(" |---------------------------------------------------------------------------------|"); - - // build prescale vector (for monitoring) - m_prescales = m_configSvc->ctpConfig()->prescaleSet().prescales_float(); - - ATH_MSG_INFO("done loadFixeConditions()"); + + // bcid + auto bcid = context.eventID().bunch_crossing_id(); + get1DHist( "/bcid")->Fill(bcid); return StatusCode::SUCCESS; } +namespace { + bool containsBunch(unsigned int bcid, const TrigConf::BunchGroup & bg) { + return std::find(bg.bunches().begin(), bg.bunches().end(), bcid) != bg.bunches().end(); + } +} StatusCode -LVL1CTP::CTPSimulation::execute() { - - ATH_MSG_DEBUG("Executing CTPSimulation algorithm"); - - ATH_MSG_DEBUG( "execute: old style configSvc provides menu " << m_configSvc->ctpConfig()->name() - << " with " << m_configSvc->ctpConfig()->menu().items().size() << " items and " - << m_configSvc->ctpConfig()->menu().thresholdConfig().size() << " thresholds"); +LVL1CTP::CTPSimulation::extractMultiplicities(std::map<std::string, unsigned int> & thrMultiMap, const EventContext& context) const { - if( m_useCondL1Menu ) { - const TrigConf::L1Menu * l1menu = SG::ReadCondHandle( m_l1MenuKey ).retrieve(); - if ( l1menu == nullptr || !l1menu->isValid() || l1menu->empty()) { - ATH_MSG_ERROR ( "No L1 menu provided, can't run"); - return StatusCode::FAILURE; - } + const TrigConf::L1Menu * l1menu = nullptr; + if( m_useNewConfig ) { + ATH_CHECK( m_detStore->retrieve(l1menu) ); } - unsigned int ctpVersion = ( m_ctpVersion != 0 ? m_ctpVersion : m_configSvc->ctpConfig()->ctpVersion() ); - - - //////////////////////////////////////////////////////////////////////////// - // // - // Extract informations about the event // - // // - //////////////////////////////////////////////////////////////////////////// - - const DataHandle< ::EventInfo > eventInfo; - StatusCode sc = evtStore()->retrieve( eventInfo ); - if( sc.isFailure() ) { - - ATH_MSG_ERROR("Couldn't retrieve event information from StoreGate"); - ATH_MSG_ERROR("Event information in output will be zeroed"); - - EventInfo::instance().clear(); + thrMultiMap.clear(); - } else { - - ATH_MSG_DEBUG("Retrieved event information from StoreGate"); - - EventInfo::instance().clear(); - - if (eventInfo->event_ID() != 0) { - const EventID* eventID = eventInfo->event_ID(); - - ATH_MSG_DEBUG("Retrieved EventID: " << *eventID); - - EventInfo::instance().setTime( eventID->time_stamp() ); - EventInfo::instance().setTimeNs( eventID->time_stamp_ns_offset() ); - - EventInfo::instance().setRunNumber( eventID->run_number() ); - EventInfo::instance().setEventNumber( eventID->event_number() ); - EventInfo::instance().setBCID( eventID->bunch_crossing_id() ); - } - else { - ATH_MSG_INFO("Event ID part of event information has zero pointer"); + if( l1menu ) { + const auto & thrV = l1menu->thresholds(); + for ( const TrigConf::L1Threshold & thr : thrV ) { + // get the multiplicity for each threshold + unsigned int multiplicity = calculateMultiplicity( thr, l1menu, context ); + // and record in threshold--> multiplicity map (to be used for item decision) + thrMultiMap[thr.name()] = multiplicity; } - - if (eventInfo->trigger_info() != 0) { - const TriggerInfo* triggerInfo = eventInfo->trigger_info(); - - ATH_MSG_DEBUG("Retrieved TriggerInfo: " << *triggerInfo); - - EventInfo::instance().setExtendedL1ID( triggerInfo->extendedLevel1ID() ); - if (triggerInfo->level1TriggerType() != 0) { - ATH_MSG_DEBUG("TriggerType not zero: " - << "0x" << std::hex << std::setw(8) << std::setfill('0') << eventInfo->trigger_info()->level1TriggerType() - << std::setfill(' ') << std::dec << " Will be overwritten."); - } - - EventInfo::instance().setEventType( 0 ); - if (triggerInfo->level1TriggerInfo().size() != 0) { - ATH_MSG_DEBUG("TriggerInfo not zero: " << std::hex << std::setfill('0')); - for (size_t i(0); i < triggerInfo->level1TriggerInfo().size(); ++i) { - ATH_MSG_DEBUG("0x" << std::setw(8) << triggerInfo->level1TriggerInfo()[i]); - } - ATH_MSG_DEBUG(std::setfill(' ') << std::dec << " Will be overwritten."); - - } - } - else { - ATH_MSG_INFO("Trigger Info part of event information has zero pointer"); + } else { + for ( const TrigConf::TriggerThreshold * thr : m_configSvc->ctpConfig()->menu().thresholdVector() ) { + // get the multiplicity for each threshold + unsigned int multiplicity = calculateMultiplicity( thr, context ); + // and record in threshold--> multiplicity map (to be used for item decision) + thrMultiMap[thr->name()] = multiplicity; } - ATH_MSG_DEBUG("EventInfo: " + EventInfo::instance().dump()); } - - - //////////////////////////////////////////////////////////////////////////// - // // - // Retrieve the inputs to the CTP // - // // - //////////////////////////////////////////////////////////////////////////// - - // Get the Calo info: - if (m_doCalo) { - // Get the egamma input from calo: - StatusCode sc = evtStore()->retrieve( m_emtauCTP, m_emTauCTPLoc ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Couldn't retrieve EM-TAU inputs from LVL1 calo simulation from StoreGate"); - ATH_MSG_WARNING("Setting calo EM-TAU inputs to CTP to zero"); - } else { - ATH_MSG_DEBUG("Retrieved EM-TAU inputs from LVL1 calo simulation from StoreGate with SG key " << m_emTauCTPLoc ); - ATH_MSG_DEBUG("EM-TAU cable word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_emtauCTP->cableWord0()); - ATH_MSG_DEBUG("EM-TAU cable word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_emtauCTP->cableWord1()); - ATH_MSG_DEBUG("EM-TAU cable word 2 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_emtauCTP->cableWord2()); - ATH_MSG_DEBUG("EM-TAU cable word 3 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_emtauCTP->cableWord3()); - } - - // Get the jet input from calo: - sc = evtStore()->retrieve( m_jetCTP, m_jetCTPLoc ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Couldn't retrieve jet inputs from LVL1 calo simulation from StoreGate"); - ATH_MSG_WARNING("Setting calo jet inputs to CTP to zero"); - } else { - ATH_MSG_DEBUG("Retrieved jet inputs from LVL1 calo simulation from StoreGate"); - ATH_MSG_DEBUG("Jet cable word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_jetCTP->cableWord0()); - ATH_MSG_DEBUG("Jet cable word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_jetCTP->cableWord1()); - } - - // Get the energy input from calo: - sc = evtStore()->retrieve( m_energyCTP, m_energyCTPLoc ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Couldn't retrieve energy input from LVL1 calo simulation from StoreGate"); - ATH_MSG_WARNING("Setting calo energy input to CTP to zero"); - } else { - ATH_MSG_DEBUG("Retrieved energy input from LVL1 calo simulation from StoreGate"); - ATH_MSG_DEBUG("Energy cable word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_energyCTP->cableWord0()); - ATH_MSG_DEBUG("Energy cable word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_energyCTP->cableWord1()); - } - - if (m_doMBTS) { - // Get forward and backward input from MBTS: (two cable words) - sc = evtStore()->retrieve( m_mbtsACTP, m_mbtsACTPLoc ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Couldn't retrieve input from LVL1 MBTSA simulation from StoreGate " << m_mbtsACTPLoc); - ATH_MSG_WARNING("Setting MBTSA input to CTP to zero"); - } else { - ATH_MSG_DEBUG("Retrieved input from LVL1 MBTSA simulation from StoreGate " << m_mbtsACTPLoc); - ATH_MSG_DEBUG("MBTSA cable word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_mbtsACTP->cableWord0()); - } - - sc = evtStore()->retrieve( m_mbtsCCTP, m_mbtsCCTPLoc ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Couldn't retrieve input from LVL1 MBTSC simulation from StoreGate " << m_mbtsCCTPLoc); - ATH_MSG_WARNING("Setting MBTSC input to CTP to zero"); - } else { - ATH_MSG_DEBUG("Retrieved input from LVL1 MBTSC simulation from StoreGate " << m_mbtsCCTPLoc); - ATH_MSG_DEBUG("MBTSC cable word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_mbtsCCTP->cableWord0()); - } - } - - } // if (m_doCalo) - - // Do something similar for L1Topo - if (m_doL1Topo) { - if ( evtStore()->retrieve( m_topoCTP, m_topoCTPLoc ).isSuccess() ) { - for(unsigned int i=0; i<32; ++i) { - uint32_t mask = 0x1; mask <<= i; - if( (m_topoCTP->cableWord1(0) & mask) != 0 ) m_HistL1TopoDecisionCable0->Fill(i); // cable 0, clock 0 - if( (m_topoCTP->cableWord1(1) & mask) != 0 ) m_HistL1TopoDecisionCable0->Fill(32 + i); // cable 0, clock 1 - if( (m_topoCTP->cableWord2(0) & mask) != 0 ) m_HistL1TopoDecisionCable1->Fill(i); // cable 1, clock 0 - if( (m_topoCTP->cableWord2(1) & mask) != 0 ) m_HistL1TopoDecisionCable1->Fill(32 + i); // cable 1, clock 1 - } - ATH_MSG_DEBUG("Retrieved input from L1Topo from StoreGate with key " << m_topoCTPLoc); - ATH_MSG_DEBUG("ALFA word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_topoCTP->cableWord0(0)); - ATH_MSG_DEBUG("ALFA word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_topoCTP->cableWord0(1)); - ATH_MSG_DEBUG("L1Topo0 word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_topoCTP->cableWord1(0)); - ATH_MSG_DEBUG("L1Topo0 word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_topoCTP->cableWord1(1)); - ATH_MSG_DEBUG("L1Topo1 word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_topoCTP->cableWord2(0)); - ATH_MSG_DEBUG("L1Topo1 word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_topoCTP->cableWord2(1)); - } else { - ATH_MSG_WARNING("Couldn't retrieve input from L1Topo from StoreGate"); - ATH_MSG_WARNING("Setting L1Topo inputs to CTP to zero"); + + // internal triggers + auto bcid = context.eventID().bunch_crossing_id(); + get1DHist( "/bcid")->Fill(bcid); + if( m_forceBunchGroupPattern ) { + // force bunch group pattern from job options + for ( size_t bg = 0; bg < 16; ++bg ) { + std::string bgName("BGRP"); + bgName += std::to_string(bg); + thrMultiMap[bgName] = ( m_bunchGroupPattern & (0x1<<bg) ) ? 1 : 0; } - } - - if (m_doBCM) { - // Get trigger input from BCM - sc = evtStore()->retrieve( m_bcmCTP, m_bcmCTPLoc ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Couldn't retrieve input from LVL1 BCM simulation from StoreGate"); - ATH_MSG_WARNING("Setting BCM input to CTP to zero"); - } else { - ATH_MSG_DEBUG("Retrieved input from LVL1 BCM simulation from StoreGate"); - ATH_MSG_DEBUG("BCM cable word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_bcmCTP->cableWord0()); + } else { + // use bunchgroup definition from configuration and pick according to the BCID + if( ! l1menu ) { + for( const TrigConf::BunchGroup & bg : m_configSvc->ctpConfig()->bunchGroupSet().bunchGroups() ) { + std::string bgName("BGRP"); + bgName += std::to_string(bg.internalNumber()); + thrMultiMap[bgName] = containsBunch(bcid,bg) ? 1 : 0; + } } } - - if (m_doLUCID) { - // Get trigger input from LUCID - sc = evtStore()->retrieve( m_lucidCTP, m_lucidCTPLoc ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Couldn't retrieve input from LVL1 LUCID simulation from StoreGate"); - ATH_MSG_WARNING("Setting LUCID input to CTP to zero"); - } else { - ATH_MSG_DEBUG("Retrieved input from LVL1 LUCID simulation from StoreGate"); - ATH_MSG_DEBUG("LUCID cable word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_lucidCTP->cableWord0()); + + // all RNDM triggers run with 40MHz, so they are always in + thrMultiMap["RNDM0"] = 1; + thrMultiMap["RNDM1"] = 1; + thrMultiMap["RNDM2"] = 1; + thrMultiMap["RNDM3"] = 1; + + + return StatusCode::SUCCESS; +} + + + +unsigned int +LVL1CTP::CTPSimulation::calculateJetMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const { + unsigned int multiplicity = 0; + if( confThr.type() == "JET" ) { + auto ctpinJet = SG::makeHandle( m_iKeyCtpinJet, context ); + if ( ctpinJet.isValid() ) { + if( l1menu->connector("JET1").hasLine(confThr.name()) ) { + auto & triggerline = l1menu->connector("JET1").triggerLine(confThr.name()); + multiplicity = CTPUtil::getMult( ctpinJet->cableWord0(), triggerline.startbit(), triggerline.endbit() ); + } else if( l1menu->connector("JET2").hasLine(confThr.name()) ) { + auto & triggerline = l1menu->connector("JET2").triggerLine(confThr.name()); + multiplicity = CTPUtil::getMult( ctpinJet->cableWord1(), triggerline.startbit(), triggerline.endbit() ); + } } - } - - if (m_doZDC) { - // Get trigger input from ZDC - sc = evtStore()->retrieve( m_zdcCTP, m_zdcCTPLoc ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Couldn't retrieve input from LVL1 ZDC simulation from StoreGate"); - ATH_MSG_WARNING("Setting ZDC input to CTP to zero"); + } else { + // Run-3 threshold + const SG::ReadHandleKey< xAOD::JetRoIContainer > * rhk { nullptr }; + if( confThr.type() == ("gJ") ) { + rhk = & m_iKeyGFexJets; + } else if( confThr.name().find("jL") == 0 ) { + rhk = & m_iKeyJFexLJets; + } else if( confThr.name().find("j") == 0 ) { + rhk = & m_iKeyJFexJets; } else { - ATH_MSG_DEBUG("Retrieved input from LVL1 ZDC simulation from StoreGate"); - ATH_MSG_DEBUG("ZDC cable word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_zdcCTP->cableWord0()); + ATH_MSG_ERROR( "Unexpected threshold name " << confThr.name() << ". Should start with j, jL, g, or J."); } - } - - if (m_doNIM) { - // Get trigger input from NIM - sc = evtStore()->retrieve( m_nimCTP, m_nimCTPLoc ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Couldn't retrieve input from LVL1 NIM simulation from StoreGate"); - ATH_MSG_WARNING("Setting NIM input to CTP to zero"); - } - - else { - ATH_MSG_DEBUG("Retrieved input from LVL1 NIM simulation from StoreGate"); - - ATH_MSG_DEBUG("NIM cable word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_nimCTP->cableWord0()); - ATH_MSG_DEBUG("NIM cable word 1 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_nimCTP->cableWord1()); - ATH_MSG_DEBUG("NIM cable word 2 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_nimCTP->cableWord2()); - } - } - - if (m_doBPTX) { - // Get trigger input from BPTX - sc = evtStore()->retrieve( m_bptxCTP, m_bptxCTPLoc ); - if ( sc.isFailure() ) { - ATH_MSG_WARNING("Couldn't retrieve input from LVL1 BPTX simulation from StoreGate"); - ATH_MSG_WARNING("Setting BPTX input to CTP to zero"); - } else { - ATH_MSG_DEBUG("Retrieved input from LVL1 BPTX simulation from StoreGate"); - ATH_MSG_DEBUG("BPTX cable word 0 is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << m_bptxCTP->cableWord0()); + auto jets = SG::makeHandle( *rhk, context ); + if ( jets.isValid() ) { + auto pt = confThr.getAttribute<unsigned int>("pt"); + auto ranges = confThr.getList("ranges"); + for ( const auto & jet : *jets ) { + if( (unsigned int) (jet->et8x8()/1000.) < pt ) continue; + // calculate eta index from eta + float eta = jet->eta(); + LVL1::Coordinate coord(/*phi=*/0, eta); + LVL1::CoordToHardware converter; + unsigned int jepCoord = converter.jepCoordinateWord(coord); + uint32_t roiword = jepCoord << 19; + auto coordRange = m_jetDecoder->coordinate(roiword); + int ieta = + int((coordRange.eta() + ((coordRange.eta() > 0.01) ? 0.025 : -0.025)) / 0.1) - 1; + // Adjustment due to irregular geometries + if (ieta > 24) + ieta += 2; + // copied from + // https://acode-browser.usatlas.bnl.gov/lxr/source/athena/Trigger/TrigT1/TrigT1CaloUtils/src/JetAlgorithm.cxx#0337 + //int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1); + //int iphi = 0; // int((m_refPhi-0.005)*32/M_PI); iphi = 16*(iphi/16) + 8; + bool inRange = false; + for( auto r : ranges ) { + if( ieta >= r.getAttribute<int>("etamin") && + ieta <= r.getAttribute<int>("etamax") ) { + inRange = true; break; + } + } + if( ! inRange ) + continue; + ++multiplicity; + } } } - - //////////////////////////////////////////////////////////////////////////// - // // - // Create the CTP decision // - // // - //////////////////////////////////////////////////////////////////////////// - - // - // Zero all the multiplicities: - // - m_decisionMap->clear(); - - // - // Extract the multiplicities sent to the CTP: - // - sc = ( this->*m_extractFunction ) (); - if ( sc.isFailure() ) { - ATH_MSG_ERROR("Error in extracting threshold multiplicities"); - return sc; - } - - // - // Set up the objects for creating the decision: - // - for (InternalTriggerMap::iterator iter = m_internalTrigger.begin(); iter != m_internalTrigger.end(); ++iter) { - iter->second->print(); - //use bcid for BGRP triggers when running over data - - if((m_IsData)&&(!iter->second->name().find("BGRP"))){ - - sc = iter->second->execute((int)EventInfo::instance().bcid()); - ATH_MSG_DEBUG("Rederiving BG " << iter->second->name() << " decision for bcid " << EventInfo::instance().bcid() << ": " << ( iter->second->evaluate() ? "ACTIVE" : "INACTIVE" ) ); - - } else { - sc = iter->second->execute(); - } - - if (sc.isFailure()) { - ATH_MSG_ERROR("Error while executing internal trigger simulation " << iter->second->name()); - } + get2DHist( "/multi/jet/" + confThr.type() + "Mult" )->Fill(confThr.mapping(), multiplicity); + ATH_MSG_DEBUG("JET MULT calculated mult for threshold " << confThr.name() << " : " << multiplicity); + return multiplicity; +} - ATH_MSG_DEBUG("REGTEST - " << iter->second->print()); - } - if ((m_doRNDM)&&(m_prescaleMode == RANDOM)){ - int event = EventInfo::instance().runNumber()+1; - int run = EventInfo::instance().eventNumber()+1; - ATH_MSG_DEBUG("Random Prescale Seeds " << event << " " << run); - - m_itemMap->updatePrescaleCounters( m_decisionMap, &m_internalTrigger, m_rndmSvc->setOnDefinedSeeds(event, run, this->name()) ); - } - else { - m_itemMap->updatePrescaleCounters( m_decisionMap, &m_internalTrigger ); - } - - // - // Create the output objects: - // - m_resultBuilder = new ResultBuilder( ctpVersion, m_configSvc->ctpConfig(), m_decisionMap, m_itemMap, &m_internalTrigger, m_readoutWindow); - - collectStatistic(); - - if (m_introduceArtificialTriggerOffsets) m_resultBuilder->readOffsetConfig(m_offsetConfigFile); - - // build extended level1 ID if not set before - if (EventInfo::instance().extendedL1ID() == 0) { - EventInfo::instance().setExtendedL1ID(m_resultBuilder->extendedLevel1ID()); - } - - // build CTP output objects - const CTPSLink* roi_output = m_resultBuilder->constructRoIResult(); - const CTP_RDO* rdo_output = m_resultBuilder->constructRDOResult(); - - //////////////////////////////////////////////////////////////////////////// - // // - // Store the CTP decision // - // // - //////////////////////////////////////////////////////////////////////////// - - - if(m_IsData){ - - sc = evtStore()->record( rdo_output, m_rdoOutputLoc_Rerun ); - if( sc.isFailure() ) { - ATH_MSG_ERROR("Couldn't store CTP_RDO_Rerun object in StoreGate with key: " << m_rdoOutputLoc_Rerun); - return sc; +unsigned int +LVL1CTP::CTPSimulation::calculateJetMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const { + unsigned int multiplicity = 0; + if( confThr->name().find("J") == 0 ) { + auto ctpinJet = SG::makeHandle( m_iKeyCtpinJet, context ); + if ( ctpinJet.isValid() ) { + if ( confThr->cableName() == "JEP1" || confThr->cableName() == "JET1" ) { + multiplicity = CTPUtil::getMult( ctpinJet->cableWord0(), confThr->cableStart(), confThr->cableEnd() ); + } else if ( confThr->cableName() == "JEP2" || confThr->cableName() == "JET2" ) { + multiplicity = CTPUtil::getMult( ctpinJet->cableWord1(), confThr->cableStart(), confThr->cableEnd() ); + } } - else { - ATH_MSG_DEBUG("Stored CTP_RDO_Rerun object in StoreGate with key: " << m_rdoOutputLoc_Rerun); - ATH_MSG_DEBUG("Dump CTP_RDO_Rerun object: " << rdo_output->dump()); + } else { + // Run-3 threshold + const SG::ReadHandleKey< xAOD::JetRoIContainer > * rhk { nullptr }; + if( confThr->name().find("g") == 0 ) { + rhk = & m_iKeyGFexJets; + } else if( confThr->name().find("jL") == 0 ) { + rhk = & m_iKeyJFexLJets; + } else if( confThr->name().find("j") == 0 ) { + rhk = & m_iKeyJFexJets; + } else { + ATH_MSG_ERROR( "Unexpected threshold name " << confThr->name() << ". Should start with j, jL, g, or J."); } - - sc = evtStore()->record( roi_output, m_roiOutputLoc_Rerun ); - if( sc.isFailure() ) { - ATH_MSG_ERROR("Couldn't store CTPSLink_Rerun object in StoreGate with key " << m_roiOutputLoc_Rerun); - return sc; - } - else { - ATH_MSG_DEBUG("Stored CTPSLink_Rerun object in StoreGate with key: " << m_roiOutputLoc_Rerun); - ATH_MSG_DEBUG("Dump CTPSLink_Rerun object: " << roi_output->dump()); + auto jets = SG::makeHandle( *rhk, context ); + if ( jets.isValid() ) { + for ( const auto & jet : *jets ) { + float eta = jet->eta(); + float phi = jet->phi(); + if ( phi < 0 ) phi += 2*M_PI; + if ( phi >= 2*M_PI ) phi -= 2*M_PI; + LVL1::Coordinate coord(phi, eta); + LVL1::CoordToHardware converter; + unsigned int jepCoord = converter.jepCoordinateWord(coord); + uint32_t roiword = jepCoord << 19; + auto coordRange = m_jetDecoder->coordinate(roiword); + int ieta = + int((coordRange.eta() + ((coordRange.eta() > 0.01) ? 0.025 : -0.025)) / 0.1) - 1; + // Adjustment due to irregular geometries + if (ieta > 24) + ieta += 2; + int iphi = int((coordRange.phiRange().min() + 0.025) * 32 / M_PI); + // copied from + // https://acode-browser.usatlas.bnl.gov/lxr/source/athena/Trigger/TrigT1/TrigT1CaloUtils/src/JetAlgorithm.cxx#0337 + //int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1); + //int iphi = 0; // int((m_refPhi-0.005)*32/M_PI); iphi = 16*(iphi/16) + 8; + bool pass = ((unsigned int) (jet->et8x8()/1000.)) > confThr->triggerThresholdValue( ieta, iphi )->ptcut(); + multiplicity += pass ? 1 : 0; + } } } - - else if(!m_IsData){ //if this is MC - - sc = evtStore()->record( rdo_output, m_rdoOutputLoc ); - if( sc.isFailure() ) { - ATH_MSG_ERROR("Couldn't store CTP_RDO object in StoreGate with key: " << m_rdoOutputLoc); - return sc; - } - else { - ATH_MSG_DEBUG("Stored CTP_RDO object in StoreGate with key: " << m_rdoOutputLoc); - ATH_MSG_DEBUG("Dump CTP_RDO object: " << rdo_output->dump()); - } - - sc = evtStore()->record( roi_output, m_roiOutputLoc ); - if( sc.isFailure() ) { - ATH_MSG_ERROR("Couldn't store CTPSLink object in StoreGate with key " << m_roiOutputLoc); - return sc; - } - else { - ATH_MSG_DEBUG("Stored CTPSLink object in StoreGate with key: " << m_roiOutputLoc); - ATH_MSG_DEBUG("Dump CTPSLink object: " << roi_output->dump()); - } - - //////////////////////////////////////////////////////////////////////////// - // // - // Update TriggerInfo in EventInfo object (SG) (only for MC) // - // // - //////////////////////////////////////////////////////////////////////////// - - // get EventInfo - const ::EventInfo* constEventInfo(0); - sc = evtStore()->retrieve(constEventInfo); - if (sc.isFailure()) { - ATH_MSG_FATAL("Can't get EventInfo object for update of TriggerInfo (LVL1 part)"); - return sc; - } - - ATH_MSG_DEBUG("Updating TriggerInfo of EventInfo object"); - - ::EventInfo* updateEventInfo = const_cast< ::EventInfo* >(constEventInfo); - TriggerInfo* triggerInfo = updateEventInfo->trigger_info(); - - // update the TriggerInfo part related to LVL1 - uint32_t lvl1Id = 0; - uint32_t lvl1Type = 0; - std::vector<uint32_t> lvl1Info; - - if ( triggerInfo != 0 ) { // get old information - lvl1Id = triggerInfo->extendedLevel1ID(); - lvl1Type = triggerInfo->level1TriggerType(); - lvl1Info = triggerInfo->level1TriggerInfo(); - - ATH_MSG_DEBUG("Saved old TriggerInfo: " << *triggerInfo); - } - - else { // create trigger info - triggerInfo = new TriggerInfo(); - updateEventInfo->setTriggerInfo(triggerInfo); - - ATH_MSG_DEBUG("Created new TriggerInfo"); - } - - // maybe overwrite extended lvl1 id - if (lvl1Id == 0) { - lvl1Id = m_resultBuilder->extendedLevel1ID(); - ATH_MSG_DEBUG("Updated extendedLevel1ID: " << lvl1Id); - } - - // overwrite trigger type - lvl1Type = m_resultBuilder->triggerType(); - ATH_MSG_DEBUG("Updated level1TriggerType: " << lvl1Type); - - // overwrite lvl1 trigger result - lvl1Info = m_resultBuilder->tbp(); - for (size_t i(0); i < m_resultBuilder->tap().size(); ++i) { - lvl1Info.push_back(m_resultBuilder->tap()[i]); // TAP + get2DHist( "/multi/jet/jetMult" )->Fill(confThr->mapping(), multiplicity); + ATH_MSG_DEBUG("JET MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); + return multiplicity; +} + + +unsigned int +LVL1CTP::CTPSimulation::calculateEMMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const { + unsigned int multiplicity (0); + if ( confThr.name()[0]=='e' ) { + // new EM threshold from eFEX + float scale = l1menu->getObject("thresholds.legacyCalo.EM.emscale").getValue<float>(); + auto eFexCluster = SG::makeHandle( m_iKeyEFexCluster, context ); + for ( const auto & cl : *eFexCluster ) { + float eta = cl->eta(); + int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1); + TrigConf::DataStructure thrV = confThr.thresholdValue( ieta ); + bool clusterPasses = ( ((unsigned int) cl->et()) > thrV.getAttribute<unsigned int>("et")*scale ); // need to add cut on isolation and other variables, once available + multiplicity += clusterPasses ? 1 : 0; } - for (size_t i(0); i < m_resultBuilder->tav().size(); ++i) { - lvl1Info.push_back(m_resultBuilder->tav()[i]); // TAV + } else { + // old EM threshold from data + auto ctpinEM = SG::makeHandle( m_iKeyCtpinEM, context ); + if ( ctpinEM.isValid() ) { + if( l1menu->connector("EM1").hasLine(confThr.name()) ) { + auto & triggerline = l1menu->connector("EM1").triggerLine(confThr.name()); + multiplicity = CTPUtil::getMult( ctpinEM->cableWord0(), triggerline.startbit(), triggerline.endbit() ); + } else if( l1menu->connector("EM2").hasLine(confThr.name()) ) { + auto & triggerline = l1menu->connector("EM2").triggerLine(confThr.name()); + multiplicity = CTPUtil::getMult( ctpinEM->cableWord1(), triggerline.startbit(), triggerline.endbit() ); + } } - - ATH_MSG_DEBUG("Updated level1TriggerInfo: " << CTPUtil::printHex(lvl1Info)); - - // store updated information in TriggerInfo/EventInfo - triggerInfo->setExtendedLevel1ID(lvl1Id); - triggerInfo->setLevel1TriggerType(lvl1Type); - triggerInfo->setLevel1TriggerInfo(lvl1Info); - - ATH_MSG_DEBUG("Updated TriggerInfo attached to EventInfo: " - << *updateEventInfo->trigger_info()); - } - - // - // do monitoring - // - ToolHandleArray<IMonitorToolBase>::iterator it; - for ( it = m_monitors.begin(); it != m_monitors.end(); ++it ) { - if (!(*it)->preSelector()) (*it)->fillHists().ignore(); } - - if (m_resultBuilder) { delete m_resultBuilder; m_resultBuilder = 0;} - - return StatusCode::SUCCESS; + get2DHist( "/multi/em/" + confThr.type() + "Mult" )->Fill(confThr.mapping(), multiplicity); + ATH_MSG_DEBUG("EM MULT calculated mult for threshold " << confThr.name() << " : " << multiplicity); + return multiplicity; } -StatusCode -LVL1CTP::CTPSimulation::extractMultiplicities() { - - - auto muctpiCTP = SG::makeHandle(m_muctpiInputKey); - - for ( TrigConf::TriggerThreshold* thr : m_configSvc->ctpConfig()->menu().thresholdVector() ) { - - int multiplicity = 0; - - if ( thr->cableName() == "" ) { - ATH_MSG_DEBUG("No cable name for what must be an internal threshold " << thr->name()); - continue; - } - if ( thr->ttype() == L1DataDef::ZB ) { - ATH_MSG_DEBUG("No simulation of zero bias triggers, ignoring " << thr->name()); - continue; +unsigned int +LVL1CTP::CTPSimulation::calculateEMMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const { + unsigned int multiplicity (0); + if ( confThr->name()[0]=='e' ) { + // new EM threshold from eFEX + auto eFexCluster = SG::makeHandle( m_iKeyEFexCluster, context ); + for ( const auto & cl : *eFexCluster ) { + float eta = cl->eta(); + int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1); + int iphi = 0; + const TrigConf::TriggerThresholdValue * thrV = confThr->triggerThresholdValue( ieta, iphi ); + const ClusterThresholdValue *ctv = dynamic_cast<const ClusterThresholdValue *>(thrV); + float scale = ctv->caloInfo().globalEmScale(); + bool clusterPasses = ( ((unsigned int) cl->et()) > thrV->ptcut()*scale ); // need to add cut on isolation and other variables, once available + multiplicity += clusterPasses ? 1 : 0; } - - if ( thr->cableName() == "MU" || thr->cableName() == "MUCTPI" ) { - - if ( muctpiCTP.isValid() ) { - multiplicity = CTPUtil::getMult( muctpiCTP->muCTPIWord(), thr->cableStart(), thr->cableEnd() ); - for(int x=0; x<=multiplicity; x++) - m_thrMUMult->AddBinContent(1+ 8 * thr->mapping() + x); - m_thrMUTot->AddBinContent(1+ thr->mapping(), multiplicity); - } - - } - - else if ( thr->cableName() == "CP1" ) { - - if ( m_emtauCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_emtauCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - } - - } - - else if ( thr->cableName() == "CP2" ) { - - if ( m_emtauCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_emtauCTP->cableWord1(), thr->cableStart(), thr->cableEnd() ); - } - - } - - else if ( thr->cableName() == "EM1" ) { - if ( m_emtauCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_emtauCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - for(int x=0; x<=multiplicity; x++) - m_thrEMMult->AddBinContent(1+ 8 * thr->mapping() + x); - m_thrEMTot->AddBinContent(1+ thr->mapping(), multiplicity); + } else { + // old EM threshold from data + auto ctpinEM = SG::makeHandle( m_iKeyCtpinEM, context ); + if ( ctpinEM.isValid() ) { + if ( confThr->cableName() == "CP1" || confThr->cableName() == "EM1" ) { + multiplicity = CTPUtil::getMult( ctpinEM->cableWord0(), confThr->cableStart(), confThr->cableEnd() ); + } else if ( confThr->cableName() == "CP2" || confThr->cableName() == "EM2" ) { + multiplicity = CTPUtil::getMult( ctpinEM->cableWord1(), confThr->cableStart(), confThr->cableEnd() ); } } + } + get2DHist( "/multi/em/emMult" )->Fill(confThr->mapping(), multiplicity); + ATH_MSG_DEBUG("EM MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); + return multiplicity; +} - else if ( thr->cableName() == "EM2" ) { - if ( m_emtauCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_emtauCTP->cableWord1(), thr->cableStart(), thr->cableEnd() ); - for(int x=0; x<=multiplicity; x++) - m_thrEMMult->AddBinContent(1+ 8 * thr->mapping() + x); - m_thrEMTot->AddBinContent(1+ thr->mapping(), multiplicity); - } - } - else if ( thr->cableName() == "TAU1" ) { - if ( m_emtauCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_emtauCTP->cableWord2(), thr->cableStart(), thr->cableEnd() ); - for(int x=0; x<=multiplicity; x++) - m_thrHAMult->AddBinContent(1+ 8 * thr->mapping() + x); - m_thrHATot->AddBinContent(1+ thr->mapping(), multiplicity); +unsigned int +LVL1CTP::CTPSimulation::calculateTauMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const { + unsigned int multiplicity = 0; + if ( confThr.name()[0]=='e' ) { + // new TAU threshold from eFEX + auto eFexTaus = SG::makeHandle( m_iKeyEFexTau, context ); + const static SG::AuxElement::ConstAccessor<float> accR3ClET ("R3ClusterET"); + const static SG::AuxElement::ConstAccessor<float> accR3ClIso ("R3ClusterIso"); + if( eFexTaus.isValid() ) { + for ( const auto & tau : *eFexTaus ) { + unsigned int eT = (unsigned int) (accR3ClET(*tau)/1000.); // tau eT is in MeV while the cut is in GeV - this is only temporary and needs to be made consistent for all L1Calo + //float iso = accR3ClIso(*tau); + unsigned int etCut = confThr.data().get_child("et").get_value<unsigned int>(); + bool tauPasses = ( eT >= etCut ); // need to add cut on isolation and other variables, once available + multiplicity += tauPasses ? 1 : 0; } } - - else if ( thr->cableName() == "TAU2" ) { - if ( m_emtauCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_emtauCTP->cableWord3(), thr->cableStart(), thr->cableEnd() ); - for(int x=0; x<=multiplicity; x++) - m_thrHAMult->AddBinContent(1+ 8 * thr->mapping() + x); - m_thrHATot->AddBinContent(1+ thr->mapping(), multiplicity); + } else { + // old TAU threshold + auto ctpinEM = SG::makeHandle( m_iKeyCtpinEM, context ); + if ( ctpinEM.isValid() ) { + if( l1menu->connector("TAU1").hasLine(confThr.name()) ) { + auto & triggerline = l1menu->connector("TAU1").triggerLine(confThr.name()); + multiplicity = CTPUtil::getMult( ctpinEM->cableWord2(), triggerline.startbit(), triggerline.endbit() ); + } else if( l1menu->connector("TAU2").hasLine(confThr.name()) ) { + auto & triggerline = l1menu->connector("TAU2").triggerLine(confThr.name()); + multiplicity = CTPUtil::getMult( ctpinEM->cableWord3(), triggerline.startbit(), triggerline.endbit() ); } } + } + get2DHist( "/multi/tau/" + confThr.type() + "Mult" )->Fill(confThr.mapping(), multiplicity); + ATH_MSG_DEBUG("TAU MULT calculated mult for threshold " << confThr.name() << " : " << multiplicity); + return multiplicity; +} - - else if ( thr->cableName() == "JEP1" || thr->cableName() == "JET1" ) { - - if ( m_jetCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_jetCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - for(int x=0; x<=multiplicity; x++) - m_thrJET1Mult->AddBinContent(1+ 8 * thr->mapping() + x); - m_thrJETTot->AddBinContent(1+ thr->mapping(), multiplicity); - } - - } - - else if ( thr->cableName() == "JEP2" || thr->cableName() == "JET2" ) { - - if ( m_jetCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_jetCTP->cableWord1(), thr->cableStart(), thr->cableEnd() ); - for(int x=0; x<=multiplicity; x++) - m_thrJET2Mult->AddBinContent(1+ 4 * (thr->mapping()-10) + x); - m_thrJETTot->AddBinContent(1+ thr->mapping(), multiplicity); - } - - } - - else if ( thr->cableName() == "JEP3" || thr->cableName() == "EN1") { - if ( m_energyCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_energyCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - - TH1I * hMult(0), * hTot(0); - switch(thr->ttype()) { - case L1DataDef::TE: - hMult = m_thrTEMult; hTot = m_thrTETot; break; - case L1DataDef::XE: - hMult = m_thrXEMult; hTot = m_thrXETot; break; - case L1DataDef::XS: - hMult = m_thrXSMult; hTot = m_thrXSTot; break; - default: - break; - } - if(hMult) { - for(int x=0; x<=multiplicity; x++) - hMult->AddBinContent(1+ 2 * thr->mapping() + x); - hTot->AddBinContent(1+ thr->mapping(), multiplicity); - } - } - } - - else if ( thr->cableName() == "EN2") { - if ( m_energyCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_energyCTP->cableWord1(), thr->cableStart(), thr->cableEnd() ); - - TH1I * hMult(0), * hTot(0); - switch(thr->ttype()) { - case L1DataDef::TE: - hMult = m_thrTEMult; hTot = m_thrTETot; break; - case L1DataDef::XE: - hMult = m_thrXEMult; hTot = m_thrXETot; break; - default: - break; - } - if(hMult) { - for(int x=0; x<=multiplicity; x++) - hMult->AddBinContent(1+ 2 * thr->mapping() + x); - hTot->AddBinContent(1+ thr->mapping(), multiplicity); - } - } - } - - else if ( thr->cableName() == "NIM1" ) { - if ( thr->type() == TrigConf::L1DataDef::mbtsType() || - thr->type() == TrigConf::L1DataDef::mbtssiType() ) { - // Don't know what to do in place of string matching - int n_a=thr->name().find("MBTS_A"); - if (m_mbtsACTP.isValid() && n_a==0) { - multiplicity = CTPUtil::getMult( m_mbtsACTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - //ATH_MSG_DEBUG("Extracted multi is: "<< multiplicity); - } +unsigned int +LVL1CTP::CTPSimulation::calculateTauMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const { + unsigned int multiplicity = 0; + if ( confThr->name()[0]=='e' ) { + // new TAU threshold from eFEX + auto eFexTaus = SG::makeHandle( m_iKeyEFexTau, context ); + const static SG::AuxElement::ConstAccessor<float> accR3ClET ("R3ClusterET"); + const static SG::AuxElement::ConstAccessor<float> accR3ClIso ("R3ClusterIso"); + if( eFexTaus.isValid() ) { + for ( const auto & tau : *eFexTaus ) { + unsigned int eT = (unsigned int) (accR3ClET(*tau)/1000.); // tau eT is in MeV while the cut is in GeV - this is only temporary and needs to be made consistent for all L1Calo + //float iso = accR3ClIso(*tau); + float eta = tau->eta(); + int ieta = int((eta + (eta>0 ? 0.005 : -0.005))/0.1); + int iphi = 0; + const TrigConf::TriggerThresholdValue * thrV = confThr->triggerThresholdValue( ieta, iphi ); + bool tauPasses = ( eT >= thrV->ptcut() ); // need to add cut on isolation and other variables, once available + multiplicity += tauPasses ? 1 : 0; } - - - } - - else if ( thr->cableName() == "NIM2" ) { - - if ( thr->type() == TrigConf::L1DataDef::mbtsType() || - thr->type() == TrigConf::L1DataDef::mbtssiType() ) { - // Don't know what to do in place of string matching - int n_c=thr->name().find("MBTS_C"); - if (m_mbtsCCTP.isValid() && n_c==0) { - multiplicity = CTPUtil::getMult( m_mbtsCCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - //ATH_MSG_DEBUG("Extracted multi is: "<< multiplicity); - } + } + } else { + // old TAU threshold + auto ctpinEM = SG::makeHandle( m_iKeyCtpinEM, context ); + if ( ctpinEM.isValid() ) { + if ( confThr->cableName() == "TAU1" ) { + multiplicity = CTPUtil::getMult( ctpinEM->cableWord2(), confThr->cableStart(), confThr->cableEnd() ); + } else if ( confThr->cableName() == "TAU2" ) { + multiplicity = CTPUtil::getMult( ctpinEM->cableWord3(), confThr->cableStart(), confThr->cableEnd() ); } - - } - - //Is there a better way to deal with overclocking at front panel? - else if ( thr->cableName() == "TOPO1" ) { + } + } + get2DHist( "/multi/tau/tauMult" )->Fill(confThr->mapping(), multiplicity); + ATH_MSG_DEBUG("TAU MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); + return multiplicity; +} - if ( m_topoCTP.isValid() ) { - uint64_t topoCable1 = m_topoCTP->cableWord1( 1 ); - topoCable1 <<= 32; - topoCable1 += m_topoCTP->cableWord1( 0 ); - ATH_MSG_DEBUG( " ---> Topo input " << dec << thr->name() << " on module TOPO1 with clock " << thr->clock() - << ", cable start " << thr->cableStart() << " and end " << thr->cableEnd() - << " double word 0x" << setw(16) << setfill('0') << hex << topoCable1 << dec << setfill(' ') - ); - multiplicity = CTPUtil::getMultTopo( topoCable1, thr->cableStart(), thr->cableEnd(), thr->clock() ); +unsigned int +LVL1CTP::CTPSimulation::calculateMETMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const { + unsigned int multiplicity = 0; + if ( confThr.type() == "XE" or confThr.type() == "TE" or confThr.type() == "XS" ) { + // old XE, TE, XS + auto ctpinEnergy = SG::makeHandle( m_iKeyCtpinXE, context ); + if ( ctpinEnergy.isValid() ) { + if( l1menu->connector("EN1").hasLine(confThr.name()) ) { + auto & triggerline = l1menu->connector("EN1").triggerLine(confThr.name()); + multiplicity = CTPUtil::getMult( ctpinEnergy->cableWord0(), triggerline.startbit(), triggerline.endbit() ); + } else if( l1menu->connector("EN2").hasLine(confThr.name()) ) { + auto & triggerline = l1menu->connector("EN2").triggerLine(confThr.name()); + multiplicity = CTPUtil::getMult( ctpinEnergy->cableWord1(), triggerline.startbit(), triggerline.endbit() ); } + } + } else { + // new XE + const SG::ReadHandleKey< xAOD::EnergySumRoI > * rhk { nullptr }; + if ( confThr.name().find("gXEPUFIT")==0 ) { + rhk = & m_iKeyGFexMETPufit; + ATH_MSG_DEBUG("Using Pufit input for threshold " << confThr.name() ); + } else if ( confThr.name().find("gXERHO")==0 ) { + rhk = & m_iKeyGFexMETRho; + ATH_MSG_DEBUG("Using Rho input for threshold " << confThr.name() ); + } else if ( confThr.name().find("gXEJWOJ")==0 ) { + rhk = & m_iKeyGFexMETJwoJ; + ATH_MSG_DEBUG("Using JwoJ input for threshold " << confThr.name() ); + } else { + rhk = & m_iKeyGFexMETJwoJ; + ATH_MSG_DEBUG("Using default input JwoJ for threshold " << confThr.name() ); + } + auto met = SG::makeHandle( *rhk, context ); + multiplicity = ( met->energyT()/1000. < confThr.getAttribute<unsigned int>("xe") ) ? 0 : 1; // energyT value is in MeV, cut in GeV + } + if(confThr.type() == "TE") { + get2DHist( "/multi/te/" + confThr.type() + "Mult" )->Fill(confThr.mapping(), multiplicity); + ATH_MSG_DEBUG("TE MULT calculated mult for threshold " << confThr.name() << " : " << multiplicity); + } else if(confThr.type() == "XS") { + get2DHist( "/multi/xs/" + confThr.type() + "Mult" )->Fill(confThr.mapping(), multiplicity); + ATH_MSG_DEBUG("XS MULT calculated mult for threshold " << confThr.name() << " : " << multiplicity); + } else { + get2DHist( "/multi/xe/" + confThr.type() + "Mult" )->Fill(confThr.mapping(), multiplicity); + ATH_MSG_DEBUG("XE MULT calculated mult for threshold " << confThr.name() << " : " << multiplicity); + } + return multiplicity; +} - } - - else if ( thr->cableName() == "TOPO2" ) { - - if ( m_topoCTP.isValid() ) { - uint64_t topoCable2 = m_topoCTP->cableWord2( 1 ); - topoCable2 <<= 32; - topoCable2 += m_topoCTP->cableWord2( 0 ); - ATH_MSG_DEBUG( " ---> Topo input " << dec << thr->name() << " on module TOPO2 with clock " << thr->clock() - << ", cable start " << thr->cableStart() << " and end " << thr->cableEnd() - << " double word 0x" << setw(16) << setfill('0') << hex << topoCable2 << dec << setfill(' ') - ); +unsigned int +LVL1CTP::CTPSimulation::calculateMETMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const { + unsigned int multiplicity = 0; + if ( confThr->name().find("XE")==0 ) { + // old XE + auto ctpinEnergy = SG::makeHandle( m_iKeyCtpinXE, context ); + if ( ctpinEnergy.isValid() ) { + if ( confThr->cableName() == "JEP3" || confThr->cableName() == "EN1") { + multiplicity = CTPUtil::getMult( ctpinEnergy->cableWord0(), confThr->cableStart(), confThr->cableEnd() ); + } else if ( confThr->cableName() == "EN2") { + multiplicity = CTPUtil::getMult( ctpinEnergy->cableWord1(), confThr->cableStart(), confThr->cableEnd() ); + } + } + } else if ( confThr->name().find("TE")==0 ) { + // old TE + auto ctpinEnergy = SG::makeHandle( m_iKeyCtpinXE, context ); + if ( ctpinEnergy.isValid() ) { + if ( confThr->cableName() == "JEP3" || confThr->cableName() == "EN1") { + multiplicity = CTPUtil::getMult( ctpinEnergy->cableWord0(), confThr->cableStart(), confThr->cableEnd() ); + } else if ( confThr->cableName() == "EN2") { + multiplicity = CTPUtil::getMult( ctpinEnergy->cableWord1(), confThr->cableStart(), confThr->cableEnd() ); + } + } + } else if ( confThr->name().find("XS")==0 ) { + // old XS + auto ctpinEnergy = SG::makeHandle( m_iKeyCtpinXE, context ); + if ( ctpinEnergy.isValid() ) { + if ( confThr->cableName() == "EN1" ) { + multiplicity = CTPUtil::getMult( ctpinEnergy->cableWord0(), confThr->cableStart(), confThr->cableEnd() ); + } + } + } else { + // new XE + const SG::ReadHandleKey< xAOD::EnergySumRoI > * rhk { nullptr }; + if ( confThr->name().find("gXEPUFIT")==0 ) { + rhk = & m_iKeyGFexMETPufit; + ATH_MSG_DEBUG("Using Pufit input for threshold " << confThr->name() ); + } else if ( confThr->name().find("gXERHO")==0 ) { + rhk = & m_iKeyGFexMETRho; + ATH_MSG_DEBUG("Using Rho input for threshold " << confThr->name() ); + } else if ( confThr->name().find("gXEJWOJ")==0 ) { + rhk = & m_iKeyGFexMETJwoJ; + ATH_MSG_DEBUG("Using JwoJ input for threshold " << confThr->name() ); + } else { + rhk = & m_iKeyGFexMETJwoJ; + ATH_MSG_DEBUG("Using default input JwoJ for threshold " << confThr->name() ); + } + auto met = SG::makeHandle( *rhk, context ); + multiplicity = ( met->energyT()/1000. < confThr->thresholdValueVector()[0]->ptcut() ) ? 0 : 1; // energyT value is in MeV, cut in GeV + } + if ( confThr->name().find("TE")==0 ) { + get2DHist( "/multi/te/teMult" )->Fill(confThr->mapping(), multiplicity); + } else if ( confThr->name().find("XE")==0 ) { + get2DHist( "/multi/xe/xeMult" )->Fill(confThr->mapping(), multiplicity); + } else { + get2DHist( "/multi/xs/xsMult" )->Fill(confThr->mapping(), multiplicity); + } + ATH_MSG_DEBUG("XE/TE/XS MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); + return multiplicity; +} - multiplicity = CTPUtil::getMultTopo( topoCable2, thr->cableStart(), thr->cableEnd(), thr->clock() ); - } - } +unsigned int +LVL1CTP::CTPSimulation::calculateMuonMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const { + unsigned int multiplicity = 0; + auto ctpinMuon = SG::makeHandle( m_iKeyMuctpi, context ); + if ( ctpinMuon.isValid() ) { + auto & triggerline = l1menu->connector("MuCTPiOpt0").triggerLine(confThr.name()); + multiplicity = CTPUtil::getMult( ctpinMuon->muCTPIWord(), triggerline.startbit(), triggerline.endbit() ); + } + get2DHist( "/multi/muon/" + confThr.type() + "Mult" )->Fill(confThr.mapping(), multiplicity); + ATH_MSG_DEBUG("MU MULT calculated mult for threshold " << confThr.name() << " : " << multiplicity); + return multiplicity; +} - else if ( thr->cableName() == "ALFA" ) { - if ( m_topoCTP.isValid() ) { - ATH_MSG_DEBUG( " ---> ALFA input " << dec << thr->name() << " on module ALFA with clock " << thr->clock() << ", cable start " - << thr->cableStart() << " and end " << thr->cableEnd() << " word 0x" << setw(8) << setfill('0') << hex << m_topoCTP->cableWord0( thr->clock() ) << dec << setfill(' ') - ); - uint64_t alfaCable = m_topoCTP->cableWord0( 1 ); - alfaCable <<= 32; - alfaCable += m_topoCTP->cableWord0( 0 ); +unsigned int +LVL1CTP::CTPSimulation::calculateMuonMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const { + unsigned int multiplicity = 0; + auto ctpinMuon = SG::makeHandle( m_iKeyMuctpi, context ); + if ( ctpinMuon.isValid() ) { + multiplicity = CTPUtil::getMult( ctpinMuon->muCTPIWord(), confThr->cableStart(), confThr->cableEnd() ); + } + get2DHist( "/multi/muon/muonMult" )->Fill(confThr->mapping(), multiplicity); + ATH_MSG_DEBUG("MU MULT calculated mult for threshold " << confThr->name() << " : " << multiplicity); + return multiplicity; +} -// unsigned int counter = 2*thr->cableStart() + thr->clock(); -// multiplicity = CTPUtil::getMult( alfaCable, counter, counter ); - multiplicity = CTPUtil::getMultTopo( alfaCable, thr->cableStart(), thr->cableEnd(), thr->clock() ); - } +unsigned int +LVL1CTP::CTPSimulation::calculateTopoMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const { + unsigned int multiplicity = 0; + // topo + auto topoInput = SG::makeHandle( m_iKeyTopo, context ); + if(topoInput.isValid()) { + uint64_t cable = 0; + std::string conn(""); + if( l1menu->connector("LegacyTopo0").hasLine(confThr.name()) ) { + conn = "LegacyTopo0"; + cable = ( (uint64_t)topoInput->cableWord1( 1 ) << 32) + topoInput->cableWord1( 0 ); + } else if( l1menu->connector("LegacyTopo1").hasLine(confThr.name()) ) { + conn = "LegacyTopo1"; + cable = ( (uint64_t)topoInput->cableWord2( 1 ) << 32) + topoInput->cableWord2( 0 ); + } + if(conn != "") { + auto & triggerline = l1menu->connector(conn).triggerLine(confThr.name()); + ATH_MSG_DEBUG( " ---> Topo input " << confThr.name() << " on module " << conn + << ", cable start " << triggerline.startbit() << " and end " << triggerline.endbit() + << " double word 0x" << std::setw(16) << std::setfill('0') << std::hex << cable << std::dec << std::setfill(' ') ); + multiplicity = CTPUtil::getMultTopo( cable, triggerline.startbit(), triggerline.endbit(), triggerline.clock() ); + } + } + return multiplicity; +} - } - else if ( thr->ttype() == TrigConf::L1DataDef::BCM ) { - - if ( m_bcmCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_bcmCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - } +unsigned int +LVL1CTP::CTPSimulation::calculateTopoMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const { + unsigned int multiplicity = 0; + // topo + auto topoInput = SG::makeHandle( m_iKeyTopo, context ); + if(topoInput.isValid()) { + uint64_t cable = 0; + if ( confThr->cableName() == "TOPO1" ) { + cable = ( (uint64_t)topoInput->cableWord1( 1 ) << 32) + topoInput->cableWord1( 0 ); + } else { + cable = ( (uint64_t)topoInput->cableWord2( 1 ) << 32) + topoInput->cableWord2( 0 ); } + ATH_MSG_DEBUG( " ---> Topo input " << confThr->name() << " on module " << confThr->cableName() << " with clock " << confThr->clock() + << ", cable start " << confThr->cableStart() << " and end " << confThr->cableEnd() + << " double word 0x" << std::setw(16) << std::setfill('0') << std::hex << cable << std::dec << std::setfill(' ') ); + multiplicity = CTPUtil::getMultTopo( cable, confThr->cableStart(), confThr->cableEnd(), confThr->clock() ); + } + return multiplicity; +} - else if ( thr->ttype() == TrigConf::L1DataDef::LUCID ) { - - if ( m_lucidCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_lucidCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - } - } - else if ( thr->ttype() == TrigConf::L1DataDef::BPTX ) { +unsigned int +LVL1CTP::CTPSimulation::calculateMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const { + unsigned int multiplicity = 0; + if( confThr->cableName() == "CTPCAL" || + confThr->cableName() == "ALFA" || + confThr->cableName() == "NIM1" || + confThr->cableName() == "NIM2" || + confThr->type() == "NIM") { + return 0; + } + // here we need to write specific code for the different types of L1 FEX objects + if ( confThr->ttype() == TrigConf::L1DataDef::EM ) { + multiplicity = calculateEMMultiplicity( confThr, context ); + } else if ( confThr->ttype() == TrigConf::L1DataDef::TAU ) { + multiplicity = calculateTauMultiplicity( confThr, context ); + } else if ( confThr->ttype() == TrigConf::L1DataDef::XE || + confThr->ttype() == TrigConf::L1DataDef::TE || + confThr->ttype() == TrigConf::L1DataDef::XS ) { + multiplicity = calculateMETMultiplicity( confThr, context ); + } else if ( confThr->ttype() == TrigConf::L1DataDef::JET ) { + multiplicity = calculateJetMultiplicity( confThr, context ); + } else if ( confThr->ttype() == TrigConf::L1DataDef::MUON ) { + multiplicity = calculateMuonMultiplicity( confThr, context ); + } else if ( confThr->ttype() == TrigConf::L1DataDef::TOPO ) { + multiplicity = calculateTopoMultiplicity( confThr, context ); + } + return multiplicity; +} - if ( m_bptxCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_bptxCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - } - +unsigned int +LVL1CTP::CTPSimulation::calculateMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const { + unsigned int multiplicity = 0; + try { + if ( confThr.type() == "EM" ) { + multiplicity = calculateEMMultiplicity( confThr, l1menu, context ); + } else if ( confThr.type() == "TAU" ) { + multiplicity = calculateTauMultiplicity( confThr, l1menu, context ); + } else if ( confThr.type() == "XE" || confThr.type() == "TE" || confThr.type() == "XS" ) { + multiplicity = calculateMETMultiplicity( confThr, l1menu, context ); + } else if ( confThr.type() == "JET" ) { + multiplicity = calculateJetMultiplicity( confThr, l1menu, context ); + } else if ( confThr.type() == "MU" ) { + multiplicity = calculateMuonMultiplicity( confThr, l1menu, context ); + } else if ( confThr.type() == "TOPO" ) { + multiplicity = calculateTopoMultiplicity( confThr, l1menu, context ); } + } + catch(std::exception & ex) { + ATH_MSG_FATAL("Caught exception when calculating multiplicity for threshold " << confThr.name() << ": " << ex.what()); + throw; + } + // all other thresholds are not simulated + return multiplicity; +} - else if ( thr->ttype() == TrigConf::L1DataDef::BCMCMB ) { - - if ( m_bcmCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_bcmCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - } - } - - else if ( thr->ttype() == TrigConf::L1DataDef::ZDC ) { - - if ( m_zdcCTP.isValid() ) { - multiplicity = CTPUtil::getMult( m_zdcCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - } - } +StatusCode +LVL1CTP::CTPSimulation::simulateItems(const std::map<std::string, unsigned int> & thrMultiMap, + const EventContext& context) const +{ - else if ( thr->ttype() == TrigConf::L1DataDef::CALREQ ) { - - ATH_MSG_DEBUG("The CALREQ type is ignored offline"); - multiplicity = 0; - } - - else if ( thr->cableName() == "CTPCAL" ) { - // should not get here - ATH_MSG_WARNING("Cable CTPCAL has threshold " << thr->name() << " of type " << thr->ttype() << " which is not handled by the CTP simulation"); - } - - else if ( thr->type() == TrigConf::L1DataDef::mbtsType() ) { - // Don't know what to do in place of string matching - int n_a=thr->name().find("MBTS_A"); - int n_c=thr->name().find("MBTS_C"); - if (m_mbtsACTP.isValid() && n_a==0) { - multiplicity = CTPUtil::getMult( m_mbtsACTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - //ATH_MSG_DEBUG("Extracted multi is: "<< multiplicity); - } - if (m_mbtsCCTP.isValid() && n_c==0) { - multiplicity = CTPUtil::getMult( m_mbtsCCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - //ATH_MSG_DEBUG("Extracted multi is: "<< multiplicity); + std::vector<uint32_t> tip; + CHECK( m_resultBuilder->constructTIPVector( thrMultiMap, tip ) ); + + std::map<std::string, unsigned int> itemDecisionMap; + CHECK( m_resultBuilder->buildItemDecision(thrMultiMap, itemDecisionMap) ); + + std::vector<uint32_t> tbp; + std::vector<uint32_t> tap; + std::vector<uint32_t> tav; + unsigned char triggerType(0); + CHECK( m_resultBuilder->constructResultVectors( itemDecisionMap, tbp, tap, tav, triggerType ) ); + + auto eventID = context.eventID(); + std::unique_ptr<CTP_RDO> rdo = m_resultBuilder->constructRDOResult( eventID, tbp, tap, tav, tip ); + std::unique_ptr<CTPSLink> roi = m_resultBuilder->constructRoIResult( eventID, tbp, tap, tav, tip, triggerType ); + + // create CTP output format and store in the event + auto rdoWriteHandle = SG::makeHandle( m_oKeyRDO, context ); + auto sLinkWriteHandle = SG::makeHandle( m_oKeySLink, context ); + ATH_CHECK( rdoWriteHandle.record( std::move(rdo) )); + ATH_CHECK( sLinkWriteHandle.record( std::move(roi) )); + + { + auto tbpById = *get1DHist( "/output/tbpById" ); + auto tapById = *get1DHist( "/output/tapById" ); + auto tavById = *get1DHist( "/output/tavById" ); + for( unsigned int ctpId= 0; ctpId < 512; ++ctpId ) { + unsigned int wordNr = ctpId / 32; + unsigned int posWithinWord = ctpId % 32; + auto mask = 1L << posWithinWord; + if( 0 != (tbp[wordNr] & mask) ) { + tbpById->Fill( ctpId ); } - } - - else if ( thr->type() == TrigConf::L1DataDef::mbtssiType() ) { - int n_a = thr->name().find("MBTS_A"); - if (m_mbtsACTP.isValid() && n_a==0) { - multiplicity = CTPUtil::getMult( m_mbtsACTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); + if( 0 != (tap[wordNr] & mask) ) { + tapById->Fill( ctpId ); } - int n_c = thr->name().find("MBTS_C"); - if (m_mbtsCCTP.isValid() && n_c==0) { - multiplicity = CTPUtil::getMult( m_mbtsCCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - } - } - - else if (!thr->name().find("NIM") ) { - if(m_nimCTP.isValid() ) { - //rather nasty hack but we don't have a separation of NIM types in the data taking - //manually separates nim slot/connector combinations and matches to cable words - if ((thr->cableCtpin().find("SLOT8")!= std::string::npos)&& - (thr->cableConnector().find("CON2")!= std::string::npos)) - multiplicity = CTPUtil::getMult( m_nimCTP->cableWord0(), thr->cableStart(), thr->cableEnd() ); - - if ((thr->cableCtpin().find("SLOT9")!= std::string::npos)&& - (thr->cableConnector().find("CON0")!= std::string::npos)) - multiplicity = CTPUtil::getMult( m_nimCTP->cableWord1(), thr->cableStart(), thr->cableEnd() ); - - if ((thr->cableCtpin().find("SLOT9")!= std::string::npos)&& - (thr->cableConnector().find("CON1")!= std::string::npos)) - multiplicity = CTPUtil::getMult( m_nimCTP->cableWord2(), thr->cableStart(), thr->cableEnd() ); + if( 0 != (tav[wordNr] & mask) ) { + tavById->Fill( ctpId ); } } - - else { - - ATH_MSG_ERROR("Threshold type " << thr->type() << " for threshold " << thr->name() - << " and cable name " << thr->cableName() << " not recognized"); - return StatusCode::FAILURE; - } - - ATH_MSG_DEBUG(" ---> Threshold with name: " << std::setfill(' ') << std::setw( 8 ) << thr->name() << " gets multiplicity: " - << std::setw( 2 ) << multiplicity); - m_decisionMap->decision( thr )->setValue( multiplicity ); - } - + return StatusCode::SUCCESS; } StatusCode -LVL1CTP::CTPSimulation::LoadBunchGroups() { - ATH_MSG_DEBUG("Trying to access bunch group content from COOL"); - - unsigned int ctpVersion = ( m_ctpVersion != 0 ? m_ctpVersion : m_configSvc->ctpConfig()->ctpVersion() ); - - TrigConf::BunchGroupSet *bunchGroupSet; - const AthenaAttributeList* atrlist; - - //loading bunch groups from cool (data scenario) - if((detStore()->contains<AthenaAttributeList>(m_BunchGroupLoc))&& - (StatusCode::SUCCESS==detStore()->retrieve(atrlist, m_BunchGroupLoc))){ - - ATH_MSG_DEBUG("Reading bunch group information from COOL"); - std::vector<TrigConf::BunchGroup> bgs; - bgs = TrigConfCoolL1PayloadConverters::readLvl1BGContent( *atrlist ); - bunchGroupSet = new TrigConf::BunchGroupSet(bgs); - //bunchGroupSet->setId( m_lvl1BgKey ); // Update the BunchGroupSet object with the ID - } - - //if folder not avaible from cool (MC scenario) take default bunchgroup settings from configuration - else{ - ATH_MSG_DEBUG("Could not retrieve bunch group content from COOL, setting to default BunchID found in trigger configuration"); - bunchGroupSet=new TrigConf::BunchGroupSet(m_configSvc->ctpConfig()->bunchGroupSet()); +LVL1CTP::CTPSimulation::finalize() { + + const TrigConf::L1Menu * l1menu = nullptr; + if( m_useNewConfig ) { + ATH_CHECK( m_detStore->retrieve(l1menu) ); } - - if(!bunchGroupSet){ - ATH_MSG_WARNING("Null pointer for bunch group set returned"); - return StatusCode::FAILURE; + + + constexpr unsigned int sizeOfCTPOutput = 512; + + unsigned int tbp[sizeOfCTPOutput]; + unsigned int tap[sizeOfCTPOutput]; + unsigned int tav[sizeOfCTPOutput]; + { + auto h = *get1DHist( "/output/tbpById" ); + for( unsigned int id = 0; id < sizeOfCTPOutput; ++id ) tbp[id] = h->GetBinContent(id+1); } - - //log << MSG::DEBUG << "Dumping bunch group content"); - //bunchGroupSet->print(); - - //translating bunch group set into a CTPSimulation readable format - const std::vector<TrigConf::BunchGroup> bunchGroups(bunchGroupSet->bunchGroups()); - if (msgLvl(MSG::DEBUG)) { - for (size_t i(0); i < bunchGroups.size(); ++i) { - std::ostringstream message; - ATH_MSG_DEBUG("BunchGroup " << i << " Name " << bunchGroups[i].name() << " Bunches:" << bunchGroups[i].bunches().size()); - for (size_t j(0); j < bunchGroups[i].bunches().size(); ++j) { - message << " " << bunchGroups[i].bunches()[j]; - } - ATH_MSG_VERBOSE("REGTEST - " << message.str()); - } + { + auto h = *get1DHist( "/output/tapById" ); + for( unsigned int id = 0; id < sizeOfCTPOutput; ++id ) tap[id] = h->GetBinContent(id+1); } - - if (bunchGroups.empty()) { - ATH_MSG_WARNING("No bunch group triggers defined."); - } - - else { - ATH_MSG_DEBUG("Defining bunch group internal trigger"); - for (size_t i(0); i < bunchGroups.size(); ++i) { - InternalTriggerMap::key_type trigtype = make_pair(TrigConf::L1DataDef::BGRP,i); - - //delete previous bunch group settings if there are any - if(m_internalTrigger.find(trigtype)!=m_internalTrigger.end()) - delete m_internalTrigger[trigtype]; - - //declare new bunch group trigger - m_internalTrigger[trigtype] = new BunchGroupTrigger(i, bunchGroups[i].bunches(),ctpVersion); - } + { + auto h = *get1DHist( "/output/tavById" ); + for( unsigned int id = 0; id < sizeOfCTPOutput; ++id ) tav[id] = h->GetBinContent(id+1); } - delete bunchGroupSet; - return StatusCode::SUCCESS; -} -const LVL1CTP::ResultBuilder* -LVL1CTP::CTPSimulation::resultBuilder() const { - return m_resultBuilder; -} - + // fill the byName TAV histograms from the byID ones + { + auto htbp = *get1DHist( "/output/tbpByName" ); + auto htap = *get1DHist( "/output/tapByName" ); + auto htav = *get1DHist( "/output/tavByName" ); + if(l1menu) { + for( auto & item : *l1menu ) { + unsigned int ctpId = item.ctpId(); + htbp->Fill( item.name().c_str(), tbp[ctpId]); + htap->Fill( item.name().c_str(), tap[ctpId]); + htav->Fill( item.name().c_str(), tav[ctpId]); + } + } else { + for(const TriggerItem * item : m_configSvc->ctpConfig()->menu().items()) { + unsigned int ctpId = item->ctpId(); + htbp->Fill( item->name().c_str(), tbp[ctpId]); + htap->Fill( item->name().c_str(), tap[ctpId]); + htav->Fill( item->name().c_str(), tav[ctpId]); + } + } + htbp->Sumw2(0); + htap->Sumw2(0); + htav->Sumw2(0); + htbp->LabelsDeflate(); + htap->LabelsDeflate(); + htav->LabelsDeflate(); -void -LVL1CTP::CTPSimulation::collectStatistic() { + } - const uint32_t mask = 0x1; + StatusCode sc(StatusCode::SUCCESS); - unsigned int idx(0); - for(uint32_t w : resultBuilder()->tbp()) { - for(unsigned int bit=0; bit<32; ++bit) { - if( (mask<<bit & w) != 0 ) { // fired - m_countsBP[idx] += 1; - m_itemAcceptBP->AddBinContent(idx+1); + // fill the threshold summary hists + { + // run 2 thresholds (legacy + muon) + std::vector<std::string> thrHists; + if( l1menu ) { + thrHists = { "em/EM", "muon/MU", "tau/TAU", "jet/JET", "xe/XE", "te/TE", "xs/XS" }; + } else { + thrHists = { "em/em", "muon/muon", "tau/tau", "jet/jet", "xe/xe", "te/te", "xs/xs" }; + } + TH2* hist = new TH2I( "LegacyMult", "Legacy thresholds multiplicity", 1, 0, 1, 10, 0, 10); + for(const std::string & histpath : thrHists) { + auto h = * get2DHist( "/multi/" + histpath + "Mult" ); + auto xaxis = h->GetXaxis(); + size_t xsize = xaxis->GetNbins(); + size_t ysize = h->GetNbinsY(); + for(size_t x = 1; x<xsize; x++) { + std::string s(""); + for(size_t y = 1; y<=ysize; y++) { + size_t binContent = h->GetBinContent(x,y); + hist->Fill(xaxis->GetBinLabel(x),y-1,binContent); + s += std::to_string(binContent) + " "; + } + ATH_MSG_DEBUG( "REGTEST CTPSim " << xaxis->GetBinLabel(x) << " MULT " << s); } - idx++; } + hist->Sumw2(0); + hist->LabelsDeflate(); + sc = hbook( "/multi/all", std::unique_ptr<TH2>(hist)); } - - idx = 0; - for(uint32_t w : resultBuilder()->tap()) { - for(unsigned int bit=0; bit<32; ++bit) { - if( (mask<<bit & w) != 0 ) { // fired - m_countsAP[idx] += 1; - m_itemAcceptAP->AddBinContent(idx+1); + { + // run 3 thresholds + TH2* hist = new TH2I( "R3Mult", "New thresholds multiplicity", 1, 0, 1, 10, 0, 10); + if( l1menu ) { + std::vector<std::string> thrHists = { "em/eEM", "muon/MU", "tau/eTAU", "jet/jJ", "jet/gJ", "xe/gXE", "xe/jXE" }; + for(const std::string & histpath : thrHists) { + auto h = * get2DHist( "/multi/" + histpath + "Mult" ); + auto xaxis = h->GetXaxis(); + size_t xsize = xaxis->GetNbins(); + size_t ysize = h->GetNbinsY(); + for(size_t x = 1; x<=xsize; x++) { + std::string s(""); + for(size_t y = 1; y<=ysize; y++) { + size_t binContent = h->GetBinContent(x,y); + hist->Fill(xaxis->GetBinLabel(x) ,y-1, binContent); + s += std::to_string(binContent) + " "; + } + ATH_MSG_DEBUG( "REGTEST CTPSim " << xaxis->GetBinLabel(x) << " MULT " << s); + } } - idx++; } + hist->Sumw2(0); + hist->LabelsDeflate(); + sc = hbook( "/multi/all", std::unique_ptr<TH2>(hist)); } - idx = 0; - for(uint32_t w : resultBuilder()->tav()) { - for(unsigned int bit=0; bit<32; ++bit) { - if( (mask<<bit & w) != 0 ) { // fired - m_countsAV[idx] += 1; - m_itemAcceptAV->AddBinContent(idx+1); - } - idx++; + if(l1menu) { + for( auto & item : *l1menu ) { + ATH_MSG_DEBUG( "REGTEST CTPSim " << item.name() << " " << item.ctpId() << + " TBP " << tbp[item.ctpId()] << + " TAP " << tap[item.ctpId()] << + " TAV " << tav[item.ctpId()]); + } + } else { + for(const TriggerItem * item : m_configSvc->ctpConfig()->menu().items()) { + ATH_MSG_DEBUG( "REGTEST CTPSim " << item->name() << " " << item->ctpId() << + " TBP " << tbp[item->ctpId()] << + " TAP " << tap[item->ctpId()] << + " TAV " << tav[item->ctpId()]); } } + return sc; } diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.h b/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.h new file mode 100644 index 0000000000000000000000000000000000000000..c00cc5b2c2ccff69d88b897a3ec0634fcfc19f62 --- /dev/null +++ b/Trigger/TrigT1/TrigT1CTP/src/CTPSimulation.h @@ -0,0 +1,179 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef TRIGT1CTP_CTPSIMULATION_H +#define TRIGT1CTP_CTPSIMULATION_H + + +#include "AthenaBaseComps/AthReentrantAlgorithm.h" + +#include "GaudiKernel/ServiceHandle.h" +#include "GaudiKernel/ToolHandle.h" +#include "GaudiKernel/Property.h" +#include "StoreGate/DataHandle.h" +#include "TrigConfInterfaces/ILVL1ConfigSvc.h" +#include "AthenaKernel/IAtRndmGenSvc.h" + +// monitoring from HLT +#include "GaudiKernel/ITHistSvc.h" + + +// data default location +#include "TrigT1Interfaces/TrigT1CaloDefs.h" +#include "TrigT1Interfaces/TrigT1StoreGateKeys.h" + +// input/output data classes +#include "TrigT1Interfaces/MuCTPICTP.h" +#include "TrigT1Interfaces/EmTauCTP.h" +#include "TrigT1Interfaces/JetCTP.h" +#include "TrigT1Interfaces/EnergyCTP.h" +#include "TrigT1Interfaces/FrontPanelCTP.h" +#include "xAODTrigger/JetRoIContainer.h" +#include "xAODTrigger/EnergySumRoI.h" +#include "xAODTrigger/MuonRoIContainer.h" +#include "xAODTrigCalo/TrigEMClusterContainer.h" +#include "xAODTrigger/EmTauRoIContainer.h" +#include "TrigConfL1Data/L1DataDef.h" +#include "TrigConfL1Data/TriggerThreshold.h" +#include "TrigT1Result/CTP_RDO.h" +#include "TrigT1Interfaces/CTPSLink.h" + + +// internal +#include "./ItemMap.h" +#include "./ThresholdMap.h" +#include "./ResultBuilder.h" + +#include "GaudiKernel/LockedHandle.h" + +#include "TH1.h" + +#include <map> +#include <string> +#include <mutex> + +namespace LVL1 { + class CPRoIDecoder; + class JEPRoIDecoder; +} + +namespace LVL1CTP { + + class CTPSimulation : public ::AthReentrantAlgorithm { + + public: + + CTPSimulation( const std::string& name, ISvcLocator* pSvcLocator ); + ~CTPSimulation(); + + virtual StatusCode initialize() override; + + virtual StatusCode start() override; + + virtual StatusCode execute( const EventContext& context ) const override; + + virtual StatusCode finalize() override; + + + private: + + struct ConfigSource { + ConfigSource(const TrigConf::CTPConfig* ctpConfig, const TrigConf::L1Menu* l1menu) : m_ctpConfig(ctpConfig), m_l1menu(l1menu) {} + const TrigConf::CTPConfig* m_ctpConfig {nullptr}; // run 2 + const TrigConf::L1Menu * m_l1menu { nullptr }; // run 3 + const TrigConf::CTPConfig* ctpConfig() const { return m_ctpConfig; } + const TrigConf::L1Menu* l1menu() const { return m_l1menu; } + }; + + + // histogramming related + StatusCode bookHists() const; + StatusCode createMultiplicityHist(const ConfigSource & cfgSrc, const std::string & type, TrigConf::L1DataDef::TriggerType tt, unsigned int maxMult = 10 ) const; + StatusCode hbook(const std::string & path, std::unique_ptr<TH1> hist) const; + StatusCode hbook(const std::string & path, std::unique_ptr<TH2> hist) const; + LockedHandle<TH1> & get1DHist(const std::string & histName) const; + LockedHandle<TH2> & get2DHist(const std::string & histName) const; + + // execution related + StatusCode fillInputHistograms(const EventContext& context) const; + + StatusCode extractMultiplicities(std::map<std::string, unsigned int> & thrMultiMap, const EventContext& context) const; + + StatusCode simulateItems(const std::map<std::string, unsigned int> & thrMultiMap, const EventContext& context) const; + + // private member functions + unsigned int calculateMultiplicity ( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const; + unsigned int calculateJetMultiplicity ( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const; + unsigned int calculateEMMultiplicity ( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const; + unsigned int calculateTauMultiplicity ( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const; + unsigned int calculateMETMultiplicity ( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const; + unsigned int calculateMuonMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const; + unsigned int calculateTopoMultiplicity( const TrigConf::TriggerThreshold * confThr, const EventContext& context ) const; + + unsigned int calculateMultiplicity ( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const; + unsigned int calculateJetMultiplicity ( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const; + unsigned int calculateEMMultiplicity ( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const; + unsigned int calculateTauMultiplicity ( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const; + unsigned int calculateMETMultiplicity ( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const; + unsigned int calculateMuonMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const; + unsigned int calculateTopoMultiplicity( const TrigConf::L1Threshold & confThr, const TrigConf::L1Menu * l1menu, const EventContext& context ) const; + + // member variables + mutable std::once_flag m_onceflag; + + // Needed services and tools + ServiceHandle<ITHistSvc> m_histSvc { this, "THistSvc", "THistSvc/THistSvc", "Histogramming svc" }; + ServiceHandle<TrigConf::ILVL1ConfigSvc> m_configSvc { this, "TrigConfigSvc", "TrigConf::TrigConfigSvc/TrigConfigSvc", "Trigger configuration service" }; + ServiceHandle<IAtRndmGenSvc> m_rndmSvc{ this, "RndmSvc", "AtRndmGenSvc", "Random Number Service used in CTP simulation" }; + ServiceHandle<StoreGateSvc> m_detStore { this, "DetectorStore", "StoreGateSvc/DetectorStore", "Detector store to get the menu" }; + ToolHandle<LVL1CTP::ResultBuilder> m_resultBuilder { this, "ResultBuilder", "LVL1CTP__ResultBuilder/ResultBuilder", "Builds the CTP result" }; + + // thread safe histogram handlers + mutable std::map<std::string, LockedHandle<TH1>> m_hist1D ATLAS_THREAD_SAFE; + mutable std::map<std::string, LockedHandle<TH2>> m_hist2D ATLAS_THREAD_SAFE; + + // inputs + // new L1Topo + SG::ReadHandleKey<LVL1::FrontPanelCTP> m_iKeyTopo{ this, "TopoInput", LVL1::DEFAULT_L1TopoCTPLocation, "Input from topo" }; + // legacy L1Topo + SG::ReadHandleKey<LVL1::FrontPanelCTP> m_iKeyLegacyTopo{ this, "LegacyTopoInput", LVL1::DEFAULT_L1TopoLegacyCTPLocation, "Input from legacy topo" }; + // MUCTPI + SG::ReadHandleKey<LVL1::MuCTPICTP> m_iKeyMuctpi{ this, "MuctpiInput", LVL1MUCTPI::DEFAULT_MuonCTPLocation, "Input from Muctpi" }; + // CTPIN + SG::ReadHandleKey<LVL1::EmTauCTP> m_iKeyCtpinEM{ this, "CtpinEMInput", LVL1::TrigT1CaloDefs::EmTauCTPLocation, "Input from CTPIN em and tau (legacy)" }; + SG::ReadHandleKey<LVL1::JetCTP> m_iKeyCtpinJet{ this, "CtpinJetInput", LVL1::TrigT1CaloDefs::JetCTPLocation, "Input from CTPIN jet (legacy)" }; + SG::ReadHandleKey<LVL1::EnergyCTP> m_iKeyCtpinXE{ this, "CtpinXEInput", LVL1::TrigT1CaloDefs::EnergyCTPLocation, "Input from CTPIN energy (te,xe,xs - legacy)" }; + // new FEX object collections (temporary until moved to L1Topo simulation) + // jFEX + SG::ReadHandleKey< xAOD::JetRoIContainer > m_iKeyJFexJets { this, "jFexJetInput", "jRoundJets", "Input list of jFEX jets" }; + SG::ReadHandleKey< xAOD::JetRoIContainer > m_iKeyJFexLJets{ this, "jFexLJetInput", "jRoundLargeRJets", "Input list of jFEX large-R jets" }; + // gFEX + SG::ReadHandleKey< xAOD::JetRoIContainer > m_iKeyGFexJets { this, "gFexJetInput", "gL1Jets", "Input list of gFEX jets" }; + SG::ReadHandleKey< xAOD::EnergySumRoI > m_iKeyGFexMETPufit{ this, "gFexMETPufitInput", "gXEPUFIT_MET", "Input list of gFEX MET Pufit" }; + SG::ReadHandleKey< xAOD::EnergySumRoI > m_iKeyGFexMETRho { this, "gFexMETRhoInput", "gXERHO_MET", "Input list of gFEX MET Rho" }; + SG::ReadHandleKey< xAOD::EnergySumRoI > m_iKeyGFexMETJwoJ { this, "gFexMETJwoJInput", "gXEJWOJ_MET", "Input list of gFEX MET JwoJ" }; + // eFEX + SG::ReadHandleKey< xAOD::TrigEMClusterContainer > m_iKeyEFexCluster{ this, "eFexClusterInput", "SClusterCl", "Input list of eFEX cluster" }; + SG::ReadHandleKey< xAOD::EmTauRoIContainer > m_iKeyEFexTau { this, "eFexTauInput", "SClusterTau", "Input list of eFEX tau" }; + + // outputs + SG::WriteHandleKey<CTP_RDO> m_oKeyRDO {this, "RDOOutput", LVL1CTP::DEFAULT_RDOOutputLocation, "Output of CTP RDO object (sim)"}; + SG::WriteHandleKey<CTPSLink> m_oKeySLink{this, "ROIOutput", LVL1CTP::DEFAULT_CTPSLinkLocation, "Output of CTP SLink object (sim)"}; + + + // properties + Gaudi::Property<bool> m_isData { this, "IsData", false, "emulate CTP as part of MC or rerun on data" }; + Gaudi::Property<std::string> m_histPath { this, "HistPath", "/EXPERT/L1/", "Booking path for the histogram" }; + Gaudi::Property<std::string> m_rndmEngineName { this, "RndmEngine", "CTPSimulation", "Name of the random engine" }; + Gaudi::Property<bool> m_useNewConfig { this, "UseNewConfig", false, "When true, read the menu from detector store, when false use the L1ConfigSvc" }; + Gaudi::Property<bool> m_forceBunchGroupPattern { this, "ForceBunchGroupPattern", true, "When true, ignore the bunchgroups and use the provided BunchGroupPattern" }; + Gaudi::Property<unsigned int> m_bunchGroupPattern { this, "BunchGroupPattern", 0x0003, "Bunchgroup pattern applied at every event, useful for simulation. Bit x corresponds to bunchgroup x" }; + + // to decode the L1 Run-2 hardware ROIs from data + LVL1::CPRoIDecoder * m_decoder { nullptr }; + LVL1::JEPRoIDecoder * m_jetDecoder { nullptr }; + }; + +} + +#endif diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.cxx old mode 100755 new mode 100644 index beab386acb39f6106ded24da0060496daedc686a..b3456445b6fc9a02677b397dbb5442a001c1ebba --- a/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.cxx +++ b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.cxx @@ -1,55 +1,101 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#include "TrigConfData/LogicParser.h" #include "TrigConfL1Data/TriggerItem.h" -#include "TrigT1CTP/CTPTriggerItem.h" - -namespace LVL1CTP { - - CTPTriggerItem::CTPTriggerItem( const TrigConf::TriggerItem* parent, int prescale ) - : m_parent( parent ), m_prescale( prescale ) { - - m_counter = 0; - m_position = -1; - - } - - CTPTriggerItem::~CTPTriggerItem() { - - } - - const TrigConf::TriggerItem* CTPTriggerItem::item() const { - - return m_parent; - - } - - int CTPTriggerItem::prescale() const { - - return m_prescale; - +#include "./CTPTriggerItem.h" + + +LVL1CTP::CTPTriggerItem::CTPTriggerItem() +{} + +LVL1CTP::CTPTriggerItem::~CTPTriggerItem() +{} + +void +LVL1CTP::CTPTriggerItem::setPrescale(int prescale) { + m_prescale = prescale; +} + + +int +LVL1CTP::CTPTriggerItem::prescale() const { + return m_prescale; +} + +void +LVL1CTP::CTPTriggerItem::setName( const std::string & name ) { + m_name = name; +} + + +const std::string & +LVL1CTP::CTPTriggerItem::name() const { + return m_name; +} + +unsigned int +LVL1CTP::CTPTriggerItem::ctpId() const { + return m_ctpid; +} + +void +LVL1CTP::CTPTriggerItem::setCtpId( unsigned int ctpid ) { + m_ctpid = ctpid; +} + +void +LVL1CTP::CTPTriggerItem::setTriggerType(unsigned char triggerType) { + m_TriggerType = (triggerType & 0xff); +} + +unsigned char +LVL1CTP::CTPTriggerItem::triggerType() const { + return m_TriggerType; +} + +void +LVL1CTP::CTPTriggerItem::setLogic(const std::string & logicExpr) { + TrigConf::LogicParser p; + m_logic = p.parse(logicExpr); +} + + +const std::shared_ptr<TrigConf::Logic> & +LVL1CTP::CTPTriggerItem::logic() const { + return m_logic; +} + +void +LVL1CTP::CTPTriggerItem::setBunchGroups(const std::vector<std::string> & bunchGroups) { + m_bunchGroups = bunchGroups; +} + +const std::vector<std::string> & +LVL1CTP::CTPTriggerItem::bunchGroups() const { + return m_bunchGroups; +} + + +bool +LVL1CTP::CTPTriggerItem::evaluate( const std::map<std::string, unsigned int> & thrDecMap ) const +{ + if(m_logic) { + bool dec = m_logic->evaluate(thrDecMap); + if( dec && (! m_bunchGroups.empty()) ) { + // apply bunchgroups, if set (if not set, it is part of the logic) + for( auto & bgName : m_bunchGroups ) { + if( thrDecMap.at(bgName) == 0 ) { + dec = false; break; + } + } + } + return dec; + } else { + std::cerr << "No logic set for this ctpItem " << name() << std::endl; + return false; } - - int CTPTriggerItem::prescaleCounter() const { - - return m_counter; - - } - - void CTPTriggerItem::setPrescaleCounter( int counter ) { - m_counter = counter; - return; - } - - unsigned int CTPTriggerItem::itemPos() const { - return m_position; - } - - void CTPTriggerItem::setItemPos( unsigned int position ) { - m_position = position; - } - -} // namespace LVL1CTP +} diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.h b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.h new file mode 100644 index 0000000000000000000000000000000000000000..6c3d2e392bfd43a4d705fb7e58437272bd07f8a8 --- /dev/null +++ b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItem.h @@ -0,0 +1,64 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +#ifndef TRIGT1CTP_CTPTRIGGERITEM_H +#define TRIGT1CTP_CTPTRIGGERITEM_H + +#include "TrigConfData/Logic.h" +#include "TrigConfL1Data/TriggerItem.h" + +#include <map> +#include <string> +#include <memory> + + +namespace LVL1CTP { + + /** + * @short Class storing information helping to make the CTP decision + */ + + class CTPTriggerItem { + + public: + /// constructor setting trigger item and corresponding prescale + CTPTriggerItem(); + /// default destructor + ~CTPTriggerItem(); + + // setters and getters for member variables + void setLogic(const std::string & logicExpr); + const std::shared_ptr<TrigConf::Logic> & logic() const; + + void setBunchGroups(const std::vector<std::string> & bunchGroups); + const std::vector<std::string> & bunchGroups() const; + + void setCtpId( unsigned int ctpid ); + unsigned int ctpId() const; + + void setName( const std::string & name ); + const std::string & name() const; + + void setTriggerType(unsigned char triggerType); + unsigned char triggerType() const; + + void setPrescale(int prescale); + int prescale() const; + + bool evaluate( const std::map<std::string, unsigned int> & thrDecMap ) const; + + + private: + std::string m_name { "" }; //!< item name + unsigned int m_ctpid { 1 }; //!< CTPID + unsigned char m_TriggerType { 0 }; //!< 8 bit trigger type (4 bit for secondary partitions) + int m_prescale { 1 }; //!< prescale value + std::shared_ptr<TrigConf::Logic> m_logic; //!< the definition of the item turned into a Logic object + std::vector<std::string> m_bunchGroups; //!< the list of bunchgroups forming this item + }; + +} + +#endif diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItemNode.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItemNode.cxx deleted file mode 100755 index bf32c3decfcc72dcf50904f586637fa7a22fbea4..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerItemNode.cxx +++ /dev/null @@ -1,97 +0,0 @@ -/* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration -*/ - -#include <cassert> -#include <sstream> -#include <iomanip> - -#include "TrigConfL1Data/TriggerItemNode.h" -#include "TrigConfL1Data/TriggerThreshold.h" -#include "TrigConfL1Data/L1DataDef.h" - -#include "TrigT1CTP/CTPTriggerItemNode.h" -#include "TrigT1CTP/ThresholdMap.h" -#include "TrigT1CTP/CTPTriggerThreshold.h" -#include "TrigT1CTP/MsgLogger.h" - -#include "boost/lexical_cast.hpp" - -using namespace std; - -bool LVL1CTP::CTPTriggerItemNode::evaluate( const TrigConf::TriggerItemNode* node, const ThresholdMap* map, const InternalTriggerMap* internalTrigger ) { - - MsgLogger logger( "CTPTriggerItemNode" ); - - if( node->type() == TrigConf::TriggerItemNode::OBJ ) { - - if ( node->isThreshold() ) { - const bool decision = map->decision( node->triggerThreshold() )->value() >= node->multiplicity(); - logger.send( MSG::VERBOSE, string(" Decision for OBJ TriggerItemNode with threshold: ") - + node->triggerThreshold()->name() + " is " + ( decision ? "ACTIVE" : "INACTIVE" ) ); - return decision; - } - - if (node->internalTriggerType() == TrigConf::L1DataDef::UNDEF) { - logger.send( MSG::WARNING, "Undefined internal trigger! Returning false." ); - return false; - } - - bool decision = false; - InternalTriggerMap::const_iterator iter = internalTrigger->find( make_pair(node->internalTriggerType(),node->internalTriggerNumber()) ); - if (iter != internalTrigger->end()) - decision = iter->second->evaluate(); - ostringstream message; - message << " Decision for OBJ TriggerItemNode with internal trigger: " - << setw( 8 ) << TrigConf::L1DataDef::typeAsString(node->internalTriggerType()) << node->internalTriggerNumber() - << " is " << ( decision ? "ACTIVE" : "INACTIVE" ); - logger.send( MSG::VERBOSE, message.str() ); - return decision; - } - - - const vector<TrigConf::TriggerItemNode*>& children = node->children(); - - if( node->type() == TrigConf::TriggerItemNode::NOT ) { - if(children.size() != 1) { - logger.send( MSG::WARNING, "TriggerItemNode NOT has " + boost::lexical_cast<string,size_t>(children.size()) - + "! Returning false." ); - return false; - } - bool decision = ! evaluate( children[0], map, internalTrigger ); - logger.send( MSG::VERBOSE, string(" Decision for NOT TriggerItemNode is ") + ( decision ? "ACTIVE" : "INACTIVE" ) ); - return decision; - } - - - if(children.size() == 0) { - logger.send( MSG::WARNING, "AND or OR node without children! Returning false." ); - return false; - } - - if( node->type() == TrigConf::TriggerItemNode::AND ) { - bool decision = true; - for(TrigConf::TriggerItemNode* child : children) { - decision &= evaluate( child, map, internalTrigger ); - if(!decision) break; - } - logger.send( MSG::VERBOSE, string(" Decision for AND TriggerItemNode is ") + ( decision ? "ACTIVE" : "INACTIVE" ) ); - return decision; - } - - - if ( node->type() == TrigConf::TriggerItemNode::OR ) { - bool decision = false; - for(TrigConf::TriggerItemNode* child : children) { - decision |= evaluate( child, map, internalTrigger ); - if(decision) break; - } - logger.send( MSG::VERBOSE, string(" Decision for OR TriggerItemNode is ") + ( decision ? "ACTIVE" : "INACTIVE" ) ); - return decision; - } - - logger.send( MSG::FATAL, "TrigConf::TriggerItemNode::type() not recognized!!!" ); - assert( 0 ); - return false; - -} diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerThreshold.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerThreshold.cxx old mode 100755 new mode 100644 index b54a11726d121b44c4bb0b96ceafbbc0d6c63619..0c911f7d20064727b2bad5d0be5553c7ac6f7793 --- a/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerThreshold.cxx +++ b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerThreshold.cxx @@ -1,91 +1,42 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#include "./CTPTriggerThreshold.h" -#include "TrigConfL1Data/TriggerThreshold.h" +LVL1CTP::CTPTriggerThreshold::CTPTriggerThreshold(const std::string & name) : + m_name(name) +{} -#include "TrigT1CTP/CTPTriggerThreshold.h" +LVL1CTP::CTPTriggerThreshold::~CTPTriggerThreshold() +{} -namespace LVL1CTP { +int +LVL1CTP::CTPTriggerThreshold::value() const { + return m_value; +} - CTPTriggerThreshold::CTPTriggerThreshold( const TrigConf::TriggerThreshold* parent ) { +void +LVL1CTP::CTPTriggerThreshold::setValue( int value ) { + m_value = value; +} - m_parent = parent; - m_value = -1; - m_start_bit = -1; - m_end_bit = -1; - // m_pit_start = -1; - // m_pit_end = -1; +unsigned int +LVL1CTP::CTPTriggerThreshold::startBit() const { + return m_start_bit; +} - } +void +LVL1CTP::CTPTriggerThreshold::setStartBit( unsigned int start ) { + m_start_bit = start; +} - CTPTriggerThreshold::~CTPTriggerThreshold() { +unsigned int +LVL1CTP::CTPTriggerThreshold::endBit() const { + return m_end_bit; +} - } - - const TrigConf::TriggerThreshold* CTPTriggerThreshold::threshold() const { - - return m_parent; - - } - - int CTPTriggerThreshold::value() const { - - return m_value; - - } - - void CTPTriggerThreshold::setValue( int value ) { - - m_value = value; - - } - - unsigned int CTPTriggerThreshold::startBit() const { - return m_start_bit; - } - - void CTPTriggerThreshold::setStartBit( unsigned int start ) { - - m_start_bit = start; - - } - - unsigned int CTPTriggerThreshold::endBit() const { - - return m_end_bit; - - } - - void CTPTriggerThreshold::setEndBit( unsigned int end ) { - - m_end_bit = end; - - } - - // int CTPTriggerThreshold::pitStart() const { - // - // return m_pit_start; - // - // } - // - // void CTPTriggerThreshold::setPitStart( int pit_start ) { - // - // m_pit_start = pit_start; - // - // } - // - // int CTPTriggerThreshold::pitEnd() const { - // - // return m_pit_end; - // - // } - // - // void CTPTriggerThreshold::setPitEnd( int pit_end ) { - // - // m_pit_end = pit_end; - // - // } - -} // namespace LVL1CTP +void +LVL1CTP::CTPTriggerThreshold::setEndBit( unsigned int end ) { + m_end_bit = end; +} diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerThreshold.h b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerThreshold.h new file mode 100644 index 0000000000000000000000000000000000000000..2a9113321537d2f4a03de2fa39edd8a748e73f99 --- /dev/null +++ b/Trigger/TrigT1/TrigT1CTP/src/CTPTriggerThreshold.h @@ -0,0 +1,52 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +#ifndef TRIGT1CTP_CTPTRIGGERTHRESHOLD_H +#define TRIGT1CTP_CTPTRIGGERTHRESHOLD_H + +#include <string> + +namespace LVL1CTP { + + /** + * @short Helper class holding trigger threshold multiplicity + */ + + class CTPTriggerThreshold { + + public: + + CTPTriggerThreshold(const std::string & name); + ~CTPTriggerThreshold(); + + const std::string & name() const + { return m_name; } + + /// Get multiplicity of the threshold + int value() const; + /// Set the multiplicity of the threshold + void setValue( int value ); + + /// Get the start position of the threshold + unsigned int startBit() const; + /// Set the start position of the threshold + void setStartBit( unsigned int start ); + + /// Get the end position of the threshold + unsigned int endBit() const; + /// Set the end position of the threshold + void setEndBit( unsigned int end ); + + private: + std::string m_name {""}; + int m_value {-1}; //!< multiplicity of threshold + unsigned int m_start_bit {0}; //!< start position of threshold + unsigned int m_end_bit {0}; //!< end position of threshold + + }; + +} + +#endif diff --git a/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.cxx b/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.cxx old mode 100755 new mode 100644 index 0c39ac29c5348cf840a62e0e0abfec6d187d85b4..8ccdae03b793e07feb5599d62efc018d4b571f81 --- a/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.cxx +++ b/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.cxx @@ -1,10 +1,10 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // this class heasder file -#include "TrigT1CTP/CTPUtil.h" +#include "./CTPUtil.h" // standard include(s): #include <cmath> diff --git a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPUtil.h b/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.h old mode 100755 new mode 100644 similarity index 97% rename from Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPUtil.h rename to Trigger/TrigT1/TrigT1CTP/src/CTPUtil.h index 0977e0cd3f478b7a098ca387d9553ab37e6193b2..c666b2db66cb08ffdc8602d780d1b200470475e2 --- a/Trigger/TrigT1/TrigT1CTP/TrigT1CTP/CTPUtil.h +++ b/Trigger/TrigT1/TrigT1CTP/src/CTPUtil.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ diff --git a/Trigger/TrigT1/TrigT1CTP/src/CustomBit.cxx b/Trigger/TrigT1/TrigT1CTP/src/CustomBit.cxx deleted file mode 100644 index 01af8dd4e09af80e48501a050779a24b0e6c0b37..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/src/CustomBit.cxx +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -// This header file -#include "TrigT1CTP/CustomBit.h" - -// CTP DAQ output: -#include "TrigT1Result/CTPResult.h" - -// Local includes: -#include "TrigT1CTP/CTPSimulation.h" - -unsigned int LVL1CTP::CustomBit::size() const -{ - // sanity check - if (m_algo == 0) return 0; - - // get pointer to result builder and do sanity check - m_resultBuilder = m_algo->resultBuilder(); - if (m_resultBuilder == 0) return 0; - - // cache result - m_result = ROIB::convertToBitset((m_resultBuilder->*m_func)()); - - return m_result.size(); -} diff --git a/Trigger/TrigT1/TrigT1CTP/src/EventInfo.cxx b/Trigger/TrigT1/TrigT1CTP/src/EventInfo.cxx deleted file mode 100755 index 7b14e7182575c11953be7788998f2c0697b2233c..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/src/EventInfo.cxx +++ /dev/null @@ -1,78 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#include "TrigT1CTP/EventInfo.h" - -#include <sstream> -#include <iomanip> - -namespace LVL1CTP { - - std::auto_ptr<EventInfo> EventInfo::m_instance; - - EventInfo::EventInfo() - : m_runNumber( 0 ), m_eventNumber ( 0 ), - m_eventType( 0 ), m_triggerType( 0 ), m_l1id( 0 ), m_bcid( 0 ), m_utcTime( 0 ), m_timeNsOffset( 0 ) - { - } - - EventInfo& EventInfo::instance() - { - if (m_instance.get() == 0) m_instance.reset(new EventInfo()); - return *m_instance; - } - - void EventInfo::clear() - { - m_runNumber = 0; - m_eventNumber = 0; - m_eventType = 0; - m_triggerType = 0; - m_l1id = 0; - m_bcid = 0; - m_utcTime = 0; - m_timeNsOffset = 0; - } - - const std::string EventInfo::dump() const - { - std::ostringstream s; - - s << " time: " << m_utcTime << " " << m_timeNsOffset - << " Run: " << m_runNumber - << " Event: " << m_eventNumber - << " L1ID: " << m_l1id - << " BCID: " << m_bcid - << " triggerType: " << m_triggerType - << " eventType: " << m_eventType; - - return s.str(); - } - - unsigned int EventInfo::runNumber() const { return m_runNumber; } - void EventInfo::setRunNumber( unsigned int value ) { m_runNumber = value; } - - unsigned int EventInfo::eventNumber() const { return m_eventNumber; } - void EventInfo::setEventNumber( unsigned int value ) { m_eventNumber = value; } - - unsigned int EventInfo::eventType() const { return m_eventType; } - void EventInfo::setEventType( unsigned int type ) { m_eventType = type; } - - unsigned int EventInfo::triggerType() const { return m_triggerType; } - void EventInfo::setTriggerType( unsigned int type ) { m_triggerType = type; } - - unsigned int EventInfo::extendedL1ID() const { return m_l1id; } - void EventInfo::setExtendedL1ID( unsigned int l1id ) { m_l1id = l1id; } - - unsigned int EventInfo::bcid() const { return m_bcid; } - void EventInfo::setBCID( unsigned int bcid ) { m_bcid = bcid; } - - unsigned int EventInfo::time() const { return m_utcTime; } - void EventInfo::setTime( unsigned int time ) { m_utcTime = time; } - - unsigned int EventInfo::timeNs() const { return m_timeNsOffset; } - void EventInfo::setTimeNs( unsigned int time ) { m_timeNsOffset = time; } - -} // namespace LVL1CTP diff --git a/Trigger/TrigT1/TrigT1CTP/src/ItemMap.cxx b/Trigger/TrigT1/TrigT1CTP/src/ItemMap.cxx old mode 100755 new mode 100644 index 2d7ce375ec549cdf2aecba5a80747407ec8b802a..ce5de5579142c72c77b050f5937d739e3f1d0426 --- a/Trigger/TrigT1/TrigT1CTP/src/ItemMap.cxx +++ b/Trigger/TrigT1/TrigT1CTP/src/ItemMap.cxx @@ -1,114 +1,128 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// std includes -#include <sstream> -#include <iomanip> -#include <math.h> +// local includes +#include "./ItemMap.h" // TrigT1 configuration includes #include "TrigConfL1Data/TriggerItem.h" #include "TrigConfL1Data/PrescaleSet.h" -// local includes -#include "TrigT1CTP/ItemMap.h" -#include "TrigT1CTP/CTPTriggerItem.h" -#include "TrigT1CTP/ThresholdMap.h" -#include "TrigT1CTP/CTPTriggerItemNode.h" // random number generator #include "CLHEP/Random/RandomEngine.h" #include "CLHEP/Random/RandFlat.h" +#include "boost/algorithm/string.hpp" +#include <boost/tokenizer.hpp> +#include <boost/lexical_cast.hpp> -LVL1CTP::ItemMap::ItemMap( const TrigConf::ItemContainer& item_vector, - const TrigConf::PrescaleSet& prescales, - CLHEP::HepRandomEngine* randEngine ) - : m_logger( "ItemMap" ) +LVL1CTP::ItemMap::ItemMap( const TrigConf::L1Menu * l1menu ) { - - m_logger.send( MSG::VERBOSE, "Created" ); - m_logger.send( MSG::DEBUG, "Creating CTPTriggerItem objects for each TrigConf::TriggerItem object..." ); - - for( TrigConf::ItemContainer::const_iterator it = item_vector.begin(); it != item_vector.end(); ++it ) { + for( const TrigConf::L1Item & item : *l1menu ) { + const std::string & itemName( item.name() ); // get postion from ctp id - unsigned int position = (*it)->ctpId(); - - m_map[ *it ] = new CTPTriggerItem( *it, prescales.prescales_float()[ position ] ); - m_map[ *it ]->setItemPos( position ); - - if (randEngine != 0) { // change prescale offset randomly if requested - long random = CLHEP::RandFlat::shootInt(randEngine, m_map[ *it ]->prescale()); - m_map[ *it ]->setPrescaleCounter( random ); - int32_t cut = TrigConf::PrescaleSet::getCutFromPrescale( m_map[*it]->prescale() ); - std::ostringstream message; - message << "REGTEST - random prescale offset for " << std::setw( 30 ) << ( *it )->name() << ": " - << std::setw( 8 ) << m_map[*it]->prescaleCounter() << "/" << std::setw( 8 ) << m_map[*it]->prescale() <<" (cut="<< cut<<")"; - m_logger.send( MSG::DEBUG, message.str() ); - } - - std::ostringstream message; - message << " --> Created object for item with name: " << std::setw( 30 ) << ( *it )->name() << " in the position: " - << std::setw( 3 ) << m_map[*it]->itemPos() << " with prescale: " << std::setw( 8 ) << m_map[*it]->prescale(); - m_logger.send( MSG::VERBOSE, message.str() ); - + unsigned int ctpId = item.ctpId(); + + CTPTriggerItem * ctpItem = new CTPTriggerItem(); + ctpItem->setPrescale( 1 ); + ctpItem->setCtpId( ctpId ); + ctpItem->setName(itemName); + ctpItem->setLogic(item.definition()); + ctpItem->setTriggerType(item.triggerTypeAsUChar()); + ctpItem->setBunchGroups(item.bunchgroups()); + + m_map[ itemName ] = ctpItem; + m_itemNames.insert( itemName ); + } - m_logger.send( MSG::DEBUG, "Creating objects done" ); - } -LVL1CTP::ItemMap::~ItemMap() { - - for( std::map< const TrigConf::TriggerItem*, CTPTriggerItem* >::const_iterator it = m_map.begin(); it != m_map.end(); ++it ) { - - delete it->second; +LVL1CTP::ItemMap::~ItemMap() { + for( auto entry : m_map ) { + delete entry.second; } - - m_logger.send( MSG::VERBOSE, "Deleted" ); - } -LVL1CTP::CTPTriggerItem* -LVL1CTP::ItemMap::getItem( const TrigConf::TriggerItem* item ) const { - return m_map.find( item )->second; -} +LVL1CTP::ItemMap::ItemMap( const TrigConf::ItemContainer& item_vector, + const TrigConf::PrescaleSet& prescales ) +{ + for( const TrigConf::TriggerItem * item : item_vector ) { + std::string definition = getDefinition(item); -void -LVL1CTP::ItemMap::updatePrescaleCounters( const ThresholdMap* decisionMap, const InternalTriggerMap* internalTrigger, CLHEP::HepRandomEngine* randEngine ) { + const std::string & itemName( item->name() ); - m_logger.send( MSG::VERBOSE, "Updating prescale counters" ); + // get postion from ctp id + unsigned int ctpId = item->ctpId(); - for ( std::map< const TrigConf::TriggerItem*, CTPTriggerItem* >::const_iterator it = m_map.begin(); it != m_map.end(); ++it ) { + CTPTriggerItem * ctpItem = new CTPTriggerItem(); + ctpItem->setPrescale( prescales.prescales_float()[ ctpId ] ); + ctpItem->setCtpId( ctpId ); + ctpItem->setName(itemName); + ctpItem->setLogic(definition); + ctpItem->setTriggerType(item->triggerType()); - const bool decision = CTPTriggerItemNode::evaluate( it->first->topNode(), decisionMap, internalTrigger ); + m_map[ itemName ] = ctpItem; + m_itemNames.insert( itemName ); + } +} - if ( decision ) { - if (randEngine != 0) { // random prescale update - //long random = CLHEP::RandFlat::shootInt(randEngine, it->second->prescale()); - //randommly create a cut value - long random = CLHEP::RandFlat::shootInt(randEngine, pow(2,24) ); - it->second->setPrescaleCounter( random ); - std::ostringstream message; - message << "REGTEST - random prescale for " << std::setw( 30 ) << it->first->name() - << " (" << std::setw(3) << it->second->itemPos() << "): " - << std::setw( 8 ) << /*TrigConf::PrescaleSet::getPrescaleFromCut*/( it->second->prescaleCounter()) << "/" << std::setw( 8 ) << it->second->prescale(); - m_logger.send( MSG::DEBUG, message.str() ); - }else{ - it->second->setPrescaleCounter( it->second->prescaleCounter() + 1 ); - } +/* + e.g for the item L1_EM15VHI_2TAU12IM_J25_3J12 + the definition that is stored in COOL is (1&2&3&4&5&6) + and the list of thresholds is 1,EM15VHI_x1,EM15VHI 2,HA12IM_x2,HA12IM 1,J25_x1,J25 3,J12_x3,J12 BGRP0 BGRP1 + + In this function this information is used to create a definition string + "(EM15VHI[x1]&HA12IM[x2]&J25[x1]&J12[x3]&BGRP0&BGRP1)" +*/ +std::string +LVL1CTP::ItemMap::getDefinition( const TrigConf::TriggerItem * item ) const { + + + std::vector<std::string> thresholdlist; + std::string logic, conditions; + item->buildLogic(logic, thresholdlist); // get's the list of thresholds, e.g. 1,EM15VHI_x1,EM15VHI 2,HA12IM_x2,HA12IM 1,J25_x1,J25 3,J12_x3,J12 BGRP0 BGRP1 + + std::map<unsigned int, std::string> thrNames; + size_t idx = 1; + for(const std::string & thrmult : thresholdlist) { + std::vector<std::string> res; + boost::split(res, thrmult, boost::is_any_of(",")); // split 1,EM15VHI_x1,EM15VHI into multiplicity,name_mult, and name + + std::string name_mult(""); + if(res.size() == 1) { + name_mult=res[0]; // for thresholds without multiplicity requirement like RNDM0 or BGRP0,... + } else { + name_mult = res[2]+"[x"+res[0]+"]"; // build "EM15VHI[x1]" } - + thrNames[idx++] = name_mult; } - m_logger.send( MSG::VERBOSE, "Updating done" ); - - return; + // now take the logic (1&2&3&4&5&6) apart and replace the numbers with names "thr[xmult]" + std::string def = item->definition(); + std::vector<std::string> tokens; + // build tokens with separators ()&|! and <space>. Keeps all separators except <space> in the list of tokens + for ( auto & tok : boost::tokenizer<boost::char_separator<char> > (item->definition(), boost::char_separator<char>(" ", "()&|!")) ) { + try { + int n = boost::lexical_cast<int,std::string>(tok); + tokens.emplace_back(thrNames[n]); + } + catch(const boost::bad_lexical_cast &) { + tokens.emplace_back(tok); + } + } + // and reassemble the logic definition string + std::string definition(""); + for( auto & tok : tokens ) { + definition += tok; + } + + return definition; } diff --git a/Trigger/TrigT1/TrigT1CTP/src/ItemMap.h b/Trigger/TrigT1/TrigT1CTP/src/ItemMap.h new file mode 100644 index 0000000000000000000000000000000000000000..8bd8417243a7b1a12082a59aa2079e169d800e0c --- /dev/null +++ b/Trigger/TrigT1/TrigT1CTP/src/ItemMap.h @@ -0,0 +1,70 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +#ifndef TRIGT1CTP_ITEMMAP_H +#define TRIGT1CTP_ITEMMAP_H + +// local include(s): +#include "./SpecialTrigger.h" + +// STL include(s): +#include <set> +#include <map> + +#include "TrigConfData/L1Menu.h" + +#include "TrigConfL1Data/Menu.h" +#include "./CTPTriggerItem.h" + + + +// Forward include(s): +namespace TrigConf { + class PrescaleSet; +} + +namespace LVL1CTP { + + // forward includes in namespace LVL1CTP + class ThresholdMap; + + /** + * @short Map associating item name to CTPTriggerItem objects + */ + + class ItemMap { + + public: + + ItemMap( const TrigConf::L1Menu * l1menu ); + + //! constructor setting list of trigger items and associated prescales (random prescale offset if randEngine is given) + ItemMap( const TrigConf::ItemContainer& item_vector, + const TrigConf::PrescaleSet& prescales ); + + //! default destructor + ~ItemMap(); + + const CTPTriggerItem* getItem( const std::string & itemName ) const + { return m_map.find( itemName )->second; } + + const std::set<std::string> & itemNames() const + { return m_itemNames; } + + + private: + + // turns item definition "1&2&3" into "EM[x2]&BGRP0&BGRP1", which is needed when item configuration is read from COOL + std::string getDefinition( const TrigConf::TriggerItem * item ) const; + + /// map from item name to CTPTriggerItem + std::map< std::string, const CTPTriggerItem* > m_map; + + std::set<std::string> m_itemNames{}; + + }; + +} +#endif diff --git a/Trigger/TrigT1/TrigT1CTP/src/MsgLogger.cxx b/Trigger/TrigT1/TrigT1CTP/src/MsgLogger.cxx deleted file mode 100755 index f8ca0ad3698413038c5f0d0195e98b7eb711cb06..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/src/MsgLogger.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#include "TrigT1CTP/MsgLogger.h" -#include "TrigT1CTP/MsgWriter.h" - -namespace LVL1CTP { - - MsgLogger::MsgLogger( const std::string& source ) - : m_source( source ) { - - m_msgWriter = MsgWriter::instance(); - - } - - MsgLogger::~MsgLogger() { - - } - - bool - MsgLogger::msgLvl (const MSG::Level lvl) const - { - return m_msgWriter->msgLvl(lvl); - } - - - /** - * This is the function that actually writes to the output, using MsgWriter. - * You can even give multi-line strings to it, it will nicely give each line - * the appropriate header. - */ - void MsgLogger::send( MSG::Level type, const std::string& message ) const { - - std::string::size_type previous_pos = 0, current_pos = 0; - - // Slice the recieved message into lines: - for( ; ; ) { - - current_pos = message.find( '\n', previous_pos ); - std::string line = message.substr( previous_pos, current_pos - previous_pos ); - - std::string message_to_send = m_source + " : " + line; - m_msgWriter->write( type, message_to_send ); - - if( current_pos == message.npos ) break; - previous_pos = current_pos + 1; - - } - - return; - - } - -} // namespace LVL1CTP diff --git a/Trigger/TrigT1/TrigT1CTP/src/MsgWriter.cxx b/Trigger/TrigT1/TrigT1CTP/src/MsgWriter.cxx deleted file mode 100755 index 6fe0ab253c07f5b9296af0f6ad0d9eb294ecbac2..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/src/MsgWriter.cxx +++ /dev/null @@ -1,63 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#include "GaudiKernel/MsgStream.h" -#include "AthenaKernel/getMessageSvc.h" - -#include "TrigT1CTP/MsgWriter.h" - -namespace LVL1CTP { - - MsgWriter* MsgWriter::m_instance = 0; - - MsgWriter* MsgWriter::instance() { - - if( !m_instance ) m_instance = new MsgWriter(); - - return m_instance; - - } - - MsgWriter::~MsgWriter() { - - delete m_stream; - - } - - bool - MsgWriter::msgLvl (const MSG::Level lvl) const - { - if (m_stream->level() <= lvl) { - *m_stream << lvl; - return true; - } else { - return false; - } - } - - void MsgWriter::write( MSG::Level type, const std::string& line ) { - - if(m_stream->level() <= type){ - *m_stream << type << line << endmsg; - return; - } - return; - } - - void MsgWriter::setName( const std::string& name ) { - - if( m_stream ) delete m_stream; - m_stream = new MsgStream( Athena::getMessageSvc(), name ); - return; - - } - - MsgWriter::MsgWriter() { - - m_stream = new MsgStream( Athena::getMessageSvc(), "CTPSimulation" ); - - } - -} // namespace LVL1CTP diff --git a/Trigger/TrigT1/TrigT1CTP/src/PrescaledClockTrigger.cxx b/Trigger/TrigT1/TrigT1CTP/src/PrescaledClockTrigger.cxx deleted file mode 100755 index 344f88086da30c63fc53803a2dbbf6267b885bbd..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/src/PrescaledClockTrigger.cxx +++ /dev/null @@ -1,29 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#include "TrigT1CTP/PrescaledClockTrigger.h" - -// gaudi includes -#include "GaudiKernel/StatusCode.h" - -LVL1CTP::PrescaledClockTrigger::PrescaledClockTrigger() : - SpecialTrigger() -{} - -LVL1CTP::PrescaledClockTrigger::PrescaledClockTrigger(unsigned int clock_number, const unsigned int aRate, unsigned int ctpVersionNumber) : - SpecialTrigger(TrigConf::L1DataDef::PCLK, clock_number,ctpVersionNumber, aRate) -{} - -StatusCode -LVL1CTP::PrescaledClockTrigger::execute(int /*bcid=1*/) { - if (m_counter <= 0) m_counter = this->rate(); - m_counter -= 1.; - return StatusCode::SUCCESS; -} - -bool -LVL1CTP::PrescaledClockTrigger::evaluate() const { - return (m_counter <= 0); -} diff --git a/Trigger/TrigT1/TrigT1CTP/src/RandomTrigger.cxx b/Trigger/TrigT1/TrigT1CTP/src/RandomTrigger.cxx deleted file mode 100755 index fadf9b16842ffed5dd8749dd5667b5a83c360266..0000000000000000000000000000000000000000 --- a/Trigger/TrigT1/TrigT1CTP/src/RandomTrigger.cxx +++ /dev/null @@ -1,52 +0,0 @@ -/* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration -*/ - - -#include "TrigT1CTP/RandomTrigger.h" - -#include <iostream> -#include <assert.h> - -// gaudi includes -#include "GaudiKernel/StatusCode.h" - -// random number generator -#include "CLHEP/Random/RandomEngine.h" -#include "CLHEP/Random/RandFlat.h" - -LVL1CTP::RandomTrigger::RandomTrigger() : - SpecialTrigger(), - m_randEngine(0) -{ - Init(); -} - -LVL1CTP::RandomTrigger::RandomTrigger(unsigned int rand_number, const unsigned int aRate,unsigned int ctpVersionNumber, CLHEP::HepRandomEngine* randEng) : - SpecialTrigger(TrigConf::L1DataDef::RNDM, rand_number, ctpVersionNumber, aRate), - m_randEngine(randEng) -{ - Init(); -} - -LVL1CTP::RandomTrigger::~RandomTrigger() -{} - -void -LVL1CTP::RandomTrigger::Init() { - if (m_randEngine != 0) return; - std::cout << "Random engine not set up." << std::endl; - assert(0); -} - -StatusCode -LVL1CTP::RandomTrigger::execute(int /*bcid=1*/) { - // get next random number - m_counter = CLHEP::RandFlat::shoot(m_randEngine); - return StatusCode::SUCCESS; -} - -bool -LVL1CTP::RandomTrigger::evaluate() const { - return (m_counter >= (1.-1./this->rate())); -} diff --git a/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx b/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx old mode 100755 new mode 100644 index d21739c6c72d3cfa440ab8860287138fd2c211f6..8af8bd0f6e8bc90667818a6a5fdd1acb81baedad --- a/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx +++ b/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.cxx @@ -1,210 +1,283 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// STL includes: -#include <cassert> -#include <vector> -#include <sstream> -#include <iomanip> -#include <map> -#include <fstream> - -// Trigger configuration includes: -#include "TrigConfL1Data/CTPConfig.h" -#include "TrigConfL1Data/Menu.h" -#include "TrigConfL1Data/TriggerItem.h" +// Local includes: +#include "./ResultBuilder.h" +#include "./CTPTriggerThreshold.h" +#include "./CTPUtil.h" +#include "./CTPTriggerItem.h" +#include "./SpecialTrigger.h" // eformat for data fragments: #include "eformat/eformat.h" #include "eformat/SourceIdentifier.h" -// Output to the RoIB: -#include "TrigT1Interfaces/CTPSLink.h" - // Output to the DAQ: -#include "TrigT1Result/CTP_RDO.h" #include "TrigT1Result/Header.h" #include "TrigT1Result/Trailer.h" -// Local includes: -#include "TrigT1CTP/ResultBuilder.h" -#include "TrigT1CTP/ThresholdMap.h" -#include "TrigT1CTP/ItemMap.h" -#include "TrigT1CTP/CTPTriggerItemNode.h" -#include "TrigT1CTP/CTPTriggerThreshold.h" -#include "TrigT1CTP/EventInfo.h" -#include "TrigT1CTP/CTPUtil.h" -#include "TrigT1CTP/CTPTriggerItem.h" - -// tdaq-common includes for CTP format definition -//#include "CTPfragment/CTPdataformat.h" +// random number generator +#include "CLHEP/Random/RandomEngine.h" +#include "CLHEP/Random/RandFlat.h" + +// STL includes: +#include <vector> +#include <map> using namespace std; -LVL1CTP::ResultBuilder::ResultBuilder( unsigned int ctpVersionNumber, - const TrigConf::CTPConfig* ctpConfig, - const ThresholdMap* decisionMap, - const ItemMap* itemMap, - const InternalTriggerMap* internalTrigger, - const uint32_t readoutWindow) : - m_ctpConfig( ctpConfig ), - m_decisionMap( decisionMap ), - m_itemMap( itemMap ), - m_internalTrigger(internalTrigger), - m_ctpVersionNumber(ctpVersionNumber), - m_logger( "ResultBuilder" ), - m_readoutWindow(readoutWindow), - m_parseLine(0) +LVL1CTP::ResultBuilder::ResultBuilder( const std::string& type, + const std::string& name, + const IInterface* parent ) + : AthAlgTool(type, name, parent) { - - if( m_logger.msgLvl(MSG::VERBOSE) ) { - std::ostringstream message; - message << "Created with CTP version " << m_ctpVersionNumber; - m_logger.send( MSG::VERBOSE, message.str() ); - } - m_ctpDataFormat = new CTPdataformatVersion(m_ctpVersionNumber); - +} - // build TIP word - m_tip.resize(m_ctpDataFormat->getTIPwords()); - for (unsigned int i = 0; i < m_ctpDataFormat->getTIPwords(); ++i ) { - m_tip[i] = constructTIPWord( i ); // TIP + 1 extra word with rndm trigger, bcid etc. - } - m_logger.send( MSG::VERBOSE, "TIP build" ); - - // build trigger result before prescale - m_tbp.resize(m_ctpDataFormat->getTBPwords()); - for (unsigned int i = 0; i < m_ctpDataFormat->getTBPwords(); ++i ) { - m_tbp[i] = this->constructResultWord( i, TBP ); // TBP + +LVL1CTP::ResultBuilder::~ResultBuilder() { + delete m_ctpDataFormat; +} + +void +LVL1CTP::ResultBuilder::setRandomEngine( CLHEP::HepRandomEngine* rndmEngine ) { + m_rndmEngine = rndmEngine; +} + +StatusCode +LVL1CTP::ResultBuilder::setConfiguration( const TrigConf::CTPConfig* ctpConfig, + const TrigConf::L1Menu* l1menu ) const +{ + ATH_MSG_DEBUG( "Set configuration with CTP version " << m_ctpVersionNumber ); + + ConfigSource cfgsrc(ctpConfig, l1menu); + + StatusCode sc = createTriggerConfigMaps(cfgsrc); + + return sc; +} + + +StatusCode +LVL1CTP::ResultBuilder::createTriggerConfigMaps(const ConfigSource & cfgSrc) const { + + if( cfgSrc.l1menu() != nullptr ) { + + ATH_MSG_DEBUG("Creating trigger configuration maps from run-3-style menu"); + + std::vector<unsigned int> bg; bg.push_back( 1 ); + std::vector<unsigned int> bgEmpty; bgEmpty.push_back( 1 ); + + // declare internal bunch group triggers + for (size_t i = 0; i < 16; ++i) { + auto bgrp = new BunchGroupTrigger(i, bg, m_ctpDataFormat); + m_internalTrigger[ bgrp->name() ] = bgrp; + } + + // declare internal random triggers + for(int rndmIdx = 0; rndmIdx<4; rndmIdx++) { + auto rndm = new RandomTrigger(rndmIdx, m_ctpDataFormat); + m_internalTrigger[ rndm->name() ] = rndm; + } + + // build map of name to ctp thresholds + m_thrConfigMap = new ThresholdMap( cfgSrc.l1menu() ); + + // build map of name to ctp items + m_itemConfigMap = new ItemMap( cfgSrc.l1menu() ); + + } else if( cfgSrc.ctpConfig() != nullptr ) { + + ATH_MSG_DEBUG("Creating trigger configuration maps from run-2-style menu"); + + const std::vector<TrigConf::BunchGroup> & bunchGroups(cfgSrc.ctpConfig()->bunchGroupSet().bunchGroups()); + for (size_t i = 0; i < bunchGroups.size(); ++i) { + std::vector<unsigned int> bunches; + for(int b : bunchGroups[i].bunches()) { + bunches.push_back(b); + } + auto bgrp = new BunchGroupTrigger(i, bunches, m_ctpDataFormat); + m_internalTrigger[bgrp->name()] = bgrp; + } + + for(int rndmIdx = 0; rndmIdx<4; rndmIdx++) { + auto rndm = new RandomTrigger(rndmIdx, m_ctpDataFormat); + m_internalTrigger[ rndm->name() ] = rndm; + } + + m_thrConfigMap = new ThresholdMap( cfgSrc.ctpConfig()->menu().thresholdVector()); + + m_itemConfigMap = new ItemMap( cfgSrc.ctpConfig()->menu().itemVector(), + cfgSrc.ctpConfig()->prescaleSet() ); + } else { + ATH_MSG_FATAL("No L1 trigger menu was provided"); + return StatusCode::FAILURE; } - m_logger.send( MSG::VERBOSE, "TBP build" ); - - // build trigger result after prescale - m_tap.resize(m_ctpDataFormat->getTAPwords()); - for (unsigned int i = 0; i < m_ctpDataFormat->getTAPwords(); ++i ) { - m_tap[i] = this->constructResultWord( i, TAP ); // TAP + + return StatusCode::SUCCESS; +} + +StatusCode +LVL1CTP::ResultBuilder::constructTIPVector( const std::map<std::string, unsigned int> & thrMultiMap, + std::vector<uint32_t> & tip ) const +{ + + tip.resize( m_ctpDataFormat->getTIPwords(), 0 ); + + for( auto & entry : thrMultiMap ) { + const std::string & thrName = entry.first; + size_t multiplicity = entry.second; + + // if multiplicity is 0 then there is nothing to set + if(multiplicity==0) { + continue; + } + + auto x = m_internalTrigger.find(thrName); + if(x != m_internalTrigger.end()) { + // internal triggers (BGRP or RNDM) + + size_t wordNr = m_ctpDataFormat->getTIPwords() - 1; // internal triggers are stored in the last word + size_t posWithinWord = x->second->pitPos() % 32; + + tip[wordNr] |= ( 1L << posWithinWord ); + + } else { + // all other trigger threshold multiplicities + + const CTPTriggerThreshold & ctpTT = m_thrConfigMap->getCTPThreshold( thrName ); + size_t startBit = ctpTT.startBit(); + size_t nBits = ctpTT.endBit() - startBit + 1; + + // restrict to the maximum possible multiplicity + if(multiplicity >= (1U<<nBits)) { + multiplicity = (1U<<nBits)-1; + } + + size_t wordNr = startBit / 32; + size_t posWithinWord = startBit % 32; + + uint64_t result = multiplicity; // need 64 bit in case the word boundary is crossed by the threshold start..end + result <<= posWithinWord; + + tip[wordNr] |= result & 0xFFFFFFFF; + if(wordNr+1 < m_ctpDataFormat->getTIPwords()-1) { + tip[wordNr+1] |= uint32_t((result & 0xFFFFFFFF00000000) >> 32); + } + } } - m_logger.send( MSG::VERBOSE, "TAP build" ); - - // build trigger result after veto - m_tav.resize(m_ctpDataFormat->getTAVwords()); - for (unsigned int i = 0; i < m_ctpDataFormat->getTAVwords(); ++i ) { - m_tav[i] = this->constructResultWord( i, TAV ); // TAV + + size_t wrdNr(0); + for( uint32_t word : tip ) { + ATH_MSG_DEBUG( "REGTEST - " << "TIP word #" << std::dec << wrdNr++ + << " is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << word ); } - m_logger.send( MSG::VERBOSE, "TAV build" ); + return StatusCode::SUCCESS; } - -LVL1CTP::ResultBuilder::~ResultBuilder() { - if (m_ctpDataFormat) delete m_ctpDataFormat; - m_ctpDataFormat = NULL; - m_logger.send( MSG::VERBOSE, "Deleted" ); - -} - -bool -LVL1CTP::ResultBuilder::readOffsetConfig(const std::string& filename) { - if (filename.empty()) return false; - - m_logger.send( MSG::VERBOSE, "Reading offset configuration..." ); - - std::ifstream file(filename.c_str()); - std::string line; - m_parseLine = &LVL1CTP::ResultBuilder::findSectionParser; - while (std::getline(file,line)){ - const std::string::size_type lPos(line.find('#')); - if (lPos != std::string::npos) line.resize(lPos); - (this->*m_parseLine)(line); + +StatusCode +LVL1CTP::ResultBuilder::buildItemDecision( const std::map<std::string, unsigned int> & thrMultiMap, + std::map<std::string, unsigned int> & itemDecisionMap ) const +{ + // build trigger result for all items + itemDecisionMap.clear(); + + try { + for( auto itemName : m_itemConfigMap->itemNames() ) { + auto ctpItem = m_itemConfigMap->getItem(itemName); + + bool pass_beforePrescale = ctpItem->evaluate(thrMultiMap); + bool pass_afterPrescale = false; + bool pass_afterVeto = false; + + if ( pass_beforePrescale ) { + long random = CLHEP::RandFlat::shootInt(m_rndmEngine, pow(2,24) ); + int32_t cut = TrigConf::PrescaleSet::getCutFromPrescale( m_itemConfigMap->getItem( itemName )->prescale() ); + pass_afterPrescale = (random >= cut) && (cut > 0); // no pass if PS set to "-1" + pass_afterVeto = pass_afterPrescale; // dead time is not simulated + } + + unsigned int result = (pass_beforePrescale ? TBP : 0) + (pass_afterPrescale ? TAP : 0) + (pass_afterVeto ? TAV : 0); + + itemDecisionMap[itemName] = result; + } + } catch (TrigConf::LogicParsingException & ex) { + ATH_MSG_FATAL("Error in evaluating logic. " << ex.msg()); + return StatusCode::FAILURE; } - - m_logger.send( MSG::VERBOSE, "Offset configuration read" ); - return true; + return StatusCode::SUCCESS; } - -bool -LVL1CTP::ResultBuilder::findSectionParser(const std::string& line) { - std::istringstream inputStream(line); - std::string readWord; - if (inputStream >> readWord){ - if (readWord == "begin"){ - if (inputStream >> readWord){ - if (readWord == "StaticOffsetMap"){ - m_logger.send( MSG::VERBOSE, "Found StaticOffsetMap" ); - m_parseLine = &LVL1CTP::ResultBuilder::staticOffsetParser; - return true; - } // if (readWord == "StaticOffsetMap") - } // if (inputStream >> readWord) - } // if (readWord == "begin") - } // if (inputStream >> readWord) - return false; -} +StatusCode +LVL1CTP::ResultBuilder::constructResultVectors( const std::map<std::string, unsigned int> & itemDecisionMap, + std::vector<uint32_t> & tbp, std::vector<uint32_t> & tap, std::vector<uint32_t> & tav, + unsigned char & triggerType ) const +{ + tbp.resize( m_ctpDataFormat->getTBPwords(), 0 ); + tap.resize( m_ctpDataFormat->getTAPwords(), 0 ); + tav.resize( m_ctpDataFormat->getTAVwords(), 0 ); + triggerType = 0; - -bool -LVL1CTP::ResultBuilder::staticOffsetParser(const std::string& line) { - std::istringstream inputStream(line); - std::string readWord; - bool sc(false); - if (inputStream >> readWord){ - if (readWord == "end"){ - m_logger.send( MSG::VERBOSE, "Found end of StaticOffsetMap" ); - m_parseLine = &LVL1CTP::ResultBuilder::findSectionParser; - sc = true; - } else { - unsigned short firedItem(0); - std::istringstream wordStream(readWord); - if ((wordStream >> firedItem) && (firedItem < 256u)){ - std::stringstream configStream; - configStream << firedItem << ":\t"; - unsigned short offsetItem(0); - int offsetValue(0); - while (inputStream >> readWord){ - wordStream.clear(); - wordStream.str(readWord); - if ((wordStream >> offsetItem) && (offsetItem < 256u)){ - wordStream.ignore(); - if ((wordStream >> offsetValue) && (offsetValue != 0)){ - configStream << offsetItem << ',' << offsetValue << '\t'; - m_changeRules[firedItem][offsetItem] = offsetValue; - sc = true; - } // if ((wordStream >> offsetValue) && (offsetValue != 0)) - } // if ((wordStream >> offsetItem) && (offsetItem < 256u)) - } // while (inputStream >> readWord) - m_logger.send( MSG::VERBOSE, configStream.str().c_str() ); - } // if ((wordStream >> firedItem) && (firedItem < 256u)) - } // if (readWord == "end") {...} else - } // if (inputStream >> readWord) - return sc; + for( auto & entry : itemDecisionMap ) { + const std::string & itemName = entry.first; + unsigned int result = entry.second; + bool passBP = (result & TBP) != 0; + bool passAP = (result & TAP) != 0; + bool passAV = (result & TAV) != 0; + + + + + auto l1Item = m_itemConfigMap->getItem( itemName ); + + if( passAV ) { + triggerType |= l1Item->triggerType(); + } + + auto ctpId = l1Item->ctpId(); + unsigned int wordNr = ctpId / 32; + unsigned int posWithinWord = ctpId % 32; + + if( passBP ) { tbp[wordNr] |= 1L << posWithinWord; } + if( passAP ) { tap[wordNr] |= 1L << posWithinWord; } + if( passAV ) { tav[wordNr] |= 1L << posWithinWord; } + + ATH_MSG_DEBUG( " --> Trigger item " << itemName << + " is " << ( !passBP ? "INACTIVE" : ( passAV ? "ACTIVE" : "ACTIVE (but PRESCALED)" ) ) ); + } + ATH_MSG_DEBUG( "REGTEST - " << "TriggerType byte is: 0x" << std::hex << std::setw( 2 ) << std::setfill( '0' ) << triggerType ); + + return StatusCode::SUCCESS; } + + + -const LVL1CTP::CTPSLink* -LVL1CTP::ResultBuilder::constructRoIResult() const { - - m_logger.send( MSG::DEBUG, "Constructing RoI result" ); - - std::vector<uint32_t> roi_vector; +std::unique_ptr<LVL1CTP::CTPSLink> +LVL1CTP::ResultBuilder::constructRoIResult( const EventIDBase & eventID, + const std::vector<uint32_t> & tbp, + const std::vector<uint32_t> & tap, + const std::vector<uint32_t> & tav, + const std::vector<uint32_t> & tip, + const unsigned char triggerType ) const +{ // // Build the data words: // + std::vector<uint32_t> roi_vector; + roi_vector.push_back( eventID.time_stamp_ns_offset() ); // Time stamp: 28-bit nanoseconds + roi_vector.push_back( eventID.time_stamp() ); // Time stamp: 32-bit UTC seconds - roi_vector.push_back( EventInfo::instance().timeNs() ); // Time stamp: 28-bit nanoseconds - roi_vector.push_back( EventInfo::instance().time() ); // Time stamp: 32-bit UTC seconds - - roi_vector.insert(roi_vector.end(), m_tip.begin(), m_tip.end()); // TIP + 1 extra word - roi_vector.insert(roi_vector.end(), m_tbp.begin(), m_tbp.end()); // TBP - roi_vector.insert(roi_vector.end(), m_tap.begin(), m_tap.end()); // TAP - roi_vector.insert(roi_vector.end(), m_tav.begin(), m_tav.end()); // TAV - - // change fired trigger items to simulated badly timed-in subcomponents (if option requested) - changeRoIResult(roi_vector); + roi_vector.insert(roi_vector.end(), tip.begin(), tip.end()); // TIP + 1 extra word + roi_vector.insert(roi_vector.end(), tbp.begin(), tbp.end()); // TBP + roi_vector.insert(roi_vector.end(), tap.begin(), tap.end()); // TAP + roi_vector.insert(roi_vector.end(), tav.begin(), tav.end()); // TAV - m_logger.send( MSG::VERBOSE, "Stored data elements of RoI result" ); + ATH_MSG_VERBOSE( "Stored data elements of RoI result" ); // // Build the trailer: @@ -212,7 +285,7 @@ LVL1CTP::ResultBuilder::constructRoIResult() const { std::vector<unsigned int> trailer(ROIB::Trailer(roi_vector.size()).trailer()); roi_vector.insert(roi_vector.end(), trailer.begin(), trailer.end()); - m_logger.send( MSG::VERBOSE, "Created trailer of RoI result" ); + ATH_MSG_VERBOSE( "Created trailer of RoI result" ); // // Build the header: @@ -221,524 +294,85 @@ LVL1CTP::ResultBuilder::constructRoIResult() const { // convention for source id in LVL1: 0 for DAQ, 1 for RoIB ROIB::Header helperHeader(eformat::helper::SourceIdentifier(eformat::TDAQ_CTP, 1).code()); - helperHeader.setRunNumber(EventInfo::instance().runNumber()); - helperHeader.setL1ID(EventInfo::instance().extendedL1ID()); - helperHeader.setBCID(EventInfo::instance().bcid()); - helperHeader.setTriggerType(triggerType()); - helperHeader.setEventType(EventInfo::instance().eventType()); + helperHeader.setRunNumber( eventID.run_number()); + //helperHeader.setL1ID( eventID.extendedL1ID()); + helperHeader.setBCID( eventID.bunch_crossing_id()); + helperHeader.setTriggerType(triggerType); + //helperHeader.setEventType(EventInfo::instance().eventType()); std::vector<unsigned int> header(helperHeader.header()); roi_vector.insert(roi_vector.begin(), header.begin(), header.end()); - m_logger.send( MSG::VERBOSE, "Created header of RoI result" ); + ATH_MSG_VERBOSE( "Created header of RoI result" ); // // Build the SLink: // - CTPSLink* result = new CTPSLink( roi_vector, m_ctpVersionNumber ); - m_logger.send( MSG::DEBUG, "Created CTPSlink object" ); - m_logger.send( MSG::VERBOSE, "Dump CTPSlink object:\n" + result->dump() ); + std::unique_ptr<CTPSLink> result ( new CTPSLink( roi_vector, m_ctpVersionNumber )); + ATH_MSG_DEBUG( "Created CTPSlink object" ); + ATH_MSG_VERBOSE( "Dump CTPSlink object:\n" + result->dump() ); // - // Debug output for ANT + // Debug output for ART // - if( m_logger.msgLvl(MSG::DEBUG) ) { - { - std::vector<std::string> passedItems = firedItems(m_tbp); - std::ostringstream message; - for (size_t i(0); i < passedItems.size(); ++i) { - message << " " << passedItems[i]; - } - m_logger.send( MSG::DEBUG, "REGTEST - Items fired before prescale: " + message.str() ); + if( msgLvl(MSG::VERBOSE) ) { + for( auto & itemName : firedItems(tbp) ) { + ATH_MSG_VERBOSE( "REGTEST - Items fired before prescale: " << itemName ); } - { - std::vector<std::string> passedItems = firedItems(m_tap); - std::ostringstream message; - for (size_t i(0); i < passedItems.size(); ++i) { - message << " " << passedItems[i]; - } - m_logger.send( MSG::DEBUG, "REGTEST - Items fired after prescale: " + message.str() ); + for( auto & itemName : firedItems(tap) ) { + ATH_MSG_VERBOSE( "REGTEST - Items fired after prescale: " << itemName ); } - - { - std::vector<std::string> passedItems = firedItems(m_tav); - std::ostringstream message; - for (size_t i(0); i < passedItems.size(); ++i) { - message << " " << passedItems[i]; - } - m_logger.send( MSG::DEBUG, "REGTEST - Items fired after veto: " + message.str() ); + for( auto & itemName : firedItems(tav) ) { + ATH_MSG_VERBOSE( "REGTEST - Items fired after veto: " << itemName ); } } return result; } -const CTP_RDO* -LVL1CTP::ResultBuilder::constructRDOResult() const { - - m_logger.send( MSG::DEBUG, "Constructing RDO result" ); - - CTP_RDO* result = new CTP_RDO(m_ctpVersionNumber); - - result->setTimeSec(EventInfo::instance().time()); // Time stamp: 32-bit UTC seconds - result->setTimeNanoSec(EventInfo::instance().timeNs()); // Time stamp: 28-bit nanoseconds - +std::unique_ptr<CTP_RDO> +LVL1CTP::ResultBuilder::constructRDOResult( const EventIDBase & eventID, + const std::vector<uint32_t> & tbp, + const std::vector<uint32_t> & tap, + const std::vector<uint32_t> & tav, + const std::vector<uint32_t> & tip ) const +{ + std::unique_ptr<CTP_RDO> result( new CTP_RDO(m_ctpVersionNumber) ); + result->setTimeSec(eventID.time_stamp()); // Time stamp: 32-bit UTC seconds + result->setTimeNanoSec(eventID.time_stamp_ns_offset()); // Time stamp: 28-bit nanoseconds for (unsigned int i(0); i < m_ctpDataFormat->getTIPwords(); ++i) { - result->setTIPWord(i, m_tip[i]); + result->setTIPWord(i, tip[i]); } - - for (unsigned int i(0); i < m_tbp.size(); ++i) { - result->setTBPWord(i, m_tbp[i]); + for (unsigned int i(0); i < tbp.size(); ++i) { + result->setTBPWord(i, tbp[i]); } for (unsigned int i(0); i < m_ctpDataFormat->getTAPwords(); ++i) { - result->setTAPWord(i, m_tap[i]); + result->setTAPWord(i, tap[i]); } for (unsigned int i(0); i < m_ctpDataFormat->getTAPwords(); ++i) { - result->setTAVWord(i, m_tav[i]); + result->setTAVWord(i, tav[i]); } - - // change fired trigger items to simulated badly timed-in subcomponents - // and add additional BCs (if option requested) - changeRDOResult(result); - - m_logger.send( MSG::DEBUG, "Created CTP_RDO object" ); - + ATH_MSG_DEBUG( "Created CTP_RDO object" ); return result; - -} - - -void -LVL1CTP::ResultBuilder::changeTriggerWords(std::vector<uint32_t>& triggerWords) const { - // check if anything needs to be done at all - if ((m_changeRules.size() == 0) || (triggerWords.size() != m_ctpDataFormat->getTAVwords())) return; - - // loop over the rules defined in the config file - for (ChangeRulesMap::const_iterator it(m_changeRules.begin()); it != m_changeRules.end(); ++it){ - - // 32-bit word that holds the current trigger bit - const unsigned short iWord(it->first/32u); - // bit within the current word that fired - const unsigned short iPos(it->first%32u); - // 32-bit trigger mask that has only the current bit 'on' - const unsigned short firedMask(1u << iPos); - - // check if the current bit has actually fired in the event - if (triggerWords[iWord] & firedMask){ - - // this map now contains the items that are supposed to be shifted by the configured offset - const OffsetMap& triggerOffsets = it->second; - // loop over the items that shall be shifted - for (OffsetMap::const_iterator jt(triggerOffsets.begin()); jt != triggerOffsets.end(); ++jt){ - // offset map should never be filled when offset is 0 - if (jt->second == 0) continue; - - // same as above, determine the word... - unsigned short jWord(jt->first/32u); - // the position ... - const unsigned short jPos(jt->first%32u); - // and the bitmask of the item - const unsigned short bitMask(1u << jPos); - - // and now eliminate this item in the trigger pattern - triggerWords[jWord] &= ~bitMask; - } // for (OffsetMap::const_iterator jt(triggerOffsets.begin()); jt != triggerOffsets.end(); ++jt) - - } // if(tav[iWord] & firedMask) - - } // for (ChangeRulesMap::const_iterator it(m_changeRules.begin()); it != m_changeRules.end(); ++it) - - return; } - -void -LVL1CTP::ResultBuilder::changeRoIResult(std::vector<uint32_t>& roi_vector) const { - // check if anything needs to be done at all - if ((m_changeRules.size() == 0) || - (roi_vector.size() != m_ctpDataFormat->getNumberTimeWords() + m_ctpDataFormat->getDAQwordsPerBunch())) return; - - std::vector<uint32_t> tav(roi_vector.end()-m_ctpDataFormat->getTAVwords(), roi_vector.end()); - - // loop over the rules defined in the config file - for (ChangeRulesMap::const_iterator it(m_changeRules.begin()); it != m_changeRules.end(); ++it){ - - // 32-bit word that holds the current trigger bit - const unsigned short iWord(it->first/32u); - // bit within the current word that fired - const unsigned short iPos(it->first%32u); - // 32-bit trigger mask that has only the current bit 'on' - const unsigned short firedMask(1u << iPos); - - // check if the current bit has actually fired in the event - if(tav[iWord] & firedMask){ - - // this map now contains the items that are supposed to be shifted by the configured offset - const OffsetMap& triggerOffsets = it->second; - // loop over the items that shall be shifted - for (OffsetMap::const_iterator jt(triggerOffsets.begin()); jt != triggerOffsets.end(); ++jt){ - // offset map should never be filled when offset is 0 - if (jt->second == 0) continue; - // same as above, determine the word... - unsigned short jWord(jt->first/32u); - // the position ... - const unsigned short jPos(jt->first%32u); - // and the bitmask of the item - const unsigned short bitMask(1u << jPos); - // and now eliminate this item in the trigger pattern - tav[jWord] &= ~bitMask; - // account for the number of time words - jWord += 2u; - // TODO: manipulate TIP - jWord += m_ctpDataFormat->getTIPwords(); - // manipulate TBP, eliminate this item - roi_vector[jWord] &= ~bitMask; - jWord += m_ctpDataFormat->getTBPwords(); - // manipulate TAP, eliminate this item - roi_vector[jWord] &= ~bitMask; - jWord += m_ctpDataFormat->getTAPwords(); - // manipulate TAV, eliminate this item - roi_vector[jWord] &= ~bitMask; - } // for (OffsetMap::const_iterator jt(triggerOffsets.begin()); jt != triggerOffsets.end(); ++jt) - } // if(tav[iWord] & firedMask) - } // for (ChangeRulesMap::const_iterator it(m_changeRules.begin()); it != m_changeRules.end(); ++it) - - return; -} - - -void -LVL1CTP::ResultBuilder::changeRDOResult(CTP_RDO*& result) const { - // check if anything needs to be done at all - if ((m_changeRules.size() == 0)||(result == 0)) return; - - std::vector<uint32_t> tav = result->getTAVWords(); - std::vector<uint32_t> tap = result->getTAPWords(); - std::vector<uint32_t> tbp = result->getTBPWords(); - std::vector<uint32_t> tip = result->getTIPWords(); - - // create a new CTP_RDO object that has the requested size - CTP_RDO* new_result = new CTP_RDO(m_ctpVersionNumber,m_readoutWindow); - - new_result->setTimeSec(result->getTimeSec()); - new_result->setTimeNanoSec(result->getTimeNanoSec()); - - delete result; - result = new_result; - - typedef std::map<unsigned short, uint32_t> WordMap; - typedef std::map<uint32_t, WordMap> ResultMap; - ResultMap tbp_result; - ResultMap tap_result; - - // loop over the rules defined in the config file - for (ChangeRulesMap::const_iterator it(m_changeRules.begin()); it != m_changeRules.end(); ++it){ - // 32-bit word that holds the current trigger bit - const unsigned short iWord(it->first/32u); - // bit within the current word that fired - const unsigned short iPos(it->first%32u); - // 32-bit trigger mask that has only the current bit 'on' - const unsigned short firedMask(1u << iPos); - // check if the current bit has actually fired in the event - if(tav[iWord] & firedMask){ - // this map now contains the items that are supposed to be shifted by the configured offset - const OffsetMap& triggerOffsets = it->second; - // loop over the items that shall be shifted - for (OffsetMap::const_iterator jt(triggerOffsets.begin()); jt != triggerOffsets.end(); ++jt){ - // offset map should never be filled when offset is 0 - if (jt->second == 0) continue; - // same as above, determine the word... - const unsigned short jWord(jt->first/32u); - // the position ... - const unsigned short jPos(jt->first%32u); - // and the bitmask of the item - const unsigned short bitMask(1u << jPos); - // TODO: manipulate TIP - - // only continue if the item appears in the tbp - if (tbp[jWord] & bitMask) { - // eliminate it in the tbp for the current BC - tbp[jWord] &= ~bitMask; - // get the offset that will be added - const int offset(jt->second + (m_readoutWindow-1u)/2u); - // check if the offset is in the range of the readoutwindow - const bool inRange((0 < offset)&&(static_cast<uint32_t>(offset) < m_readoutWindow)); - if (inRange){ - // switch on the corresponding bit, shifted by 'offset' - tbp_result[offset][jWord] |= bitMask; - } - // only continue if the item appears in the tap - if (tap[jWord] & bitMask){ - // eliminate it in the tap for the current BC - tap[jWord] &= ~bitMask; - if (inRange){ - // switch on the corresponding bit, shifted by 'offset' - tap_result[offset][jWord] |= bitMask; - } - // if (tav[jWord] & bitMask){ - - // and now eliminate the bit from the tav - tav[jWord] &= ~bitMask; - // } - } // if (tap[jWord] & bitMask) - } // if (tbp[jWord] & bitMask) - } // for (OffsetMap::const_iterator jt(triggerOffsets.begin()); jt != triggerOffsets.end(); ++jt) - } // if(tav[iWord] & firedMask) - } // for (ChangeRulesMap::const_iterator it(m_changeRules.begin()); it != m_changeRules.end(); ++it) - - // and now copy the trigger bits to the actual result - - // for the tbp - for (ResultMap::const_iterator it(tbp_result.begin()); it != tbp_result.end(); ++it){ - result->selectBunch(it->first); - const WordMap& dataWords(it->second); - for (WordMap::const_iterator jt(dataWords.begin()); jt != dataWords.end(); ++jt){ - result->setTBPWord(jt->first, jt->second); - } - } - // for the tap - for (ResultMap::const_iterator it(tap_result.begin()); it != tap_result.end(); ++it){ - result->selectBunch(it->first); - const WordMap& dataWords(it->second); - for (WordMap::const_iterator jt(dataWords.begin()); jt != dataWords.end(); ++jt){ - result->setTAPWord(jt->first, jt->second); - } - } - - // the L1A is assumed to be in the middle of the readout window - result->selectBunch((m_readoutWindow-1u)/2u); - - // for the BC of the L1A, we also set the tip and the tav - unsigned short i(0u); - for (std::vector<uint32_t>::const_iterator it(tip.begin()); it != tip.end(); ++it, ++i){ - result->setTIPWord(i, *it); - } - i=0u; - for (std::vector<uint32_t>::const_iterator it(tbp.begin()); it != tbp.end(); ++it, ++i){ - result->setTBPWord(i, *it); - } - i=0u; - for (std::vector<uint32_t>::const_iterator it(tap.begin()); it != tap.end(); ++it, ++i){ - result->setTAPWord(i, *it); - } - i=0u; - for (std::vector<uint32_t>::const_iterator it(tav.begin()); it != tav.end(); ++it, ++i){ - result->setTAVWord(i, *it); - } - - return; -} - - -uint32_t -LVL1CTP::ResultBuilder::extendedLevel1ID() const { - //if MC extendedLVL1ID will be 0, otherwise will !=0 - uint32_t id = EventInfo::instance().extendedL1ID()?EventInfo::instance().extendedL1ID():EventInfo::instance().eventNumber(); - - if( m_logger.msgLvl(MSG::DEBUG) ) { - std::ostringstream message; - message << "Created extendedLevel1ID: " << id; - m_logger.send( MSG::DEBUG, "REGTEST - " + message.str() ); - } - return id; -} - -/** - * Constructs the TIP words, which store the information about the threshold multiplicities - * sent to the CTP in the event. - */ -uint32_t -LVL1CTP::ResultBuilder::constructTIPWord( unsigned int wrd_num ) const { - - if( wrd_num < m_ctpDataFormat->getTIPwords()-1 ) { //TIP words are input bits + 1 additional word => hence -1 - - uint32_t result = 0; - - for( const TrigConf::TriggerThreshold* threshold : m_ctpConfig->menu().thresholdVector() ) { - - const CTPTriggerThreshold* ctpTT = m_decisionMap->decision( threshold ); - - if ( ( ( ctpTT->startBit() >= 32*wrd_num ) && ( ctpTT->startBit() < 32*(wrd_num+1) ) ) || - ( ( ctpTT->endBit() >= 32*wrd_num ) && ( ctpTT->endBit() < 32*(wrd_num+1) ) ) - ) { - - result |= CTPUtil::alignBits( ctpTT->value(), - ctpTT->startBit() - 32*wrd_num, - ctpTT->endBit() - 32*wrd_num - ); - } - - } - - if( m_logger.msgLvl(MSG::DEBUG) ) { - std::ostringstream message; - message << "TIP word #" << std::dec << wrd_num << " is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << result; - m_logger.send( MSG::DEBUG, "REGTEST - " + message.str() ); - } - return result; - - } else if( wrd_num == m_ctpDataFormat->getAuxTIPwordPos()-1 ) { // This is a special word. (And I don't calculate it at the moment...) - - uint32_t result = 0; - - for (InternalTriggerMap::const_iterator iter = m_internalTrigger->begin(); iter != m_internalTrigger->end(); - ++iter) { - result |= CTPUtil::alignBits( iter->second->evaluate(), iter->second->pit() - 32*wrd_num, iter->second->pit() - 32*wrd_num); - } - - if( m_logger.msgLvl(MSG::DEBUG) ) { - std::ostringstream message; - message << "TIP word #" << std::dec << wrd_num << " is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << result; - m_logger.send( MSG::DEBUG, "REGTEST - " + message.str() ); - } - return result; - - } else { - std::ostringstream message; - message << "ResultBuilder::constructTIPWord() called with wrd_num = " << wrd_num; - m_logger.send( MSG::FATAL, message.str() ); - assert( 0 ); - } - - return 0; - -} - - -/** - * Constructs the Trigger Before Prescale words. - */ -uint32_t -LVL1CTP::ResultBuilder::constructResultWord(unsigned int wrd_num, WrdType type ) const { - - - if( wrd_num >= m_ctpDataFormat->getTBPwords() ) { - - std::ostringstream message; - message << "ResultBuilder::constructResultWord() called with wrd_num = " << wrd_num; - m_logger.send( MSG::FATAL, message.str() ); - assert( 0 ); - - } - - - uint32_t result = 0; - - for( auto item : m_ctpConfig->menu().itemVector() ) { - - if( ( m_itemMap->getItem( item )->itemPos() >= 32 * wrd_num ) && - ( m_itemMap->getItem( item )->itemPos() < 32 * ( wrd_num + 1 ) ) ) { - - bool decision = CTPTriggerItemNode::evaluate( item->topNode(), m_decisionMap, m_internalTrigger ); - - std::string sDecision = decision ? "ACTIVE" : "INACTIVE"; - - if( type == TBP ) { - - result |= CTPUtil::alignBits( ( decision ? 1 : 0 ), - m_itemMap->getItem( item )->itemPos() - 32 * wrd_num, - m_itemMap->getItem( item )->itemPos() - 32 * wrd_num ); - - } else if( type == TAP ) { - - //const bool pass_prescale = m_itemMap->getItem( *item )->prescaleCounter() == m_itemMap->getItem( *item )->prescale(); - //for float prescales - int32_t cut = TrigConf::PrescaleSet::getCutFromPrescale( m_itemMap->getItem( item )->prescale() ); - const bool pass_prescale = (m_itemMap->getItem( item )->prescaleCounter() >= cut) && cut > 0; // no pass if PS set to "-1" - - result |= CTPUtil::alignBits( ( decision & pass_prescale ? 1 : 0 ), - m_itemMap->getItem( item )->itemPos() - 32 * wrd_num, - m_itemMap->getItem( item )->itemPos() - 32 * wrd_num ); - - if (decision == true && pass_prescale == false) sDecision = "INACTIVE(PRESCALED)"; - - } else if( type == TAV ) { - - //for float prescales - int32_t cut = TrigConf::PrescaleSet::getCutFromPrescale( m_itemMap->getItem( item )->prescale() ); - const bool pass_prescale = (m_itemMap->getItem( item )->prescaleCounter() >= cut) && cut > 0; // no pass if PS set to "-1" - - const bool pass_veto = true; // xxx apply dead time - - result |= CTPUtil::alignBits( ( decision & pass_prescale & pass_veto ? 1 : 0 ), - m_itemMap->getItem( item )->itemPos() - 32 * wrd_num, - m_itemMap->getItem( item )->itemPos() - 32 * wrd_num ); - - if (decision == true && pass_prescale == true && pass_veto == false) sDecision = "INACTIVE(VETOED)"; - - } - - if( m_logger.msgLvl(MSG::VERBOSE) ) { - std::ostringstream message; - message << " --> Trigger item " << std::setw( 12 ) << item->name() << " is " << sDecision; - m_logger.send( MSG::VERBOSE, message.str() ); - } - - } - - } - - if( m_logger.msgLvl(MSG::DEBUG) ) { - std::ostringstream message; - if( type == TBP ) message << "TBP"; - else if( type == TAP ) message << "TAP"; - else if( type == TAV ) message << "TAV"; - message << " word #" << std::dec << wrd_num << " is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << result; - m_logger.send( MSG::DEBUG, "REGTEST - " + message.str() ); - } - return result; - -} -uint32_t -LVL1CTP::ResultBuilder::constructTriggerType(const std::vector<uint32_t>& triggerWords) const { - uint32_t tt = 0; - - // change fired trigger items to simulated badly timed-in subcomponents (if option requested) - std::vector<uint32_t> updatedTriggerWords(triggerWords); - changeTriggerWords(updatedTriggerWords); - - // convert trigger result into bitset - std::bitset<512> items = CTPUtil::convertToLargeBitset(updatedTriggerWords); - - // loop over all items and or the trigger type for all fired items - for( TrigConf::ItemContainer::const_iterator item = m_ctpConfig->menu().itemVector().begin(); - item != m_ctpConfig->menu().itemVector().end(); ++item ) { - if (items[(*item)->ctpId()]) tt |= (*item)->triggerType(); - } - - // print output - if( m_logger.msgLvl(MSG::VERBOSE) ) { - for (unsigned int i(0); i < 8; ++i) { - std::ostringstream message; - message << "TriggerType bit" << i << " is: " << ( (tt & (0x1 << i)) ? "ACTIVE" : "INACTIVE" ); - m_logger.send( MSG::VERBOSE, message.str() ); - } - } - - if( m_logger.msgLvl(MSG::DEBUG) ) { - std::ostringstream message; - message << "TriggerType word is: 0x" << std::hex << std::setw( 8 ) << std::setfill( '0' ) << tt; - m_logger.send( MSG::DEBUG, "REGTEST - " + message.str() ); - } - return tt; -} std::vector<std::string> LVL1CTP::ResultBuilder::firedItems(const std::vector<uint32_t>& triggerWords) const { - const std::bitset<512> items = CTPUtil::convertToLargeBitset(triggerWords); - std::vector<std::string> passedItems; - - for( TrigConf::ItemContainer::const_iterator item = m_ctpConfig->menu().itemVector().begin(); - item != m_ctpConfig->menu().itemVector().end(); ++item ) { - if (items[(*item)->ctpId()]) passedItems.push_back((*item)->name()); + std::vector<std::string> passedItems; + for( const std::string & itemName : m_itemConfigMap->itemNames() ) { + auto item = m_itemConfigMap->getItem(itemName); + size_t idx = item->ctpId() / 32; + size_t bit = item->ctpId() % 32; + if ( triggerWords[idx] % (1L << bit) ) { + passedItems.push_back(item->name()); + } } - std::sort(passedItems.begin(), passedItems.end()); - return passedItems; } diff --git a/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.h b/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.h new file mode 100644 index 0000000000000000000000000000000000000000..42f590089d948fd9f8dd38efcec7a8e37369063f --- /dev/null +++ b/Trigger/TrigT1/TrigT1CTP/src/ResultBuilder.h @@ -0,0 +1,113 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + + +#ifndef TRIGT1CTP_RESULTBUILDER_H +#define TRIGT1CTP_RESULTBUILDER_H + +// local includes +//#include "./SpecialTrigger.h" +#include "./ThresholdMap.h" +#include "./ItemMap.h" + +#include <stdint.h> + +// For handling different CTP versions: +#include "CTPfragment/CTPdataformatVersion.h" +#include "GaudiKernel/EventIDBase.h" + +#include "AthenaBaseComps/AthAlgTool.h" + +// L1 configuration data +#include "TrigConfData/L1Menu.h" +#include "TrigConfL1Data/CTPConfig.h" +#include "TrigConfL1Data/Menu.h" +#include "TrigConfL1Data/TriggerItem.h" + +// Output to the RoIB: +#include "TrigT1Interfaces/CTPSLink.h" + +// Output to the DAQ: +#include "TrigT1Result/CTP_RDO.h" + +#include "CLHEP/Random/RandomEngine.h" + +namespace LVL1CTP { + + /** + * + * @short Class used to create the CTP output (RDO, SLink and TriggerInfo) + */ + + class ResultBuilder : public AthAlgTool { + + public: + + ResultBuilder( const std::string& type, const std::string& name, const IInterface* parent ); + ~ResultBuilder(); + + void setRandomEngine( CLHEP::HepRandomEngine* rndmEngine ); + + StatusCode setConfiguration( const TrigConf::CTPConfig* ctpConfig, + const TrigConf::L1Menu* l1menu ) const; + + StatusCode buildItemDecision( const std::map<std::string, unsigned int> & thrMultiMap, + std::map<std::string, unsigned int> & itemDecisionMap ) const; + + + StatusCode constructResultVectors( const std::map<std::string, unsigned int> & itemDecisionMap, + std::vector<uint32_t> & tbp, std::vector<uint32_t> & tap, std::vector<uint32_t> & tav, + unsigned char & triggerType ) const; + + + StatusCode constructTIPVector( const std::map<std::string, unsigned int> & thrMultiMap, + std::vector<uint32_t> & tip ) const; + + + //! build RoI result (LVL1CTP::CTPSLink) + std::unique_ptr<CTPSLink> constructRoIResult( const EventIDBase & eventID, + const std::vector<uint32_t> & tbp, const std::vector<uint32_t> & tap, + const std::vector<uint32_t> & tav, const std::vector<uint32_t> & tip, + const unsigned char triggerType ) const; + + //! build RDO result (CTP_RDO) + std::unique_ptr<CTP_RDO> constructRDOResult( const EventIDBase & eventID, + const std::vector<uint32_t> & tbp, const std::vector<uint32_t> & tap, + const std::vector<uint32_t> & tav, const std::vector<uint32_t> & tip ) const; + + private: + + struct ConfigSource { + ConfigSource(const TrigConf::CTPConfig* ctpConfig, const TrigConf::L1Menu* l1menu) : m_ctpConfig(ctpConfig), m_l1menu(l1menu) {} + const TrigConf::CTPConfig* m_ctpConfig {nullptr}; // run 2 + const TrigConf::L1Menu * m_l1menu { nullptr }; // run 3 + const TrigConf::CTPConfig* ctpConfig() const { return m_ctpConfig; } + const TrigConf::L1Menu* l1menu() const { return m_l1menu; } + }; + + enum WrdType { TBP = 0x01, TAP = 0x02, TAV = 0x04 }; + + StatusCode createTriggerConfigMaps(const ConfigSource & cfgSrc) const; + + //! build list of fired items and dump to string + std::vector<std::string> firedItems(const std::vector<uint32_t>& triggerWords) const; + + // configuration information + mutable ThresholdMap* m_thrConfigMap ATLAS_THREAD_SAFE { nullptr }; //!< Map between threshold objects and their CTP-internal description + mutable ItemMap* m_itemConfigMap ATLAS_THREAD_SAFE { nullptr }; //!< Map between item objects and their CTP-internal description + mutable InternalTriggerMap m_internalTrigger ATLAS_THREAD_SAFE; //!< internal triggers BGRP and RNDM + unsigned int m_ctpVersionNumber { 4 }; //!< CTP data format version (4 in most of Run 2 and in Run 3) + CTPdataformatVersion* m_ctpDataFormat { nullptr }; //!< CTP data format details + CLHEP::HepRandomEngine* m_rndmEngine; //!< for random prescaling + }; + + + // typedefs + + // generic typedef for easy access to TIP/TBP/TAP/TAV information + typedef std::vector<uint32_t> (ResultBuilder::*Result)() const; + +} // namespace LVL1CTP + +#endif // TRIGT1CTP_RESULTBUILDER_H diff --git a/Trigger/TrigT1/TrigT1CTP/src/SpecialTrigger.cxx b/Trigger/TrigT1/TrigT1CTP/src/SpecialTrigger.cxx old mode 100755 new mode 100644 index cc1ba5cbacfea9ef97c098c360f8e46d003231cf..2143fafe5d2b2c923da36b4d09f4c268f480beed --- a/Trigger/TrigT1/TrigT1CTP/src/SpecialTrigger.cxx +++ b/Trigger/TrigT1/TrigT1CTP/src/SpecialTrigger.cxx @@ -1,106 +1,21 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -#include "TrigT1CTP/SpecialTrigger.h" +#include "./SpecialTrigger.h" -#include "boost/lexical_cast.hpp" +LVL1CTP::RandomTrigger::RandomTrigger( size_t rndmNr, + const CTPdataformatVersion * ctpFormat) : + m_rndmNr(rndmNr), + m_pitPos(ctpFormat->getMaxTIPtotal() + ctpFormat->getRandomTrigShift() + rndmNr) +{} -#include <sstream> -#include <stdexcept> -using namespace std; +LVL1CTP::BunchGroupTrigger::BunchGroupTrigger( size_t bgrpNr, + const std::vector<unsigned int>& bunches, + const CTPdataformatVersion * ctpFormat) : + m_bunches(bunches), + m_bgrpNr(bgrpNr), + m_pitPos(ctpFormat->getMaxTIPtotal() + ctpFormat->getBunchGroupShift() + bgrpNr) +{} -LVL1CTP::SpecialTrigger::SpecialTrigger() : - m_rate(1), - m_counter(1), - m_type(TrigConf::L1DataDef::UNDEF), - m_thrNumber(0), - m_ctpVersionNumber(4) -{ - m_ctpVersion = new CTPdataformatVersion(m_ctpVersionNumber); -} - -LVL1CTP::SpecialTrigger::SpecialTrigger(TrigConf::L1DataDef::TriggerType tt, unsigned int thrnumber, unsigned int ctpVersionNumber) : - m_rate(1), - m_counter(1), - m_type(tt), - m_thrNumber(thrnumber), - m_ctpVersionNumber(ctpVersionNumber) -{ - m_ctpVersion = new CTPdataformatVersion(m_ctpVersionNumber); -} - -LVL1CTP::SpecialTrigger::SpecialTrigger(TrigConf::L1DataDef::TriggerType tt, unsigned int thrnumber, unsigned int ctpVersionNumber, const unsigned int rate) : - m_rate(rate), - m_counter(rate), - m_type(tt), - m_thrNumber(thrnumber), - m_ctpVersionNumber(ctpVersionNumber) -{ - m_ctpVersion = new CTPdataformatVersion(m_ctpVersionNumber); -} - -LVL1CTP::SpecialTrigger::~SpecialTrigger() -{ - if (m_ctpVersion) delete m_ctpVersion; - m_ctpVersion = NULL; - -} - -string -LVL1CTP::SpecialTrigger::name() const { - return TrigConf::L1DataDef::typeAsString(m_type) + boost::lexical_cast<string,unsigned int>(m_thrNumber); -} - -unsigned int -LVL1CTP::SpecialTrigger::rate() const { - return m_rate; -} - -unsigned int -LVL1CTP::SpecialTrigger::pit() const { - /* - This information is stored in an additional (or auxiliary) word in the event format, after the trigger input words. - The lowest 4 bits of this word are used for BCID information, - then there are the bunchgroup triggers, the random triggers and the prescaled clock triggers - */ - switch (m_type) { - case TrigConf::L1DataDef::BGRP: - //return 160 + m_thrNumber; //this is a bug! the 4 lowest bits are the BCID! should be 164 + threshold number - return m_ctpVersion->getMaxTIPtotal() + m_ctpVersion->getBunchGroupShift() + m_thrNumber; - case TrigConf::L1DataDef::RNDM: - //return 172 + m_thrNumber; - return m_ctpVersion->getMaxTIPtotal() + m_ctpVersion->getRandomTrigShift() + m_thrNumber; - case TrigConf::L1DataDef::PCLK: - //return 174 + m_thrNumber; - if (m_ctpVersionNumber>3) { - throw runtime_error("There are no prescaled clock triggers in CTP version " + std::to_string(m_ctpVersionNumber)); - return 9999; - }else { - return m_ctpVersion->getMaxTIPtotal() + m_ctpVersion->getPrescaledClockShift() + m_thrNumber; - } - case TrigConf::L1DataDef::UNDEF: - return 0; - default: - throw runtime_error(TrigConf::L1DataDef::typeAsString(m_type) + " is not an internal trigger"); - } - return 0; -} - -string -LVL1CTP::SpecialTrigger::print() const { - std::ostringstream s; - - s << "Name: " << this->name() << " Counter: " << m_counter << "/" << this->rate() - << " " << ( this->evaluate() ? "ACTIVE" : "INACTIVE" ); - - return s.str(); -} - -string -LVL1CTP::SpecialTrigger::dump() const { - std::ostringstream s; - s << this->name() << " " << this->rate() << " " << m_counter << " " << this->evaluate(); - return s.str(); -} diff --git a/Trigger/TrigT1/TrigT1CTP/src/SpecialTrigger.h b/Trigger/TrigT1/TrigT1CTP/src/SpecialTrigger.h new file mode 100644 index 0000000000000000000000000000000000000000..cfb678d61f33378fed94e2a88d6b49dbb225010d --- /dev/null +++ b/Trigger/TrigT1/TrigT1CTP/src/SpecialTrigger.h @@ -0,0 +1,85 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ +#ifndef TRIGT1CTP_ISPECIAL_TRIGGER_H +#define TRIGT1CTP_ISPECIAL_TRIGGER_H + +#include "CTPfragment/CTPdataformatVersion.h" + +// STL include(s): +#include <vector> +#include <string> +#include <map> + +namespace LVL1CTP { + + class ISpecialTrigger; + typedef std::map< std::string, const ISpecialTrigger*> InternalTriggerMap; + + + /* @brief Interface for internal trigger classes */ + class ISpecialTrigger { + public: + virtual ~ISpecialTrigger() {} + virtual std::string name() const = 0; //!< get name of internal trigger + virtual size_t pitPos() const = 0; //!< get signal position on PIT bus + }; + + + + class RandomTrigger : public ISpecialTrigger { + public: + RandomTrigger() = delete; + RandomTrigger( size_t rndmNr, const CTPdataformatVersion * ctpFormat); + virtual ~RandomTrigger() {} + std::string name() const + { return "RNDM" + std::to_string(m_rndmNr); } + size_t pitPos() const + {return m_pitPos; } + private: + size_t m_rndmNr; //!< nr of the bunchgroup 0..15 + size_t m_pitPos; //!< global bit in the TIP vector + }; + + + + + /** @brief Class for simulating the internal bunch group trigger */ + class BunchGroupTrigger : public ISpecialTrigger { + public: + BunchGroupTrigger() = delete; + BunchGroupTrigger( size_t bgrpNr, + const std::vector<unsigned int>& bunches, + const CTPdataformatVersion * ctpFormat); + virtual ~BunchGroupTrigger() {} + std::string name() const + { return "BGRP" + std::to_string(m_bgrpNr); } + size_t pitPos() const + {return m_pitPos; } + private: + std::vector<unsigned int> m_bunches; //!< list of bunch IDs + size_t m_bgrpNr; //!< nr of the bunchgroup 0..15 + size_t m_pitPos; //!< global bit in the TIP vector + }; + +} + + + + + + + + + + + + + + + + + + + +#endif diff --git a/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.cxx b/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.cxx old mode 100755 new mode 100644 index 3ca545def376d9bcacad2ba9b099655510893c48..fd53c0d3fa9077e0cd9cad08c8b5a72430f390a9 --- a/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.cxx +++ b/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.cxx @@ -1,169 +1,103 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ +#include "./ThresholdMap.h" -#include <sstream> -#include <iomanip> #include <cstdlib> -#include "TrigConfL1Data/TriggerThreshold.h" -#include "TrigConfL1Data/PIT.h" -#include "TrigConfL1Data/TIP.h" -#include "TrigT1CTP/ThresholdMap.h" -#include "TrigT1CTP/CTPTriggerThreshold.h" -#include "CTPfragment/CTPdataformatVersion.h" -using namespace std; - -namespace LVL1CTP { - - ThresholdMap::ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector) - : m_logger( "ThresholdMap" ) { - - m_logger.send( MSG::VERBOSE, "Created" ); - - m_logger.send( MSG::DEBUG, "Creating CTPTriggerThreshold objects for each TrigConf::TriggerThreshold object..." ); - unsigned int start = 0; - - for ( vector< TrigConf::TriggerThreshold* >::const_iterator it = threshold_vector.begin(); it != threshold_vector.end(); ++it ) { - - m_map[ *it ] = new CTPTriggerThreshold( *it ); - unsigned int end = start + abs( ( *it )->cableStart() - ( *it )->cableEnd() ); - m_map[ *it ]->setStartBit( start ); - m_map[ *it ]->setEndBit( end ); - - ostringstream message; - message << " --> Created object for threshold with name: " << setw( 10 ) << ( *it )->name() << " from TIP = " << setw( 3 ) << start << " to TIP = " << setw( 3 ) << end; - m_logger.send( MSG::VERBOSE, message.str() ); - - start = end + 1; - } - - m_logger.send( MSG::DEBUG, "Creating objects done" ); - - } - - ThresholdMap::ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector, - const std::vector< TrigConf::PIT* >& pit_vector) - : m_logger( "ThresholdMap" ) { - - m_logger.send( MSG::VERBOSE, "Created" ); - - - ostringstream testmessage; - testmessage << "Length of PIT vector: " << pit_vector.size(); - m_logger.send(MSG::DEBUG, testmessage.str()); - - m_logger.send( MSG::DEBUG, "Creating CTPTriggerThreshold objects for each TrigConf::TriggerThreshold object..." ); - - - for ( vector< TrigConf::TriggerThreshold* >::const_iterator it = threshold_vector.begin(); it != threshold_vector.end(); ++it ) { - - m_map[ *it ] = new CTPTriggerThreshold( *it ); - - //default pit values: used if threshold doesn't have a corresponding pit bit - int pit_start=999; - int pit_end=-999; - +LVL1CTP::ThresholdMap::ThresholdMap( const TrigConf::L1Menu * l1menu ) +{ + //unsigned int start = 0; + for ( const TrigConf::L1Threshold & thr : l1menu->thresholds() ) { + CTPTriggerThreshold * ctpThr = new CTPTriggerThreshold(thr.name()); + /* + defining the start and stop bit is much more complex now, as + the CTP has many more inputs and the precise mapping of the + inputs to the TIP vector has to be worked out + */ + m_mapByName[ctpThr->name()] = ctpThr; + } +} - for( vector< TrigConf::PIT* >::const_iterator pit = pit_vector.begin(); pit != pit_vector.end(); ++pit){ - if(((*pit)->thresholdName())==((*it)->name())){ - if((*pit)->pitNumber()<pit_start) - pit_start=(*pit)->pitNumber(); - if((*pit)->pitNumber()>pit_end) - pit_end=(*pit)->pitNumber(); - } - } - - m_map[ *it ]->setStartBit( pit_start ); - m_map[ *it ]->setEndBit( pit_end ); - - ostringstream message; - message << " --> Created object for threshold with name: " << setw( 10 ) << ( *it )->name() << " from TIP = " << setw( 3 ) << pit_start << " to TIP = " << setw( 3 ) << pit_end; - m_logger.send( MSG::VERBOSE, message.str() ); - - - } - - m_logger.send( MSG::DEBUG, "Creating objects done" ); - - } - - - - ThresholdMap::ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector, - const std::vector< TrigConf::TIP* >& tip_vector) - : m_logger( "ThresholdMap" ) { - - m_logger.send( MSG::VERBOSE, "Created" ); - - m_logger.send( MSG::DEBUG, "Creating CTPTriggerThreshold objects for each TrigConf::TriggerThreshold object..." ); - - - for ( vector< TrigConf::TriggerThreshold* >::const_iterator it = threshold_vector.begin(); it != threshold_vector.end(); ++it ) { - - m_map[ *it ] = new CTPTriggerThreshold( *it ); - - //default pit values: used if threshold doesn't have a corresponding pit bit - int tip_start=999; - int tip_end=-999; - - for( vector< TrigConf::TIP* >::const_iterator tip = tip_vector.begin(); tip != tip_vector.end(); ++tip){ - if(((*tip)->thresholdName())==((*it)->name())){ - if((*tip)->tipNumber()<tip_start) - tip_start=(*tip)->tipNumber(); - if((*tip)->tipNumber()>tip_end) - tip_end=(*tip)->tipNumber(); - } - } - - m_map[ *it ]->setStartBit( tip_start ); - m_map[ *it ]->setEndBit( tip_end ); - - ostringstream message; - message << " --> Created object for threshold with name: " << setw( 10 ) << ( *it )->name() << " from TIP = " << setw( 3 ) << tip_start << " to TIP = " << setw( 3 ) << tip_end; - m_logger.send( MSG::VERBOSE, message.str() ); - - - } - m_logger.send( MSG::DEBUG, "Creating objects done" ); +LVL1CTP::ThresholdMap::ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector) +{ + unsigned int start = 0; + for ( TrigConf::TriggerThreshold* thr : threshold_vector ) { + CTPTriggerThreshold * ctpThr = new CTPTriggerThreshold(thr->name()); + unsigned int end = start + abs( thr->cableStart() - thr->cableEnd() ); + ctpThr->setStartBit( start ); + ctpThr->setEndBit( end ); + start = end + 1; + m_mapByName[thr->name()] = ctpThr; + } +} +LVL1CTP::ThresholdMap::ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector, + const std::vector< TrigConf::PIT* >& pit_vector) +{ + for ( TrigConf::TriggerThreshold* thr : threshold_vector ) { + CTPTriggerThreshold * ctpThr = new CTPTriggerThreshold(thr->name()); + //default pit values: used if threshold doesn't have a corresponding pit bit + int pit_start=999; + int pit_end=-999; + for( TrigConf::PIT* pit : pit_vector ) { + if( pit->thresholdName() != thr->name() ) + continue; + if( pit->pitNumber() < pit_start ) + pit_start = pit->pitNumber(); + if( pit->pitNumber() > pit_end ) + pit_end = pit->pitNumber(); + } + ctpThr->setStartBit( pit_start ); + ctpThr->setEndBit( pit_end ); + m_mapByName[thr->name()] = ctpThr; + } } +LVL1CTP::ThresholdMap::ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector, + const std::vector< TrigConf::TIP* >& tip_vector) +{ + for ( TrigConf::TriggerThreshold* thr : threshold_vector ) { + CTPTriggerThreshold * ctpThr = new CTPTriggerThreshold(thr->name()); + //default pit values: used if threshold doesn't have a corresponding pit bit + int tip_start=999; + int tip_end=-999; + for( TrigConf::TIP* tip : tip_vector){ + if( tip->thresholdName() != thr->name() ) + continue; + if( tip->tipNumber() < tip_start) + tip_start = tip->tipNumber(); + if( tip->tipNumber() > tip_end ) + tip_end = tip->tipNumber(); + } + ctpThr->setStartBit( tip_start ); + ctpThr->setEndBit( tip_end ); + m_mapByName[thr->name()] = ctpThr; + } +} -ThresholdMap::~ThresholdMap() { - - for ( map< const TrigConf::TriggerThreshold*, CTPTriggerThreshold* >::const_iterator it = m_map.begin(); - it != m_map.end(); ++it ) { - - delete it->second; - - } - - m_logger.send( MSG::VERBOSE, "Deleted" ); - +LVL1CTP::ThresholdMap::~ThresholdMap() { + for ( auto & entry : m_mapByName ) { + delete entry.second; + } } -CTPTriggerThreshold* ThresholdMap::decision( const TrigConf::TriggerThreshold* threshold ) const { - - return m_map.find( threshold )->second; - +std::vector<std::string> +LVL1CTP::ThresholdMap::getThresholdNames() const { + std::vector<std::string> thrNames; + thrNames.reserve(m_mapByName.size()); + for( auto & entry : m_mapByName ) { + thrNames.emplace_back(entry.first); + } + return thrNames; } -void ThresholdMap::clear() { - - m_logger.send( MSG::VERBOSE, "Clearing multiplicities in all CTPTriggerThreshold objects" ); - - for ( map< const TrigConf::TriggerThreshold*, CTPTriggerThreshold* >::const_iterator it = m_map.begin(); - it != m_map.end(); ++it ) { - - it->second->setValue( 0 ); - - } - +const LVL1CTP::CTPTriggerThreshold & +LVL1CTP::ThresholdMap::getCTPThreshold( const std::string & thrName ) const { + return * m_mapByName.at( thrName ); } -} // namespace LVL1CTP diff --git a/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.h b/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.h new file mode 100644 index 0000000000000000000000000000000000000000..25f05cb5f249031c4dd3475daad2e10d40fc29d4 --- /dev/null +++ b/Trigger/TrigT1/TrigT1CTP/src/ThresholdMap.h @@ -0,0 +1,59 @@ +/* + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +*/ + +#ifndef TRIGT1CTP_THRESHOLDMAP_H +#define TRIGT1CTP_THRESHOLDMAP_H + +#include "./CTPTriggerThreshold.h" + +#include "TrigConfData/L1Menu.h" + +#include "TrigConfL1Data/TriggerThreshold.h" +#include "TrigConfL1Data/PIT.h" +#include "TrigConfL1Data/TIP.h" + +#include <vector> +#include <map> + +namespace LVL1CTP { + + /** + * @short Access to TrigConf::CTPTriggerThreshold by name + */ + + class ThresholdMap { + public: + ThresholdMap() = delete; + + // construct map from L1Menu (Run 3) + ThresholdMap( const TrigConf::L1Menu * l1menu ); + + // construct map from thresholds using default PIT mapping (Run 1) + ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector); + + // construct map from thresholds using given PIT mapping (Run 1) + ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector, const std::vector< TrigConf::PIT* >& pit_vector); + + // construct map from thresholds using default TIP mapping (Run 2) + ThresholdMap( const std::vector< TrigConf::TriggerThreshold* >& threshold_vector, const std::vector< TrigConf::TIP* >& pit_vector ); + + /// default destructor + ~ThresholdMap(); + + // Function returning the threshold names + std::vector<std::string> getThresholdNames() const; + + // Function returning the CTPTriggerThreshold object belonging to the given TriggerThreshold object + const CTPTriggerThreshold & getCTPThreshold( const std::string & thrName ) const; + + private: + + /// map storing the accosiation between threshold name and CTPTriggerThreshold + std::map< std::string, const CTPTriggerThreshold* > m_mapByName; + + }; + +} + +#endif diff --git a/Trigger/TrigT1/TrigT1CTP/src/components/TrigT1CTP_entries.cxx b/Trigger/TrigT1/TrigT1CTP/src/components/TrigT1CTP_entries.cxx index 7ea22232f0dfe3db68ea92b8bf1730ade40c266a..1187bfc7818418fbba81cc31e39a0b075bcec47b 100644 --- a/Trigger/TrigT1/TrigT1CTP/src/components/TrigT1CTP_entries.cxx +++ b/Trigger/TrigT1/TrigT1CTP/src/components/TrigT1CTP_entries.cxx @@ -1,8 +1,6 @@ -#include "TrigT1CTP/CTPSimulation.h" -#include "TrigT1CTP/CTPDataDumper.h" +#include "../CTPSimulation.h" +#include "../ResultBuilder.h" -using LVL1CTP::CTPSimulation; -using LVL1CTP::CTPDataDumper; -DECLARE_COMPONENT( CTPSimulation ) -DECLARE_COMPONENT( CTPDataDumper ) +DECLARE_COMPONENT( LVL1CTP::CTPSimulation ) +DECLARE_COMPONENT( LVL1CTP::ResultBuilder ) diff --git a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/TrigT1StoreGateKeys.h b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/TrigT1StoreGateKeys.h index 489542295927aee4be5efdaea9cd298d11c76c53..6889d22c6fc921c45811fe9fa87ce23d0ee9d442 100644 --- a/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/TrigT1StoreGateKeys.h +++ b/Trigger/TrigT1/TrigT1Interfaces/TrigT1Interfaces/TrigT1StoreGateKeys.h @@ -1,6 +1,5 @@ -// Dear emacs, this is -*- c++ -*- /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef TRIGT1INTERFACES_TRIGT1STOREGATEKEYS_H #define TRIGT1INTERFACES_TRIGT1STOREGATEKEYS_H @@ -10,9 +9,6 @@ /** * @short Namespace of the LVL1 MuCTPI simulation - * - * $Revision: 621285 $ - * $Date: 2014-10-11 16:51:48 +0200 (Sat, 11 Oct 2014) $ */ namespace LVL1MUCTPI { @@ -47,9 +43,16 @@ namespace LVL1 { //static const std::string DEFAULT_FrontPanelCTPLocation = "FrontPanelCTPLocation"; //! default StoreGate location for Front Panel CTP inputs static const std::string DEFAULT_L1TopoCTPLocation = "L1TopoToCTPLocation"; + + //! default StoreGate location for Front Panel legacy L1Topo to CTP inputs + static const std::string DEFAULT_L1TopoLegacyCTPLocation = "L1TopoLegacyToCTPLocation"; + //! default StoreGate location for Front Panel CTP inputs of l1topo overflow bits static const std::string DEFAULT_L1TopoOverflowCTPLocation = "L1TopoOverflowToCTPLocation"; + //! default StoreGate location for CTP inputs of legacy l1topo overflow bits + static const std::string DEFAULT_L1TopoLegacyOverflowCTPLocation = "L1TopoLegacyOverflowToCTPLocation"; + } // namespace LVL1 namespace LVL1CTP { diff --git a/Trigger/TrigTools/TrigByteStreamTools/python/trigbs_modifyEvent.py b/Trigger/TrigTools/TrigByteStreamTools/python/trigbs_modifyEvent.py index 3b4269e3a1dae5ce8098c6da3bbf991ea25899dc..67757e3f1f5b25255d821ad390207b4d00a30de9 100755 --- a/Trigger/TrigTools/TrigByteStreamTools/python/trigbs_modifyEvent.py +++ b/Trigger/TrigTools/TrigByteStreamTools/python/trigbs_modifyEvent.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration """Modify lumiblock, run number and other events quantities.""" @@ -31,7 +31,7 @@ def modify(event): Store.eventCounter += 1 if Config.eventsPerLB is not None: - Store.currentLB = Config.firstLB + (Store.eventCounter-1) / Config.eventsPerLB + Store.currentLB = Config.firstLB + (Store.eventCounter-1) // Config.eventsPerLB # Find CTP ROB ctp_robs = [rob for rob in newevt.children() diff --git a/Trigger/TrigTools/TrigFTKTrackConverter/CMakeLists.txt b/Trigger/TrigTools/TrigFTKTrackConverter/CMakeLists.txt index bdd94f17bba09cf9a4838bcb5637d99bb770a3b1..962f4278770eb82c97ef49f2b205cb45ec2ea5ea 100644 --- a/Trigger/TrigTools/TrigFTKTrackConverter/CMakeLists.txt +++ b/Trigger/TrigTools/TrigFTKTrackConverter/CMakeLists.txt @@ -23,6 +23,7 @@ atlas_depends_on_subdirs( PUBLIC Generators/GeneratorObjects InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetRecEvent/InDetRIO_OnTrack Tracking/TrkEvent/TrkEventPrimitives Tracking/TrkEvent/TrkParameters @@ -38,7 +39,7 @@ atlas_add_component( TrigFTKTrackConverter src/*.cxx src/components/*.cxx INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${HEPMC_INCLUDE_DIRS} - LINK_LIBRARIES ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel TrkFitterInterfaces TrkFitterUtils TrigFTKSimLib StoreGateLib SGtests AtlasDetDescr GeoPrimitives GeneratorObjects InDetIdentifier InDetReadoutGeometry InDetRIO_OnTrack TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTruthData PixelConditionsData) + LINK_LIBRARIES ${EIGEN_LIBRARIES} ${HEPMC_LIBRARIES} AthenaBaseComps GaudiKernel TrkFitterInterfaces TrkFitterUtils TrigFTKSimLib StoreGateLib SGtests AtlasDetDescr GeoPrimitives GeneratorObjects InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry InDetRIO_OnTrack TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkTruthData PixelConditionsData) # Install files from the package: atlas_install_headers( TrigFTKTrackConverter ) diff --git a/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKClusterConverterTool.cxx b/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKClusterConverterTool.cxx index a77f682b30234b4a5d44ff3ab34cf2e6f50f18d1..f62957fb71a6fa1a5bb9b37005e17fbd60f0f703 100644 --- a/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKClusterConverterTool.cxx +++ b/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKClusterConverterTool.cxx @@ -30,7 +30,7 @@ #include "TrigFTKTrackConverter/TrigFTKTrackConverter.h" #include "TrigFTKTrackConverter/TrigFTKClusterConverterTool.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SCT_ModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_BarrelModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_ForwardModuleSideDesign.h" diff --git a/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKTrackConverter.cxx b/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKTrackConverter.cxx index 8b53af2d99ac9f21dc9ef657bb17d688961491da..d03efce28b0ac1c2f807d67e88ec5ea1ef2a6015 100644 --- a/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKTrackConverter.cxx +++ b/Trigger/TrigTools/TrigFTKTrackConverter/src/TrigFTKTrackConverter.cxx @@ -31,7 +31,7 @@ #include "TrigFTKTrackConverter/TrigFTKClusterConverterTool.h" -#include "InDetReadoutGeometry/PixelModuleDesign.h" +#include "PixelReadoutGeometry/PixelModuleDesign.h" #include "InDetReadoutGeometry/SCT_ModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_BarrelModuleSideDesign.h" #include "InDetReadoutGeometry/SCT_ForwardModuleSideDesign.h" diff --git a/Trigger/TrigTools/TrigInDetRecoTools/CMakeLists.txt b/Trigger/TrigTools/TrigInDetRecoTools/CMakeLists.txt index 1276f85f0c22183494838f56497cd7534ed6e9b6..d2184aac48211a017d0e8a62da6daa0f0870e9c1 100644 --- a/Trigger/TrigTools/TrigInDetRecoTools/CMakeLists.txt +++ b/Trigger/TrigTools/TrigInDetRecoTools/CMakeLists.txt @@ -29,6 +29,7 @@ atlas_depends_on_subdirs( PUBLIC InnerDetector/InDetConditions/InDetBeamSpotService InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelRedoutGeometry InnerDetector/InDetRecEvent/InDetRIO_OnTrack InnerDetector/InDetRecEvent/SiSPSeededTrackFinderData Tracking/TrkDetDescr/TrkSurfaces @@ -47,7 +48,7 @@ atlas_add_component( TrigInDetRecoTools src/*.cxx src/components/*.cxx INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData SiSpacePoint InDetRecToolInterfaces TrkSpacePoint TrkTrack TrigInDetEvent TrigInDetPattRecoEvent TrigSteeringEvent AthenaKernel GeoPrimitives IRegionSelector ByteStreamCnvSvcBaseLib EventInfo InDetIdentifier InDetReadoutGeometry InDetRIO_OnTrack SiSPSeededTrackFinderData TrkSurfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkSegment TrigTimeAlgsLib TrkEventUtils) + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps GaudiKernel InDetPrepRawData SiSpacePoint InDetRecToolInterfaces TrkSpacePoint TrkTrack TrigInDetEvent TrigInDetPattRecoEvent TrigSteeringEvent AthenaKernel GeoPrimitives IRegionSelector ByteStreamCnvSvcBaseLib EventInfo InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry InDetRIO_OnTrack SiSPSeededTrackFinderData TrkSurfaces TrkEventPrimitives TrkParameters TrkRIO_OnTrack TrkSegment TrigTimeAlgsLib TrkEventUtils) # Install files from the package: atlas_install_headers( TrigInDetRecoTools ) diff --git a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/StrBTrack.h b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/StrBTrack.h index 137ff88dcdeea9489a69ca81df3648f6876c02aa..b77c232530c325fa542e6a33ffbca345842f027e 100644 --- a/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/StrBTrack.h +++ b/Trigger/TrigTools/TrigInDetRecoTools/TrigInDetRecoTools/StrBTrack.h @@ -285,14 +285,6 @@ class StrBPattern { }; -struct StrBPatternCompare : public std::binary_function<StrBPattern*, StrBPattern*, bool> { - bool operator()(const StrBPattern *t1, const StrBPattern *t2) const { - return ((*(t1->track))<(*(t2->track))); - }; -}; - - - /****************************************************************/ /****************************************************************/ /** class StrBTrk **/ diff --git a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2LayerSetPredictorTool.cxx b/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2LayerSetPredictorTool.cxx index 0f93896df25988db6ead909cfe8c7d4930e4d777..28fedc8e8ef9db690a01fc0283feb4f2a79c4300 100644 --- a/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2LayerSetPredictorTool.cxx +++ b/Trigger/TrigTools/TrigInDetRecoTools/src/TrigL2LayerSetPredictorTool.cxx @@ -8,7 +8,7 @@ #include "InDetIdentifier/PixelID.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "TrigL2LayerSetPredictorTool.h" diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/CMakeLists.txt b/Trigger/TrigTools/TrigOnlineSpacePointTool/CMakeLists.txt index c14b579defbc84d9ee4e314d18ce47cee1831687..e039bfc686f0b339f49a06652ecde1faf39c12c6 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/CMakeLists.txt +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/CMakeLists.txt @@ -17,6 +17,7 @@ atlas_depends_on_subdirs( PRIVATE InnerDetector/InDetConditions/SCT_ConditionsTools InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetDetDescr/PixelCabling InnerDetector/InDetDetDescr/SCT_Cabling InnerDetector/InDetEventCnv/PixelRawDataByteStreamCnv @@ -44,7 +45,7 @@ atlas_add_component( TrigOnlineSpacePointTool src/*.cxx src/components/*.cxx INCLUDE_DIRS ${TDAQ-COMMON_INCLUDE_DIRS} - LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps IRegionSelector InDetByteStreamErrors ByteStreamData ByteStreamData_test GaudiKernel InDetByteStreamErrors InDetIdentifier InDetReadoutGeometry SCT_CablingLib InDetRawData InDetPrepRawData SiClusterizationToolLib TrkPrepRawData TrigInDetEvent TrigSteeringEvent AtlasDetDescr ByteStreamCnvSvcBaseLib SCT_ConditionsData TrkSpacePoint TrigTimeAlgsLib PixelCablingLib ) + LINK_LIBRARIES ${TDAQ-COMMON_LIBRARIES} AthenaBaseComps IRegionSelector InDetByteStreamErrors ByteStreamData ByteStreamData_test GaudiKernel InDetByteStreamErrors InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry SCT_CablingLib InDetRawData InDetPrepRawData SiClusterizationToolLib TrkPrepRawData TrigInDetEvent TrigSteeringEvent AtlasDetDescr ByteStreamCnvSvcBaseLib SCT_ConditionsData TrkSpacePoint TrigTimeAlgsLib PixelCablingLib ) # Install files from the package: atlas_install_python_modules( python/*.py ) diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/FastPixelClusterization.h b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/FastPixelClusterization.h index 535329ec018d0bec121f130ed51a749bdd63c3d0..fe5cc8dc6eec0758da301e5b4743d2dde3e1b6d5 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/FastPixelClusterization.h +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/FastPixelClusterization.h @@ -8,7 +8,7 @@ #include "TrkPrepRawData/PrepRawDataCLASS_DEF.h" #include "InDetRawData/PixelRDORawData.h" #include "InDetPrepRawData/PixelClusterCollection.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "Identifier/Identifier.h" #include "InDetCondTools/ISiLorentzAngleTool.h" diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/PixelClusterCacheTool.cxx b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/PixelClusterCacheTool.cxx index dbaa95d57af7979e09a04514efe55fa2f17b35e5..a848d407a32e19dffac2cd496e7fd02a7aaae7c7 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/PixelClusterCacheTool.cxx +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/PixelClusterCacheTool.cxx @@ -8,7 +8,7 @@ #include "InDetIdentifier/PixelID.h" #include "Identifier/IdentifierHash.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetPrepRawData/SiClusterContainer.h" #include "InDetPrepRawData/PixelClusterCollection.h" diff --git a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigL2LayerNumberTool.cxx b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigL2LayerNumberTool.cxx index 4be575d6664a98388b49d01fc70bb1720b816319..e96d3939d573cbc9919c510cf7af0397986ee03b 100644 --- a/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigL2LayerNumberTool.cxx +++ b/Trigger/TrigTools/TrigOnlineSpacePointTool/src/TrigL2LayerNumberTool.cxx @@ -5,7 +5,7 @@ #include "InDetIdentifier/SCT_ID.h" #include "InDetIdentifier/PixelID.h" #include "InDetReadoutGeometry/SiDetectorElement.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "TrigL2LayerNumberTool.h" diff --git a/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref b/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref index e3f942fb9f348d6c9455e7c1d44cd3af92653987..d34fdb17997896c06c0c92858c6cd9083929e2ed 100644 --- a/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref +++ b/Trigger/TrigValidation/TrigAnalysisTest/share/q221_RDOtoRDOTrig_mt1_build.ref @@ -16,20 +16,20 @@ TrigSignatureMoniMT INFO HLT_2mu10_bJpsimumu_L12M TrigSignatureMoniMT INFO HLT_2mu10_bJpsimumu_L12MU10 decisions 12 0 0 0 0 TrigSignatureMoniMT INFO HLT_2mu10_bUpsimumu_L12MU10 3 3 3 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_2mu10_bUpsimumu_L12MU10 decisions 12 0 0 0 0 -TrigSignatureMoniMT INFO HLT_2mu14_L12MU10 3 3 3 2 2 1 0 1 -TrigSignatureMoniMT INFO HLT_2mu14_L12MU10 decisions 12 8 8 4 0 -TrigSignatureMoniMT INFO HLT_2mu15_L12MU10 3 3 3 2 2 1 0 1 -TrigSignatureMoniMT INFO HLT_2mu15_L12MU10 decisions 12 8 8 4 0 -TrigSignatureMoniMT INFO HLT_2mu4_bJpsimumu_L12MU4 4 4 4 2 1 1 1 1 -TrigSignatureMoniMT INFO HLT_2mu4_bJpsimumu_L12MU4 decisions 16 4 6 4 1 +TrigSignatureMoniMT INFO HLT_2mu14_L12MU10 3 3 3 2 2 0 0 0 +TrigSignatureMoniMT INFO HLT_2mu14_L12MU10 decisions 12 8 8 0 0 +TrigSignatureMoniMT INFO HLT_2mu15_L12MU10 3 3 3 2 2 0 0 0 +TrigSignatureMoniMT INFO HLT_2mu15_L12MU10 decisions 12 8 8 0 0 +TrigSignatureMoniMT INFO HLT_2mu4_bJpsimumu_L12MU4 4 4 4 2 1 0 0 0 +TrigSignatureMoniMT INFO HLT_2mu4_bJpsimumu_L12MU4 decisions 16 4 6 0 0 TrigSignatureMoniMT INFO HLT_2mu4_bUpsimumu_L12MU4 4 4 4 1 0 0 0 0 TrigSignatureMoniMT INFO HLT_2mu4_bUpsimumu_L12MU4 decisions 16 1 0 0 0 TrigSignatureMoniMT INFO HLT_2mu6Comb_L12MU6 4 4 4 3 0 0 0 3 TrigSignatureMoniMT INFO HLT_2mu6Comb_L12MU6 decisions 16 12 0 0 0 -TrigSignatureMoniMT INFO HLT_2mu6_10invm70_L1MU6 10 10 4 3 3 3 2 0 -TrigSignatureMoniMT INFO HLT_2mu6_10invm70_L1MU6 decisions 16 12 18 16 2 -TrigSignatureMoniMT INFO HLT_2mu6_L12MU6 4 4 4 3 3 3 0 3 -TrigSignatureMoniMT INFO HLT_2mu6_L12MU6 decisions 16 12 18 16 0 +TrigSignatureMoniMT INFO HLT_2mu6_10invm70_L1MU6 10 10 4 3 3 0 0 0 +TrigSignatureMoniMT INFO HLT_2mu6_10invm70_L1MU6 decisions 16 12 18 0 0 +TrigSignatureMoniMT INFO HLT_2mu6_L12MU6 4 4 4 3 3 0 0 0 +TrigSignatureMoniMT INFO HLT_2mu6_L12MU6 decisions 16 12 18 0 0 TrigSignatureMoniMT INFO HLT_3j200_L1J100 3 3 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_3j200_L1J100 decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_3j200_L1J20 19 19 0 0 0 0 0 0 @@ -116,6 +116,12 @@ TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_ TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 decisions 18 48 48 0 0 TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J2019 19 18 18 18 0 0 18 TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 decisions 18 48 48 0 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_pf_L1J2019 19 16 0 0 0 0 16 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_pf_L1J20 decisions 16 0 0 0 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_L1J1520 20 18 0 0 0 0 18 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_L1J15 decisions 18 0 0 0 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_pf_L1J2019 19 15 0 0 0 0 15 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_pf_L1J20 decisions 15 0 0 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J1003 3 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J100 decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J20 19 19 0 0 0 0 0 0 @@ -143,35 +149,35 @@ TrigSignatureMoniMT INFO HLT_mu10_lateMu_L1MU10 d TrigSignatureMoniMT INFO HLT_mu20_ivar_L1MU6 10 10 10 5 3 0 0 3 TrigSignatureMoniMT INFO HLT_mu20_ivar_L1MU6 decisions 14 6 3 0 0 TrigSignatureMoniMT INFO HLT_mu24_idperf_L1MU20 8 8 6 6 5 5 0 5 -TrigSignatureMoniMT INFO HLT_mu24_idperf_L1MU20 decisions 7 7 6 6 0 -TrigSignatureMoniMT INFO HLT_mu26_ivarmedium_L1MU20 8 8 8 5 4 3 2 2 -TrigSignatureMoniMT INFO HLT_mu26_ivarmedium_L1MU20 decisions 10 6 5 4 2 -TrigSignatureMoniMT INFO HLT_mu28_ivarmedium_L1MU20 8 8 8 5 4 3 2 2 -TrigSignatureMoniMT INFO HLT_mu28_ivarmedium_L1MU20 decisions 10 6 5 3 2 -TrigSignatureMoniMT INFO HLT_mu35_ivarmedium_L1MU20 8 8 8 5 4 2 1 1 -TrigSignatureMoniMT INFO HLT_mu35_ivarmedium_L1MU20 decisions 10 6 5 2 1 -TrigSignatureMoniMT INFO HLT_mu50_L1MU20 8 8 8 5 1 1 0 1 -TrigSignatureMoniMT INFO HLT_mu50_L1MU20 decisions 10 6 1 1 0 -TrigSignatureMoniMT INFO HLT_mu50_RPCPEBSecondaryReadout_L1MU208 8 8 5 1 1 1 1 -TrigSignatureMoniMT INFO HLT_mu50_RPCPEBSecondaryReadout_L1MU20 decisions 10 6 1 1 1 +TrigSignatureMoniMT INFO HLT_mu24_idperf_L1MU20 decisions 7 7 6 11 0 +TrigSignatureMoniMT INFO HLT_mu26_ivarmedium_L1MU20 8 8 8 5 4 1 0 0 +TrigSignatureMoniMT INFO HLT_mu26_ivarmedium_L1MU20 decisions 10 6 5 1 0 +TrigSignatureMoniMT INFO HLT_mu28_ivarmedium_L1MU20 8 8 8 5 4 1 0 0 +TrigSignatureMoniMT INFO HLT_mu28_ivarmedium_L1MU20 decisions 10 6 5 1 0 +TrigSignatureMoniMT INFO HLT_mu35_ivarmedium_L1MU20 8 8 8 5 4 1 0 0 +TrigSignatureMoniMT INFO HLT_mu35_ivarmedium_L1MU20 decisions 10 6 5 1 0 +TrigSignatureMoniMT INFO HLT_mu50_L1MU20 8 8 8 5 1 0 0 0 +TrigSignatureMoniMT INFO HLT_mu50_L1MU20 decisions 10 6 1 0 0 +TrigSignatureMoniMT INFO HLT_mu50_RPCPEBSecondaryReadout_L1MU208 8 8 5 1 0 0 0 +TrigSignatureMoniMT INFO HLT_mu50_RPCPEBSecondaryReadout_L1MU20 decisions 10 6 1 0 0 TrigSignatureMoniMT INFO HLT_mu60_0eta105_msonly_L1MU208 8 1 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_mu60_0eta105_msonly_L1MU20 decisions 2 0 0 0 0 TrigSignatureMoniMT INFO HLT_mu6Comb_L1MU6 10 10 10 10 0 0 0 10 TrigSignatureMoniMT INFO HLT_mu6Comb_L1MU6 decisions 14 13 0 0 0 -TrigSignatureMoniMT INFO HLT_mu6_L1MU6 10 10 10 10 10 10 0 10 -TrigSignatureMoniMT INFO HLT_mu6_L1MU6 decisions 14 13 16 15 0 +TrigSignatureMoniMT INFO HLT_mu6_L1MU6 10 10 10 10 10 2 0 2 +TrigSignatureMoniMT INFO HLT_mu6_L1MU6 decisions 14 13 16 2 0 TrigSignatureMoniMT INFO HLT_mu6_idperf_L1MU6 10 10 10 10 10 10 0 10 -TrigSignatureMoniMT INFO HLT_mu6_idperf_L1MU6 decisions 14 14 17 18 0 -TrigSignatureMoniMT INFO HLT_mu6_ivarmedium_L1MU6 10 10 10 10 10 10 7 7 -TrigSignatureMoniMT INFO HLT_mu6_ivarmedium_L1MU6 decisions 14 13 16 15 7 +TrigSignatureMoniMT INFO HLT_mu6_idperf_L1MU6 decisions 14 14 17 33 0 +TrigSignatureMoniMT INFO HLT_mu6_ivarmedium_L1MU6 10 10 10 10 10 2 1 1 +TrigSignatureMoniMT INFO HLT_mu6_ivarmedium_L1MU6 decisions 14 13 16 2 1 TrigSignatureMoniMT INFO HLT_mu6_msonly_L1MU6 10 10 10 0 10 0 0 10 TrigSignatureMoniMT INFO HLT_mu6_msonly_L1MU6 decisions 14 0 17 0 0 -TrigSignatureMoniMT INFO HLT_mu6_mu4_L12MU4 4 4 4 4 4 4 0 4 -TrigSignatureMoniMT INFO HLT_mu6_mu4_L12MU4 decisions 8 8 12 10 0 +TrigSignatureMoniMT INFO HLT_mu6_mu4_L12MU4 4 4 4 4 4 0 0 0 +TrigSignatureMoniMT INFO HLT_mu6_mu4_L12MU4 decisions 8 8 12 0 0 TrigSignatureMoniMT INFO HLT_mu6fast_L1MU6 10 10 10 0 0 0 0 10 TrigSignatureMoniMT INFO HLT_mu6fast_L1MU6 decisions 14 0 0 0 0 -TrigSignatureMoniMT INFO HLT_mu6noL1_L1MU6 10 10 10 10 0 0 0 10 -TrigSignatureMoniMT INFO HLT_mu6noL1_L1MU6 decisions 18 14 0 0 0 +TrigSignatureMoniMT INFO HLT_mu6noL1_L1MU6 10 10 10 2 0 0 0 2 +TrigSignatureMoniMT INFO HLT_mu6noL1_L1MU6 decisions 18 2 0 0 0 TrigSignatureMoniMT INFO HLT_mu80_msonly_3layersEC_L1MU208 8 8 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_mu80_msonly_3layersEC_L1MU20 decisions 10 0 0 0 0 TrigSignatureMoniMT INFO HLT_tau0_perf_ptonly_L1TAU100 0 0 0 0 0 0 0 0 @@ -230,6 +236,8 @@ TrigSignatureMoniMT INFO HLT_xe30_cell_xe30_tcpuf TrigSignatureMoniMT INFO HLT_xe30_cell_xe30_tcpufit_L1XE10 decisions 14 0 0 0 0 TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 19 19 19 0 0 0 0 19 TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 decisions 19 0 0 0 0 +TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 19 19 15 0 0 0 0 15 +TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 decisions 15 0 0 0 0 TrigSignatureMoniMT INFO HLT_xe30_tcpufit_L1XE10 19 19 15 0 0 0 0 15 TrigSignatureMoniMT INFO HLT_xe30_tcpufit_L1XE10 decisions 15 0 0 0 0 TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 19 19 17 0 0 0 0 17 diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_SliceJet_fork_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_FullMenu_missingROBs_build.py similarity index 51% rename from Trigger/TrigValidation/TrigP1Test/test/test_trigP1_SliceJet_fork_build.py rename to Trigger/TrigValidation/TrigP1Test/test/test_trigP1_FullMenu_missingROBs_build.py index 05a23f9f85f0769266e6e1842878dacc981c8091..9aa68337912c8aac3b594b6f1c7ba941bbeb6a58 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_SliceJet_fork_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_FullMenu_missingROBs_build.py @@ -1,19 +1,16 @@ #!/usr/bin/env python -# art-description: Jet slice test, with athenaHLT, MP -# art-type: build -# art-include: master/Athena +# art-description: Same as full_menu test from TrigUpgradeTest, but with athenaHLT. Test with detector ROBs removed. +# art-type: build +# art-include: master/Athena from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps ex = ExecStep.ExecStep() ex.type = 'athenaHLT' +ex.args = '--ros2rob="{\'ROS-TDQ-CTP-00\': [0x770000]}"' ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'data' -ex.forks = 2 -ex.threads = 1 -ex.concurrent_events = 1 -ex.args = '--stdcmalloc -c "doEmptyMenu=True;doJetSlice=True;"' test = Test.Test() test.art_type = 'build' diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_ID_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_ID_build.py index 5c414c69d37c9bf18e3c2b4b4cb66bcf312e9f11..1576e4467534f5437c873a3de1a6c9f651351ac0 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_ID_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_ID_build.py @@ -11,7 +11,7 @@ ex.type = 'athenaHLT' ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'data_cos_IDCosmic' ex.max_events = 100 -ex.args = '-c "setMenu=\'Cosmic_pp_run3_v1\';"' +ex.args = '-c "setMenu=\'Cosmic_pp_run3_v1\';doCosmics=True;"' test = Test.Test() test.art_type = 'build' diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_build.py index a3336183cac683aaf30c3c19464194e5efaa5bde..181317e4924c13f92be8ed838b4621b78beb0e7b 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_build.py @@ -11,7 +11,7 @@ ex.type = 'athenaHLT' ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'data_cos' ex.max_events = 100 -ex.args = '-c "setMenu=\'Cosmic_pp_run3_v1\';"' +ex.args = '-c "setMenu=\'Cosmic_pp_run3_v1\';doCosmics=True;"' test = Test.Test() test.art_type = 'build' diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_muons_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_muons_build.py index 33e493e29b1035d4fc65b6ba9e893e14f43f0594..3b1fb51851f3170ab203ff973f61d60db4600ea1 100755 --- a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_muons_build.py +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1Cosmic_muons_build.py @@ -11,7 +11,7 @@ ex.type = 'athenaHLT' ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'data_cos_CosmicMuons' ex.max_events = 100 -ex.args = '-c "setMenu=\'Cosmic_pp_run3_v1\';"' +ex.args = '-c "setMenu=\'Cosmic_pp_run3_v1\';doCosmics=True;"' test = Test.Test() test.art_type = 'build' diff --git a/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1PhysP1_runStopRun_build.py b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1PhysP1_runStopRun_build.py new file mode 100755 index 0000000000000000000000000000000000000000..3e76736bbefd419133f4d9c343f9fe94eb19b62f --- /dev/null +++ b/Trigger/TrigValidation/TrigP1Test/test/test_trigP1_v1PhysP1_runStopRun_build.py @@ -0,0 +1,31 @@ +#!/usr/bin/env python + +# art-description: start/stop/start transition test with PhysicsP1_pp_run3_v1 menu +# art-type: build +# art-include: master/Athena +# Skipping art-output which has no effect for build tests. +# If you create a grid version, check art-output in existing grid tests. + +from TrigValTools.TrigValSteering import Test, ExecStep, CheckSteps + +ex = ExecStep.ExecStep() +ex.type = 'athenaHLT' +ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' +ex.input = 'data' +ex.args = '-i -M -ul -c "setMenu=\'PhysicsP1_pp_run3_v1\';"' +ex.perfmon = False # perfmon currently not fully supported with athenaHLT -M + +# Trick to pass the transitions file into athenaHLT -i +ex.job_options += ' < `find_data.py run-stop-run-saveHist.trans`' + +test = Test.Test() +test.art_type = 'build' +test.exec_steps = [ex] +test.check_steps = CheckSteps.default_check_steps(test) + +# Extra merging pattern for logs produced with -ul option +logmerge = test.get_step("LogMerge") +logmerge.extra_log_regex = 'athenaHLT-.*-.*(.out|.err)' + +import sys +sys.exit(test.run()) diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref index 25be2958fc40008cb5b12147bee4674c3697fa04..559a1e9a37ebdaee91bd05afb3db453fe47891f3 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/full_menu_build.ref @@ -3,7 +3,7 @@ TrigSignatureMoniMT INFO HLT_2e17_etcut_L12EM15V TrigSignatureMoniMT INFO HLT_2e17_lhvloose_L12EM3 20 20 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_2e17_lhvloose_L12EM3 decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_2e3_etcut_L12EM3 20 20 13 13 13 0 0 13 -TrigSignatureMoniMT INFO HLT_2e3_etcut_L12EM3 decisions 46 256 85 0 0 +TrigSignatureMoniMT INFO HLT_2e3_etcut_L12EM3 decisions 46 246 85 0 0 TrigSignatureMoniMT INFO HLT_2g20_tight_L12EM20VH 20 20 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_2g20_tight_L12EM20VH decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_2g35_etcut_L12EM20VH 20 20 0 0 0 0 0 0 @@ -51,7 +51,7 @@ TrigSignatureMoniMT INFO HLT_costmonitor_CostMon TrigSignatureMoniMT INFO HLT_e140_lhloose_L1EM24VHI 20 20 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_e140_lhloose_L1EM24VHI decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_e26_etcut_L1EM22VHI 20 20 1 1 0 0 0 0 -TrigSignatureMoniMT INFO HLT_e26_etcut_L1EM22VHI decisions 1 6 0 0 0 +TrigSignatureMoniMT INFO HLT_e26_etcut_L1EM22VHI decisions 1 8 0 0 0 TrigSignatureMoniMT INFO HLT_e26_lhtight_L1EM24VHI 20 20 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_e26_lhtight_L1EM24VHI decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_e300_etcut_L1EM24VHI 20 20 0 0 0 0 0 0 @@ -59,19 +59,19 @@ TrigSignatureMoniMT INFO HLT_e300_etcut_L1EM24VH TrigSignatureMoniMT INFO HLT_e3_etcut1step_mu6fast_L1EM8I_MU1020 20 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_e3_etcut1step_mu6fast_L1EM8I_MU10 decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_e3_etcut_L1EM3 20 20 15 13 13 0 0 13 -TrigSignatureMoniMT INFO HLT_e3_etcut_L1EM3 decisions 48 256 85 0 0 +TrigSignatureMoniMT INFO HLT_e3_etcut_L1EM3 decisions 48 246 85 0 0 TrigSignatureMoniMT INFO HLT_e5_etcut_L1EM3 20 20 13 12 12 0 0 12 -TrigSignatureMoniMT INFO HLT_e5_etcut_L1EM3 decisions 41 236 47 0 0 +TrigSignatureMoniMT INFO HLT_e5_etcut_L1EM3 decisions 41 230 47 0 0 TrigSignatureMoniMT INFO HLT_e5_lhloose_L1EM3 20 20 10 9 9 0 0 0 -TrigSignatureMoniMT INFO HLT_e5_lhloose_L1EM3 decisions 15 77 28 0 0 +TrigSignatureMoniMT INFO HLT_e5_lhloose_L1EM3 decisions 15 76 28 0 0 TrigSignatureMoniMT INFO HLT_e5_lhmedium_L1EM3 20 20 9 8 8 0 0 0 -TrigSignatureMoniMT INFO HLT_e5_lhmedium_L1EM3 decisions 13 75 27 0 0 +TrigSignatureMoniMT INFO HLT_e5_lhmedium_L1EM3 decisions 13 74 27 0 0 TrigSignatureMoniMT INFO HLT_e5_lhtight_L1EM3 20 20 9 8 8 0 0 0 -TrigSignatureMoniMT INFO HLT_e5_lhtight_L1EM3 decisions 13 75 27 0 0 +TrigSignatureMoniMT INFO HLT_e5_lhtight_L1EM3 decisions 13 74 27 0 0 TrigSignatureMoniMT INFO HLT_e60_lhmedium_L1EM24VHI 20 20 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_e60_lhmedium_L1EM24VHI decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_e7_etcut_L1EM3 20 20 13 12 11 0 0 11 -TrigSignatureMoniMT INFO HLT_e7_etcut_L1EM3 decisions 26 167 21 0 0 +TrigSignatureMoniMT INFO HLT_e7_etcut_L1EM3 decisions 26 162 21 0 0 TrigSignatureMoniMT INFO HLT_g140_etcut_L1EM24VHI 20 20 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_g140_etcut_L1EM24VHI decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_g140_loose_L1EM24VHI 20 20 0 0 0 0 0 0 @@ -114,12 +114,18 @@ TrigSignatureMoniMT INFO HLT_j45_ftf_L1J15 TrigSignatureMoniMT INFO HLT_j45_ftf_L1J15 decisions 6 0 0 0 0 TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 20 20 4 0 0 0 0 4 TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 decisions 4 0 0 0 0 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 20 20 6 0 0 0 0 6 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 decisions 6 0 0 0 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 20 20 7 0 0 0 0 7 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 decisions 7 0 0 0 0 TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J2020 20 5 5 5 0 0 5 TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_bmv2c1070_split_L1J20 decisions 5 5 5 0 0 TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J2020 20 5 5 5 0 0 5 TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_boffperf_split_L1J20 decisions 5 5 5 0 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_pf_L1J2020 20 4 0 0 0 0 4 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_pf_L1J20 decisions 4 0 0 0 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_L1J1520 20 6 0 0 0 0 6 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_L1J15 decisions 6 0 0 0 0 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_pf_L1J2020 20 4 0 0 0 0 4 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_pf_L1J20 decisions 4 0 0 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J10020 20 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J100 decisions 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J20 20 20 0 0 0 0 0 0 @@ -242,9 +248,11 @@ TrigSignatureMoniMT INFO HLT_xe30_cell_xe30_tcpu TrigSignatureMoniMT INFO HLT_xe30_cell_xe30_tcpufit_L1XE10 decisions 2 0 0 0 0 TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 20 20 16 0 0 0 0 16 TrigSignatureMoniMT INFO HLT_xe30_mht_L1XE10 decisions 16 0 0 0 0 +TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 20 20 4 0 0 0 0 4 +TrigSignatureMoniMT INFO HLT_xe30_pfsum_L1XE10 decisions 4 0 0 0 0 TrigSignatureMoniMT INFO HLT_xe30_tcpufit_L1XE10 20 20 2 0 0 0 0 2 TrigSignatureMoniMT INFO HLT_xe30_tcpufit_L1XE10 decisions 2 0 0 0 0 -TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 20 20 7 0 0 0 0 7 -TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 decisions 7 0 0 0 0 +TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 20 20 8 0 0 0 0 8 +TrigSignatureMoniMT INFO HLT_xe30_trkmht_L1XE10 decisions 8 0 0 0 0 TrigSignatureMoniMT INFO HLT_xe65_cell_L1XE50 20 20 0 0 0 0 0 0 TrigSignatureMoniMT INFO HLT_xe65_cell_L1XE50 decisions 0 0 0 0 0 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/share/slice_jet.ref b/Trigger/TrigValidation/TrigUpgradeTest/share/slice_jet.ref index e273506975eec3331e4f1c0beb19caeb55eadb18..7115c8b5539ccbafdd90bec9036c0285e961691e 100644 --- a/Trigger/TrigValidation/TrigUpgradeTest/share/slice_jet.ref +++ b/Trigger/TrigValidation/TrigUpgradeTest/share/slice_jet.ref @@ -6,8 +6,8 @@ TrigSignatureMoniMT INFO HLT_3j200_L1J20 TrigSignatureMoniMT INFO HLT_3j200_L1J20 decisions 0 TrigSignatureMoniMT INFO HLT_5j70_0eta240_L14J20 20 20 0 0 TrigSignatureMoniMT INFO HLT_5j70_0eta240_L14J20 decisions 0 -TrigSignatureMoniMT INFO HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J2020 20 1 1 -TrigSignatureMoniMT INFO HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20 decisions 2 +TrigSignatureMoniMT INFO HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J2020 20 2 2 +TrigSignatureMoniMT INFO HLT_j0_vbenfSEP30etSEP34mass35SEP50fbet_L1J20 decisions 5 TrigSignatureMoniMT INFO HLT_j260_320eta490_L1J20 20 20 0 0 TrigSignatureMoniMT INFO HLT_j260_320eta490_L1J20 decisions 0 TrigSignatureMoniMT INFO HLT_j260_320eta490_L1J75_31ETA4920 20 0 0 @@ -18,14 +18,20 @@ TrigSignatureMoniMT INFO HLT_j420_L1J20 TrigSignatureMoniMT INFO HLT_j420_L1J20 decisions 0 TrigSignatureMoniMT INFO HLT_j420_ftf_subjesgscIS_L1J2020 20 0 0 TrigSignatureMoniMT INFO HLT_j420_ftf_subjesgscIS_L1J20 decisions 0 -TrigSignatureMoniMT INFO HLT_j45_L1J15 20 20 5 5 -TrigSignatureMoniMT INFO HLT_j45_L1J15 decisions 5 -TrigSignatureMoniMT INFO HLT_j45_ftf_L1J15 20 20 5 5 -TrigSignatureMoniMT INFO HLT_j45_ftf_L1J15 decisions 5 +TrigSignatureMoniMT INFO HLT_j45_L1J15 20 20 6 6 +TrigSignatureMoniMT INFO HLT_j45_L1J15 decisions 6 +TrigSignatureMoniMT INFO HLT_j45_ftf_L1J15 20 20 6 6 +TrigSignatureMoniMT INFO HLT_j45_ftf_L1J15 decisions 6 TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 20 20 4 4 TrigSignatureMoniMT INFO HLT_j45_ftf_pf_L1J20 decisions 4 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 20 20 5 5 -TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 decisions 5 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 20 20 6 6 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_L1J15 decisions 6 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_pf_L1J2020 20 4 4 +TrigSignatureMoniMT INFO HLT_j45_ftf_subjesgscIS_pf_L1J20 decisions 4 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_L1J1520 20 6 6 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_L1J15 decisions 6 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_pf_L1J2020 20 4 4 +TrigSignatureMoniMT INFO HLT_j45_ftf_subresjesgscIS_pf_L1J20 decisions 4 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J10020 20 0 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J100 decisions 0 TrigSignatureMoniMT INFO HLT_j460_a10_lcw_subjes_L1J20 20 20 0 0 @@ -38,13 +44,13 @@ TrigSignatureMoniMT INFO HLT_j460_a10t_lcw_jes_3 TrigSignatureMoniMT INFO HLT_j460_a10t_lcw_jes_30smcINF_L1J100 decisions 0 TrigSignatureMoniMT INFO HLT_j460_a10t_lcw_jes_L1J100 20 20 0 0 TrigSignatureMoniMT INFO HLT_j460_a10t_lcw_jes_L1J100 decisions 0 -TrigSignatureMoniMT INFO HLT_j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J2020 20 1 1 -TrigSignatureMoniMT INFO HLT_j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J20 decisions 1 -TrigSignatureMoniMT INFO HLT_j80_j60_L1J15 20 20 1 1 -TrigSignatureMoniMT INFO HLT_j80_j60_L1J15 decisions 1 -TrigSignatureMoniMT INFO HLT_j85_L1J20 20 20 1 1 -TrigSignatureMoniMT INFO HLT_j85_L1J20 decisions 1 -TrigSignatureMoniMT INFO HLT_j85_ftf_L1J20 20 20 1 1 -TrigSignatureMoniMT INFO HLT_j85_ftf_L1J20 decisions 1 -TrigSignatureMoniMT INFO HLT_j85_ftf_pf_L1J20 20 20 0 0 -TrigSignatureMoniMT INFO HLT_j85_ftf_pf_L1J20 decisions 0 +TrigSignatureMoniMT INFO HLT_j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J2020 20 0 0 +TrigSignatureMoniMT INFO HLT_j80_0eta240_2j60_320eta490_j0_dijetSEP80j1etSEP0j1eta240SEP80j2etSEP0j2eta240SEP700djmass_L1J20 decisions 0 +TrigSignatureMoniMT INFO HLT_j80_j60_L1J15 20 20 0 0 +TrigSignatureMoniMT INFO HLT_j80_j60_L1J15 decisions 0 +TrigSignatureMoniMT INFO HLT_j85_L1J20 20 20 3 3 +TrigSignatureMoniMT INFO HLT_j85_L1J20 decisions 3 +TrigSignatureMoniMT INFO HLT_j85_ftf_L1J20 20 20 3 3 +TrigSignatureMoniMT INFO HLT_j85_ftf_L1J20 decisions 3 +TrigSignatureMoniMT INFO HLT_j85_ftf_pf_L1J20 20 20 2 2 +TrigSignatureMoniMT INFO HLT_j85_ftf_pf_L1J20 decisions 2 diff --git a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_slice_met_build.sh b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_slice_met_build.sh index 9761b3739528f57e097ec19516a23adfd50e7c3a..3c3b26f8ec83adf31fc8cbfb269b12cba13b6cf7 100755 --- a/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_slice_met_build.sh +++ b/Trigger/TrigValidation/TrigUpgradeTest/test/test_trigUpgr_slice_met_build.sh @@ -10,7 +10,7 @@ export THREADS=1 export SLOTS=1 export JOBOPTION="TriggerJobOpts/runHLT_standalone.py" export REGTESTEXP="TrigSignatureMoniMT.*HLT_.*" -export EXTRA="doEmptyMenu=True;doMETSlice=True;doWriteBS=False;doWriteRDOTrigger=True;" +export EXTRA="doEmptyMenu=True;doMETSlice=True;doWriteBS=False;doWriteRDOTrigger=True;forceEnableAllChains=True;" # Find the regtest reference installed with the release export REGTESTREF=`find_data.py TrigUpgradeTest/slice_met.ref` diff --git a/Trigger/TrigValidation/TrigValTools/bin/chainDump.py b/Trigger/TrigValidation/TrigValTools/bin/chainDump.py index 592fa68d0dc8cde946546a29a0786afe2e45f49f..3d7b7238a6e3161c4aea4df568088d143bd2d18c 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/chainDump.py +++ b/Trigger/TrigValidation/TrigValTools/bin/chainDump.py @@ -58,7 +58,8 @@ def get_parser(): 'HLTFramework/TrigSignatureMoniMT/SignatureAcceptance', 'TrigSteer_HLT/ChainAcceptance', 'TrigSteer_HLT/NumberOfActiveTEs', - 'CTPSimulation/L1ItemsAV'], + 'CTPSimulation/L1ItemsAV', + 'L1/CTPSimulation/output/tavByName'], help='Histograms to use for counts dump. All existing ' 'histograms from the list are used, default = %(default)s') parser.add_argument('--totalHists', @@ -76,7 +77,8 @@ def get_parser(): 'HLTFramework/TrigSignatureMoniMT/SignatureAcceptance:HLTChain', 'TrigSteer_HLT/ChainAcceptance:HLTChain', 'TrigSteer_HLT/NumberOfActiveTEs:HLTTE', - 'CTPSimulation/L1ItemsAV:L1AV'], + 'CTPSimulation/L1ItemsAV:L1AV', + 'L1/CTPSimulation/output/tavByName:L1AV'], help='Dictionary defining names of output text files for each ' 'histogram, default = %(default)s') return parser diff --git a/Trigger/TrigValidation/TrigValTools/bin/runTrigCI.py b/Trigger/TrigValidation/TrigValTools/bin/runTrigCI.py index ed3dafd4e06c848c7ea8ea389e59e83ecd71c6b1..3b9623410166449deff5e995d28c69160202b61a 100755 --- a/Trigger/TrigValidation/TrigValTools/bin/runTrigCI.py +++ b/Trigger/TrigValidation/TrigValTools/bin/runTrigCI.py @@ -10,6 +10,7 @@ import sys import logging import argparse import subprocess +import errno from TrigValTools.TrigARTUtils import find_scripts, remember_cwd @@ -65,6 +66,17 @@ def analyse_steps(log_file, steps): return ret_code +def try_mkdir(dirname): + try: + os.mkdir(dirname) + except OSError as e: + if e.errno == errno.EEXIST: + logging.info("SUB-DIRECTORY %s ALREADY EXISTS AND WILL BE REUSED", dirname) + else: + logging.error("FAILED TO CREATE SUB-DIRECTORY %s", dirname) + raise e + + def main(): args = get_parser().parse_args() logging.basicConfig(stream=sys.stdout, @@ -83,6 +95,8 @@ def main(): max_name_len = len(script) with remember_cwd(): dirname = os.path.splitext(script)[0] + try_mkdir(dirname) + os.chdir(dirname) logging.info('='*50) logging.info('STARTING %s IN SUB-DIRECTORY %s', script, dirname) logging.info('='*50) diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Cosmic_build.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Cosmic_build.py index a9bc9cd5c33366ca8cc9b0c67fbca8d794b7d33f..19c7dcdbdac4fc4fa5d212958e9e43571fc68462 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Cosmic_build.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Cosmic_build.py @@ -13,7 +13,7 @@ ex.type = 'athena' ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'data_cos' ex.threads = 1 -ex.args = '-c "setMenu=\'Cosmic_pp_run3_v1\';doWriteBS=False;doWriteRDOTrigger=True;"' +ex.args = '-c "setMenu=\'Cosmic_pp_run3_v1\';doCosmics=True;doWriteBS=False;doWriteRDOTrigger=True;"' test = Test.Test() test.art_type = 'build' diff --git a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Cosmic_grid.py b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Cosmic_grid.py index 4ba89ba44a8c43ebf531947beae18a3db97921ea..93a5eccc633c0967d4461fa122bdfe7832c013fd 100755 --- a/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Cosmic_grid.py +++ b/Trigger/TrigValidation/TriggerTest/test/test_trig_data_v1Cosmic_grid.py @@ -23,7 +23,7 @@ ex.type = 'athena' ex.job_options = 'TriggerJobOpts/runHLT_standalone.py' ex.input = 'data_cos' ex.threads = 1 -ex.args = '-c "setMenu=\'Cosmic_pp_run3_v1\';doWriteBS=False;doWriteRDOTrigger=True;"' +ex.args = '-c "setMenu=\'Cosmic_pp_run3_v1\';doCosmics=True;doWriteBS=False;doWriteRDOTrigger=True;"' test = Test.Test() test.art_type = 'grid' diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun2.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun2.py index b645c3a68a3c4d39f07cef93aa697570bc121250..d6255cd1c5c065fe8da98b37823eee27311a0eb4 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun2.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun2.py @@ -1557,7 +1557,6 @@ EDMLibraries = [ 'TrigSteeringEvent', 'TrigMuonEvent', 'tauEventTPCnvDict', 'RecTPCnvDict', 'TrigMonitoringEventTPCnvDict', 'OLD_RecTPCnvDict', - 'TrigCosmicEvent', # #'TrigCombinedEventTPCnv1Dict', 'TrigCaloEventTPCnv1Dict', #'TrigDecisionEventTPCnv1Dict', 'TrigInDetEventTPCnv1Dict', diff --git a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py index c0e48c83df1b371da931a684720834d5862e248e..1feb42c4e466899a041c69ee546a17b55a43f5f0 100644 --- a/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py +++ b/Trigger/TriggerCommon/TrigEDMConfig/python/TriggerEDMRun3.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # Definition of trigger EDM for the Run 3 @@ -217,6 +217,9 @@ TriggerHLTListRun3 = [ ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subjesgscIS_ftf', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'), ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoJets_subjesgscIS_ftfAux.'+JetVars, 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'), + ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subresjesgscIS_ftf', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'), + ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoJets_subresjesgscIS_ftfAux.'+JetVars, 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'Jet'), + ('xAOD::JetContainer#HLT_AntiKt4EMTopoJets_subjes', 'BS ESD AODFULL', 'Jet'), ('xAOD::JetAuxContainer#HLT_AntiKt4EMTopoJets_subjesAux.'+JetVars, 'BS ESD AODFULL', 'Jet'), @@ -241,6 +244,12 @@ TriggerHLTListRun3 = [ ('xAOD::JetContainer#HLT_AntiKt4EMPFlowJets_subjesIS_ftf', 'BS ESD AODFULL', 'Jet'), ('xAOD::JetAuxContainer#HLT_AntiKt4EMPFlowJets_subjesIS_ftfAux.', 'BS ESD AODFULL', 'Jet'), + ('xAOD::JetContainer#HLT_AntiKt4EMPFlowJets_subjesgscIS_ftf', 'BS ESD AODFULL', 'Jet'), + ('xAOD::JetAuxContainer#HLT_AntiKt4EMPFlowJets_subjesgscIS_ftfAux.', 'BS ESD AODFULL', 'Jet'), + + ('xAOD::JetContainer#HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftf', 'BS ESD AODFULL', 'Jet'), + ('xAOD::JetAuxContainer#HLT_AntiKt4EMPFlowJets_subresjesgscIS_ftfAux.', 'BS ESD AODFULL', 'Jet'), + ('xAOD::TrackParticleContainer#HLT_xAODTracks_FS', 'BS ESD AODFULL', 'Jet'), ('xAOD::TrackParticleAuxContainer#HLT_xAODTracks_FSAux.', 'BS ESD AODFULL', 'Jet'), @@ -260,6 +269,9 @@ TriggerHLTListRun3 = [ ('xAOD::TrigMissingETContainer#HLT_MET_trkmht', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), ('xAOD::TrigMissingETAuxContainer#HLT_MET_trkmhtAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), + ('xAOD::TrigMissingETContainer#HLT_MET_pfsum', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), + ('xAOD::TrigMissingETContainer#HLT_MET_pfsumAux.', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), + ('xAOD::CaloClusterContainer#HLT_TopoCaloClustersFS', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), ('xAOD::CaloClusterTrigAuxContainer#HLT_TopoCaloClustersFSAux.nCells', 'BS ESD AODFULL AODSLIM AODVERYSLIM', 'MET'), diff --git a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py index ff418c9e35abb79109cfe406f76cff2c5d5e7746..c1b24631c214aaa54ade7915a5d2ccc47f27cb65 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/python/TriggerConfig.py @@ -1,6 +1,7 @@ # Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +from builtins import str from AthenaConfiguration.ComponentAccumulator import ComponentAccumulator from AthenaConfiguration.ComponentFactory import CompFactory from AthenaCommon.CFElements import seqAND, seqOR, flatAlgorithmSequences @@ -43,23 +44,24 @@ def __decisionsFromHypo( hypo ): """ return all chains served by this hypo and the key of produced decision object """ from TrigCompositeUtils.TrigCompositeUtils import isLegId if hypo.getType() == 'ComboHypo': - return [key for key in hypo.MultiplicitiesMap.keys() if not isLegId(key)], hypo.HypoOutputDecisions[0] + return [key for key in list(hypo.MultiplicitiesMap.keys()) if not isLegId(key)], hypo.HypoOutputDecisions[0] else: # regular hypos return [ t.name() for t in hypo.HypoTools if not isLegId(t.name())], hypo.HypoOutputDecisions def collectViewMakers( steps ): """ collect all view maker algorithms in the configuration """ - makers = set() # map with name, instance and encompasing recoSequence + makers = [] # map with name, instance and encompasing recoSequence for stepSeq in steps.getChildren(): for recoSeq in stepSeq.getChildren(): algsInSeq = flatAlgorithmSequences( recoSeq ) for seq,algs in six.iteritems (algsInSeq): for alg in algs: if "EventViewCreator" in alg.getFullName(): # TODO base it on checking types of write handles once available - makers.add(alg) - __log.info("Found View Makers: {}".format( ' '.join([ maker.name() for maker in makers ]) )) - return list(makers) + makers.append(alg) + makers = sorted(set(makers)) #Remove duplicates and return in reproducible order + __log.debug("Found ViewMakers: {}".format( ' '.join([ maker.name() for maker in makers ]) )) + return makers @@ -143,7 +145,7 @@ def collectDecisionObjects( hypos, filters, l1decoder, hltSummary ): decisionObjects.update(decObjHypo) decisionObjects.update(decObjFilter) decisionObjects.update(decObjSummary) - return decisionObjects + return sorted(decisionObjects) def triggerSummaryCfg(flags, hypos): """ @@ -173,10 +175,10 @@ def triggerSummaryCfg(flags, hypos): # TODO once sequences available in the menu we need to crosscheck it here assert len(chainDict['chainParts']) == 1, "Chains w/o the steps can not have mutiple parts in chainDict, it makes no sense: %s"%chainName allChains[chainName] = mapThresholdToL1DecisionCollection( chainDict['chainParts'][0]['L1threshold'] ) - __log.info("The chain %s final decisions will be taken from %s", chainName, allChains[chainName] ) + __log.debug("The chain %s final decisions will be taken from %s", chainName, allChains[chainName] ) for c, cont in six.iteritems (allChains): - __log.info("Final decision of chain " + c + " will be read from " + cont ) + __log.debug("Final decision of chain " + c + " will be read from " + cont ) decisionSummaryAlg.FinalDecisionKeys = list(set(allChains.values())) decisionSummaryAlg.FinalStepDecisions = allChains decisionSummaryAlg.DecisionsSummaryKey = "HLTNav_Summary" # Output @@ -207,7 +209,7 @@ def triggerMonitoringCfg(flags, hypos, filters, l1Decoder): allChains.update( hypoChains ) dcTool = DecisionCollectorTool( "DecisionCollector" + stepName, Decisions=list(set(stepDecisionKeys)) ) - __log.info( "The step monitoring decisions in " + dcTool.name() + " " +str( dcTool.Decisions ) ) + __log.debug( "The step monitoring decisions in " + dcTool.name() + " " +str( dcTool.Decisions ) ) mon.CollectorTools += [ dcTool ] @@ -215,7 +217,7 @@ def triggerMonitoringCfg(flags, hypos, filters, l1Decoder): mon.L1Decisions = l1Decoder.getProperties()['L1DecoderSummaryKey'] if l1Decoder.getProperties()['L1DecoderSummaryKey'] != '<no value>' else l1Decoder.getDefaultProperty('L1DecoderSummary') from DecisionHandling.DecisionHandlingConfig import setupFilterMonitoring - [ [ setupFilterMonitoring( alg ) for alg in algs ] for algs in filters.values() ] + [ [ setupFilterMonitoring( alg ) for alg in algs ] for algs in list(filters.values()) ] return acc, mon @@ -294,7 +296,7 @@ def triggerBSOutputCfg(flags, decObj, decObjHypoOut, summaryAlg, offline=False): from TrigEDMConfig.TriggerEDM import getRun3BSList # handle the collectiosn defined in the EDM config - collectionsToBS = getRun3BSList( ["BS"]+ EventBuildingInfo.DataScoutingIdentifiers.keys() ) + collectionsToBS = getRun3BSList( ["BS"]+ list(EventBuildingInfo.DataScoutingIdentifiers.keys()) ) from collections import OrderedDict @@ -312,9 +314,9 @@ def triggerBSOutputCfg(flags, decObj, decObjHypoOut, summaryAlg, offline=False): dynamic = '.' # Include dynamic typeName = 'xAOD::TrigCompositeContainer#{:s}'.format(item) typeNameAux = 'xAOD::TrigCompositeAuxContainer#{:s}Aux{:s}'.format(item, dynamic) - if typeName not in ItemModuleDict.keys(): + if typeName not in list(ItemModuleDict.keys()): ItemModuleDict[typeName] = [EventBuildingInfo.getFullHLTResultID()] - if typeNameAux not in ItemModuleDict.keys(): + if typeNameAux not in list(ItemModuleDict.keys()): ItemModuleDict[typeNameAux] = [EventBuildingInfo.getFullHLTResultID()] from TrigOutputHandling.TrigOutputHandlingConfig import TriggerEDMSerialiserToolCfg, StreamTagMakerToolCfg, TriggerBitsMakerToolCfg @@ -330,7 +332,7 @@ def triggerBSOutputCfg(flags, decObj, decObjHypoOut, summaryAlg, offline=False): bitsmaker = TriggerBitsMakerToolCfg() # Map decisions producing PEBInfo from DecisionSummaryMakerAlg.FinalStepDecisions to StreamTagMakerTool.PEBDecisionKeys - pebDecisionKeys = [key for key in summaryAlg.getProperties()['FinalStepDecisions'].values() if 'PEBInfoWriter' in key] + pebDecisionKeys = [key for key in list(summaryAlg.getProperties()['FinalStepDecisions'].values()) if 'PEBInfoWriter' in key] stmaker.PEBDecisionKeys = pebDecisionKeys acc = ComponentAccumulator(sequenceName="HLTTop") @@ -423,7 +425,7 @@ def triggerMergeViewsAndAddMissingEDMCfg( edmSet, hypos, viewMakers, decObj, dec alg = HLTEDMCreatorAlg("EDMCreatorAlg") # configure views merging - needMerging = filter( lambda x: len(x) >= 4 and x[3].startswith("inViews:"), TriggerHLTListRun3 ) + needMerging = [x for x in TriggerHLTListRun3 if len(x) >= 4 and x[3].startswith("inViews:")] __log.info("These collections need merging: {}".format( " ".join([ c[0] for c in needMerging ])) ) # group by the view collection name/(the view maker algorithm in practice) from collections import defaultdict @@ -566,6 +568,9 @@ def triggerIDCCacheCreatorsCfg(flags): from MuonConfig.MuonBytestreamDecodeConfig import MuonCacheCfg acc.merge( MuonCacheCfg() ) + from MuonConfig.MuonRdoDecodeConfig import MuonPrdCacheCfg + acc.merge( MuonPrdCacheCfg() ) + from TrigInDetConfig.InDetConfig import InDetIDCCacheCreatorCfg acc.merge( InDetIDCCacheCreatorCfg() ) diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py index 1e093f673114936c5d61013769b611b838c48410..3e0425ff1f3e174e707ac23b3b13f539d7dfe5bb 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py @@ -363,6 +363,20 @@ if TriggerFlags.doMuon(): include ("MuonRecExample/MuonRecLoadTools.py") +# --------------------------------------------------------------- +# ID conditions +# --------------------------------------------------------------- + +if TriggerFlags.doID: + from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags + InDetTrigFlags.doPixelClusterSplitting = False + + # PixelLorentzAngleSvc and SCTLorentzAngleSvc + from AthenaCommon.Include import include + include("InDetRecExample/InDetRecConditionsAccess.py") + + + # ---------------------------------------------------------------- # Pool input # ---------------------------------------------------------------- @@ -483,19 +497,6 @@ if not opt.createHLTMenuExternally: -# --------------------------------------------------------------- -# ID conditions -# --------------------------------------------------------------- - -if TriggerFlags.doID: - from InDetTrigRecExample.InDetTrigFlags import InDetTrigFlags - InDetTrigFlags.doPixelClusterSplitting = False - - # PixelLorentzAngleSvc and SCTLorentzAngleSvc - from AthenaCommon.Include import include - include("InDetRecExample/InDetRecConditionsAccess.py") - - # --------------------------------------------------------------- # Monitoring # --------------------------------------------------------------- diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py index 65d4c8e2d6707937d868f015c797e64b15d42611..8f6b8be6ccb14be02e5a9d2959e7b8402c547715 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Jet/JetRecoConfiguration.py @@ -1,5 +1,5 @@ # -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # ########################################################################################## @@ -104,11 +104,15 @@ def defineCalibFilterMods(jetRecoDict,dataSource,rhoKey="auto"): if jetRecoDict["trkopt"]=="notrk" and "gsc" in jetRecoDict["jetCalib"]: raise ValueError("Track GSC requested but no track source provided!") + if jetRecoDict["trkopt"]=="notrk" and "subres" in jetRecoDict["jetCalib"]: + raise ValueError("Pileup residual calibration requested but no track source provided!") + if jetRecoDict["dataType"]=="tc": calibContext,calibSeq = { ("a4","subjes"): ("TrigRun2","JetArea_EtaJES_GSC"), # Calo GSC only ("a4","subjesIS"): ("TrigRun2","JetArea_EtaJES_GSC_Insitu"), # Calo GSC only ("a4","subjesgscIS"): ("TrigRun2GSC","JetArea_EtaJES_GSC_Insitu"), # Calo+Trk GSC + ("a4","subresjesgscIS"): ("TrigRun2GSC","JetArea_Residual_EtaJES_GSC_Insitu"), # pu residual + calo+trk GSC ("a10","subjes"): ("TrigUngroomed","JetArea_EtaJES"), ("a10t","jes"): ("TrigTrimmed","EtaJES_JMS"), }[(jetRecoDict["recoAlg"],jetRecoDict["jetCalib"])] @@ -117,13 +121,15 @@ def defineCalibFilterMods(jetRecoDict,dataSource,rhoKey="auto"): ("a4","subjes"): ("TrigLS2","JetArea_EtaJES_GSC"), ("a4","subjesIS"): ("TrigLS2","JetArea_EtaJES_GSC_Insitu"), ("a4","subjesgscIS"): ("TrigLS2","JetArea_EtaJES_GSC_Insitu"), + ("a4","subresjesgscIS"): ("TrigLS2","JetArea_Residual_EtaJES_GSC_Insitu"), }[(jetRecoDict["recoAlg"],jetRecoDict["jetCalib"])] gscDepth = "auto" if "gsc" in jetRecoDict["jetCalib"]: gscDepth = "trackWIDTH" + pvname = "HLT_EFHistoPrmVtx" - calibSpec = ":".join( [calibContext, dataSource, calibSeq, rhoKey, gscDepth] ) + calibSpec = ":".join( [calibContext, dataSource, calibSeq, rhoKey, pvname, gscDepth] ) from .TriggerJetMods import ConstitFourMom_copy if jetalg=="a4": calibMods = [(ConstitFourMom_copy,""), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py index d710ed0bf219a35560acd5509ad0880cfc765a92..f76b27f706f15e032c5f895c6542b09b96863293 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/MET/AlgConfigs.py @@ -7,6 +7,9 @@ from ..Menu.MenuComponents import RecoFragmentsPool from ..Menu.SignatureDicts import METChainParts import GaudiKernel.SystemOfUnits as Units +from AthenaCommon.Logging import logging +log = logging.getLogger(__name__) + def test_configs(): """ Make sure that all algorithms defined in the METChainParts have configurations @@ -134,3 +137,36 @@ class TrkMHTConfig(AlgConfig): self.fexAlg.TrackSelTool.maxZ0SinTheta = 1.5 self.fexAlg.TrackSelTool.maxD0overSigmaD0 = 3 self.fexAlg.TrackSelTool.minPt = 1 * Units.GeV + +class PFSumConfig(AlgConfig): + @classmethod + def algType(cls): + return "pfsum" + + def __init__(self, **recoDict): + super(PFSumConfig, self).__init__(**recoDict) + + from TrigT2CaloCommon.CaloDef import HLTFSTopoRecoSequence + from eflowRec.PFHLTSequence import PFHLTSequence + from ..Jet.JetRecoConfiguration import defineJetConstit + from TrigEFMissingET.TrigEFMissingETConf import HLT__MET__PFSumFex + jetRecoDict = jetRecoDictForMET(trkopt="ftf", **recoDict) + jetRecoDict["calib"] = "em" + jetRecoDict["dataType"] = "pf" + + RoIs = self.inputMaker.RoIs + tcSeq, clusterName = RecoFragmentsPool.retrieve( + HLTFSTopoRecoSequence, RoIs) + pfseq, pfoPrefix = RecoFragmentsPool.retrieve( + PFHLTSequence, None, clustersin = clusterName, tracktype="ftf") + constit = defineJetConstit(jetRecoDict, pfoPrefix=pfoPrefix) + from JetRecConfig.ConstModHelpers import getConstitModAlg + constit_mod_seq = getConstitModAlg( + constit, "HLT", + tvaKey="JetTrackVtxAssoc_{trkopt}".format(**jetRecoDict), + vtxKey="HLT_EFHistoPrmVtx") + self.inputs = [tcSeq, pfseq, constit_mod_seq] + self.fexAlg = self._make_fex_alg( + HLT__MET__PFSumFex, + NeutralPFOName = pfoPrefix+"CHSNeutralParticleFlowObjects", + ChargedPFOName = pfoPrefix+"CHSChargedParticleFlowObjects") diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py index 483cac21695e05ea74bfa204b0b220eb5dbcaa6a..a7b7ce91b0766708266419d74589cb29ab6c29dc 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/HLTCFConfig.py @@ -70,7 +70,7 @@ def createStepFilterNode(name, seq_list, dump=False): filter_list.append(filterAlg) - stepCF = parOR(name + CFNaming.FILTER_POSTFIX, subs=set(filter_list)) + stepCF = parOR(name + CFNaming.FILTER_POSTFIX, subs=sorted(set(filter_list))) if dump: dumpSequence (stepCF, indent=0) diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py index 2a7aeccd7d81238f2e966716474e63946422da2e..88e6b937f26599a587f0ba800c30700da60d779c 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/LS2_v1.py @@ -102,6 +102,7 @@ def setupMenu(): ChainProp(name='HLT_xe30_mht_L1XE10', groups=SingleMETGroup), ChainProp(name='HLT_xe30_tcpufit_L1XE10', groups=SingleMETGroup), ChainProp(name='HLT_xe30_trkmht_L1XE10', groups=SingleMETGroup), + ChainProp(name='HLT_xe30_pfsum_L1XE10', groups=SingleMETGroup), # MultiMET Chain ChainProp(name='HLT_xe30_cell_xe30_tcpufit_L1XE10',l1SeedThresholds=['XE10']*2, groups=MultiMETGroup), #must be FS seeded ] @@ -111,11 +112,14 @@ def setupMenu(): ChainProp(name='HLT_j45_L1J15', groups=SingleJetGroup), ChainProp(name='HLT_j420_L1J20', groups=SingleJetGroup), ChainProp(name='HLT_j45_ftf_subjesgscIS_L1J15', groups=SingleJetGroup), + ChainProp(name='HLT_j45_ftf_subresjesgscIS_L1J15', groups=SingleJetGroup), ChainProp(name='HLT_j45_ftf_L1J15', groups=SingleJetGroup), ChainProp(name='HLT_j85_ftf_L1J20', groups=SingleJetGroup), ChainProp(name='HLT_j45_ftf_pf_L1J20', groups=SingleJetGroup), + ChainProp(name='HLT_j45_ftf_subjesgscIS_pf_L1J20', groups=SingleJetGroup), + ChainProp(name='HLT_j45_ftf_subresjesgscIS_pf_L1J20', groups=SingleJetGroup), ChainProp(name='HLT_j85_ftf_pf_L1J20', groups=SingleJetGroup), ChainProp(name='HLT_j420_ftf_subjesgscIS_L1J20', groups=SingleJetGroup), diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py index 6c281e0380d2b0c8b59cb861c68f38c164fc8f82..da971ab8436288db94ecb854377444d444816644 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Menu/SignatureDicts.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from AthenaCommon.Logging import logging log = logging.getLogger( __name__ ) log.info("Importing %s",__name__) @@ -102,7 +102,7 @@ JetChainParts = { 'recoAlg' : ['a4', 'a10', 'a10r', 'a10t'], 'dataType' : ['tc','sktc','pf'], 'calib' : ['em', 'lcw'], - 'jetCalib' : ['jes', 'subjes', 'subjesIS', 'subjesgscIS', 'nojcalib'], + 'jetCalib' : ['jes', 'subjes', 'subjesIS', 'subjesgscIS', 'subresjesgscIS', 'nojcalib'], 'scan' : ['FS',], 'addInfo' : ['perf'], @@ -186,7 +186,7 @@ MuonChainParts = { 'IDinfo' : [], 'isoInfo' : ['ivar','ivarmedium'], 'invMassInfo' : ['10invm70'], - 'addInfo' : ['1step','idperf','3layersEC','cosmic'], + 'addInfo' : ['1step','idperf','3layersEC','cosmic',"muonqual"], 'topo' : AllowedTopos_mu, 'flavour' : [], } @@ -277,7 +277,7 @@ METChainParts = { 'extra' : ['noL1'], 'calib' : ['lcw',], 'L2recoAlg' : [], - 'EFrecoAlg' : ['cell', 'tcpufit', 'mht', 'trkmht'], + 'EFrecoAlg' : ['cell', 'tcpufit', 'mht', 'trkmht', 'pfsum'], 'L2muonCorr' : [], 'EFmuonCorr' : [], 'addInfo' : ['FStracks'], diff --git a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py index c6f8f34eaa056d6aa35cc1592eb32028ddfe4261..7fe733004b11b3865b5b195fd64d22231a5ee04c 100644 --- a/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py +++ b/Trigger/TriggerCommon/TriggerMenuMT/python/HLTMenuConfig/Muon/MuonSetup.py @@ -10,6 +10,7 @@ log = logging.getLogger('MuonSetup') ### Output data name ### from TrigEDMConfig.TriggerEDMRun3 import recordable from MuonConfig.MuonBytestreamDecodeConfig import MuonCacheNames +from MuonConfig.MuonRdoDecodeConfig import MuonPrdCacheNames TrackParticlesName = recordable("HLT_xAODTracks_Muon") theFTF_name = "FTFTracks_Muons" @@ -78,9 +79,10 @@ def makeMuonPrepDataAlgs(RoIs="MURoIs", forFullScan=False): Decoder = CSCRodDecoder ) ToolSvc += MuonCscRawDataProviderTool - from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscRdoToCscPrepDataTool - CscRdoToCscPrepDataTool = Muon__CscRdoToCscPrepDataTool(name = "CscRdoToCscPrepDataTool") - + from MuonCSC_CnvTools.MuonCSC_CnvToolsConf import Muon__CscRdoToCscPrepDataToolMT + CscRdoToCscPrepDataTool = Muon__CscRdoToCscPrepDataToolMT(name = "CscRdoToCscPrepDataTool", + CscStripPrdContainerCacheKey = MuonPrdCacheNames.CscStripCache) + ToolSvc += CscRdoToCscPrepDataTool from MuonRdoToPrepData.MuonRdoToPrepDataConf import CscRdoToCscPrepData @@ -123,8 +125,9 @@ def makeMuonPrepDataAlgs(RoIs="MURoIs", forFullScan=False): Decoder = MDTRodDecoder ) ToolSvc += MuonMdtRawDataProviderTool - from MuonMDT_CnvTools.MuonMDT_CnvToolsConf import Muon__MdtRdoToPrepDataTool - MdtRdoToMdtPrepDataTool = Muon__MdtRdoToPrepDataTool(name = "MdtRdoToPrepDataTool") + from MuonMDT_CnvTools.MuonMDT_CnvToolsConf import Muon__MdtRdoToPrepDataToolMT + MdtRdoToMdtPrepDataTool = Muon__MdtRdoToPrepDataToolMT(name = "MdtRdoToPrepDataTool", + MdtPrdContainerCacheKey = MuonPrdCacheNames.MdtCache) ToolSvc += MdtRdoToMdtPrepDataTool @@ -162,6 +165,13 @@ def makeMuonPrepDataAlgs(RoIs="MURoIs", forFullScan=False): from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataTool RpcRdoToRpcPrepDataTool = Muon__RpcRdoToPrepDataTool(name = "RpcRdoToPrepDataTool") + + #from MuonRPC_CnvTools.MuonRPC_CnvToolsConf import Muon__RpcRdoToPrepDataToolMT + #RpcRdoToRpcPrepDataTool = Muon__RpcRdoToPrepDataToolMT(name = "RpcRdoToPrepDataTool", + # RpcPrdContainerCacheKey = MuonPrdCacheNames.RpcCache, + # RpcCoinContainerCacheKey = MuonPrdCacheNames.RpcCoinCache) + #RpcRdoToRpcPrepDataTool.OutputLevel = DEBUG + if athenaCommonFlags.isOnline: RpcRdoToRpcPrepDataTool.ReadKey = "" @@ -538,8 +548,16 @@ def muEFCBRecoSequence( RoIs, name ): trackParticles = PTTrackParticles[-1] #Make InDetCandidates + from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool + from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigExtrapolator + from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTrackSummaryTool + + InDetTrigTrackSelectorTool = InDet__InDetDetailedTrackSelectorTool("InDetTrigTrackSelectorTool", + TrackSummaryTool = InDetTrigTrackSummaryTool, + Extrapolator = InDetTrigExtrapolator, + ) theIndetCandidateAlg = MuonCombinedInDetCandidateAlg("TrigMuonCombinedInDetCandidateAlg_"+name,TrackParticleLocation = [trackParticles],ForwardParticleLocation=trackParticles, - InDetCandidateLocation="InDetCandidates_"+name) + InDetCandidateLocation="InDetCandidates_"+name, TrackSelector = InDetTrigTrackSelectorTool) #MS ID combination candidatesName = "MuonCandidates" @@ -621,8 +639,18 @@ def muEFInsideOutRecoSequence(RoIs, name): trackParticles = PTTrackParticles[-1] #Make InDetCandidates + + from InDetTrackSelectorTool.InDetTrackSelectorToolConf import InDet__InDetDetailedTrackSelectorTool + from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigExtrapolator + from InDetTrigRecExample.InDetTrigConfigRecLoadTools import InDetTrigTrackSummaryTool + + InDetTrigTrackSelectorTool = InDet__InDetDetailedTrackSelectorTool("InDetTrigTrackSelectorTool", + TrackSummaryTool = InDetTrigTrackSummaryTool, + Extrapolator = InDetTrigExtrapolator, + ) + theIndetCandidateAlg = MuonCombinedInDetCandidateAlg("TrigMuonCombinedInDetCandidateAlg_"+name,TrackParticleLocation = [trackParticles],ForwardParticleLocation=trackParticles, - InDetCandidateLocation="InDetCandidates_"+name) + InDetCandidateLocation="InDetCandidates_"+name, TrackSelector = InDetTrigTrackSelectorTool) efAlgs.append(theIndetCandidateAlg) diff --git a/Trigger/TriggerSimulation/TrigSimTransforms/python/rdo2bs_rodversion_setup.py b/Trigger/TriggerSimulation/TrigSimTransforms/python/rdo2bs_rodversion_setup.py index e8c9191e771aa53499808dc5ab0ac4f0e60539db..4256a5c139b81be3c73ea2048760750c19cdc7e3 100755 --- a/Trigger/TriggerSimulation/TrigSimTransforms/python/rdo2bs_rodversion_setup.py +++ b/Trigger/TriggerSimulation/TrigSimTransforms/python/rdo2bs_rodversion_setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration def rod_version_setup(trigger_release): @@ -24,7 +24,7 @@ def rod_version_setup(trigger_release): def main(): from TrigSimTransforms.rodconfig import get_rod_config - print get_rod_config("17.1.3.4") + print(get_rod_config("17.1.3.4")) return 0 diff --git a/graphics/GeometryJiveXML/CMakeLists.txt b/graphics/GeometryJiveXML/CMakeLists.txt index 8e57bf2cbdd83ab28dc9e4ee69a5bafb2d371538..01e7a782a00e11cdd7981bc709350668cb1c5ac6 100644 --- a/graphics/GeometryJiveXML/CMakeLists.txt +++ b/graphics/GeometryJiveXML/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry LArCalorimeter/LArGeoModel/LArReadoutGeometry MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers @@ -28,7 +29,7 @@ atlas_add_component( GeometryJiveXML src/*.cxx src/components/*.cxx INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS} - LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps JiveXMLLib CaloDetDescrLib StoreGateLib SGtests GaudiKernel InDetIdentifier InDetReadoutGeometry LArReadoutGeometry MuonReadoutGeometry MuonIdHelpersLib TileDetDescr ) + LINK_LIBRARIES ${CLHEP_LIBRARIES} AthenaBaseComps JiveXMLLib CaloDetDescrLib StoreGateLib SGtests GaudiKernel InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry LArReadoutGeometry MuonReadoutGeometry MuonIdHelpersLib TileDetDescr ) # Install files from the package: atlas_install_headers( GeometryJiveXML ) diff --git a/graphics/GeometryJiveXML/src/GeometryWriter.cxx b/graphics/GeometryJiveXML/src/GeometryWriter.cxx index 709e15434f2fdcd0b2017cf4f60beff4b0f3d93c..0c245c8015468eda3b7c91f60ebe26287c194d50 100755 --- a/graphics/GeometryJiveXML/src/GeometryWriter.cxx +++ b/graphics/GeometryJiveXML/src/GeometryWriter.cxx @@ -20,7 +20,7 @@ // #include "GeoModelKernel/GeoTube.h" // #include "GeoModelKernel/GeoTrd.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetReadoutGeometry/SiDetectorElementCollection.h" diff --git a/graphics/VP1/VP1Systems/VP12DGeometrySystems/CMakeLists.txt b/graphics/VP1/VP1Systems/VP12DGeometrySystems/CMakeLists.txt index b0ff149c0104f68125c8a1021dcb0e9cb6bb4507..80dfcc0adc993949574b1599a5515688d85b8fca 100644 --- a/graphics/VP1/VP1Systems/VP12DGeometrySystems/CMakeLists.txt +++ b/graphics/VP1/VP1Systems/VP12DGeometrySystems/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC DetectorDescription/IdDictDetDescr InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry LArCalorimeter/LArGeoModel/LArReadoutGeometry MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry MuonSpectrometer/MuonIdHelpers @@ -23,12 +24,17 @@ atlas_depends_on_subdirs( PUBLIC # External dependencies: find_package( Eigen ) find_package( GeoModelCore ) +find_package( Qt5 ) + +# Run the QT build steps automatically. +set( CMAKE_AUTOMOC TRUE ) +set( CMAKE_AUTOUIC TRUE ) # Component(s) in the package: atlas_add_library( VP12DGeometrySystems - src/*.c* + VP12DGeometrySystems/*.h src/*.cxx src/*.ui PUBLIC_HEADERS VP12DGeometrySystems INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} LINK_LIBRARIES ${EIGEN_LIBRARIES} GeoPrimitives VP1Base StoreGateLib SGtests CaloDetDescrLib MuonIdHelpersLib - PRIVATE_LINK_LIBRARIES ${GEOMODELCORE_LIBRARIES} IdDictDetDescr InDetIdentifier InDetReadoutGeometry LArReadoutGeometry MuonReadoutGeometry TileDetDescr ) + PRIVATE_LINK_LIBRARIES ${GEOMODELCORE_LIBRARIES} IdDictDetDescr InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry LArReadoutGeometry MuonReadoutGeometry TileDetDescr ) diff --git a/graphics/VP1/VP1Systems/VP12DGeometrySystems/src/StoreGateGeometryReader.cxx b/graphics/VP1/VP1Systems/VP12DGeometrySystems/src/StoreGateGeometryReader.cxx index d804f34d9cc5131d36c53609debefde352c6ab0f..5fc718710658c4cd0d99f704ef28d81796a008f6 100644 --- a/graphics/VP1/VP1Systems/VP12DGeometrySystems/src/StoreGateGeometryReader.cxx +++ b/graphics/VP1/VP1Systems/VP12DGeometrySystems/src/StoreGateGeometryReader.cxx @@ -14,7 +14,7 @@ #include "GeoModelKernel/GeoPVConstLink.h" #include "GeoModelKernel/GeoTrd.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetReadoutGeometry/SiDetectorElementCollection.h" diff --git a/graphics/VP1/VP1Systems/VP1RawDataSystems/CMakeLists.txt b/graphics/VP1/VP1Systems/VP1RawDataSystems/CMakeLists.txt index eb6cf5aba690ae4febface804c3199c2ec050bb9..7509b5a495dedbe51006882eb369862b194084b2 100644 --- a/graphics/VP1/VP1Systems/VP1RawDataSystems/CMakeLists.txt +++ b/graphics/VP1/VP1Systems/VP1RawDataSystems/CMakeLists.txt @@ -15,6 +15,7 @@ atlas_depends_on_subdirs( PUBLIC GaudiKernel InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetRawEvent/InDetBCM_RawData InnerDetector/InDetRawEvent/InDetRawData graphics/VP1/VP1HEPVis @@ -43,5 +44,5 @@ atlas_add_library( VP1RawDataSystems VP1RawDataSystems/*.h src/*.h src/*.cxx src PRIVATE_INCLUDE_DIRS ${COIN3D_INCLUDE_DIRS} FILES LUCID_RawEvent/LUCID_Digit.h LINK_LIBRARIES ${EIGEN_LIBRARIES} GeoPrimitives VP1Base GL - PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${GEOMODELCORE_LIBRARIES} EventPrimitives LUCID_RawEvent GaudiKernel InDetIdentifier InDetReadoutGeometry InDetBCM_RawData InDetRawData VP1HEPVis VP1Utils ) + PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${GEOMODELCORE_LIBRARIES} EventPrimitives LUCID_RawEvent GaudiKernel InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry InDetBCM_RawData InDetRawData VP1HEPVis VP1Utils ) diff --git a/graphics/VP1/VP1Systems/VP1RawDataSystems/src/VP1RawDataHandle_PixelRDO.cxx b/graphics/VP1/VP1Systems/VP1RawDataSystems/src/VP1RawDataHandle_PixelRDO.cxx index aca8c915228c3bf8624433fc707a95d64b3caf17..9ee440a40a8691a87efcca30c7a8776273031d58 100644 --- a/graphics/VP1/VP1Systems/VP1RawDataSystems/src/VP1RawDataHandle_PixelRDO.cxx +++ b/graphics/VP1/VP1Systems/VP1RawDataSystems/src/VP1RawDataHandle_PixelRDO.cxx @@ -17,7 +17,7 @@ #include "VP1Utils/VP1DetInfo.h" #include "VP1Utils/VP1LinAlgUtils.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetRawData/PixelRDORawData.h" #include "InDetIdentifier/PixelID.h" diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/CMakeLists.txt b/graphics/VP1/VP1Systems/VP1TrackSystems/CMakeLists.txt index 3a7af0a14da166545658b793bc8e2e80119a1293..044e0424a2ef80e5d51c0625ba380e8cfcf5e472 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/CMakeLists.txt +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/CMakeLists.txt @@ -29,6 +29,7 @@ atlas_depends_on_subdirs( ForwardDetectors/ForwardSimulation/ForwardRegion_SimEv InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetRecEvent/InDetPrepRawData InnerDetector/InDetRecEvent/InDetRIO_OnTrack InnerDetector/InDetSimEvent @@ -83,7 +84,7 @@ atlas_add_library( VP1TrackSystems VP1TrackSystems/*.h src/*.cxx MuonIdHelpersLib MuonRecHelperToolsLib Qt5::Core Qt5::Gui PRIVATE_LINK_LIBRARIES ${COIN3D_LIBRARIES} ${CLHEP_LIBRARIES} ${HEPMC_LIBRARIES} AthContainers AtlasDetDescr EventPrimitives - ForwardRegion_SimEv InDetIdentifier InDetReadoutGeometry InDetPrepRawData + ForwardRegion_SimEv InDetIdentifier InDetReadoutGeometry PixelReadoutGeometry InDetPrepRawData InDetRIO_OnTrack InDetSimEvent MuonReadoutGeometry MuonChamberT0s MuonPrepRawData MuonRIO_OnTrack MuonSegment MuonSimEvent Particle TrkDetDescrUtils TrkDetElementBase TrkVolumes TrkCompetingRIOsOnTrack diff --git a/graphics/VP1/VP1Systems/VP1TrackSystems/src/SimHitHandle_SiHit.cxx b/graphics/VP1/VP1Systems/VP1TrackSystems/src/SimHitHandle_SiHit.cxx index 4fda1569d553e02bddec737df6adff55d7682119..1e4b1ca4679121df04886fd98eb85f0a79f29c19 100644 --- a/graphics/VP1/VP1Systems/VP1TrackSystems/src/SimHitHandle_SiHit.cxx +++ b/graphics/VP1/VP1Systems/VP1TrackSystems/src/SimHitHandle_SiHit.cxx @@ -20,7 +20,7 @@ #include "InDetSimEvent/SiHit.h" #include "InDetReadoutGeometry/SiDetectorElement.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetIdentifier/PixelID.h" #include "InDetIdentifier/SCT_ID.h" #include "VP1TrackSystems/VP1TrackSanity.h" diff --git a/graphics/VP1/VP1Utils/CMakeLists.txt b/graphics/VP1/VP1Utils/CMakeLists.txt index 4745154d5077916b441d0f49f0b16bd801402d42..d3b3db5f6104a1b16031f4d6990e6caf15c519fc 100644 --- a/graphics/VP1/VP1Utils/CMakeLists.txt +++ b/graphics/VP1/VP1Utils/CMakeLists.txt @@ -27,6 +27,7 @@ atlas_depends_on_subdirs( DetectorDescription/Identifier InnerDetector/InDetDetDescr/InDetIdentifier InnerDetector/InDetDetDescr/InDetReadoutGeometry + InnerDetector/InDetDetDescr/PixelReadoutGeometry InnerDetector/InDetRecEvent/InDetRIO_OnTrack LArCalorimeter/LArGeoModel/LArReadoutGeometry MuonSpectrometer/MuonDetDescr/MuonReadoutGeometry @@ -62,7 +63,7 @@ atlas_add_library( VP1Utils VP1Utils/*.h src/*.cxx src/*.cpp PRIVATE_LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${COIN3D_LIBRARIES} ${EIGEN_LIBRARIES} CaloIdentifier CaloTTDetDescr CxxUtils AtlasDetDescr GeoModelUtilities GeoSpecialShapes Identifier InDetIdentifier - InDetReadoutGeometry InDetRIO_OnTrack LArReadoutGeometry + InDetReadoutGeometry PixelReadoutGeometry InDetRIO_OnTrack LArReadoutGeometry MuonReadoutGeometry MuonRIO_OnTrack TileDetDescr TrkSurfaces TrkRIO_OnTrack VP1HEPVis ) endif() diff --git a/graphics/VP1/VP1Utils/src/VP1DetInfo.cxx b/graphics/VP1/VP1Utils/src/VP1DetInfo.cxx index 3e02f9e0bb41f516adf0cbfb3abb31de7bea0410..2c9405336991d7c6e369c1ae4af7cedd0204c3c5 100644 --- a/graphics/VP1/VP1Utils/src/VP1DetInfo.cxx +++ b/graphics/VP1/VP1Utils/src/VP1DetInfo.cxx @@ -22,7 +22,7 @@ #include "GeoModelKernel/GeoPVConstLink.h" #include "InDetReadoutGeometry/TRT_DetectorManager.h" -#include "InDetReadoutGeometry/PixelDetectorManager.h" +#include "PixelReadoutGeometry/PixelDetectorManager.h" #include "InDetReadoutGeometry/SCT_DetectorManager.h" //#include "InDetServMatGeoModel/InDetServMatManager.h" #include "MuonReadoutGeometry/MuonDetectorManager.h"