IAP GITLAB

Commit 2e8803df authored by Tanguy Pierog's avatar Tanguy Pierog

add LHE output using EPOS directly. Only constraint : file name should finish...

add LHE output using EPOS directly. Only constraint : file name should finish with ".lhe" and ".lhe" should not be in path name (checks are done at initialization)
lhegz not done and I don't know if it can be done ...


git-svn-id: https://devel-ik.fzk.de/svn/mc/crmc/trunk@3042 c7a5e08c-de06-0410-9364-b41cf42a0b17
parent 72002831
......@@ -123,7 +123,7 @@ 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/crmc.cc src/CRMC.cc src/CRMCinterface.cc src/CRMCoptions.cc src/OutputPolicyROOT.cc src/OutputPolicyHepMC.cc src/CRMCtrapfpe.c src/crmc-aaa.f src/models.F)
ADD_EXECUTABLE(crmc src/crmc.cc src/CRMC.cc src/CRMCinterface.cc src/CRMCoptions.cc src/OutputPolicyROOT.cc src/OutputPolicyHepMC.cc src/OutputPolicyLHE.cc src/CRMCtrapfpe.c src/crmc-aaa.f src/models.F)
# linking of modules
TARGET_LINK_LIBRARIES (crmc ${HepMC_LIBRARIES})
......
......@@ -4,6 +4,7 @@
#include <OutputPolicyROOT.h>
#include <OutputPolicyHepMC.h>
#include <OutputPolicyLHE.h>
#include <iomanip>
#include <iostream>
......@@ -33,17 +34,20 @@ CRMC<OutputPolicy>::CRMC(const CRMCoptions& cfg)
template<class OutputPolicy>
bool
CRMC<OutputPolicy>::init()
CRMC<OutputPolicy>::init(const int& ipout)
{
setbuf(stdout, 0); // set output to unbuffered
// open FORTRAN IO at first call
crmc_init_f_(fCfg.fSeed,
crmc_init_f_(fCfg.fNCollision,
fCfg.fSeed,
fCfg.fProjectileMomentum,
fCfg.fTargetMomentum,
fCfg.fProjectileId,
fCfg.fTargetId,
fCfg.fHEModel,
fCfg.fHEModel,
ipout,
fCfg.GetOutputFileName().c_str(),
fCfg.fParamFileName.c_str());
......@@ -57,7 +61,7 @@ CRMC<OutputPolicy>::init()
template<class OutputPolicy>
bool
CRMC<OutputPolicy>::run()
CRMC<OutputPolicy>::run(const int& ipout)
{
TStopwatch watch;
std::cout.precision(10);
......@@ -71,8 +75,9 @@ CRMC<OutputPolicy>::run()
cout << " ==[crmc]==> Collision number " << iColl+1 << endl;
// loop over collisions
crmc_f_(gCRMC_data.fNParticles,
gCRMC_data.fImpactParameter,
crmc_f_(ipout,iColl+1,
gCRMC_data.fNParticles,
gCRMC_data.fImpactParameter,
gCRMC_data.fPartId[0],
gCRMC_data.fPartPx[0],
gCRMC_data.fPartPy[0],
......@@ -104,7 +109,7 @@ CRMC<OutputPolicy>::run()
template<class OutputPolicy>
bool
CRMC<OutputPolicy>::finish()
CRMC<OutputPolicy>::finish(const int& ipout)
{
OutputPolicy::CloseOutput();
return true;
......@@ -118,3 +123,4 @@ CRMC<OutputPolicy>::finish()
template class CRMC<OutputPolicyROOT>;
template class CRMC<OutputPolicyHepMC>;
template class CRMC<OutputPolicyLHE>;
......@@ -31,9 +31,9 @@ class CRMC : public OutputPolicy {
public:
CRMC(const CRMCoptions& cfg);// : OutputPolicy(cfg), fCfg(cfg) {}
bool init();
bool run();
bool finish();
bool init(const int&);
bool run(const int&);
bool finish(const int&);
private:
......@@ -46,9 +46,11 @@ class CRMC : public OutputPolicy {
#include <OutputPolicyROOT.h>
#include <OutputPolicyHepMC.h>
#include <OutputPolicyLHE.h>
typedef CRMC<OutputPolicyROOT> CRMC2ROOT;
typedef CRMC<OutputPolicyHepMC> CRMC2HepMC;
typedef CRMC<OutputPolicyLHE> CRMC2LHE;
#endif
......@@ -27,13 +27,15 @@ extern CRMCdata gCRMC_data;
extern "C"
{
void crmc_f_( int&, double&, int&, double&, double&, double&,
double&, double&);
void crmc_f_( const int&, const int&, int&, double&, int&, double&,
double&, double&,double&, double&);
}
extern "C"
{
void crmc_init_f_( const int&, const double&, const double&, const int&, const int&, const int&, const char*);
void crmc_init_f_( const int&, const int&, const double&, const double&,
const int&, const int&, const int&, const int&,
const char*, const char*);
}
extern "C"
......
......@@ -248,13 +248,26 @@ CRMCoptions::GetOutputFileName() const
rootOutDir = gSystem->Getenv("PWD");
}
//check compatibility of path with lhe files
if ( GetOutputTypeEnding().find("lhe") != string::npos && string(rootOutDir).find(".lhe") != string::npos ) {
cout << " path error - path contains '.lhe' : " << rootOutDir << endl;
cout << " exit ..." << endl;
exit(1);
}
#warning rename, by removing ROOT...
// open ROOT output file
//if file name provided
if (fOutputFileName != "")
if (fOutputFileName != "") {
//check compatibility of file name with lhe files
if ( GetOutputTypeEnding().find("lhe") != string::npos && fOutputFileName.find(".lhe") == string::npos ) {
cout << " file name error - extension is not '.lhe' : " << fOutputFileName << endl;
cout << " exit ..." << endl;
exit(1);
}{
return fOutputFileName;
}}
//create file name based on options
ostringstream rootFileName;
......
......@@ -8,6 +8,7 @@ class CRMCoptions {
template<typename> friend class CRMC;
friend class OutputPolicyROOT;
friend class OutputPolicyHepMC;
friend class OutputPolicyLHE;
CRMCoptions();
......
This diff is collapsed.
......@@ -2,6 +2,7 @@
#include <CRMC.h>
#include <OutputPolicyROOT.h>
#include <OutputPolicyHepMC.h>
#include <OutputPolicyLHE.h>
#include <iostream>
......@@ -26,9 +27,9 @@ main(int argc, char **argv)
case CRMCoptions::eROOT:
{
CRMC2ROOT crmc(cfg);
crmc.init();
crmc.run();
crmc.finish();
crmc.init(0);
crmc.run(0);
crmc.finish(0);
}
break;
......@@ -36,9 +37,19 @@ main(int argc, char **argv)
case CRMCoptions::eHepMCGZ:
{
CRMC2HepMC crmc(cfg);
crmc.init();
crmc.run();
crmc.finish();
crmc.init(0);
crmc.run(0);
crmc.finish(0);
}
break;
case CRMCoptions::eLHE:
case CRMCoptions::eLHEGZ:
{
CRMC2LHE crmc(cfg);
crmc.init(1);
crmc.run(1);
crmc.finish(1);
}
break;
......
......@@ -1588,7 +1588,8 @@ c-----------------------------------------------------------------------
wi=.197/15.34e15
elseif(id.eq.20)then
wi=.197/2.6842e13
elseif(iabs(id).lt.100.and.id.ne.20)then
elseif((iabs(id).lt.100.and.id.ne.20)
* .or.id.gt.1e9)then
wi=0
elseif(iabs(id).lt.1e8)then
ix=iabs(id)/10
......
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