|
def | getfiles (self, usecache) |
|
def | headercomment (self) |
|
def | writefilelist_hippy (self, firstrun, lastrun, runs, eventsperjob, maxevents, outputfile, usecache=True) |
|
def | writefilelist_validation (self, firstrun, lastrun, runs, maxevents, outputfile=None, usecache=True) |
|
Definition at line 127 of file dataset.py.
◆ getfiles()
def dataset.DatasetBase.getfiles |
( |
|
self, |
|
|
|
usecache |
|
) |
| |
◆ headercomment()
def dataset.DatasetBase.headercomment |
( |
|
self | ) |
|
Definition at line 135 of file dataset.py.
135 def headercomment(self):
◆ writefilelist_hippy()
def dataset.DatasetBase.writefilelist_hippy |
( |
|
self, |
|
|
|
firstrun, |
|
|
|
lastrun, |
|
|
|
runs, |
|
|
|
eventsperjob, |
|
|
|
maxevents, |
|
|
|
outputfile, |
|
|
|
usecache = True |
|
) |
| |
Definition at line 167 of file dataset.py.
References python.cmstools.all(), any(), nano_mu_digi_cff.float, and dataset.DatasetBase.getfiles().
167 def writefilelist_hippy(self, firstrun, lastrun, runs, eventsperjob, maxevents, outputfile, usecache=True):
168 runrange =
RunRange(firstrun=firstrun, lastrun=lastrun, runs=runs)
169 if maxevents < 0: maxevents =
float(
"inf")
170 totalevents = sum(datafile.nevents
for datafile
in self.getfiles(usecache)
if all(run
in runrange
for run
in datafile.runs))
172 raise ValueError(
"No events within the run range!")
173 accepted = rejected = inthisjob = 0.
175 fractiontoaccept = 1.*maxevents / totalevents
178 with open(outputfile,
"w")
as f:
179 for datafile
in self.getfiles(usecache):
180 if all(run
in runrange
for run
in datafile.runs):
181 if accepted == 0
or accepted / (accepted+rejected) <= fractiontoaccept:
182 if writecomma: f.write(
",")
183 f.write(
"'" + datafile.filename +
"'")
184 accepted += datafile.nevents
185 inthisjob += datafile.nevents
186 if inthisjob >= eventsperjob:
193 rejected += datafile.nevents
194 elif any(run
in runrange
for run
in datafile.runs):
195 raise DatasetError(
"file {} has multiple runs {}, which straddle firstrun or lastrun".
format(datafile.filename, datafile.runs))
bool any(const std::vector< T > &v, const T &what)
std::pair< RunNumber, RunNumber > RunRange
◆ writefilelist_validation()
def dataset.DatasetBase.writefilelist_validation |
( |
|
self, |
|
|
|
firstrun, |
|
|
|
lastrun, |
|
|
|
runs, |
|
|
|
maxevents, |
|
|
|
outputfile = None , |
|
|
|
usecache = True |
|
) |
| |
Definition at line 138 of file dataset.py.
138 def writefilelist_validation(self, firstrun, lastrun, runs, maxevents, outputfile=None, usecache=True):
139 runrange =
RunRange(firstrun=firstrun, lastrun=lastrun, runs=runs)
141 if outputfile
is None:
142 outputfile = os.path.join(os.environ[
"CMSSW_BASE"],
"src",
"Alignment",
"OfflineValidation",
"python", self.filenamebase+
"_cff.py")
144 if maxevents < 0: maxevents =
float(
"inf")
145 totalevents = sum(datafile.nevents
for datafile
in self.getfiles(usecache)
if all(run
in runrange
for run
in datafile.runs))
147 raise ValueError(
"No events within the run range!")
148 accepted = rejected = 0.
150 fractiontoaccept = 1.*maxevents / totalevents
152 with open(outputfile,
"w")
as f:
153 f.write(
"#"+self.headercomment+
"\n")
154 f.write(validationheader)
155 for datafile
in self.getfiles(usecache):
156 if all(run
in runrange
for run
in datafile.runs):
157 if accepted == 0
or accepted / (accepted+rejected) <= fractiontoaccept:
158 f.write(
'"' + datafile.filename +
'",\n')
159 accepted += datafile.nevents
161 rejected += datafile.nevents
162 elif any(run
in runrange
for run
in datafile.runs):
163 raise DatasetError(
"file {} has multiple runs {}, which straddle firstrun or lastrun".
format(datafile.filename, datafile.runs))
164 f.write(
"#total events in these files: {}".
format(accepted))
165 f.write(validationfooter)
bool any(const std::vector< T > &v, const T &what)
std::pair< RunNumber, RunNumber > RunRange
◆ __metaclass__
dataset.DatasetBase.__metaclass__ = abc.ABCMeta |
|
staticprivate |