Home · Overview · Users Guide · Reference Guide

Sartre Class Reference

The Sartre class is the central class for event generation. It provides methods to initialize, control and run event generation. More...

 #include "Sartre.h"

Public Member Functions

  Sartre()
  ~Sartre()
virtual bool init(const char* = 0)
virtual bool init(const string&)
virtual Event* generateEvent()
virtual double totalCrossSection()
virtual double totalCrossSection(double lower[3], double upper[3])
EventGeneratorSettings* runSettings()
const Frangiblenucleus* nucleus() const
void listStatus(ostream& os=cout)
time_t runTime() const
vector<pair<double,double> > kinematicLimits()

Detailed Description

The Sartre class is the main class the user has to deal with in order to generate events or calculate cross-sections in certain kinematic ranges. After creating an instance of Sartre, Sartre::init() should be called in order to fully initialize and setup Sartre. After the call to init(), Sartre is ready to generate events. Sartre is holding all its settings and required parameters in an instance of class EventGeneratorSettings (private data member). Parameters can in generally be set in two ways:

  1. Programmatically using the many access function of the EventGeneratorSettings class. For example:
  2.                 Sartre mySartre;
                    EventGeneratorSettings *mySettings = mySartre.runSettings();
                    
                    mySettings->setVerbose(false);
                    mySettings->setNumberOfEvents(1000);   
                    mySettings->setVectorMesonId(333);   
                    mySettings->setElectronBeamEnergy(27.);   
                    mySettings->setHadronBeamEnergy(300.);   
                    mySettings->setDipoleModelType(bSat);   
                    mySettings->setA(1); // proton   
                    
                    bool ok = mySartre.init();
                    
                    // if ok ready to generate events ... 
  3. Through a runcard (see the Runcard Reference Documentation)
  4.                 Sartre mySartre;
                    EventGeneratorSettings *mySettings = mySartre.runSettings();
                    
                    bool ok = mySartre.init("myRuncard.txt);
                    
                    // if ok ready to generate events ... 

You can of course also use a mix of both. Note, however, that the settings in the runcard passed to init() overwrite all previous settings.

Once Sartre is initialized through init(), parameter should not be changed any more. In most cases it will have no effect to start with.

For technical reasons EventGeneratorSettings is a singleton class, meaning only one instance can exist at any given time. Because of this multiple instances of Sartre do share the same settings. Changing it in one instance would alter it in all. It is therefore not recommended to run multiple instances of Sartre at the same time. You can, however, reinitialize Sartre by calling init() at any time.

Events are generated through a call to generateEvent(). Note that the event record from the previous event gets deleted each time a new event is generated. If you want to keep a certain event you need too copy the object you obtained from generateEvent(). For example:

            Event *myevent = mySartre.generateEvent();
            Event keptEvent = *myevent;  // keep this one
            myevent = mySartre.generateEvent();

Sartre can also be used to calculate cross-sections w/o generating events by using an overloaded version of totalCrossSection(). Here is a very simple example:
            Sartre mySartre;
            mySartre.init("myRuncard.txt");
            double lower[3], upper[3];
            lower[0] = -0.2;  upper[0] = -0.05; // t
            lower[1] = 5;     upper[1] = 6;     // Q2
            lower[2] = 30;    upper[2] = 32;    // W
            double cs = mySartre.totalCrossSection(lower, upper);
            cout << "Cross-section is: " << cs << " nb" << endl;

On kinematic limits: Sartre has to deal with several kinematic limits:

  1. Those given by the user via runcard or programmatically in (Q2, and W).
  2. The kinematic limits given by the event kinematic, essentially the beam energies.
  3. The range of the amplitude tables available for the selected hadron beam species (in t, Q2, and W).

In init() Sartre will take all three into account and calculate the largest possible range not exceeding the range provided by the user (1). If the range has to be reduced a warning is printed but the program is not stopped. The actual used kinematic limit is printed during initialization and can also be obtained at any time using the kinematicLimits() method. To obtain the largest possible limit given by the tables and kinematic range (beam energies) the user should set Q2min > Q2max and Wmin > Wmax.

On CPU time: Event generation in Sartre is extremely fast ( < 0.5 ms/event) when run w/o nuclear breakup switched on. Calculating the total cross section at the end (mandatory if you want to absolutely normalize the output) can be a bit slow depending on the range chosen.


Public Member Function Documentation

Sartre()

Constructor. Note that in order to fully initialize the instance Sartre::init() has to be called.

~Sartre()

Destructor.

virtual bool init(const char* runcardfile = 0)

Initializes Sartre. After this call, Sartre is ready to generate events and/or perform cross-section calculations. runcardfile is the name of the runcard file (simple text file) containing some or all setup parameters. There is no predefined extension for this kinds of file. The argument is optional. If given, Sartre will load the runcard and sets all parameters given in it's instance of EventGeneratorSettings. A pointer to that instance can be obtained through Sartre::runSettings(). If no argument is provided Sartre will use the settings as defined in its instance of EventGeneratorSettings before calling init(). See Detailed Description for more.

virtual bool init(const string& runcardfile)

Overloaded version of above method. Here runcardfile is a string.

virtual Event* generateEvent()

Generates one event and returns a pointer to an instance of class Event that holds the event record. Note that the old event record is deleted first thing in this method. If the user wants to keep the previous event he/she needs to make a copy of the event record, i.e., copy the object returned by generateEvent().

virtual double totalCrossSection()

Returns the total cross-section in nb (nanobarn) in the kinematic limits used for event generation. Note that this method is slow since a 3-dim integration is performed.

Knowledge of the calculated cross-section is mandatory for the user to normalization the generated output of Sartre. Hence this function should always be called typically at the end of each event generating application.

virtual double totalCrossSection(double lower[3], double upper[3])

Overloaded method from above. Returns the total cross-section in nb (nanobarn) in the kinematic limits passed as arguments. This method is useful when Sartre is deployed to calculate cross-sections in certain kinematic ranges for comparisons or evaluations of yields. See for example the heraCompare.cpp program in the examples/ directory.

lower[0] = tmin, upper[0] = tmax
lower[1] = Q2min, upper[1] = Q2max
lower[2] = Wmin, upper[2] = Wmax

Remember that t is negative so be careful when setting lower[0] and upper[0].

As mentioned above this method is slow due to the 3D integration that is performed.

EventGeneratorSettings* runSettings()

Returns pointer to the EventGeneratorSettings instance Sartre is using. It contains all parameters that can be used to setup and tune Sartre.

const Frangiblenucleus* nucleus() const

Returns constant pointer to the current Nucleus Sartre is using. Useful after the event is generated to look into details of the breakup in the incoherent case. Note that the object from the previous event gets overwritten when generateEvent() is called.

void listStatus(ostream& os=cout) const

Prints-out the current status of Sartre. If no output stream os is given will print to screen (cout). Prints the current event number and the number of tries, as well as the elapsed run time.

time_t runTime() const

Returns the elapsed run time in seconds since call to init().

vector<pair<double,double> > kinematicLimits()

Returns the kinematic limits currently used in Sartre. Note that these do not necessarily have to be identical with the limits provided by the user (explanation is here). Order in the vector is: t, Q2, W. pair::first is the lower limit and pair::second the upper limit.

 

   

Last Update: January 11, 2013