128 randomMuSampling=False,
129 sequentialEventNumbers=False,
130 doNotCorrectMaxEvents=False):
131 """Generate pile-up profile"""
132 logger = logging.getLogger(
"PileUp")
133 logger.info(
'Doing RunLumiOverride configuration from file.')
135 jobNumber = flags.Input.JobNumber
136 maxEvents = flags.Exec.MaxEvents
137 totalEvents = flags.Exec.MaxEvents
138 skipEvents = flags.Exec.SkipEvents
141 if flags.ExecutorSplitting.TotalSteps > 1:
142 totalEvents = flags.ExecutorSplitting.TotalEvents
145 raise ValueError(
"maxEvents = -1 is not supported! Please set this to the number of events per file times the number of files per job.")
146 if not doNotCorrectMaxEvents
and not flags.ExecutorSplitting.TotalSteps > 1:
148 corrMaxEvents = ceil(
float(maxEvents) / 100.0) * 100.0
150 if not flags.ExecutorSplitting.TotalSteps > 1:
151 logger.warning(
"Using the actual number of HITS input events for this job -- not for production use!")
152 corrMaxEvents = maxEvents
161 if flags.ExecutorSplitting.TotalSteps > 1:
162 generatedProfile =
list(
filter(
lambda lb:
'step' not in lb
or lb[
'step'] == flags.ExecutorSplitting.Step, generatedProfile))
164 runMaxEvents =
sum(lb[
"evts"]
for lb
in generatedProfile)
165 logger.info(
"There are %d events in this run.", runMaxEvents)
166 jobsPerRun =
int(ceil(
float(runMaxEvents) / corrMaxEvents))
167 logger.info(
"Assuming there are usually %d events per job. (Based on %d events in this job.)",
168 corrMaxEvents, maxEvents)
169 logger.info(
"There must be %d jobs per run.", jobsPerRun)
172 if sequentialEventNumbers:
173 logger.info(
"All event numbers will be sequential.")
177 logger.info(
"Mu values will be sampled randomly from the set profile.")
179 from RunDependentSimComps.RunDependentMCTaskIterator
import getRandomlySampledRunLumiInfoFragment
181 jobnumber=(jobNumber - 1),
182 task=generatedProfile,
184 totalEvents=totalEvents,
185 skipEvents=skipEvents,
186 sequentialEventNumbers=sequentialEventNumbers)
189 from RunDependentSimComps.RunDependentMCTaskIterator
import getRunLumiInfoFragment
191 jobnumber=(jobNumber - 1),
192 task=generatedProfile,
194 totalEvents=totalEvents,
195 skipEvents=skipEvents,
196 sequentialEventNumbers=sequentialEventNumbers)
199 for element
in fragment:
200 if element[
'evts'] == 0:
201 logger.warning(
'Found lumiblock with no events! This lumiblock will not be used:\n (' + element.__str__() +
')' )
202 fragment = [x
for x
in fragment
if x[
'evts'] != 0]
204 from RunDependentSimComps.RunLumiConfigTools
import condenseRunLumiInfoFragment
205 logger.info(
"Writing RunDMC trigger configuration fragment to file. listOfRunsEvents = %s",
208 flags.Input.RunAndLumiOverrideList = fragment