Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 23:29:38

0001 from __future__ import print_function
0002 import FWCore.ParameterSet.Config as cms
0003 from PhysicsTools.PatAlgos.patInputFiles_cff import filesRelValTTbarPileUpGENSIMRECO
0004 import FWCore.ParameterSet.VarParsing as VarParsing
0005 from CalibTracker.SiStripCommon.shallowTree_test_template import *
0006 
0007 ###################################################################
0008 def alterTriggersForUnitTest(process):
0009 ###################################################################
0010     '''
0011     These modification as necessary only in order to run on a
0012     RelVal MC in which the physics menu is not simulated!
0013     '''
0014     if(hasattr(process,'AAGFilter')):
0015         process.AAGFilter.triggerConditions = ["HLT_Random_v*"]
0016     if(hasattr(process,'IsolatedMuonFilter')):
0017         process.IsolatedMuonFilter.triggerConditions = ["MC_IsoMu_v*"]
0018 
0019     return process
0020 
0021 ###################################################################
0022 # Setup 'standard' options
0023 ###################################################################
0024 options = VarParsing.VarParsing()
0025 
0026 options.register('conditionGT',
0027                  "auto:phase1_2017_realistic",
0028                  VarParsing.VarParsing.multiplicity.singleton,
0029                  VarParsing.VarParsing.varType.string,
0030                  "condition global tag for the job (\"auto:phase1_2017_realistic\" is default)")
0031 
0032 options.register('conditionOverwrite',
0033                  "",
0034                  VarParsing.VarParsing.multiplicity.singleton,
0035                  VarParsing.VarParsing.varType.string,
0036                  "configuration to overwrite the condition into the GT (\"\" is default)")
0037 
0038 options.register('inputCollection',
0039                  "generalTracks",
0040                  VarParsing.VarParsing.multiplicity.singleton,
0041                  VarParsing.VarParsing.varType.string,
0042                  "collections to be used for input (\"generalTracks\" is default)")
0043 
0044 options.register('inputFiles',
0045                  filesRelValTTbarPileUpGENSIMRECO,
0046                  VarParsing.VarParsing.multiplicity.list,
0047                  VarParsing.VarParsing.varType.string,
0048                  "file to process")
0049 
0050 options.register('outputFile',
0051                  "calibTreeTest.root",
0052                  VarParsing.VarParsing.multiplicity.singleton,
0053                  VarParsing.VarParsing.varType.string,
0054                  "name for the output root file (\"calibTreeTest.root\" is default)")
0055 
0056 options.register('maxEvents',
0057                  -1,
0058                  VarParsing.VarParsing.multiplicity.singleton,
0059                  VarParsing.VarParsing.varType.int,
0060                  "number of events to process (\"-1\" for all)")
0061 
0062 options.register('unitTest',
0063                  False,
0064                  VarParsing.VarParsing.multiplicity.singleton,
0065                  VarParsing.VarParsing.varType.bool,
0066                  "is for unit test?")
0067 
0068 options.parseArguments()
0069 
0070 print("conditionGT       : ", options.conditionGT)
0071 print("conditionOverwrite: ", options.conditionOverwrite)
0072 print("inputCollection   : ", options.inputCollection)
0073 print("maxEvents         : ", options.maxEvents)
0074 print("outputFile        : ", options.outputFile)
0075 print("inputFiles        : ", options.inputFiles)
0076 
0077 process = cms.Process('CALIB')
0078 #from CalibTracker.SiStripChannelGain.ntuple_cff import *
0079 process.load('CalibTracker.Configuration.setupCalibrationTree_cff')
0080 process.load('CalibTracker.SiStripCommon.ShallowEventDataProducer_cfi') #event Info
0081 
0082 process.load('Configuration.StandardSequences.MagneticField_cff')
0083 process.load('Configuration.Geometry.GeometryRecoDB_cff')
0084 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0085 process.load('CalibTracker.SiStripCommon.ShallowEventDataProducer_cfi') #event Info
0086 
0087 from Configuration.AlCa.GlobalTag import GlobalTag
0088 process.GlobalTag = GlobalTag(process.GlobalTag, options.conditionGT, options.conditionOverwrite)
0089 
0090 process.load('FWCore.MessageService.MessageLogger_cfi')
0091 if(options.unitTest):
0092     process.MessageLogger.cerr.FwkReport.reportEvery = 1
0093 else:
0094     process.MessageLogger.cerr.FwkReport.reportEvery = 100
0095 
0096 process.load('Configuration.StandardSequences.Services_cff')
0097 process.add_( cms.Service( "TFileService",
0098                            fileName = cms.string( options.outputFile ),
0099                            closeFileFast = cms.untracked.bool(True)  ) )
0100 
0101 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.maxEvents) )
0102 
0103 #import runs
0104 process.source = cms.Source (
0105     "PoolSource",
0106     fileNames = cms.untracked.vstring(options.inputFiles[0])
0107     )
0108 
0109 #definition of input collection
0110 process.CalibrationTracks.src = cms.InputTag( options.inputCollection )
0111 process.shallowTracks.Tracks  = cms.InputTag( options.inputCollection )
0112 #process.shallowGainCalibrationAllBunch   = 'ALCARECOSiStripCalMinBias' #cms.InputTag( options.inputCollection )
0113 #process.shallowGainCalibrationAllBunch0T = 'ALCARECOSiStripCalMinBias' #cms.InputTag( options.inputCollection )
0114 
0115 # BSCNoBeamHalo selection (Not to use for Cosmic Runs) --- OUTDATED!!!
0116 ## process.load('L1TriggerConfig.L1GtConfigProducers.L1GtTriggerMaskTechTrigConfig_cff')
0117 ## process.load('HLTrigger/HLTfilters/hltLevel1GTSeed_cfi')
0118 
0119 ## process.L1T1=process.hltLevel1GTSeed.clone()
0120 ## process.L1T1.L1TechTriggerSeeding = cms.bool(True)
0121 ## process.L1T1.L1SeedsLogicalExpression = cms.string('(40 OR 41) AND NOT (36 OR 37 OR 38 OR 39)')
0122 
0123 compressionSettings = 201
0124 process.EventInfo = cms.EDAnalyzer("ShallowTree", 
0125                     CompressionSettings = process.gainCalibrationTreeStdBunch.CompressionSettings,
0126                                     outputCommands = cms.untracked.vstring('drop *',
0127                                                                           'keep *_shallowEventRun_*_*',
0128                                                                           )
0129                                    )
0130 
0131 process.gainCalibrationTreeStdBunch.CompressionSettings = cms.untracked.int32(compressionSettings)
0132 process.gainCalibrationTreeStdBunch0T.CompressionSettings = cms.untracked.int32(compressionSettings)
0133 process.gainCalibrationTreeIsoMuon.CompressionSettings = cms.untracked.int32(compressionSettings)
0134 process.gainCalibrationTreeIsoMuon0T.CompressionSettings = cms.untracked.int32(compressionSettings)
0135 process.gainCalibrationTreeAagBunch.CompressionSettings = cms.untracked.int32(compressionSettings)
0136 process.gainCalibrationTreeAagBunch0T.CompressionSettings = cms.untracked.int32(compressionSettings)
0137 
0138 #process.TkCalPath = cms.Path(process.L1T1*process.TkCalFullSequence)
0139 
0140 ### if it is a unit test run, do not look for not existing triggers
0141 ### e.g. no AAG in MC
0142 
0143 if(options.unitTest):
0144     alterTriggersForUnitTest(process)
0145 
0146 process.TkCalPath_StdBunch   = cms.Path(process.TkCalSeq_StdBunch*process.shallowEventRun*process.EventInfo)
0147 process.TkCalPath_StdBunch0T = cms.Path(process.TkCalSeq_StdBunch0T*process.shallowEventRun*process.EventInfo)
0148 process.TkCalPath_IsoMuon    = cms.Path(process.TkCalSeq_IsoMuon*process.shallowEventRun*process.EventInfo)
0149 process.TkCalPath_IsoMuon0T  = cms.Path(process.TkCalSeq_IsoMuon0T*process.shallowEventRun*process.EventInfo)
0150 process.TkCalPath_AagBunch   = cms.Path(process.TkCalSeq_AagBunch*process.shallowEventRun*process.EventInfo)
0151 process.TkCalPath_AagBunch0T = cms.Path(process.TkCalSeq_AagBunch0T*process.shallowEventRun*process.EventInfo)
0152 
0153 process.schedule = cms.Schedule( process.TkCalPath_StdBunch, 
0154                                  process.TkCalPath_StdBunch0T,
0155                                  process.TkCalPath_IsoMuon,
0156                                  process.TkCalPath_IsoMuon0T,
0157                                  process.TkCalPath_AagBunch,
0158                                  process.TkCalPath_AagBunch0T,
0159                                  )
0160 
0161 process.options = cms.untracked.PSet(
0162     #wantSummary = cms.untracked.bool(True),
0163     Rethrow = cms.untracked.vstring('OtherCMS', 
0164         'StdException', 
0165         'Unknown', 
0166         'BadAlloc', 
0167         'BadExceptionType', 
0168         'ProductNotFound', 
0169         'DictionaryNotFound', 
0170         'InsertFailure', 
0171         'Configuration', 
0172         'LogicError', 
0173         'UnimplementedFeature', 
0174         'InvalidReference', 
0175         'NullPointerError', 
0176         'NoProductSpecified', 
0177         'EventTimeout', 
0178         'EventCorruption', 
0179         'ScheduleExecutionFailure', 
0180         'EventProcessorFailure', 
0181         'FileInPathError', 
0182         'FileOpenError', 
0183         'FileReadError', 
0184         'FatalRootError', 
0185         'MismatchedInputFiles', 
0186         'ProductDoesNotSupportViews', 
0187         'ProductDoesNotSupportPtr', 
0188         'NotFound')
0189     )
0190 
0191 process.Timing = cms.Service("Timing",
0192                              summaryOnly = cms.untracked.bool(True),
0193                              useJobReport = cms.untracked.bool(True)
0194                              )
0195 
0196 '''
0197 if(options.unitTest):
0198     process.SimpleMemoryCheck = cms.Service("SimpleMemoryCheck",
0199                                             ignoreTotal = cms.untracked.int32(1),
0200                                             moduleMemorySummary = cms.untracked.bool(True)
0201                                             )
0202 '''
0203 
0204 #Setup FWK for multithreaded
0205 process.options.numberOfThreads=cms.untracked.uint32(4)
0206 process.options.numberOfStreams=cms.untracked.uint32(0)
0207 #process.options.numberOfConcurrentLuminosityBlocks=cms.untracked.uint32(2)  ## not yet