Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:11:37

0001 import FWCore.ParameterSet.Config as cms
0002 import FWCore.ParameterSet.VarParsing as VarParsing
0003 import glob
0004 import os
0005 import os,sys,getopt,glob,cx_Oracle,subprocess
0006 
0007 cmsswbase = os.path.expandvars("$CMSSW_BASE/")
0008 inputPath = '/raid/fff'
0009 
0010 ##### to understand the run type by means of connecting the the CONFDB
0011 conn_str = os.path.expandvars("$CONFDB")
0012 conn     = cx_Oracle.connect(conn_str)
0013 e        = conn.cursor()
0014 e.execute('select RUNMODE from run where runnumber = RUNNUMBER')
0015 runmode = e.fetchall()
0016 runtype = -1;
0017 for result in runmode:
0018     runtype = int(result[0]);
0019 conn.close()
0020 
0021 
0022 process = cms.Process("SRC")
0023 
0024 process.load("DQM.SiStripCommon.MessageLogger_cfi")
0025 
0026 process.load("DQM.SiStripCommon.DaqMonitorROOTBackEnd_cfi")
0027 
0028 process.load("OnlineDB.SiStripConfigDb.SiStripConfigDb_cfi")
0029 process.SiStripConfigDb.UsingDb = True                    
0030 process.SiStripConfigDb.ConfDb = 'user/password@account'
0031 process.SiStripConfigDb.Partitions.PrimaryPartition.PartitionName = 'DBPART'
0032 process.SiStripConfigDb.Partitions.PrimaryPartition.RunNumber     = RUNNUMBER
0033 process.SiStripConfigDb.TNS_ADMIN = '/etc'
0034 
0035 process.SiStripCondObjBuilderFromDb = cms.Service("SiStripCondObjBuilderFromDb")
0036 process.SiStripCondObjBuilderFromDb.SiStripDetInfoFile = cms.FileInPath("CalibTracker/SiStripCommon/data/SiStripDetInfo.dat")
0037 process.SiStripCondObjBuilderFromDb.UseFEC = cms.untracked.bool(True)
0038 process.SiStripCondObjBuilderFromDb.UseFED = cms.untracked.bool(True)
0039 
0040 process.FedCablingFromConfigDb = cms.ESSource("SiStripFedCablingBuilderFromDb",
0041     CablingSource = cms.untracked.string('UNDEFINED')  
0042 )
0043 
0044 process.PedestalsFromConfigDb = cms.ESSource("SiStripPedestalsBuilderFromDb")
0045 process.NoiseFromConfigDb = cms.ESSource("SiStripNoiseBuilderFromDb")
0046 process.sistripconn = cms.ESProducer("SiStripConnectivity")
0047 
0048 process.load("Geometry.CMSCommonData.cmsIdealGeometryXML_cfi")
0049 process.load("Geometry.TrackerNumberingBuilder.trackerTopology_cfi")
0050 process.load("Geometry.TrackerGeometryBuilder.trackerParameters_cfi")
0051 
0052 process.FastMonitoringService = cms.Service("FastMonitoringService",
0053         sleepTime = cms.untracked.int32(1),
0054         microstateDefPath = cms.untracked.string( cmsswbase+'/src/EventFilter/Utilities/plugins/microstatedef.jsd'),
0055         fastMicrostateDefPath = cms.untracked.string( cmsswbase+'/src/EventFilter/Utilities/plugins/microstatedeffast.jsd'),
0056         fastName = cms.untracked.string( 'fastmoni' ),
0057         slowName = cms.untracked.string( 'slowmoni' )
0058 )
0059 
0060 process.EvFDaqDirector = cms.Service("EvFDaqDirector",
0061         runNumber = cms.untracked.uint32(RUNNUMBER),
0062         buBaseDir = cms.untracked.string(inputPath),
0063         directorIsBu = cms.untracked.bool(False),
0064         testModeNoBuilderUnit = cms.untracked.bool(False)
0065 )
0066 
0067 process.source = cms.Source("FedRawDataInputSource",
0068         runNumber = cms.untracked.uint32(RUNNUMBER),
0069         getLSFromFilename = cms.untracked.bool(True),
0070         testModeNoBuilderUnit = cms.untracked.bool(False),
0071         verifyAdler32 = cms.untracked.bool(True),
0072         verifyChecksum = cms.untracked.bool(True),
0073         useL1EventID = cms.untracked.bool(True),
0074         eventChunkSize = cms.untracked.uint32(16),
0075         numBuffers = cms.untracked.uint32(2),
0076         eventChunkBlock = cms.untracked.uint32(1),
0077         fileListMode = cms.untracked.bool(True),
0078         fileNames = cms.untracked.vstring()
0079 )
0080 
0081 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
0082 
0083 ### for run types != from DAQ SCOPE Modes
0084 if runtype != 15:
0085     process.load("EventFilter.SiStripRawToDigi.FedChannelDigis_cfi")
0086     process.FedChannelDigis.UnpackBadChannels = cms.bool(True)
0087     process.FedChannelDigis.DoAPVEmulatorCheck = cms.bool(True)
0088     process.FedChannelDigis.LegacyUnpacker = cms.bool(False)
0089     process.FedChannelDigis.ProductLabel = cms.InputTag("rawDataCollector")
0090 else:
0091     process.load('DQM.SiStripMonitorHardware.SiStripSpyUnpacker_cfi')
0092     process.load('DQM.SiStripMonitorHardware.SiStripSpyDigiConverter_cfi')
0093     process.load('DQM.SiStripMonitorHardware.SiStripSpyEventSummaryProducer_cfi')    
0094     ## * Scope digi settings                                                                                                                                                                     
0095     process.SiStripSpyUnpacker.FEDIDs = cms.vuint32()                   #use a subset of FEDs or leave empty for all.                                                                                  
0096     process.SiStripSpyUnpacker.InputProductLabel = cms.InputTag('rawDataCollector')
0097     process.SiStripSpyUnpacker.AllowIncompleteEvents = True
0098     process.SiStripSpyUnpacker.StoreCounters = True
0099     process.SiStripSpyUnpacker.StoreScopeRawDigis = cms.bool(True)      # Note - needs to be True for use in other modules.                                                                       
0100     ## * Module digi settings                                                                                                                                                                         
0101     process.SiStripSpyDigiConverter.InputProductLabel = cms.InputTag('SiStripSpyUnpacker','ScopeRawDigis')
0102     process.SiStripSpyDigiConverter.StorePayloadDigis = True
0103     process.SiStripSpyDigiConverter.StoreReorderedDigis = True
0104     process.SiStripSpyDigiConverter.StoreModuleDigis = True
0105     process.SiStripSpyDigiConverter.StoreAPVAddress = True
0106     process.SiStripSpyDigiConverter.MinDigiRange = 100
0107     process.SiStripSpyDigiConverter.MaxDigiRange = 1024
0108     process.SiStripSpyDigiConverter.MinZeroLight = 0
0109     process.SiStripSpyDigiConverter.MaxZeroLight = 1024
0110     process.SiStripSpyDigiConverter.MinTickHeight = 0
0111     process.SiStripSpyDigiConverter.MaxTickHeight = 1024
0112     process.SiStripSpyDigiConverter.ExpectedPositionOfFirstHeaderBit = 0
0113     process.SiStripSpyDigiConverter.DiscardDigisWithWrongAPVAddress = False
0114     process.SiStripSpyEventSummary.RawDataTag = cms.InputTag('rawDataCollector')
0115 
0116 process.load("DQM.SiStripCommissioningSources.CommissioningHistos_cfi")
0117 process.CommissioningHistos.CommissioningTask = 'UNDEFINED'
0118 process.CommissioningHistos.PedsFullNoiseParameters.NrEvToSkipAtStart = 100
0119 process.CommissioningHistos.PedsFullNoiseParameters.NrEvForPeds       = 3000
0120 process.CommissioningHistos.PedsFullNoiseParameters.FillNoiseProfile  = True
0121 
0122 outfilename = inputPath+"/run"+"RUNNUMBER"+"/run"+"RUNNUMBER"+".root"
0123 process.out = cms.OutputModule("PoolOutputModule",
0124   fileName = cms.untracked.string(outfilename),
0125   outputCommands = cms.untracked.vstring("drop *", "keep FEDRawDataCollection_*_*_*")
0126 )
0127 
0128 if runtype != 15:
0129     process.p = cms.Path(process.FedChannelDigis*process.CommissioningHistos)
0130 else:
0131     
0132     process.SiStripSpyEventSummary.RunType = cms.uint32(runtype)
0133     process.CommissioningHistos.InputModuleLabel = 'SiStripSpyDigiConverter'  # output label from spy converter                                                                                        
0134     process.CommissioningHistos.InputModuleLabelAlt = cms.string('SiStripSpyUnpacker')
0135     process.CommissioningHistos.SummaryInputModuleLabel = 'SiStripSpyEventSummary'
0136     process.CommissioningHistos.isSpy = cms.bool(True)
0137     process.CommissioningHistos.PartitionName = cms.string('DBPART')
0138 
0139     process.p = cms.Path(process.SiStripSpyUnpacker*process.SiStripSpyDigiConverter*process.SiStripSpyEventSummary*process.CommissioningHistos)
0140 
0141 process.e = cms.EndPath(process.out)
0142 
0143 fnames = glob.glob(inputPath+"/run"+"RUNNUMBER"+"/*ls00*.raw")
0144 for f in fnames :
0145         process.source.fileNames.extend(cms.untracked.vstring('file:'+f))
0146