IAP GITLAB

Commit 192a106e authored by Ralf Ulrich's avatar Ralf Ulrich

make root optional

git-svn-id: https://devel-ik.fzk.de/svn/mc/crmc/trunk@4573 c7a5e08c-de06-0410-9364-b41cf42a0b17
parent 59dfcd09
......@@ -70,12 +70,36 @@ 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)
SET (CRMC_SOURCES src/crmcMain.cc src/CRMC.cc src/CRMCinterface.cc src/CRMCoptions.cc src/OutputPolicyLHE.cc src/OutputPolicyNone.cc src/CRMCtrapfpe.c)
FIND_PACKAGE (Root)
if (Root_FOUND)
INCLUDE_DIRECTORIES ("${ROOT_INCLUDE_DIR}")
LIST(APPEND CRMC_SOURCES src/OutputPolicyROOT.cc)
add_definitions(-DWITH_ROOT)
MESSAGE("Build ROOT Output Interface")
else (Root_FOUND)
MESSAGE("Cannot Build ROOT Output Interface")
endif (Root_FOUND)
# SET(Boost_DEBUG TRUE)
FIND_PACKAGE (Boost 1.35 REQUIRED COMPONENTS filesystem iostreams system program_options)
# TODO HepMC NOT REQUIRED
FIND_PACKAGE (HepMC REQUIRED COMPONENTS HepMC HepMCfio)
INCLUDE_DIRECTORIES ("${HepMC_INCLUDE_DIRS}")
LIST(APPEND CRMC_SOURCES src/OutputPolicyHepMC.cc)
add_definitions(-DWITH_HEPMC)
MESSAGE("Build HEPMC Output Interface")
FIND_PACKAGE (Fastjet)
if (FASTJET_FOUND)
include_directories("${Fastjet_INCLUDE_DIRS}")
add_definitions(-DWITH_FASTJET)
MESSAGE("Include fastjet filter")
endif (FASTJET_FOUND)
# prepare crmc to use same size HEPMC common block than HepMC was compiled with
STRING ( STRIP ${HepMC_HEPEVT_SIZE} Replace_String )
......@@ -230,21 +254,22 @@ ENDIF (__CRMCSTATIC__)
#include directories for headers
INCLUDE_DIRECTORIES ("${PROJECT_BINARY_DIR}/src")
INCLUDE_DIRECTORIES ("${HepMC_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES ("${Boost_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES ("${ROOT_INCLUDE_DIR}")
# the executable
ADD_EXECUTABLE(crmc src/crmcMain.cc src/CRMC.cc src/CRMCinterface.cc src/CRMCoptions.cc src/OutputPolicyROOT.cc src/OutputPolicyHepMC.cc src/OutputPolicyLHE.cc src/OutputPolicyNone.cc src/CRMCtrapfpe.c)
ADD_EXECUTABLE(crmc ${CRMC_SOURCES})
# linking of modules
TARGET_LINK_LIBRARIES (crmc ${CMAKE_DL_LIBS})
TARGET_LINK_LIBRARIES (crmc ${HepMC_LIBRARIES})
TARGET_LINK_LIBRARIES (crmc ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES (crmc ${ROOT_LIBRARIES})
if (Root_FOUND)
TARGET_LINK_LIBRARIES (crmc ${ROOT_LIBRARIES})
endif (Root_FOUND)
IF (__CRMCSTATIC__)
TARGET_LINK_LIBRARIES (crmc CrmcBasic)
TARGET_LINK_LIBRARIES (crmc CrmcFortranStatic)
TARGET_LINK_LIBRARIES (crmc CrmcBasic)
TARGET_LINK_LIBRARIES (crmc CrmcFortranStatic)
ELSE (__CRMCSTATIC__)
TARGET_LINK_LIBRARIES (crmc HepEvtDummy)
TARGET_LINK_LIBRARIES (crmc HepEvtDummy)
ENDIF (__CRMCSTATIC__)
## installation
......
......@@ -2,7 +2,9 @@
#include <CRMCinterface.h>
#include <CRMCoptions.h>
#ifdef WITH_ROOT
#include <OutputPolicyROOT.h>
#endif
#include <OutputPolicyHepMC.h>
#include <OutputPolicyLHE.h>
#include <OutputPolicyNone.h>
......@@ -56,6 +58,7 @@ CRMC<OutputPolicy>::init()
//init models with set variables
fInterface.crmc_init(fCfg.GetOutputFileName().c_str(),fCfg.GetOutputFileName().size());
OutputPolicy::InitOutput(fCfg);
//fFilter.Init(fCfg.GetFilter());
return true;
}
......@@ -88,7 +91,7 @@ CRMC<OutputPolicy>::run()
gCRMC_data.fPartEnergy[0],
gCRMC_data.fPartMass[0],
gCRMC_data.fPartStatus[0]);
gCRMC_data.sigtot = double(hadr5_.sigtot);
gCRMC_data.sigine = double(hadr5_.sigine);
gCRMC_data.sigela = double(hadr5_.sigela);
......@@ -114,7 +117,7 @@ CRMC<OutputPolicy>::run()
gCRMC_data.fglevt = double(c2evt_.fglevt);
gCRMC_data.typevt = int(c2evt_.typevt);
OutputPolicy::FillEvent(fCfg,iColl);
OutputPolicy::FillEvent(fCfg, iColl);
}
std::cout.precision(2);
......@@ -151,8 +154,9 @@ CRMC<OutputPolicy>::finish()
#ifdef WITH_ROOT
template class CRMC<OutputPolicyROOT>;
#endif
template class CRMC<OutputPolicyHepMC>;
template class CRMC<OutputPolicyLHE>;
template class CRMC<OutputPolicyNone>;
......@@ -2,6 +2,7 @@
#define __CRMC_H
#include <CRMCinterface.h>
//#include <CRMCfilter.h>
// //////////
// //////////
......@@ -44,19 +45,24 @@ class CRMC : public OutputPolicy {
const CRMCoptions& fCfg;
CRMCinterface fInterface;
};
//CRMCfilter fFilter;
};
#ifdef WITH_ROOT
#include <OutputPolicyROOT.h>
#include <OutputPolicyHepMC.h>
#include <OutputPolicyLHE.h>
#include <OutputPolicyNone.h>
typedef CRMC<OutputPolicyROOT> CRMC2ROOT;
#endif
#include <OutputPolicyHepMC.h>
typedef CRMC<OutputPolicyHepMC> CRMC2HepMC;
#include <OutputPolicyLHE.h>
typedef CRMC<OutputPolicyLHE> CRMC2LHE;
#include <OutputPolicyNone.h>
typedef CRMC<OutputPolicyNone> CRMC2NONE;
......
......@@ -64,7 +64,7 @@ void
CRMCoptions::ParseOptions(int argc, char** argv)
{
po::options_description desc("Options of CRMC");
ostringstream model_desc;
model_desc << "model [0=EPOS_LHC, 1=EPOS_1.99"
#ifdef __QGSJET01__
......@@ -111,9 +111,10 @@ CRMCoptions::ParseOptions(int argc, char** argv)
("config,c", po::value<string>(), "config file")
("out,f", po::value<string>(), "output file name (auto if none provided)")
("produceTables,t", po::value<bool>()->implicit_value(1), "create tables if none are found")
//("filter,F", po::value<string>(), "specify file with filter commands")
("Test,T", po::value<bool>()->implicit_value(1), "Test mode")
;
po::variables_map opt;
po::store(po::parse_command_line(argc, argv, desc), opt);
po::notify(opt);
......@@ -122,13 +123,13 @@ CRMCoptions::ParseOptions(int argc, char** argv)
cout << "crmc v" << CRMC_VERSION_MAJOR << "." << CRMC_VERSION_MINOR << endl;
exit(0);
}
// check if user needs help-printout
if (opt.count("help")) {
cout << endl << desc << endl;
exit(1);
}
if(opt.count("output")) {
const string om = opt["output"].as<string>();
......@@ -136,8 +137,14 @@ CRMCoptions::ParseOptions(int argc, char** argv)
else if (om=="hepmcgz") fOutputMode = eHepMCGZ;
else if (om=="lhe") fOutputMode = eLHE;
else if (om=="lhegz") fOutputMode = eLHEGZ;
else if (om=="root") fOutputMode = eROOT;
else {
else if (om=="root") {
#ifdef WITH_ROOT
fOutputMode = eROOT;
#else
cout << " Compile with ROOT first " << endl;
exit(1);
#endif
} else {
cout << " Wrong output type: " << om << endl;
cout << endl << desc << endl;
exit(1);
......@@ -147,8 +154,10 @@ CRMCoptions::ParseOptions(int argc, char** argv)
if (fOutputMode == eLHE || fOutputMode == eLHEGZ)
fTypout = 1;
#ifdef WITH_ROOT
if (fOutputMode == eROOT)
fTypout = -1;
#endif
// parameter readout
if (opt.count("seed")) {
......@@ -195,6 +204,10 @@ CRMCoptions::ParseOptions(int argc, char** argv)
fProduceTables = opt["produceTables"].as<bool>();
}
//if (opt.count("filter")) {
//fFilter = opt["filter"].as<string>();
//}
if (opt.count("Test"))
fTest = opt["Test"].as<bool>();
......@@ -327,9 +340,11 @@ CRMCoptions::GetOutputTypeEnding() const
case eLHEGZ:
return ".lhe.gz";
break;
#ifdef WITH_ROOT
case eROOT:
return ".root";
break;
#endif
}
return ".unknown";
}
......
......@@ -29,8 +29,10 @@ class CRMCoptions {
EOutputMode GetOutputMode() const { return fOutputMode; }
std::string GetOutputTypeEnding() const;
std::string GetOutputFileName() const;
std::string ParticleName(const int pid) const;
//std::string GetFilter() const { return fFilter; }
void SetProjectileMomentum(const double p) { fProjectileMomentum = p; }
void SetTargetMomentum(const double p) { fTargetMomentum = p; }
......@@ -55,6 +57,7 @@ class CRMCoptions {
bool fProduceTables;
bool fSeedProvided;
//std::string fFilter;
bool fTest;
private:
......
#include <CRMCoptions.h>
#include <CRMC.h>
#ifdef WITH_ROOT
#include <OutputPolicyROOT.h>
#endif
#include <OutputPolicyHepMC.h>
#include <OutputPolicyLHE.h>
#include <OutputPolicyNone.h>
......@@ -54,6 +56,7 @@ main(int argc, char **argv)
switch(cfg.GetOutputMode()) {
#ifdef WITH_ROOT
case CRMCoptions::eROOT:
{
CRMC2ROOT crmc(cfg);
......@@ -62,6 +65,7 @@ main(int argc, char **argv)
crmc.finish();
}
break;
#endif
case CRMCoptions::eHepMC:
case CRMCoptions::eHepMCGZ:
......
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