IAP GITLAB

Commit d2d72660 authored by Colin Baus's avatar Colin Baus

added option for only printing the cross section (-x)

for style conformity is also changed options
--Test -> --test
--produceTables -> --produce-tables
Nobody should notice these changes since a normal user won't use these functions anyway. The short option keys stay the same



git-svn-id: https://devel-ik.fzk.de/svn/mc/crmc/trunk@4658 c7a5e08c-de06-0410-9364-b41cf42a0b17
parent fd81f1ae
......@@ -26,7 +26,8 @@ CRMCoptions::CRMCoptions(int argc, char** argv)
fOutputFileName(""),
fProduceTables(false),
fSeedProvided(false),
fTest(false)
fTest(false),
fCSMode(false)
{
CheckEnvironment();
ParseOptions(argc, argv);
......@@ -110,9 +111,10 @@ CRMCoptions::ParseOptions(int argc, char** argv)
("target-id,I", po::value<int>(), "PDG or Z*10000+A*10")
("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")
("produce-tables,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")
("test,T", po::value<bool>()->implicit_value(1), "test mode")
("cross-section,x", po::value<bool>()->implicit_value(1), "calculate and print cross section only")
;
po::variables_map opt;
......@@ -200,8 +202,8 @@ CRMCoptions::ParseOptions(int argc, char** argv)
if (opt.count("out"))
fOutputFileName = opt["out"].as<string>();
if (opt.count("produceTables")) {
fProduceTables = opt["produceTables"].as<bool>();
if (opt.count("produce-tables")) {
fProduceTables = opt["produce-tables"].as<bool>();
}
//if (opt.count("filter")) {
......@@ -209,7 +211,17 @@ CRMCoptions::ParseOptions(int argc, char** argv)
//}
if (opt.count("Test"))
fTest = opt["Test"].as<bool>();
{
fOutputMode = eHepMC;
fTest = opt["Test"].as<bool>();
}
if (opt.count("cross-section"))
{
fCSMode = opt["cross-section"].as<bool>();
fOutputMode = eNone;
fNCollision = 1;
}
// check if random seed was provided, otherwise generate one
fSeedProvided = fSeed;
......@@ -307,7 +319,7 @@ CRMCoptions::DumpConfig() const
cout << " number of collisions: " << fNCollision << "\n"
<< " parameter file name: " << fParamFileName << "\n";
if ( !fTest )
if (!fTest && fCSMode)
cout << " output file name: " << GetOutputFileName() << "\n";
cout << " HE model: " << fHEModel;
......
......@@ -9,6 +9,7 @@ class CRMCoptions {
friend class OutputPolicyROOT;
friend class OutputPolicyHepMC;
friend class OutputPolicyLHE;
friend class OutputPolicyNone;
CRMCoptions();
......@@ -20,6 +21,7 @@ class CRMCoptions {
eLHE,
eLHEGZ,
eROOT,
eNone,
};
CRMCoptions(int argc, char** argv);
......@@ -29,9 +31,9 @@ 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; }
......@@ -59,6 +61,7 @@ class CRMCoptions {
bool fSeedProvided;
//std::string fFilter;
bool fTest;
bool fCSMode;
private:
......
......@@ -196,9 +196,9 @@ OutputPolicyHepMC::FillEvent(const CRMCoptions& cfg, const int nEvent)
case 4: sig_id = 103; break;
case -4: sig_id = 104; break;
default: cerr << "Signal ID not recognised for setting HEPEVT" << endl;
}
}
fEvtHepMC->set_signal_process_id(sig_id);
if(fEvtHepMC->vertices_begin()!=fEvtHepMC->vertices_end())
fEvtHepMC->set_signal_process_vertex(*(fEvtHepMC->vertices_begin()));
......@@ -270,7 +270,7 @@ OutputPolicyHepMC::PrintTestEvent(const CRMCoptions& cfg)
cout << " Inel. AA Cross Section (mb): " << gCRMC_data.sigineaa << "\n"
<< " Elastic AA Cross Section (mb): " << gCRMC_data.sigelaaa << "\n"
<< " Total AA Cross Section (mb): " << gCRMC_data.sigtotaa << "\n" ;
cout << endl;
cout << " Energy (GeV): " << TotalEnergy
<< " +/- " << ErrorTotalEnergy << "\n"
......@@ -291,4 +291,3 @@ OutputPolicyHepMC::PrintTestEvent(const CRMCoptions& cfg)
}
}
......@@ -43,13 +43,13 @@ OutputPolicyNone::FillEvent(const CRMCoptions& cfg, const int nEvent)
void
OutputPolicyNone::CloseOutput(const CRMCoptions& cfg)
{
if(cfg.fCSMode) PrintCrossSections(cfg);
}
void
OutputPolicyNone::PrintTestEvent(const CRMCoptions& cfg)
OutputPolicyNone::PrintCrossSections(const CRMCoptions& cfg)
{
/*
cout << "\n >> Test output <<\n\n"
cout << "\n >> Cross Sections <<\n\n"
<< " Total Cross Section (mb): " << gCRMC_data.sigtot << "\n"
<< " Elastic Cross Section (mb): " << gCRMC_data.sigela << "\n"
<< " Inel. Cross Section (mb) : " << gCRMC_data.sigine << "\n" ;
......@@ -57,7 +57,4 @@ OutputPolicyNone::PrintTestEvent(const CRMCoptions& cfg)
cout << " Inel. AA Cross Section (mb): " << gCRMC_data.sigineaa << "\n"
<< " Elastic AA Cross Section (mb): " << gCRMC_data.sigelaaa << "\n"
<< " Total AA Cross Section (mb): " << gCRMC_data.sigtotaa << "\n" ;
*/
}
......@@ -14,10 +14,10 @@ class OutputPolicyNone {
private:
void PrintTestEvent(const CRMCoptions& cfg);
void PrintTestEvent(const CRMCoptions& cfg) {};
void PrintCrossSections(const CRMCoptions& cfg);
};
#endif
......@@ -32,23 +32,23 @@ main(int argc, char **argv)
for (int i=0; i<50; ++i) {
const double labE = std::pow(10., 1 + 0.5 * i); // [GeV]
cfgCpy.SetProjectileMomentum(labE);
cfgCpy.SetTargetMomentum(0.);
CRMC2NONE crmc(cfgCpy);
crmc.init();
double xsigtot=0,xsigine=0,xsigela=0,xsigdd=0,xsigsd=0,
xsloela=0,xsigtotaa=0,xsigineaa=0,xsigelaaa=0;
crmc.GetInterface().crmc_xsection(xsigtot,xsigine,xsigela,xsigdd,xsigsd,
xsloela,xsigtotaa,xsigineaa,xsigelaaa);
out << labE << " " << xsigtot<< " " <<xsigine<< " " <<xsigela<< " " <<xsigdd<< " " <<xsigsd<< " " <<
xsloela<< " " <<xsigtotaa<< " " <<xsigineaa<< " " <<xsigelaaa << endl;
}
out.close();
return 0;
*/
......@@ -87,6 +87,15 @@ main(int argc, char **argv)
}
break;
case CRMCoptions::eNone:
{
CRMC2NONE crmc(cfg);
crmc.init();
crmc.run();
crmc.finish();
}
break;
}
// default options
......
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