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()):
65 print(
'input files checksum: %s'%(self.__hasher.hexdigest()))
67 for key
in sorted(samples.keys()):
69 local_hash = md5.new()
71 self.__hasher.update(local_hash.hexdigest())
73 print(
'event processing checksum: %s'%(self.__hasher.hexdigest()))
75 self.__hasher.update(select.md5String())
77 print(
'total checksum: %s'%(self.__hasher.hexdigest()))
81 self.__hasher.update(item)
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)
S & print(S &os, JobReport::InputFile const &f)
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)