CMS 3D CMS Logo

SiStripCommissioningSource_FromRAW_cfg.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 import FWCore.ParameterSet.VarParsing as VarParsing
3 import glob
4 import os
5 import os,sys,getopt,glob,cx_Oracle,subprocess
6 
7 cmsswbase = os.path.expandvars("$CMSSW_BASE/")
8 inputPath = '/raid/fff'
9 
10 ##### to understand the run type by means of connecting the the CONFDB
11 conn_str = os.path.expandvars("$CONFDB")
12 conn = cx_Oracle.connect(conn_str)
13 e = conn.cursor()
14 e.execute('select RUNMODE from run where runnumber = RUNNUMBER')
15 runmode = e.fetchall()
16 runtype = -1;
17 for result in runmode:
18  runtype = int(result[0]);
19 conn.close()
20 
21 
22 process = cms.Process("SRC")
23 
24 process.load("DQM.SiStripCommon.MessageLogger_cfi")
25 
26 process.load("DQM.SiStripCommon.DaqMonitorROOTBackEnd_cfi")
27 
28 process.load("OnlineDB.SiStripConfigDb.SiStripConfigDb_cfi")
29 process.SiStripConfigDb.UsingDb = True
30 process.SiStripConfigDb.ConfDb = 'user/password@account'
31 process.SiStripConfigDb.Partitions.PrimaryPartition.PartitionName = 'DBPART'
32 process.SiStripConfigDb.Partitions.PrimaryPartition.RunNumber = RUNNUMBER
33 process.SiStripConfigDb.TNS_ADMIN = '/etc'
34 
35 process.SiStripCondObjBuilderFromDb = cms.Service("SiStripCondObjBuilderFromDb")
36 process.SiStripCondObjBuilderFromDb.UseFEC = cms.untracked.bool(True)
37 process.SiStripCondObjBuilderFromDb.UseFED = cms.untracked.bool(True)
38 
39 process.FedCablingFromConfigDb = cms.ESSource("SiStripFedCablingBuilderFromDb",
40  CablingSource = cms.untracked.string('UNDEFINED')
41 )
42 process.SiStripDetInfoFileReader = cms.Service("SiStripDetInfoFileReader")
43 
44 process.PedestalsFromConfigDb = cms.ESSource("SiStripPedestalsBuilderFromDb")
45 process.NoiseFromConfigDb = cms.ESSource("SiStripNoiseBuilderFromDb")
46 process.sistripconn = cms.ESProducer("SiStripConnectivity")
47 
48 process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
49 process.load("Geometry.TrackerNumberingBuilder.trackerTopology_cfi")
50 process.load("Geometry.TrackerGeometryBuilder.trackerParameters_cfi")
51 
52 process.FastMonitoringService = cms.Service("FastMonitoringService",
53  sleepTime = cms.untracked.int32(1),
54  microstateDefPath = cms.untracked.string( cmsswbase+'/src/EventFilter/Utilities/plugins/microstatedef.jsd'),
55  fastMicrostateDefPath = cms.untracked.string( cmsswbase+'/src/EventFilter/Utilities/plugins/microstatedeffast.jsd'),
56  fastName = cms.untracked.string( 'fastmoni' ),
57  slowName = cms.untracked.string( 'slowmoni' )
58 )
59 
60 process.EvFDaqDirector = cms.Service("EvFDaqDirector",
61  runNumber = cms.untracked.uint32(RUNNUMBER),
62  buBaseDir = cms.untracked.string(inputPath),
63  directorIsBu = cms.untracked.bool(False),
64  testModeNoBuilderUnit = cms.untracked.bool(False)
65 )
66 
67 process.source = cms.Source("FedRawDataInputSource",
68  runNumber = cms.untracked.uint32(RUNNUMBER),
69  getLSFromFilename = cms.untracked.bool(True),
70  testModeNoBuilderUnit = cms.untracked.bool(False),
71  verifyAdler32 = cms.untracked.bool(True),
72  verifyChecksum = cms.untracked.bool(True),
73  useL1EventID = cms.untracked.bool(True),
74  eventChunkSize = cms.untracked.uint32(16),
75  numBuffers = cms.untracked.uint32(2),
76  eventChunkBlock = cms.untracked.uint32(1),
77  fileListMode = cms.untracked.bool(True),
78  fileNames = cms.untracked.vstring()
79 )
80 
81 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
82 
83 ### for run types != from DAQ SCOPE Modes
84 if runtype != 15:
85  process.load("EventFilter.SiStripRawToDigi.FedChannelDigis_cfi")
86  process.FedChannelDigis.UnpackBadChannels = cms.bool(True)
87  process.FedChannelDigis.DoAPVEmulatorCheck = cms.bool(True)
88  process.FedChannelDigis.LegacyUnpacker = cms.bool(False)
89  process.FedChannelDigis.ProductLabel = cms.InputTag("rawDataCollector")
90 else:
91  process.load('DQM.SiStripMonitorHardware.SiStripSpyUnpacker_cfi')
92  process.load('DQM.SiStripMonitorHardware.SiStripSpyDigiConverter_cfi')
93  process.load('DQM.SiStripMonitorHardware.SiStripSpyEventSummaryProducer_cfi')
94  ## * Scope digi settings
95  process.SiStripSpyUnpacker.FEDIDs = cms.vuint32() #use a subset of FEDs or leave empty for all.
96  process.SiStripSpyUnpacker.InputProductLabel = cms.InputTag('rawDataCollector')
97  process.SiStripSpyUnpacker.AllowIncompleteEvents = True
98  process.SiStripSpyUnpacker.StoreCounters = True
99  process.SiStripSpyUnpacker.StoreScopeRawDigis = cms.bool(True) # Note - needs to be True for use in other modules.
100  ## * Module digi settings
101  process.SiStripSpyDigiConverter.InputProductLabel = cms.InputTag('SiStripSpyUnpacker','ScopeRawDigis')
102  process.SiStripSpyDigiConverter.StorePayloadDigis = True
103  process.SiStripSpyDigiConverter.StoreReorderedDigis = True
104  process.SiStripSpyDigiConverter.StoreModuleDigis = True
105  process.SiStripSpyDigiConverter.StoreAPVAddress = True
106  process.SiStripSpyDigiConverter.MinDigiRange = 100
107  process.SiStripSpyDigiConverter.MaxDigiRange = 1024
108  process.SiStripSpyDigiConverter.MinZeroLight = 0
109  process.SiStripSpyDigiConverter.MaxZeroLight = 1024
110  process.SiStripSpyDigiConverter.MinTickHeight = 0
111  process.SiStripSpyDigiConverter.MaxTickHeight = 1024
112  process.SiStripSpyDigiConverter.ExpectedPositionOfFirstHeaderBit = 0
113  process.SiStripSpyDigiConverter.DiscardDigisWithWrongAPVAddress = False
114  process.SiStripSpyEventSummary.RawDataTag = cms.InputTag('rawDataCollector')
115 
116 process.load("DQM.SiStripCommissioningSources.CommissioningHistos_cfi")
117 process.CommissioningHistos.CommissioningTask = 'UNDEFINED'
118 process.CommissioningHistos.PedsFullNoiseParameters.NrEvToSkipAtStart = 100
119 process.CommissioningHistos.PedsFullNoiseParameters.NrEvForPeds = 3000
120 process.CommissioningHistos.PedsFullNoiseParameters.FillNoiseProfile = True
121 
122 outfilename = inputPath+"/run"+"RUNNUMBER"+"/run"+"RUNNUMBER"+".root"
123 process.out = cms.OutputModule("PoolOutputModule",
124  fileName = cms.untracked.string(outfilename),
125  outputCommands = cms.untracked.vstring("drop *", "keep FEDRawDataCollection_*_*_*")
126 )
127 
128 if runtype != 15:
129  process.p = cms.Path(process.FedChannelDigis*process.CommissioningHistos)
130 else:
131 
132  process.SiStripSpyEventSummary.RunType = cms.uint32(runtype)
133  process.CommissioningHistos.InputModuleLabel = 'SiStripSpyDigiConverter' # output label from spy converter
134  process.CommissioningHistos.InputModuleLabelAlt = cms.string('SiStripSpyUnpacker')
135  process.CommissioningHistos.SummaryInputModuleLabel = 'SiStripSpyEventSummary'
136  process.CommissioningHistos.isSpy = cms.bool(True)
137  process.CommissioningHistos.PartitionName = cms.string('DBPART')
138 
139  process.p = cms.Path(process.SiStripSpyUnpacker*process.SiStripSpyDigiConverter*process.SiStripSpyEventSummary*process.CommissioningHistos)
140 
141 process.e = cms.EndPath(process.out)
142 
143 fnames = glob.glob(inputPath+"/run"+"RUNNUMBER"+"/*ls00*.raw")
144 for f in fnames :
145  process.source.fileNames.extend(cms.untracked.vstring('file:'+f))
146