def __init__(self, mw_param='', run_name='', auto=0): """ initialisation of the object """ #init self.y = {} self.dy = {} self.event = {} #to verify that all bin have the same number of data #charge parameter if run_name == '' and mw_param == '': self.MWparam = MW_param.MW_info('MadWeight_card.dat') elif mw_param == '': self.MWparam = MW_param.MW_info(run_name + '_banner.txt') else: self.MWparam = mw_param self.run_type = self.MWparam.info['mw_parameter'][ '1'] #how are use/generated param_card self.name = self.MWparam.name #init step 2 for k in self.MWparam.actif_param: self.y[k] = 0 self.dy[k] = 0 self.event[k] = 0 #launch everything if auto: self.make_all()
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 print 'time init Lhco_filter', time.time() - start if lhco_file and auto: self.verif_event(lhco_file, self.partdef)
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']['21']: 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)
def __init__(self, directory, lhco_file='', MWparam=''): """ input is either a file containing particule number info or a SubProcesses directory """ if MWparam: self.MWparam = MWparam else: import MW_param self.MWparam = MW_param.MW_info('MadWeight_card.dat') #treat directory info if directory.count('SubProcesses'): self.directory = directory else: self.directory = './SubProcesses/' + directory # find number of particle of each type if os.path.isfile(self.directory + 'info_part.dat'): self.extract_file_info(self.directory) else: self.load_particle_number(self.directory) self.init_hlt_cut() if self.MWparam.info.has_key('hltcut'): self.update_hlt_cut() if lhco_file: self.verif_event(lhco_file)
def oneSetUp(self): """prepare the runs """ os.system('./bin/PassToMadWeight') os.system('rm ./Cards/proc_card_mg5.dat') os.system('ln -s ../Source/MadWeight/test_files/proc_card_mg5.dat ./Cards') os.system('./bin/newprocess') os.system('./bin/madweight.py -12') self.MWparam = MW_param.MW_info('MadWeight_card.dat')
def __init__(self,name='acceptance'): """read the card""" MW_param.go_to_main_dir() self.MWparam=MW_param.MW_info('MadWeight_card.dat') self.name=name self.dir=os.getcwd().split('/')[-1] os.system('mkdir Events/'+self.MWparam.name) os.system('mkdir Events/'+self.MWparam.name+'/Acceptance') create_param.Param_card(run_name=self.MWparam) self.MWparam.update_nb_card() os.chdir('..')
def test_autofiles(self): if not self.checkSetUp(): self.oneSetUp() else: self.MWparam = MW_param.MW_info('MadWeight_card.dat') for MWdir in self.MWparam.MW_listdir: for filename in ['main_code%s.f', 'data%s.inc','d_choices%s.f','d_choices%s.inc','info_part%s.dat','multi_channel%s.f','transfer_functions%s.f']: text = 'diff ./SubProcesses/%s/' + filename + ' ./Source/MadWeight/test_files/'+ filename os.system(text % (MWdir, '', MWdir[4])) self.assertTrue(filecmp.cmp(os.path.join('./SubProcesses/',MWdir, filename % ''), './Source/MadWeight/test_files/' + filename % MWdir[4], False), 'not valid file %s in process %s' % (filename % '', MWdir))
# dir_sche=create_dir(MW_param) # dir_sche.all() # os.chdir("../../../") # print 'created',dir_sche.created,'directories' # return dir_sche.created def create_all_schedular(MWparam): for directory in MWparam.MW_listdir + MWparam.P_listdir: try: os.mkdir('./SubProcesses/' + directory + '/schedular') except: pass ############################################################################################## ## Single Launch ## ############################################################################################## if __name__ == '__main__': #reupdate all the active card to a certain nuber of event #import global run opt import MW_param MW_param.go_to_main_dir() MWparam = MW_param.MW_info('MadWeight_card.dat') #launch the check create_obj = create_dir(MWparam) create_obj.update_card_status()