Commit 98307eca authored by Frank Siegert's avatar Frank Siegert

Merging HADRONS++ standalone run infrastructure updates from hadrons-bachelors...

Merging HADRONS++ standalone run infrastructure updates from hadrons-bachelors branch: c27835, c27846, c27869, c28927.

parent 2ece114a
......@@ -5,10 +5,16 @@
#include "ATOOLS/Org/Run_Parameter.H"
#include "ATOOLS/Org/Read_Write_Base.H"
#include "ATOOLS/Phys/Blob_List.H"
#include "MODEL/Main/Standard_Model.H"
#include "MODEL/Main/Model_Base.H"
#include "PHASIC++/Channels/Rambo.H"
#include "ATOOLS/Org/MyStrStream.H"
#include "ATOOLS/Org/Library_Loader.H"
#include "ATOOLS/Org/My_MPI.H"
#include "ATOOLS/Math/Random.H"
#include "PDF/Main/ISR_Handler.H"
#include "PDF/Main/ISR_Base.H"
#include "PDF/Main/Intact.H"
#include "BEAM/Main/Monochromatic.H"
#include "SHERPA/SoftPhysics/Hadron_Decay_Handler.H"
#include "HADRONS++/Main/Hadron_Decay_Map.H"
......@@ -41,27 +47,22 @@ void CleanUpEvent(Blob_List*);
void FinishAnalysis();
void FinishGenerator();
static int m_analysis;
void small_sherpa_init(int argc, char *argv[])
{
// use this for small programs, which don't use the full Sherpa framework,
// but only Hadrons
ATOOLS::mpi = new My_MPI();
ATOOLS::exh = new Exception_Handler();
ATOOLS::msg = new Message();
ATOOLS::ran = new Random(1234);
ATOOLS::rpa = new Run_Parameter();
ATOOLS::s_loader = new Library_Loader();
PRINT_INFO("using small_sherpa_init");
std::vector<std::string> searchpaths;
searchpaths.push_back(rpa.gen.Variable("SHERPA_RUN_PATH")+"/");
My_Out_File::SetSearchPaths(searchpaths);
searchpaths.push_back(rpa.gen.Variable("SHERPA_DAT_PATH")+"/");
searchpaths.push_back(rpa.gen.Variable("SHERPA_DAT_PATH"));
searchpaths.push_back(SHERPA_SHARE_PATH+std::string("/"));
searchpaths.push_back(SHERPA_SHARE_PATH);
My_In_File::SetSearchPaths(searchpaths);
rpa.gen.SetVariable("PATH_PIECE","./");
std::vector<std::string> names(4);
names[0]="Decaydata";
names[1]="Run.dat";
My_In_File::SetNoComplains(names);
rpa->gen.SetVariable("PATH_PIECE","./");
for (int i=1; i<argc;++i) {
string par = string(argv[i]);
......@@ -79,58 +80,61 @@ void small_sherpa_init(int argc, char *argv[])
}
}
}
ATOOLS::s_loader = new Library_Loader();
rpa.Init("","Run.dat",argc,argv);
MODEL::s_model = new MODEL::Standard_Model("","Model.dat",true);
MODEL::s_model->InitializeInteractionModel();
rpa->Init("","Run.dat",argc,argv);
s_loader->LoadLibrary("SherpaSM");
MODEL::s_model=MODEL::Model_Base::Model_Getter_Function::
GetObject("SM",MODEL::Model_Arguments("","Model.dat",true));
PDF::ISR_Base ** isrbases = new PDF::ISR_Base*[2];
isrbases[0] = new PDF::Intact(Flavour(kf_e));
isrbases[1] = new PDF::Intact(Flavour(kf_e).Bar());
PDF::ISR_Handler_Map isrhandlers;
isrhandlers[PDF::isr::hard_process] = new PDF::ISR_Handler(isrbases);
isrhandlers[PDF::isr::hard_process]->SetBeam(new BEAM::Monochromatic(Flavour(kf_e),7000.,0.0,1),0);
isrhandlers[PDF::isr::hard_process]->SetBeam(new BEAM::Monochromatic(Flavour(kf_e).Bar(),7000.,0.0,-1),1);
double bunch_splimits[2] = {1e-10, 1.};
isrhandlers[PDF::isr::hard_process]->Init(bunch_splimits);
MODEL::s_model->ModelInit(isrhandlers);
AHADIC::Hadron_Init hi;
hi.Init();
Data_Reader overwrite;
hi.OverWriteProperties(overwrite);
Data_Reader dr;
hi.OverWriteProperties(dr);
ATOOLS::OutputHadrons(std::cout);
m_analysis = dr.GetValue<int>("ANALYSIS",1);
msg->SetModifiable(true);
}
int main(int argc, char *argv[])
{
PRINT_INFO("starting main");
ATOOLS::exh->Init();
set_terminate(ATOOLS::Terminate);
set_unexpected(ATOOLS::Terminate);
signal(SIGSEGV,ATOOLS::SignalHandler);
signal(SIGINT,ATOOLS::SignalHandler);
signal(SIGBUS,ATOOLS::SignalHandler);
signal(SIGFPE,ATOOLS::SignalHandler);
signal(SIGABRT,ATOOLS::SignalHandler);
signal(SIGTERM,ATOOLS::SignalHandler);
signal(SIGXCPU,ATOOLS::SignalHandler);
#ifdef USING__MPI
MPI::Init(argc,argv);
#endif
try {
#ifdef USING__ROOT
TApplication myapp(string("HadronsApp").c_str(),&argc,&(*argv));
gROOT->SetStyle("Plain");
#endif
PRINT_INFO("starting generator");
InitialiseGenerator(argc, argv);
PRINT_INFO("starting analysis");
if(rpa.gen.Analysis()) InitialiseAnalysis();
if(m_analysis) InitialiseAnalysis();
for(int i=0; i<rpa.gen.NumberOfEvents(); i++) {
for(int i=0; i<rpa->gen.NumberOfEvents(); i++) {
Blob_List* blobs = GenerateEvent();
if(rpa.gen.Analysis()) AnalyseEvent(blobs);
if(m_analysis) AnalyseEvent(blobs);
CleanUpEvent(blobs);
rpa.gen.SetNumberOfGeneratedEvents(i+1);
int steps = int(double(rpa.gen.NumberOfEvents()/10.0));
rpa->gen.SetNumberOfGeneratedEvents(i+1);
int steps = int(double(rpa->gen.NumberOfEvents()/10.0));
if(steps==0) steps=1;
if((i+1)%steps==0) msg_Info()<<i+1<<" events passed."<<std::endl;
}
msg_Info()<<"Generated "<<rpa.gen.NumberOfEvents()<<" events"<<endl;
msg_Info()<<"Generated "<<rpa->gen.NumberOfEvents()<<" events"<<endl;
FinishGenerator();
if(rpa.gen.Analysis()) FinishAnalysis();
if(m_analysis) FinishAnalysis();
}
catch (Exception Sherpaexception) {
msg_Error()<<Sherpaexception<<endl;
......@@ -141,6 +145,10 @@ int main(int argc, char *argv[])
<<stdexception.what()<<" ..."<<endl;
terminate();
}
#ifdef USING__MPI
MPI::Finalize();
#endif
return 0;
}
#ifdef USING__ROOT
......
......@@ -29,36 +29,21 @@ void InitialiseGenerator(int argc, char *argv[])
mother_flav=Flavour(mother_kf);
mother_flav.SetStable(false);
rpa->gen.SetEcms(mother_flav.HadMass());
m_analysis = read.GetValue<int>("ANALYSIS",1);
msg_Info()<<"Welcome. I am decaying a "<<mother_flav<<endl;
}
Blob_List* GenerateEvent()
{
Blob_List* blobs=p_sherpa->GetEventHandler()->GetBlobs();
if (!blobs->empty()) THROW(fatal_error, "Bloblist not empty.");
Vec4D mom(mother_flav.HadMass(), 0., 0., 0.);
Particle* mother_in_part=new Particle(1, mother_flav, mom);
Particle* mother_part=new Particle(1, mother_flav, mom);
mother_part->SetTime();
mother_part->SetFinalMass(mother_flav.HadMass());
mother_in_part->SetStatus(part_status::decayed);
Blob* blob = blobs->AddBlob(btp::Hadron_Decay);
blob->SetStatus(blob_status::needs_hadrondecays);
blob->AddToInParticles(mother_in_part);
blob->AddToOutParticles(mother_part);
p_sherpa->GenerateOneEvent(false);
return blobs;
p_sherpa->GenerateOneEvent();
return p_sherpa->GetEventHandler()->GetBlobs();
}
void CleanUpEvent(Blob_List* blobs)
{
p_sherpa->GetEventHandler()->Reset();
ATOOLS::ran.SaveStatus();
ATOOLS::ran->SaveStatus();
}
......
......@@ -2,7 +2,8 @@
This is an example setup for an analysis of multiplicities and inclusive
quantities in hadron decays.
It has to include Main_FullDecay.C, and a FullDecay has to be
started with the following specialities:
started with the following commands (in the directory containing the provided
Run.dat):
- ./FullDecay DECAYER=<kfcode> EVENTS=100000 ANALYSIS=1
*/
......@@ -23,10 +24,12 @@ typedef map<Flavour,int>::iterator FIMapIt;
void InitialiseAnalysis()
{
#ifdef USING__ROOT
std::string adir = "";
std::string adir = "Analysis";
ATOOLS::MakeDir(adir,493);
rootfile = new TFile(string(adir+"/Multiplicities_"+
mother_flav.ShellName()+".root").c_str(), "RECREATE");
PRINT_INFO("Writing to: "<<adir+"/Multiplicities_"+
mother_flav.ShellName()+".root");
list<Flavour> flavours;
flavours.push_back(Flavour(kf_pi_plus));
flavours.push_back(Flavour(kf_pi_plus).Bar());
......
......@@ -37,13 +37,11 @@ static TH1D* mixed_Bbar_events;
void InitialiseAnalysis()
{
#ifdef USING__ROOT
Hadron_Decay_Map* decaymap = p_sherpa->GetInitHandler()
->GetHadronDecayHandler("Hadrons")
->GetHadrons()->DecayMap();
Hadron_Decay_Table* decaytable = (*decaymap)[Flavour(kf_B)][1];
signal_hdc = (Hadron_Decay_Channel*) decaytable->GetDecayChannel(0);
PHASIC::Decay_Map* decaymap = p_sherpa->GetInitHandler()->GetHDHandler()->DecayMap();
PHASIC::Decay_Table* decaytable = (*decaymap)[Flavour(kf_B)][1];
signal_hdc = (Hadron_Decay_Channel*) decaytable->at(0);
std::string adir = "";
std::string adir = "Analysis";
ATOOLS::MakeDir(adir,493);
rootfile = new TFile(string(adir+"/CPasymmetry_"+
signal_hdc->FileName()+".root").c_str(), "RECREATE");
......
......@@ -39,7 +39,9 @@ void InitialiseGenerator(int argc, char *argv[])
PHASIC::Decay_Table* table=hadrons->DecayMap()->FindDecay(mother_flav);
for(size_t i(0);i<table->size();++i)
table->UpdateWidth(table->at(i), 1.0);
//table->UpdateWidth(table->at(0), 1.0);
//PRINT_VAR(table->at(0)->Name());
rpa->gen.SetEcms(mother_flav.HadMass());
msg_Info()<<"Welcome. I am decaying a "<<mother_flav<<endl;
}
......@@ -53,9 +55,10 @@ void InitialiseAnalysis()
map<string, string>::const_iterator it=tags.find("TAG_FILE_PIECE");
if(it!=tags.end())
filepiece="."+it->second;
Hadron_Decay_Table* table=hadrons->DecayMap()->FindDecay(mother_flav);
PHASIC::Decay_Table* table=hadrons->DecayMap()->FindDecay(mother_flav);
for(int i(0);i<table->size();++i) {
Hadron_Decay_Channel* hdc=table->at(i);
PHASIC::Decay_Channel* dc=table->at(i);
Hadron_Decay_Channel* hdc = dynamic_cast<Hadron_Decay_Channel*>(dc);
string fname = hdc->FileName();
rootfiles[hdc]=
new TFile(("Analysis/"+fname.erase(fname.length()-4)+filepiece+".root").c_str(),"RECREATE");
......@@ -176,7 +179,7 @@ void AnalyseEvent(Blob_List* blobs)
Blob* blob = blobs->FindFirst(btp::Hadron_Decay);
if(blob==NULL) return;
#ifdef USING__ROOT
Hadron_Decay_Channel* hdc=(*blob)["hdc"]->Get<Hadron_Decay_Channel*>();
Hadron_Decay_Channel* hdc=(*blob)["dc"]->Get<Hadron_Decay_Channel*>();
int currenthist=0;
for(int i=0; i<blob->NOutP(); i++) {
......
......@@ -41,7 +41,7 @@ void InitialiseGenerator(int argc, char *argv[])
reader->AddWordSeparator("\t");
reader->SetInputPath("./");
reader->SetInputFile("YFS.dat");
photons = new PHOTONS::Photons(reader,true);
photons = new PHOTONS::Photons(reader);
mother_flav = Flavour( (kf_code) abs(ToType<int>(argv[1])) );
mother_flav.SetStable(false);
......@@ -95,7 +95,7 @@ Blob_List* GenerateEvent()
{
Blob_List* blobs = new Blob_List();
Blob* blob = new Blob(ref_blob);
Blob* blob = new Blob(ref_blob, true);
blob->SetStatus(blob_status::needs_extraQED);
blobs->push_back(blob);
......
(me){
(run){
EVENT_TYPE=HadronDecay
ME_SIGNAL_GENERATOR=None
}(me)
(beam){
BEAM_1=2212
BEAM_1=11
BEAM_ENERGY_1=7000.
BEAM_2=-2212
BEAM_2=-11
BEAM_ENERGY_2=7000.
}(beam)
(model){
STABLE[15]=0
}(model)
}(run)
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