Exemple #1
0
    def create_ordering_file(self):
        """ take input form TF_input.dat and insert in ordering_file.inc"""
        
        #collect particle information
        thin=[]
        large=[]
        with_x=0
        theta = []
        phi = []
        for block in self.block.values():
            if block.order==1:
                thin+=block.particles
            elif block.order==2:
                large+=block.particles
            if "x1" in block.particles or "x2" in block.particles:
                with_x=1
            if block['THETA'].tf_code.strip() != 'tf=1d0' or \
                block['THETA'].width_code.strip() != 'width=0d0':
                theta += block.particles
            if block['PHI'].tf_code.strip() != 'tf=1d0' or \
                block['PHI'].width_code.strip() != 'width=0d0':
                phi += block.particles            

        #define the rule of how modif file transfer_function/input/ordering_file.inc        
        modif_rule={}
        modif_rule['THIN']=','.join(thin)
        modif_rule['LARGE']=','.join(large)
        modif_rule['X']=str(with_x)
        modif_rule['NAME_TF']=self.tf_name
        modif_rule['THETA'] = ','.join(theta)
        modif_rule['PHI'] =  ','.join(phi)

        #modify file
        mod_file.mod_file('./input/ordering_file.inc',modif_rule,write='./ordering_file.inc')
Exemple #2
0
def activate_acceptance_run():
    """ 1. reactivate the write of events .lhe
        2. modify combine_event.f
        3. modify pythia-pgs/src/pythia.f  --> Pass in standard in special package
        4. modify pythia-pgs/src/pgs.f     --> Pass in standard in special package
        5. compile those modification
    """
    #0. test if the card/directory exist
    if not (os.path.isfile('./Cards/pythia_card.dat')
            and os.path.isfile('./Cards/pgs_card.dat')
            and os.path.isdir('../MW_pythia-pgs')):
        raise AcceptanceError(
            'Cards or MW_pythia-pgs missing... impossible to load acceptance module'
        )

    #1. test if the acc is already loaded
    if os.path.isfile('./Source/MadWeight_file/acc.in'):
        return
    os.system('touch ./Source/MadWeight_file/acc.in')

    #2. reactivate the write of events .lhe
    mod_file.mod_file('./SubProcesses/unwgt.f', {'S-DECOMMENT_C': ''})

    #3. change combine_events.f
    mod_file.mod_file('./Source/combine_events.f',
                      './Source/MadWeight/mod_file/mod_combine_events')

    #4. modify pythia_card.dat
    mod_file.mod_file('./Cards/pythia_card.dat',
                      './Source/MadWeight/mod_file/mod_combine_events')

    #4. modify pythia-pgs/src/pythia.f
    #os.system('cp ../pythia-pgs/src/pythia.f ../pythia-pgs/src/pythia_default.f')
    #rule={}
    #rule['def_file']=change_tf.put_in_fortran_format("""
    # write(*,*) 'enter input/output file for MW run'
    # read(*,*) input_file,output_file
    #pythia_card='../Cards/pythia_card.dat'
    # nfiles=1
    #""")
    #mod_file.mod_file('../pythia-pgs/src/pythia.f',rule)

    #4. modify pythia-pgs/src/pgs.f
    #os.system('cp ../pythia-pgs/src/pgs.f ../pythia-pgs/src/pgs_default.f')
    #rule={}
    #rule['def_file']=change_tf.put_in_fortran_format("""
    #    write(*,*) 'enter input file for MW run'
    #    read(*,*) pgs_input_file
    #    write(*,*) 'enter output file for MW run'
    #    read(*,*) pgs_output_file
    #""")
    #mod_file.mod_file('../pythia-pgs/src/pgs.f',rule)

    #5.compile the new files
    os.system("cd Source;make ../bin/combine_events;cd -")
    os.system("cd ../MW_pythia-pgs;make &>/dev/null")
def activate_acceptance_run():
    """ 1. reactivate the write of events .lhe
        2. modify combine_event.f
        3. modify pythia-pgs/src/pythia.f  --> Pass in standard in special package
        4. modify pythia-pgs/src/pgs.f     --> Pass in standard in special package
        5. compile those modification
    """
    #0. test if the card/directory exist
    if not( os.path.isfile('./Cards/pythia_card.dat') and
            os.path.isfile('./Cards/pgs_card.dat') and
            os.path.isdir('../MW_pythia-pgs')):
        raise AcceptanceError, 'Cards or MW_pythia-pgs missing... impossible to load acceptance module'
        
    #1. test if the acc is already loaded
    if os.path.isfile('./Source/MadWeight_file/acc.in'):
        return
    os.system('touch ./Source/MadWeight_file/acc.in')

    #2. reactivate the write of events .lhe
    mod_file.mod_file('./SubProcesses/unwgt.f',{'S-DECOMMENT_C':''})

    #3. change combine_events.f
    mod_file.mod_file('./Source/combine_events.f','./Source/MadWeight/mod_file/mod_combine_events')

    #4. modify pythia_card.dat
    mod_file.mod_file('./Cards/pythia_card.dat','./Source/MadWeight/mod_file/mod_combine_events')

    #4. modify pythia-pgs/src/pythia.f
    #os.system('cp ../pythia-pgs/src/pythia.f ../pythia-pgs/src/pythia_default.f')
    #rule={}
    #rule['def_file']=change_tf.put_in_fortran_format("""
    # write(*,*) 'enter input/output file for MW run'
    # read(*,*) input_file,output_file
    #pythia_card='../Cards/pythia_card.dat'      
    # nfiles=1
    #""")
    #mod_file.mod_file('../pythia-pgs/src/pythia.f',rule)
    
    #4. modify pythia-pgs/src/pgs.f
    #os.system('cp ../pythia-pgs/src/pgs.f ../pythia-pgs/src/pgs_default.f')
    #rule={}
    #rule['def_file']=change_tf.put_in_fortran_format("""
    #    write(*,*) 'enter input file for MW run'
    #    read(*,*) pgs_input_file
    #    write(*,*) 'enter output file for MW run'
    #    read(*,*) pgs_output_file
    #""")
    #mod_file.mod_file('../pythia-pgs/src/pgs.f',rule)

    #5.compile the new files
    os.system("cd Source;make ../bin/combine_events;cd -")
    os.system("cd ../MW_pythia-pgs;make &>/dev/null")
Exemple #4
0
def update_cuts_status(MW_param):
    """ remove the call to the cuts if asked in MadWeight_Card.dat """

# Pierre: pass
    return

    #check cut status for cross section:
    if (MW_param.info['mw_run']['use_cut']+cut_is_active('cuts.f'))%2: #pass if not coherent between asked and actual status
        file_to_mod=['./SubProcesses/cuts.f']
        rule=['./Source/MadWeight/mod_file/suppress_cuts_MG']
        #modify file
        mod_file.mod_file(file_to_mod,rule,opt={'nowarning':"""['PASSCUTS','MW_NEW_DEF','DESACTIVATE_BW_CUT']"""})
        #check update
        check_Subprocesses_update('cuts.f',MW_param.P_listdir,'./Source/MadWeight/mod_file/suppress_cuts_MG')

    #check cut status for Weight computation:
    if (MW_param.info['mw_run']['use_cut']+cut_is_active('cuts_MW.f'))%2: #pass if not coherent between asked and actual status
        file_to_mod=['./SubProcesses/cuts_MW.f']
        rule=['./Source/MadWeight/mod_file/suppress_cuts_MW']
        #modify file
        mod_file.mod_file(file_to_mod,rule,opt={'nowarning':"""['PASSCUTS','TO_SPECISA','DESACTIVATE_BW_CUT']"""})
        #check update
        check_Subprocesses_update('cuts_MW.f',MW_param.MW_listdir,'./Source/MadWeight/mod_file/suppress_cuts_MW')

    #check BW cut status for cross section
    if (MW_param['mw_run']['bw_cut']+bw_cut_is_active('cuts.f'))%2: #pass if not coherent between asked and actual status
        file_to_mod=['./SubProcesses/cuts.f']
        rule=['./Source/MadWeight/mod_file/suppress_BW_cuts']
        #modify file
        mod_file.mod_file(file_to_mod,rule,opt={'nowarning':"""['PASSCUTS','MW_NEW_DEF']"""})
        #check update 
        check_Subprocesses_update('cuts.f',MW_param.P_listdir,'./Source/MadWeight/mod_file/suppress_BW_cuts')

    #check cut status for Weight computation:
    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
        file_to_mod=['./SubProcesses/cuts_MW.f']
        rule=['./Source/MadWeight/mod_file/suppress_BW_cuts']
        #modify file               
        mod_file.mod_file(file_to_mod,rule,opt={'nowarning':"""['PASSCUTS','TO_SPECISA']"""})
        #check update
        check_Subprocesses_update('cuts_MW.f',MW_param.MW_listdir,'./Source/MadWeight/mod_file/suppress_BW_cuts')
Exemple #5
0
 def modiffile(self,file,rule):
     mod_file.mod_file(file,rule)