Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 11:27:55

0001 ###############################################################################
0002 # Way to use this:
0003 #   cmsRun protoValid_cfg.py geometry=D88 type=hgcalSimHitStudy defaultInput=1
0004 #
0005 #   Options for geometry D88, D92, D93
0006 #               type hgcalGeomCheck, hgcalSimHitStudy, hgcalDigiStudy,
0007 #                    hgcalRecHitStudy, hgcalSiliconValidation
0008 #               defaultInput 1, 0
0009 #
0010 ###############################################################################
0011 import FWCore.ParameterSet.Config as cms
0012 import os, sys, imp, re
0013 import FWCore.ParameterSet.VarParsing as VarParsing
0014 
0015 ############################################################
0016 ### SETUP OPTIONS
0017 options = VarParsing.VarParsing('standard')
0018 options.register('geometry',
0019                  "D88",
0020                   VarParsing.VarParsing.multiplicity.singleton,
0021                   VarParsing.VarParsing.varType.string,
0022                   "geometry of operations: D88, D92, D93")
0023 options.register('type',
0024                  "hgcalGeomCheck",
0025                  VarParsing.VarParsing.multiplicity.singleton,
0026                  VarParsing.VarParsing.varType.string,
0027                  "type of operations: hgcalGeomCheck, hgcalSimHitStudy, hgcalDigiStudy, hgcalRecHitStudy, hgcalSiliconValidation")
0028 options.register('defaultInput',
0029                  1, # default Value = true
0030                  VarParsing.VarParsing.multiplicity.singleton,
0031                  VarParsing.VarParsing.varType.int,
0032                  "change files path in case of defaultInput=0 for using DIGI o/p")
0033 
0034 ### get and parse the command line arguments
0035 options.parseArguments()
0036 
0037 print(options)
0038 
0039 ############################################################
0040 # Use the options
0041 
0042 from Configuration.Eras.Era_Phase2C17I13M9_cff import Phase2C17I13M9
0043 process = cms.Process('PROD',Phase2C17I13M9)
0044 
0045 geomFile = "Configuration.Geometry.GeometryExtended2026" + options.geometry + "Reco_cff"
0046 fileCheck = "testHGCalSimWatcher" + options.geometry + ".root"
0047 if (options.type == "hgcalSimHitStudy"):
0048     fileName = "hgcSimHit" + options.geometry + ".root"
0049 elif (options.type == "hgcalDigiStudy"):
0050     fileName = "hgcDigi" + options.geometry + ".root"
0051 elif (options.type == "hgcalRecHitStudy"):
0052     fileName = "hgcRecHit" + options.geometry + ".root"
0053 elif (options.type == "hgcalSiliconValidation"):
0054     if (options.defaultInput == 0):
0055         fileName = "hgcDigValid" + options.geometry + ".root"
0056     else:
0057         fileName = "hgcSilValid" + options.geometry + ".root"
0058 else:
0059     fileName = "hgcGeomCheck" + options.geometry + ".root"
0060 
0061 print("Geometry file: ", geomFile)
0062 print("Output file:   ", fileName)
0063 
0064 process.load(geomFile)
0065 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0066 process.load("Configuration.StandardSequences.MagneticField_cff")
0067 process.load('Configuration.StandardSequences.Services_cff')
0068 process.load("Configuration.EventContent.EventContent_cff")
0069 process.load('FWCore.MessageService.MessageLogger_cfi')
0070 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0071 from Configuration.AlCa.autoCond import autoCond
0072 process.GlobalTag.globaltag = autoCond['phase2_realistic']
0073 
0074 process.MessageLogger.cerr.FwkReport.reportEvery = 5
0075 if hasattr(process,'MessageLogger'):
0076     process.MessageLogger.HGCalGeom=dict()
0077 
0078 if (options.type == "hgcalSimHitStudy"):
0079     process.load('Validation.HGCalValidation.hgcSimHitStudy_cfi')
0080     process.source = cms.Source("PoolSource",
0081                                 fileNames = cms.untracked.vstring('file:step1.root') )
0082     process.analysis_step = cms.Path(process.hgcalSimHitStudy)
0083 elif (options.type == "hgcalDigiStudy"):
0084     process.load('Configuration.StandardSequences.RawToDigi_cff')
0085     process.load('Validation.HGCalValidation.hgcDigiStudy_cfi')
0086     process.source = cms.Source("PoolSource",
0087                                 fileNames = cms.untracked.vstring('file:step2.root') )
0088     process.analysis_step = cms.Path(process.RawToDigi+process.hgcalDigiStudyEE+process.hgcalDigiStudyHEF+process.hgcalDigiStudyHEB)
0089 elif (options.type == "hgcalRecHitStudy"):
0090     process.load('Validation.HGCalValidation.hgcalRecHitStudy_cff')
0091     process.source = cms.Source("PoolSource",
0092                                 fileNames = cms.untracked.vstring('file:step3.root') )
0093     process.analysis_step = cms.Path(process.hgcalRecHitStudyEE+process.hgcalRecHitStudyFH+process.hgcalRecHitStudyBH)
0094 elif (options.type == "hgcalSiliconValidation"):
0095     if (options.defaultInput == 0):
0096         fileIn = "file:step2.root"
0097     else:
0098         fileIn = "file:step1.root"
0099     process.load('Validation.HGCalValidation.hgcalSiliconValidation_cfi')
0100     process.source = cms.Source("PoolSource",
0101                                 fileNames = cms.untracked.vstring(fileIn) )
0102     process.analysis_step = cms.Path(process.hgcalSiliconAnalysisEE+process.hgcalSiliconAnalysisHEF)
0103 else:
0104     process.load('Validation.HGCalValidation.hgcGeomCheck_cff')
0105     process.source = cms.Source("PoolSource",
0106                                 fileNames = cms.untracked.vstring(fileCheck)
0107     )
0108     process.analysis_step = cms.Path(process.hgcGeomCheck)
0109 
0110 
0111 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) )
0112 process.TFileService = cms.Service("TFileService",
0113                                    fileName = cms.string(fileName),
0114                                    closeFileFast = cms.untracked.bool(True) )
0115 process.options = cms.untracked.PSet(
0116     wantSummary = cms.untracked.bool(True)
0117 )
0118 
0119 # Schedule definition
0120 process.schedule = cms.Schedule(process.analysis_step)