diff --git a/SimG4CMS/HGCalTestBeam/CaloUtil.xml b/SimG4CMS/HGCalTestBeam/CaloUtil.xml
deleted file mode 100644
index 2619c0b700090..0000000000000
--- a/SimG4CMS/HGCalTestBeam/CaloUtil.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/SimG4CMS/HGCalTestBeam/data/dd4hep/HGCalTB181Oct1.xml b/SimG4CMS/HGCalTestBeam/data/dd4hep/HGCalTB181Oct1.xml
new file mode 100644
index 0000000000000..b07ea40251d0d
--- /dev/null
+++ b/SimG4CMS/HGCalTestBeam/data/dd4hep/HGCalTB181Oct1.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.h b/SimG4CMS/HGCalTestBeam/interface/HGCPassive.h
similarity index 99%
rename from SimG4CMS/HGCalTestBeam/plugins/HGCPassive.h
rename to SimG4CMS/HGCalTestBeam/interface/HGCPassive.h
index ecc9881bb3fe4..089792fe19c6d 100644
--- a/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.h
+++ b/SimG4CMS/HGCalTestBeam/interface/HGCPassive.h
@@ -68,6 +68,7 @@ class HGCPassive : public SimProducer,
G4LogicalVolume *topLV_;
std::map> mapLV_;
std::string motherName_;
+ int addlevel_;
// some private members for ananlysis
unsigned int count_;
diff --git a/SimG4CMS/HGCalTestBeam/plugins/BuildFile.xml b/SimG4CMS/HGCalTestBeam/plugins/BuildFile.xml
index 34d2dbe586930..3028adccff3da 100644
--- a/SimG4CMS/HGCalTestBeam/plugins/BuildFile.xml
+++ b/SimG4CMS/HGCalTestBeam/plugins/BuildFile.xml
@@ -18,6 +18,7 @@
+
diff --git a/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc b/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc
index 151bc145d3eab..3012c17a4873b 100644
--- a/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc
+++ b/SimG4CMS/HGCalTestBeam/plugins/HGCPassive.cc
@@ -4,12 +4,13 @@
// Description: Main analysis class for HGCal Validation of G4 Hits
///////////////////////////////////////////////////////////////////////////////
-#include "HGCPassive.h"
+#include "SimG4CMS/HGCalTestBeam/interface/HGCPassive.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "CLHEP/Units/GlobalPhysicalConstants.h"
#include "CLHEP/Units/GlobalSystemOfUnits.h"
#include "G4TransportationManager.hh"
+#include "DD4hep/Filter.h"
#include
#include
@@ -23,9 +24,11 @@ HGCPassive::HGCPassive(const edm::ParameterSet& p) : topPV_(nullptr), topLV_(nul
edm::ParameterSet m_Passive = p.getParameter("HGCPassive");
LVNames_ = m_Passive.getParameter >("LVNames");
motherName_ = m_Passive.getParameter("MotherName");
+ bool dd4hep = m_Passive.getParameter("IfDD4Hep");
+ addlevel_ = dd4hep ? 1 : 0;
#ifdef EDM_ML_DEBUG
- edm::LogVerbatim("HGCSim") << "Name of the mother volume " << motherName_;
+ edm::LogVerbatim("HGCSim") << "Name of the mother volume " << motherName_ << " AddLevel " << addlevel_;
unsigned k(0);
#endif
for (const auto& name : LVNames_) {
@@ -86,6 +89,7 @@ void HGCPassive::update(const G4Step* aStep) {
G4VSensitiveDetector* curSD = aStep->GetPreStepPoint()->GetSensitiveDetector();
const G4VTouchable* touchable = aStep->GetPreStepPoint()->GetTouchable();
+ int level = (touchable->GetHistoryDepth());
if (curSD == nullptr) {
G4LogicalVolume* plv = touchable->GetVolume()->GetLogicalVolume();
auto it = (init_) ? mapLV_.find(plv) : findLV(plv);
@@ -96,8 +100,8 @@ void HGCPassive::update(const G4Step* aStep) {
if (((aStep->GetPostStepPoint() == nullptr) || (aStep->GetTrack()->GetNextVolume() == nullptr)) &&
(aStep->IsLastStepInVolume())) {
#ifdef EDM_ML_DEBUG
- edm::LogVerbatim("HGCSim") << plv->GetName() << " F|L Step " << aStep->IsFirstStepInVolume() << ":"
- << aStep->IsLastStepInVolume() << " Position"
+ edm::LogVerbatim("HGCSim") << static_cast(dd4hep::dd::noNamespace(plv->GetName())) << " F|L Step "
+ << aStep->IsFirstStepInVolume() << ":" << aStep->IsLastStepInVolume() << " Position"
<< aStep->GetPreStepPoint()->GetPosition() << " Track "
<< aStep->GetTrack()->GetDefinition()->GetParticleName() << " at"
<< aStep->GetTrack()->GetPosition() << " Volume " << aStep->GetTrack()->GetVolume()
@@ -109,7 +113,9 @@ void HGCPassive::update(const G4Step* aStep) {
energy += (aStep->GetPreStepPoint()->GetKineticEnergy() / CLHEP::GeV);
} else {
time = (aStep->GetPostStepPoint()->GetGlobalTime());
- copy = (unsigned int)(touchable->GetReplicaNumber(0) + 1000 * touchable->GetReplicaNumber(1));
+ copy = (level < 2)
+ ? 0
+ : static_cast(touchable->GetReplicaNumber(0) + 1000 * touchable->GetReplicaNumber(1));
}
if (it != mapLV_.end()) {
storeInfo(it, plv, copy, time, energy, true);
@@ -122,7 +128,6 @@ void HGCPassive::update(const G4Step* aStep) {
} // if (curSD==NULL)
// Now for the mother volumes
- int level = (touchable->GetHistoryDepth());
if (level > 0) {
double energy = (aStep->GetTotalEnergyDeposit()) / CLHEP::GeV;
double time = (aStep->GetTrack()->GetGlobalTime());
@@ -131,8 +136,9 @@ void HGCPassive::update(const G4Step* aStep) {
G4LogicalVolume* plv = touchable->GetVolume(i)->GetLogicalVolume();
auto it = (init_) ? mapLV_.find(plv) : findLV(plv);
#ifdef EDM_ML_DEBUG
- edm::LogVerbatim("HGCSim") << "Level: " << level << ":" << i << " " << plv->GetName() << " flag in the List "
- << (it != mapLV_.end());
+ edm::LogVerbatim("HGCSim") << "Level: " << level << ":" << i << " "
+ << static_cast(dd4hep::dd::noNamespace(plv->GetName()))
+ << " flag in the List " << (it != mapLV_.end());
#endif
if (it != mapLV_.end()) {
unsigned int copy =
@@ -176,7 +182,7 @@ G4VPhysicalVolume* HGCPassive::getTopPV() {
HGCPassive::volumeIterator HGCPassive::findLV(G4LogicalVolume* plv) {
auto itr = mapLV_.find(plv);
if (itr == mapLV_.end()) {
- std::string name = plv->GetName();
+ std::string name = static_cast(dd4hep::dd::noNamespace(plv->GetName()));
for (unsigned int k = 0; k < LVNames_.size(); ++k) {
if (name.find(LVNames_[k]) != std::string::npos) {
mapLV_[plv] = std::pair(k, name);
@@ -186,7 +192,7 @@ HGCPassive::volumeIterator HGCPassive::findLV(G4LogicalVolume* plv) {
}
}
if (topLV_ == nullptr) {
- if (std::string(plv->GetName()) == motherName_)
+ if (static_cast(dd4hep::dd::noNamespace(plv->GetName())) == motherName_)
topLV_ = plv;
}
return itr;
diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py
index d4bd99d3db2b9..ffebf5a7ea94d 100644
--- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py
+++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN170_cfg.py
@@ -101,9 +101,10 @@
'HcalTB06BeamDetector']
process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
HGCPassive = cms.PSet(
- LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
- MotherName = cms.string('OCMS'),
- ),
+ LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
+ MotherName = cms.string('OCMS'),
+ IfDD4Hep = cms.bool(False),
+ ),
type = cms.string('HGCPassive'),
)
)
diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4Hep_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4Hep_cfg.py
new file mode 100644
index 0000000000000..b6ce1cd26dbd1
--- /dev/null
+++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1DD4Hep_cfg.py
@@ -0,0 +1,151 @@
+import FWCore.ParameterSet.Config as cms
+from Configuration.ProcessModifiers.dd4hep_cff import dd4hep
+
+process = cms.Process('SIM',dd4hep)
+
+# import of standard configurations
+process.load("FWCore.MessageService.MessageLogger_cfi")
+process.load('Configuration.StandardSequences.Services_cff')
+process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
+process.load('Configuration.EventContent.EventContent_cff')
+process.load('SimGeneral.MixingModule.mixNoPU_cfi')
+process.load("Configuration.Geometry.GeometryDD4hep_cff")
+process.load('Geometry.HGCalCommonData.hgcalNumberingInitialization_cfi')
+process.load('Geometry.HGCalCommonData.hgcalParametersInitialization_cfi')
+process.load('Geometry.HcalTestBeamData.hcalTB06Parameters_cff')
+process.load('Configuration.StandardSequences.MagneticField_0T_cff')
+process.load('Configuration.StandardSequences.Generator_cff')
+process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_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('SimG4CMS.HGCalTestBeam.HGCalTBAnalyzer_cfi')
+process.load('SimG4CMS.HGCalTestBeam.HGCalTBCheckGunPosition_cfi')
+
+process.maxEvents = cms.untracked.PSet(
+ input = cms.untracked.int32(10)
+)
+
+if 'MessageLogger' in process.__dict__:
+ process.MessageLogger.HGCalGeom=dict()
+ process.MessageLogger.HGCSim=dict()
+ process.MessageLogger.HcalSim=dict()
+ process.MessageLogger.HcalTB06BeamSD=dict()
+# process.MessageLogger.SimG4CoreGeometry=dict()
+
+# Input source
+process.source = cms.Source("EmptySource")
+
+process.options = cms.untracked.PSet(
+)
+
+# Production Info
+process.configurationMetadata = cms.untracked.PSet(
+ annotation = cms.untracked.string('SingleMuonE200_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:TBGenSim181Oct1DD4Hep.root'),
+ outputCommands = process.FEVTDEBUGEventContent.outputCommands,
+ splitLevel = cms.untracked.int32(0)
+)
+
+# Additional output definition
+process.TFileService = cms.Service("TFileService",
+ fileName = cms.string('TBGenSimDD4Hep.root')
+ )
+
+# Other statements
+process.genstepfilter.triggerConditions=cms.vstring("generation_step")
+from Configuration.AlCa.GlobalTag import GlobalTag
+process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '')
+
+process.generator = cms.EDProducer("FlatRandomEThetaGunProducer",
+ AddAntiParticle = cms.bool(False),
+ PGunParameters = cms.PSet(
+ MinE = cms.double(99.99),
+ MaxE = cms.double(100.01),
+ MinTheta = cms.double(0.0),
+ MaxTheta = cms.double(0.0),
+ MinPhi = cms.double(-3.14159265359),
+ MaxPhi = cms.double(3.14159265359),
+ PartID = cms.vint32(11)
+ ),
+ Verbosity = cms.untracked.int32(0),
+ firstRun = cms.untracked.uint32(1),
+ psethack = cms.string('single muon E 100')
+)
+process.VtxSmeared.MinZ = -800.0
+process.VtxSmeared.MaxZ = -800.0
+process.VtxSmeared.MinX = -7.5
+process.VtxSmeared.MaxX = 7.5
+process.VtxSmeared.MinY = -7.5
+process.VtxSmeared.MaxY = 7.5
+process.g4SimHits.HGCSD.RejectMouseBite = True
+process.g4SimHits.HGCSD.RotatedWafer = True
+process.g4SimHits.OnlySDs = ['AHcalSensitiveDetector',
+ 'HGCSensitiveDetector',
+ 'HGCalTB1601SensitiveDetector',
+ 'HcalTB06BeamDetector']
+process.DDDetectorESProducer.confGeomXMLFiles = cms.FileInPath("SimG4CMS/HGCalTestBeam/data/dd4hep/HGCalTB181Oct1.xml")
+
+process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
+ HGCPassive = cms.PSet(
+ LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
+ MotherName = cms.string('OCMS'),
+ IfDD4Hep = cms.bool(True),
+ ),
+ type = cms.string('HGCPassive'),
+ )
+ )
+process.HGCalTBAnalyzer.doDigis = False
+process.HGCalTBAnalyzer.doRecHits = False
+process.HGCalTBAnalyzer.useFH = True
+process.HGCalTBAnalyzer.useBH = True
+process.HGCalTBAnalyzer.useBeam = True
+process.HGCalTBAnalyzer.zFrontEE = 1110.0
+process.HGCalTBAnalyzer.zFrontFH = 1176.5
+process.HGCalTBAnalyzer.zFrontFH = 1307.5
+process.HGCalTBAnalyzer.maxDepth = 39
+process.HGCalTBAnalyzer.deltaZ = 26.2
+process.HGCalTBAnalyzer.zFirst = 22.8
+process.HGCalTBAnalyzer.doPassive = True
+process.HGCalTBAnalyzer.doPassiveEE = True
+process.HGCalTBAnalyzer.doPassiveHE = True
+process.HGCalTBAnalyzer.doPassiveBH = True
+
+# Path and EndPath definitions
+process.generation_step = cms.Path(process.pgen)
+process.gunfilter_step = cms.Path(process.HGCalTBCheckGunPostion)
+process.simulation_step = cms.Path(process.psim)
+process.genfiltersummary_step = cms.EndPath(process.genFilterSummary)
+process.analysis_step = cms.Path(process.HGCalTBAnalyzer)
+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.gunfilter_step,
+ process.analysis_step,
+ process.endjob_step,
+ process.FEVTDEBUGoutput_step
+ )
+# filter all path with the production filter sequence
+for path in process.paths:
+ getattr(process,path)._seq = process.generator * getattr(process,path)._seq
+
+
diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py
index 010dee6e59dd6..f7a646183257c 100644
--- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py
+++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1PC1mm_cfg.py
@@ -100,12 +100,13 @@
'HGCalTB1601SensitiveDetector',
'HcalTB06BeamDetector']
process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
- HGCPassive = cms.PSet(
- LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
- MotherName = cms.string('OCMS'),
- ),
- type = cms.string('HGCPassive'),
- )
+ HGCPassive = cms.PSet(
+ LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
+ MotherName = cms.string('OCMS'),
+ IfDD4Hep = cms.bool(False),
+ ),
+ type = cms.string('HGCPassive'),
+)
)
process.HGCalTBAnalyzer.doDigis = False
process.HGCalTBAnalyzer.doRecHits = False
diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py
index c732aa5c82699..dedf1c3e905b5 100644
--- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py
+++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1_cfg.py
@@ -100,9 +100,10 @@
'HcalTB06BeamDetector']
process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
HGCPassive = cms.PSet(
- LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
- MotherName = cms.string('OCMS'),
- ),
+ LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
+ MotherName = cms.string('OCMS'),
+ IfDD4Hep = cms.bool(False),
+ ),
type = cms.string('HGCPassive'),
)
)
diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py
index 936802a0d6d79..2ff18aae945a8 100644
--- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py
+++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct1el100_cfg.py
@@ -102,9 +102,10 @@
'HcalTB06BeamDetector']
process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
HGCPassive = cms.PSet(
- LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
- MotherName = cms.string('OCMS'),
- ),
+ LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
+ MotherName = cms.string('OCMS'),
+ IfDD4Hep = cms.bool(False),
+ ),
type = cms.string('HGCPassive'),
)
)
diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py
index 4aec57c9ae2dd..78e5591094328 100644
--- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py
+++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct2_cfg.py
@@ -100,9 +100,10 @@
'HcalTB06BeamDetector']
process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
HGCPassive = cms.PSet(
- LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
- MotherName = cms.string('OCMS'),
- ),
+ LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
+ MotherName = cms.string('OCMS'),
+ IfDD4Hep = cms.bool(False),
+ ),
type = cms.string('HGCPassive'),
)
)
diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py
index 380326c051e77..adfa709001079 100644
--- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py
+++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct3_cfg.py
@@ -100,9 +100,10 @@
'HcalTB06BeamDetector']
process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
HGCPassive = cms.PSet(
- LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
- MotherName = cms.string('OCMS'),
- ),
+ LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
+ MotherName = cms.string('OCMS'),
+ IfDD4Hep = cms.bool(False),
+ ),
type = cms.string('HGCPassive'),
)
)
diff --git a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py
index 50fce5576d0a9..26a3a41c82086 100644
--- a/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py
+++ b/SimG4CMS/HGCalTestBeam/test/HGCalTBCERN181Oct4_cfg.py
@@ -100,9 +100,10 @@
'HcalTB06BeamDetector']
process.g4SimHits.Watchers = cms.VPSet(cms.PSet(
HGCPassive = cms.PSet(
- LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
- MotherName = cms.string('OCMS'),
- ),
+ LVNames = cms.vstring('HGCalEE','HGCalHE','HGCalAH', 'HGCalBeam', 'CMSE'),
+ MotherName = cms.string('OCMS'),
+ IfDD4Hep = cms.bool(False),
+ ),
type = cms.string('HGCPassive'),
)
)