Package madgraph :: Package madweight :: Module create_run
[hide private]
[frames] | no frames]

Source Code for Module madgraph.madweight.create_run

  1  #!/usr/bin/env python 
  2   
  3  #Extension 
  4  import string,os,sys,re,popen2,time,stat,filecmp 
  5   
  6  try:  
  7      import madgraph.madweight.mod_file as mod_file 
  8      import madgraph.madweight.change_tf as change_tf 
  9      #import madgraph.various.progressbar as progressbar 
 10  except ImportError: 
 11      import internal.madweight.mod_file as mod_file 
 12      #import internal.madweight.progressbar as progressbar 
 13   
 14   
 15  ########################################################################### 
 16  ##                                CONTENT                                ## 
 17  ##                                -------                                ## 
 18  ##                                                                       ## 
 19  ##    + update_cuts_status                                               ## 
 20  ##         activate/desactivate the cuts in ME/MW                        ## 
 21  ##     + cut_is_active (send cut status)                                 ## 
 22  ##     + check_Subprocesses_update (check if Subprocces/(MW_?)P files    ## 
 23  ##         follows the last version of the file -protection against cp-) ## 
 24  ##    + active_acceptance_run                                            ## 
 25  ##    + desactive_acceptance_run                                         ## 
 26  ##    + del_old_dir                                                      ## 
 27  ##    + create_dir                                                       ## 
 28  ##    + copy_file                                                        ## 
 29  ##    + put_data                                                         ## 
 30  ##    + restore_last_info_for_control (not use anymore)                  ## 
 31  ##    + create_all_MWdir                                                 ## 
 32  ##    + create_all_Pdir                                                  ## 
 33  ##    + create_all_schedular                                             ## 
 34  ########################################################################### 
 35   
 36   
 37  ########################################################################### 
 38  ###################           VARIABLE GLOBALE           ################## 
 39  ########################################################################### 
 40  opt=sys.argv 
 41  write = sys.stdout.write 
 42   
 43   
44 -class NoMoreEvent(Exception):
45 pass
46 47 ########################################################################### 48 ################### GESTION OF CUT (des)ACTIVATE ################## 49 ########################################################################### 50
51 -def update_cuts_status(MW_param):
52 """ remove the call to the cuts if asked in MadWeight_Card.dat """ 53 54 # Pierre: pass 55 return 56 57 #check cut status for cross section: 58 if (MW_param.info['mw_run']['use_cut']+cut_is_active('cuts.f'))%2: #pass if not coherent between asked and actual status 59 file_to_mod=['./SubProcesses/cuts.f'] 60 rule=['./Source/MadWeight/mod_file/suppress_cuts_MG'] 61 #modify file 62 mod_file.mod_file(file_to_mod,rule,opt={'nowarning':"""['PASSCUTS','MW_NEW_DEF','DESACTIVATE_BW_CUT']"""}) 63 #check update 64 check_Subprocesses_update('cuts.f',MW_param.P_listdir,'./Source/MadWeight/mod_file/suppress_cuts_MG') 65 66 #check cut status for Weight computation: 67 if (MW_param.info['mw_run']['use_cut']+cut_is_active('cuts_MW.f'))%2: #pass if not coherent between asked and actual status 68 file_to_mod=['./SubProcesses/cuts_MW.f'] 69 rule=['./Source/MadWeight/mod_file/suppress_cuts_MW'] 70 #modify file 71 mod_file.mod_file(file_to_mod,rule,opt={'nowarning':"""['PASSCUTS','TO_SPECISA','DESACTIVATE_BW_CUT']"""}) 72 #check update 73 check_Subprocesses_update('cuts_MW.f',MW_param.MW_listdir,'./Source/MadWeight/mod_file/suppress_cuts_MW') 74 75 #check BW cut status for cross section 76 if (MW_param['mw_run']['bw_cut']+bw_cut_is_active('cuts.f'))%2: #pass if not coherent between asked and actual status 77 file_to_mod=['./SubProcesses/cuts.f'] 78 rule=['./Source/MadWeight/mod_file/suppress_BW_cuts'] 79 #modify file 80 mod_file.mod_file(file_to_mod,rule,opt={'nowarning':"""['PASSCUTS','MW_NEW_DEF']"""}) 81 #check update 82 check_Subprocesses_update('cuts.f',MW_param.P_listdir,'./Source/MadWeight/mod_file/suppress_BW_cuts') 83 84 #check cut status for Weight computation: 85 if (MW_param.info['mw_run']['bw_cut']+bw_cut_is_active('cuts_MW.f'))%2: #pass if not coherent between asked and actual status 86 file_to_mod=['./SubProcesses/cuts_MW.f'] 87 rule=['./Source/MadWeight/mod_file/suppress_BW_cuts'] 88 #modify file 89 mod_file.mod_file(file_to_mod,rule,opt={'nowarning':"""['PASSCUTS','TO_SPECISA']"""}) 90 #check update 91 check_Subprocesses_update('cuts_MW.f',MW_param.MW_listdir,'./Source/MadWeight/mod_file/suppress_BW_cuts')
92 93 94 95 96
97 -def cut_is_active(filename):
98 """ check is the cut is active or not """ 99 100 # Pierre: pass the fucntion 101 pass
102 103 # for line in file('./SubProcesses/'+filename): 104 # if line.count('DESACTIVATE_CUT'): 105 # return 1 106 # elif line.count('ACTIVATE_CUT'): 107 # return 0 108
109 -def bw_cut_is_active(filename):
110 """ check is the bw_cutt is active or not """ 111 for line in file('./SubProcesses/'+filename): 112 if 'DESACTIVATE_BW_CUT' in line: 113 return 1 114 elif 'ACTIVATE_BW_CUT' in line: 115 return 0 116 raise Exception
117 118 119
120 -class check_Subprocesses_update:
121 """ check if Subprocces/'listdir' files follows the last version of 122 ./SubProcesses/'filename'. This is a protection against copy files 123 -normally they are just linked- 124 125 different mode are available 126 warning: 127 0: no warning apply modification 128 1: warning and apply modification 129 2: warning and user choice 130 3: warning but no modification 131 4: no warning and no modification 132 5: warning and raising error 133 modifrule: 134 '', copy the original file 135 else: apply the modification asked in modifrule 136 137 """ 138
139 - class ERROR_DifferenceInFile(Exception):pass
140 141 142
143 - def __init__(self,filelist,listdir,modifrule='',warning=1,run=1):
144 145 #chek type input: 146 if type(filelist)==str: 147 self.filelist=[filelist] 148 else: 149 self.filelist=filelist 150 if type(listdir)==str: 151 self.listdir=[listdir] 152 else: self.listdir=listdir 153 154 self.modifrule=modifrule 155 156 157 #assign tag mode 158 usewarning=0 159 if int(warning) in [1,2,3,5]: 160 self.usewarning=1 161 162 self.usemodif=0 163 self.intmode=0 164 self.raiseerror=0 165 if int(warning) in [0,1]: 166 self.usemodif=1 #apply 167 elif int(warning)==2: 168 self.intmode=1 #interactive mode 169 elif int(warning)==5: 170 self.raiseerror==1 #raising error 171 172 if run: 173 self.compare()
174 175
176 - def compare(self):
177 #main loop 178 for dirname in self.listdir: 179 for filename in self.filelist: 180 status=filecmp.cmp('./SubProcesses/'+filename,'./SubProcesses/'+dirname+'/'+filename) 181 182 if status: 183 continue #continue check if ok 184 185 #warning 186 if self.usewarning: 187 self.printwarning('./SubProcesses/'+filename,'./SubProcesses/'+dirname+'/'+filename) 188 189 #error 190 if self.raiseerror: 191 raise self.ERROR_DifferenceInFile 192 193 #interactive mode 194 if self.intmode: 195 self.usemodif=self.printintmode('./SubProcesses/'+dirname+'/'+filename) 196 197 #modif file 198 if self.usemodif: 199 self.modiffile('./SubProcesses/'+dirname+'/'+filename,self.modifrule)
200 201
202 - def printwarning(self,filename1,filename2):
203 204 print """ WARNING: those file are supposed to be identical (symbolic link):\n\ 205 ./SubProcesses/"""+filename1+"""\n./SubProcesses/"""+filename2 206 print """ define the tag MW_run/901 to change the rule for modification """ 207 if self.usemodif==0: 208 print """ no modification to the file are done """ 209 elif self.usemodif==1: 210 print """ modify the file """
211
212 - def printintmode(self,file):
213 214 a=raw_input('modify file '+file+'with rule'+self.modifrule+'? (y/n)') 215 if a=='y': 216 return 1 217 elif a=='n': 218 return 0 219 else: 220 a=self.printintmode(file) 221 return a
222
223 - def modiffile(self,file,rule):
224 mod_file.mod_file(file,rule)
225 226 ########################################################################### 227 ######### ACTIVATE/DESACTIVATE ACCEPTANCE TERM ########### 228 ###########################################################################
229 -class AcceptanceError(Exception): pass
230
231 -def activate_acceptance_run():
232 """ 1. reactivate the write of events .lhe 233 2. modify combine_event.f 234 3. modify pythia-pgs/src/pythia.f --> Pass in standard in special package 235 4. modify pythia-pgs/src/pgs.f --> Pass in standard in special package 236 5. compile those modification 237 """ 238 #0. test if the card/directory exist 239 if not( os.path.isfile('./Cards/pythia_card.dat') and 240 os.path.isfile('./Cards/pgs_card.dat') and 241 os.path.isdir('../MW_pythia-pgs')): 242 raise AcceptanceError, 'Cards or MW_pythia-pgs missing... impossible to load acceptance module' 243 244 #1. test if the acc is already loaded 245 if os.path.isfile('./Source/MadWeight_file/acc.in'): 246 return 247 os.system('touch ./Source/MadWeight_file/acc.in') 248 249 #2. reactivate the write of events .lhe 250 mod_file.mod_file('./SubProcesses/unwgt.f',{'S-DECOMMENT_C':''}) 251 252 #3. change combine_events.f 253 mod_file.mod_file('./Source/combine_events.f','./Source/MadWeight/mod_file/mod_combine_events') 254 255 #4. modify pythia_card.dat 256 mod_file.mod_file('./Cards/pythia_card.dat','./Source/MadWeight/mod_file/mod_combine_events') 257 258 #4. modify pythia-pgs/src/pythia.f 259 #os.system('cp ../pythia-pgs/src/pythia.f ../pythia-pgs/src/pythia_default.f') 260 #rule={} 261 #rule['def_file']=change_tf.put_in_fortran_format(""" 262 # write(*,*) 'enter input/output file for MW run' 263 # read(*,*) input_file,output_file 264 #pythia_card='../Cards/pythia_card.dat' 265 # nfiles=1 266 #""") 267 #mod_file.mod_file('../pythia-pgs/src/pythia.f',rule) 268 269 #4. modify pythia-pgs/src/pgs.f 270 #os.system('cp ../pythia-pgs/src/pgs.f ../pythia-pgs/src/pgs_default.f') 271 #rule={} 272 #rule['def_file']=change_tf.put_in_fortran_format(""" 273 # write(*,*) 'enter input file for MW run' 274 # read(*,*) pgs_input_file 275 # write(*,*) 'enter output file for MW run' 276 # read(*,*) pgs_output_file 277 #""") 278 #mod_file.mod_file('../pythia-pgs/src/pgs.f',rule) 279 280 #5.compile the new files 281 os.system("cd Source;make ../bin/combine_events;cd -") 282 os.system("cd ../MW_pythia-pgs;make &>/dev/null")
283 284
285 -def desactivate_acceptance_run():
286 """ check that the event are not written """ 287 288 if os.path.isfile('./Source/MadWeight_file/acc.in'): 289 import expand_MadWeight 290 expand_MadWeight.expand_all(echap=['MadWeight_card.dat']) 291 os.system('rm ./Source/MadWeight_file/acc.in')
292 293
294 -def restore_pythia_pgs():
295 pass
296 # os.system('cp ../pythia-pgs/src/pythia_default.f ../pythia-pgs/src/pythia.f') 297 # os.system('cp ../pythia-pgs/src/pgs_default.f ../pythia-pgs/src/pgs.f') 298 # os.system("cd ../pythia-pgs;make &>/dev/null") 299 300 301 ########################################################################### 302 ######### CREATION DES DOSSIER/FICHIERS DE SORTIE ########### 303 ########################################################################### 304 305 #1 ##################################################################################
306 -class create_dir:
307 """create all the directory for the run """ 308 309 #2 ##############################################################################
310 - def __init__(self,MWparam):
311 312 self.MWparam=MWparam 313 self.dir_name=MWparam.name 314 315 self.ref_card=self.MWparam.actif_param[0] #card where the file verif.lhco are written and not linked 316 self.created=0
317 318 #2 ##############################################################################
319 - def all(self):
320 321 print 'creating all directories' 322 323 # Pierre 324 # if self.MWparam.norm_with_cross: 325 # for dir in self.MWparam.P_listdir: 326 # self.all_dir(dir) 327 # else: 328 # pass 329 330 if self.MWparam.nb_event: 331 for dir in self.MWparam.MW_listdir: 332 self.all_dir(dir)
333 334 #2 ##############################################################################
335 - def all_dir(self,dir):
336 """creates the directory for standard run """ 337 338 self.dir_type='M' # dir[0] Pierre: only one dir type (MadWeight type) 339 self.Sdir_pos='./SubProcesses/'+dir 340 try: 341 os.mkdir('./SubProcesses/'+dir) 342 except: 343 pass 344 345 346 if self.dir_type=='M': 347 if self.MWparam['mw_run']['22']: 348 self.add_events() 349 else: 350 print 'create M dir' 351 self.create_M_dir() 352 else: 353 if self.MWparam['mw_run']['22']: 354 return 355 self.create_P_dir() 356 357 print 'created',self.created,'directories' 358 self.created=0
359 360 #2 ##############################################################################
361 - def update_card_status(self,cardref=-1,number_of_event=-1):
362 """creates the directory for standard run 363 number_of_event[-1]:-1:automatic (number of event of cardref if !=-1, highest existing event in other case 364 """ 365 366 #check if all card have a directory in P_ 367 list_card=[num for num in self.MWparam.actif_param] 368 #progress bar 369 pbar = progressbar.progbar('update Pdir',len(list_card)*len(self.MWparam.P_listdir)) 370 for directory in self.MWparam.P_listdir: 371 self.dir_type=directory[0] 372 self.Sdir_pos='./SubProcesses/'+directory 373 for card in list_card: 374 self.create_one_P_dir(card,remove_old=0) 375 pbar.update() 376 pbar.finish() 377 378 #find cardref and number_of_event if not defined 379 if number_of_event==-1 and cardref==-1: #search the card with the maximum of event defined 380 self.dir_type='M' 381 self.Sdir_pos='./SubProcesses/'+self.MWparam.MW_listdir[0] 382 for card in self.MWparam.actif_param: 383 event=self.find_exist_event(card) 384 if event>=number_of_event: 385 cardref=card 386 number_of_event=event 387 elif cardref==-1: 388 ref_num=number_of_event-1 #-1 due to the starting at zero 389 for card in self.MWparam.actif_param: 390 if self.find_exist_event(card)>=ref_num: 391 cardref=card 392 393 if cardref==-1 or number_of_event==-1: 394 sys.exit('impossible to update card and/or number of event not defined') 395 else: 396 self.ref_card=cardref 397 398 #update events 399 #progress bar 400 list_card=self.MWparam.actif_param 401 list_event=range(0,number_of_event) 402 if (len(list_card))*(len(list_event))*len(self.MWparam.MW_listdir)>0: 403 pbar = progressbar.progbar('update MWdir',(len(list_card))*(len(list_event))*len(self.MWparam.P_listdir)) 404 for dir in self.MWparam.MW_listdir: 405 self.dir_type=dir[0] 406 self.Sdir_pos='./SubProcesses/'+dir 407 408 #then pass in update mode for all the card 409 for card in list_card: 410 for event in list_event: 411 self.create_one_M_dir(card,event,remove_old=0) 412 pbar.update() 413 pbar.finish()
414 415 416 #2 ##############################################################################
417 - def add_events(self):
418 419 self.file_event=open(self.Sdir_pos+'/'+self.MWparam.name+'/verif.lhco') 420 self.line_event=self.file_event.readline() 421 422 nb_exist_event=self.find_exist_event() 423 list_card=self.MWparam.actif_param 424 list_event=range(nb_exist_event,nb_exist_event+self.MWparam.nb_event) 425 pbar = progressbar.progbar('create_dir',(len(list_card))*(len(list_event))) 426 for card in list_card: 427 for event in list_event: 428 self.create_one_M_dir(card,event) 429 pbar.update() 430 pbar.finish()
431 432 433 434 #2 ###############################################################################
435 - def find_exist_event(self,card_nb=-1):
436 """ find the maximal event number in this SubProcess""" 437 438 if card_nb==-1: 439 card_nb=self.ref_card 440 directory=self.Sdir_pos+'/'+self.MWparam.name 441 442 return self.MWparam.find_existing_events(directory,card_nb)
443 444 #2 ##############################################################################
445 - def create_M_dir(self):
446 447 self.file_event=open(self.Sdir_pos+'/'+self.MWparam.name+'/verif.lhco') 448 self.line_event=self.file_event.readline() 449 dirname = self.Sdir_pos.split('/')[-1] 450 self.del_old_dir() 451 list_card=self.MWparam.actif_param 452 453 #progress bar 454 pbar = progressbar.progbar('create_dir',(len(list_card))*(self.MWparam.nb_event_MW[dirname])) 455 for card in list_card: 456 list_event=range(0, self.MWparam.nb_event_MW[dirname]) 457 try: 458 os.mkdir(self.Sdir_pos+'/'+self.MWparam.name+'/card_'+str(card)) 459 except: 460 pass 461 for event in list_event: 462 try: 463 self.create_one_M_dir(card,event) 464 except NoMoreEvent: 465 os.system('rm -rf %s' % self.Sdir_pos+'/'+self.MWparam.name+'/card_'+str(card)) 466 self.MWparam.nb_event_MW[dirname] = event 467 break 468 469 pbar.update() 470 pbar.finish()
471 472 #2 ##############################################################################
473 - def create_P_dir(self):
474 475 self.del_old_dir() 476 list_card=[num for num in self.MWparam.actif_param] 477 #progress bar 478 pbar = progressbar.progbar('create_dir',len(list_card)) 479 for card in list_card: 480 self.create_one_P_dir(card) 481 pbar.update() 482 pbar.finish()
483 484 #2 ##############################################################################
485 - def create_one_M_dir(self,card,event,remove_old=1):
486 """ create the directory for the event \"event\" and the card nb \"card\" 487 """ 488 dir_name=self.MWparam.name 489 pos=self.Sdir_pos+'/'+dir_name+'/card_'+str(card)+'/event_'+str(event)+'/' 490 #check that upper level exist 491 if not os.path.isdir(self.Sdir_pos+'/'+dir_name+'/card_'+str(card)): 492 os.mkdir(self.Sdir_pos+'/'+dir_name+'/card_'+str(card)) 493 494 # if not os.path.isdir(pos): 495 # os.mkdir(pos) 496 497 try: 498 os.mkdir(pos) 499 except OSError: 500 if remove_old: 501 os.system('rm '+pos+'/* >/dev/null') 502 # else: 503 # return 504 505 506 ff=open(pos+'/param.dat','w') 507 ff.writelines('param_card_'+str(card)+'.dat\n') 508 ff.writelines(str(self.MWparam['mw_run']['MW_int_points'])+'\n') 509 ff.close() 510 511 if card==self.ref_card: 512 data=self.give_new_exp_point() 513 hh=open(pos+'/verif.lhco','w') 514 hh.writelines(data) 515 hh.close() 516 else: 517 try: 518 os.symlink('../../card_'+str(self.ref_card)+'/event_'+str(event)+'/verif.lhco',pos+'/verif.lhco') 519 except OSError: 520 pass 521 self.created+=1
522 523 524 #2 ##############################################################################
525 - def create_one_P_dir(self,card,remove_old=1):
526 """ create the directory for the event \"event\" and the card nb \"card\" 527 """ 528 dir_name=self.MWparam.name 529 pos=self.Sdir_pos+'/'+dir_name+'/card_'+str(card) 530 try: 531 os.mkdir(pos) 532 except: 533 if remove_old: 534 os.system('rm '+pos+'/* >/dev/null') 535 else: 536 return 537 ff=open(pos+'/param.dat','w') 538 ff.writelines('param_card_'+str(card)+'.dat\n') 539 ff.writelines(str(self.MWparam['mw_run']['MW_int_points'])+'\n') 540 ff.close() 541 os.system('ln -s ../../madevent.py '+pos+'/madevent.py') 542 os.system('ln -s ../../madevent '+pos+'/madevent') 543 os.system('ln -s ../../input_app.txt '+pos+'/input_app.txt') 544 os.system('ln -s ../../symfact.dat '+pos+'/symfact.dat') 545 #add link to a job: 546 for file in os.listdir(pos+'/../../'): 547 if len(file)>4 and file[:4]=='ajob': 548 os.system('ln -s ../../'+file+' '+pos) 549 550 self.created+=1
551 552 Pattern=re.compile(r'''^\s*0\s+\d+\s+\d+\s*$''',re.I) 553 #2 ##############################################################################
554 - def give_new_exp_point(self):
555 556 data=self.line_event 557 while 1: 558 try: 559 line=self.file_event.readline() 560 except ValueError: 561 raise NoMoreEvent 562 563 if line=='': 564 self.file_event.close() 565 if data == '': 566 raise NoMoreEvent 567 return data 568 if self.Pattern.search(line): 569 self.line_event=line 570 return data 571 else: 572 data+=line
573 574 #2 ##############################################################################
575 - def del_old_dir(self):
576 ''' delete old event directory ''' 577 578 output=1 579 #verification du format des dossiers 580 list_dir=os.listdir(os.pardir) 581 if self.MWparam.info['mw_run']['22']: 582 print self.Sdir_pos.split('/')[-1],': no deleting' 583 return output 584 585 print self.Sdir_pos.split('/')[-1],': deleting old run directory' 586 print os.getcwd() 587 os.system('mkdir '+self.Sdir_pos+'/'+self.MWparam.name+'/') 588 for datafile in os.listdir(self.Sdir_pos+'/'+self.MWparam.name): 589 if datafile not in ['verif.lhco']: 590 try: os.system('rm '+self.Sdir_pos+'/'+self.MWparam.name+'/'+datafile+' -rf') 591 except: 592 print "WARNING: this directory ", os.getcwd()+'/'+self.Sdir_pos+'/'+self.MWparam.name," are not deleted" 593 output=0 594 595 596 597 return output
598 599 ###### copy file
600 -def copy_file(list,i):
601 pos=os.getcwd() 602 init_dir=os.sep+pos.split(os.sep)[-1] 603 604 title=[] 605 content=[] 606 607 for file in list: 608 title.append(file.split('/')[-1]) 609 ff=open(file,'r') 610 content.append(ff.readlines()) 611 ff.close() 612 613 # for i in range(0,nmax): 614 os.chdir('../'+dir_name+str(i)) 615 for i in range(0,len(title)): 616 ff=open('./'+title[i],'w') 617 ff.writelines(content[i]) 618 ff.close() 619 os.chdir(os.pardir+init_dir)
620
621 -def restore_last_info_for_control(MW_param):
622 """ restore run info for controlling """ 623 624 pattern=re.compile(r'''condor_id/\s*(?P<run_list>.+)\s*/job/\s*(?P<job>\d*)''',re.DOTALL) 625 launch_job=0 626 run_job=[] 627 dir_list=[] 628 629 for dir in MW_param.P_listdir+MW_param.MW_listdir: 630 ff=open('./SubProcesses/'+dir+'/schedular/condor.log','r') 631 text=ff.readline() 632 ff.close() 633 pat=pattern.search(text) 634 if pat: 635 launch_job+=int(pat.group('job')) 636 prov_job=eval(pat.group('run_list')) 637 dir_list+=[dir]*len(prov_job) 638 run_job+=prov_job 639 return launch_job,run_job,dir_list
640 641 642 #def return_failed(dir,MW_param): 643 # """read the failed process and return them in a list """ 644 # 645 # try: 646 # ff=open('./SubProcesses/'+dir+'/'+MW_param.name+'/failed_job.dat','r') 647 # except: 648 # return [] 649 # out=[] 650 # while 1: 651 # line=ff.readline() 652 # if line=='': 653 # break 654 # out.append(line.replace('\n','')) 655 # 656 # return out 657 658 659 ########################################################################### 660 ################### MAIN PROGRAM ################## 661 ########################################################################### 662 #def create_all_MWdir(dir,MW_param): 663 # """n: number of data , name : name_run""" 664 # 665 # run_name=MW_param.name 666 # try: 667 # os.chdir('./SubProcesses/'+dir+'/schedular') 668 # except: 669 # os.mkdir('./SubProcesses/'+dir+'/schedular') 670 # os.chdir('./SubProcesses/'+dir+'/schedular') 671 # 672 # os.system('mkdir ../'+run_name+'&>/dev/null') 673 # dir_sche=create_dir(MW_param) 674 # dir_sche.all() 675 # os.chdir("../../../") 676 # print 'created',dir_sche.created,'directories' 677 # return dir_sche.created 678 679 ########################################################################### 680 ################### MAIN PROGRAM 2 ################## 681 ########################################################################### 682 683 #def create_all_Pdir(dir,MW_param): 684 # """n: number of data , name : name_run"""## 685 # 686 # #re-init global parameter 687 # run_name=MW_param.name 688 ## os.system(' mkdir ./SubProcesses/'+dir+'/schedular') 689 # os.chdir('./SubProcesses/'+dir+'/schedular') 690 # os.system(' mkdir ../'+run_name+'&>/dev/null') 691 # dir_sche=create_dir(MW_param) 692 # dir_sche.all() 693 # os.chdir("../../../") 694 # print 'created',dir_sche.created,'directories' 695 # return dir_sche.created 696 697
698 -def create_all_schedular(MWparam):
699 700 for directory in MWparam.MW_listdir+MWparam.P_listdir: 701 try: 702 os.mkdir('./SubProcesses/'+directory+'/schedular') 703 except: 704 pass
705 706 707 708 709 710 711 ############################################################################################## 712 ## Single Launch ## 713 ############################################################################################## 714 if __name__=='__main__': 715 716 717 #reupdate all the active card to a certain number of event 718 #import global run opt 719 import MW_param 720 MW_param.go_to_main_dir() 721 MWparam=MW_param.MW_info('MadWeight_card.dat') 722 723 #launch the check 724 create_obj=create_dir(MWparam) 725 create_obj.update_card_status() 726 # for dir in MWparam.MW_listdir: 727 # create_obj.Sdir_pos='./SubProcesses/'+dir 728 # print create_obj.find_exist_event(1) 729