Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:24:10

0001 import ROOT
0002 import string
0003 import random
0004 
0005 # load FWLite C++ libraries
0006 ROOT.gSystem.Load("libFWCoreFWLite.so");
0007 ROOT.gSystem.Load("libDataFormatsFWLite.so");
0008 ROOT.FWLiteEnabler.enable()
0009 
0010 class VIDCutFlowResult:
0011     def __init__(self, instance):
0012         self.__instance = instance
0013 
0014     def cutFlowName(self):
0015         return self.__instance.cutFlowName()
0016     
0017     def cutFlowPassed(self):
0018         return self.__instance.cutFlowPassed()
0019 
0020     def cutFlowSize(self):
0021         return self.__instance.cutFlowSize()
0022 
0023     def getNameAtIndex(self,idx):
0024         return self.__instance.getNameAtIndex(idx)
0025 
0026     def getCutResultByIndex(self,idx):
0027         return self.__instance.getCutResultByIndex(idx)
0028 
0029     def getCutResultByName(self,name):
0030         return self.__instance.getCutResultByName(name)
0031 
0032     def isCutMasked(self,idx_or_name):
0033         return self.__instance.isCutMasked(idx_or_name)
0034 
0035     def getValueCutUpon(self,idx_or_name):
0036         return self.__instance.getValueCutUpon(idx_or_name)
0037     
0038     def getCutFlowResultMasking(self,things_to_mask):       
0039         if isinstance(things_to_mask, str) or isinstance(things_to_mask, int):
0040             return VIDCutFlowResult(self.__instance.getCutFlowResultMasking(things_to_mask))
0041         elif not isinstance(things_to_mask, list):
0042             raise Exception('InvalidType','getCutFlowResultMasking only accepts (lists of) strings or ints!')
0043             
0044         if isinstance(things_to_mask, list):
0045             vect = None
0046             if len(things_to_mask) <= 0: 
0047                 raise Exception('NothingToMask')
0048             if isinstance(things_to_mask[0], str):
0049                 vect = ROOT.std.vector('std::string')()
0050             elif isinstance(things_to_mask[0], int):
0051                 vect = ROOT.std.vector('unsigned int')()
0052             else:
0053                 raise Exception('InvalidType','getCutFlowResultMasking only accepts (lists of) strings or ints!')
0054         
0055         for item in things_to_mask:
0056             vect.push_back(item)
0057 
0058         result = VIDCutFlowResult(self.__instance.getCutFlowResultMasking(vect))
0059         del vect
0060         
0061         return result
0062 
0063             
0064