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