Exemplo n.º 1
0
def makeGenEvents( genName    = "Pythia",
                   genProcess = "ttbar",
                   cfgGenName = "EvGen" ):
    """
    Little helper method to provide a quick way to produce Mc-events
    """
    msg = logging.getLogger( "McParticleTests" )
    
    if genName.lower() not in [ "pythia", "herwig" ]:
        raise RuntimeError ("Unknown GENERATOR [%s]" % str(genName))
    if genProcess not in ["ttbar", "HiggsTo4Leptons", "Z+j"]:
        raise RuntimeError ("Unknown PROCESS [%s]" % str(genProcess))

    if genName.lower() == "pythia":
        try:
            from Pythia_i.Pythia_iConf import Pythia
        except ImportError as err:
            msg.warning( "Could not load module Pythia_iConf" )
            raise err
        
        genAlg = Pythia(cfgGenName)
        genAlg.Tune_Name='ATLAS_20110103'
        if genProcess == "Z+j":
            genAlg.PythiaCommand = [ "pysubs msel 13",
                                     "pysubs ckin 3 18.",
                                     "pypars mstp 43 2" ]
        elif genProcess == "ttbar":
            # semi-leptonic decay of a ttbar pair (lepton=e,mu)
            genAlg.PythiaCommand = [
                "pysubs msel 6",
                "pysubs ckin 3 18.",
                "pypars mstp 43 2",
                # Customisation of subprocess generation
                "pysubs msub 81 1",    # qqbar -> QQbar
                "pysubs msub 82 1",    # gq -> QQbar
                "pysubs msub 96 1",    # SemiHard QCD 2 -> 2
                # top
                "pydat3 mdme 41 1 0", # gt
                "pydat3 mdme 42 1 0", # gamma t
                "pydat3 mdme 43 1 0", # Z0 t
                "pydat3 mdme 44 1 0", # W+ d
                "pydat3 mdme 45 1 0", # W+ s
                "pydat3 mdme 46 1 1", # W+ b
                "pydat3 mdme 47 1 0", # W+ b'
                "pydat3 mdme 48 1 0", # h0 t
                "pydat3 mdme 49 1 0", # H+ b
                "pydat3 mdme 50 1 0", # ~chi_10 ~t_1
                "pydat3 mdme 51 1 0", # ~chi_20 ~t_1
                "pydat3 mdme 52 1 0", # ~chi_30 ~t_1
                "pydat3 mdme 53 1 0", # ~chi_40 ~t_1
                "pydat3 mdme 54 1 0", # ~g ~t_1
                "pydat3 mdme 55 1 0", # ~gravitino ~t_1
                # W
                "pydat3 mdme 190 1 2", # dbar u
                "pydat3 mdme 191 1 2", # dbar c
                "pydat3 mdme 192 1 2", # dbar t
                "pydat3 mdme 193 1 0", # dbar t'
                "pydat3 mdme 194 1 2", # sbar u
                "pydat3 mdme 195 1 2", # sbar c
                "pydat3 mdme 196 1 2", # sbar t
                "pydat3 mdme 197 1 0", # sbar t'
                "pydat3 mdme 198 1 2", # bbar u
                "pydat3 mdme 199 1 2", # bbar c
                "pydat3 mdme 200 1 2", # bbar t
                "pydat3 mdme 201 1 0", # bbar t'
                "pydat3 mdme 202 1 0", # b'bar u
                "pydat3 mdme 203 1 0", # b'bar c
                "pydat3 mdme 204 1 0", # b'bar t
                "pydat3 mdme 205 1 0", # b'bar t'
                "pydat3 mdme 206 1 0", # e+ nu_e
                "pydat3 mdme 207 1 3", # mu+ nu_mu
                "pydat3 mdme 208 1 0", # tau+ nu_tau
                "pydat3 mdme 209 1 0"  # tau'+ nu'_tau
                ]
        elif genProcess == "HiggsTo4Leptons":
            genAlg.PythiaCommand = [
                # Higgs mass set:
                "pydat2 pmas 25 1 150.",
                # Select Higgs production
                "pysubs msel 16",
                # Higgs Decays
                "pydat3 mdme 210 1 0",
                "pydat3 mdme 211 1 0",
                "pydat3 mdme 212 1 0",
                "pydat3 mdme 213 1 0",
                "pydat3 mdme 214 1 0",
                "pydat3 mdme 215 1 0",
                "pydat3 mdme 218 1 0",
                "pydat3 mdme 219 1 0",
                "pydat3 mdme 220 1 0",
                "pydat3 mdme 222 1 0",
                "pydat3 mdme 223 1 0",
                "pydat3 mdme 224 1 0",
                "pydat3 mdme 225 1 1",
                "pydat3 mdme 226 1 0",
                
                # Z Decays
                "pydat3 mdme 174 1 0",
                "pydat3 mdme 175 1 0",
                "pydat3 mdme 176 1 0",
                "pydat3 mdme 177 1 0",
                "pydat3 mdme 178 1 0",
                "pydat3 mdme 179 1 0",
                "pydat3 mdme 180 1 0",
                "pydat3 mdme 181 1 0",
                "pydat3 mdme 182 1 1",
                "pydat3 mdme 183 1 0",
                "pydat3 mdme 184 1 1",
                "pydat3 mdme 185 1 0",
                "pydat3 mdme 186 1 0",
                "pydat3 mdme 187 1 0",
                "pydat3 mdme 188 1 0",
                "pydat3 mdme 189 1 0"
                ]
        else:
            raise RuntimeError ("Unknown PROCESS [%s]" % str(genProcess))

        # Some ISR,FSR,MultipleInteractions and Hadronization parameters
        genAlg.PythiaCommand += [
            "pypars mstp 61 1", # ISR
            "pypars mstp 71 1", # FSR
            "pypars mstp 81 1", # MultInt 
            "pypars mstp 111 1", # Hadronization
            ]
        
        # Pythia listing documentation level (0-1-2)
        genAlg.PythiaCommand += [ "pypars mstp 125 2" ]

    elif genName.lower() == "herwig":
        try:
            from Herwig_i.Herwig_iConf  import Herwig
        except ImportError as err:
            msg.warning( "Could not load module Herwig_iConf" )
            raise err
        genAlg = Herwig(cfgGenName)
        if genProcess == "Z+j":
            genAlg.HerwigCommand = [
                "iproc 2150",
                "modpdf 10042",
                "autpdf HWLHAPDF"
                ]
        
        elif genProcess == "ttbar":
            genAlg.HerwigCommand = ["iproc 1706","modpdf 10042",
                                    "autpdf HWLHAPDF" ]
        else:
            raise RuntimeError ("Unknown PROCESS [%s]" % str(genProcess))
        pass
        
    else:
        raise RuntimeError ("Unknown GENERATOR [%s]" % str(genName))

    return genAlg
uetune = 1

#####--------- Min_bias
if selector == "min_bias":
    Pythia.Tune_Name = "ATLAS_20080001"
    Pythia.PythiaCommand = [
        "pysubs msel 1",  #pre-programmed processes 
        "pyinit win 14000.",
        ##      #"pypars mstp 2  2",    #second order running alpha_s
        ##      #"pypars mstp 33 3",    #K-factors
        ##      #"pysubs ckin 13 -0.1.", #low limit of the highest rapidity
        ##      #"pysubs ckin 14  0.1.", #hight limit of the highest rapidity
        ##      #"pysubs ckin 15 -0.1.", #low limit of the smallest rapidity
        ##      #"pysubs ckin 16  0.1.", #hight limit of the smallest rapidity
        #"pypars mstp 81 1",     #multiple interaction on
        #"pypars mstp 82 4",     #impact parameter choice
        #"pydat1 mstj 11 3",     #(D=4), fragementation=hybrid scheme
        #"pydat1 mstj 22 2",     #(D=1), dist to deacay a part=parj(71)
        #"pydat1 parj 54 -0.07", #related to fragmentation
        #"pydat1 parj 55 -0.006",#related to fragmentation
        #"pypars parp 82 1.8",   #PT0 multiple distribution tail
        #"pystat 1 3 4 5",
        #"pyinit output event_listing.txt",
        #"pypars mstp 128 0",
        "pypars parp 84 0.5"
    ]  #gaussian distribution mstp(82)=4)
###--------- Z/gamma + jet production
##Pythia.PythiaCommand = [
##--      "pysubs msel 13",       #(D=1), user controlled processes selection
##      #"pysubs msub 1 1",     #Z/gamma process
##      #"pypars mstp 43 1",    #Z only. D=1=Z/Gamma mixture