IAP GITLAB

Commit 7218d442 authored by Ralf Ulrich's avatar Ralf Ulrich

Working version of crmc. Started to implement many of the point from the todo list.

* version v0r2
* started integration of all possible output formats in one executable. Can do hepmc/hepmc.gz/root now. LHE missing.
* use boost program_option
* remove all global variables



git-svn-id: https://devel-ik.fzk.de/svn/mc/crmc/trunk@2878 c7a5e08c-de06-0410-9364-b41cf42a0b17
parent 989221ba
......@@ -4,19 +4,20 @@ PROJECT (crmc)
######################################ONLY EDIT THIS######################################
SET (CMAKE_INSTALL_PREFIX ${PROJECT_BINARY_DIR})
# Enable/Disble models to be built
# Enable/Disable models to be built
OPTION (__QGSJET01__ "Build with model" ON)
OPTION (__GHEISHA__ "Build with model" OFF)
OPTION (__PYTHIA__ "Build with model" OFF)
OPTION (__HIJING__ "Build with model" OFF)
OPTION (__SIBYLL__ "Build with model" ON)
OPTION (__QGSJETII__ "Build with model" ON)
# TODO want to disable epos, too
# TODO better support for model versions
######################################ONLY EDIT THIS######################################
# The version number
SET (CRMC_VERSION_MAJOR 0)
SET (CRMC_VERSION_MINOR 1)
SET (CRMC_VERSION_MINOR 2)
# hotfix for lxbatch not sure why he selects wrong compiler
#SET (CMAKE_Fortran_COMPILER gfortran)
......@@ -45,8 +46,10 @@ ENDIF("${isSystemDir}" STREQUAL "-1")
## find packages
SET (CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeModules" CACHE PATH "Module Path" FORCE)
# TODO ROOT NOT REQUIRED
FIND_PACKAGE (Root REQUIRED)
FIND_PACKAGE (Boost REQUIRED COMPONENTS filesystem iostreams system program_options)
# TODO HepMC NOT REQUIRED
FIND_PACKAGE (HepMC REQUIRED COMPONENTS HepMC HepMCfio)
## configure a header file to pass some of the CMake settings to the source code
......@@ -104,13 +107,13 @@ INCLUDE_DIRECTORIES ("${PROJECT_BINARY_DIR}/src") #cmake config file
INCLUDE_DIRECTORIES ("${HepMC_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES ("${Boost_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES ("${ROOT_INCLUDE_DIR}")
ADD_EXECUTABLE(Crmc src/crmchep.cc src/crmctrapfpe.c src/crmc-aaa.f src/models.F)
ADD_EXECUTABLE(crmc src/crmc.cc src/crmctrapfpe.c src/crmc-aaa.f src/models.F)
# linking of modules
TARGET_LINK_LIBRARIES (Crmc ${HepMC_LIBRARIES})
TARGET_LINK_LIBRARIES (Crmc ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES (Crmc ${ROOT_LIBRARIES})
TARGET_LINK_LIBRARIES (Crmc ${EXTRA_MODELS})
TARGET_LINK_LIBRARIES (crmc ${HepMC_LIBRARIES})
TARGET_LINK_LIBRARIES (crmc ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES (crmc ${ROOT_LIBRARIES})
TARGET_LINK_LIBRARIES (crmc ${EXTRA_MODELS})
## installation
# configure the parameter file
......@@ -124,12 +127,12 @@ endif(CMAKE_HOST_UNIX)
# install executable
INSTALL (PROGRAMS ${PROJECT_SOURCE_DIR}/src/crmc.py DESTINATION bin)
INSTALL (PROGRAMS ${PROJECT_BINARY_DIR}/Crmc DESTINATION bin RENAME crmc)
INSTALL (PROGRAMS ${PROJECT_BINARY_DIR}/crmc DESTINATION bin RENAME crmc)
# enable dashboard scripting
include (CTest)
ADD_TEST (CrmcRuns bin/crmc -s 123 -f ctest)
ADD_TEST (CrmcCheckFile md5sum "ctest")
SET_TESTS_PROPERTIES (CrmcCheckFile PROPERTIES PASS_REGULAR_EXPRESSION ".*13a1067a443279b3e397eab0e58e2e4e ctest")
ADD_TEST (CrmcRemoveFile rm "ctest")
ADD_TEST (crmcRuns bin/crmc -s 123 -f ctest)
ADD_TEST (crmcCheckFile md5sum "ctest")
SET_TESTS_PROPERTIES (crmcCheckFile PROPERTIES PASS_REGULAR_EXPRESSION ".*13a1067a443279b3e397eab0e58e2e4e ctest")
ADD_TEST (crmcRemoveFile rm "ctest")
add license here
\ No newline at end of file
#ifndef __CRMC_INTERFACE_H
#define __CRMC_INTERFACE_H
// -------------- forward declarations
extern "C"
{
void crmc_f_( int&, double&, int&, double&, double&, double&,
double&, double&);
}
extern "C"
{
void crmc_init_f_( int&, double&, double&, int&, int&, int&, const char*);
}
extern "C"
{
extern struct
{
float sigtot;
float sigcut;
float sigela;
float sloela;
float sigsd;
float sigine;
float sigdif;
float sigineaa;
float sigtotaa;
float sigelaaa;
float sigcutaa;
} hadr5_; //crmc-aaa.f
}
extern "C"
{
extern struct
{
// nevt .......... error code. 1=valid event, 0=invalid event
// bimevt ........ absolute value of impact parameter
// phievt ........ angle of impact parameter
// kolevt ........ number of collisions
// koievt ........ number of inelastic collisions
// pmxevt ........ reference momentum
// egyevt ........ pp cm energy (hadron) or string energy (lepton)
// npjevt ........ number of primary projectile participants
// ntgevt ........ number of primary target participants
// npnevt ........ number of primary projectile neutron spectators
// nppevt ........ number of primary projectile proton spectators
// ntnevt ........ number of primary target neutron spectators
// ntpevt ........ number of primary target proton spectators
// jpnevt ........ number of absolute projectile neutron spectators
// jppevt ........ number of absolute projectile proton spectators
// jtnevt ........ number of absolute target neutron spectators
// jtpevt ........ number of absolute target proton spectators
// xbjevt ........ bjorken x for dis
// qsqevt ........ q**2 for dis
// sigtot ........ total cross section
// nglevt ........ number of collisions acc to Glauber
// zppevt ........ average Z-parton-proj
// zptevt ........ average Z-parton-targ
// ng1evt ........ number of Glauber participants with at least one IAs
// ng2evt ........ number of Glauber participants with at least two IAs
// ikoevt ........ number of elementary parton-parton scatterings
// typevt ........ type of event (1=Non Diff, 2=Double Diff, 3=Single Diff
float phievt;
int nevt;
float bimevt;
int kolevt;
int koievt;
float pmxevt;
float egyevt;
int npjevt;
int ntgevt;
int npnevt;
int nppevt;
int ntnevt;
int ntpevt;
int jpnevt;
int jppevt;
int jtnevt;
int jtpevt;
float xbjevt;
float qsqevt;
int nglevt;
float zppevt;
float zptevt;
int minfra;
int maxfra;
} cevt_; //epos.inc
}
extern "C"
{
extern struct
{
int ng1evt;
int ng2evt;
float rglevt;
float sglevt;
float eglevt;
float fglevt;
int ikoevt;
} c2evt_; //epos.inc
}
#endif
This diff is collapsed.
#ifndef __CONEX_H
#define __CONEX_H
#ifndef __CRMC_H
#define __CRMC_H
#include <string>
#include <iostream>
#include <vector>
#include <cstdlib>
#include <unistd.h>
#include <TMath.h>
#include <TTree.h>
#include <TFile.h>
#include <TSystem.h>
#include <TStopwatch.h>
// -------------- forward declarations
extern "C"
{
void crmc_f_( int&, double&, int&, double&, double&, double&,
double&, double&);
};
extern "C"
{
void crmc_init_f_( int&, double&, double&, int&, int&, int&, const char*);
class TTree;
class TFile;
namespace HepMC {
//class GenEvent;
class IO_HEPEVT;
class IO_GenEvent;
}
#include <boost/iostreams/filtering_stream.hpp>
class crmc {
enum EOutputMode {
eHepMC,
eHepMCGZ,
eLHE,
eLHEGZ,
eROOT,
eNDST
};
public:
crmc();
bool setOptions(int argc, char** argv);
void dumpConfig() const;
bool init();
bool run();
bool event(const int nEvent);
bool finish();
void cleanVector();
private:
// output related stuff
EOutputMode fOutputMode;
TFile *fFile;
TTree *fHead, *fParticle;
boost::iostreams::filtering_ostream *fOut;
HepMC::IO_HEPEVT* hepevtio;
HepMC::IO_GenEvent* ascii_out;
// HepMC::GenEvent* fEvtHepMC;
// real data members
int fNCollision;
int fSeed;
int fProjectileId;
int fTargetId;
int fHEModel;
double fProjectileMomentum;
double fTargetMomentum;
std::string fParamFileName;
std::string fPrefix;
// fortran output
const static unsigned int fMaxParticles = 9990; // HEP max number of particles
int fNParticles;
double fImpactParameter;
int fPartId[fMaxParticles];
double fPartPx[fMaxParticles];
double fPartPy[fMaxParticles];
double fPartPz[fMaxParticles];
double fPartEnergy[fMaxParticles];
double fPartMass[fMaxParticles];
};
bool GetOptions(int,char**);
void rootOut(int);
void cleanVector();
// -------------- default options
int gNCollision=1;
int gSeed=123;
int gBeamID=120;
int gTargetID=12;
int gHEModel=0;
double gBeamMomentum=300;
double gTargetMomentum=0;
std::string gParamFileName="crmc.param";
std::string gPrefix = "crmc";
// -------------- Tree data
const unsigned int gMaxParticles = 9990; // HEP max number of particles
int gNParticles = 0;
double gImpactParameter = 0;
static int gPartID[gMaxParticles];
static double gPartPx[gMaxParticles];
static double gPartPy[gMaxParticles];
static double gPartPz[gMaxParticles];
static double gPartEnergy[gMaxParticles];
static double gPartMass[gMaxParticles];
// for timing
TStopwatch gStopwatch;
#endif
......@@ -4,6 +4,8 @@
namespace io = boost::iostreams;
using namespace std;
// Ralf TODO this code is affected by the fortran common block limitation of HepMC ???
void AddEvent(const int nEvent, HepMC::IO_HEPEVT& hepevtio, HepMC::IO_GenEvent& ascii_out)
{
......@@ -209,6 +211,7 @@ GetOptions(int argc, char **argv)
case 'n':
gNCollision=atoi(optarg);
break;
#warning Ralf TODO is this relevant:
case 'N':
gFirstEventNumber=atoi(optarg);
break;
......
#ifndef __INCLUDE_TRAPFE_H_
#define __INCLUDE_TRAPFE_H_
// skip compilation on MacOSX platform
#ifndef __APPLE__
......@@ -33,3 +36,5 @@ static void __attribute__ ((constructor)) trapfpe(void)
}
#endif
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment