From 50a45f867be3aa6b31a2a16cc386d128055457df Mon Sep 17 00:00:00 2001 From: Gabriel Ramirez Date: Mon, 8 Feb 2021 11:23:24 +0100 Subject: [PATCH 01/46] Setting fixed binning for the nClusters histograms --- DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc | 4 ++-- DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc index 6aa9ec92ca102..57de4eb75aff3 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc @@ -261,7 +261,7 @@ void Phase2ITMonitorCluster::fillDescriptions(edm::ConfigurationDescriptions& de psd0.add("title", "NumberClusters;Number of Clusters;"); psd0.add("xmin", 0.0); psd0.add("switch", true); - psd0.add("xmax", 0.0); + psd0.add("xmax", 300000.0); psd0.add("NxBins", 50); desc.add("GlobalNClusters", psd0); } @@ -325,7 +325,7 @@ void Phase2ITMonitorCluster::fillDescriptions(edm::ConfigurationDescriptions& de psd0.add("title", "NumberOfClutsers;Number of Clusters;"); psd0.add("xmin", 0.0); psd0.add("switch", true); - psd0.add("xmax", 0.0); + psd0.add("xmax", 15000.0); psd0.add("NxBins", 50); desc.add("NClustersLayer", psd0); } diff --git a/DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc b/DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc index 3533db537cf1e..069cc6131d2ce 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc @@ -275,7 +275,7 @@ void Phase2OTMonitorCluster::fillDescriptions(edm::ConfigurationDescriptions& de psd0.add("title", ";Number of clusters per event;"); psd0.add("xmin", 0.0); psd0.add("switch", true); - psd0.add("xmax", 0.0); + psd0.add("xmax", 350000.0); psd0.add("NxBins", 50); desc.add("GlobalNClusters", psd0); } @@ -338,7 +338,7 @@ void Phase2OTMonitorCluster::fillDescriptions(edm::ConfigurationDescriptions& de psd0.add("name", "NumberOfClustersLayerP"); psd0.add("title", ";Number of clusters per event(macro pixel sensor);"); psd0.add("xmin", 0.0); - psd0.add("xmax", 0.0); + psd0.add("xmax", 28000.0); psd0.add("NxBins", 50); psd0.add("switch", true); desc.add("NClustersLayer_P", psd0); @@ -348,7 +348,7 @@ void Phase2OTMonitorCluster::fillDescriptions(edm::ConfigurationDescriptions& de psd0.add("name", "NumberOfClustersLayerS"); psd0.add("title", ";Number of clusters per event(strip sensor);"); psd0.add("xmin", 0.0); - psd0.add("xmax", 0.0); + psd0.add("xmax", 28000.0); psd0.add("NxBins", 50); psd0.add("switch", true); desc.add("NClustersLayer_S", psd0); From 1d84bb033ad2d7cbdeeb47635c9b52991a131440 Mon Sep 17 00:00:00 2001 From: David Date: Sun, 7 Mar 2021 18:11:01 +0100 Subject: [PATCH 02/46] correct Buildfiles --- DataFormats/Alignment/BuildFile.xml | 3 +++ DataFormats/BTauReco/BuildFile.xml | 4 ++++ DataFormats/BeamSpot/BuildFile.xml | 2 ++ DataFormats/CSCDigi/BuildFile.xml | 2 ++ DataFormats/CTPPSDetId/BuildFile.xml | 1 + DataFormats/CTPPSDigi/BuildFile.xml | 1 + DataFormats/CTPPSReco/BuildFile.xml | 2 ++ DataFormats/CaloRecHit/BuildFile.xml | 1 + DataFormats/CastorReco/BuildFile.xml | 1 + DataFormats/EcalDigi/BuildFile.xml | 3 +++ DataFormats/EcalRecHit/BuildFile.xml | 2 ++ DataFormats/EgammaCandidates/BuildFile.xml | 1 + DataFormats/EgammaReco/BuildFile.xml | 3 +++ DataFormats/EgammaTrackReco/BuildFile.xml | 1 + DataFormats/FP420Cluster/BuildFile.xml | 1 + DataFormats/FTLDigi/BuildFile.xml | 1 + DataFormats/GEMDigi/BuildFile.xml | 2 ++ DataFormats/GEMRecHit/BuildFile.xml | 1 + DataFormats/GeometrySurface/BuildFile.xml | 2 ++ DataFormats/GsfTrackReco/BuildFile.xml | 3 +++ DataFormats/HGCDigi/BuildFile.xml | 1 + DataFormats/HGCRecHit/BuildFile.xml | 1 + DataFormats/HGCalReco/BuildFile.xml | 1 + DataFormats/HLTReco/BuildFile.xml | 1 + DataFormats/HcalCalibObjects/BuildFile.xml | 1 + DataFormats/HcalDetId/BuildFile.xml | 1 + DataFormats/HcalDigi/BuildFile.xml | 1 + DataFormats/Histograms/BuildFile.xml | 2 ++ DataFormats/JetReco/BuildFile.xml | 4 ++++ DataFormats/L1TCalorimeterPhase2/BuildFile.xml | 3 +++ DataFormats/L1TGlobal/BuildFile.xml | 2 ++ DataFormats/L1THGCal/BuildFile.xml | 2 ++ DataFormats/L1TMuon/BuildFile.xml | 1 + DataFormats/L1TrackTrigger/BuildFile.xml | 3 +++ DataFormats/L1Trigger/BuildFile.xml | 1 + DataFormats/LTCDigi/BuildFile.xml | 1 + DataFormats/METReco/BuildFile.xml | 12 ++++++++++++ DataFormats/Math/BuildFile.xml | 1 + DataFormats/MuonReco/BuildFile.xml | 4 ++++ DataFormats/MuonSeed/BuildFile.xml | 2 ++ DataFormats/OnlineMetaData/BuildFile.xml | 1 + DataFormats/ParticleFlowCandidate/BuildFile.xml | 2 ++ DataFormats/ProtonReco/BuildFile.xml | 1 + DataFormats/RPCDigi/BuildFile.xml | 3 +++ DataFormats/RecoCandidate/BuildFile.xml | 5 +++++ DataFormats/SiPixelCluster/BuildFile.xml | 2 ++ DataFormats/SiPixelDetId/BuildFile.xml | 1 + DataFormats/SiPixelRawData/BuildFile.xml | 1 + DataFormats/SiStripCluster/BuildFile.xml | 1 + DataFormats/SiStripCommon/BuildFile.xml | 1 + DataFormats/Streamer/BuildFile.xml | 2 ++ DataFormats/TauReco/BuildFile.xml | 2 ++ DataFormats/TestObjects/BuildFile.xml | 2 ++ DataFormats/TrackCandidate/BuildFile.xml | 1 + DataFormats/TrackerRecHit2D/BuildFile.xml | 10 ++++++++++ DataFormats/TrackingRecHit/BuildFile.xml | 3 +++ DataFormats/TrajectoryState/BuildFile.xml | 1 + DataFormats/VertexReco/BuildFile.xml | 2 ++ 58 files changed, 123 insertions(+) diff --git a/DataFormats/Alignment/BuildFile.xml b/DataFormats/Alignment/BuildFile.xml index 7b654617c980f..2114ee0ec721b 100644 --- a/DataFormats/Alignment/BuildFile.xml +++ b/DataFormats/Alignment/BuildFile.xml @@ -2,6 +2,9 @@ + + + diff --git a/DataFormats/BTauReco/BuildFile.xml b/DataFormats/BTauReco/BuildFile.xml index d61fb0cdf68fa..8dcec2898d265 100644 --- a/DataFormats/BTauReco/BuildFile.xml +++ b/DataFormats/BTauReco/BuildFile.xml @@ -5,6 +5,10 @@ + + + + diff --git a/DataFormats/BeamSpot/BuildFile.xml b/DataFormats/BeamSpot/BuildFile.xml index 2e6117fdaf79c..aa43b789310ee 100644 --- a/DataFormats/BeamSpot/BuildFile.xml +++ b/DataFormats/BeamSpot/BuildFile.xml @@ -1,5 +1,7 @@ + + diff --git a/DataFormats/CSCDigi/BuildFile.xml b/DataFormats/CSCDigi/BuildFile.xml index d6439ed232394..dfa1171462466 100644 --- a/DataFormats/CSCDigi/BuildFile.xml +++ b/DataFormats/CSCDigi/BuildFile.xml @@ -1,6 +1,8 @@ + + diff --git a/DataFormats/CTPPSDetId/BuildFile.xml b/DataFormats/CTPPSDetId/BuildFile.xml index 5a1d1280da478..7b963c0dd3077 100644 --- a/DataFormats/CTPPSDetId/BuildFile.xml +++ b/DataFormats/CTPPSDetId/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/DataFormats/CTPPSDigi/BuildFile.xml b/DataFormats/CTPPSDigi/BuildFile.xml index 7c537d9ebb995..38b45babc72b0 100644 --- a/DataFormats/CTPPSDigi/BuildFile.xml +++ b/DataFormats/CTPPSDigi/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/DataFormats/CTPPSReco/BuildFile.xml b/DataFormats/CTPPSReco/BuildFile.xml index 41320fa24a34d..10ada3e092459 100644 --- a/DataFormats/CTPPSReco/BuildFile.xml +++ b/DataFormats/CTPPSReco/BuildFile.xml @@ -2,6 +2,8 @@ + + diff --git a/DataFormats/CaloRecHit/BuildFile.xml b/DataFormats/CaloRecHit/BuildFile.xml index 3a36baafe8b01..135aabf10cd07 100644 --- a/DataFormats/CaloRecHit/BuildFile.xml +++ b/DataFormats/CaloRecHit/BuildFile.xml @@ -1,6 +1,7 @@ + diff --git a/DataFormats/CastorReco/BuildFile.xml b/DataFormats/CastorReco/BuildFile.xml index 6b20714cdb249..f8590afedc96d 100644 --- a/DataFormats/CastorReco/BuildFile.xml +++ b/DataFormats/CastorReco/BuildFile.xml @@ -1,6 +1,7 @@ + diff --git a/DataFormats/EcalDigi/BuildFile.xml b/DataFormats/EcalDigi/BuildFile.xml index 5b1ead14f9466..7e3d70b84fbdd 100644 --- a/DataFormats/EcalDigi/BuildFile.xml +++ b/DataFormats/EcalDigi/BuildFile.xml @@ -1,5 +1,8 @@ + + + diff --git a/DataFormats/EcalRecHit/BuildFile.xml b/DataFormats/EcalRecHit/BuildFile.xml index 3b88044dd0ce9..e38ee48a95bed 100644 --- a/DataFormats/EcalRecHit/BuildFile.xml +++ b/DataFormats/EcalRecHit/BuildFile.xml @@ -2,6 +2,8 @@ + + diff --git a/DataFormats/EgammaCandidates/BuildFile.xml b/DataFormats/EgammaCandidates/BuildFile.xml index 3b9adcd56ab88..673252ed2d9fb 100644 --- a/DataFormats/EgammaCandidates/BuildFile.xml +++ b/DataFormats/EgammaCandidates/BuildFile.xml @@ -13,6 +13,7 @@ + diff --git a/DataFormats/EgammaReco/BuildFile.xml b/DataFormats/EgammaReco/BuildFile.xml index 98b3ad34f1141..993fe380a5352 100644 --- a/DataFormats/EgammaReco/BuildFile.xml +++ b/DataFormats/EgammaReco/BuildFile.xml @@ -5,6 +5,9 @@ + + + diff --git a/DataFormats/EgammaTrackReco/BuildFile.xml b/DataFormats/EgammaTrackReco/BuildFile.xml index 9afb2bb325833..6a0ffe9b8340f 100644 --- a/DataFormats/EgammaTrackReco/BuildFile.xml +++ b/DataFormats/EgammaTrackReco/BuildFile.xml @@ -4,6 +4,7 @@ + diff --git a/DataFormats/FP420Cluster/BuildFile.xml b/DataFormats/FP420Cluster/BuildFile.xml index 7c537d9ebb995..b8bd3c7e515f2 100644 --- a/DataFormats/FP420Cluster/BuildFile.xml +++ b/DataFormats/FP420Cluster/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/DataFormats/FTLDigi/BuildFile.xml b/DataFormats/FTLDigi/BuildFile.xml index 15d7f7b3264a8..27ab1f668924d 100644 --- a/DataFormats/FTLDigi/BuildFile.xml +++ b/DataFormats/FTLDigi/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/DataFormats/GEMDigi/BuildFile.xml b/DataFormats/GEMDigi/BuildFile.xml index ba133c8e101a4..4eecf7bb271bc 100644 --- a/DataFormats/GEMDigi/BuildFile.xml +++ b/DataFormats/GEMDigi/BuildFile.xml @@ -1,6 +1,8 @@ + + diff --git a/DataFormats/GEMRecHit/BuildFile.xml b/DataFormats/GEMRecHit/BuildFile.xml index 9ecef8c127da7..7c61a5807f3b0 100644 --- a/DataFormats/GEMRecHit/BuildFile.xml +++ b/DataFormats/GEMRecHit/BuildFile.xml @@ -2,6 +2,7 @@ + diff --git a/DataFormats/GeometrySurface/BuildFile.xml b/DataFormats/GeometrySurface/BuildFile.xml index 2ba0299686a0c..07cf24d28a8a5 100644 --- a/DataFormats/GeometrySurface/BuildFile.xml +++ b/DataFormats/GeometrySurface/BuildFile.xml @@ -1,4 +1,6 @@ + + diff --git a/DataFormats/GsfTrackReco/BuildFile.xml b/DataFormats/GsfTrackReco/BuildFile.xml index 061af954fdd84..dacd02efb3af5 100644 --- a/DataFormats/GsfTrackReco/BuildFile.xml +++ b/DataFormats/GsfTrackReco/BuildFile.xml @@ -1,5 +1,8 @@ + + + diff --git a/DataFormats/HGCDigi/BuildFile.xml b/DataFormats/HGCDigi/BuildFile.xml index d410cbfccec84..f3a1b78798f8e 100644 --- a/DataFormats/HGCDigi/BuildFile.xml +++ b/DataFormats/HGCDigi/BuildFile.xml @@ -1,6 +1,7 @@ + diff --git a/DataFormats/HGCRecHit/BuildFile.xml b/DataFormats/HGCRecHit/BuildFile.xml index eb5042c528e97..dcb63ce812514 100644 --- a/DataFormats/HGCRecHit/BuildFile.xml +++ b/DataFormats/HGCRecHit/BuildFile.xml @@ -2,6 +2,7 @@ + diff --git a/DataFormats/HGCalReco/BuildFile.xml b/DataFormats/HGCalReco/BuildFile.xml index e168223e87f69..ea59e3506573a 100644 --- a/DataFormats/HGCalReco/BuildFile.xml +++ b/DataFormats/HGCalReco/BuildFile.xml @@ -3,6 +3,7 @@ + diff --git a/DataFormats/HLTReco/BuildFile.xml b/DataFormats/HLTReco/BuildFile.xml index ebf0965502d1a..d7fd9b9046193 100644 --- a/DataFormats/HLTReco/BuildFile.xml +++ b/DataFormats/HLTReco/BuildFile.xml @@ -12,6 +12,7 @@ + diff --git a/DataFormats/HcalCalibObjects/BuildFile.xml b/DataFormats/HcalCalibObjects/BuildFile.xml index 2e32b563d83ae..3c38aaa2da09b 100644 --- a/DataFormats/HcalCalibObjects/BuildFile.xml +++ b/DataFormats/HcalCalibObjects/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/DataFormats/HcalDetId/BuildFile.xml b/DataFormats/HcalDetId/BuildFile.xml index 7b963c0dd3077..2582aa71146d8 100644 --- a/DataFormats/HcalDetId/BuildFile.xml +++ b/DataFormats/HcalDetId/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/DataFormats/HcalDigi/BuildFile.xml b/DataFormats/HcalDigi/BuildFile.xml index cee2c128fcdbf..5227530aaaa5e 100644 --- a/DataFormats/HcalDigi/BuildFile.xml +++ b/DataFormats/HcalDigi/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/DataFormats/Histograms/BuildFile.xml b/DataFormats/Histograms/BuildFile.xml index 5e41c09784248..62f34e0d7a74b 100644 --- a/DataFormats/Histograms/BuildFile.xml +++ b/DataFormats/Histograms/BuildFile.xml @@ -1,5 +1,7 @@ + + diff --git a/DataFormats/JetReco/BuildFile.xml b/DataFormats/JetReco/BuildFile.xml index c17b5dc73a0d5..f3ecf3960c0fb 100644 --- a/DataFormats/JetReco/BuildFile.xml +++ b/DataFormats/JetReco/BuildFile.xml @@ -6,6 +6,10 @@ + + + + diff --git a/DataFormats/L1TCalorimeterPhase2/BuildFile.xml b/DataFormats/L1TCalorimeterPhase2/BuildFile.xml index e8fab97541080..732b899908e54 100644 --- a/DataFormats/L1TCalorimeterPhase2/BuildFile.xml +++ b/DataFormats/L1TCalorimeterPhase2/BuildFile.xml @@ -1,4 +1,7 @@ + + + diff --git a/DataFormats/L1TGlobal/BuildFile.xml b/DataFormats/L1TGlobal/BuildFile.xml index 3ddb67cbcc89b..ad09aa959bb19 100644 --- a/DataFormats/L1TGlobal/BuildFile.xml +++ b/DataFormats/L1TGlobal/BuildFile.xml @@ -1,5 +1,7 @@ + + diff --git a/DataFormats/L1THGCal/BuildFile.xml b/DataFormats/L1THGCal/BuildFile.xml index 855a2f46f4b66..a81d1b9fd188b 100644 --- a/DataFormats/L1THGCal/BuildFile.xml +++ b/DataFormats/L1THGCal/BuildFile.xml @@ -4,6 +4,8 @@ + + diff --git a/DataFormats/L1TMuon/BuildFile.xml b/DataFormats/L1TMuon/BuildFile.xml index 71988edc547a7..93dbcf323a8ba 100644 --- a/DataFormats/L1TMuon/BuildFile.xml +++ b/DataFormats/L1TMuon/BuildFile.xml @@ -6,5 +6,6 @@ + diff --git a/DataFormats/L1TrackTrigger/BuildFile.xml b/DataFormats/L1TrackTrigger/BuildFile.xml index 54723d87ca386..81cd982c6b40d 100644 --- a/DataFormats/L1TrackTrigger/BuildFile.xml +++ b/DataFormats/L1TrackTrigger/BuildFile.xml @@ -5,6 +5,9 @@ + + + diff --git a/DataFormats/L1Trigger/BuildFile.xml b/DataFormats/L1Trigger/BuildFile.xml index 0a412dcbebe4e..8a8f538c1545e 100644 --- a/DataFormats/L1Trigger/BuildFile.xml +++ b/DataFormats/L1Trigger/BuildFile.xml @@ -3,6 +3,7 @@ + diff --git a/DataFormats/LTCDigi/BuildFile.xml b/DataFormats/LTCDigi/BuildFile.xml index 7c537d9ebb995..38b45babc72b0 100644 --- a/DataFormats/LTCDigi/BuildFile.xml +++ b/DataFormats/LTCDigi/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/DataFormats/METReco/BuildFile.xml b/DataFormats/METReco/BuildFile.xml index 3990ea2805e11..6b233fb46fa1c 100644 --- a/DataFormats/METReco/BuildFile.xml +++ b/DataFormats/METReco/BuildFile.xml @@ -3,6 +3,18 @@ + + + + + + + + + + + + diff --git a/DataFormats/Math/BuildFile.xml b/DataFormats/Math/BuildFile.xml index ca9295240cdec..5f8b2dd514ddc 100644 --- a/DataFormats/Math/BuildFile.xml +++ b/DataFormats/Math/BuildFile.xml @@ -1,6 +1,7 @@ + diff --git a/DataFormats/MuonReco/BuildFile.xml b/DataFormats/MuonReco/BuildFile.xml index 87fc25933f09f..9b38bb9ec734a 100644 --- a/DataFormats/MuonReco/BuildFile.xml +++ b/DataFormats/MuonReco/BuildFile.xml @@ -5,6 +5,10 @@ + + + + diff --git a/DataFormats/MuonSeed/BuildFile.xml b/DataFormats/MuonSeed/BuildFile.xml index 2fb4d2e5b84ff..5f948ce5f68d0 100644 --- a/DataFormats/MuonSeed/BuildFile.xml +++ b/DataFormats/MuonSeed/BuildFile.xml @@ -2,6 +2,8 @@ + + diff --git a/DataFormats/OnlineMetaData/BuildFile.xml b/DataFormats/OnlineMetaData/BuildFile.xml index 7c537d9ebb995..78feda1bd1db7 100644 --- a/DataFormats/OnlineMetaData/BuildFile.xml +++ b/DataFormats/OnlineMetaData/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/DataFormats/ParticleFlowCandidate/BuildFile.xml b/DataFormats/ParticleFlowCandidate/BuildFile.xml index 3cac6a372565c..60d55ce862890 100644 --- a/DataFormats/ParticleFlowCandidate/BuildFile.xml +++ b/DataFormats/ParticleFlowCandidate/BuildFile.xml @@ -7,6 +7,8 @@ + + diff --git a/DataFormats/ProtonReco/BuildFile.xml b/DataFormats/ProtonReco/BuildFile.xml index f87de591913ea..75667b3b6ff59 100644 --- a/DataFormats/ProtonReco/BuildFile.xml +++ b/DataFormats/ProtonReco/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/DataFormats/RPCDigi/BuildFile.xml b/DataFormats/RPCDigi/BuildFile.xml index 45612b7880a0b..4742344ab3568 100644 --- a/DataFormats/RPCDigi/BuildFile.xml +++ b/DataFormats/RPCDigi/BuildFile.xml @@ -1,6 +1,9 @@ + + + diff --git a/DataFormats/RecoCandidate/BuildFile.xml b/DataFormats/RecoCandidate/BuildFile.xml index 6d98dad0f0f59..6a7e5439614f6 100644 --- a/DataFormats/RecoCandidate/BuildFile.xml +++ b/DataFormats/RecoCandidate/BuildFile.xml @@ -8,6 +8,11 @@ + + + + + diff --git a/DataFormats/SiPixelCluster/BuildFile.xml b/DataFormats/SiPixelCluster/BuildFile.xml index 7c537d9ebb995..d679816bd4955 100644 --- a/DataFormats/SiPixelCluster/BuildFile.xml +++ b/DataFormats/SiPixelCluster/BuildFile.xml @@ -1,4 +1,6 @@ + + diff --git a/DataFormats/SiPixelDetId/BuildFile.xml b/DataFormats/SiPixelDetId/BuildFile.xml index 2582aa71146d8..842f5d3051d8a 100644 --- a/DataFormats/SiPixelDetId/BuildFile.xml +++ b/DataFormats/SiPixelDetId/BuildFile.xml @@ -1,6 +1,7 @@ + diff --git a/DataFormats/SiPixelRawData/BuildFile.xml b/DataFormats/SiPixelRawData/BuildFile.xml index 7c537d9ebb995..38b45babc72b0 100644 --- a/DataFormats/SiPixelRawData/BuildFile.xml +++ b/DataFormats/SiPixelRawData/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/DataFormats/SiStripCluster/BuildFile.xml b/DataFormats/SiStripCluster/BuildFile.xml index 64d3e18e16284..98341fd03c3a7 100644 --- a/DataFormats/SiStripCluster/BuildFile.xml +++ b/DataFormats/SiStripCluster/BuildFile.xml @@ -1,6 +1,7 @@ + diff --git a/DataFormats/SiStripCommon/BuildFile.xml b/DataFormats/SiStripCommon/BuildFile.xml index b8bc952eb8685..7c0e145f7dac8 100644 --- a/DataFormats/SiStripCommon/BuildFile.xml +++ b/DataFormats/SiStripCommon/BuildFile.xml @@ -1,6 +1,7 @@ + diff --git a/DataFormats/Streamer/BuildFile.xml b/DataFormats/Streamer/BuildFile.xml index 0a3da27bfa9b3..ab124ca3e5158 100644 --- a/DataFormats/Streamer/BuildFile.xml +++ b/DataFormats/Streamer/BuildFile.xml @@ -1,4 +1,6 @@ + + diff --git a/DataFormats/TauReco/BuildFile.xml b/DataFormats/TauReco/BuildFile.xml index df5fe8fe03f0c..ab47c5fbf0d92 100644 --- a/DataFormats/TauReco/BuildFile.xml +++ b/DataFormats/TauReco/BuildFile.xml @@ -5,6 +5,8 @@ + + diff --git a/DataFormats/TestObjects/BuildFile.xml b/DataFormats/TestObjects/BuildFile.xml index 78feda1bd1db7..a99144ef6f751 100644 --- a/DataFormats/TestObjects/BuildFile.xml +++ b/DataFormats/TestObjects/BuildFile.xml @@ -1,5 +1,7 @@ + + diff --git a/DataFormats/TrackCandidate/BuildFile.xml b/DataFormats/TrackCandidate/BuildFile.xml index eb75fa27154fa..bb47dc67ba9b5 100644 --- a/DataFormats/TrackCandidate/BuildFile.xml +++ b/DataFormats/TrackCandidate/BuildFile.xml @@ -2,6 +2,7 @@ + diff --git a/DataFormats/TrackerRecHit2D/BuildFile.xml b/DataFormats/TrackerRecHit2D/BuildFile.xml index 81627d076969b..d92749878b7d3 100644 --- a/DataFormats/TrackerRecHit2D/BuildFile.xml +++ b/DataFormats/TrackerRecHit2D/BuildFile.xml @@ -6,6 +6,16 @@ + + + + + + + + + + diff --git a/DataFormats/TrackingRecHit/BuildFile.xml b/DataFormats/TrackingRecHit/BuildFile.xml index c22f87d6e1db9..e9c7b52166f09 100644 --- a/DataFormats/TrackingRecHit/BuildFile.xml +++ b/DataFormats/TrackingRecHit/BuildFile.xml @@ -4,6 +4,9 @@ + + + diff --git a/DataFormats/TrajectoryState/BuildFile.xml b/DataFormats/TrajectoryState/BuildFile.xml index ea3598810ab81..6771c1c232a4e 100644 --- a/DataFormats/TrajectoryState/BuildFile.xml +++ b/DataFormats/TrajectoryState/BuildFile.xml @@ -1,4 +1,5 @@ + diff --git a/DataFormats/VertexReco/BuildFile.xml b/DataFormats/VertexReco/BuildFile.xml index 061af954fdd84..a8c7cac35828d 100644 --- a/DataFormats/VertexReco/BuildFile.xml +++ b/DataFormats/VertexReco/BuildFile.xml @@ -1,5 +1,7 @@ + + From b39771bceed25093165e5ee4b4176540aacc79df Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 1 May 2020 09:11:35 +0200 Subject: [PATCH 03/46] First implementation of a TICL debugger module --- RecoHGCal/TICL/test/BuildFile.xml | 14 +++ RecoHGCal/TICL/test/TiclDebugger.cc | 130 ++++++++++++++++++++++++ RecoHGCal/TICL/test/ticlDebugger_cfg.py | 23 +++++ 3 files changed, 167 insertions(+) create mode 100644 RecoHGCal/TICL/test/BuildFile.xml create mode 100644 RecoHGCal/TICL/test/TiclDebugger.cc create mode 100644 RecoHGCal/TICL/test/ticlDebugger_cfg.py diff --git a/RecoHGCal/TICL/test/BuildFile.xml b/RecoHGCal/TICL/test/BuildFile.xml new file mode 100644 index 0000000000000..24ab693182582 --- /dev/null +++ b/RecoHGCal/TICL/test/BuildFile.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/RecoHGCal/TICL/test/TiclDebugger.cc b/RecoHGCal/TICL/test/TiclDebugger.cc new file mode 100644 index 0000000000000..3db081265ba89 --- /dev/null +++ b/RecoHGCal/TICL/test/TiclDebugger.cc @@ -0,0 +1,130 @@ +// +// Original Author: Marco Rovere +// Created: Fri May 1 07:21:02 CEST 2020 +// +// +// +// system include files +#include +#include +#include +#include + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/ConsumesCollector.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DataFormats/ForwardDetId/interface/HGCalDetId.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" +#include "DataFormats/HGCalReco/interface/Trackster.h" +#include "SimDataFormats/Track/interface/SimTrack.h" +#include "SimDataFormats/Vertex/interface/SimVertex.h" +#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" + +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" +#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" +#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" +#include "Geometry/CaloTopology/interface/HGCalTopology.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" + +// +// class declaration +// + +class TiclDebugger : public edm::one::EDAnalyzer<> { +public: + explicit TiclDebugger(const edm::ParameterSet&); + ~TiclDebugger() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void endJob() override; + + edm::InputTag trackstersMerge_; + edm::EDGetTokenT> trackstersMergeToken_; +}; + +TiclDebugger::TiclDebugger(const edm::ParameterSet& iConfig) + : trackstersMerge_(iConfig.getParameter("trackstersMerge")) { + edm::ConsumesCollector&& iC = consumesCollector(); + trackstersMergeToken_ = iC.consumes>(trackstersMerge_); +} + +TiclDebugger::~TiclDebugger() {} + +void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + static const char* particle_kind[] = {"gam", "e", "mu", "pi0", "h", "h0", "?", "!"}; + using namespace edm; + using std::begin; + using std::end; + using std::iota; + using std::sort; + + edm::Handle> trackstersMergeH; + + iEvent.getByToken(trackstersMergeToken_, trackstersMergeH); + auto const& tracksters = *trackstersMergeH.product(); + std::vector sorted_tracksters_idx(tracksters.size()); + iota(begin(sorted_tracksters_idx), end(sorted_tracksters_idx), 0); + sort(begin(sorted_tracksters_idx), end(sorted_tracksters_idx), [&tracksters](int i, int j) { + return tracksters[i].raw_energy() > tracksters[j].raw_energy(); + }); + + for (auto const & t : sorted_tracksters_idx) { + auto const & trackster = tracksters[t]; + auto const & probs = trackster.id_probabilities(); + // Sort probs in descending order + std::vector sorted_probs_idx(probs.size()); + iota(begin(sorted_probs_idx), end(sorted_probs_idx), 0); + sort(begin(sorted_probs_idx), end(sorted_probs_idx), [&probs](int i, int j) { + return probs[i] > probs[j]; + }); + + std::cout << "TrksIdx: " << t << "\n bary: " << trackster.barycenter() + << " baryEta: " << trackster.barycenter().eta() + << " baryPhi: " << trackster.barycenter().phi() + << "\n raw_energy: " << trackster.raw_energy() + << " raw_em_energy: " << trackster.raw_em_energy() + << "\n raw_pt: " << trackster.raw_pt() + << " raw_em_pt: " << trackster.raw_em_pt() + << "\n seedIdx: " << trackster.seedIndex() + << "\n Probs: "; + for (auto p_idx : sorted_probs_idx) { + std::cout << "(" << particle_kind[p_idx] << "):" << probs[p_idx] << " "; + } + std::cout << "\n time: " << trackster.time() << "+/-" << trackster.timeError() + << std::endl; + } +} + +void TiclDebugger::beginJob() {} + +void TiclDebugger::endJob() {} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void TiclDebugger::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("trackstersMerge", edm::InputTag("ticlTrackstersMerge")); + desc.add("tracks", edm::InputTag("generalTracks")); + descriptions.add("ticlDebugger", desc); +} + +// define this as a plug-in +DEFINE_FWK_MODULE(TiclDebugger); diff --git a/RecoHGCal/TICL/test/ticlDebugger_cfg.py b/RecoHGCal/TICL/test/ticlDebugger_cfg.py new file mode 100644 index 0000000000000..5a1f7d6a2e750 --- /dev/null +++ b/RecoHGCal/TICL/test/ticlDebugger_cfg.py @@ -0,0 +1,23 @@ +import FWCore.ParameterSet.Config as cms + +process = cms.Process("TICLDEBUG") + +process.load("FWCore.MessageService.MessageLogger_cfi") +process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +process.source = cms.Source("PoolSource", + # replace 'myfile.root' with the source file you want to use + fileNames = cms.untracked.vstring( + 'file:step3.root' + ) +) + +process.load("RecoHGCal.TICL.ticlDebugger_cfi") + +process.p = cms.Path(process.ticlDebugger) + From 405bc631388fd69a96adb15f40f7c7dd312a0ff5 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 1 May 2020 15:01:55 +0200 Subject: [PATCH 04/46] Improve TICL Trackster debugging --- RecoHGCal/TICL/test/BuildFile.xml | 7 +-- RecoHGCal/TICL/test/TiclDebugger.cc | 71 +++++++++++++------------ RecoHGCal/TICL/test/ticlDebugger_cfg.py | 5 +- 3 files changed, 40 insertions(+), 43 deletions(-) diff --git a/RecoHGCal/TICL/test/BuildFile.xml b/RecoHGCal/TICL/test/BuildFile.xml index 24ab693182582..5700923976540 100644 --- a/RecoHGCal/TICL/test/BuildFile.xml +++ b/RecoHGCal/TICL/test/BuildFile.xml @@ -1,12 +1,7 @@ - - - - - - + diff --git a/RecoHGCal/TICL/test/TiclDebugger.cc b/RecoHGCal/TICL/test/TiclDebugger.cc index 3db081265ba89..e5e49530ca0ea 100644 --- a/RecoHGCal/TICL/test/TiclDebugger.cc +++ b/RecoHGCal/TICL/test/TiclDebugger.cc @@ -25,21 +25,7 @@ #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/HGCalReco/interface/Trackster.h" -#include "SimDataFormats/Track/interface/SimTrack.h" -#include "SimDataFormats/Vertex/interface/SimVertex.h" -#include "SimDataFormats/TrackingAnalysis/interface/TrackingParticle.h" -#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" -#include "SimDataFormats/CaloHit/interface/PCaloHit.h" -#include "SimDataFormats/CaloAnalysis/interface/SimCluster.h" - -#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" -#include "Geometry/HGCalGeometry/interface/HGCalGeometry.h" -#include "Geometry/HGCalCommonData/interface/HGCalDDDConstants.h" -#include "SimDataFormats/CaloTest/interface/HGCalTestNumbering.h" -#include "Geometry/CaloTopology/interface/HGCalTopology.h" -#include "Geometry/CaloGeometry/interface/CaloGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "Geometry/HcalCommonData/interface/HcalHitRelabeller.h" +#include "DataFormats/TrackReco/interface/Track.h" // // class declaration @@ -57,14 +43,18 @@ class TiclDebugger : public edm::one::EDAnalyzer<> { void analyze(const edm::Event&, const edm::EventSetup&) override; void endJob() override; - edm::InputTag trackstersMerge_; + const edm::InputTag trackstersMerge_; + const edm::InputTag tracks_; edm::EDGetTokenT> trackstersMergeToken_; + edm::EDGetTokenT> tracksToken_; }; TiclDebugger::TiclDebugger(const edm::ParameterSet& iConfig) - : trackstersMerge_(iConfig.getParameter("trackstersMerge")) { + : trackstersMerge_(iConfig.getParameter("trackstersMerge")), + tracks_(iConfig.getParameter("tracks")) { edm::ConsumesCollector&& iC = consumesCollector(); trackstersMergeToken_ = iC.consumes>(trackstersMerge_); + tracksToken_ = iC.consumes>(tracks_); } TiclDebugger::~TiclDebugger() {} @@ -87,30 +77,41 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet return tracksters[i].raw_energy() > tracksters[j].raw_energy(); }); - for (auto const & t : sorted_tracksters_idx) { - auto const & trackster = tracksters[t]; - auto const & probs = trackster.id_probabilities(); + edm::Handle> tracksH; + iEvent.getByToken(tracksToken_, tracksH); + const auto & tracks = *tracksH.product(); + + for (auto const& t : sorted_tracksters_idx) { + auto const& trackster = tracksters[t]; + auto const& probs = trackster.id_probabilities(); // Sort probs in descending order std::vector sorted_probs_idx(probs.size()); iota(begin(sorted_probs_idx), end(sorted_probs_idx), 0); - sort(begin(sorted_probs_idx), end(sorted_probs_idx), [&probs](int i, int j) { - return probs[i] > probs[j]; - }); - - std::cout << "TrksIdx: " << t << "\n bary: " << trackster.barycenter() - << " baryEta: " << trackster.barycenter().eta() - << " baryPhi: " << trackster.barycenter().phi() - << "\n raw_energy: " << trackster.raw_energy() - << " raw_em_energy: " << trackster.raw_em_energy() - << "\n raw_pt: " << trackster.raw_pt() - << " raw_em_pt: " << trackster.raw_em_pt() - << "\n seedIdx: " << trackster.seedIndex() - << "\n Probs: "; + sort(begin(sorted_probs_idx), end(sorted_probs_idx), [&probs](int i, int j) { return probs[i] > probs[j]; }); + + std::cout << "\nTrksIdx: " << t << "\n bary: " << trackster.barycenter() + << " baryEta: " << trackster.barycenter().eta() << " baryPhi: " << trackster.barycenter().phi() + << "\n raw_energy: " << trackster.raw_energy() << " raw_em_energy: " << trackster.raw_em_energy() + << "\n raw_pt: " << trackster.raw_pt() << " raw_em_pt: " << trackster.raw_em_pt() + << "\n seedIdx: " << trackster.seedIndex() << "\n Probs: "; for (auto p_idx : sorted_probs_idx) { std::cout << "(" << particle_kind[p_idx] << "):" << probs[p_idx] << " "; } - std::cout << "\n time: " << trackster.time() << "+/-" << trackster.timeError() - << std::endl; + std::cout << "\n time: " << trackster.time() << "+/-" << trackster.timeError() << std::endl + << " cells: " << trackster.vertices().size() + << " average usage: " << std::accumulate( + std::begin(trackster.vertex_multiplicity()), + std::end(trackster.vertex_multiplicity()), + 0.) / trackster.vertex_multiplicity().size() << std::endl; + if (trackster.seedID().id() != 0) { + auto const & track = tracks[trackster.seedIndex()]; + std::cout << " Seeding Track:" << std::endl; + std::cout << " pt: " << track.pt() << " p: " << track.p() + << " eta: " << track.eta() + << " outerEta: " << track.outerEta() << " phi: " << track.phi() + << " outerPhi: " << track.outerPhi() + << std::endl; + } } } diff --git a/RecoHGCal/TICL/test/ticlDebugger_cfg.py b/RecoHGCal/TICL/test/ticlDebugger_cfg.py index 5a1f7d6a2e750..a996a4ef1205a 100644 --- a/RecoHGCal/TICL/test/ticlDebugger_cfg.py +++ b/RecoHGCal/TICL/test/ticlDebugger_cfg.py @@ -8,7 +8,7 @@ from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic_T15', '') -process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) process.source = cms.Source("PoolSource", # replace 'myfile.root' with the source file you want to use @@ -18,6 +18,7 @@ ) process.load("RecoHGCal.TICL.ticlDebugger_cfi") +process.load("SimGeneral.Debugging.caloParticleDebugger_cfi") -process.p = cms.Path(process.ticlDebugger) +process.p = cms.Path(process.ticlDebugger+process.caloParticleDebugger) From eaee1909c6ba90681b6eb5ce8834541c58be872f Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Mon, 4 May 2020 12:35:01 +0200 Subject: [PATCH 05/46] Improve TICL debugger --- RecoHGCal/TICL/test/BuildFile.xml | 2 + RecoHGCal/TICL/test/TiclDebugger.cc | 61 +++++++++++++++++++------ RecoHGCal/TICL/test/ticlDebugger_cfg.py | 2 + 3 files changed, 52 insertions(+), 13 deletions(-) diff --git a/RecoHGCal/TICL/test/BuildFile.xml b/RecoHGCal/TICL/test/BuildFile.xml index 5700923976540..14d080361b482 100644 --- a/RecoHGCal/TICL/test/BuildFile.xml +++ b/RecoHGCal/TICL/test/BuildFile.xml @@ -2,6 +2,8 @@ + + diff --git a/RecoHGCal/TICL/test/TiclDebugger.cc b/RecoHGCal/TICL/test/TiclDebugger.cc index e5e49530ca0ea..1ff3dd4760a84 100644 --- a/RecoHGCal/TICL/test/TiclDebugger.cc +++ b/RecoHGCal/TICL/test/TiclDebugger.cc @@ -26,7 +26,9 @@ #include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/HGCalReco/interface/Trackster.h" #include "DataFormats/TrackReco/interface/Track.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" // // class declaration // @@ -45,16 +47,20 @@ class TiclDebugger : public edm::one::EDAnalyzer<> { const edm::InputTag trackstersMerge_; const edm::InputTag tracks_; + const edm::InputTag caloParticles_; edm::EDGetTokenT> trackstersMergeToken_; edm::EDGetTokenT> tracksToken_; + edm::EDGetTokenT> caloParticlesToken_; }; TiclDebugger::TiclDebugger(const edm::ParameterSet& iConfig) : trackstersMerge_(iConfig.getParameter("trackstersMerge")), - tracks_(iConfig.getParameter("tracks")) { + tracks_(iConfig.getParameter("tracks")), + caloParticles_(iConfig.getParameter("caloParticles")) { edm::ConsumesCollector&& iC = consumesCollector(); trackstersMergeToken_ = iC.consumes>(trackstersMerge_); tracksToken_ = iC.consumes>(tracks_); + caloParticlesToken_ = iC.consumes>(caloParticles_); } TiclDebugger::~TiclDebugger() {} @@ -79,7 +85,25 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet edm::Handle> tracksH; iEvent.getByToken(tracksToken_, tracksH); - const auto & tracks = *tracksH.product(); + const auto& tracks = *tracksH.product(); + + edm::Handle> caloParticlesH; + iEvent.getByToken(caloParticlesToken_, caloParticlesH); + auto const& caloParticles = *caloParticlesH.product(); + std::vector> bestCPMatches; + + auto bestCaloParticleMatches = [&](const ticl::Trackster& t) -> void { + bestCPMatches.clear(); + auto idx = 0; + auto separation = 0.; + for (auto const& cp : caloParticles) { + separation = reco::deltaR2(t.barycenter(), cp.momentum()); + if (separation < 0.05) { + bestCPMatches.push_back(std::make_pair(idx, separation)); + } + ++idx; + } + }; for (auto const& t : sorted_tracksters_idx) { auto const& trackster = tracksters[t]; @@ -98,19 +122,29 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet std::cout << "(" << particle_kind[p_idx] << "):" << probs[p_idx] << " "; } std::cout << "\n time: " << trackster.time() << "+/-" << trackster.timeError() << std::endl - << " cells: " << trackster.vertices().size() - << " average usage: " << std::accumulate( - std::begin(trackster.vertex_multiplicity()), - std::end(trackster.vertex_multiplicity()), - 0.) / trackster.vertex_multiplicity().size() << std::endl; + << " cells: " << trackster.vertices().size() << " average usage: " + << std::accumulate( + std::begin(trackster.vertex_multiplicity()), std::end(trackster.vertex_multiplicity()), 0.) / + trackster.vertex_multiplicity().size() + << std::endl; if (trackster.seedID().id() != 0) { - auto const & track = tracks[trackster.seedIndex()]; + auto const& track = tracks[trackster.seedIndex()]; std::cout << " Seeding Track:" << std::endl; - std::cout << " pt: " << track.pt() << " p: " << track.p() - << " eta: " << track.eta() - << " outerEta: " << track.outerEta() << " phi: " << track.phi() - << " outerPhi: " << track.outerPhi() - << std::endl; + std::cout << " p: " << track.p() << " pt: " << track.pt() + << " charge: " << track.charge() << " eta: " << track.eta() + << " outerEta: " << track.outerEta() << " phi: " << track.phi() << " outerPhi: " << track.outerPhi() + << std::endl; + } + bestCaloParticleMatches(trackster); + if (!bestCPMatches.empty()) { + std::cout << " Best CaloParticles Matches:" << std::endl;; + for (auto const& i : bestCPMatches) { + auto const & cp = caloParticles[i.first]; + std::cout << " " << i.first << "(" << i.second << "):" << cp.pdgId() << "|" + << cp.simClusters().size() << "|" + << cp.energy() << "|" << cp.pt() << " " << std::endl; + } + std::cout << std::endl; } } } @@ -124,6 +158,7 @@ void TiclDebugger::fillDescriptions(edm::ConfigurationDescriptions& descriptions edm::ParameterSetDescription desc; desc.add("trackstersMerge", edm::InputTag("ticlTrackstersMerge")); desc.add("tracks", edm::InputTag("generalTracks")); + desc.add("caloParticles", edm::InputTag("mix", "MergedCaloTruth")); descriptions.add("ticlDebugger", desc); } diff --git a/RecoHGCal/TICL/test/ticlDebugger_cfg.py b/RecoHGCal/TICL/test/ticlDebugger_cfg.py index a996a4ef1205a..6629b32681898 100644 --- a/RecoHGCal/TICL/test/ticlDebugger_cfg.py +++ b/RecoHGCal/TICL/test/ticlDebugger_cfg.py @@ -19,6 +19,8 @@ process.load("RecoHGCal.TICL.ticlDebugger_cfi") process.load("SimGeneral.Debugging.caloParticleDebugger_cfi") +process.caloParticleDebugger.printTrackingP = True +process.caloParticleDebugger.printSimTracks = True process.p = cms.Path(process.ticlDebugger+process.caloParticleDebugger) From 15de7ad7c224ba2d4514baed1ce8e125d59ef915 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Mon, 27 Jul 2020 18:57:28 +0200 Subject: [PATCH 06/46] Improve debugging for edges in tracksters --- RecoHGCal/TICL/test/BuildFile.xml | 1 + RecoHGCal/TICL/test/TiclDebugger.cc | 51 +++++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/RecoHGCal/TICL/test/BuildFile.xml b/RecoHGCal/TICL/test/BuildFile.xml index 14d080361b482..d6d0f32aecf71 100644 --- a/RecoHGCal/TICL/test/BuildFile.xml +++ b/RecoHGCal/TICL/test/BuildFile.xml @@ -7,5 +7,6 @@ + diff --git a/RecoHGCal/TICL/test/TiclDebugger.cc b/RecoHGCal/TICL/test/TiclDebugger.cc index 1ff3dd4760a84..a99772535f14a 100644 --- a/RecoHGCal/TICL/test/TiclDebugger.cc +++ b/RecoHGCal/TICL/test/TiclDebugger.cc @@ -11,6 +11,7 @@ #include // user include files +#include "DataFormats/CaloRecHit/interface/CaloCluster.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ConsumesCollector.h" @@ -28,12 +29,13 @@ #include "DataFormats/TrackReco/interface/Track.h" #include "DataFormats/Math/interface/deltaR.h" +#include "RecoLocalCalo/HGCalRecAlgos/interface/RecHitTools.h" #include "SimDataFormats/CaloAnalysis/interface/CaloParticle.h" // // class declaration // -class TiclDebugger : public edm::one::EDAnalyzer<> { +class TiclDebugger : public edm::one::EDAnalyzer { public: explicit TiclDebugger(const edm::ParameterSet&); ~TiclDebugger() override; @@ -42,25 +44,32 @@ class TiclDebugger : public edm::one::EDAnalyzer<> { private: void beginJob() override; + void beginRun(const edm::Run&, const edm::EventSetup&) override; void analyze(const edm::Event&, const edm::EventSetup&) override; + void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}; void endJob() override; const edm::InputTag trackstersMerge_; const edm::InputTag tracks_; const edm::InputTag caloParticles_; + const edm::InputTag layerClusters_; + hgcal::RecHitTools rhtools_; edm::EDGetTokenT> trackstersMergeToken_; edm::EDGetTokenT> tracksToken_; edm::EDGetTokenT> caloParticlesToken_; + edm::EDGetTokenT> layerClustersToken_; }; TiclDebugger::TiclDebugger(const edm::ParameterSet& iConfig) : trackstersMerge_(iConfig.getParameter("trackstersMerge")), tracks_(iConfig.getParameter("tracks")), - caloParticles_(iConfig.getParameter("caloParticles")) { + caloParticles_(iConfig.getParameter("caloParticles")), + layerClusters_(iConfig.getParameter("layerClusters")) { edm::ConsumesCollector&& iC = consumesCollector(); trackstersMergeToken_ = iC.consumes>(trackstersMerge_); tracksToken_ = iC.consumes>(tracks_); caloParticlesToken_ = iC.consumes>(caloParticles_); + layerClustersToken_ = iC.consumes>(layerClusters_); } TiclDebugger::~TiclDebugger() {} @@ -83,6 +92,10 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet return tracksters[i].raw_energy() > tracksters[j].raw_energy(); }); + edm::Handle> layerClustersH; + iEvent.getByToken(layerClustersToken_, layerClustersH); + auto const& layerClusters = *layerClustersH.product(); + edm::Handle> tracksH; iEvent.getByToken(tracksToken_, tracksH); const auto& tracks = *tracksH.product(); @@ -112,6 +125,15 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet std::vector sorted_probs_idx(probs.size()); iota(begin(sorted_probs_idx), end(sorted_probs_idx), 0); sort(begin(sorted_probs_idx), end(sorted_probs_idx), [&probs](int i, int j) { return probs[i] > probs[j]; }); + // Sort edges in ascending order + std::vector sorted_edges_idx(trackster.edges().size()); + iota(begin(sorted_edges_idx), end(sorted_edges_idx), 0); + sort(begin(sorted_edges_idx), end(sorted_edges_idx), [&trackster](int i, int j) { + if (trackster.edges()[i][0] != trackster.edges()[j][0]) + return trackster.edges()[i][0] < trackster.edges()[j][0]; + else + return trackster.edges()[i][1] < trackster.edges()[j][1]; + }); std::cout << "\nTrksIdx: " << t << "\n bary: " << trackster.barycenter() << " baryEta: " << trackster.barycenter().eta() << " baryPhi: " << trackster.barycenter().phi() @@ -127,6 +149,28 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet std::begin(trackster.vertex_multiplicity()), std::end(trackster.vertex_multiplicity()), 0.) / trackster.vertex_multiplicity().size() << std::endl; + std::cout << " link connections: " << trackster.edges().size() << std::endl; + auto dumpLayerCluster = [&layerClusters](hgcal::RecHitTools const & rhtools, int cluster_idx) { + auto const & cluster = layerClusters[cluster_idx]; + const auto firstHitDetId = cluster.hitsAndFractions()[0].first; + int layers = rhtools.lastLayer(); + int lcLayerId = + rhtools.getLayerWithOffset(firstHitDetId) + layers * ((rhtools.zside(firstHitDetId) + 1) >> 1) - 1; + + std::cout << "Idx: " << cluster_idx + << "(" + << lcLayerId << ", " + << cluster.energy() << ", " + << cluster.hitsAndFractions().size() << ", " + << cluster.position() + << ") "; + }; + for (auto link : sorted_edges_idx) { + std::cout << "(" << trackster.edges()[link][0] << ", " << trackster.edges()[link][1] << ") "; + dumpLayerCluster(rhtools_, trackster.edges()[link][0]); + dumpLayerCluster(rhtools_, trackster.edges()[link][1]); + std::cout << std::endl; + } if (trackster.seedID().id() != 0) { auto const& track = tracks[trackster.seedIndex()]; std::cout << " Seeding Track:" << std::endl; @@ -149,6 +193,8 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet } } +void TiclDebugger::beginRun(edm::Run const&, edm::EventSetup const& es) { rhtools_.getEventSetup(es); } + void TiclDebugger::beginJob() {} void TiclDebugger::endJob() {} @@ -159,6 +205,7 @@ void TiclDebugger::fillDescriptions(edm::ConfigurationDescriptions& descriptions desc.add("trackstersMerge", edm::InputTag("ticlTrackstersMerge")); desc.add("tracks", edm::InputTag("generalTracks")); desc.add("caloParticles", edm::InputTag("mix", "MergedCaloTruth")); + desc.add("layerClusters", edm::InputTag("hgcalLayerClusters")); descriptions.add("ticlDebugger", desc); } From 5dfa3d81b74744983470070a8f4c361545da07a2 Mon Sep 17 00:00:00 2001 From: Marco Rovere Date: Fri, 7 Aug 2020 22:41:26 +0200 Subject: [PATCH 07/46] Update TICLDebugger --- RecoHGCal/TICL/test/TiclDebugger.cc | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/RecoHGCal/TICL/test/TiclDebugger.cc b/RecoHGCal/TICL/test/TiclDebugger.cc index a99772535f14a..d621960d48f31 100644 --- a/RecoHGCal/TICL/test/TiclDebugger.cc +++ b/RecoHGCal/TICL/test/TiclDebugger.cc @@ -128,11 +128,22 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet // Sort edges in ascending order std::vector sorted_edges_idx(trackster.edges().size()); iota(begin(sorted_edges_idx), end(sorted_edges_idx), 0); - sort(begin(sorted_edges_idx), end(sorted_edges_idx), [&trackster](int i, int j) { - if (trackster.edges()[i][0] != trackster.edges()[j][0]) - return trackster.edges()[i][0] < trackster.edges()[j][0]; + sort(begin(sorted_edges_idx), end(sorted_edges_idx), [&](int i, int j) { + int layers = rhtools_.lastLayer(); + auto const & ed_i = trackster.edges()[i]; + auto const & ed_j = trackster.edges()[j]; + auto const & cl_i_in = layerClusters[ed_i[0]].hitsAndFractions()[0].first; + auto const & cl_i_out = layerClusters[ed_i[1]].hitsAndFractions()[0].first; + auto const & cl_j_in = layerClusters[ed_j[0]].hitsAndFractions()[0].first; + auto const & cl_j_out = layerClusters[ed_j[1]].hitsAndFractions()[0].first; + auto const layer_i_in = rhtools_.getLayerWithOffset(cl_i_in) + layers * ((rhtools_.zside(cl_i_in) + 1) >> 1) - 1; + auto const layer_i_out = rhtools_.getLayerWithOffset(cl_i_out) + layers * ((rhtools_.zside(cl_i_out) + 1) >> 1) - 1; + auto const layer_j_in = rhtools_.getLayerWithOffset(cl_j_in) + layers * ((rhtools_.zside(cl_j_in) + 1) >> 1) - 1; + auto const layer_j_out = rhtools_.getLayerWithOffset(cl_j_out) + layers * ((rhtools_.zside(cl_j_out) + 1) >> 1) - 1; + if (layer_i_in != layer_j_in) + return layer_i_in < layer_j_in; else - return trackster.edges()[i][1] < trackster.edges()[j][1]; + return layer_i_out < layer_j_out; }); std::cout << "\nTrksIdx: " << t << "\n bary: " << trackster.barycenter() @@ -144,7 +155,7 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet std::cout << "(" << particle_kind[p_idx] << "):" << probs[p_idx] << " "; } std::cout << "\n time: " << trackster.time() << "+/-" << trackster.timeError() << std::endl - << " cells: " << trackster.vertices().size() << " average usage: " + << " vertices: " << trackster.vertices().size() << " average usage: " << std::accumulate( std::begin(trackster.vertex_multiplicity()), std::end(trackster.vertex_multiplicity()), 0.) / trackster.vertex_multiplicity().size() From 98c29e0d0729d731a2f1f902bb7f18dac855da68 Mon Sep 17 00:00:00 2001 From: Leonardo Cristella Date: Tue, 29 Sep 2020 10:51:35 +0200 Subject: [PATCH 08/46] Make it compile --- RecoHGCal/TICL/test/TiclDebugger.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/RecoHGCal/TICL/test/TiclDebugger.cc b/RecoHGCal/TICL/test/TiclDebugger.cc index d621960d48f31..3a6727aacd9c4 100644 --- a/RecoHGCal/TICL/test/TiclDebugger.cc +++ b/RecoHGCal/TICL/test/TiclDebugger.cc @@ -204,7 +204,9 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet } } -void TiclDebugger::beginRun(edm::Run const&, edm::EventSetup const& es) { rhtools_.getEventSetup(es); } +void TiclDebugger::beginRun(edm::Run const&, edm::EventSetup const& es) { + edm::ESHandle geom; es.get().get(geom); rhtools_.setGeometry(*geom); +} void TiclDebugger::beginJob() {} From 3798d00dfd500b0c6cbe9d309b3a5322aa6262d1 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 9 Mar 2021 10:27:35 +0100 Subject: [PATCH 09/46] remove unneeded includes --- DataFormats/METReco/BuildFile.xml | 1 - DataFormats/METReco/interface/HcalHaloData.h | 2 +- DataFormats/RecoCandidate/BuildFile.xml | 3 --- DataFormats/RecoCandidate/src/classes.h | 3 --- 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/DataFormats/METReco/BuildFile.xml b/DataFormats/METReco/BuildFile.xml index 6b233fb46fa1c..7685b66a36e88 100644 --- a/DataFormats/METReco/BuildFile.xml +++ b/DataFormats/METReco/BuildFile.xml @@ -14,7 +14,6 @@ - diff --git a/DataFormats/METReco/interface/HcalHaloData.h b/DataFormats/METReco/interface/HcalHaloData.h index 31a11af8943ea..c13694d54241b 100644 --- a/DataFormats/METReco/interface/HcalHaloData.h +++ b/DataFormats/METReco/interface/HcalHaloData.h @@ -12,7 +12,7 @@ #include "DataFormats/DetId/interface/DetId.h" #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" #include "DataFormats/METReco/interface/HaloClusterCandidateHCAL.h" -#include "DataFormats/VertexReco/interface/Vertex.h" + struct HaloTowerStrip { std::vector > cellTowerIds; float hadEt; diff --git a/DataFormats/RecoCandidate/BuildFile.xml b/DataFormats/RecoCandidate/BuildFile.xml index 6a7e5439614f6..98f8e104eb6c1 100644 --- a/DataFormats/RecoCandidate/BuildFile.xml +++ b/DataFormats/RecoCandidate/BuildFile.xml @@ -5,11 +5,8 @@ - - - diff --git a/DataFormats/RecoCandidate/src/classes.h b/DataFormats/RecoCandidate/src/classes.h index 76282ff6faa09..7ccb822646d0d 100644 --- a/DataFormats/RecoCandidate/src/classes.h +++ b/DataFormats/RecoCandidate/src/classes.h @@ -20,9 +20,6 @@ #include "DataFormats/RecoCandidate/interface/TrackAssociation.h" #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/RecoCandidate/interface/TrackCandidateAssociation.h" -#include "DataFormats/HcalDetId/interface/HcalSubdetector.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitDefs.h" -#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h" #include "DataFormats/Common/interface/RefProd.h" #include "DataFormats/Common/interface/Wrapper.h" #include "DataFormats/Common/interface/RefToBase.h" From c9bc8b4ee09ddf83339408ab4a0fd58356659b93 Mon Sep 17 00:00:00 2001 From: Erica Brondolin Date: Tue, 9 Mar 2021 11:26:00 +0100 Subject: [PATCH 10/46] Better printout --- RecoHGCal/TICL/test/TiclDebugger.cc | 12 +++++++----- RecoHGCal/TICL/test/ticlDebugger_cfg.py | 2 -- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/RecoHGCal/TICL/test/TiclDebugger.cc b/RecoHGCal/TICL/test/TiclDebugger.cc index 3a6727aacd9c4..969df37e8072f 100644 --- a/RecoHGCal/TICL/test/TiclDebugger.cc +++ b/RecoHGCal/TICL/test/TiclDebugger.cc @@ -11,7 +11,6 @@ #include // user include files -#include "DataFormats/CaloRecHit/interface/CaloCluster.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/ConsumesCollector.h" @@ -23,6 +22,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "DataFormats/CaloRecHit/interface/CaloCluster.h" #include "DataFormats/ForwardDetId/interface/HGCalDetId.h" #include "DataFormats/HepMCCandidate/interface/GenParticle.h" #include "DataFormats/HGCalReco/interface/Trackster.h" @@ -187,7 +187,8 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet std::cout << " Seeding Track:" << std::endl; std::cout << " p: " << track.p() << " pt: " << track.pt() << " charge: " << track.charge() << " eta: " << track.eta() - << " outerEta: " << track.outerEta() << " phi: " << track.phi() << " outerPhi: " << track.outerPhi() + << " outerEta: " << track.outerEta() << " phi: " << track.phi() + << " outerPhi: " << track.outerPhi() << std::endl; } bestCaloParticleMatches(trackster); @@ -195,9 +196,10 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet std::cout << " Best CaloParticles Matches:" << std::endl;; for (auto const& i : bestCPMatches) { auto const & cp = caloParticles[i.first]; - std::cout << " " << i.first << "(" << i.second << "):" << cp.pdgId() << "|" - << cp.simClusters().size() << "|" - << cp.energy() << "|" << cp.pt() << " " << std::endl; + std::cout << " " << i.first << "(" << i.second << "):" << cp.pdgId() + << " simCl size:" << cp.simClusters().size() + << " energy:" << cp.energy() << " pt:" << cp.pt() + << " momentum:" << cp.momentum() << std::endl; } std::cout << std::endl; } diff --git a/RecoHGCal/TICL/test/ticlDebugger_cfg.py b/RecoHGCal/TICL/test/ticlDebugger_cfg.py index 6629b32681898..a996a4ef1205a 100644 --- a/RecoHGCal/TICL/test/ticlDebugger_cfg.py +++ b/RecoHGCal/TICL/test/ticlDebugger_cfg.py @@ -19,8 +19,6 @@ process.load("RecoHGCal.TICL.ticlDebugger_cfi") process.load("SimGeneral.Debugging.caloParticleDebugger_cfi") -process.caloParticleDebugger.printTrackingP = True -process.caloParticleDebugger.printSimTracks = True process.p = cms.Path(process.ticlDebugger+process.caloParticleDebugger) From 73d1210e14997d94390b281eaa8d6c6867bdffd0 Mon Sep 17 00:00:00 2001 From: Mircho Rodozov Date: Tue, 9 Mar 2021 12:13:10 +0100 Subject: [PATCH 11/46] Update unit tests for LLVM 11 --- PhysicsTools/PythonAnalysis/test/BuildFile.xml | 2 +- Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml | 5 +++++ Utilities/ReleaseScripts/test/test-clang-tidy.sh | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PhysicsTools/PythonAnalysis/test/BuildFile.xml b/PhysicsTools/PythonAnalysis/test/BuildFile.xml index 4ea66e34689c0..3d3fcfd2894c6 100644 --- a/PhysicsTools/PythonAnalysis/test/BuildFile.xml +++ b/PhysicsTools/PythonAnalysis/test/BuildFile.xml @@ -25,7 +25,7 @@ - + diff --git a/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml b/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml index 462d9fd109097..986704e2d08ee 100644 --- a/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml +++ b/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml @@ -11,6 +11,7 @@ Diagnostics: Offset: 69 Length: 1 ReplacementText: nullptr + Level: Warning - DiagnosticName: modernize-use-nullptr DiagnosticMessage: Message: use nullptr @@ -21,6 +22,7 @@ Diagnostics: Offset: 206 Length: 1 ReplacementText: nullptr + Level: Warning - DiagnosticName: modernize-use-nullptr DiagnosticMessage: Message: use nullptr @@ -31,6 +33,7 @@ Diagnostics: Offset: 235 Length: 1 ReplacementText: nullptr + Level: Warning - DiagnosticName: modernize-use-override DiagnosticMessage: Message: 'prefer using ''override'' or (rarely) ''final'' instead of ''virtual''' @@ -45,6 +48,7 @@ Diagnostics: Offset: 399 Length: 0 ReplacementText: ' override' + Level: Warning - DiagnosticName: modernize-use-override DiagnosticMessage: Message: 'prefer using ''override'' or (rarely) ''final'' instead of ''virtual''' @@ -59,4 +63,5 @@ Diagnostics: Offset: 427 Length: 0 ReplacementText: ' override' + Level: Warning ... diff --git a/Utilities/ReleaseScripts/test/test-clang-tidy.sh b/Utilities/ReleaseScripts/test/test-clang-tidy.sh index cb0fe16237b34..e9009360b0258 100755 --- a/Utilities/ReleaseScripts/test/test-clang-tidy.sh +++ b/Utilities/ReleaseScripts/test/test-clang-tidy.sh @@ -1,5 +1,6 @@ #!/bin/bash -ex clang-tidy -export-fixes $CMSSW_BASE/test-clang-tidy.cc.yaml -header-filter "$CMSSW_BASE/src/.*" $CMSSW_BASE/src/Utilities/ReleaseScripts/test/test-clang-tidy.cc sed -i -e "s|$CMSSW_BASE/src/||" $CMSSW_BASE/test-clang-tidy.cc.yaml +sed -i -e '/^ BuildDirectory/d' $CMSSW_BASE/test-clang-tidy.cc.yaml diff -u $CMSSW_BASE/test-clang-tidy.cc.yaml $CMSSW_BASE/src/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml rm -f $CMSSW_BASE/test-clang-tidy.cc.yaml From 778981e7a5d50da2056dc48c1e42de01911248fb Mon Sep 17 00:00:00 2001 From: Erica Brondolin Date: Tue, 9 Mar 2021 15:39:16 +0100 Subject: [PATCH 12/46] Introduce LogVerbatim --- RecoHGCal/TICL/test/TiclDebugger.cc | 36 ++++++++++++++----------- RecoHGCal/TICL/test/ticlDebugger_cfg.py | 17 ++++++++++++ 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/RecoHGCal/TICL/test/TiclDebugger.cc b/RecoHGCal/TICL/test/TiclDebugger.cc index 969df37e8072f..b72a0b02273a8 100644 --- a/RecoHGCal/TICL/test/TiclDebugger.cc +++ b/RecoHGCal/TICL/test/TiclDebugger.cc @@ -118,6 +118,8 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet } }; + std::stringstream prob_id_str; + for (auto const& t : sorted_tracksters_idx) { auto const& trackster = tracksters[t]; auto const& probs = trackster.id_probabilities(); @@ -146,21 +148,24 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet return layer_i_out < layer_j_out; }); - std::cout << "\nTrksIdx: " << t << "\n bary: " << trackster.barycenter() + for (auto p_idx : sorted_probs_idx) { + prob_id_str << "(" << particle_kind[p_idx] << "):" << std::fixed << std::setprecision(4) << probs[p_idx] << " "; + } + LogVerbatim("TICLDebugger") + << "\nTrksIdx: " << t << "\n bary: " << trackster.barycenter() << " baryEta: " << trackster.barycenter().eta() << " baryPhi: " << trackster.barycenter().phi() << "\n raw_energy: " << trackster.raw_energy() << " raw_em_energy: " << trackster.raw_em_energy() << "\n raw_pt: " << trackster.raw_pt() << " raw_em_pt: " << trackster.raw_em_pt() - << "\n seedIdx: " << trackster.seedIndex() << "\n Probs: "; - for (auto p_idx : sorted_probs_idx) { - std::cout << "(" << particle_kind[p_idx] << "):" << probs[p_idx] << " "; - } - std::cout << "\n time: " << trackster.time() << "+/-" << trackster.timeError() << std::endl + << "\n seedIdx: " << trackster.seedIndex() << "\n Probs: " << prob_id_str.str(); + prob_id_str.str(""); + prob_id_str.clear(); + LogVerbatim("TICLDebugger") << "\n time: " << trackster.time() << "+/-" << trackster.timeError() << std::endl << " vertices: " << trackster.vertices().size() << " average usage: " << std::accumulate( std::begin(trackster.vertex_multiplicity()), std::end(trackster.vertex_multiplicity()), 0.) / trackster.vertex_multiplicity().size() << std::endl; - std::cout << " link connections: " << trackster.edges().size() << std::endl; + LogVerbatim("TICLDebugger") << " link connections: " << trackster.edges().size() << std::endl; auto dumpLayerCluster = [&layerClusters](hgcal::RecHitTools const & rhtools, int cluster_idx) { auto const & cluster = layerClusters[cluster_idx]; const auto firstHitDetId = cluster.hitsAndFractions()[0].first; @@ -168,24 +173,23 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet int lcLayerId = rhtools.getLayerWithOffset(firstHitDetId) + layers * ((rhtools.zside(firstHitDetId) + 1) >> 1) - 1; - std::cout << "Idx: " << cluster_idx + LogVerbatim("TICLDebugger") << "Idx: " << cluster_idx << "(" << lcLayerId << ", " - << cluster.energy() << ", " << cluster.hitsAndFractions().size() << ", " << cluster.position() << ") "; }; for (auto link : sorted_edges_idx) { - std::cout << "(" << trackster.edges()[link][0] << ", " << trackster.edges()[link][1] << ") "; + LogVerbatim("TICLDebugger") << "(" << trackster.edges()[link][0] << ", " << trackster.edges()[link][1] << ") "; dumpLayerCluster(rhtools_, trackster.edges()[link][0]); dumpLayerCluster(rhtools_, trackster.edges()[link][1]); - std::cout << std::endl; + LogVerbatim("TICLDebugger") << std::endl; } if (trackster.seedID().id() != 0) { auto const& track = tracks[trackster.seedIndex()]; - std::cout << " Seeding Track:" << std::endl; - std::cout << " p: " << track.p() << " pt: " << track.pt() + LogVerbatim("TICLDebugger") << " Seeding Track:" << std::endl; + LogVerbatim("TICLDebugger") << " p: " << track.p() << " pt: " << track.pt() << " charge: " << track.charge() << " eta: " << track.eta() << " outerEta: " << track.outerEta() << " phi: " << track.phi() << " outerPhi: " << track.outerPhi() @@ -193,15 +197,15 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet } bestCaloParticleMatches(trackster); if (!bestCPMatches.empty()) { - std::cout << " Best CaloParticles Matches:" << std::endl;; + LogVerbatim("TICLDebugger") << " Best CaloParticles Matches:" << std::endl;; for (auto const& i : bestCPMatches) { auto const & cp = caloParticles[i.first]; - std::cout << " " << i.first << "(" << i.second << "):" << cp.pdgId() + LogVerbatim("TICLDebugger") << " " << i.first << "(" << i.second << "):" << cp.pdgId() << " simCl size:" << cp.simClusters().size() << " energy:" << cp.energy() << " pt:" << cp.pt() << " momentum:" << cp.momentum() << std::endl; } - std::cout << std::endl; + LogVerbatim("TICLDebugger") << std::endl; } } } diff --git a/RecoHGCal/TICL/test/ticlDebugger_cfg.py b/RecoHGCal/TICL/test/ticlDebugger_cfg.py index a996a4ef1205a..44582be049cd3 100644 --- a/RecoHGCal/TICL/test/ticlDebugger_cfg.py +++ b/RecoHGCal/TICL/test/ticlDebugger_cfg.py @@ -20,5 +20,22 @@ process.load("RecoHGCal.TICL.ticlDebugger_cfi") process.load("SimGeneral.Debugging.caloParticleDebugger_cfi") +# MessageLogger customizations +process.MessageLogger.cerr.enable = False +process.MessageLogger.cout.enable = False +label = 'TICLDebugger' +messageLogger = dict() +main_key = '%sMessageLogger'%(label) +messageLogger[main_key] = dict( + filename = '%s.log' % (label), + threshold = 'INFO', + default = dict(limit=0) + ) +messageLogger[main_key][label] = dict(limit=-1) +# First create defaults +setattr(process.MessageLogger.files, label, dict()) +# Then modify them +setattr(process.MessageLogger.files, label, messageLogger[main_key]) + process.p = cms.Path(process.ticlDebugger+process.caloParticleDebugger) From b57d7991a503e02fbea60ecb7bce6a4032f64aba Mon Sep 17 00:00:00 2001 From: Erica Brondolin Date: Tue, 9 Mar 2021 15:44:58 +0100 Subject: [PATCH 13/46] Adjusting format --- RecoHGCal/TICL/test/TiclDebugger.cc | 100 ++++++++++++++-------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/RecoHGCal/TICL/test/TiclDebugger.cc b/RecoHGCal/TICL/test/TiclDebugger.cc index b72a0b02273a8..12c6d40b401e2 100644 --- a/RecoHGCal/TICL/test/TiclDebugger.cc +++ b/RecoHGCal/TICL/test/TiclDebugger.cc @@ -46,7 +46,7 @@ class TiclDebugger : public edm::one::EDAnalyzer { void beginJob() override; void beginRun(const edm::Run&, const edm::EventSetup&) override; void analyze(const edm::Event&, const edm::EventSetup&) override; - void endRun(edm::Run const& iEvent, edm::EventSetup const&) override {}; + void endRun(edm::Run const& iEvent, edm::EventSetup const&) override{}; void endJob() override; const edm::InputTag trackstersMerge_; @@ -131,54 +131,54 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet std::vector sorted_edges_idx(trackster.edges().size()); iota(begin(sorted_edges_idx), end(sorted_edges_idx), 0); sort(begin(sorted_edges_idx), end(sorted_edges_idx), [&](int i, int j) { - int layers = rhtools_.lastLayer(); - auto const & ed_i = trackster.edges()[i]; - auto const & ed_j = trackster.edges()[j]; - auto const & cl_i_in = layerClusters[ed_i[0]].hitsAndFractions()[0].first; - auto const & cl_i_out = layerClusters[ed_i[1]].hitsAndFractions()[0].first; - auto const & cl_j_in = layerClusters[ed_j[0]].hitsAndFractions()[0].first; - auto const & cl_j_out = layerClusters[ed_j[1]].hitsAndFractions()[0].first; - auto const layer_i_in = rhtools_.getLayerWithOffset(cl_i_in) + layers * ((rhtools_.zside(cl_i_in) + 1) >> 1) - 1; - auto const layer_i_out = rhtools_.getLayerWithOffset(cl_i_out) + layers * ((rhtools_.zside(cl_i_out) + 1) >> 1) - 1; - auto const layer_j_in = rhtools_.getLayerWithOffset(cl_j_in) + layers * ((rhtools_.zside(cl_j_in) + 1) >> 1) - 1; - auto const layer_j_out = rhtools_.getLayerWithOffset(cl_j_out) + layers * ((rhtools_.zside(cl_j_out) + 1) >> 1) - 1; - if (layer_i_in != layer_j_in) - return layer_i_in < layer_j_in; - else - return layer_i_out < layer_j_out; + int layers = rhtools_.lastLayer(); + auto const& ed_i = trackster.edges()[i]; + auto const& ed_j = trackster.edges()[j]; + auto const& cl_i_in = layerClusters[ed_i[0]].hitsAndFractions()[0].first; + auto const& cl_i_out = layerClusters[ed_i[1]].hitsAndFractions()[0].first; + auto const& cl_j_in = layerClusters[ed_j[0]].hitsAndFractions()[0].first; + auto const& cl_j_out = layerClusters[ed_j[1]].hitsAndFractions()[0].first; + auto const layer_i_in = rhtools_.getLayerWithOffset(cl_i_in) + layers * ((rhtools_.zside(cl_i_in) + 1) >> 1) - 1; + auto const layer_i_out = + rhtools_.getLayerWithOffset(cl_i_out) + layers * ((rhtools_.zside(cl_i_out) + 1) >> 1) - 1; + auto const layer_j_in = rhtools_.getLayerWithOffset(cl_j_in) + layers * ((rhtools_.zside(cl_j_in) + 1) >> 1) - 1; + auto const layer_j_out = + rhtools_.getLayerWithOffset(cl_j_out) + layers * ((rhtools_.zside(cl_j_out) + 1) >> 1) - 1; + if (layer_i_in != layer_j_in) + return layer_i_in < layer_j_in; + else + return layer_i_out < layer_j_out; }); for (auto p_idx : sorted_probs_idx) { - prob_id_str << "(" << particle_kind[p_idx] << "):" << std::fixed << std::setprecision(4) << probs[p_idx] << " "; + prob_id_str << "(" << particle_kind[p_idx] << "):" << std::fixed << std::setprecision(4) << probs[p_idx] << " "; } - LogVerbatim("TICLDebugger") - << "\nTrksIdx: " << t << "\n bary: " << trackster.barycenter() - << " baryEta: " << trackster.barycenter().eta() << " baryPhi: " << trackster.barycenter().phi() - << "\n raw_energy: " << trackster.raw_energy() << " raw_em_energy: " << trackster.raw_em_energy() - << "\n raw_pt: " << trackster.raw_pt() << " raw_em_pt: " << trackster.raw_em_pt() - << "\n seedIdx: " << trackster.seedIndex() << "\n Probs: " << prob_id_str.str(); + LogVerbatim("TICLDebugger") << "\nTrksIdx: " << t << "\n bary: " << trackster.barycenter() + << " baryEta: " << trackster.barycenter().eta() + << " baryPhi: " << trackster.barycenter().phi() + << "\n raw_energy: " << trackster.raw_energy() + << " raw_em_energy: " << trackster.raw_em_energy() + << "\n raw_pt: " << trackster.raw_pt() << " raw_em_pt: " << trackster.raw_em_pt() + << "\n seedIdx: " << trackster.seedIndex() << "\n Probs: " << prob_id_str.str(); prob_id_str.str(""); prob_id_str.clear(); LogVerbatim("TICLDebugger") << "\n time: " << trackster.time() << "+/-" << trackster.timeError() << std::endl - << " vertices: " << trackster.vertices().size() << " average usage: " - << std::accumulate( - std::begin(trackster.vertex_multiplicity()), std::end(trackster.vertex_multiplicity()), 0.) / - trackster.vertex_multiplicity().size() - << std::endl; + << " vertices: " << trackster.vertices().size() << " average usage: " + << std::accumulate(std::begin(trackster.vertex_multiplicity()), + std::end(trackster.vertex_multiplicity()), + 0.) / + trackster.vertex_multiplicity().size() + << std::endl; LogVerbatim("TICLDebugger") << " link connections: " << trackster.edges().size() << std::endl; - auto dumpLayerCluster = [&layerClusters](hgcal::RecHitTools const & rhtools, int cluster_idx) { - auto const & cluster = layerClusters[cluster_idx]; + auto dumpLayerCluster = [&layerClusters](hgcal::RecHitTools const& rhtools, int cluster_idx) { + auto const& cluster = layerClusters[cluster_idx]; const auto firstHitDetId = cluster.hitsAndFractions()[0].first; int layers = rhtools.lastLayer(); int lcLayerId = - rhtools.getLayerWithOffset(firstHitDetId) + layers * ((rhtools.zside(firstHitDetId) + 1) >> 1) - 1; - - LogVerbatim("TICLDebugger") << "Idx: " << cluster_idx - << "(" - << lcLayerId << ", " - << cluster.hitsAndFractions().size() << ", " - << cluster.position() - << ") "; + rhtools.getLayerWithOffset(firstHitDetId) + layers * ((rhtools.zside(firstHitDetId) + 1) >> 1) - 1; + + LogVerbatim("TICLDebugger") << "Idx: " << cluster_idx << "(" << lcLayerId << ", " + << cluster.hitsAndFractions().size() << ", " << cluster.position() << ") "; }; for (auto link : sorted_edges_idx) { LogVerbatim("TICLDebugger") << "(" << trackster.edges()[link][0] << ", " << trackster.edges()[link][1] << ") "; @@ -189,21 +189,19 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet if (trackster.seedID().id() != 0) { auto const& track = tracks[trackster.seedIndex()]; LogVerbatim("TICLDebugger") << " Seeding Track:" << std::endl; - LogVerbatim("TICLDebugger") << " p: " << track.p() << " pt: " << track.pt() - << " charge: " << track.charge() << " eta: " << track.eta() - << " outerEta: " << track.outerEta() << " phi: " << track.phi() - << " outerPhi: " << track.outerPhi() - << std::endl; + LogVerbatim("TICLDebugger") << " p: " << track.p() << " pt: " << track.pt() << " charge: " << track.charge() + << " eta: " << track.eta() << " outerEta: " << track.outerEta() + << " phi: " << track.phi() << " outerPhi: " << track.outerPhi() << std::endl; } bestCaloParticleMatches(trackster); if (!bestCPMatches.empty()) { - LogVerbatim("TICLDebugger") << " Best CaloParticles Matches:" << std::endl;; + LogVerbatim("TICLDebugger") << " Best CaloParticles Matches:" << std::endl; + ; for (auto const& i : bestCPMatches) { - auto const & cp = caloParticles[i.first]; - LogVerbatim("TICLDebugger") << " " << i.first << "(" << i.second << "):" << cp.pdgId() - << " simCl size:" << cp.simClusters().size() - << " energy:" << cp.energy() << " pt:" << cp.pt() - << " momentum:" << cp.momentum() << std::endl; + auto const& cp = caloParticles[i.first]; + LogVerbatim("TICLDebugger") << " " << i.first << "(" << i.second << "):" << cp.pdgId() + << " simCl size:" << cp.simClusters().size() << " energy:" << cp.energy() + << " pt:" << cp.pt() << " momentum:" << cp.momentum() << std::endl; } LogVerbatim("TICLDebugger") << std::endl; } @@ -211,7 +209,9 @@ void TiclDebugger::analyze(const edm::Event& iEvent, const edm::EventSetup& iSet } void TiclDebugger::beginRun(edm::Run const&, edm::EventSetup const& es) { - edm::ESHandle geom; es.get().get(geom); rhtools_.setGeometry(*geom); + edm::ESHandle geom; + es.get().get(geom); + rhtools_.setGeometry(*geom); } void TiclDebugger::beginJob() {} From afc00ea201a1b793f6125c80dbafb0a1b99bf3fc Mon Sep 17 00:00:00 2001 From: David Date: Tue, 9 Mar 2021 15:51:10 +0100 Subject: [PATCH 14/46] one more include that I missed --- DataFormats/RecoCandidate/src/classes.h | 1 - 1 file changed, 1 deletion(-) diff --git a/DataFormats/RecoCandidate/src/classes.h b/DataFormats/RecoCandidate/src/classes.h index 7ccb822646d0d..9783441487180 100644 --- a/DataFormats/RecoCandidate/src/classes.h +++ b/DataFormats/RecoCandidate/src/classes.h @@ -18,7 +18,6 @@ #include "DataFormats/RecoCandidate/interface/FitResult.h" #include "DataFormats/RecoCandidate/interface/CaloRecHitCandidate.h" #include "DataFormats/RecoCandidate/interface/TrackAssociation.h" -#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h" #include "DataFormats/RecoCandidate/interface/TrackCandidateAssociation.h" #include "DataFormats/Common/interface/RefProd.h" #include "DataFormats/Common/interface/Wrapper.h" From ad03661f569b22acb914cb96c007c9eeb839de1a Mon Sep 17 00:00:00 2001 From: Suvankar Roy Chowdhury Date: Tue, 9 Mar 2021 16:34:44 +0100 Subject: [PATCH 15/46] misc changes to binning and ranges --- .../plugins/Phase2ITMonitorRecHit.cc | 16 +++++----- .../plugins/Phase2ITValidateCluster.cc | 16 +++++----- .../plugins/Phase2ITValidateRecHit.cc | 12 +++---- .../plugins/Phase2OTValidateCluster.cc | 32 +++++++++---------- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc index 54b3b82cc70e6..33da43b9c9f35 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc @@ -270,8 +270,8 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des psd0.add("title", "NumberRecHits;Number of RecHits;"); psd0.add("xmin", 0.0); psd0.add("switch", true); - psd0.add("xmax", 0.0); - psd0.add("NxBins", 50); + psd0.add("xmax", 250000.0); + psd0.add("NxBins", 250); desc.add("GlobalNumberRecHits", psd0); } { @@ -333,8 +333,8 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des psd0.add("title", "NumberRecHits;Number of RecHits;"); psd0.add("xmin", 0.0); psd0.add("switch", true); - psd0.add("xmax", 0.0); - psd0.add("NxBins", 50); + psd0.add("xmax", 150000.0); + psd0.add("NxBins", 150); desc.add("LocalNumberRecHits", psd0); } { @@ -392,8 +392,8 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des psd0.add("title", "Cluster_SizeY;cluster size y;"); psd0.add("xmin", -0.5); psd0.add("switch", true); - psd0.add("xmax", 20.5); - psd0.add("NxBins", 21); + psd0.add("xmax", 25.5); + psd0.add("NxBins", 26); desc.add("LocalClusterSizeY", psd0); } { @@ -419,7 +419,7 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des { edm::ParameterSetDescription psd0; psd0.add("name", "RecHit_X_error_Vs_eta"); - psd0.add("title", "RecHit_X_error_Vs_eta;#eta;x error #times 10^{6}"); + psd0.add("title", "RecHit_X_error_Vs_eta;#eta;x error [microns]"); psd0.add("switch", true); psd0.add("NxBins", 82); psd0.add("xmax", 4.1); @@ -431,7 +431,7 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des { edm::ParameterSetDescription psd0; psd0.add("name", "RecHit_Y_error_Vs_eta"); - psd0.add("title", "RecHit_Y_error_Vs_eta;#eta;y error #times 10^{6}"); + psd0.add("title", "RecHit_Y_error_Vs_eta;#eta;y error [microns]"); psd0.add("switch", true); psd0.add("NxBins", 82); psd0.add("xmax", 4.1); diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateCluster.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateCluster.cc index 56cdc5ab62d4e..9e91d540f8dfa 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateCluster.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateCluster.cc @@ -312,17 +312,17 @@ void Phase2ITValidateCluster::fillDescriptions(edm::ConfigurationDescriptions& d { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Pixel"); - psd0.add("title", "#Delta X;Cluster resolution X dimension"); + psd0.add("title", "#Delta X;Cluster resolution X coordinate"); psd0.add("switch", true); - psd0.add("xmax", 5.0); - psd0.add("xmin", -5.0); + psd0.add("xmax", 2.5); + psd0.add("xmin", -2.5); psd0.add("NxBins", 100); desc.add("Delta_X_Pixel", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Pixel"); - psd0.add("title", "#Delta Y ;Cluster resolution Y dimension"); + psd0.add("title", "#Delta Y ;Cluster resolution Y coordinate"); psd0.add("xmin", -5.0); psd0.add("switch", true); psd0.add("xmax", 5.0); @@ -332,17 +332,17 @@ void Phase2ITValidateCluster::fillDescriptions(edm::ConfigurationDescriptions& d { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Pixel_Primary"); - psd0.add("title", "#Delta X ;cluster resolution X dimension"); - psd0.add("xmin", -5.0); + psd0.add("title", "#Delta X ;cluster resolution X coordinate"); + psd0.add("xmin", -2.5); psd0.add("switch", true); - psd0.add("xmax", 5.0); + psd0.add("xmax", 2.5); psd0.add("NxBins", 100); desc.add("Delta_X_Pixel_Primary", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Pixel_Primary"); - psd0.add("title", "#Delta Y ;cluster resolution Y dimension"); + psd0.add("title", "#Delta Y ;cluster resolution Y coordinate"); psd0.add("xmin", -5.0); psd0.add("switch", true); psd0.add("xmax", 5.0); diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc index da5c48524b1cb..56b1c41aaed77 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc @@ -310,20 +310,20 @@ void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& de { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X"); - psd0.add("title", "Delta_X;RecHit resolution X dimension"); - psd0.add("xmin", -0.2); + psd0.add("title", "Delta_X;RecHit resolution X coordinate"); + psd0.add("xmin", -0.1); psd0.add("switch", true); - psd0.add("xmax", 0.2); + psd0.add("xmax", 0.1); psd0.add("NxBins", 100); desc.add("DeltaX", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y"); - psd0.add("title", "Delta_Y;RecHit resolution Y dimension;"); - psd0.add("xmin", -0.2); + psd0.add("title", "Delta_Y;RecHit resolution Y coordinate;"); + psd0.add("xmin", -0.1); psd0.add("switch", true); - psd0.add("xmax", 0.2); + psd0.add("xmax", 0.1); psd0.add("NxBins", 100); desc.add("DeltaY", psd0); } diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2OTValidateCluster.cc b/Validation/SiTrackerPhase2V/plugins/Phase2OTValidateCluster.cc index 9a0a3fbdaef23..b624874906b2b 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2OTValidateCluster.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2OTValidateCluster.cc @@ -351,17 +351,17 @@ void Phase2OTValidateCluster::fillDescriptions(edm::ConfigurationDescriptions& d { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Pixel"); - psd0.add("title", "#Delta X " + mptag + ";Cluster resolution X dimension"); + psd0.add("title", "#Delta X " + mptag + ";Cluster resolution X coordinate"); psd0.add("switch", true); - psd0.add("xmax", 5.0); - psd0.add("xmin", -5.0); + psd0.add("xmax", 2.0); + psd0.add("xmin", -2.0); psd0.add("NxBins", 100); desc.add("Delta_X_Pixel", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Pixel"); - psd0.add("title", "#Delta Y " + mptag + ";Cluster resolution Y dimension"); + psd0.add("title", "#Delta Y " + mptag + ";Cluster resolution Y coordinate"); psd0.add("xmin", -5.0); psd0.add("switch", true); psd0.add("xmax", 5.0); @@ -371,17 +371,17 @@ void Phase2OTValidateCluster::fillDescriptions(edm::ConfigurationDescriptions& d { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Pixel_Primary"); - psd0.add("title", "#Delta X " + mptag + ";cluster resolution X dimension"); - psd0.add("xmin", -5.0); + psd0.add("title", "#Delta X " + mptag + ";cluster resolution X coordinate"); + psd0.add("xmin", -2.0); psd0.add("switch", true); - psd0.add("xmax", 5.0); + psd0.add("xmax", 2.0); psd0.add("NxBins", 100); desc.add("Delta_X_Pixel_Primary", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Pixel_Primary"); - psd0.add("title", "#Delta Y " + mptag + ";cluster resolution Y dimension"); + psd0.add("title", "#Delta Y " + mptag + ";cluster resolution Y coordinate"); psd0.add("xmin", -5.0); psd0.add("switch", true); psd0.add("xmax", 5.0); @@ -393,17 +393,17 @@ void Phase2OTValidateCluster::fillDescriptions(edm::ConfigurationDescriptions& d { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Strip"); - psd0.add("title", "#Delta X " + striptag + ";Cluster resolution X dimension"); - psd0.add("xmin", -5.0); + psd0.add("title", "#Delta X " + striptag + ";Cluster resolution X coordinate"); + psd0.add("xmin", -2.0); psd0.add("switch", true); - psd0.add("xmax", 5.0); + psd0.add("xmax", 2.0); psd0.add("NxBins", 100); desc.add("Delta_X_Strip", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Strip"); - psd0.add("title", "#Delta Y " + striptag + ";Cluster resolution Y dimension"); + psd0.add("title", "#Delta Y " + striptag + ";Cluster resolution Y coordinate"); psd0.add("xmin", -5.0); psd0.add("switch", true); psd0.add("xmax", 5.0); @@ -413,17 +413,17 @@ void Phase2OTValidateCluster::fillDescriptions(edm::ConfigurationDescriptions& d { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Strip_Primary"); - psd0.add("title", "#Delta X " + striptag + ";Cluster resolution X dimension"); - psd0.add("xmin", -5.0); + psd0.add("title", "#Delta X " + striptag + ";Cluster resolution X coordinate"); + psd0.add("xmin", -2.0); psd0.add("switch", true); - psd0.add("xmax", 5.0); + psd0.add("xmax", 2.0); psd0.add("NxBins", 100); desc.add("Delta_X_Strip_Primary", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Strip_Primary"); - psd0.add("title", "#Delta Y " + striptag + ";Cluster resolution Y dimension"); + psd0.add("title", "#Delta Y " + striptag + ";Cluster resolution Y coordinate"); psd0.add("xmin", -5.0); psd0.add("switch", true); psd0.add("xmax", 5.0); From 3d4a15fa6004bd6dee51ddf296a8916a546ed2d3 Mon Sep 17 00:00:00 2001 From: Gabriel Ramirez Date: Tue, 9 Mar 2021 16:54:31 +0100 Subject: [PATCH 16/46] bin ranges --- DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc | 6 +++--- DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc index 57de4eb75aff3..20f7f04643d7f 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorCluster.cc @@ -262,7 +262,7 @@ void Phase2ITMonitorCluster::fillDescriptions(edm::ConfigurationDescriptions& de psd0.add("xmin", 0.0); psd0.add("switch", true); psd0.add("xmax", 300000.0); - psd0.add("NxBins", 50); + psd0.add("NxBins", 150); desc.add("GlobalNClusters", psd0); } { @@ -325,8 +325,8 @@ void Phase2ITMonitorCluster::fillDescriptions(edm::ConfigurationDescriptions& de psd0.add("title", "NumberOfClutsers;Number of Clusters;"); psd0.add("xmin", 0.0); psd0.add("switch", true); - psd0.add("xmax", 15000.0); - psd0.add("NxBins", 50); + psd0.add("xmax", 20000.0); + psd0.add("NxBins", 150); desc.add("NClustersLayer", psd0); } { diff --git a/DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc b/DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc index 069cc6131d2ce..6ff1f20b7f23d 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2OTMonitorCluster.cc @@ -276,7 +276,7 @@ void Phase2OTMonitorCluster::fillDescriptions(edm::ConfigurationDescriptions& de psd0.add("xmin", 0.0); psd0.add("switch", true); psd0.add("xmax", 350000.0); - psd0.add("NxBins", 50); + psd0.add("NxBins", 150); desc.add("GlobalNClusters", psd0); } { @@ -339,7 +339,7 @@ void Phase2OTMonitorCluster::fillDescriptions(edm::ConfigurationDescriptions& de psd0.add("title", ";Number of clusters per event(macro pixel sensor);"); psd0.add("xmin", 0.0); psd0.add("xmax", 28000.0); - psd0.add("NxBins", 50); + psd0.add("NxBins", 150); psd0.add("switch", true); desc.add("NClustersLayer_P", psd0); } @@ -349,7 +349,7 @@ void Phase2OTMonitorCluster::fillDescriptions(edm::ConfigurationDescriptions& de psd0.add("title", ";Number of clusters per event(strip sensor);"); psd0.add("xmin", 0.0); psd0.add("xmax", 28000.0); - psd0.add("NxBins", 50); + psd0.add("NxBins", 150); psd0.add("switch", true); desc.add("NClustersLayer_S", psd0); } From 0754a5dbe46d3a86879fd3179cfa403494f2923b Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 9 Mar 2021 19:25:01 +0100 Subject: [PATCH 17/46] migrate Phase2TrackerRecHits to esConsumes --- .../plugins/Phase2TrackerRecHits.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/RecoLocalTracker/Phase2TrackerRecHits/plugins/Phase2TrackerRecHits.cc b/RecoLocalTracker/Phase2TrackerRecHits/plugins/Phase2TrackerRecHits.cc index 9c03b5ce846a8..20531f27becc5 100644 --- a/RecoLocalTracker/Phase2TrackerRecHits/plugins/Phase2TrackerRecHits.cc +++ b/RecoLocalTracker/Phase2TrackerRecHits/plugins/Phase2TrackerRecHits.cc @@ -34,13 +34,16 @@ class Phase2TrackerRecHits : public edm::global::EDProducer<> { void produce(edm::StreamID sid, edm::Event& event, const edm::EventSetup& eventSetup) const final; private: + edm::ESGetToken const tTrackerGeom_; + edm::ESGetToken, TkPhase2OTCPERecord> const tCPE_; + edm::EDGetTokenT token_; - edm::ESInputTag cpeTag_; }; Phase2TrackerRecHits::Phase2TrackerRecHits(edm::ParameterSet const& conf) - : token_(consumes(conf.getParameter("src"))), - cpeTag_(conf.getParameter("Phase2StripCPE")) { + : tTrackerGeom_(esConsumes()), + tCPE_(esConsumes(conf.getParameter("Phase2StripCPE"))), + token_(consumes(conf.getParameter("src"))) { produces(); } @@ -50,13 +53,10 @@ void Phase2TrackerRecHits::produce(edm::StreamID sid, edm::Event& event, const e event.getByToken(token_, clusters); // load the cpe via the eventsetup - edm::ESHandle > cpe; - eventSetup.get().get(cpeTag_, cpe); + const auto& cpe = &eventSetup.getData(tCPE_); // Get the geometry - edm::ESHandle geomHandle; - eventSetup.get().get(geomHandle); - const TrackerGeometry* tkGeom(&(*geomHandle)); + const TrackerGeometry* tkGeom = &eventSetup.getData(tTrackerGeom_); // Global container for the RecHits of each module auto outputRecHits = std::make_unique(); From 5e9a58ebc032097850a6c939f1f32fed90cb22da Mon Sep 17 00:00:00 2001 From: David Date: Tue, 9 Mar 2021 19:30:33 +0100 Subject: [PATCH 18/46] add back Vertex.h --- RecoMET/METAlgorithms/BuildFile.xml | 1 + RecoMET/METAlgorithms/interface/HcalHaloAlgo.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/RecoMET/METAlgorithms/BuildFile.xml b/RecoMET/METAlgorithms/BuildFile.xml index 615a4a22c5813..017f7c4f1fbed 100644 --- a/RecoMET/METAlgorithms/BuildFile.xml +++ b/RecoMET/METAlgorithms/BuildFile.xml @@ -17,6 +17,7 @@ + diff --git a/RecoMET/METAlgorithms/interface/HcalHaloAlgo.h b/RecoMET/METAlgorithms/interface/HcalHaloAlgo.h index 1ec1589092e22..8fe9e58348891 100644 --- a/RecoMET/METAlgorithms/interface/HcalHaloAlgo.h +++ b/RecoMET/METAlgorithms/interface/HcalHaloAlgo.h @@ -33,11 +33,12 @@ #include "DataFormats/CaloTowers/interface/CaloTower.h" #include "DataFormats/CaloTowers/interface/CaloTowerDetId.h" #include "DataFormats/CaloTowers/interface/CaloTowerCollection.h" - +#include "DataFormats/VertexReco/interface/Vertex.h" #include "DataFormats/METReco/interface/HaloClusterCandidateHCAL.h" #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" + class HcalHaloAlgo { public: //constructor From 1e8fdbc2986c48ab6c3ded6ce0aa1c486145c1e4 Mon Sep 17 00:00:00 2001 From: David Date: Tue, 9 Mar 2021 20:00:33 +0100 Subject: [PATCH 19/46] code checks --- RecoMET/METAlgorithms/interface/HcalHaloAlgo.h | 1 - 1 file changed, 1 deletion(-) diff --git a/RecoMET/METAlgorithms/interface/HcalHaloAlgo.h b/RecoMET/METAlgorithms/interface/HcalHaloAlgo.h index 8fe9e58348891..e8381930c14a2 100644 --- a/RecoMET/METAlgorithms/interface/HcalHaloAlgo.h +++ b/RecoMET/METAlgorithms/interface/HcalHaloAlgo.h @@ -38,7 +38,6 @@ #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h" - class HcalHaloAlgo { public: //constructor From a999c274c6aa756d65eb8637e3e8fa832e2d2dc1 Mon Sep 17 00:00:00 2001 From: zeratul87 Date: Tue, 9 Mar 2021 16:00:20 -0600 Subject: [PATCH 20/46] Devirtualize PFBlockElementTrack class --- .../ParticleFlowReco/interface/PFBlockElementTrack.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h index 16d3ea84609bd..2d9898e575454 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h @@ -14,7 +14,7 @@ namespace reco { /// \brief Track Element. /// /// this class contains a reference to a PFRecTrack - class PFBlockElementTrack : public PFBlockElement { + class PFBlockElementTrack final : public PFBlockElement { public: PFBlockElementTrack() {} @@ -50,12 +50,12 @@ namespace reco { /// check if the track is secondary bool isSecondary() const override { - return trackType(T_FROM_DISP) || trackType(T_FROM_GAMMACONV) || trackType(T_FROM_V0); + return trackType(T_FROM_DISP) | trackType(T_FROM_GAMMACONV) | trackType(T_FROM_V0); } bool isPrimary() const override { return trackType(T_TO_DISP); } - bool isLinkedToDisplacedVertex() const override { return isSecondary() || isPrimary(); } + bool isLinkedToDisplacedVertex() const override { return isSecondary() | isPrimary(); } /// \return the displaced vertex associated const PFDisplacedTrackerVertexRef& displacedVertexRef(TrackType trType) const override { From e2e2733d88e4435d972a4b110521ecbffb24491f Mon Sep 17 00:00:00 2001 From: zeratul87 Date: Tue, 9 Mar 2021 22:12:11 -0600 Subject: [PATCH 21/46] Bitmasking for isLinkedToDisplacedVertex, isPrimary, isSecondary functions --- .../interface/PFBlockElementTrack.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h index 2d9898e575454..a25ea279c08d7 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlockElementTrack.h @@ -48,14 +48,18 @@ namespace reco { /// \return reference to the corresponding Track const reco::TrackRef& trackRef() const override { return trackRef_; } + static constexpr unsigned int kPrimaryMask = 1 << T_TO_DISP; + + static constexpr unsigned int kSecondaryMask = (1 << T_FROM_DISP) | (1 << T_FROM_GAMMACONV) | (1 << T_FROM_V0); + + static constexpr unsigned int kLinkedToDisplacedVertexMask = kPrimaryMask | kSecondaryMask; + /// check if the track is secondary - bool isSecondary() const override { - return trackType(T_FROM_DISP) | trackType(T_FROM_GAMMACONV) | trackType(T_FROM_V0); - } + bool isSecondary() const override { return trackType_ & kSecondaryMask; } - bool isPrimary() const override { return trackType(T_TO_DISP); } + bool isPrimary() const override { return trackType_ & kPrimaryMask; } - bool isLinkedToDisplacedVertex() const override { return isSecondary() | isPrimary(); } + bool isLinkedToDisplacedVertex() const override { return trackType_ & kLinkedToDisplacedVertexMask; } /// \return the displaced vertex associated const PFDisplacedTrackerVertexRef& displacedVertexRef(TrackType trType) const override { From 431c39088ec995f84e3939bf99d32ad0dd80d52d Mon Sep 17 00:00:00 2001 From: Andrea Date: Wed, 10 Mar 2021 08:19:56 +0100 Subject: [PATCH 22/46] remove dead assignments --- .../L1TrackTrigger/src/TTTrack_TrackWord.cc | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc b/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc index 5e7e1bc4469e3..27fd5b30a55b9 100644 --- a/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc +++ b/DataFormats/L1TrackTrigger/src/TTTrack_TrackWord.cc @@ -95,22 +95,16 @@ void TTTrack_TrackWord::setTrackWord(const GlobalVector& Momentum, // bin, convert to integers, and pack - unsigned int seg1, seg2, seg3; - seg1 = 0; - seg2 = 0; - seg3 = 0; + unsigned int seg1, seg2, seg3, seg4; //tanl - itanl = digitize_Signed(rTanl, NTanlBits, 0, valLSBTanl); //z0 iz0 = digitize_Signed(rZ0, NZ0Bits, 0, valLSBZ0); //chi2 has non-linear bins - ichi2XY = 0; - for (unsigned int ibin = 0; ibin < Nchi2; ++ibin) { ichi2XY = ibin; if (theChi2XY < chi2Bins[ibin]) @@ -118,9 +112,7 @@ void TTTrack_TrackWord::setTrackWord(const GlobalVector& Momentum, } //chi2Z has non-linear bins - ichi2Z = 0; - for (unsigned int ibin = 0; ibin < Nchi2; ++ibin) { ichi2Z = ibin; if (theChi2Z < chi2ZBins[ibin]) @@ -138,7 +130,6 @@ void TTTrack_TrackWord::setTrackWord(const GlobalVector& Momentum, //bend chi2 - non-linear bins iBendChi2 = 0; - for (unsigned int ibin = 0; ibin < NBchi2; ++ibin) { iBendChi2 = ibin; if (theBendChi2 < Bchi2Bins[ibin]) @@ -171,11 +162,9 @@ void TTTrack_TrackWord::setTrackWord(const GlobalVector& Momentum, //set bits TrackWord1 = seg1 + seg2 + seg3; - seg1 = 0; - seg2 = 0; - seg3 = 0; //second 32-bit word + seg1 = (iphi << (nWordBits - (NPhiBits + 1))); //20 seg2 = (id0 << (nWordBits - (NPhiBits + ND0Bits + 2))); //7 @@ -185,16 +174,13 @@ void TTTrack_TrackWord::setTrackWord(const GlobalVector& Momentum, //set bits TrackWord2 = seg1 + seg2 + seg3; - seg1 = 0; - seg2 = 0; - seg3 = 0; //third 32-bit word seg1 = (iRinv << (nWordBits - (NCurvBits + 1))); //17 seg2 = (iBendChi2 << (nWordBits - (NCurvBits + NBChi2Bits + 1))); //14 seg3 = (ichi2Z << (nWordBits - (NCurvBits + NBChi2Bits + NChi2Bits + 1))); //10 - unsigned int seg4 = ispare; + seg4 = ispare; TrackWord3 = seg1 + seg2 + seg3 + seg4; } From 0a8736c64f82856bede4fd54c21a73759e5cc548 Mon Sep 17 00:00:00 2001 From: mmusich Date: Tue, 9 Mar 2021 21:07:29 +0100 Subject: [PATCH 23/46] migrate RecoLocalTracker/SubCollectionProducers to esConsumes --- .../interface/PixelClusterSelectorTopBottom.h | 6 +++--- .../interface/StripClusterSelectorTopBottom.h | 5 +++-- .../src/HITrackClusterRemover.cc | 10 +++++----- .../src/HLTTrackClusterRemoverNew.cc | 10 +++++----- .../src/JetCoreClusterSplitter.cc | 19 +++++++++---------- .../src/PixelClusterSelectorTopBottom.cc | 4 +--- .../src/SeedClusterRemover.cc | 10 +++++----- .../src/SeedClusterRemoverPhase2.cc | 10 +++++----- .../src/StripClusterSelectorTopBottom.cc | 4 +--- 9 files changed, 37 insertions(+), 41 deletions(-) diff --git a/RecoLocalTracker/SubCollectionProducers/interface/PixelClusterSelectorTopBottom.h b/RecoLocalTracker/SubCollectionProducers/interface/PixelClusterSelectorTopBottom.h index 09b8921740fd7..4b975a51bc45e 100644 --- a/RecoLocalTracker/SubCollectionProducers/interface/PixelClusterSelectorTopBottom.h +++ b/RecoLocalTracker/SubCollectionProducers/interface/PixelClusterSelectorTopBottom.h @@ -13,8 +13,6 @@ #include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" - #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "DataFormats/SiPixelCluster/interface/SiPixelCluster.h" @@ -28,7 +26,8 @@ class PixelClusterSelectorTopBottom : public edm::global::EDProducer<> { public: explicit PixelClusterSelectorTopBottom(const edm::ParameterSet& cfg) - : token_(consumes(cfg.getParameter("label"))), + : tTrackerGeom_(esConsumes()), + token_(consumes(cfg.getParameter("label"))), y_(cfg.getParameter("y")) { produces(); } @@ -36,6 +35,7 @@ class PixelClusterSelectorTopBottom : public edm::global::EDProducer<> { void produce(edm::StreamID, edm::Event& event, const edm::EventSetup& setup) const override; private: + edm::ESGetToken const tTrackerGeom_; edm::EDGetTokenT token_; double y_; }; diff --git a/RecoLocalTracker/SubCollectionProducers/interface/StripClusterSelectorTopBottom.h b/RecoLocalTracker/SubCollectionProducers/interface/StripClusterSelectorTopBottom.h index b47abf504dfc4..dc50ef3d8ee41 100644 --- a/RecoLocalTracker/SubCollectionProducers/interface/StripClusterSelectorTopBottom.h +++ b/RecoLocalTracker/SubCollectionProducers/interface/StripClusterSelectorTopBottom.h @@ -13,7 +13,6 @@ #include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/Framework/interface/Event.h" #include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" @@ -29,7 +28,8 @@ class StripClusterSelectorTopBottom : public edm::global::EDProducer<> { public: explicit StripClusterSelectorTopBottom(const edm::ParameterSet& cfg) - : token_(consumes>(cfg.getParameter("label"))), + : tTrackerGeom_(esConsumes()), + token_(consumes>(cfg.getParameter("label"))), y_(cfg.getParameter("y")) { produces>(); } @@ -37,6 +37,7 @@ class StripClusterSelectorTopBottom : public edm::global::EDProducer<> { void produce(edm::StreamID, edm::Event& event, const edm::EventSetup& setup) const override; private: + edm::ESGetToken const tTrackerGeom_; edm::EDGetTokenT> token_; double y_; }; diff --git a/RecoLocalTracker/SubCollectionProducers/src/HITrackClusterRemover.cc b/RecoLocalTracker/SubCollectionProducers/src/HITrackClusterRemover.cc index 9b965a27e53f3..76abb063a1d9c 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/HITrackClusterRemover.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/HITrackClusterRemover.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -46,6 +45,7 @@ class HITrackClusterRemover : public edm::stream::EDProducer<> { void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; private: + edm::ESGetToken const tTrackerGeom_; struct ParamBlock { ParamBlock() : isSet_(false), usesCharge_(false) {} ParamBlock(const edm::ParameterSet &iConfig) @@ -143,7 +143,8 @@ void HITrackClusterRemover::readPSet( } HITrackClusterRemover::HITrackClusterRemover(const ParameterSet &iConfig) - : doTracks_(iConfig.exists("trajectories")), + : tTrackerGeom_(esConsumes()), + doTracks_(iConfig.exists("trajectories")), doStrip_(iConfig.existsAs("doStrip") ? iConfig.getParameter("doStrip") : true), doPixel_(iConfig.existsAs("doPixel") ? iConfig.getParameter("doPixel") : true), mergeOld_(iConfig.exists("oldClusterRemovalInfo")), @@ -410,8 +411,7 @@ void HITrackClusterRemover::process(const TrackingRecHit *hit, unsigned char chi void HITrackClusterRemover::produce(Event &iEvent, const EventSetup &iSetup) { ProductID pixelOldProdID, stripOldProdID; - edm::ESHandle tgh; - iSetup.get().get(tgh); + const auto &tgh = &iSetup.getData(tTrackerGeom_); Handle > pixelClusters; if (doPixel_) { @@ -525,7 +525,7 @@ void HITrackClusterRemover::produce(Event &iEvent, const EventSetup &iSetup) { auto hit = *(hb + h); if (!hit->isValid()) continue; - process(hit, chi2sX5[h], tgh.product()); + process(hit, chi2sX5[h], tgh); } } } diff --git a/RecoLocalTracker/SubCollectionProducers/src/HLTTrackClusterRemoverNew.cc b/RecoLocalTracker/SubCollectionProducers/src/HLTTrackClusterRemoverNew.cc index a5f025fb7e833..3d46e5f4660ce 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/HLTTrackClusterRemoverNew.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/HLTTrackClusterRemoverNew.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -43,6 +42,7 @@ class HLTTrackClusterRemoverNew final : public edm::stream::EDProducer<> { void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; private: + edm::ESGetToken const tTrackerGeom_; struct ParamBlock { ParamBlock() : isSet_(false), usesCharge_(false) {} ParamBlock(const edm::ParameterSet &iConfig) @@ -132,7 +132,8 @@ void HLTTrackClusterRemoverNew::readPSet( } HLTTrackClusterRemoverNew::HLTTrackClusterRemoverNew(const ParameterSet &iConfig) - : doTracks_(iConfig.exists("trajectories")), + : tTrackerGeom_(esConsumes()), + doTracks_(iConfig.exists("trajectories")), doStrip_(iConfig.existsAs("doStrip") ? iConfig.getParameter("doStrip") : true), doPixel_(iConfig.existsAs("doPixel") ? iConfig.getParameter("doPixel") : true), mergeOld_(false), @@ -364,8 +365,7 @@ void HLTTrackClusterRemoverNew::process(const TrackingRecHit *hit, float chi2, c void HLTTrackClusterRemoverNew::produce(Event &iEvent, const EventSetup &iSetup) { ProductID pixelOldProdID, stripOldProdID; - edm::ESHandle tgh; - iSetup.get().get(tgh); + const auto &tgh = &iSetup.getData(tTrackerGeom_); edm::Handle > pixelClusters; if (doPixel_) { @@ -411,7 +411,7 @@ void HLTTrackClusterRemoverNew::produce(Event &iEvent, const EventSetup &iSetup) if (!hit->isValid()) continue; // std::cout<<"process hit"<estimate(), tgh.product()); + process(hit, itm->estimate(), tgh); } } diff --git a/RecoLocalTracker/SubCollectionProducers/src/JetCoreClusterSplitter.cc b/RecoLocalTracker/SubCollectionProducers/src/JetCoreClusterSplitter.cc index b6a69cae8037f..258f57e3cdee3 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/JetCoreClusterSplitter.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/JetCoreClusterSplitter.cc @@ -46,8 +46,11 @@ class JetCoreClusterSplitter : public edm::stream::EDProducer<> { std::multimap secondDistDiffScore(const std::vector>& distanceMap); std::multimap secondDistScore(const std::vector>& distanceMap); std::multimap distScore(const std::vector>& distanceMap); + + edm::ESGetToken const tTrackingGeom_; + edm::ESGetToken const tCPE_; + bool verbose; - std::string pixelCPE_; double ptMin_; double deltaR_; double chargeFracMin_; @@ -62,8 +65,9 @@ class JetCoreClusterSplitter : public edm::stream::EDProducer<> { }; JetCoreClusterSplitter::JetCoreClusterSplitter(const edm::ParameterSet& iConfig) - : verbose(iConfig.getParameter("verbose")), - pixelCPE_(iConfig.getParameter("pixelCPE")), + : tTrackingGeom_(esConsumes()), + tCPE_(esConsumes(edm::ESInputTag("", iConfig.getParameter("pixelCPE")))), + verbose(iConfig.getParameter("verbose")), ptMin_(iConfig.getParameter("ptMin")), deltaR_(iConfig.getParameter("deltaRmax")), chargeFracMin_(iConfig.getParameter("chargeFractionMin")), @@ -87,8 +91,7 @@ bool SortPixels(const SiPixelCluster::Pixel& i, const SiPixelCluster::Pixel& j) void JetCoreClusterSplitter::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { using namespace edm; - edm::ESHandle geometry; - iSetup.get().get(geometry); + const auto& geometry = &iSetup.getData(tTrackingGeom_); Handle> inputPixelClusters; iEvent.getByToken(pixelClusters_, inputPixelClusters); @@ -100,11 +103,7 @@ void JetCoreClusterSplitter::produce(edm::Event& iEvent, const edm::EventSetup& Handle> cores; iEvent.getByToken(cores_, cores); - edm::ESHandle pe; - const PixelClusterParameterEstimator* pp; - iSetup.get().get(pixelCPE_, pe); - pp = pe.product(); - + const PixelClusterParameterEstimator* pp = &iSetup.getData(tCPE_); auto output = std::make_unique>(); edmNew::DetSetVector::const_iterator detIt = inputPixelClusters->begin(); diff --git a/RecoLocalTracker/SubCollectionProducers/src/PixelClusterSelectorTopBottom.cc b/RecoLocalTracker/SubCollectionProducers/src/PixelClusterSelectorTopBottom.cc index ddff02e19af6c..feac4b993c8cf 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/PixelClusterSelectorTopBottom.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/PixelClusterSelectorTopBottom.cc @@ -5,9 +5,7 @@ void PixelClusterSelectorTopBottom::produce(edm::StreamID, edm::Event& event, co edm::Handle input; event.getByToken(token_, input); - edm::ESHandle geom; - setup.get().get(geom); - const TrackerGeometry& theTracker(*geom); + const TrackerGeometry& theTracker = setup.getData(tTrackerGeom_); auto output = std::make_unique(); diff --git a/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemover.cc b/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemover.cc index caa006c2012ce..478358b1b4d75 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemover.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemover.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -39,6 +38,7 @@ class SeedClusterRemover : public edm::stream::EDProducer<> { void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; private: + edm::ESGetToken const tTrackerGeom_; struct ParamBlock { ParamBlock() : isSet_(false), usesCharge_(false) {} ParamBlock(const edm::ParameterSet &iConfig) @@ -111,7 +111,8 @@ void SeedClusterRemover::readPSet( } SeedClusterRemover::SeedClusterRemover(const ParameterSet &iConfig) - : doStrip_(iConfig.existsAs("doStrip") ? iConfig.getParameter("doStrip") : true), + : tTrackerGeom_(esConsumes()), + doStrip_(iConfig.existsAs("doStrip") ? iConfig.getParameter("doStrip") : true), doPixel_(iConfig.existsAs("doPixel") ? iConfig.getParameter("doPixel") : true), mergeOld_(iConfig.exists("oldClusterRemovalInfo")) { fill(pblocks_, pblocks_ + NumberOfParamBlocks, ParamBlock()); @@ -235,8 +236,7 @@ void SeedClusterRemover::process(const TrackingRecHit *hit, float chi2, const Tr } void SeedClusterRemover::produce(Event &iEvent, const EventSetup &iSetup) { - edm::ESHandle tgh; - iSetup.get().get("", tgh); //is it correct to use "" ? + const auto &tgh = &iSetup.getData(tTrackerGeom_); Handle > pixelClusters; if (doPixel_) { @@ -283,7 +283,7 @@ void SeedClusterRemover::produce(Event &iEvent, const EventSetup &iSetup) { for (auto const &hit : seed.recHits()) { if (!hit.isValid()) continue; - process(&hit, 0., tgh.product()); + process(&hit, 0., tgh); } } diff --git a/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemoverPhase2.cc b/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemoverPhase2.cc index 24df700d80ed4..aa1bf43ddb213 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemoverPhase2.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/SeedClusterRemoverPhase2.cc @@ -1,7 +1,6 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/stream/EDProducer.h" #include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/InputTag.h" @@ -38,6 +37,7 @@ class SeedClusterRemoverPhase2 : public edm::stream::EDProducer<> { void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override; private: + edm::ESGetToken const tTrackerGeom_; bool doOuterTracker_, doPixel_; bool mergeOld_; typedef edm::ContainerMask > PixelMaskContainer; @@ -61,7 +61,8 @@ using namespace std; using namespace edm; SeedClusterRemoverPhase2::SeedClusterRemoverPhase2(const ParameterSet &iConfig) - : doOuterTracker_(iConfig.existsAs("doOuterTracker") ? iConfig.getParameter("doOuterTracker") : true), + : tTrackerGeom_(esConsumes()), + doOuterTracker_(iConfig.existsAs("doOuterTracker") ? iConfig.getParameter("doOuterTracker") : true), doPixel_(iConfig.existsAs("doPixel") ? iConfig.getParameter("doPixel") : true), mergeOld_(iConfig.exists("oldClusterRemovalInfo")) { produces > >(); @@ -163,8 +164,7 @@ void SeedClusterRemoverPhase2::process(const TrackingRecHit *hit, float chi2, co void SeedClusterRemoverPhase2::produce(Event &iEvent, const EventSetup &iSetup) { ProductID pixelOldProdID, stripOldProdID; - edm::ESHandle tgh; - iSetup.get().get("", tgh); //is it correct to use "" ? + const auto &tgh = &iSetup.getData(tTrackerGeom_); Handle > pixelClusters; if (doPixel_) { @@ -211,7 +211,7 @@ void SeedClusterRemoverPhase2::produce(Event &iEvent, const EventSetup &iSetup) for (auto const &hit : seed.recHits()) { if (!hit.isValid()) continue; - process(&hit, 0., tgh.product()); + process(&hit, 0., tgh); } } diff --git a/RecoLocalTracker/SubCollectionProducers/src/StripClusterSelectorTopBottom.cc b/RecoLocalTracker/SubCollectionProducers/src/StripClusterSelectorTopBottom.cc index ce7eaca7083bd..52e298f8b7093 100644 --- a/RecoLocalTracker/SubCollectionProducers/src/StripClusterSelectorTopBottom.cc +++ b/RecoLocalTracker/SubCollectionProducers/src/StripClusterSelectorTopBottom.cc @@ -5,9 +5,7 @@ void StripClusterSelectorTopBottom::produce(edm::StreamID, edm::Event& event, co edm::Handle> input; event.getByToken(token_, input); - edm::ESHandle geom; - setup.get().get(geom); - const TrackerGeometry& theTracker(*geom); + const TrackerGeometry& theTracker = setup.getData(tTrackerGeom_); auto output = std::make_unique>(); From 6d13b7db0f6e4c0b3dbea3e887a3b15527886a18 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Wed, 10 Mar 2021 19:19:33 +0100 Subject: [PATCH 24/46] move TBB_PREVIEW_RESUMABLE_TASKS macro in tbb tool definition --- FWCore/Concurrency/interface/include_first_syncWait.h | 1 - FWCore/Concurrency/src/SerialTaskQueue.cc | 1 - 2 files changed, 2 deletions(-) diff --git a/FWCore/Concurrency/interface/include_first_syncWait.h b/FWCore/Concurrency/interface/include_first_syncWait.h index a3e4ccbd3d642..6c180e88b62c5 100644 --- a/FWCore/Concurrency/interface/include_first_syncWait.h +++ b/FWCore/Concurrency/interface/include_first_syncWait.h @@ -7,7 +7,6 @@ // // Created by Chris Jones on 2/24/21. // -#define TBB_PREVIEW_RESUMABLE_TASKS 1 #include "FWCore/Concurrency/interface/WaitingTaskHolder.h" #include "tbb/task_group.h" #include "tbb/task.h" diff --git a/FWCore/Concurrency/src/SerialTaskQueue.cc b/FWCore/Concurrency/src/SerialTaskQueue.cc index 660478e3e6388..5c4bef539f1d4 100644 --- a/FWCore/Concurrency/src/SerialTaskQueue.cc +++ b/FWCore/Concurrency/src/SerialTaskQueue.cc @@ -12,7 +12,6 @@ // // system include files -#define TBB_PREVIEW_RESUMABLE_TASKS 1 #include "tbb/task.h" // user include files From 191b2d1d7b83478ecac037ac53b4a118a592a02e Mon Sep 17 00:00:00 2001 From: zeratul87 Date: Wed, 10 Mar 2021 13:20:14 -0600 Subject: [PATCH 25/46] Devirtualize derived classes of PFBlockElement --- DataFormats/ParticleFlowReco/interface/PFBlockElementBrem.h | 2 +- .../ParticleFlowReco/interface/PFBlockElementCluster.h | 2 +- .../ParticleFlowReco/interface/PFBlockElementGsfTrack.h | 6 ++++-- .../ParticleFlowReco/interface/PFBlockElementSuperCluster.h | 2 +- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementBrem.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementBrem.h index 6ecb951a67e1d..20662d22f719c 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementBrem.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlockElementBrem.h @@ -14,7 +14,7 @@ namespace reco { /// \brief Track Element. /// /// this class contains a reference to a PFRecTrack - class PFBlockElementBrem : public PFBlockElement { + class PFBlockElementBrem final : public PFBlockElement { public: PFBlockElementBrem() {} diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h index 168eccc0ceb7f..3e43b7babe8f6 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlockElementCluster.h @@ -13,7 +13,7 @@ namespace reco { /// \brief Cluster Element. /// /// this class contains a reference to a PFCluster - class PFBlockElementCluster : public PFBlockElement { + class PFBlockElementCluster final : public PFBlockElement { public: PFBlockElementCluster() {} diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h index 23b26cc3d5d09..0b95f4fa46ccc 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlockElementGsfTrack.h @@ -15,7 +15,7 @@ namespace reco { /// \brief Track Element. /// /// this class contains a reference to a PFRecTrack - class PFBlockElementGsfTrack : public PFBlockElement { + class PFBlockElementGsfTrack final : public PFBlockElement { public: PFBlockElementGsfTrack() {} @@ -38,7 +38,9 @@ namespace reco { trackType_ = trackType_ ^ (1 << trType); } - bool isSecondary() const override { return trackType(T_FROM_GAMMACONV); } + static constexpr unsigned int kSecondaryMask = 1 << T_FROM_GAMMACONV; + + bool isSecondary() const override { return trackType_ & kSecondaryMask; } /// \return reference to the corresponding PFGsfRecTrack const GsfPFRecTrackRef& GsftrackRefPF() const { return GsftrackRefPF_; } diff --git a/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h b/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h index 9e23fee8ebd07..cea195ac13832 100644 --- a/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h +++ b/DataFormats/ParticleFlowReco/interface/PFBlockElementSuperCluster.h @@ -12,7 +12,7 @@ namespace reco { /// \brief Cluster Element. /// /// this class contains a reference to a PFCluster - class PFBlockElementSuperCluster : public PFBlockElement { + class PFBlockElementSuperCluster final : public PFBlockElement { public: PFBlockElementSuperCluster() {} From 19d3730ad5a951d92a985da73b2ed01eab9e753f Mon Sep 17 00:00:00 2001 From: francescobrivio Date: Wed, 10 Mar 2021 20:40:19 +0100 Subject: [PATCH 26/46] add Ecal supercluster parameters to GTs --- Configuration/AlCa/python/autoCond.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index 6d0758ffcfb73..1858744627cd8 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -2,13 +2,13 @@ ### NEW KEYS ### # GlobalTag for MC production with perfectly aligned and calibrated detector for Run1 - 'run1_design' : '113X_mcRun1_design_v1', + 'run1_design' : '113X_mcRun1_design_v2', # GlobalTag for MC production (pp collisions) with realistic alignment and calibrations for Run1 - 'run1_mc' : '113X_mcRun1_realistic_v1', + 'run1_mc' : '113X_mcRun1_realistic_v2', # GlobalTag for MC production (Heavy Ions collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_hi' : '113X_mcRun1_HeavyIon_v1', + 'run1_mc_hi' : '113X_mcRun1_HeavyIon_v2', # GlobalTag for MC production (p-Pb collisions) with realistic alignment and calibrations for Run1 - 'run1_mc_pa' : '113X_mcRun1_pA_v1', + 'run1_mc_pa' : '113X_mcRun1_pA_v2', # GlobalTag for MC production with pessimistic alignment and calibrations for Run2 'run2_mc_50ns' : '113X_mcRun2_startup_v2', # GlobalTag for MC production (2015 L1 Trigger Stage1) with startup-like alignment and calibrations for Run2, L1 trigger in Stage1 mode @@ -40,14 +40,14 @@ # GlobalTag for Run2 HLT: it points to the online GT 'run2_hlt' : '101X_dataRun2_HLT_frozen_v11', # GlobalTag for Run2 HLT RelVals: customizations to run with fixed L1 Menu - 'run2_hlt_relval' : '112X_dataRun2_HLT_relval_v3', - 'run2_hlt_relval_hi' : '112X_dataRun2_HLT_relval_HI_v2', + 'run2_hlt_relval' : '112X_dataRun2_HLT_relval_v4', + 'run2_hlt_relval_hi' : '112X_dataRun2_HLT_relval_HI_v3', # GlobalTag for Run2 HLT for HI (not 2018 HI): it points to the online GT 'run2_hlt_hi' : '101X_dataRun2_HLTHI_frozen_v11', # GlobalTag for Run3 data relvals (express GT) - 'run3_data_express' : '112X_dataRun3_Express_v2', + 'run3_data_express' : '112X_dataRun3_Express_v3', # GlobalTag for Run3 data relvals - 'run3_data_promptlike' : '112X_dataRun3_Prompt_v2', + 'run3_data_promptlike' : '112X_dataRun3_Prompt_v3', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) 'phase1_2017_design' : '113X_mc2017_design_v4', # GlobalTag for MC production with realistic conditions for Phase1 2017 detector @@ -83,7 +83,7 @@ # GlobalTag for MC production with realistic conditions for Phase1 2024 'phase1_2024_realistic' : '113X_mcRun3_2024_realistic_v5', # GT containing realistic conditions for Phase1 2024 # GlobalTag for MC production with realistic conditions for Phase2 - 'phase2_realistic' : '113X_mcRun4_realistic_v5' + 'phase2_realistic' : '113X_mcRun4_realistic_v6' } aliases = { From f6a607b6d6d3846ad254feecfddd51ac0b85b9b9 Mon Sep 17 00:00:00 2001 From: Gabriel Ramirez Date: Thu, 11 Mar 2021 12:35:08 +0100 Subject: [PATCH 27/46] Change of range and units (to microns) for the residual histograms; adding cut in Y for closest simhit to a cluster selection --- .../interface/TrackerPhase2ValidationUtil.h | 1 + .../plugins/Phase2ITValidateCluster.cc | 37 +++++------ .../plugins/Phase2ITValidateRecHit.cc | 40 ++++++------ .../plugins/Phase2OTValidateCluster.cc | 61 ++++++++++--------- 4 files changed, 73 insertions(+), 66 deletions(-) diff --git a/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h b/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h index a3b492be26e36..d18511f2e9495 100644 --- a/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h +++ b/Validation/SiTrackerPhase2V/interface/TrackerPhase2ValidationUtil.h @@ -6,6 +6,7 @@ namespace phase2tkutil { bool isPrimary(const SimTrack& simTrk, const PSimHit* simHit); + static constexpr float cmtomicron = 1e4; } // namespace phase2tkutil #endif diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateCluster.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateCluster.cc index 9e91d540f8dfa..8c23a4e26c04d 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateCluster.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateCluster.cc @@ -196,15 +196,18 @@ void Phase2ITValidateCluster::fillITHistos(const edm::Event& iEvent, } std::sort(clusterSimTrackIds.begin(), clusterSimTrackIds.end()); const PSimHit* closestSimHit = nullptr; - float minx = 10000.; + float mind = 10000.; // Get the SimHit for (const auto& psimhitCont : simHits) { for (const auto& simhitIt : *psimhitCont) { if (rawid == simhitIt.detUnitId()) { auto it = std::lower_bound(clusterSimTrackIds.begin(), clusterSimTrackIds.end(), simhitIt.trackId()); if (it != clusterSimTrackIds.end() && *it == simhitIt.trackId()) { - if (!closestSimHit || fabs(simhitIt.localPosition().x() - localPosCluster.x()) < minx) { - minx = abs(simhitIt.localPosition().x() - localPosCluster.x()); + float dx = simhitIt.localPosition().x() - localPosCluster.x(); + float dy = simhitIt.localPosition().y() - localPosCluster.y(); + float dist = std::sqrt(dx * dx + dy * dy); + if (!closestSimHit || dist < mind) { + mind = dist; closestSimHit = &simhitIt; } } @@ -219,8 +222,8 @@ void Phase2ITValidateCluster::fillITHistos(const edm::Event& iEvent, if (simTrackIt == simTracks.end()) continue; Local3DPoint localPosSimHit(closestSimHit->localPosition()); - const double deltaX = localPosCluster.x() - localPosSimHit.x(); - const double deltaY = localPosCluster.y() - localPosSimHit.y(); + const double deltaX = phase2tkutil::cmtomicron * (localPosCluster.x() - localPosSimHit.x()); + const double deltaY = phase2tkutil::cmtomicron * (localPosCluster.y() - localPosSimHit.y()); auto layerMEIt = layerMEs_.find(folderkey); if (layerMEIt == layerMEs_.end()) @@ -312,40 +315,40 @@ void Phase2ITValidateCluster::fillDescriptions(edm::ConfigurationDescriptions& d { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Pixel"); - psd0.add("title", "#Delta X;Cluster resolution X coordinate"); + psd0.add("title", "#Delta X;Cluster resolution X coordinate [#mum]"); psd0.add("switch", true); - psd0.add("xmax", 2.5); - psd0.add("xmin", -2.5); + psd0.add("xmax", 250.); + psd0.add("xmin", -250.); psd0.add("NxBins", 100); desc.add("Delta_X_Pixel", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Pixel"); - psd0.add("title", "#Delta Y ;Cluster resolution Y coordinate"); - psd0.add("xmin", -5.0); + psd0.add("title", "#Delta Y ;Cluster resolution Y coordinate [#mum]"); + psd0.add("xmin", -250.); + psd0.add("xmax", 250.); psd0.add("switch", true); - psd0.add("xmax", 5.0); psd0.add("NxBins", 100); desc.add("Delta_Y_Pixel", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Pixel_Primary"); - psd0.add("title", "#Delta X ;cluster resolution X coordinate"); - psd0.add("xmin", -2.5); + psd0.add("title", "#Delta X ;cluster resolution X coordinate [#mum]"); + psd0.add("xmin", -250.); + psd0.add("xmax", 250.); psd0.add("switch", true); - psd0.add("xmax", 2.5); psd0.add("NxBins", 100); desc.add("Delta_X_Pixel_Primary", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Pixel_Primary"); - psd0.add("title", "#Delta Y ;cluster resolution Y coordinate"); - psd0.add("xmin", -5.0); + psd0.add("title", "#Delta Y ;cluster resolution Y coordinate [#mum]"); + psd0.add("xmin", -250.); + psd0.add("xmax", 250.); psd0.add("switch", true); - psd0.add("xmax", 5.0); psd0.add("NxBins", 100); desc.add("Delta_Y_Pixel_Primary", psd0); } diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc index 56b1c41aaed77..c0471ec05cb65 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2ITValidateRecHit.cc @@ -194,8 +194,8 @@ void Phase2ITValidateRecHit::fillITHistos(const edm::Event& iEvent, isPrimary = phase2tkutil::isPrimary(simTrackIt->second, simhitClosest); Local3DPoint simlp(simhitClosest->localPosition()); const LocalError& lperr = rechit.localPositionError(); - double dx = lp.x() - simlp.x(); - double dy = lp.y() - simlp.y(); + double dx = phase2tkutil::cmtomicron * (lp.x() - simlp.x()); + double dy = phase2tkutil::cmtomicron * (lp.y() - simlp.y()); double pullx = 999.; double pully = 999.; if (lperr.xx()) @@ -310,20 +310,20 @@ void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& de { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X"); - psd0.add("title", "Delta_X;RecHit resolution X coordinate"); - psd0.add("xmin", -0.1); + psd0.add("title", "Delta_X;RecHit resolution X coordinate [#mum]"); psd0.add("switch", true); - psd0.add("xmax", 0.1); + psd0.add("xmin", -100.0); + psd0.add("xmax", 100.0); psd0.add("NxBins", 100); desc.add("DeltaX", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y"); - psd0.add("title", "Delta_Y;RecHit resolution Y coordinate;"); - psd0.add("xmin", -0.1); + psd0.add("title", "Delta_Y;RecHit resolution Y coordinate [#mum];"); psd0.add("switch", true); - psd0.add("xmax", 0.1); + psd0.add("xmin", -100.0); + psd0.add("xmax", 100.0); psd0.add("NxBins", 100); desc.add("DeltaY", psd0); } @@ -350,25 +350,25 @@ void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& de { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_vs_Eta"); - psd0.add("title", "Delta_X_vs_Eta;#eta;#Delta x"); - psd0.add("ymax", 0.02); + psd0.add("title", "Delta_X_vs_Eta;#eta;#Delta x [#mum]"); + psd0.add("ymin", -100.0); + psd0.add("ymax", 100.0); psd0.add("NxBins", 82); psd0.add("switch", true); psd0.add("xmax", 4.1); psd0.add("xmin", -4.1); - psd0.add("ymin", -0.02); desc.add("DeltaX_eta", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_vs_Eta"); - psd0.add("title", "Delta_Y_vs_Eta;#eta;#Delta y"); - psd0.add("ymax", 0.02); + psd0.add("title", "Delta_Y_vs_Eta;#eta;#Delta y [#mum]"); + psd0.add("ymin", -100.0); + psd0.add("ymax", 100.0); psd0.add("NxBins", 82); psd0.add("switch", true); psd0.add("xmax", 4.1); psd0.add("xmin", -4.1); - psd0.add("ymin", -0.02); desc.add("DeltaY_eta", psd0); } { @@ -409,20 +409,20 @@ void Phase2ITValidateRecHit::fillDescriptions(edm::ConfigurationDescriptions& de { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_SimHitPrimary"); - psd0.add("title", "Delta_X_SimHitPrimary;#delta x;"); - psd0.add("xmin", -0.2); + psd0.add("title", "Delta_X_SimHitPrimary;#delta x [#mum];"); + psd0.add("xmin", -100.0); psd0.add("switch", true); - psd0.add("xmax", 0.2); + psd0.add("xmax", 100.0); psd0.add("NxBins", 100); desc.add("DeltaX_primary", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_SimHitPrimary"); - psd0.add("title", "Delta_Y_SimHitPrimary;#Delta y;"); - psd0.add("xmin", -0.2); + psd0.add("title", "Delta_Y_SimHitPrimary;#Delta y [#mum];"); + psd0.add("xmin", -100.0); psd0.add("switch", true); - psd0.add("xmax", 0.2); + psd0.add("xmax", 100.0); psd0.add("NxBins", 100); desc.add("DeltaY_primary", psd0); } diff --git a/Validation/SiTrackerPhase2V/plugins/Phase2OTValidateCluster.cc b/Validation/SiTrackerPhase2V/plugins/Phase2OTValidateCluster.cc index b624874906b2b..a9c45e54436af 100644 --- a/Validation/SiTrackerPhase2V/plugins/Phase2OTValidateCluster.cc +++ b/Validation/SiTrackerPhase2V/plugins/Phase2OTValidateCluster.cc @@ -203,15 +203,18 @@ void Phase2OTValidateCluster::fillOTHistos(const edm::Event& iEvent, } std::sort(clusterSimTrackIds.begin(), clusterSimTrackIds.end()); const PSimHit* closestSimHit = nullptr; - float minx = 10000.; + float mind = 1e4; // Get the SimHit for (const auto& psimhitCont : simHits) { for (const auto& simhitIt : *psimhitCont) { if (rawid == simhitIt.detUnitId()) { auto it = std::lower_bound(clusterSimTrackIds.begin(), clusterSimTrackIds.end(), simhitIt.trackId()); if (it != clusterSimTrackIds.end() && *it == simhitIt.trackId()) { - if (!closestSimHit || fabs(simhitIt.localPosition().x() - localPosCluster.x()) < minx) { - minx = abs(simhitIt.localPosition().x() - localPosCluster.x()); + float dx = simhitIt.localPosition().x() - localPosCluster.x(); + float dy = simhitIt.localPosition().y() - localPosCluster.y(); + float dist = std::sqrt(dx * dx + dy * dy); + if (!closestSimHit || dist < mind) { + mind = dist; closestSimHit = &simhitIt; } } @@ -236,19 +239,19 @@ void Phase2OTValidateCluster::fillOTHistos(const edm::Event& iEvent, ClusterMEs& local_mes = layerMEit->second; if (mType == TrackerGeometry::ModuleType::Ph2PSP) { - local_mes.deltaX_P->Fill(deltaX); - local_mes.deltaY_P->Fill(deltaY); + local_mes.deltaX_P->Fill(phase2tkutil::cmtomicron * deltaX); + local_mes.deltaY_P->Fill(phase2tkutil::cmtomicron * deltaY); } else if (mType == TrackerGeometry::ModuleType::Ph2PSS || mType == TrackerGeometry::ModuleType::Ph2SS) { - local_mes.deltaX_S->Fill(deltaX); + local_mes.deltaX_S->Fill(phase2tkutil::cmtomicron * deltaX); local_mes.deltaY_S->Fill(deltaY); } // Primary particles only if (phase2tkutil::isPrimary(simTrackIt->second, closestSimHit)) { if (mType == TrackerGeometry::ModuleType::Ph2PSP) { - local_mes.deltaX_P_primary->Fill(deltaX); - local_mes.deltaY_P_primary->Fill(deltaY); + local_mes.deltaX_P_primary->Fill(phase2tkutil::cmtomicron * deltaX); + local_mes.deltaY_P_primary->Fill(phase2tkutil::cmtomicron * deltaY); } else if (mType == TrackerGeometry::ModuleType::Ph2PSS || mType == TrackerGeometry::ModuleType::Ph2SS) { - local_mes.deltaX_S_primary->Fill(deltaX); + local_mes.deltaX_S_primary->Fill(phase2tkutil::cmtomicron * deltaX); local_mes.deltaY_S_primary->Fill(deltaY); } } @@ -351,40 +354,40 @@ void Phase2OTValidateCluster::fillDescriptions(edm::ConfigurationDescriptions& d { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Pixel"); - psd0.add("title", "#Delta X " + mptag + ";Cluster resolution X coordinate"); + psd0.add("title", "#Delta X " + mptag + ";Cluster resolution X coordinate [#mum]"); psd0.add("switch", true); - psd0.add("xmax", 2.0); - psd0.add("xmin", -2.0); + psd0.add("xmax", 250); + psd0.add("xmin", -250); psd0.add("NxBins", 100); desc.add("Delta_X_Pixel", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Pixel"); - psd0.add("title", "#Delta Y " + mptag + ";Cluster resolution Y coordinate"); - psd0.add("xmin", -5.0); + psd0.add("title", "#Delta Y " + mptag + ";Cluster resolution Y coordinate [#mum]"); psd0.add("switch", true); - psd0.add("xmax", 5.0); + psd0.add("xmin", -1500); + psd0.add("xmax", 1500); psd0.add("NxBins", 100); desc.add("Delta_Y_Pixel", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Pixel_Primary"); - psd0.add("title", "#Delta X " + mptag + ";cluster resolution X coordinate"); - psd0.add("xmin", -2.0); + psd0.add("title", "#Delta X " + mptag + ";cluster resolution X coordinate [#mum]"); psd0.add("switch", true); - psd0.add("xmax", 2.0); + psd0.add("xmin", -250); + psd0.add("xmax", 250); psd0.add("NxBins", 100); desc.add("Delta_X_Pixel_Primary", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Pixel_Primary"); - psd0.add("title", "#Delta Y " + mptag + ";cluster resolution Y coordinate"); - psd0.add("xmin", -5.0); + psd0.add("title", "#Delta Y " + mptag + ";cluster resolution Y coordinate [#mum]"); psd0.add("switch", true); - psd0.add("xmax", 5.0); + psd0.add("xmin", -500); + psd0.add("xmax", 500); psd0.add("NxBins", 100); desc.add("Delta_Y_Pixel_Primary", psd0); } @@ -393,17 +396,17 @@ void Phase2OTValidateCluster::fillDescriptions(edm::ConfigurationDescriptions& d { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Strip"); - psd0.add("title", "#Delta X " + striptag + ";Cluster resolution X coordinate"); - psd0.add("xmin", -2.0); + psd0.add("title", "#Delta X " + striptag + ";Cluster resolution X coordinate [#mum]"); psd0.add("switch", true); - psd0.add("xmax", 2.0); + psd0.add("xmin", -250); + psd0.add("xmax", 250); psd0.add("NxBins", 100); desc.add("Delta_X_Strip", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Strip"); - psd0.add("title", "#Delta Y " + striptag + ";Cluster resolution Y coordinate"); + psd0.add("title", "#Delta Y " + striptag + ";Cluster resolution Y coordinate [cm]"); psd0.add("xmin", -5.0); psd0.add("switch", true); psd0.add("xmax", 5.0); @@ -413,17 +416,17 @@ void Phase2OTValidateCluster::fillDescriptions(edm::ConfigurationDescriptions& d { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_X_Strip_Primary"); - psd0.add("title", "#Delta X " + striptag + ";Cluster resolution X coordinate"); - psd0.add("xmin", -2.0); + psd0.add("title", "#Delta X " + striptag + ";Cluster resolution X coordinate [#mum]"); psd0.add("switch", true); - psd0.add("xmax", 2.0); + psd0.add("xmin", -250); + psd0.add("xmax", 250); psd0.add("NxBins", 100); desc.add("Delta_X_Strip_Primary", psd0); } { edm::ParameterSetDescription psd0; psd0.add("name", "Delta_Y_Strip_Primary"); - psd0.add("title", "#Delta Y " + striptag + ";Cluster resolution Y coordinate"); + psd0.add("title", "#Delta Y " + striptag + ";Cluster resolution Y coordinate [cm]"); psd0.add("xmin", -5.0); psd0.add("switch", true); psd0.add("xmax", 5.0); From e32beb44fe0ebe470d0ca25e7f9508351be90022 Mon Sep 17 00:00:00 2001 From: Gabriel Ramirez Date: Thu, 11 Mar 2021 12:50:56 +0100 Subject: [PATCH 28/46] Correcting axis titles form micro to #mum --- DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc index 33da43b9c9f35..655b96dd3d6c0 100644 --- a/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc +++ b/DQM/SiTrackerPhase2/plugins/Phase2ITMonitorRecHit.cc @@ -419,7 +419,7 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des { edm::ParameterSetDescription psd0; psd0.add("name", "RecHit_X_error_Vs_eta"); - psd0.add("title", "RecHit_X_error_Vs_eta;#eta;x error [microns]"); + psd0.add("title", "RecHit_X_error_Vs_eta;#eta;x error [#mum]"); psd0.add("switch", true); psd0.add("NxBins", 82); psd0.add("xmax", 4.1); @@ -431,7 +431,7 @@ void Phase2ITMonitorRecHit::fillDescriptions(edm::ConfigurationDescriptions& des { edm::ParameterSetDescription psd0; psd0.add("name", "RecHit_Y_error_Vs_eta"); - psd0.add("title", "RecHit_Y_error_Vs_eta;#eta;y error [microns]"); + psd0.add("title", "RecHit_Y_error_Vs_eta;#eta;y error [#mum]"); psd0.add("switch", true); psd0.add("NxBins", 82); psd0.add("xmax", 4.1); From ca1fd48995d452351282090c724620bf215c4b93 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 11 Mar 2021 15:06:57 +0100 Subject: [PATCH 29/46] add missing buildfile dependencies --- HeterogeneousCore/CUDACore/BuildFile.xml | 3 +++ HeterogeneousCore/CUDAServices/BuildFile.xml | 1 + HeterogeneousCore/CUDATest/BuildFile.xml | 1 + HeterogeneousCore/SonicTriton/BuildFile.xml | 6 ++++-- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/HeterogeneousCore/CUDACore/BuildFile.xml b/HeterogeneousCore/CUDACore/BuildFile.xml index a62395dc96d0c..42f7db8fc72d6 100644 --- a/HeterogeneousCore/CUDACore/BuildFile.xml +++ b/HeterogeneousCore/CUDACore/BuildFile.xml @@ -1,10 +1,13 @@ + + + diff --git a/HeterogeneousCore/CUDAServices/BuildFile.xml b/HeterogeneousCore/CUDAServices/BuildFile.xml index 3c4c6a843fba8..5fcaf5e5527b0 100644 --- a/HeterogeneousCore/CUDAServices/BuildFile.xml +++ b/HeterogeneousCore/CUDAServices/BuildFile.xml @@ -2,6 +2,7 @@ + diff --git a/HeterogeneousCore/CUDATest/BuildFile.xml b/HeterogeneousCore/CUDATest/BuildFile.xml index e50f088dd19fc..3d370b4248fa4 100644 --- a/HeterogeneousCore/CUDATest/BuildFile.xml +++ b/HeterogeneousCore/CUDATest/BuildFile.xml @@ -1,5 +1,6 @@ + diff --git a/HeterogeneousCore/SonicTriton/BuildFile.xml b/HeterogeneousCore/SonicTriton/BuildFile.xml index b574f395f4d12..8efadafbe2869 100644 --- a/HeterogeneousCore/SonicTriton/BuildFile.xml +++ b/HeterogeneousCore/SonicTriton/BuildFile.xml @@ -1,6 +1,8 @@ - - + + + + From c7c54cbeb3bf28f274c76611263c5858bede7ff6 Mon Sep 17 00:00:00 2001 From: Christopher Jones Date: Thu, 11 Mar 2021 15:20:33 -0600 Subject: [PATCH 30/46] Use tbb::task_arena to keep SecondaryEventProvider on same thread Calls to syncWait can cause the callstack to migrate to another thread unless task_arena::execute is used. --- Mixing/Base/src/SecondaryEventProvider.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Mixing/Base/src/SecondaryEventProvider.cc b/Mixing/Base/src/SecondaryEventProvider.cc index 272bf9dc0b136..a220c1065f0ee 100644 --- a/Mixing/Base/src/SecondaryEventProvider.cc +++ b/Mixing/Base/src/SecondaryEventProvider.cc @@ -6,6 +6,7 @@ #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "FWCore/Utilities/interface/StreamID.h" #include "DataFormats/Provenance/interface/ProductRegistry.h" +#include "tbb/task_arena.h" namespace { template @@ -21,8 +22,13 @@ namespace { return; auto token = edm::ServiceRegistry::instance().presentToken(); - std::exception_ptr exceptPtr = edm::syncWait([&](edm::WaitingTaskHolder&& iHolder) { - manager.processOneOccurrenceAsync(std::move(iHolder), info, token, streamID, topContext, context); + //we need the arena to guarantee that the syncWait will return to this thread + // and not cause this callstack to possibly be moved to a new thread + tbb::task_arena localArena{tbb::this_task_arena::max_concurrency()}; + std::exception_ptr exceptPtr = localArena.execute([&]() { + return edm::syncWait([&](edm::WaitingTaskHolder&& iHolder) { + manager.processOneOccurrenceAsync(std::move(iHolder), info, token, streamID, topContext, context); + }); }); if (exceptPtr) { From 0ba92e24533b493e561c7f20d33a3d204d4a7127 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 12 Mar 2021 15:52:59 +0100 Subject: [PATCH 31/46] Update the debug printing for EB geometry algorithm --- .../plugins/DDEcalBarrelNewAlgo.cc | 3 ++- .../plugins/dd4hep/DDEcalBarrelNewAlgo.cc | 21 +++++-------------- 2 files changed, 7 insertions(+), 17 deletions(-) diff --git a/Geometry/EcalCommonData/plugins/DDEcalBarrelNewAlgo.cc b/Geometry/EcalCommonData/plugins/DDEcalBarrelNewAlgo.cc index 856896a356a0f..5ca91813c990b 100644 --- a/Geometry/EcalCommonData/plugins/DDEcalBarrelNewAlgo.cc +++ b/Geometry/EcalCommonData/plugins/DDEcalBarrelNewAlgo.cc @@ -1924,8 +1924,9 @@ void DDEcalBarrelNewAlgo::execute(DDCompactView& cpv) { : myrot(ilyPipeLog[type].name().name() + "_rot" + std::to_string(copyNum[type]), Rota(Vec3(xx, yy, 0), 90 * deg)))); #ifdef EDM_ML_DEBUG + std::string rrr = (9 > type) ? " with no rotation" : " with rotation"; edm::LogVerbatim("EBGeomX") << ilyPipeLog[type].name() << ":" << copyNum[type] << " positioned in " - << xilyLog.name() << " at" << DDTranslation(xx, yy, zz) << " with rotation"; + << xilyLog.name() << " at" << DDTranslation(xx, yy, zz) << rrr; #endif } } diff --git a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgo.cc b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgo.cc index e0bba448551e5..ffc05c594f0af 100644 --- a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgo.cc +++ b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgo.cc @@ -907,7 +907,6 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext // Barrel parent volume---------------------------------------------------------- Solid barSolid = Polycone(bar.name, bar.phiLo, (bar.phiHi - bar.phiLo), bar.vecRMin, bar.vecRMax, bar.vecZPts); #ifdef EDM_ML_DEBUG - ROOT::Math::XYZVector vv; edm::LogVerbatim("EBGeom") << bar.name << " PolyCone from " << convertRadToDeg(bar.phiLo) << " to " << convertRadToDeg(bar.phiHi) << " with " << bar.vecZPts.size() << " points"; for (unsigned int k = 0; k < bar.vecZPts.size(); ++k) @@ -986,19 +985,13 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext alltrot1 = alltrot; temp1 = SubtractionSolid(spm.name + "_T1", ddspm, spmCutBox, alltrot); #ifdef EDM_ML_DEBUG - alltrot.GetTranslation(vv); - edm::LogVerbatim("EBGeom") << (spm.name + "_T1") << " Subtraction " << ddspm.name() << ":" << spmCutBox.name() - << " at (" << cms::convert2mm(vv.x()) << "," << cms::convert2mm(vv.y()) << "," - << cms::convert2mm(vv.z()) << ")"; + edm::LogVerbatim("EBGeom") << (spm.name + "_T1") << " Subtraction " << ddspm.name() << ":" << spmCutBox.name() << " at (" << cms::convert2mm(alltrot.Translation().Vect().x()) << "," << cms::convert2mm(alltrot.Translation().Vect().y()) << "," << cms::convert2mm(alltrot.Translation().Vect().z()) << ")"; #endif } else { alltrot2 = alltrot; temp2 = SubtractionSolid(spm.name, temp1, spmCutBox, alltrot); #ifdef EDM_ML_DEBUG - alltrot.GetTranslation(vv); - edm::LogVerbatim("EBGeom") << spm.name << " Subtraction " << temp1.name() << ":" << spmCutBox.name() << " at (" - << cms::convert2mm(vv.x()) << "," << cms::convert2mm(vv.y()) << "," - << cms::convert2mm(vv.z()) << ")"; + edm::LogVerbatim("EBGeom") << spm.name << " Subtraction " << temp1.name() << ":" << spmCutBox.name() << " at (" << cms::convert2mm(alltrot.Translation().Vect().x()) << "," << cms::convert2mm(alltrot.Translation().Vect().y()) << "," << cms::convert2mm(alltrot.Translation().Vect().z()) << ")"; #endif } const Tl3D trSide(tvec[0], @@ -1018,17 +1011,13 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext if (0 != spm.cutShow) { spmLog.placeVolume(spmCutLog, 1, alltrot1); #ifdef EDM_ML_DEBUG - alltrot1.GetTranslation(vv); edm::LogVerbatim("EBGeomX") << spmCutLog.name() << ":1 positioned in " << spmLog.name() << " at (" - << cms::convert2mm(vv.x()) << "," << cms::convert2mm(vv.y()) << "," - << cms::convert2mm(vv.z()) << ") with rotation"; + << cms::convert2mm(alltrot1.Translation().Vect().x()) << "," << cms::convert2mm(alltrot1.Translation().Vect().y()) << "," + << cms::convert2mm(alltrot1.Translation().Vect().z()) << ") with rotation"; #endif spmLog.placeVolume(spmCutLog, 1, alltrot2); #ifdef EDM_ML_DEBUG - alltrot2.GetTranslation(vv); - edm::LogVerbatim("EBGeomX") << spmCutLog.name() << ":1 positioned in " << spmLog.name() << " at (" - << cms::convert2mm(vv.x()) << "," << cms::convert2mm(vv.y()) << "," - << cms::convert2mm(vv.z()) << ") with rotation"; + edm::LogVerbatim("EBGeomX") << spmCutLog.name() << ":1 positioned in " << spmLog.name() << " at (" << cms::convert2mm(alltrot2.Translation().Vect().x()) << "," << cms::convert2mm(alltrot2.Translation().Vect().y()) << "," << cms::convert2mm(alltrot2.Translation().Vect().z()) << ") with rotation"; #endif } spmLog.placeVolume(sideLog, 1, Transform3D(ns.rotation(spm.sideName + std::to_string(1)), sideddtra1)); From 7be372c11bae18c22cbd405d50db5114ef6215aa Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 12 Mar 2021 16:07:15 +0100 Subject: [PATCH 32/46] Code check --- .../plugins/DDEcalBarrelNewAlgo.cc | 2 +- .../plugins/dd4hep/DDEcalBarrelNewAlgo.cc | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Geometry/EcalCommonData/plugins/DDEcalBarrelNewAlgo.cc b/Geometry/EcalCommonData/plugins/DDEcalBarrelNewAlgo.cc index 5ca91813c990b..ea02da9eddf0d 100644 --- a/Geometry/EcalCommonData/plugins/DDEcalBarrelNewAlgo.cc +++ b/Geometry/EcalCommonData/plugins/DDEcalBarrelNewAlgo.cc @@ -1924,7 +1924,7 @@ void DDEcalBarrelNewAlgo::execute(DDCompactView& cpv) { : myrot(ilyPipeLog[type].name().name() + "_rot" + std::to_string(copyNum[type]), Rota(Vec3(xx, yy, 0), 90 * deg)))); #ifdef EDM_ML_DEBUG - std::string rrr = (9 > type) ? " with no rotation" : " with rotation"; + std::string rrr = (9 > type) ? " with no rotation" : " with rotation"; edm::LogVerbatim("EBGeomX") << ilyPipeLog[type].name() << ":" << copyNum[type] << " positioned in " << xilyLog.name() << " at" << DDTranslation(xx, yy, zz) << rrr; #endif diff --git a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgo.cc b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgo.cc index ffc05c594f0af..1d946e76157bd 100644 --- a/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgo.cc +++ b/Geometry/EcalCommonData/plugins/dd4hep/DDEcalBarrelNewAlgo.cc @@ -985,13 +985,19 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext alltrot1 = alltrot; temp1 = SubtractionSolid(spm.name + "_T1", ddspm, spmCutBox, alltrot); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("EBGeom") << (spm.name + "_T1") << " Subtraction " << ddspm.name() << ":" << spmCutBox.name() << " at (" << cms::convert2mm(alltrot.Translation().Vect().x()) << "," << cms::convert2mm(alltrot.Translation().Vect().y()) << "," << cms::convert2mm(alltrot.Translation().Vect().z()) << ")"; + edm::LogVerbatim("EBGeom") << (spm.name + "_T1") << " Subtraction " << ddspm.name() << ":" << spmCutBox.name() + << " at (" << cms::convert2mm(alltrot.Translation().Vect().x()) << "," + << cms::convert2mm(alltrot.Translation().Vect().y()) << "," + << cms::convert2mm(alltrot.Translation().Vect().z()) << ")"; #endif } else { alltrot2 = alltrot; temp2 = SubtractionSolid(spm.name, temp1, spmCutBox, alltrot); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("EBGeom") << spm.name << " Subtraction " << temp1.name() << ":" << spmCutBox.name() << " at (" << cms::convert2mm(alltrot.Translation().Vect().x()) << "," << cms::convert2mm(alltrot.Translation().Vect().y()) << "," << cms::convert2mm(alltrot.Translation().Vect().z()) << ")"; + edm::LogVerbatim("EBGeom") << spm.name << " Subtraction " << temp1.name() << ":" << spmCutBox.name() << " at (" + << cms::convert2mm(alltrot.Translation().Vect().x()) << "," + << cms::convert2mm(alltrot.Translation().Vect().y()) << "," + << cms::convert2mm(alltrot.Translation().Vect().z()) << ")"; #endif } const Tl3D trSide(tvec[0], @@ -1012,12 +1018,16 @@ static long algorithm(dd4hep::Detector& /* description */, cms::DDParsingContext spmLog.placeVolume(spmCutLog, 1, alltrot1); #ifdef EDM_ML_DEBUG edm::LogVerbatim("EBGeomX") << spmCutLog.name() << ":1 positioned in " << spmLog.name() << " at (" - << cms::convert2mm(alltrot1.Translation().Vect().x()) << "," << cms::convert2mm(alltrot1.Translation().Vect().y()) << "," + << cms::convert2mm(alltrot1.Translation().Vect().x()) << "," + << cms::convert2mm(alltrot1.Translation().Vect().y()) << "," << cms::convert2mm(alltrot1.Translation().Vect().z()) << ") with rotation"; #endif spmLog.placeVolume(spmCutLog, 1, alltrot2); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("EBGeomX") << spmCutLog.name() << ":1 positioned in " << spmLog.name() << " at (" << cms::convert2mm(alltrot2.Translation().Vect().x()) << "," << cms::convert2mm(alltrot2.Translation().Vect().y()) << "," << cms::convert2mm(alltrot2.Translation().Vect().z()) << ") with rotation"; + edm::LogVerbatim("EBGeomX") << spmCutLog.name() << ":1 positioned in " << spmLog.name() << " at (" + << cms::convert2mm(alltrot2.Translation().Vect().x()) << "," + << cms::convert2mm(alltrot2.Translation().Vect().y()) << "," + << cms::convert2mm(alltrot2.Translation().Vect().z()) << ") with rotation"; #endif } spmLog.placeVolume(sideLog, 1, Transform3D(ns.rotation(spm.sideName + std::to_string(1)), sideddtra1)); From f156f9964af44f59d6f68663ecdf1ed7e82f6703 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 12 Mar 2021 17:24:46 +0100 Subject: [PATCH 33/46] Correct the scripts for running tests with ddd/dd4hep --- .../test/python/runEcalCellDumpDD4Hep_cfg.py | 27 +++---------------- .../test/python/runEcalCellDumpDDD_cfg.py | 13 +++------ 2 files changed, 6 insertions(+), 34 deletions(-) diff --git a/Geometry/EcalAlgo/test/python/runEcalCellDumpDD4Hep_cfg.py b/Geometry/EcalAlgo/test/python/runEcalCellDumpDD4Hep_cfg.py index 2e81e7f7feb8b..492728b96989f 100644 --- a/Geometry/EcalAlgo/test/python/runEcalCellDumpDD4Hep_cfg.py +++ b/Geometry/EcalAlgo/test/python/runEcalCellDumpDD4Hep_cfg.py @@ -1,37 +1,16 @@ import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep -process = cms.Process("EcalGeometryTest") +process = cms.Process("EcalGeometryTest",Run3_dd4hep) -process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cff") -process.load("Geometry.HcalCommonData.hcalDDDRecConstants_cfi") -process.load("Geometry.EcalCommonData.ecalSimulationParameters_cff") -process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi"); -process.load("Geometry.CaloEventSetup.CaloTopology_cfi") -process.load("Geometry.CaloEventSetup.CaloGeometry_cff") -process.load("Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi") -process.load("Geometry.EcalMapping.EcalMapping_cfi") -process.load("Geometry.EcalMapping.EcalMappingRecord_cfi") - -process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", - confGeomXMLFiles = cms.FileInPath('Geometry/EcalCommonData/data/dd4hep/cms-ecal-geometry.xml'), - appendToDataLabel = cms.string('') -) - -process.DDCompactViewESProducer = cms.ESProducer("DDCompactViewESProducer", - appendToDataLabel = cms.string('') -) +process.load("Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff") process.source = cms.Source("EmptySource") process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) ) -process.hcalParameters.fromDD4Hep = cms.bool(True) -process.caloSimulationParameters.fromDD4Hep = cms.bool(True) process.CaloGeometryBuilder.SelectedCalos = ['EcalBarrel', 'EcalEndcap', 'EcalPreshower'] -process.ecalSimulationParametersEB.fromDD4Hep = cms.bool(True) -process.ecalSimulationParametersEE.fromDD4Hep = cms.bool(True) -process.ecalSimulationParametersES.fromDD4Hep = cms.bool(True) process.demo1 = cms.EDAnalyzer("EcalBarrelCellParameterDump") process.demo2 = cms.EDAnalyzer("EcalEndcapCellParameterDump") diff --git a/Geometry/EcalAlgo/test/python/runEcalCellDumpDDD_cfg.py b/Geometry/EcalAlgo/test/python/runEcalCellDumpDDD_cfg.py index 54c1ef46b6145..894581eb2c378 100644 --- a/Geometry/EcalAlgo/test/python/runEcalCellDumpDDD_cfg.py +++ b/Geometry/EcalAlgo/test/python/runEcalCellDumpDDD_cfg.py @@ -1,16 +1,9 @@ import FWCore.ParameterSet.Config as cms +from Configuration.Eras.Era_Run3_cff import Run3 -process = cms.Process("EcalGeometryTest") +process = cms.Process("EcalGeometryTest",Run3) -process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cff") -process.load("Geometry.HcalCommonData.hcalDDDRecConstants_cfi") -process.load("Geometry.EcalCommonData.ecalSimulationParameters_cff") -process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi"); -process.load("Geometry.CaloEventSetup.CaloTopology_cfi") -process.load("Geometry.CaloEventSetup.CaloGeometry_cff") -process.load("Geometry.CaloEventSetup.EcalTrigTowerConstituents_cfi") -process.load("Geometry.EcalMapping.EcalMapping_cfi") -process.load("Geometry.EcalMapping.EcalMappingRecord_cfi") +process.load("Configuration.Geometry.GeometryExtended2021Reco_cff") process.source = cms.Source("EmptySource") process.maxEvents = cms.untracked.PSet( From 1a6d5e67f7a4c66e0251b6fcc9e8ed82df7cf507 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Fri, 12 Mar 2021 19:03:24 +0100 Subject: [PATCH 34/46] Fix production cuts with DD4hep. Reflected volumes need special treatment here as well. --- SimG4Core/Geometry/src/DDG4ProductionCuts.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/SimG4Core/Geometry/src/DDG4ProductionCuts.cc b/SimG4Core/Geometry/src/DDG4ProductionCuts.cc index 10aa530634e8e..95f16dce624a4 100644 --- a/SimG4Core/Geometry/src/DDG4ProductionCuts.cc +++ b/SimG4Core/Geometry/src/DDG4ProductionCuts.cc @@ -140,9 +140,24 @@ void DDG4ProductionCuts::dd4hepInitialize() { for (auto const& it : dd4hepVec_) { auto regName = it.second->strValue(keywordRegion_); G4Region* region = G4RegionStore::GetInstance()->FindOrCreateRegion({regName.data(), regName.size()}); + region->AddRootLogicalVolume(it.first); - edm::LogVerbatim("Geometry") << it.first->GetName() << ": " << it.second->strValue(keywordRegion_); + edm::LogVerbatim("Geometry") << it.first->GetName() << ": " << regName; edm::LogVerbatim("Geometry") << " MakeRegions: added " << it.first->GetName() << " to region " << region->GetName(); + + // Also treat reflected volumes + const G4String& nonReflectedG4Name = it.first->GetName(); + const G4String& reflectedG4Name = nonReflectedG4Name + "_refl"; + const G4LogicalVolumeStore* const allG4LogicalVolumes = G4LogicalVolumeStore::GetInstance(); + const auto reflectedG4LogicalVolumeIt = std::find_if(allG4LogicalVolumes->begin(), allG4LogicalVolumes->end(), [&](const G4LogicalVolume* const aG4LogicalVolume) { + return (aG4LogicalVolume->GetName() == reflectedG4Name); + }); + // If G4 Logical volume has a reflected volume, add it to the region as well. + if (reflectedG4LogicalVolumeIt != allG4LogicalVolumes->end()) { + region->AddRootLogicalVolume(*reflectedG4LogicalVolumeIt); + edm::LogVerbatim("Geometry") << " MakeRegions: added " << (*reflectedG4LogicalVolumeIt)->GetName() << " to region " << region->GetName(); + } + edm::LogVerbatim("Geometry").log([&](auto& log) { for (auto const& sit : it.second->spars) { log << sit.first << " = " << sit.second[0] << "\n"; From c8a41c1870e92fbe7be8b099da6b5d2a9db92154 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Fri, 12 Mar 2021 19:07:40 +0100 Subject: [PATCH 35/46] Header --- SimG4Core/Geometry/src/DDG4ProductionCuts.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/SimG4Core/Geometry/src/DDG4ProductionCuts.cc b/SimG4Core/Geometry/src/DDG4ProductionCuts.cc index 95f16dce624a4..ecc9dcb41cd43 100644 --- a/SimG4Core/Geometry/src/DDG4ProductionCuts.cc +++ b/SimG4Core/Geometry/src/DDG4ProductionCuts.cc @@ -11,6 +11,7 @@ #include "G4RegionStore.hh" #include "G4Region.hh" #include "G4LogicalVolume.hh" +#include "G4LogicalVolumeStore.hh" #include From 0544d910d4cd36df8848227440b5d7fc3a280f19 Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Fri, 12 Mar 2021 19:09:48 +0100 Subject: [PATCH 36/46] scram b code-format --- SimG4Core/Geometry/src/DDG4ProductionCuts.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/SimG4Core/Geometry/src/DDG4ProductionCuts.cc b/SimG4Core/Geometry/src/DDG4ProductionCuts.cc index ecc9dcb41cd43..fe3c068f84a31 100644 --- a/SimG4Core/Geometry/src/DDG4ProductionCuts.cc +++ b/SimG4Core/Geometry/src/DDG4ProductionCuts.cc @@ -141,7 +141,7 @@ void DDG4ProductionCuts::dd4hepInitialize() { for (auto const& it : dd4hepVec_) { auto regName = it.second->strValue(keywordRegion_); G4Region* region = G4RegionStore::GetInstance()->FindOrCreateRegion({regName.data(), regName.size()}); - + region->AddRootLogicalVolume(it.first); edm::LogVerbatim("Geometry") << it.first->GetName() << ": " << regName; edm::LogVerbatim("Geometry") << " MakeRegions: added " << it.first->GetName() << " to region " << region->GetName(); @@ -150,13 +150,15 @@ void DDG4ProductionCuts::dd4hepInitialize() { const G4String& nonReflectedG4Name = it.first->GetName(); const G4String& reflectedG4Name = nonReflectedG4Name + "_refl"; const G4LogicalVolumeStore* const allG4LogicalVolumes = G4LogicalVolumeStore::GetInstance(); - const auto reflectedG4LogicalVolumeIt = std::find_if(allG4LogicalVolumes->begin(), allG4LogicalVolumes->end(), [&](const G4LogicalVolume* const aG4LogicalVolume) { - return (aG4LogicalVolume->GetName() == reflectedG4Name); - }); + const auto reflectedG4LogicalVolumeIt = std::find_if( + allG4LogicalVolumes->begin(), allG4LogicalVolumes->end(), [&](const G4LogicalVolume* const aG4LogicalVolume) { + return (aG4LogicalVolume->GetName() == reflectedG4Name); + }); // If G4 Logical volume has a reflected volume, add it to the region as well. if (reflectedG4LogicalVolumeIt != allG4LogicalVolumes->end()) { region->AddRootLogicalVolume(*reflectedG4LogicalVolumeIt); - edm::LogVerbatim("Geometry") << " MakeRegions: added " << (*reflectedG4LogicalVolumeIt)->GetName() << " to region " << region->GetName(); + edm::LogVerbatim("Geometry") << " MakeRegions: added " << (*reflectedG4LogicalVolumeIt)->GetName() + << " to region " << region->GetName(); } edm::LogVerbatim("Geometry").log([&](auto& log) { From cf9163db297d9cd594ef069322cf784591572b6f Mon Sep 17 00:00:00 2001 From: Gabrielle Hugo Date: Fri, 12 Mar 2021 19:50:24 +0100 Subject: [PATCH 37/46] Touchables: can stop search at first occurence, as a logical volume is within one detector anyway. Same touchables catalog with DD4hep as DDD --- SimG4Core/Geometry/src/DD4hep_DDG4Builder.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SimG4Core/Geometry/src/DD4hep_DDG4Builder.cc b/SimG4Core/Geometry/src/DD4hep_DDG4Builder.cc index 06d7bd67d3974..f7024f6a5023f 100644 --- a/SimG4Core/Geometry/src/DD4hep_DDG4Builder.cc +++ b/SimG4Core/Geometry/src/DD4hep_DDG4Builder.cc @@ -46,13 +46,19 @@ G4VPhysicalVolume *DDG4Builder::BuildGeometry(SensitiveDetectorCatalog &catalog) dd4hep::SpecParRefs specs; specPars.filter(specs, "SensitiveDetector"); for (auto const &it : map_) { + bool foundMatch = false; // Stop search at first occurrence for (auto const &fit : specs) { for (auto const &pit : fit.second->paths) { if (dd4hep::dd::compareEqualName(dd4hep::dd::noNamespace(dd4hep::dd::realTopName(pit)), dd4hep::dd::noNamespace(it.first.name()))) { dd4hepVec.emplace_back(&*it.second, &*fit.second); + + foundMatch = true; + break; } } + if (foundMatch) + break; } } From 363f8bf5ca8292710c77aceb9b9e9dba2e4e5cf0 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 12 Mar 2021 22:33:46 +0100 Subject: [PATCH 38/46] Update PrintGeomInfo to give statistics for touchables --- .../interface/PrintGeomInfoAction.h | 5 +- .../PrintGeomInfo/src/PrintGeomInfoAction.cc | 135 ++++++++++++------ .../test/python/runDD4HEP_cfg.py | 15 +- .../PrintGeomInfo/test/python/runDDD_cfg.py | 15 +- 4 files changed, 107 insertions(+), 63 deletions(-) diff --git a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h index 813305158f308..74ab1fc183b2c 100644 --- a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h +++ b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h @@ -39,10 +39,11 @@ class PrintGeomInfoAction : public SimWatcher, public Observer &touches); std::string spacesFromLeafDepth(unsigned int leafDepth); - void dumpSolid(G4VSolid* sol, unsigned int leafDepth, std::ostream& out = std::cout); G4VPhysicalVolume* getTopPV(); G4LogicalVolume* getTopLV(); @@ -53,7 +54,7 @@ class PrintGeomInfoAction : public SimWatcher, public Observer names_; G4VPhysicalVolume* theTopPV_; G4NavigationHistory fHistory_; diff --git a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc b/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc index f0094127037a1..5df605c7e2a26 100644 --- a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc +++ b/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc @@ -16,7 +16,8 @@ #include "DetectorDescription/DDCMS/interface/DDCompactView.h" #include "DetectorDescription/DDCMS/interface/DDFilteredView.h" -#include +#include "DD4hep/DD4hepUnits.h" +#include "DD4hep/Filter.h" #include "G4Run.hh" #include "G4PhysicalVolumeStore.hh" @@ -30,9 +31,11 @@ #include "G4UserLimits.hh" #include "G4TransportationManager.hh" +#include #include -#include #include +#include +#include using angle_units::operators::convertRadToDeg; @@ -58,6 +61,7 @@ PrintGeomInfoAction::PrintGeomInfoAction(const edm::ParameterSet &p) { fileSolid_ = p.getUntrackedParameter("SolidFileName", ""); fileLV_ = p.getUntrackedParameter("LVFileName", ""); filePV_ = p.getUntrackedParameter("PVFileName", ""); + fileTouch_ = p.getUntrackedParameter("TouchFileName", ""); G4cout << "PrintGeomInfoAction:: initialised for dd4hep " << dd4hep_ << " with verbosity levels:" << " Summary " << dumpSummary_ << " LVTree " << dumpLVTree_ << " LVList " << dumpLVList_ << " Material " << dumpMaterial_ << "\n " @@ -67,10 +71,10 @@ PrintGeomInfoAction::PrintGeomInfoAction(const edm::ParameterSet &p) { << "\n " << " Touchable " << dumpTouch_ << " for names (0-" << nchar_ << ") = " << name_ << "\n " - << " Sensitive " << dumpSense_ << " for " << names_.size() << " names:" + << " Sensitive " << dumpSense_ << " Files " << fileMat_ << ":" << fileSolid_ << ":" + << fileLV_ << ":" << filePV_ << ":" << fileTouch_ << "\n " - << " Files " << fileMat_ << ":" << fileSolid_ << ":" - << ":" << fileLV_ << ":" << filePV_; + << "for " << names_.size() << " names:"; for (unsigned int i = 0; i < names_.size(); i++) G4cout << " " << names_[i]; G4cout << G4endl; @@ -232,43 +236,6 @@ void PrintGeomInfoAction::dumpG4LVLeaf(G4LogicalVolume *lv, dumpG4LVLeaf((cite->first), leafDepth + 1, (cite->second), out); } -void PrintGeomInfoAction::dumpInFile() { - //---------- Dump number objects of each class in a file - if (theTopPV_ != nullptr) { - if (!fileMat_.empty()) { - const G4MaterialTable *matTab = G4Material::GetMaterialTable(); - std::ofstream fout(fileMat_.c_str()); - for (std::vector::const_iterator matite = matTab->begin(); matite != matTab->end(); matite++) - fout << (*matite)->GetName() << "\n"; - fout.close(); - } - const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance(); - if (!fileSolid_.empty()) { - std::ofstream fout(fileSolid_.c_str()); - for (std::vector::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) - fout << (*lvcite)->GetSolid()->GetName() << "\n"; - fout.close(); - } - if (!fileLV_.empty()) { - std::ofstream fout(fileLV_.c_str()); - for (std::vector::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) - fout << (*lvcite)->GetName() << "\n"; - fout.close(); - } - if (!filePV_.empty()) { - const G4PhysicalVolumeStore *pvs = G4PhysicalVolumeStore::GetInstance(); - std::ofstream fout(filePV_.c_str()); - for (std::vector::const_iterator pvcite = pvs->begin(); pvcite != pvs->end(); pvcite++) { - if (dd4hep_) - fout << (*pvcite)->GetName() << "\n"; - else - fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << "\n"; - } - fout.close(); - } - } -} - int PrintGeomInfoAction::countNoTouchables() { int nTouch = 0; G4LogicalVolume *lv = getTopLV(); @@ -424,6 +391,11 @@ void PrintGeomInfoAction::dumpPV(G4VPhysicalVolume *pv, unsigned int leafDepth, } } +void PrintGeomInfoAction::dumpSolid(G4VSolid *sol, unsigned int leafDepth, std::ostream &out) { + std::string spaces = spacesFromLeafDepth(leafDepth); + out << spaces << *(sol) << G4endl; +} + void PrintGeomInfoAction::dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, std::ostream &out) { std::string spaces = spacesFromLeafDepth(leafDepth); if (leafDepth == 0) @@ -455,6 +427,80 @@ void PrintGeomInfoAction::dumpTouch(G4VPhysicalVolume *pv, unsigned int leafDept fHistory_.BackLevel(); } +void PrintGeomInfoAction::dumpInFile() { + //---------- Dump number objects of each class in a file + if (theTopPV_ != nullptr) { + if (!fileMat_.empty()) { + const G4MaterialTable *matTab = G4Material::GetMaterialTable(); + std::ofstream fout(fileMat_.c_str()); + for (std::vector::const_iterator matite = matTab->begin(); matite != matTab->end(); matite++) + fout << (*matite)->GetName() << "\n"; + fout.close(); + } + const G4LogicalVolumeStore *lvs = G4LogicalVolumeStore::GetInstance(); + if (!fileSolid_.empty()) { + std::ofstream fout(fileSolid_.c_str()); + for (std::vector::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) + fout << (*lvcite)->GetSolid()->GetName() << "\n"; + fout.close(); + } + if (!fileLV_.empty()) { + std::ofstream fout(fileLV_.c_str()); + for (std::vector::const_iterator lvcite = lvs->begin(); lvcite != lvs->end(); lvcite++) + fout << (*lvcite)->GetName() << "\n"; + fout.close(); + } + if (!filePV_.empty()) { + const G4PhysicalVolumeStore *pvs = G4PhysicalVolumeStore::GetInstance(); + std::ofstream fout(filePV_.c_str()); + for (std::vector::const_iterator pvcite = pvs->begin(); pvcite != pvs->end(); pvcite++) { + if (dd4hep_) + fout << (*pvcite)->GetName() << "\n"; + else + fout << (*pvcite)->GetName() << "_" << (*pvcite)->GetCopyNo() << "\n"; + } + fout.close(); + } + if (!fileTouch_.empty()) { + std::ofstream fout(fileTouch_.c_str()); + std::vector touches; + getTouch(theTopPV_, 0, 1, touches); + std::sort(touches.begin(), touches.end()); + for (auto touch : touches) + fout << touch << "\n"; + fout.close(); + } + } +} + +void PrintGeomInfoAction::getTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector &touches) { + if (leafDepth == 0) + fHistory_.SetFirstEntry(pv); + else + fHistory_.NewLevel(pv, kNormal, pv->GetCopyNo()); + + std::string mother = "World"; + if (pv->GetMotherLogical()) + mother = static_cast(dd4hep::dd::noNamespace(pv->GetMotherLogical()->GetName())); + + G4LogicalVolume *lv = pv->GetLogicalVolume(); + std::string lvname = static_cast(dd4hep::dd::noNamespace(lv->GetName())); + unsigned int copy = static_cast(pv->GetCopyNo()); + + std::string name = lvname + ":" + std::to_string(copy) + "_" + mother + ":" + std::to_string(copym); + touches.emplace_back(name); + + int NoDaughters = lv->GetNoDaughters(); + while ((NoDaughters--) > 0) { + G4VPhysicalVolume *pvD = lv->GetDaughter(NoDaughters); + if (!pvD->IsReplicated()) + getTouch(pvD, leafDepth + 1, copy, touches); + } + + if (leafDepth > 0) + fHistory_.BackLevel(); +} + std::string PrintGeomInfoAction::spacesFromLeafDepth(unsigned int leafDepth) { std::string spaces; unsigned int ii; @@ -464,11 +510,6 @@ std::string PrintGeomInfoAction::spacesFromLeafDepth(unsigned int leafDepth) { return spaces; } -void PrintGeomInfoAction::dumpSolid(G4VSolid *sol, unsigned int leafDepth, std::ostream &out) { - std::string spaces = spacesFromLeafDepth(leafDepth); - out << spaces << *(sol) << G4endl; -} - G4VPhysicalVolume *PrintGeomInfoAction::getTopPV() { return G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume(); } diff --git a/SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py index df401212988ed..a5b840de3c96d 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runDD4HEP_cfg.py @@ -18,23 +18,24 @@ process.MessageLogger.G4cout=dict() process.g4SimHits.Watchers = cms.VPSet(cms.PSet( DumpSummary = cms.untracked.bool(True), - DumpLVTree = cms.untracked.bool(True), + DumpLVTree = cms.untracked.bool(False), DumpMaterial = cms.untracked.bool(False), - DumpLVList = cms.untracked.bool(True), + DumpLVList = cms.untracked.bool(False), DumpLV = cms.untracked.bool(False), - DumpSolid = cms.untracked.bool(True), + DumpSolid = cms.untracked.bool(False), DumpAttributes = cms.untracked.bool(False), DumpPV = cms.untracked.bool(False), DumpRotation = cms.untracked.bool(False), DumpReplica = cms.untracked.bool(False), - DumpTouch = cms.untracked.bool(True), - DumpSense = cms.untracked.bool(True), + DumpTouch = cms.untracked.bool(False), + DumpSense = cms.untracked.bool(False), DD4Hep = cms.untracked.bool(True), - Name = cms.untracked.string('csc:ME11*'), - Names = cms.untracked.vstring('EcalHitsEB'), + Name = cms.untracked.string(''), + Names = cms.untracked.vstring(''), MaterialFileName = cms.untracked.string('matfileDD4Hep.txt'), SolidFileName = cms.untracked.string('solidfileDD4Hep.txt'), LVFileName = cms.untracked.string('lvfileDD4Hep.txt'), PVFileName = cms.untracked.string('pvfileDD4Hep.txt'), + TouchFileName = cms.untracked.string('touchfileDD4Hep.txt'), type = cms.string('PrintGeomInfoAction') )) diff --git a/SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py b/SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py index 887bb3f81a461..18af92f3380bd 100644 --- a/SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py +++ b/SimG4Core/PrintGeomInfo/test/python/runDDD_cfg.py @@ -29,23 +29,24 @@ process.g4SimHits.g4GeometryDD4hepSource = cms.bool(False) process.g4SimHits.Watchers = cms.VPSet(cms.PSet( DumpSummary = cms.untracked.bool(True), - DumpLVTree = cms.untracked.bool(True), + DumpLVTree = cms.untracked.bool(False), DumpMaterial = cms.untracked.bool(False), - DumpLVList = cms.untracked.bool(True), + DumpLVList = cms.untracked.bool(False), DumpLV = cms.untracked.bool(False), - DumpSolid = cms.untracked.bool(True), + DumpSolid = cms.untracked.bool(False), DumpAttributes = cms.untracked.bool(False), DumpPV = cms.untracked.bool(False), DumpRotation = cms.untracked.bool(False), DumpReplica = cms.untracked.bool(False), - DumpTouch = cms.untracked.bool(True), - DumpSense = cms.untracked.bool(True), + DumpTouch = cms.untracked.bool(False), + DumpSense = cms.untracked.bool(False), DD4Hep = cms.untracked.bool(False), - Name = cms.untracked.string('ME11*'), - Names = cms.untracked.vstring('EcalHitsEB'), + Name = cms.untracked.string(''), + Names = cms.untracked.vstring(''), MaterialFileName = cms.untracked.string('matfileDDD.txt'), SolidFileName = cms.untracked.string('solidfileDDD.txt'), LVFileName = cms.untracked.string('lvfileDDD.txt'), PVFileName = cms.untracked.string('pvfileDDD.txt'), + TouchFileName = cms.untracked.string('touchfileDDD.txt'), type = cms.string('PrintGeomInfoAction') )) From 773d46a6ee951612cca98033631b9120d3e5dd8a Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 12 Mar 2021 23:03:52 +0100 Subject: [PATCH 39/46] Code check --- SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h | 2 +- SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h index 74ab1fc183b2c..769c384d34321 100644 --- a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h +++ b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h @@ -42,7 +42,7 @@ class PrintGeomInfoAction : public SimWatcher, public Observer &touches); + void getTouch(G4VPhysicalVolume* pv, unsigned int leafDepth, unsigned int copym, std::vector& touches); std::string spacesFromLeafDepth(unsigned int leafDepth); G4VPhysicalVolume* getTopPV(); G4LogicalVolume* getTopLV(); diff --git a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc b/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc index 5df605c7e2a26..d84f960ff5521 100644 --- a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc +++ b/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc @@ -71,10 +71,9 @@ PrintGeomInfoAction::PrintGeomInfoAction(const edm::ParameterSet &p) { << "\n " << " Touchable " << dumpTouch_ << " for names (0-" << nchar_ << ") = " << name_ << "\n " - << " Sensitive " << dumpSense_ << " Files " << fileMat_ << ":" << fileSolid_ << ":" - << fileLV_ << ":" << filePV_ << ":" << fileTouch_ - << "\n " - << "for " << names_.size() << " names:"; + << " Sensitive " << dumpSense_ << " Files " << fileMat_ << ":" << fileSolid_ << ":" << fileLV_ << ":" + << filePV_ << ":" << fileTouch_ << "\n " + << "for " << names_.size() << " names:"; for (unsigned int i = 0; i < names_.size(); i++) G4cout << " " << names_[i]; G4cout << G4endl; From 6a095a813832bafb8de8db769934ea9fb0dd0cfe Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 12 Mar 2021 23:36:35 +0100 Subject: [PATCH 40/46] Code check --- SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h | 2 +- SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h index 769c384d34321..74ab1fc183b2c 100644 --- a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h +++ b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h @@ -42,7 +42,7 @@ class PrintGeomInfoAction : public SimWatcher, public Observer& touches); + void getTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector &touches); std::string spacesFromLeafDepth(unsigned int leafDepth); G4VPhysicalVolume* getTopPV(); G4LogicalVolume* getTopLV(); diff --git a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc b/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc index d84f960ff5521..ca7fe828cc887 100644 --- a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc +++ b/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc @@ -465,7 +465,7 @@ void PrintGeomInfoAction::dumpInFile() { std::vector touches; getTouch(theTopPV_, 0, 1, touches); std::sort(touches.begin(), touches.end()); - for (auto touch : touches) + for (const auto& touch : touches) fout << touch << "\n"; fout.close(); } From 9ed919d6db498f0c8274da39e0e6451965ab8893 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Fri, 12 Mar 2021 23:44:12 +0100 Subject: [PATCH 41/46] Code check --- SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h | 2 +- SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h index 74ab1fc183b2c..769c384d34321 100644 --- a/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h +++ b/SimG4Core/PrintGeomInfo/interface/PrintGeomInfoAction.h @@ -42,7 +42,7 @@ class PrintGeomInfoAction : public SimWatcher, public Observer &touches); + void getTouch(G4VPhysicalVolume* pv, unsigned int leafDepth, unsigned int copym, std::vector& touches); std::string spacesFromLeafDepth(unsigned int leafDepth); G4VPhysicalVolume* getTopPV(); G4LogicalVolume* getTopLV(); diff --git a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc b/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc index ca7fe828cc887..cd93c2609d491 100644 --- a/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc +++ b/SimG4Core/PrintGeomInfo/src/PrintGeomInfoAction.cc @@ -465,14 +465,17 @@ void PrintGeomInfoAction::dumpInFile() { std::vector touches; getTouch(theTopPV_, 0, 1, touches); std::sort(touches.begin(), touches.end()); - for (const auto& touch : touches) - fout << touch << "\n"; + for (const auto &touch : touches) + fout << touch << "\n"; fout.close(); } } } -void PrintGeomInfoAction::getTouch(G4VPhysicalVolume *pv, unsigned int leafDepth, unsigned int copym, std::vector &touches) { +void PrintGeomInfoAction::getTouch(G4VPhysicalVolume *pv, + unsigned int leafDepth, + unsigned int copym, + std::vector &touches) { if (leafDepth == 0) fHistory_.SetFirstEntry(pv); else From 8040368313e034c8fca54c55dbfc772d3b824a34 Mon Sep 17 00:00:00 2001 From: Malik Shahzad Muzaffar Date: Sat, 13 Mar 2021 09:25:10 +0100 Subject: [PATCH 42/46] remove level: so that unit test worksfor llvm 10 too --- Utilities/ReleaseScripts/test/test-clang-tidy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Utilities/ReleaseScripts/test/test-clang-tidy.sh b/Utilities/ReleaseScripts/test/test-clang-tidy.sh index e9009360b0258..cf406ea6e974b 100755 --- a/Utilities/ReleaseScripts/test/test-clang-tidy.sh +++ b/Utilities/ReleaseScripts/test/test-clang-tidy.sh @@ -1,6 +1,6 @@ #!/bin/bash -ex clang-tidy -export-fixes $CMSSW_BASE/test-clang-tidy.cc.yaml -header-filter "$CMSSW_BASE/src/.*" $CMSSW_BASE/src/Utilities/ReleaseScripts/test/test-clang-tidy.cc sed -i -e "s|$CMSSW_BASE/src/||" $CMSSW_BASE/test-clang-tidy.cc.yaml -sed -i -e '/^ BuildDirectory/d' $CMSSW_BASE/test-clang-tidy.cc.yaml +sed -i -e '/^\s\s*BuildDirectory/d;/^\s\s*Level:/d' $CMSSW_BASE/test-clang-tidy.cc.yaml diff -u $CMSSW_BASE/test-clang-tidy.cc.yaml $CMSSW_BASE/src/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml rm -f $CMSSW_BASE/test-clang-tidy.cc.yaml From 921195a229ed31e7b198caac10e7063b904c58c5 Mon Sep 17 00:00:00 2001 From: Malik Shahzad Muzaffar Date: Sat, 13 Mar 2021 09:26:15 +0100 Subject: [PATCH 43/46] Update test-clang-tidy.cc.yaml --- Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml b/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml index 986704e2d08ee..462d9fd109097 100644 --- a/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml +++ b/Utilities/ReleaseScripts/test/test-clang-tidy.cc.yaml @@ -11,7 +11,6 @@ Diagnostics: Offset: 69 Length: 1 ReplacementText: nullptr - Level: Warning - DiagnosticName: modernize-use-nullptr DiagnosticMessage: Message: use nullptr @@ -22,7 +21,6 @@ Diagnostics: Offset: 206 Length: 1 ReplacementText: nullptr - Level: Warning - DiagnosticName: modernize-use-nullptr DiagnosticMessage: Message: use nullptr @@ -33,7 +31,6 @@ Diagnostics: Offset: 235 Length: 1 ReplacementText: nullptr - Level: Warning - DiagnosticName: modernize-use-override DiagnosticMessage: Message: 'prefer using ''override'' or (rarely) ''final'' instead of ''virtual''' @@ -48,7 +45,6 @@ Diagnostics: Offset: 399 Length: 0 ReplacementText: ' override' - Level: Warning - DiagnosticName: modernize-use-override DiagnosticMessage: Message: 'prefer using ''override'' or (rarely) ''final'' instead of ''virtual''' @@ -63,5 +59,4 @@ Diagnostics: Offset: 427 Length: 0 ReplacementText: ' override' - Level: Warning ... From d9d60ce01908be82b2de18ad7cda66ff11fdd7f4 Mon Sep 17 00:00:00 2001 From: Shahzad Malik Muzaffar Date: Sat, 13 Mar 2021 12:01:01 +0100 Subject: [PATCH 44/46] [UBSAN] Added missing deps to fix UBSAN build errors --- DQM/DataScouting/BuildFile.xml | 1 + GeneratorInterface/TauolaInterface/plugins/BuildFile.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/DQM/DataScouting/BuildFile.xml b/DQM/DataScouting/BuildFile.xml index e9bbac313c107..773d9a7f05962 100644 --- a/DQM/DataScouting/BuildFile.xml +++ b/DQM/DataScouting/BuildFile.xml @@ -4,6 +4,7 @@ + diff --git a/GeneratorInterface/TauolaInterface/plugins/BuildFile.xml b/GeneratorInterface/TauolaInterface/plugins/BuildFile.xml index e18f8b3190fa9..f65842a456d8b 100644 --- a/GeneratorInterface/TauolaInterface/plugins/BuildFile.xml +++ b/GeneratorInterface/TauolaInterface/plugins/BuildFile.xml @@ -14,6 +14,7 @@ + From 559eda737c952662c1aa27f95a8770fe237be239 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sun, 14 Mar 2021 20:43:58 +0100 Subject: [PATCH 45/46] recover simhits in HF for dd4hep --- ...runHcalParametersFromDD4HepAnalyzer_cfg.py | 18 +-- .../runHcalParametersFromDDDAnalyzer_cfg.py | 8 +- SimG4CMS/Calo/plugins/HcalSimHitDump.cc | 47 ++++--- SimG4CMS/Calo/src/HCalSD.cc | 9 +- SimG4CMS/Calo/test/python/runHFDD4HEP_cfg.py | 132 ++++++++++++++++++ SimG4CMS/Calo/test/python/runHFDDD_cfg.py | 130 +++++++++++++++++ .../Calo/test/python/runHcalSimHitDump_cfg.py | 27 +--- 7 files changed, 310 insertions(+), 61 deletions(-) create mode 100644 SimG4CMS/Calo/test/python/runHFDD4HEP_cfg.py create mode 100644 SimG4CMS/Calo/test/python/runHFDDD_cfg.py diff --git a/Geometry/HcalCommonData/test/python/runHcalParametersFromDD4HepAnalyzer_cfg.py b/Geometry/HcalCommonData/test/python/runHcalParametersFromDD4HepAnalyzer_cfg.py index bf1486d925f79..640a29b75a600 100644 --- a/Geometry/HcalCommonData/test/python/runHcalParametersFromDD4HepAnalyzer_cfg.py +++ b/Geometry/HcalCommonData/test/python/runHcalParametersFromDD4HepAnalyzer_cfg.py @@ -1,8 +1,9 @@ import FWCore.ParameterSet.Config as cms -process = cms.Process("HcalParametersTest") +from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep -process.load('Geometry.HcalCommonData.hcalParameters_cff') -process.load('Geometry.HcalCommonData.hcalSimulationParameters_cff') +process = cms.Process("HcalParametersTest",Run3_dd4hep) + +process.load("Configuration.Geometry.GeometryDD4hepExtended2021Reco_cff") process.load('FWCore.MessageService.MessageLogger_cfi') if hasattr(process,'MessageLogger'): @@ -14,18 +15,7 @@ input = cms.untracked.int32(1) ) -process.DDDetectorESProducer = cms.ESSource("DDDetectorESProducer", - confGeomXMLFiles = cms.FileInPath('Geometry/HcalAlgo/data/cms-test-Phase2GeometryFine-algorithm.xml'), - appendToDataLabel = cms.string('') - ) - -process.DDCompactViewESProducer = cms.ESProducer("DDCompactViewESProducer", - appendToDataLabel = cms.string('') -) - process.hpa = cms.EDAnalyzer("HcalParametersAnalyzer") -process.hcalParameters.fromDD4Hep = cms.bool(True) -process.hcalSimulationParameters.fromDD4Hep = cms.bool(True) process.Timing = cms.Service("Timing") process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck") diff --git a/Geometry/HcalCommonData/test/python/runHcalParametersFromDDDAnalyzer_cfg.py b/Geometry/HcalCommonData/test/python/runHcalParametersFromDDDAnalyzer_cfg.py index 308717c6b5163..73a8c45cbb0d7 100644 --- a/Geometry/HcalCommonData/test/python/runHcalParametersFromDDDAnalyzer_cfg.py +++ b/Geometry/HcalCommonData/test/python/runHcalParametersFromDDDAnalyzer_cfg.py @@ -1,9 +1,9 @@ import FWCore.ParameterSet.Config as cms -process = cms.Process("HcalParametersTest") +from Configuration.Eras.Era_Run3_cff import Run3 -process.load('Geometry.HcalCommonData.testPhase2GeometryFineXML_cfi') -process.load('Geometry.HcalCommonData.hcalParameters_cff') -process.load('Geometry.HcalCommonData.hcalSimulationParameters_cff') +process = cms.Process("HcalParametersTest",Run3) + +process.load("Configuration.Geometry.GeometryExtended2021Reco_cff") process.load('FWCore.MessageService.MessageLogger_cfi') process.source = cms.Source("EmptySource") diff --git a/SimG4CMS/Calo/plugins/HcalSimHitDump.cc b/SimG4CMS/Calo/plugins/HcalSimHitDump.cc index 055a6772fbbc1..d830cd4f68e21 100644 --- a/SimG4CMS/Calo/plugins/HcalSimHitDump.cc +++ b/SimG4CMS/Calo/plugins/HcalSimHitDump.cc @@ -1,5 +1,5 @@ #include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" @@ -7,6 +7,7 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" #include "FWCore/Utilities/interface/InputTag.h" #include "FWCore/Utilities/interface/Exception.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -28,10 +29,11 @@ #include #include -class HcalSimHitDump : public edm::EDAnalyzer { +class HcalSimHitDump : public edm::one::EDAnalyzer<> { public: HcalSimHitDump(const edm::ParameterSet& ps); ~HcalSimHitDump() override {} + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); protected: void beginJob() override {} @@ -41,21 +43,33 @@ class HcalSimHitDump : public edm::EDAnalyzer { void analyzeHits(std::vector&); private: - std::string g4Label_, hitLab_; + const std::string g4Label_, hitLab_; + const int maxEvent_; + const bool testNumber_; edm::EDGetTokenT toks_calo_; - int nevt_, maxEvent_; + int nevt_; }; -HcalSimHitDump::HcalSimHitDump(const edm::ParameterSet& ps) : nevt_(0) { - g4Label_ = ps.getUntrackedParameter("ModuleLabel", "g4SimHits"); - hitLab_ = ps.getUntrackedParameter("HCCollection", "HcalHits"); - maxEvent_ = ps.getUntrackedParameter("MaxEvent", 10); - +HcalSimHitDump::HcalSimHitDump(const edm::ParameterSet& ps) : + g4Label_(ps.getParameter("ModuleLabel")), + hitLab_(ps.getParameter("HCCollection")), + maxEvent_(ps.getParameter("MaxEvent")), + testNumber_(ps.getParameter("TestNumber")), + nevt_(0) { + // register for data access toks_calo_ = consumes(edm::InputTag(g4Label_, hitLab_)); - edm::LogVerbatim("HitStudy") << "HcalSimHitDump::Module Label: " << g4Label_ << " Hits: " << hitLab_ << " MaxEvent " - << maxEvent_; + edm::LogVerbatim("HitStudy") << "HcalSimHitDump::Module Label: " << g4Label_ << " Hits: " << hitLab_ << " MaxEvent " << maxEvent_ << " TestNumbering " << testNumber_; +} + +void HcalSimHitDump::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + desc.add("ModuleLabel", "g4SimHits"); + desc.add("HCCollection","HcalHits"); + desc.add("MaxEvent", 10); + desc.add("TestNumber", true); + descriptions.add("hcalSimHitDump", desc); } void HcalSimHitDump::analyze(const edm::Event& e, const edm::EventSetup&) { @@ -78,22 +92,13 @@ void HcalSimHitDump::analyze(const edm::Event& e, const edm::EventSetup&) { } void HcalSimHitDump::analyzeHits(std::vector& hits) { - bool testN(false); - for (unsigned int k = 1; k < hits.size(); ++k) { - int det = (((hits[k].id()) >> 28) & 0xF); - if (det != 4) { - testN = true; - break; - } - } - edm::LogVerbatim("HitStudy") << "Hit ID uses numbering scheme " << testN << " (0 normal; 1 test)"; //Now the dump for (unsigned int i = 0; i < hits.size(); i++) { double edep = hits[i].energy(); double time = hits[i].time(); unsigned int id_ = hits[i].id(); - if (testN) { + if (testNumber_) { int det, z, depth, eta, phi, lay; HcalTestNumbering::unpackHcalIndex(id_, det, z, depth, eta, phi, lay); std::string sub("HX"); diff --git a/SimG4CMS/Calo/src/HCalSD.cc b/SimG4CMS/Calo/src/HCalSD.cc index f9ad1bd78770a..50d3bc6c623f0 100644 --- a/SimG4CMS/Calo/src/HCalSD.cc +++ b/SimG4CMS/Calo/src/HCalSD.cc @@ -78,6 +78,7 @@ HCalSD::HCalSD(const std::string& name, //static SimpleConfigurable bk3(1.75, "HCalSD:BirkC3"); // Values from NIM 80 (1970) 239-244: as implemented in Geant3 + bool dd4hep = p.getParameter("g4GeometryDD4hepSource"); edm::ParameterSet m_HC = p.getParameter("HCalSD"); useBirk = m_HC.getParameter("UseBirkLaw"); double bunit = (CLHEP::g / (CLHEP::MeV * CLHEP::cm2)); @@ -192,6 +193,7 @@ HCalSD::HCalSD(const std::string& name, std::stringstream ss0; ss0 << "HCalSD: Names to be tested for Volume = HF has " << hfNames.size() << " elements"; #endif + int addlevel = dd4hep ? 1 : 0; for (unsigned int i = 0; i < hfNames.size(); ++i) { G4String namv(static_cast(dd4hep::dd::noNamespace(hfNames[i]))); lv = nullptr; @@ -202,9 +204,9 @@ HCalSD::HCalSD(const std::string& name, } } hfLV.emplace_back(lv); - hfLevels.emplace_back(temp[i]); + hfLevels.emplace_back(temp[i] + addlevel); #ifdef EDM_ML_DEBUG - ss0 << "\n HF[" << i << "] = " << namv << " LV " << lv << " at level " << temp[i]; + ss0 << "\n HF[" << i << "] = " << namv << " LV " << lv << " at level " << (temp[i] + addlevel); #endif } #ifdef EDM_ML_DEBUG @@ -366,6 +368,9 @@ bool HCalSD::getFromLibrary(const G4Step* aStep) { weight_ = 1.0; bool kill(false); isHF = isItHF(aStep); +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("HcalSim") << "GetFromLibrary: isHF " << isHF << " darken " << (m_HFDarkening != nullptr) << " useParam " << useParam << " useShowerLibrary " << useShowerLibrary << " Muon? " << G4TrackToParticleID::isMuon(track) << " electron? " << G4TrackToParticleID::isGammaElectronPositron(track) << " Stable Hadron? " << G4TrackToParticleID::isStableHadronIon(track); +#endif if (isHF) { if (m_HFDarkening) { G4ThreeVector hitPoint = aStep->GetPreStepPoint()->GetPosition(); diff --git a/SimG4CMS/Calo/test/python/runHFDD4HEP_cfg.py b/SimG4CMS/Calo/test/python/runHFDD4HEP_cfg.py new file mode 100644 index 0000000000000..f323bedb2183d --- /dev/null +++ b/SimG4CMS/Calo/test/python/runHFDD4HEP_cfg.py @@ -0,0 +1,132 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep + +process = cms.Process('SIM',Run3_dd4hep) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRun3RoundOptics25ns13TeVLowSigmaZ_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') # there w + + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HcalSim=dict() + process.MessageLogger.HFShower=dict() + process.MessageLogger.HitStudy=dict() + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('SinglePion_cfi nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.FEVTDEBUGoutput = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN-SIM'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:step1_dd4hep.root'), + outputCommands = process.FEVTDEBUGEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') + + +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(211), + MinEta = cms.double(3.1), + MaxEta = cms.double(4.6), + MinPhi = cms.double(-3.1415926), + MaxPhi = cms.double(-1.5707963), + MinE = cms.double(100.00), + MaxE = cms.double(100.00) + ), + Verbosity = cms.untracked.int32(0), + AddAntiParticle = cms.bool(True) +) + +process.load("SimG4CMS.Calo.hcalSimHitDump_cfi") +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.analysis_step = cms.Path(process.hcalSimHitDump) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.FEVTDEBUGoutput_step = cms.EndPath(process.FEVTDEBUGoutput) + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.endjob_step,process.analysis_step,process.FEVTDEBUGoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path).insert(0, process.ProductionFilterSequence) + + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/SimG4CMS/Calo/test/python/runHFDDD_cfg.py b/SimG4CMS/Calo/test/python/runHFDDD_cfg.py new file mode 100644 index 0000000000000..09bc793f24301 --- /dev/null +++ b/SimG4CMS/Calo/test/python/runHFDDD_cfg.py @@ -0,0 +1,130 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 + +process = cms.Process('SIM',Run3) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('SimGeneral.MixingModule.mixNoPU_cfi') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedRun3RoundOptics25ns13TeVLowSigmaZ_cfi') +process.load('GeneratorInterface.Core.genFilterSummary_cff') +process.load('Configuration.StandardSequences.SimIdeal_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('Configuration.Geometry.GeometryExtended2021_cff') # there w + +if hasattr(process,'MessageLogger'): + process.MessageLogger.HcalSim=dict() + process.MessageLogger.HFShower=dict() + process.MessageLogger.HitStudy=dict() + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +# Input source +process.source = cms.Source("EmptySource") + +process.options = cms.untracked.PSet( + FailPath = cms.untracked.vstring(), + IgnoreCompletely = cms.untracked.vstring(), + Rethrow = cms.untracked.vstring(), + SkipEvent = cms.untracked.vstring(), + allowUnscheduled = cms.obsolete.untracked.bool, + canDeleteEarly = cms.untracked.vstring(), + emptyRunLumiMode = cms.obsolete.untracked.string, + eventSetup = cms.untracked.PSet( + forceNumberOfConcurrentIOVs = cms.untracked.PSet( + + ), + numberOfConcurrentIOVs = cms.untracked.uint32(1) + ), + fileMode = cms.untracked.string('FULLMERGE'), + forceEventSetupCacheClearOnNewRun = cms.untracked.bool(False), + makeTriggerResults = cms.obsolete.untracked.bool, + numberOfConcurrentLuminosityBlocks = cms.untracked.uint32(1), + numberOfConcurrentRuns = cms.untracked.uint32(1), + numberOfStreams = cms.untracked.uint32(0), + numberOfThreads = cms.untracked.uint32(1), + printDependencies = cms.untracked.bool(False), + sizeOfStackForThreadsInKB = cms.optional.untracked.uint32, + throwIfIllegalParameter = cms.untracked.bool(True), + wantSummary = cms.untracked.bool(False) +) + +# Production Info +process.configurationMetadata = cms.untracked.PSet( + annotation = cms.untracked.string('SinglePion_cfi nevts:10'), + name = cms.untracked.string('Applications'), + version = cms.untracked.string('$Revision: 1.19 $') +) + +# Output definition + +process.FEVTDEBUGoutput = cms.OutputModule("PoolOutputModule", + SelectEvents = cms.untracked.PSet( + SelectEvents = cms.vstring('generation_step') + ), + dataset = cms.untracked.PSet( + dataTier = cms.untracked.string('GEN-SIM'), + filterName = cms.untracked.string('') + ), + fileName = cms.untracked.string('file:step1_ddd.root'), + outputCommands = process.FEVTDEBUGEventContent.outputCommands, + splitLevel = cms.untracked.int32(0) +) + +# Additional output definition + +# Other statements +process.genstepfilter.triggerConditions=cms.vstring("generation_step") +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2021_realistic', '') + +process.generator = cms.EDProducer("FlatRandomEGunProducer", + PGunParameters = cms.PSet( + PartID = cms.vint32(211), + MinEta = cms.double(3.1), + MaxEta = cms.double(4.6), + MinPhi = cms.double(-3.1415926), + MaxPhi = cms.double(-1.5707963), + MinE = cms.double(100.00), + MaxE = cms.double(100.00) + ), + Verbosity = cms.untracked.int32(0), + AddAntiParticle = cms.bool(True) +) + +process.load("SimG4CMS.Calo.hcalSimHitDump_cfi") +process.ProductionFilterSequence = cms.Sequence(process.generator) + +# Path and EndPath definitions +process.generation_step = cms.Path(process.pgen) +process.simulation_step = cms.Path(process.psim) +process.genfiltersummary_step = cms.EndPath(process.genFilterSummary) +process.analysis_step = cms.Path(process.hcalSimHitDump) +process.endjob_step = cms.EndPath(process.endOfProcess) +process.FEVTDEBUGoutput_step = cms.EndPath(process.FEVTDEBUGoutput) + +# Schedule definition +process.schedule = cms.Schedule(process.generation_step,process.genfiltersummary_step,process.simulation_step,process.endjob_step,process.analysis_step,process.FEVTDEBUGoutput_step) +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) +# filter all path with the production filter sequence +for path in process.paths: + getattr(process,path).insert(0, process.ProductionFilterSequence) + + +# Customisation from command line + +# Add early deletion of temporary data products to reduce peak memory need +from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete +process = customiseEarlyDelete(process) +# End adding early deletion diff --git a/SimG4CMS/Calo/test/python/runHcalSimHitDump_cfg.py b/SimG4CMS/Calo/test/python/runHcalSimHitDump_cfg.py index 085ff6e086249..c96e459b0fed4 100644 --- a/SimG4CMS/Calo/test/python/runHcalSimHitDump_cfg.py +++ b/SimG4CMS/Calo/test/python/runHcalSimHitDump_cfg.py @@ -3,6 +3,7 @@ process = cms.Process("Sim") process.load("SimG4CMS.Calo.PythiaMinBias_cfi") process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi") +process.load('FWCore.MessageService.MessageLogger_cfi') process.load("Configuration.Geometry.GeometryExtended2017Reco_cff") process.load("Configuration.StandardSequences.MagneticField_cff") process.load("Configuration.EventContent.EventContent_cff") @@ -21,20 +22,8 @@ input = cms.untracked.int32(200) ) -process.MessageLogger = cms.Service("MessageLogger", - cerr = cms.untracked.PSet( - enable = cms.untracked.bool(False) - ), - cout = cms.untracked.PSet( - HitStudy = cms.untracked.PSet( - limit = cms.untracked.int32(-1) - ), - default = cms.untracked.PSet( - limit = cms.untracked.int32(0) - ), - enable = cms.untracked.bool(True) - ) -) +if hasattr(process,'MessageLogger'): + process.MessageLogger.HitStudy=dict() process.load("IOMC.RandomEngine.IOMC_cff") process.RandomNumberGeneratorService.generator.initialSeed = 456789 @@ -42,11 +31,9 @@ process.RandomNumberGeneratorService.VtxSmeared.initialSeed = 123456789 process.rndmStore = cms.EDProducer("RandomEngineStateProducer") -process.analyze = cms.EDAnalyzer("HcalSimHitDump", - ModuleLabel = cms.untracked.string('g4SimHits'), - HCCollection = cms.untracked.string('HcalHits'), - MaxEvent = cms.untracked.int32(20) - ) +process.load("SimG4CMS.Calo.hcalSimHitDump_cfi") + +process.hcalSimHitDump.MaxEvent = 20 -process.schedule = cms.Path(process.analyze) +process.schedule = cms.Path(process.hcalSimHitDump) From 2a7a16c235b77599bad024dcdaf74a40dc84f99e Mon Sep 17 00:00:00 2001 From: Sunanda Date: Sun, 14 Mar 2021 20:56:38 +0100 Subject: [PATCH 46/46] Code check --- SimG4CMS/Calo/plugins/HcalSimHitDump.cc | 19 +++++++++---------- SimG4CMS/Calo/src/HCalSD.cc | 6 +++++- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/SimG4CMS/Calo/plugins/HcalSimHitDump.cc b/SimG4CMS/Calo/plugins/HcalSimHitDump.cc index d830cd4f68e21..a1a791270386c 100644 --- a/SimG4CMS/Calo/plugins/HcalSimHitDump.cc +++ b/SimG4CMS/Calo/plugins/HcalSimHitDump.cc @@ -50,23 +50,23 @@ class HcalSimHitDump : public edm::one::EDAnalyzer<> { int nevt_; }; -HcalSimHitDump::HcalSimHitDump(const edm::ParameterSet& ps) : - g4Label_(ps.getParameter("ModuleLabel")), - hitLab_(ps.getParameter("HCCollection")), - maxEvent_(ps.getParameter("MaxEvent")), - testNumber_(ps.getParameter("TestNumber")), - nevt_(0) { - +HcalSimHitDump::HcalSimHitDump(const edm::ParameterSet& ps) + : g4Label_(ps.getParameter("ModuleLabel")), + hitLab_(ps.getParameter("HCCollection")), + maxEvent_(ps.getParameter("MaxEvent")), + testNumber_(ps.getParameter("TestNumber")), + nevt_(0) { // register for data access toks_calo_ = consumes(edm::InputTag(g4Label_, hitLab_)); - edm::LogVerbatim("HitStudy") << "HcalSimHitDump::Module Label: " << g4Label_ << " Hits: " << hitLab_ << " MaxEvent " << maxEvent_ << " TestNumbering " << testNumber_; + edm::LogVerbatim("HitStudy") << "HcalSimHitDump::Module Label: " << g4Label_ << " Hits: " << hitLab_ << " MaxEvent " + << maxEvent_ << " TestNumbering " << testNumber_; } void HcalSimHitDump::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; desc.add("ModuleLabel", "g4SimHits"); - desc.add("HCCollection","HcalHits"); + desc.add("HCCollection", "HcalHits"); desc.add("MaxEvent", 10); desc.add("TestNumber", true); descriptions.add("hcalSimHitDump", desc); @@ -92,7 +92,6 @@ void HcalSimHitDump::analyze(const edm::Event& e, const edm::EventSetup&) { } void HcalSimHitDump::analyzeHits(std::vector& hits) { - //Now the dump for (unsigned int i = 0; i < hits.size(); i++) { double edep = hits[i].energy(); diff --git a/SimG4CMS/Calo/src/HCalSD.cc b/SimG4CMS/Calo/src/HCalSD.cc index 50d3bc6c623f0..25044764681c2 100644 --- a/SimG4CMS/Calo/src/HCalSD.cc +++ b/SimG4CMS/Calo/src/HCalSD.cc @@ -369,7 +369,11 @@ bool HCalSD::getFromLibrary(const G4Step* aStep) { bool kill(false); isHF = isItHF(aStep); #ifdef EDM_ML_DEBUG - edm::LogVerbatim("HcalSim") << "GetFromLibrary: isHF " << isHF << " darken " << (m_HFDarkening != nullptr) << " useParam " << useParam << " useShowerLibrary " << useShowerLibrary << " Muon? " << G4TrackToParticleID::isMuon(track) << " electron? " << G4TrackToParticleID::isGammaElectronPositron(track) << " Stable Hadron? " << G4TrackToParticleID::isStableHadronIon(track); + edm::LogVerbatim("HcalSim") << "GetFromLibrary: isHF " << isHF << " darken " << (m_HFDarkening != nullptr) + << " useParam " << useParam << " useShowerLibrary " << useShowerLibrary << " Muon? " + << G4TrackToParticleID::isMuon(track) << " electron? " + << G4TrackToParticleID::isGammaElectronPositron(track) << " Stable Hadron? " + << G4TrackToParticleID::isStableHadronIon(track); #endif if (isHF) { if (m_HFDarkening) {