CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
VIDCutFlowResult.py
Go to the documentation of this file.
1 import ROOT
2 import string
3 import random
4 
5 # load FWLite C++ libraries
6 ROOT.gSystem.Load("libFWCoreFWLite.so");
7 ROOT.gSystem.Load("libDataFormatsFWLite.so");
8 ROOT.FWLiteEnabler.enable()
9 
11  def __init__(self, instance):
12  self.__instance = instance
13 
14  def cutFlowName(self):
15  return self.__instance.cutFlowName()
16 
17  def cutFlowPassed(self):
18  return self.__instance.cutFlowPassed()
19 
20  def cutFlowSize(self):
21  return self.__instance.cutFlowSize()
22 
23  def getNameAtIndex(self,idx):
24  return self.__instance.getNameAtIndex(idx)
25 
26  def getCutResultByIndex(self,idx):
27  return self.__instance.getCutResultByIndex(idx)
28 
29  def getCutResultByName(self,name):
30  return self.__instance.getCutResultByName(name)
31 
32  def isCutMasked(self,idx_or_name):
33  return self.__instance.isCutMasked(idx_or_name)
34 
35  def getValueCutUpon(self,idx_or_name):
36  return self.__instance.getValueCutUpon(idx_or_name)
37 
38  def getCutFlowResultMasking(self,things_to_mask):
39  if isinstance(things_to_mask, str) or isinstance(things_to_mask, int):
40  return VIDCutFlowResult(self.__instance.getCutFlowResultMasking(things_to_mask))
41  elif not isinstance(things_to_mask, list):
42  raise Exception('InvalidType','getCutFlowResultMasking only accepts (lists of) strings or ints!')
43 
44  if isinstance(things_to_mask, list):
45  vect = None
46  if len(things_to_mask) <= 0:
47  raise Exception('NothingToMask')
48  if isinstance(things_to_mask[0], str):
49  vect = ROOT.std.vector('std::string')()
50  elif isinstance(things_to_mask[0], int):
51  vect = ROOT.std.vector('unsigned int')()
52  else:
53  raise Exception('InvalidType','getCutFlowResultMasking only accepts (lists of) strings or ints!')
54 
55  for item in things_to_mask:
56  vect.push_back(item)
57 
58  result = VIDCutFlowResult(self.__instance.getCutFlowResultMasking(vect))
59  del vect
60 
61  return result
62 
63 
64