示例#1
0
    def ResetMultiparticles(self):

        # Reset multiparticles
        self.main.multiparticles.Reset()

        # Opening a CmdDefine
        cmd_define = CmdDefine(self.main)

        # Loading particles
        input = ParticleReader(self.main.archi_info.ma5dir, cmd_define,
                               self.main.mode)
        input.Load()
        input = MultiparticleReader(self.main.archi_info.ma5dir, cmd_define,
                                    self.main.mode, self.main.forced)
        input.Load()
示例#2
0
 def InitializeMultiparticle(self):
     input = MultiparticleReader(self.main.archi_info.ma5dir,self.cmd_define,self.main.mode,self.main.forced)
     input.Load()
示例#3
0
    def do_main(self, args):

        # Looking for '='
        if args[1] != '=':
            logging.getLogger('MA5').error(
                "syntax error with the command 'set'.")
            self.help()
            return

        # Looking for one dot in the name
        object = args[0]
        #        object = object.lower()
        object = object.replace('fastsim.bjet_id.', 'fastsim.bjet_idXXX')
        object = object.replace('fastsim.tau_id.', 'fastsim.tau_idXXX')
        objs = object.split('.')
        for i in range(len(objs)):
            objs[i] = objs[i].replace('XXX', '.')

        if len(objs) == 2 and objs[0].lower() == 'main' and objs[1].lower(
        ) == 'recast':
            user_info = UserInfo()
            user_info.ReadUserOptions(
                self.main.archi_info.ma5dir +
                '/madanalysis/input/installation_options.dat')
            checker = ConfigChecker(self.main.archi_info, user_info,
                                    self.main.session_info, self.main.script,
                                    False)
            hasdelphes = checker.checkDelphes(True)
            hasMA5tune = checker.checkDelphesMA5tune(True)
            hasPAD = checker.checkPAD()
            hasPADtune = checker.checkPADForMA5tune()
            self.main.recasting.user_SetParameter(
                "status", args[2], self.main.mode,
                self.main.archi_info.has_root, hasdelphes, hasMA5tune,
                self.main.datasets, hasPAD, hasPADtune)
            if args[2] == 'on' and self.main.fastsim.package != 'none':
                logging.getLogger('MA5').warning(
                    "Fastsim package switched off and internally handled")
                self.main.fastsim.package = "none"
        elif len(objs) == 2 and objs[0].lower() == 'main':
            if objs[1] == 'mode' and args[2] == 'parton':
                self.main.mode = MA5RunningType.PARTON
                self.main.ResetParameters()
                self.main.AutoSetGraphicalRenderer()
                self.main.InitObservables(self.main.mode)
                lvl = logging.getLogger('MA5').getEffectiveLevel()
                logging.getLogger('MA5').setLevel(100)
                self.main.multiparticles.Reset()
                cmd_define = CmdDefine(self.main)
                input = ParticleReader(self.main.archi_info.ma5dir, cmd_define,
                                       self.main.mode, self.main.forced)
                input.Load()
                input = MultiparticleReader(self.main.archi_info.ma5dir,
                                            cmd_define, self.main.mode,
                                            self.main.forced)
                input.Load()
                logging.getLogger('MA5').setLevel(lvl)
            else:
                self.main.user_SetParameter(objs[1], args[2])
        elif len(objs) == 3 and objs[0].lower() == 'main' and objs[1].lower(
        ) == 'isolation':
            self.main.isolation.user_SetParameter(objs[2], args[2])
        elif len(objs) == 3 and objs[0].lower() == 'main' and objs[1].lower(
        ) == 'fom':
            self.main.fom.user_SetParameter(objs[2], args[2])
        elif len(objs) == 3 and objs[0].lower() == 'main' and objs[1].lower(
        ) == 'merging':
            self.main.merging.user_SetParameter(
                objs[2], args[2], self.main.mode,
                self.main.archi_info.has_fastjet)
        elif len(objs) == 3 and objs[0].lower() == 'main' and objs[1].lower(
        ) == 'fastsim':
            user_info = UserInfo()
            user_info.ReadUserOptions(
                self.main.archi_info.ma5dir +
                '/madanalysis/input/installation_options.dat')
            checker = ConfigChecker(self.main.archi_info, user_info,
                                    self.main.session_info, self.main.script,
                                    False)
            hasdelphes = checker.checkDelphes(True)
            hasMA5tune = checker.checkDelphesMA5tune(True)
            self.main.fastsim.user_SetParameter(
                objs[2], args[2], self.main.datasets, self.main.mode,
                self.main.archi_info.has_fastjet, hasdelphes, hasMA5tune)
            if objs[2] == 'package' and args[2] in [
                    'fastjet', 'delphes', 'delphesMA5tune'
            ] and self.main.recasting.status == 'on':
                logging.getLogger('MA5').warning("Recasting mode switched off")
                self.main.recasting.status = "off"
        elif len(objs) == 3 and objs[0].lower() == 'main' and objs[1].lower(
        ) == 'recast':
            user_info = UserInfo()
            user_info.ReadUserOptions(
                self.main.archi_info.ma5dir +
                '/madanalysis/input/installation_options.dat')
            checker = ConfigChecker(self.main.archi_info, user_info,
                                    self.main.session_info, self.main.script,
                                    False)
            hasdelphes = checker.checkDelphes(True)
            hasMA5tune = checker.checkDelphesMA5tune(True)
            hasPAD = checker.checkPAD()
            hasPADtune = checker.checkPADForMA5tune()
            self.main.recasting.user_SetParameter(
                objs[2], args[2], self.main.mode,
                self.main.archi_info.has_root, hasdelphes, hasMA5tune,
                self.main.datasets, hasPAD, hasPADtune)
        else:
            logging.getLogger('MA5').error(
                "syntax error with the command 'set'.")
            self.help()
            return
示例#4
0
    def ImportJob(self, filename, myinterpreter, history):
        self.logger.info("SampleAnalyzer job folder is detected")
        self.logger.info(
            "Restore MadAnalysis configuration used for this job ...")

        # Ask question
        if not self.main.forced:
            self.logger.warning(
                "You are going to reinitialize MadAnalysis 5. The current configuration will be lost."
            )
            self.logger.warning("Are you sure to do that ? (Y/N)")
            allowed_answers = ['n', 'no', 'y', 'yes']
            answer = ""
            while answer not in allowed_answers:
                answer = raw_input("Answer: ")
                answer = answer.lower()
            if answer == "no" or answer == "n":
                return False

        self.main.datasets.Reset()

        # Reset selection
        self.main.selection.Reset()

        # Reset main
        self.main.ResetParameters()

        # Reset multiparticles
        self.main.multiparticles.Reset()

        # Opening a CmdDefine
        cmd_define = CmdDefine(self.main)

        # Loading particles
        input = ParticleReader(self.main.archi_info.ma5dir, cmd_define,
                               self.main.mode)
        input.Load()
        input = MultiparticleReader(self.main.archi_info.ma5dir, cmd_define,
                                    self.main.mode, self.main.forced)
        input.Load()

        # Reset history
        myinterpreter.history = []

        # Load script
        myinterpreter.load(filename + '/history.ma5')

        # Saving job name as global variable
        self.main.lastjob_name = filename
        self.main.lastjob_status = False

        # Extract info from ROOT file
        layout = Layout(self.main)
        if not self.extract(filename, layout):
            return

        # Initialize selection for generating report
        self.main.selection.RefreshStat()

        # Status = GOOD
        self.main.lastjob_status = True

        # Computing
        layout.Initialize()

        # Cleaning the directories
        if not FolderWriter.RemoveDirectory(self.main.lastjob_name + '/HTML',
                                            False):
            return
        if self.main.session_info.has_pdflatex:
            if not FolderWriter.RemoveDirectory(
                    self.main.lastjob_name + '/PDF', False):
                return
        if self.main.session_info.has_latex:
            if not FolderWriter.RemoveDirectory(
                    self.main.lastjob_name + '/DVI', False):
                return

        # Creating the reports
        self.CreateReports([self.main.lastjob_name], history, layout)
示例#5
0
 def InitializeMultiparticle(self):
     input = MultiparticleReader(self.main.ma5dir, self.cmd_define,
                                 self.main.mode)
     input.Load()