jetweb is hosted by Hepforge, IPPP Durham

cedar.jetweb.generator
Class Generator

java.lang.Object
  extended by cedar.jetweb.generator.Generator
Direct Known Subclasses:
Herwig, Pythia

public abstract class Generator
extends java.lang.Object

Abstract base class for the JetWeb Monte Carlo generator interface.


Field Summary
protected  java.lang.String generatorName
           
protected  java.lang.String generatorVersion
           
protected  java.util.Set<java.lang.String> intArrayNames
           
protected  java.util.Set<java.lang.String> intNames
           
protected  java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Integer>> intParameterArrays
           
protected  java.util.HashMap<java.lang.String,java.lang.Integer> intParameters
           
protected  java.util.Set<java.lang.String> realArrayNames
           
protected  java.util.Set<java.lang.String> realNames
           
protected  java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Double>> realParameterArrays
           
protected  java.util.HashMap<java.lang.String,java.lang.Double> realParameters
           
 
Constructor Summary
Generator()
           
 
Method Summary
static java.util.Set<java.lang.String> allNames()
          Return a Set of all known generator names.
static java.util.Set<java.lang.String> allVersions(java.lang.String name)
          Return a vector of all known versions for the named generator.
abstract  boolean checkParameters()
          Perform any generator-specific consistency checks.
static java.lang.String defaultName()
          Return the name of the default generator.
static java.lang.String defaultVersion(java.lang.String name)
          Return the default version for the named generator.
 java.util.Set<java.lang.String> getIntArrayNames()
          return a Set containing the names of all known integer parameter arrays.
 java.util.Set<java.lang.String> getIntNames()
          return a Set containing the names of all known integer parameters.
 java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Integer>> getIntParameterArrays()
          Return a HashMap of the integer generator parameter arrays.
 java.util.HashMap<java.lang.String,java.lang.Integer> getIntParameters()
          Return a HashMap of the integer generator parameters.
 java.lang.Boolean getIsRelevantToPhoton(java.lang.String pName)
          Returns whether the named parameter is relevant to processes with photons
 java.lang.Boolean getIsRelevantToPhoton(java.lang.String aName, java.lang.Integer aIndex)
          Returns whether the named parameter in an array is relevant to processes with photons.
 java.lang.Boolean getIsRelevantToProton(java.lang.String pName)
           
 java.lang.Boolean getIsRelevantToProton(java.lang.String aName, java.lang.Integer aIndex)
           
 int getMaxIndex(java.lang.String name)
          Return the maximum allowed index for the named array.
abstract  java.lang.String getMCProcessName(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Integer>> parameters)
          Work out the process name from the input map of parameter names and values.
 int getMinIndex(java.lang.String name)
          Return the minimum allowed index for the named array.
 java.lang.String getName()
          Return the name of the generator.
protected abstract  java.lang.String getParticleName(java.lang.String pName)
          Send it the JetWeb standard name for a particle and return the name required by the specific generator in the control cards.
abstract  java.lang.String getProcessSelector(MCProcessType proc)
          Return the appropriate String to set the process(es) to be generated.
abstract  java.lang.Double getPthat()
          Return the minimum hard transverse momemtum for partonic scatters.
 java.util.Set<java.lang.String> getRealArrayNames()
          return a Set containing the names of all known real parameter arrays.
 java.util.Set<java.lang.String> getRealNames()
          return a Set containing the names of all known real parameters.
 java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Double>> getRealParameterArrays()
          Return a HashMap of the double generator parameter arrays.
 java.util.HashMap<java.lang.String,java.lang.Double> getRealParameters()
          Return a HashMap of the double generator parameters.
 java.lang.String getVersion()
          Return the version of the generator.
 boolean inModel(java.lang.String pName)
          This method allows you to exclude parameters from the list associated with the generator model.
 boolean inProcessType(java.lang.String pName)
          This method allows you to include parameters in the list associated with the processtype.
 boolean isConsistentWith(Generator gen)
          Check all the parameters of this generator versus another.
 java.lang.Boolean isRelevant(MCProcessType proc, java.lang.String pName)
          Is this parameter relevant? Defaults to true since DBGeneratormanager.checkRelevance(), and hence getIsRelevant, have true as the default.
 java.lang.Boolean isRelevant(MCProcessType proc, java.lang.String pName, java.lang.Integer aIndex)
           
static Generator Maker()
          Make a default generator
static Generator Maker(java.lang.String name, java.lang.String version)
          Little factory to make generators :)
 void setDefaults()
          Set all parameters to their default values.
 void setIntElement(java.lang.String name, int index, int value)
          Set an element of one of the integer arrays.
 Generator setIntParameterArrays(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Integer>> parm)
          Set the integer parameter arrays
 Generator setIntParameters(java.util.HashMap<java.lang.String,java.lang.Integer> parm)
          Set the integer parameters
 void setParameter(java.lang.String name, double value)
          Set the named double parameter
 void setParameter(java.lang.String name, int value)
          Set the named int parameter
 void setRealElement(java.lang.String name, int index, java.lang.Double value)
          Set an element of one of the real arrays.
 Generator setRealParameterArrays(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Double>> parm)
          Set the real parameter arrays
 Generator setRealParameters(java.util.HashMap<java.lang.String,java.lang.Double> parm)
          Set the real parameters
 void setSoftDefaults()
          Set any unset parameters to their default values.
 java.lang.String toString()
          Write a descriptive string for the generator.
 Generator union(Generator generator)
           
protected  void writeCommonFFKey(java.io.BufferedWriter newCards, MCProcessType proc)
          Write out common FFKEY-style control cards for a given MCProcessType
protected  void writeGenFFKey(java.io.BufferedWriter newCards, MCProcessType proc)
          Write out generator parameters in FFKEY-style control cards.
protected  void writePapersFFKey(java.io.BufferedWriter newCards, MCProcessType proc)
          Write out switches to turn on routines in FFKEY-style control cards.
protected  void writePDFFFKey(java.io.BufferedWriter newCards, Model model, MCProcessType proc)
          Write out generator parameters in FFKEY-style control cards.
abstract  void writeSteering(java.io.BufferedWriter newCards, Model model, MCProcessType proc)
          Write out the steering for this generator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

intParameters

protected java.util.HashMap<java.lang.String,java.lang.Integer> intParameters

realParameters

protected java.util.HashMap<java.lang.String,java.lang.Double> realParameters

intParameterArrays

protected java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Integer>> intParameterArrays

realParameterArrays

protected java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Double>> realParameterArrays

realArrayNames

protected java.util.Set<java.lang.String> realArrayNames

realNames

protected java.util.Set<java.lang.String> realNames

intArrayNames

protected java.util.Set<java.lang.String> intArrayNames

intNames

protected java.util.Set<java.lang.String> intNames

generatorVersion

protected java.lang.String generatorVersion

generatorName

protected java.lang.String generatorName
Constructor Detail

Generator

public Generator()
Method Detail

Maker

public static Generator Maker(java.lang.String name,
                              java.lang.String version)
                       throws JetWebException
Little factory to make generators :)

Throws:
JetWebException


Maker

public static Generator Maker()
                       throws JetWebException
Make a default generator

Throws:
JetWebException


getIntParameters

public java.util.HashMap<java.lang.String,java.lang.Integer> getIntParameters()
Return a HashMap of the integer generator parameters.


getRealParameters

public java.util.HashMap<java.lang.String,java.lang.Double> getRealParameters()
Return a HashMap of the double generator parameters.


getIntParameterArrays

public java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Integer>> getIntParameterArrays()
Return a HashMap of the integer generator parameter arrays.


getRealParameterArrays

public java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Double>> getRealParameterArrays()
Return a HashMap of the double generator parameter arrays.


setIntParameters

public Generator setIntParameters(java.util.HashMap<java.lang.String,java.lang.Integer> parm)
Set the integer parameters


setRealParameters

public Generator setRealParameters(java.util.HashMap<java.lang.String,java.lang.Double> parm)
Set the real parameters


setIntParameterArrays

public Generator setIntParameterArrays(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Integer>> parm)
Set the integer parameter arrays


setRealParameterArrays

public Generator setRealParameterArrays(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Double>> parm)
Set the real parameter arrays


setParameter

public void setParameter(java.lang.String name,
                         int value)
                  throws JetWebException
Set the named int parameter

Parameters:
String - name the name of the parameter to be set
int - the value to assign to the parameter
Throws:
JetWebException


setParameter

public void setParameter(java.lang.String name,
                         double value)
                  throws JetWebException
Set the named double parameter

Parameters:
String - name the name of the parameter to be set
double - the value to assign to the parameter
Throws:
JetWebException


setRealElement

public void setRealElement(java.lang.String name,
                           int index,
                           java.lang.Double value)
                    throws JetWebException
Set an element of one of the real arrays.

Parameters:
name - the name of the array
index - the index of the array element
value - the value which the array element will be set to.
Throws:
JetWebException


setIntElement

public void setIntElement(java.lang.String name,
                          int index,
                          int value)
                   throws JetWebException
Set an element of one of the integer arrays.

Parameters:
name - the name of the array
index - the index of the array element
value - the value which the array element will be set to.
Throws:
JetWebException


getMCProcessName

public abstract java.lang.String getMCProcessName(java.util.HashMap<java.lang.String,java.util.HashMap<java.lang.Integer,java.lang.Integer>> parameters)
                                           throws JetWebException
Work out the process name from the input map of parameter names and values.

Throws:
JetWebException


getProcessSelector

public abstract java.lang.String getProcessSelector(MCProcessType proc)
Return the appropriate String to set the process(es) to be generated. This has to be overridden with great care for each generator, making sure that the appropriate generator subprocesss are invoked, in an input card format understood be the generator, for each process and beam combination.


getMaxIndex

public int getMaxIndex(java.lang.String name)
                throws JetWebException
Return the maximum allowed index for the named array.

Throws:
JetWebException


getMinIndex

public int getMinIndex(java.lang.String name)
                throws JetWebException
Return the minimum allowed index for the named array.

Throws:
JetWebException


toString

public java.lang.String toString()
Write a descriptive string for the generator.

Overrides:
toString in class java.lang.Object


getName

public java.lang.String getName()
Return the name of the generator.


getVersion

public java.lang.String getVersion()
Return the version of the generator.


setSoftDefaults

public void setSoftDefaults()
                     throws JetWebException
Set any unset parameters to their default values.

Throws:
JetWebException


setDefaults

public void setDefaults()
                 throws JetWebException
Set all parameters to their default values.

Throws:
JetWebException


getPthat

public abstract java.lang.Double getPthat()
Return the minimum hard transverse momemtum for partonic scatters.


checkParameters

public abstract boolean checkParameters()
Perform any generator-specific consistency checks. Return true if everything has been set consistent, false if its broken and we don't know how to fix it.


getRealArrayNames

public java.util.Set<java.lang.String> getRealArrayNames()
                                                  throws JetWebException
return a Set containing the names of all known real parameter arrays.

Throws:
JetWebException


getRealNames

public java.util.Set<java.lang.String> getRealNames()
                                             throws JetWebException
return a Set containing the names of all known real parameters.

Throws:
JetWebException


getIntArrayNames

public java.util.Set<java.lang.String> getIntArrayNames()
                                                 throws JetWebException
return a Set containing the names of all known integer parameter arrays.

Throws:
JetWebException


getIntNames

public java.util.Set<java.lang.String> getIntNames()
                                            throws JetWebException
return a Set containing the names of all known integer parameters.

Throws:
JetWebException


defaultName

public static java.lang.String defaultName()
                                    throws JetWebException
Return the name of the default generator.

Throws:
JetWebException


allNames

public static java.util.Set<java.lang.String> allNames()
                                                throws JetWebException
Return a Set of all known generator names.

Throws:
JetWebException


allVersions

public static java.util.Set<java.lang.String> allVersions(java.lang.String name)
                                                   throws JetWebException
Return a vector of all known versions for the named generator.

Throws:
JetWebException


defaultVersion

public static java.lang.String defaultVersion(java.lang.String name)
                                       throws JetWebException
Return the default version for the named generator.

Throws:
JetWebException


getParticleName

protected abstract java.lang.String getParticleName(java.lang.String pName)
Send it the JetWeb standard name for a particle and return the name required by the specific generator in the control cards.


writeSteering

public abstract void writeSteering(java.io.BufferedWriter newCards,
                                   Model model,
                                   MCProcessType proc)
                            throws JetWebException
Write out the steering for this generator

Throws:
JetWebException


writeCommonFFKey

protected void writeCommonFFKey(java.io.BufferedWriter newCards,
                                MCProcessType proc)
                         throws JetWebException,
                                java.io.IOException
Write out common FFKEY-style control cards for a given MCProcessType

Throws:
JetWebException
java.io.IOException


writePDFFFKey

protected void writePDFFFKey(java.io.BufferedWriter newCards,
                             Model model,
                             MCProcessType proc)
                      throws JetWebException,
                             java.io.IOException
Write out generator parameters in FFKEY-style control cards.

Throws:
JetWebException
java.io.IOException


writeGenFFKey

protected void writeGenFFKey(java.io.BufferedWriter newCards,
                             MCProcessType proc)
                      throws JetWebException,
                             java.io.IOException
Write out generator parameters in FFKEY-style control cards.

Throws:
JetWebException
java.io.IOException


writePapersFFKey

protected void writePapersFFKey(java.io.BufferedWriter newCards,
                                MCProcessType proc)
                         throws JetWebException,
                                java.io.IOException
Write out switches to turn on routines in FFKEY-style control cards.

Throws:
JetWebException
java.io.IOException


inModel

public boolean inModel(java.lang.String pName)
This method allows you to exclude parameters from the list associated with the generator model. This is particularly useful for the parameters which only set the process type, not the model. The default implementation returns true for everything, i.e. excludes nothing.


inProcessType

public boolean inProcessType(java.lang.String pName)
This method allows you to include parameters in the list associated with the processtype. This is particularly useful for the parameters which only set the model, not the model. The default implementation returns false for everything, i.e. includes nothing.


isConsistentWith

public boolean isConsistentWith(Generator gen)
Check all the parameters of this generator versus another. Return true if they all match. If a parameter is undefined in either the input generator or this one, it is declared consistent.


union

public Generator union(Generator generator)
                throws JetWebException
Throws:
JetWebException

getIsRelevantToPhoton

public java.lang.Boolean getIsRelevantToPhoton(java.lang.String pName)
                                        throws JetWebException
Returns whether the named parameter is relevant to processes with photons

Throws:
JetWebException


getIsRelevantToPhoton

public java.lang.Boolean getIsRelevantToPhoton(java.lang.String aName,
                                               java.lang.Integer aIndex)
                                        throws JetWebException
Returns whether the named parameter in an array is relevant to processes with photons.

Throws:
JetWebException


getIsRelevantToProton

public java.lang.Boolean getIsRelevantToProton(java.lang.String pName)
                                        throws JetWebException
Throws:
JetWebException

getIsRelevantToProton

public java.lang.Boolean getIsRelevantToProton(java.lang.String aName,
                                               java.lang.Integer aIndex)
                                        throws JetWebException
Throws:
JetWebException

isRelevant

public java.lang.Boolean isRelevant(MCProcessType proc,
                                    java.lang.String pName)
                             throws JetWebException
Is this parameter relevant? Defaults to true since DBGeneratormanager.checkRelevance(), and hence getIsRelevant, have true as the default. If the process is not known (i.e. null) then have to assume it is relevant

Throws:
JetWebException


isRelevant

public java.lang.Boolean isRelevant(MCProcessType proc,
                                    java.lang.String pName,
                                    java.lang.Integer aIndex)
                             throws JetWebException
Throws:
JetWebException