-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to fix GeometryProducer and G4e examples #38864
Changes from 2 commits
37ea99a
84ea5ec
2816210
386cf0d
264a5ff
c8c63c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -331,18 +331,20 @@ void Geant4ePropagatorAnalyzer::analyze(const edm::Event &iEvent, const edm::Eve | |
/////////////////////////////////////// | ||
// Get the sim tracks & vertices | ||
Handle<SimTrackContainer> simTracks; | ||
iEvent.getByLabel<SimTrackContainer>(G4TrkSrc_, simTracks); | ||
iEvent.getByLabel<SimTrackContainer>("g4SimHits", "", simTracks); | ||
if (!simTracks.isValid()) { | ||
LogWarning("Geant4e") << "No tracks found" << std::endl; | ||
return; | ||
// return; | ||
} | ||
LogDebug("Geant4e") << "G4e -- Got simTracks of size " << simTracks->size(); | ||
std::cout << "Geant4e " | ||
<< "G4e -- Got simTracks of size " << simTracks->size() << std::endl; | ||
|
||
Handle<SimVertexContainer> simVertices; | ||
iEvent.getByLabel<SimVertexContainer>(G4VtxSrc_, simVertices); | ||
iEvent.getByLabel<SimVertexContainer>("g4SimHits", simVertices); | ||
if (!simVertices.isValid()) { | ||
LogWarning("Geant4e") << "No tracks found" << std::endl; | ||
return; | ||
LogWarning("Geant4e") << "No verticess found" << std::endl; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. typo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for spotting. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably unrelated, but about
Shouldn't be tokens used instead? https://twiki.cern.ch/twiki/bin/view/CMSPublic/SWGuideEDMGetDataFromEvent#get_ByToken AFAIK There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Correct, and I would have expected too to see a different exception (complaining about missing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. deprecated should not mean not working... (or message should indeed say something different) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does one really has to consume each single product used? is there a script that generate the boilerplate? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes.
Yes.
No.
The consumes information is used also for input file to read in only those branches that are actually needed by the module.
I'm not aware of any. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added
in the constructor. getByLabel still produces the very same error as above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The point of the migration is to use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to note that the exception message has been improved for this particular corner case in #38875. About
in this case the
In that case the |
||
// return; | ||
} | ||
LogDebug("Geant4e") << "Got simVertices of size " << simVertices->size(); | ||
|
||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
import FWCore.ParameterSet.Config as cms | ||
|
||
process = cms.Process("PROPAGATORTEST") | ||
|
||
|
||
|
||
##################################################################### | ||
# Message Logger #################################################### | ||
# | ||
process.load("FWCore.MessageService.MessageLogger_cfi") | ||
process.load('Configuration.StandardSequences.Services_cff') | ||
process.load('Configuration.StandardSequences.GeometryDB_cff') | ||
process.load("Configuration.EventContent.EventContent_cff") | ||
process.load("Configuration.StandardSequences.Reconstruction_cff") | ||
process.load('Configuration.StandardSequences.MagneticField_38T_cff') | ||
process.load('Configuration.StandardSequences.EndOfProcess_cff') | ||
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff") | ||
|
||
from Configuration.AlCa.GlobalTag import GlobalTag | ||
process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run1_mc', '') | ||
# process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase1_2022_realistic', '') | ||
|
||
process.load("FWCore.MessageService.MessageLogger_cfi") | ||
|
||
# MessageLogger customizations | ||
process.MessageLogger.cerr.enable = False | ||
process.MessageLogger.cout.enable = True | ||
labels = ["propAna", "geopro"] # Python module's label | ||
messageLogger = dict() | ||
for category in labels: | ||
main_key = '%sMessageLogger'%(category) | ||
category_key = 'Geant4e' # C++ EDProducer type | ||
messageLogger[main_key] = dict( | ||
filename = '%s_%s.log' % ("debugG4e", category), | ||
threshold = 'DEBUG', | ||
default = dict(limit=0) | ||
) | ||
messageLogger[main_key][category_key] = dict(limit=-1) | ||
# First create defaults | ||
setattr(process.MessageLogger.files, category, dict()) | ||
# Then modify them | ||
setattr(process.MessageLogger.files, category, messageLogger[main_key]) | ||
|
||
|
||
##################################################################### | ||
# Pool Source ####################################################### | ||
# | ||
process.source = cms.Source("PoolSource", | ||
fileNames = cms.untracked.vstring("file:step1.root") | ||
# '/store/relval/CMSSW_12_5_0_pre3/RelValSingleMuPt10/GEN-SIM-RECO/124X_mcRun3_2022_realistic_v8-v2/10000/6a6528c0-9d66-4358-bacc-158c40b439cf.root' | ||
) | ||
|
||
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(20) ) | ||
|
||
## Load propagator | ||
from TrackPropagation.Geant4e.Geant4ePropagator_cfi import * | ||
|
||
|
||
from TrackingTools.TrackRefitter.TracksToTrajectories_cff import * | ||
|
||
## Set up geometry | ||
process.geopro = cms.EDProducer("GeometryProducer", | ||
UseMagneticField = cms.bool(True), | ||
UseSensitiveDetectors = cms.bool(False), | ||
MagneticField = cms.PSet( | ||
UseLocalMagFieldManager = cms.bool(False), | ||
Verbosity = cms.bool(False), | ||
ConfGlobalMFM = cms.PSet( | ||
Volume = cms.string('OCMS'), | ||
OCMS = cms.PSet( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
Stepper = cms.string('G4TDormandPrince45'), | ||
Type = cms.string('CMSIMField'), | ||
StepperParam = cms.PSet( | ||
VacRegions = cms.vstring(), | ||
# VacRegions = cms.vstring('DefaultRegionForTheWorld','BeamPipeVacuum','BeamPipeOutside'), | ||
EnergyThTracker = cms.double(0.2), ## in GeV | ||
RmaxTracker = cms.double(8000), ## in mm | ||
ZmaxTracker = cms.double(11000), ## in mm | ||
MaximumEpsilonStep = cms.untracked.double(0.01), | ||
DeltaOneStep = cms.double(0.001), ## in mm | ||
DeltaOneStepTracker = cms.double(1e-4),## in mm | ||
MaximumLoopCounts = cms.untracked.double(1000.0), | ||
DeltaChord = cms.double(0.002), ## in mm | ||
DeltaChordTracker = cms.double(0.001), ## in mm | ||
MinStep = cms.double(0.1), ## in mm | ||
DeltaIntersectionAndOneStep = cms.untracked.double(-1.0), | ||
DeltaIntersection = cms.double(0.0001), ## in mm | ||
DeltaIntersectionTracker = cms.double(1e-6),## in mm | ||
MaxStep = cms.double(150.), ## in cm | ||
MinimumEpsilonStep = cms.untracked.double(1e-05), | ||
EnergyThSimple = cms.double(0.015), ## in GeV | ||
DeltaChordSimple = cms.double(0.1), ## in mm | ||
DeltaOneStepSimple = cms.double(0.1), ## in mm | ||
DeltaIntersectionSimple = cms.double(0.01), ## in mm | ||
MaxStepSimple = cms.double(50.), ## in cm | ||
) | ||
) | ||
), | ||
delta = cms.double(1.0) | ||
), | ||
) | ||
|
||
|
||
|
||
|
||
##################################################################### | ||
# Extrapolator ###################################################### | ||
# | ||
process.propAna = cms.EDAnalyzer("Geant4ePropagatorAnalyzer", | ||
G4VtxSrc = cms.InputTag("g4SimHits"), | ||
G4TrkSrc = cms.InputTag("g4SimHits"), | ||
RootFile = cms.string("Geant4e.root"), | ||
BeamCenter = cms.double(0), #degrees | ||
BeamInterval = cms.double(20), #degrees | ||
StudyStation = cms.int32(-1) #Station that we want to study. -1 for all. | ||
) | ||
|
||
|
||
process.g4AnalPath = cms.Path( process.geopro*process.propAna ) | ||
process.schedule = cms.Schedule( process.g4AnalPath ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't this PSet be taken from somewhere else, so that we can avoid staying in synch manually?