Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-04-09 02:50:39

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 from Configuration.AlCa.GlobalTag import GlobalTag
0004 
0005 options = VarParsing.VarParsing("analysis")
0006 
0007 MODE_ANALYZE, MODE_REMAP = 0, 1
0008 RECHITS, DIGIS, CLUSTERS = 1, 2, 3
0009 
0010 dataSourceDic = { RECHITS : "ALCARECOTkAlMinBias", #"generalTracks",
0011                   DIGIS   : "siStripDigis",
0012                   CLUSTERS: "siStripClusters" }
0013 
0014 defaultAnylyzeMode = RECHITS #DIGIS # RECHITS
0015 
0016 ###################### OPTIONS HANDLER
0017 
0018 options.register ("opMode",                                  
0019                   MODE_ANALYZE,               
0020                   VarParsing.VarParsing.multiplicity.singleton, 
0021                   VarParsing.VarParsing.varType.int,         
0022                   "Operation Mode")   
0023 
0024 options.register ("analyzeMode",                                  
0025                   defaultAnylyzeMode,               
0026                   VarParsing.VarParsing.multiplicity.singleton, 
0027                   VarParsing.VarParsing.varType.int,         
0028                   "Analyze Mode") 
0029 
0030 options.register ("eventLimit",                                  
0031                   -1,               
0032                   VarParsing.VarParsing.multiplicity.singleton, 
0033                   VarParsing.VarParsing.varType.int,         
0034                   "Limits Events Processed in Analyze Mode") 
0035 
0036 options.register ("inputRootFile",                                  
0037                   "/store/express/Run2018D/StreamExpressAlignment/ALCARECO/TkAlMinBias-Express-v1/000/324/980/00000/00E8FB8F-D3AB-C442-BCC2-FEEAE63EA711.root",
0038                   VarParsing.VarParsing.multiplicity.singleton, 
0039                   VarParsing.VarParsing.varType.string,         
0040                   "Source Data File - either for analyze or remap")   
0041 
0042 options.register ("stripHistogram",                                  
0043                   "TkHMap_NumberValidHits",               
0044                   VarParsing.VarParsing.multiplicity.singleton, 
0045                   VarParsing.VarParsing.varType.string,         
0046                   "Strip Detector Histogram to Remap")   
0047 
0048 options.register ("src",   
0049                   dataSourceDic[defaultAnylyzeMode],                                              
0050                   VarParsing.VarParsing.multiplicity.singleton, 
0051                   VarParsing.VarParsing.varType.string,         
0052                   "Collection Source")    #??
0053 
0054 options.register ("globalTag",                                  # option name
0055                   "auto:run2_data",                             # default value
0056                   VarParsing.VarParsing.multiplicity.singleton, # singleton or list
0057                   VarParsing.VarParsing.varType.string,         # string, bool, int, or float
0058                   "Global Tag")                                 # ? help ?
0059                   
0060 options.parseArguments()
0061 
0062 ######################
0063 
0064 process = cms.Process("Demo")
0065 
0066 if options.opMode == MODE_ANALYZE:
0067     process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(options.eventLimit) )
0068     process.source = cms.Source("PoolSource",
0069         fileNames = cms.untracked.vstring(
0070             options.inputRootFile
0071         )
0072     )
0073     runNumber = "Analyze"
0074 
0075 elif options.opMode == MODE_REMAP:
0076     process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(1) )
0077     process.source = cms.Source("EmptySource")
0078     #run number deduction
0079     runNumber = str(int(options.inputRootFile.split("_")[-1].split(".")[0][1:]))
0080 
0081 process.demo = cms.EDAnalyzer('TrackerRemapper',
0082                               opMode = cms.int32(options.opMode),
0083                               analyzeMode = cms.int32(options.analyzeMode),
0084                               #stripRemapFile = cms.string(options.inputRootFile),
0085                               #stripHistogram = cms.string(options.stripHistogram),
0086                               #runString = cms.string(runNumber),
0087                               src = cms.InputTag(options.src),
0088                               )
0089 
0090 process.p = cms.Path(process.demo)
0091 
0092 process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
0093 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
0094 process.GlobalTag = GlobalTag(process.GlobalTag, options.globalTag, "")
0095 
0096 process.load("CalibTracker.SiStripCommon.TkDetMapESProducer_cfi")
0097 #process.load("DQM.SiStripCommon.TkHistoMap_cff")
0098 #process.TkDetMap = cms.Service("TkDetMap")
0099 #process.SiStripDetInfoFileReader = cms.Service("SiStripDetInfoFileReader")
0100 
0101 #### Add these lines to produce a tracker map
0102 process.load("DQMServices.Core.DQMStore_cfg")
0103 
0104 # Output root file name:
0105 process.TFileService = cms.Service("TFileService", fileName = cms.string('outputStrip.root') )