1 from __future__
import print_function
6 ROOT.gSystem.Load(
"libFWCoreFWLite.so")
7 ROOT.gSystem.Load(
"libDataFormatsFWLite.so")
8 ROOT.FWLiteEnabler.enable()
11 import FWCore.ParameterSet.Config
as cms
14 from DataFormats.FWLite
import Handle, Events
24 def __init__(self, selector, collection_type, collection_name):
34 if not isinstance(files,list):
35 raise Exception(
'BadFileInput',
'You need to give "setSignalFiles" a list of strings')
39 if not isinstance(files,list):
40 raise Exception(
'BadFileInput',
'You need to give "setBackgroundFiles" a list of strings')
44 if not isinstance(files,list):
45 raise Exception(
'BadFileInput',
'You need to give "setMixFiles" a list of strings')
56 print(
'running validation for: %s'%(select.name()))
59 if not len(samples[
'signal'] + samples[
'background'] + samples[
'mix']):
60 raise Exception(
'NoInputFiles',
'There were no input files given, cannot validate!')
62 for key
in sorted(samples.keys()):
67 for key
in sorted(samples.keys()):
69 local_hash = md5.new()
73 print(
'event processing checksum: %s'%(self.
__hasher.hexdigest()))
82 print(
'Input %s file: %s'%(name,item))
89 events = Events(the_list)
95 if idstring ==
'':
continue 96 sub_cutnames.append(idstring.split()[2])
97 sub_hashes.append(md5.new(idstring))
100 event.getByLabel(productLabel,handle)
101 for i,obj
in enumerate(handle.product()):
108 if idstring ==
'':
continue 109 sub_hashes[icut].
update(idstring)
112 for sub_hash
in sub_hashes:
113 hasher.update(sub_hash.hexdigest())
115 hasher.update(
str(n_pass))
116 hasher.update(
str(n_fail))
117 print(
'%s sample pass : fail : hash -> %d : %d : %s'%(name,n_pass,n_fail,hasher.hexdigest()))
118 print(
'%s sample cut breakdown:'%(name))
119 for i,sub_hash
in enumerate(sub_hashes):
120 print(
'\t%s hash -> %s'%(sub_cutnames[i],sub_hash.hexdigest()))
def processInputList(self, the_list, name)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
def split(sequence, size)
def __init__(self, selector, collection_type, collection_name)
def setBackgroundFiles(self, files)
def processEvents(self, the_list, name, hasher)
def setMixFiles(self, files)
def setSignalFiles(self, files)