Exemplo n.º 1
0
    def __init__(self):
        self.lhco_file = raw_input(
            'enter the name of the file to test : ').split()[0]
        Card_pos = raw_input(
            'give position to a MadWeight_card.dat: ').split()[0]
        import MW_param
        self.MWparam = MW_param.MW_info(Card_pos)
        val = ''
        while val not in ['0', '1']:
            val = raw_input('use the file info_part.dat (0/1)?')
        if val == '1':
            self.partdef = self.extract_file_info()
        else:
            self.nb_part = {}
            for element in [
                    'jet', 'bjet', 'electron', 'positron', 'muon', 'amuon',
                    'tau', 'atau', 'miss'
            ]:
                value = raw_input(
                    'enter authorize value for the nb of particule of type ' +
                    element + ' : ')
                value.split()
                if len(value) == 1: self.nb_part[element] = int(value[0])
                else: self.nb_part[element] = value
            self.nb_part['photon'] = 0

        partdef = lhco_all_particles_def()
        if not self.MWparam.info['mw_perm']['bjet_is_jet_for_selection']:
            partdef.use_bjet()
        if self.MWparam.info.has_key('eventselection'):
            partdef.update_hlt_cut(self.MWparam.info['eventselection'])
        self.partdef = partdef
        #define internal variable
        self.write_events = 0
        self.verif_event(self.lhco_file, self.partdef, output=1)
Exemplo n.º 2
0
    def configure(self):
        os.chdir(pjoin(self.me_dir))
        self.__CMD__initpos = self.me_dir

        time_mod = max([
            os.path.getctime(pjoin(self.me_dir, 'Cards', 'run_card.dat')),
            os.path.getctime(pjoin(self.me_dir, 'Cards', 'MadWeight_card.dat'))
        ])


        if self.configured > time_mod and \
                           hasattr(self,'MWparam') and hasattr(self,'run_card'):
            return
        self.configured = time.time()

        self.MWparam = MW_info.MW_info(
            pjoin(self.me_dir, 'Cards', 'MadWeight_card.dat'))
        run_card = pjoin(self.me_dir, 'Cards', 'run_card.dat')
        self.run_card = banner.RunCard(run_card)

        if self.options['run_mode'] == 0:
            self.exec_cmd('set run_mode 2 --no_save')
            self.exec_cmd('set nb_core 1 --no_save')
        if not self.options['cluster_temp_path']:
            if self.options['run_mode'] == 2:
                logger.info(
                    'Options cluster_temp_path is required for MW run. Trying to run with /tmp',
                    '$MG:color:BLACK')
                self.exec_cmd('set cluster_temp_path /tmp --no_save')
            elif self.options['cluster_type'] != 'condor':
                raise Exception, 'cluster_temp_path needs to be define for MW. Please retry.'
Exemplo n.º 3
0
    def __init__(self,
                 directory,
                 lhco_file='',
                 MWparam='',
                 auto=1,
                 write_mode=1):
        """ input is either a file containing particule number info or a SubProcesses directory """

        start = time.time()
        if MWparam:
            self.MWparam = MWparam
        else:
            import MW_param
            self.MWparam = MW_param.MW_info('MadWeight_card.dat')
        self.write_mode = write_mode

        #treat directory info
        if directory.count('SubProcesses'):
            self.directory = directory
        else:
            self.directory = './SubProcesses/' + directory

        self.lhco_file = lhco_file
        self.partdef = self.find_particle_number(
        )  # find number of particle of each type
        #define internal variable
        self.write_events = 0
        if lhco_file and auto:
            self.verif_event(lhco_file, self.partdef)