CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
readSiStripApvGain.py
Go to the documentation of this file.
1 #! /bin/env cmsRun
2 import FWCore.ParameterSet.Config as cms
3 from FWCore.ParameterSet.VarParsing import VarParsing
4 
5 
6 options = VarParsing('python')
7 options.register('runN', 1,
8  VarParsing.multiplicity.singleton,
9  VarParsing.varType.int,
10  "runN in the IOV"
11 )
12 
13 options.parseArguments()
14 
15 if (not options.tag or not options.inputFiles):
16  raise ValueError('usage: cmsRun SiStripApvGainReader_cfg.py inputFiles=my_input_file tag=my_tag')
17 process = cms.Process("SiStripApvGainReader")
18 
19 process.MessageLogger = cms.Service(
20  "MessageLogger",
21  debugModules = cms.untracked.vstring(''),
22  threshold = cms.untracked.string('INFO'),
23  destinations = cms.untracked.vstring('SiStripApvGainReader.log')
24  )
25 
26 ##
27 ## Empty events source
28 ## (specify the run number to pick correct IOV)
29 ##
30 process.source = cms.Source("EmptySource",
31  numberEventsInRun = cms.untracked.uint32(1),
32  firstRun = cms.untracked.uint32(options.runN)
33  )
34 
35 process.maxEvents = cms.untracked.PSet(
36  input = cms.untracked.int32(1)
37  )
38 
39 ##
40 ## To Correctly build the SiStripGainRcd in the ES
41 ## we need all the dependent records => specify a Global Tag
42 ##
43 process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
44 from Configuration.AlCa.GlobalTag import GlobalTag
45 
46 process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:run2_data', '')
47 
48 
49 ##
50 ## Prefer the SiStripApvGainRcd or SiStripApvGain2Rcd
51 ## under test
52 ##
53 process.poolDBESSource = cms.ESSource("PoolDBESSource",
54  #connect = cms.string('frontier://FrontierProd/CMS_CONDITIONS'),
55  connect = cms.string(options.inputFiles[0]),
56  toGet = cms.VPSet(cms.PSet(record = cms.string('SiStripApvGainRcd'),
57  tag = cms.string(options.tag)
58  )
59  )
60  )
61 process.prefer_poolDBESSource = cms.ESPrefer("PoolDBESSource","poolDBESSource")
62 
63 ##
64 ## Dump the Gain payload. It will be in the format
65 ## DetId APV1 APV2 APV3 APV4 (APV5) (APV6)
66 ##
67 process.gainreader = cms.EDAnalyzer("SiStripApvGainReader",
68  printDebug = cms.untracked.bool(True),
69  outputFile = cms.untracked.string("SiStripApvGains_dump.txt"),
70  gainType = cms.untracked.uint32(0) #0 for G1, 1 for G2
71  )
72 
73 process.TFileService = cms.Service("TFileService",
74  fileName = cms.string("gain.root"),
75  closeFileFast = cms.untracked.bool(True)
76  )
77 
78 process.p1 = cms.Path(process.gainreader)
79 
80