Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18371 from bsunanda/Run2-sim06
Run2-sim06 Add an example to produce geometry summary for a given configuration
- Loading branch information
Showing
9 changed files
with
518 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#ifndef SimG4Core_PrintGeomSummary_H | ||
#define SimG4Core_PrintGeomSummary_H | ||
|
||
#include "SimG4Core/Watcher/interface/SimWatcher.h" | ||
#include "SimG4Core/Notification/interface/Observer.h" | ||
#include "DetectorDescription/Core/interface/DDSolidShapes.h" | ||
#include "FWCore/ParameterSet/interface/ParameterSet.h" | ||
|
||
#include "G4NavigationHistory.hh" | ||
|
||
#include <algorithm> | ||
#include <iostream> | ||
#include <vector> | ||
#include <map> | ||
#include <string> | ||
|
||
class BeginOfJob; | ||
class BeginOfRun; | ||
class DDLogicalPart; | ||
class G4LogicalVolume; | ||
class G4VPhysicalVolume; | ||
class G4VSolid; | ||
|
||
class PrintGeomSummary : public SimWatcher, | ||
public Observer<const BeginOfJob *>, | ||
public Observer<const BeginOfRun *> { | ||
|
||
public: | ||
PrintGeomSummary(edm::ParameterSet const & p); | ||
~PrintGeomSummary(); | ||
|
||
private: | ||
void update(const BeginOfJob * job); | ||
void update(const BeginOfRun * run); | ||
void addSolid(const DDLogicalPart & part); | ||
void fillLV(G4LogicalVolume * lv); | ||
void dumpSummary(std::ostream& out, std::string name); | ||
G4VPhysicalVolume * getTopPV(); | ||
void addName(std::string name); | ||
void printSummary(std::ostream & out); | ||
|
||
private: | ||
std::vector<std::string> nodeNames_; | ||
std::map<DDSolidShape,std::string> solidShape_; | ||
std::map<std::string,DDSolidShape> solidMap_; | ||
G4VPhysicalVolume * theTopPV_; | ||
std::vector<G4LogicalVolume*> lvs_, touch_; | ||
std::vector<G4VSolid*> sls_; | ||
std::map<DDSolidShape,std::pair<int,int> > kount_; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
def printGeomInfo(process): | ||
|
||
process.load("SimGeneral.HepPDTESSource.pdt_cfi") | ||
|
||
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") | ||
process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi") | ||
process.load("Geometry.HcalCommonData.hcalParameters_cfi") | ||
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi") | ||
process.load("IOMC.RandomEngine.IOMC_cff") | ||
process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi') | ||
process.load('GeneratorInterface.Core.generatorSmeared_cfi') | ||
process.load('FWCore.MessageService.MessageLogger_cfi') | ||
|
||
process.load("SimG4Core.Application.g4SimHits_cfi") | ||
|
||
process.source = cms.Source("EmptySource") | ||
|
||
process.generator = cms.EDProducer("FlatRandomEGunProducer", | ||
PGunParameters = cms.PSet( | ||
PartID = cms.vint32(14), | ||
MinEta = cms.double(-3.5), | ||
MaxEta = cms.double(3.5), | ||
MinPhi = cms.double(-3.14159265359), | ||
MaxPhi = cms.double(3.14159265359), | ||
MinE = cms.double(9.99), | ||
MaxE = cms.double(10.01) | ||
), | ||
AddAntiParticle = cms.bool(False), | ||
Verbosity = cms.untracked.int32(0), | ||
firstRun = cms.untracked.uint32(1) | ||
) | ||
|
||
process.maxEvents = cms.untracked.PSet( | ||
input = cms.untracked.int32(1) | ||
) | ||
|
||
process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits) | ||
|
||
process.g4SimHits.UseMagneticField = False | ||
process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' | ||
process.g4SimHits.Physics.DummyEMPhysics = True | ||
process.g4SimHits.Physics.DefaultCutValue = 10. | ||
process.g4SimHits.Watchers = cms.VPSet(cms.PSet( | ||
DumpSummary = cms.untracked.bool(True), | ||
DumpLVTree = cms.untracked.bool(True), | ||
DumpMaterial = cms.untracked.bool(False), | ||
DumpLVList = cms.untracked.bool(True), | ||
DumpLV = cms.untracked.bool(True), | ||
DumpSolid = cms.untracked.bool(True), | ||
DumpAttributes = cms.untracked.bool(False), | ||
DumpPV = cms.untracked.bool(True), | ||
DumpRotation = cms.untracked.bool(False), | ||
DumpReplica = cms.untracked.bool(False), | ||
DumpTouch = cms.untracked.bool(False), | ||
DumpSense = cms.untracked.bool(False), | ||
Name = cms.untracked.string('TotemT*'), | ||
Names = cms.untracked.vstring(' '), | ||
type = cms.string('PrintGeomInfoAction') | ||
)) | ||
|
||
return(process) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
def printGeomSummary(process): | ||
|
||
process.load("SimGeneral.HepPDTESSource.pdt_cfi") | ||
|
||
process.load("Geometry.TrackerNumberingBuilder.trackerNumberingGeometry_cfi") | ||
process.load("Geometry.MuonNumbering.muonNumberingInitialization_cfi") | ||
process.load("Geometry.HcalCommonData.hcalParameters_cfi") | ||
process.load("Geometry.HcalCommonData.hcalDDDSimConstants_cfi") | ||
process.load("IOMC.RandomEngine.IOMC_cff") | ||
process.load('IOMC.EventVertexGenerators.VtxSmearedFlat_cfi') | ||
process.load('GeneratorInterface.Core.generatorSmeared_cfi') | ||
process.load('FWCore.MessageService.MessageLogger_cfi') | ||
|
||
process.load("SimG4Core.Application.g4SimHits_cfi") | ||
|
||
process.source = cms.Source("EmptySource") | ||
|
||
process.generator = cms.EDProducer("FlatRandomEGunProducer", | ||
PGunParameters = cms.PSet( | ||
PartID = cms.vint32(14), | ||
MinEta = cms.double(-3.5), | ||
MaxEta = cms.double(3.5), | ||
MinPhi = cms.double(-3.14159265359), | ||
MaxPhi = cms.double(3.14159265359), | ||
MinE = cms.double(9.99), | ||
MaxE = cms.double(10.01) | ||
), | ||
AddAntiParticle = cms.bool(False), | ||
Verbosity = cms.untracked.int32(0), | ||
firstRun = cms.untracked.uint32(1) | ||
) | ||
|
||
process.maxEvents = cms.untracked.PSet( | ||
input = cms.untracked.int32(1) | ||
) | ||
|
||
process.p1 = cms.Path(process.generator*process.VtxSmeared*process.generatorSmeared*process.g4SimHits) | ||
|
||
process.g4SimHits.UseMagneticField = False | ||
process.g4SimHits.Physics.type = 'SimG4Core/Physics/DummyPhysics' | ||
process.g4SimHits.Physics.DummyEMPhysics = True | ||
process.g4SimHits.Physics.DefaultCutValue = 10. | ||
process.g4SimHits.Watchers = cms.VPSet(cms.PSet( | ||
NodeNames = cms.untracked.vstring(), | ||
type = cms.string('PrintGeomSummary') | ||
)) | ||
|
||
return(process) |
Oops, something went wrong.