Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:05

0001 #! /usr/bin/env cmsRun
0002 
0003 import FWCore.ParameterSet.Config as cms
0004 
0005 process = cms.Process("MaterialAnalyser")
0006 
0007 
0008 # Configuration and Conditions
0009 # We cannot read the geometry from the DB, since we have to inject out custom-made
0010 # material-budget grouping into the DDD of the detector. So we need to read the
0011 # geometry using the XMLIdealGeometryRecord.
0012 process.load('Configuration.Geometry.GeometryExtended2016Reco_cff')
0013 process.load("Configuration.StandardSequences.MagneticField_38T_cff")
0014 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0015 process.load('FWCore.MessageService.MessageLogger_cfi')
0016 #Global Tag
0017 from Configuration.AlCa.GlobalTag import GlobalTag
0018 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_mc', '')
0019 
0020 # Add our custom detector grouping to DDD
0021 process.XMLIdealGeometryESSource.geomXMLFiles.extend(['SimTracker/TrackerMaterialAnalysis/data/trackingMaterialGroups.xml'])
0022 
0023 # Analyze and plot the tracking material
0024 process.load("SimTracker.TrackerMaterialAnalysis.trackingMaterialAnalyser_cff")
0025 process.trackingMaterialAnalyser.SplitMode         = "NearestLayer"
0026 process.trackingMaterialAnalyser.SaveParameters    = True
0027 process.trackingMaterialAnalyser.SaveXML           = True
0028 process.trackingMaterialAnalyser.SaveDetailedPlots = False
0029   
0030 process.source = cms.Source("PoolSource",
0031     fileNames = cms.untracked.vstring('file:material.root')
0032 )
0033 process.maxEvents = cms.untracked.PSet(
0034     input = cms.untracked.int32(-1)
0035 )
0036 
0037 process.path = cms.Path(process.trackingMaterialAnalyser)
0038 
0039 
0040 def customizeMessageLogger(process):
0041     ### Easy customisation of MessageLogger ###
0042     # 1. Extend MessageLogger to monitor all modules: the * means any
0043     #    label for all defined python modules
0044     process.MessageLogger.debugModules.extend(['*'])
0045     # 2. Define destination and its default logging properties
0046     how_to_debug = cms.untracked.PSet(threshold = cms.untracked.string("DEBUG"),
0047                                       DEBUG = cms.untracked.PSet(limit = cms.untracked.int32(0)),
0048                                       default = cms.untracked.PSet(limit = cms.untracked.int32(0)),
0049                                       )
0050     # 3. Attach destination and its logging properties to the main process
0051     process.MessageLogger.files.debugTrackingMaterialAnalyzer = how_to_debug
0052     # 4. Define and extend the categories we would like to monitor
0053     log_debug_categories = ['TrackingMaterialAnalyser']
0054     
0055 
0056     # 5. Extend the configuration of the configured destination so that it
0057     #    will trace all messages coming from the list of specified
0058     #    categories.
0059     unlimit_debug = cms.untracked.PSet(limit = cms.untracked.int32(-1))
0060     for val in log_debug_categories:
0061         setattr(process.MessageLogger.files.debugTrackingMaterialAnalyzer,val, unlimit_debug)
0062 
0063     return process
0064 
0065 
0066 process = customizeMessageLogger(process)