From 056d257da392d50cf800cf801d231666d3a3c72d Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 15 Oct 2020 21:57:58 +0200 Subject: [PATCH 1/2] Add tools to test transition to dd4hep --- SimG4CMS/Calo/plugins/EcalSimHitDump.cc | 97 +++++++++++ SimG4CMS/Calo/src/CaloSD.cc | 3 + .../Calo/test/python/runEcalSimHitDump_cfg.py | 30 ++++ .../test/dd4hep_ZMM_Run3_Step1_cfg.py | 12 +- .../test/dd4hep_ZMM_Run3_Step2_cfg.py | 7 +- ...g.py => dd4hep_ttbar_2026D49_Step1_cfg.py} | 6 +- .../test/dd4hep_ttbar_Run3_Step1_cfg.py | 164 ++++++++++++++++++ .../test/ddd_ZMM_Run3_Step1_cfg.py | 7 +- .../test/ddd_ZMM_Run3_Step2_cfg.py | 4 + 9 files changed, 319 insertions(+), 11 deletions(-) create mode 100644 SimG4CMS/Calo/plugins/EcalSimHitDump.cc create mode 100644 SimG4CMS/Calo/test/python/runEcalSimHitDump_cfg.py rename SimG4Core/Configuration/test/{dd4hep_ttbar_2026D41_Step1_cfg.py => dd4hep_ttbar_2026D49_Step1_cfg.py} (98%) create mode 100644 SimG4Core/Configuration/test/dd4hep_ttbar_Run3_Step1_cfg.py diff --git a/SimG4CMS/Calo/plugins/EcalSimHitDump.cc b/SimG4CMS/Calo/plugins/EcalSimHitDump.cc new file mode 100644 index 0000000000000..a7f2a655a7926 --- /dev/null +++ b/SimG4CMS/Calo/plugins/EcalSimHitDump.cc @@ -0,0 +1,97 @@ +#include "DataFormats/EcalDetId/interface/EBDetId.h" +#include "DataFormats/EcalDetId/interface/EEDetId.h" +#include "DataFormats/EcalDetId/interface/ESDetId.h" +#include "DataFormats/EcalDetId/interface/EcalSubdetector.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" +#include "FWCore/Utilities/interface/transform.h" + +#include "SimDataFormats/CaloHit/interface/PCaloHit.h" +#include "SimDataFormats/CaloHit/interface/PCaloHitContainer.h" + +#include +#include + +class EcalSimHitDump : public edm::one::EDAnalyzer<> { +public: + EcalSimHitDump(const edm::ParameterSet& ps); + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +protected: + void analyze(edm::Event const&, edm::EventSetup const&) override; + +private: + + const std::string g4Label_; + const std::vector hitLab_; + const std::vector > toksCalo_; + const std::vector types_; + const int maxEvent_; + int kount_; +}; + +EcalSimHitDump::EcalSimHitDump(const edm::ParameterSet& ps) : + g4Label_(ps.getParameter("ModuleLabel")), + hitLab_(ps.getParameter>("HitCollections")), + toksCalo_{ + edm::vector_transform(hitLab_, + [this](const std::string& name) { + return consumes( + edm::InputTag{g4Label_, name}); + })}, + types_(ps.getParameter>("CollectionTypes")), + maxEvent_(ps.getParameter("MaxEvent")), + kount_(0) { + + edm::LogVerbatim("HitStudy") << "Module Label: " << g4Label_ << " with " << hitLab_.size() << " collections and maxEvent = " << maxEvent_; + for (unsigned int k = 0; k < hitLab_.size(); ++k) + edm::LogVerbatim("HitStudy") << "[" << k << "] Type " << types_[k] << " Label " << hitLab_[k]; +} + +void EcalSimHitDump::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + edm::ParameterSetDescription desc; + std::vector coll = {"EcalHitsEB", "EcalHitsEE", "EcalHitsES"}; + std::vector type = {0, 1, 2}; + desc.add("ModuleLabel", "g4SimHits"); + desc.add >("HitCollections", coll); + desc.add >("CollectionTypes", type); + desc.add("MaxEvent", 10); + descriptions.add("ecalSimHitDump", desc); +} + +void EcalSimHitDump::analyze(const edm::Event& e, const edm::EventSetup&) { + ++kount_; + edm::LogVerbatim("HitStudy") << "[" << kount_ << "] Run = " << e.id().run() << " Event = " << e.id().event(); + + if ((kount_ <= maxEvent_) || (maxEvent_ <= 0)) { + for (unsigned int k = 0; k < toksCalo_.size(); ++k) { + edm::Handle hitsCalo; + e.getByToken(toksCalo_[k], hitsCalo); + if (hitsCalo.isValid()) + edm::LogVerbatim("HitStudy") << "EcalSimHitDump: Input " << hitsCalo->size() << " hits of type " << types_[k]; + unsigned int i(0); + for (auto const& hit : *hitsCalo) { + double edep = hit.energy(); + double time = hit.time(); + unsigned int id = hit.id(); + if (types_[k] == 0) + edm::LogVerbatim("HitStudy") << "[" << i << "] " << EBDetId(id) << " E" << edep << " T " << time; + else if (types_[k] == 1) + edm::LogVerbatim("HitStudy") << "[" << i << "] " << EEDetId(id) << " E" << edep << " T " << time; + else + edm::LogVerbatim("HitStudy") << "[" << i << "] " << ESDetId(id) << " E" << edep << " T " << time; + ++i; + } + } + } +} + +//define this as a plug-in +DEFINE_FWK_MODULE(EcalSimHitDump); diff --git a/SimG4CMS/Calo/src/CaloSD.cc b/SimG4CMS/Calo/src/CaloSD.cc index 10213ca0d8288..4f98c899d4223 100644 --- a/SimG4CMS/Calo/src/CaloSD.cc +++ b/SimG4CMS/Calo/src/CaloSD.cc @@ -294,6 +294,9 @@ void CaloSD::PrintAll() { } void CaloSD::fillHits(edm::PCaloHitContainer& cc, const std::string& hname) { +#ifdef EDM_ML_DEBUG + edm::LogVerbatim("CaloSim") << "CaloSD: Tries to transfer " << slave.get()->hits().size() << " hits for " << slave.get()->name() << " " << hname; +#endif if (slave.get()->name() == hname) { cc = slave.get()->hits(); } diff --git a/SimG4CMS/Calo/test/python/runEcalSimHitDump_cfg.py b/SimG4CMS/Calo/test/python/runEcalSimHitDump_cfg.py new file mode 100644 index 0000000000000..f434b6043e3a2 --- /dev/null +++ b/SimG4CMS/Calo/test/python/runEcalSimHitDump_cfg.py @@ -0,0 +1,30 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_dd4hep_cff import Run3_dd4hep + +process = cms.Process('Dump',Run3_dd4hep) + +# import of standard configurations +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') +process.load('SimG4CMS.Calo.ecalSimHitDump_cfi') + +if hasattr(process,'MessageLogger'): + process.MessageLogger.categories.append('HitStudy') + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(10), + output = cms.optional.untracked.allowed(cms.int32,cms.PSet) +) + +process.source = cms.Source("PoolSource", + dropDescendantsOfDroppedBranches = cms.untracked.bool(False), + fileNames = cms.untracked.vstring('file:step1_ZMM_dd4hep.root'), +) + +process.analysis_step = cms.Path(process.ecalSimHitDump) + +process.ecalSimHitDump.MaxEvent = 10 + +# Schedule definition +process.schedule = cms.Schedule(process.analysis_step) diff --git a/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step1_cfg.py b/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step1_cfg.py index bedce9fdc04a2..77a932443ee21 100644 --- a/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step1_cfg.py +++ b/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step1_cfg.py @@ -19,9 +19,15 @@ process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.load('Configuration.Geometry.GeometryDD4hepExtended2021_cff') # there w -process.MessageLogger.categories.append("TrackerGeometryBuilder"); -process.MessageLogger.categories.append("TrackerSimInfoNumbering"); - +#if hasattr(process,'MessageLogger'): +# process.MessageLogger.categories.append('EcalGeom') +# process.MessageLogger.categories.append('MuonSim') +# process.MessageLogger.categories.append('CaloSim') +# process.MessageLogger.categories.append('EcalSim') +# process.MessageLogger.categories.append('HcalSim') +# process.MessageLogger.categories.append('SimG4CoreApplication') +# process.MessageLogger.categories.append("TrackerGeometryBuilder"); +# process.MessageLogger.categories.append("TrackerSimInfoNumbering"); process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10), diff --git a/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step2_cfg.py b/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step2_cfg.py index b89bb9fa5c884..10057df88c977 100644 --- a/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step2_cfg.py +++ b/SimG4Core/Configuration/test/dd4hep_ZMM_Run3_Step2_cfg.py @@ -19,9 +19,10 @@ process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -if hasattr(process,'MessageLogger'): - process.MessageLogger.categories.append('EcalGeom') -# process.MessageLogger.categories.append('CaloGeometryBuilder') +#if hasattr(process,'MessageLogger'): +# process.MessageLogger.categories.append('EcalGeom') +# process.MessageLogger.categories.append('GEMGeometry') +# process.MessageLogger.categories.append('CaloGeometryBuilder') process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10), diff --git a/SimG4Core/Configuration/test/dd4hep_ttbar_2026D41_Step1_cfg.py b/SimG4Core/Configuration/test/dd4hep_ttbar_2026D49_Step1_cfg.py similarity index 98% rename from SimG4Core/Configuration/test/dd4hep_ttbar_2026D41_Step1_cfg.py rename to SimG4Core/Configuration/test/dd4hep_ttbar_2026D49_Step1_cfg.py index d4ac70505c373..7f043daee59d8 100644 --- a/SimG4Core/Configuration/test/dd4hep_ttbar_2026D41_Step1_cfg.py +++ b/SimG4Core/Configuration/test/dd4hep_ttbar_2026D49_Step1_cfg.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Era_Phase2C8_dd4hep_cff import Phase2C8_dd4hep +from Configuration.Eras.Era_Phase2C9_dd4hep_cff import Phase2C9_dd4hep -process = cms.Process('SIM',Phase2C8_dd4hep) +process = cms.Process('SIM',Phase2C9_dd4hep) # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') @@ -10,7 +10,7 @@ process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.Geometry.GeometryDD4hepExtended2026D41_cff') +process.load('Configuration.Geometry.GeometryDD4hepExtended2026D49_cff') process.load('Configuration.StandardSequences.MagneticField_cff') process.load('Configuration.StandardSequences.Generator_cff') process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') diff --git a/SimG4Core/Configuration/test/dd4hep_ttbar_Run3_Step1_cfg.py b/SimG4Core/Configuration/test/dd4hep_ttbar_Run3_Step1_cfg.py new file mode 100644 index 0000000000000..34308d76ac03b --- /dev/null +++ b/SimG4Core/Configuration/test/dd4hep_ttbar_Run3_Step1_cfg.py @@ -0,0 +1,164 @@ +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.Geometry.GeometryDD4hepExtended2021_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.Generator_cff') +process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_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.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('TTbar_14TeV_TuneCP5_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.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.EDFilter("Pythia8GeneratorFilter", + PythiaParameters = cms.PSet( + parameterSets = cms.vstring( + 'pythia8CommonSettings', + 'pythia8CP5Settings', + 'processParameters' + ), + processParameters = cms.vstring( + 'Top:gg2ttbar = on ', + 'Top:qqbar2ttbar = on ', + '6:m0 = 175 ' + ), + pythia8CP5Settings = cms.vstring( + 'Tune:pp 14', + 'Tune:ee 7', + 'MultipartonInteractions:ecmPow=0.03344', + 'MultipartonInteractions:bProfile=2', + 'MultipartonInteractions:pT0Ref=1.41', + 'MultipartonInteractions:coreRadius=0.7634', + 'MultipartonInteractions:coreFraction=0.63', + 'ColourReconnection:range=5.176', + 'SigmaTotal:zeroAXB=off', + 'SpaceShower:alphaSorder=2', + 'SpaceShower:alphaSvalue=0.118', + 'SigmaProcess:alphaSvalue=0.118', + 'SigmaProcess:alphaSorder=2', + 'MultipartonInteractions:alphaSvalue=0.118', + 'MultipartonInteractions:alphaSorder=2', + 'TimeShower:alphaSorder=2', + 'TimeShower:alphaSvalue=0.118', + 'SigmaTotal:mode = 0', + 'SigmaTotal:sigmaEl = 21.89', + 'SigmaTotal:sigmaTot = 100.309', + 'PDF:pSet=LHAPDF6:NNPDF31_nnlo_as_0118' + ), + pythia8CommonSettings = cms.vstring( + 'Tune:preferLHAPDF = 2', + 'Main:timesAllowErrors = 10000', + 'Check:epTolErr = 0.01', + 'Beams:setProductionScalesFromLHEF = off', + 'SLHA:keepSM = on', + 'SLHA:minMassSM = 1000.', + 'ParticleDecays:limitTau0 = on', + 'ParticleDecays:tau0Max = 10', + 'ParticleDecays:allowPhotonRadiation = on' + ) + ), + comEnergy = cms.double(14000.0), + filterEfficiency = cms.untracked.double(1.0), + maxEventsToPrint = cms.untracked.int32(0), + pythiaHepMCVerbosity = cms.untracked.bool(False), + pythiaPylistVerbosity = cms.untracked.int32(0) +) + + +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.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.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/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step1_cfg.py b/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step1_cfg.py index b51379bd99970..ce708536b18f4 100644 --- a/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step1_cfg.py +++ b/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step1_cfg.py @@ -19,8 +19,11 @@ process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.load('Configuration.Geometry.GeometryExtended2021_cff') # there w -process.MessageLogger.categories.append("TrackerGeometryBuilder"); -process.MessageLogger.categories.append("TrackerSimInfoNumbering"); +#if hasattr(process,'MessageLogger'): +# process.MessageLogger.categories.append('Geometry') +# process.MessageLogger.categories.append('EcalGeom') +# process.MessageLogger.categories.append("TrackerGeometryBuilder"); +# process.MessageLogger.categories.append("TrackerSimInfoNumbering"); process.maxEvents = cms.untracked.PSet( diff --git a/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step2_cfg.py b/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step2_cfg.py index 981400f1d6f1d..3cfb0e3a015a8 100644 --- a/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step2_cfg.py +++ b/SimG4Core/Configuration/test/ddd_ZMM_Run3_Step2_cfg.py @@ -19,6 +19,10 @@ process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +#if hasattr(process,'MessageLogger'): +# process.MessageLogger.categories.append('GEMGeometry') +# process.MessageLogger.categories.append('CaloGeometryBuilder') + process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10), output = cms.optional.untracked.allowed(cms.int32,cms.PSet) From c5bf46c8b57a97554fe8fddf1cf078c21cabf061 Mon Sep 17 00:00:00 2001 From: Sunanda Date: Thu, 15 Oct 2020 22:08:07 +0200 Subject: [PATCH 2/2] Code check --- SimG4CMS/Calo/plugins/EcalSimHitDump.cc | 59 ++++++++++++------------- SimG4CMS/Calo/src/CaloSD.cc | 3 +- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/SimG4CMS/Calo/plugins/EcalSimHitDump.cc b/SimG4CMS/Calo/plugins/EcalSimHitDump.cc index a7f2a655a7926..110b794a023d4 100644 --- a/SimG4CMS/Calo/plugins/EcalSimHitDump.cc +++ b/SimG4CMS/Calo/plugins/EcalSimHitDump.cc @@ -28,31 +28,28 @@ class EcalSimHitDump : public edm::one::EDAnalyzer<> { void analyze(edm::Event const&, edm::EventSetup const&) override; private: - const std::string g4Label_; const std::vector hitLab_; - const std::vector > toksCalo_; + const std::vector> toksCalo_; const std::vector types_; const int maxEvent_; int kount_; }; -EcalSimHitDump::EcalSimHitDump(const edm::ParameterSet& ps) : - g4Label_(ps.getParameter("ModuleLabel")), - hitLab_(ps.getParameter>("HitCollections")), - toksCalo_{ - edm::vector_transform(hitLab_, - [this](const std::string& name) { - return consumes( - edm::InputTag{g4Label_, name}); - })}, - types_(ps.getParameter>("CollectionTypes")), - maxEvent_(ps.getParameter("MaxEvent")), - kount_(0) { - - edm::LogVerbatim("HitStudy") << "Module Label: " << g4Label_ << " with " << hitLab_.size() << " collections and maxEvent = " << maxEvent_; - for (unsigned int k = 0; k < hitLab_.size(); ++k) - edm::LogVerbatim("HitStudy") << "[" << k << "] Type " << types_[k] << " Label " << hitLab_[k]; +EcalSimHitDump::EcalSimHitDump(const edm::ParameterSet& ps) + : g4Label_(ps.getParameter("ModuleLabel")), + hitLab_(ps.getParameter>("HitCollections")), + toksCalo_{edm::vector_transform(hitLab_, + [this](const std::string& name) { + return consumes(edm::InputTag{g4Label_, name}); + })}, + types_(ps.getParameter>("CollectionTypes")), + maxEvent_(ps.getParameter("MaxEvent")), + kount_(0) { + edm::LogVerbatim("HitStudy") << "Module Label: " << g4Label_ << " with " << hitLab_.size() + << " collections and maxEvent = " << maxEvent_; + for (unsigned int k = 0; k < hitLab_.size(); ++k) + edm::LogVerbatim("HitStudy") << "[" << k << "] Type " << types_[k] << " Label " << hitLab_[k]; } void EcalSimHitDump::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { @@ -60,8 +57,8 @@ void EcalSimHitDump::fillDescriptions(edm::ConfigurationDescriptions& descriptio std::vector coll = {"EcalHitsEB", "EcalHitsEE", "EcalHitsES"}; std::vector type = {0, 1, 2}; desc.add("ModuleLabel", "g4SimHits"); - desc.add >("HitCollections", coll); - desc.add >("CollectionTypes", type); + desc.add>("HitCollections", coll); + desc.add>("CollectionTypes", type); desc.add("MaxEvent", 10); descriptions.add("ecalSimHitDump", desc); } @@ -75,19 +72,19 @@ void EcalSimHitDump::analyze(const edm::Event& e, const edm::EventSetup&) { edm::Handle hitsCalo; e.getByToken(toksCalo_[k], hitsCalo); if (hitsCalo.isValid()) - edm::LogVerbatim("HitStudy") << "EcalSimHitDump: Input " << hitsCalo->size() << " hits of type " << types_[k]; + edm::LogVerbatim("HitStudy") << "EcalSimHitDump: Input " << hitsCalo->size() << " hits of type " << types_[k]; unsigned int i(0); for (auto const& hit : *hitsCalo) { - double edep = hit.energy(); - double time = hit.time(); - unsigned int id = hit.id(); - if (types_[k] == 0) - edm::LogVerbatim("HitStudy") << "[" << i << "] " << EBDetId(id) << " E" << edep << " T " << time; - else if (types_[k] == 1) - edm::LogVerbatim("HitStudy") << "[" << i << "] " << EEDetId(id) << " E" << edep << " T " << time; - else - edm::LogVerbatim("HitStudy") << "[" << i << "] " << ESDetId(id) << " E" << edep << " T " << time; - ++i; + double edep = hit.energy(); + double time = hit.time(); + unsigned int id = hit.id(); + if (types_[k] == 0) + edm::LogVerbatim("HitStudy") << "[" << i << "] " << EBDetId(id) << " E" << edep << " T " << time; + else if (types_[k] == 1) + edm::LogVerbatim("HitStudy") << "[" << i << "] " << EEDetId(id) << " E" << edep << " T " << time; + else + edm::LogVerbatim("HitStudy") << "[" << i << "] " << ESDetId(id) << " E" << edep << " T " << time; + ++i; } } } diff --git a/SimG4CMS/Calo/src/CaloSD.cc b/SimG4CMS/Calo/src/CaloSD.cc index 4f98c899d4223..c361fc56c7d75 100644 --- a/SimG4CMS/Calo/src/CaloSD.cc +++ b/SimG4CMS/Calo/src/CaloSD.cc @@ -295,7 +295,8 @@ void CaloSD::PrintAll() { void CaloSD::fillHits(edm::PCaloHitContainer& cc, const std::string& hname) { #ifdef EDM_ML_DEBUG - edm::LogVerbatim("CaloSim") << "CaloSD: Tries to transfer " << slave.get()->hits().size() << " hits for " << slave.get()->name() << " " << hname; + edm::LogVerbatim("CaloSim") << "CaloSD: Tries to transfer " << slave.get()->hits().size() << " hits for " + << slave.get()->name() << " " << hname; #endif if (slave.get()->name() == hname) { cc = slave.get()->hits();