Exemple #1
0
    def Open(self):

        # Checking input dir
        if not os.path.isdir(self.input_path):
            logging.error("no directory denoted by '" + self.input_path +
                          "' found.")
            return False

        # Creating list of ROOT files
        for ind in range(0, len(self.main.datasets)):
            name = InstanceName.Get(self.main.datasets[ind].name)
            self.files.append(
                RootFileReader(
                    os.path.normpath(self.input_path + "/root/" + name +
                                     ".root")))

        # Trying to open each ROOT files
        for ind in range(0, len(self.files)):
            if not self.files[ind].Open():
                for i in range(0, ind):
                    self.files[i].Close()
                return False

        # Creating production directory
        if not FolderWriter.CreateDirectory(self.output_path, True):
            return False

        # Creating cut flow for each file
        for ind in range(0, len(self.files)):
            self.cutflow.append(CutFlow(self.main.datasets[ind],\
                                        self.main.selection,\
                                        self.main.lumi,
                                        self.main))
        # Good end
        return True
Exemple #2
0
 def __init__(self, main):
     self.main = main
     self.input_path = self.main.lastjob_name
     self.cutflow = CutFlow(self.main)
     self.plotflow = PlotFlow(self.main)
     self.merging = MergingPlots(self.main)
     self.logger = logging.getLogger('MA5')
Exemple #3
0
    def DoEfficiencies(self):

        if self.main.selection.Ncuts == 0:
            return True

        for i in range(0, len(self.cutflow)):
            if not self.cutflow[i].initializeFromFile(self.files[i]):
                return False

            self.cutflow[i].calculate()

        self.signal     = CutFlow(self.main.datasets[0],\
                                  self.main.selection,\
                                  self.main.lumi,\
                                  self.main)
        self.background = CutFlow(self.main.datasets[0],\
                                  self.main.selection,\
                                  self.main.lumi,\
                                  self.main)

        signalvect = []
        backgroundvect = []

        for i in range(0, len(self.main.datasets)):
            if not self.main.datasets[i].background:
                signalvect.append(self.cutflow[i])
            else:
                backgroundvect.append(self.cutflow[i])

        if len(signalvect) != 0:
            self.signal.initializeFromCutflow(signalvect)
            self.isSignal = True
        if len(backgroundvect) != 0:
            self.background.initializeFromCutflow(backgroundvect)
            self.isBackground = True

        return True