1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
import FWCore.ParameterSet.Config as cms
import FWCore.ParameterSet.VarParsing as VarParsing
import os
import math
#Instructions:
# before running this script make sure that you have access to %fffBaseDir%/ramdisk and %fffBaseDir%/data
# these parameters can also be changed in startFU.py and startBU.py scripts
#user = os.environ['USER']
options = VarParsing.VarParsing ('analysis')
options.register ('runNumber',
100, # default value
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.int, # string, int, or float
"Run Number")
options.register ('buBaseDir',
'ramdisk/', # default value
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.string, # string, int, or float
"BU base directory")
options.register ('fffBaseDir',
'.', # default value
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.string, # string, int, or float
"FFF base directory")
options.register ('maxLS',
0,
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.int, # string, int, or float
"Max LS to generate (0 to disable limit)")
options.register ('eventsPerLS',
105,
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.int, # string, int, or float
"Max LS to generate (0 to disable limit)")
options.register ('eventsPerFile',
20,
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.int, # string, int, or float
"Number of events per raw file")
options.register ('fedMeanSize',
1024,
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.int, # string, int, or float
"Mean size of generated (fake) FED raw payload")
options.register ('frdFileVersion',
1,
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.int, # string, int, or float
"Generate raw files with FRD file header with version 1 or separate JSON files with 0")
options.register ('dataType',
"FRD",
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.string, # string, int, or float
"Choice between FRD or raw DTH data generation")
options.register ('subsystems',
"",
VarParsing.VarParsing.multiplicity.singleton,
VarParsing.VarParsing.varType.string, # string, int, or float
"List of generated subsystem FEDs. Empty means all.")
options.parseArguments()
#try to create 'ramdisk' directory
try:
os.makedirs(options.fffBaseDir+"/"+options.buBaseDir)
except:pass
cmsswbase = os.path.expandvars("$CMSSW_BASE/")
process = cms.Process("FAKEBU")
if options.maxLS==0:
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(-1)
)
else:
process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(options.eventsPerLS * options.maxLS)
)
process.options = cms.untracked.PSet(
)
process.MessageLogger = cms.Service("MessageLogger",
destinations = cms.untracked.vstring( 'cout' ),
cout = cms.untracked.PSet( FwkReport =
cms.untracked.PSet(reportEvery = cms.untracked.int32(1000),
optionalPSet = cms.untracked.bool(True),
limit = cms.untracked.int32(10000000)
),
threshold = cms.untracked.string( "INFO" )
)
)
process.source = cms.Source("EmptySource",
firstRun= cms.untracked.uint32(options.runNumber),
numberEventsInLuminosityBlock = cms.untracked.uint32(options.eventsPerLS),
numberEventsInRun = cms.untracked.uint32(0)
)
process.EvFDaqDirector = cms.Service("EvFDaqDirector",
runNumber = cms.untracked.uint32(options.runNumber),
baseDir = cms.untracked.string(options.fffBaseDir+"/"+options.buBaseDir),
buBaseDir = cms.untracked.string(options.fffBaseDir+"/"+options.buBaseDir),
directorIsBU = cms.untracked.bool(True),
useFileBroker = cms.untracked.bool(False),
fileBrokerHost = cms.untracked.string("")
)
#throttle when running with no limit
if options.maxLS==0:
process.EvFBuildingThrottle = cms.Service("EvFBuildingThrottle",
highWaterMark = cms.untracked.double(0.80),
lowWaterMark = cms.untracked.double(0.75),
sleepmSecs = cms.untracked.uint32(500))
process.a = cms.EDAnalyzer("ExceptionGenerator",
defaultAction = cms.untracked.int32(0),
defaultQualifier = cms.untracked.int32(0))
if options.dataType == "FRD":
process.s = cms.EDProducer("DaqFakeReader",
fillRandom = cms.untracked.bool(True),
meanSize = cms.untracked.uint32(options.fedMeanSize),
width = cms.untracked.uint32(int(math.ceil(options.fedMeanSize/2.))),
tcdsFEDID = cms.untracked.uint32(1024),
injectErrPpm = cms.untracked.uint32(0)
)
if options.subsystems:
#set FED filering
process.s.subsystems = cms.untracked.vstring(tuple(options.subsystems.split(',')))
process.out = cms.OutputModule("RawStreamFileWriterForBU",
source = cms.InputTag("s"),
numEventsPerFile = cms.uint32(options.eventsPerFile),
frdVersion = cms.uint32(6),
frdFileVersion = cms.uint32(options.frdFileVersion),
)
elif options.dataType == "DTH":
process.s = cms.EDProducer("DTHFakeReader",
fillRandom = cms.untracked.bool(True),
meanSize = cms.untracked.uint32(options.fedMeanSize),
width = cms.untracked.uint32(int(math.ceil(options.fedMeanSize/2.))),
injectErrPpm = cms.untracked.uint32(0),
sourceIdList = cms.untracked.vuint32(66,1511)
)
process.out = cms.OutputModule("RawStreamFileWriterForBU",
source = cms.InputTag("s"),
numEventsPerFile = cms.uint32(options.eventsPerFile),
frdVersion = cms.uint32(0),
frdFileVersion = cms.uint32(0),
sourceIdList = cms.untracked.vuint32(66,1511)
)
process.p = cms.Path(process.s+process.a)
process.ep = cms.EndPath(process.out)
|