Exemplo n.º 1
0
void Hard_Decay_Handler::ReadDecayTable(Flavour decayer)
{
  DEBUG_FUNC(decayer);
  if (!m_store_results) return;
  Data_Reader reader = Data_Reader("|",";","!");
  reader.SetAddCommandLine(false);
  reader.AddComment("#");
  reader.AddComment("//");
  reader.AddWordSeparator("\t");
  reader.SetInputPath(m_resultdir);
  reader.SetInputFile(decayer.ShellName());
  
  vector<vector<string> > file;
  if(reader.MatrixFromFile(file)) {
    for (size_t iline=0; iline<file.size(); ++iline) {
      if (file[iline].size()==4) {
        string decaychannel=file[iline][0];
        vector<double> results(3);
        for (size_t i=0; i<3; ++i) results[i]=ToType<double>(file[iline][i+1]);
        m_read[decayer].insert(make_pair(decaychannel, results));
      }
      else {
        PRINT_INFO("Wrong format in decay table in "<<m_resultdir);
      }
    }
  }
}
Exemplo n.º 2
0
bool Simple_String::Initialize()
{
  CleanUp();
  if (InputPath()=="" && InputFile()=="") return false;
  if (!rpa->gen.Beam1().IsHadron() ||
      !rpa->gen.Beam2().IsHadron()) return false;
  Data_Reader *reader = new Data_Reader(" ",";","!","=");
  reader->AddComment("#");
  reader->AddWordSeparator("\t");
  reader->SetInputPath(InputPath());
  reader->SetInputFile(InputFile());
  std::vector<std::vector<std::string> > helpsvv;
  if (!reader->MatrixFromFile(helpsvv,"REGGE_TRAJECTORY")) {
    helpsvv.push_back(std::vector<std::string>(3));
    helpsvv.back()[0]="Pomeron";
    helpsvv.back()[1]="1.0808";
    helpsvv.back()[2]="0.25";
  }
  msg_Info()<<"Simple_String::Initialize(): Adding Reggeon {\n";
  for (size_t i=0;i<helpsvv.size();++i) {
    if (helpsvv[i].size()<3) continue;
    m_reggeons.push_back(new Reggeon_Trajectory
			 (ToType<double>(helpsvv[i][1]),
			  ToType<double>(helpsvv[i][2])));
    m_reggeons.back()->SetS(sqr(rpa->gen.Ecms()));
    msg_Info()<<"   "<<std::setw(10)<<helpsvv[i][0]
	      <<" "<<std::setw(8)<<helpsvv[i][1]
	      <<" "<<std::setw(8)<<helpsvv[i][2]<<"\n";
  }
  msg_Info()<<"}"<<std::endl;
  p_remnants[0]=p_isr->GetRemnant(0);
  p_remnants[1]=p_isr->GetRemnant(1);
  return true;
}
Exemplo n.º 3
0
bool Amisic::Initialize()
{
  if (InputPath()=="" && InputFile()=="") return false;
  Data_Reader *reader = new Data_Reader(" ",";","!","=");
  reader->AddComment("#");
  reader->AddWordSeparator("\t");
  reader->SetInputPath(InputPath());
  reader->SetInputFile(InputFile());
  std::vector<std::string> model;
  if (!reader->VectorFromFile(model,"HARD_MODEL_NAME")) {
    model.push_back("Simple_Chain");
  }
  for (size_t i=1;i<model.size();++i) model[0]+=" "+model[i];
  SelectHardModel(model[0]);
  if (!reader->VectorFromFile(model,"SOFT_MODEL_NAME")) {
    model.push_back("None");
  }
  for (size_t i=1;i<model.size();++i) model[0]+=" "+model[i];
  SelectSoftModel(model[0]);
  std::string file;
  if (!reader->ReadFromFile(file,"HARD_MODEL_FILE")) file=InputFile();
  p_hardbase->SetInputPath(InputPath());
  p_hardbase->SetInputFile(file);
  if (!reader->ReadFromFile(file,"SOFT_MODEL_FILE")) file=InputFile();
  p_softbase->SetInputPath(InputPath());
  p_softbase->SetInputFile(file);
  delete reader;
  bool success=true;
  success=success&&p_hardbase->Initialize();
  success=success&&p_softbase->Initialize();
  return success;
}
Exemplo n.º 4
0
void InitialiseGenerator(int argc, char *argv[])
{
  if(argc<2) {
    cout<<"Usage: ./SingleDecay <PDG_CODE>"<<endl;
    THROW(normal_exit,"you didn't specify the decaying particle by PDG code.");
  }

  small_sherpa_init(argc, argv);

  hadrons = new SHERPA::Hadron_Decay_Handler(".", "Fragmentation.dat");

  Data_Reader * reader = new Data_Reader(" ",";","!","=");
  reader->AddWordSeparator("\t");
  reader->SetInputPath("./");
  reader->SetInputFile("YFS.dat");
  photons = new PHOTONS::Photons(reader,true);

  mother_flav = Flavour( (kf_code) abs(ToType<int>(argv[1])) );
  mother_flav.SetStable(false);
  if(ToType<int>(argv[1])<0) mother_flav=mother_flav.Bar();

  rpa->gen.SetEcms(mother_flav.HadMass());
  msg_Info()<<"Welcome. I am decaying a "<<mother_flav<<endl;

  Particle* mother_part = new Particle( 1,mother_flav,
                                        Vec4D(mother_flav.HadMass(),0.,0.,0.) );
  mother_part->SetTime();
  mother_part->SetFinalMass(mother_flav.HadMass());
  
  ref_blob = new Blob();
  ref_blob->SetType(btp::Hadron_Decay);
  ref_blob->SetStatus(blob_status::needs_hadrondecays);
  ref_blob->AddToInParticles(mother_part);

  try {
    hadrons->FillOnshellDecay(ref_blob, NULL);
  } catch (Return_Value::code ret) {
    msg_Error()<<METHOD<<" Something went wrong for blob: "<<ref_blob<<endl;
    return;
  }
}
Exemplo n.º 5
0
void FeynRules_Model::ParticleInit() {
  m_partfile = p_dataread->GetValue<string>("FR_PARTICLES",std::string("Particle.dat"));
  Data_Reader reader = Data_Reader(" ",";","!","=");
  p_dataread->AddComment("#");
  reader.AddWordSeparator("\t");
  reader.SetAddCommandLine(false);
  reader.SetInputPath(m_dir);
  reader.SetInputFile(m_partfile);
  
  kf_code kfc;
  int     charge,icharge,spin,strong,Majorana;
  bool    Take,stable,massive;
  double  mass,width;
  std::string idname, texname;
  
  if (!reader.OpenInFile()) {
    msg_Error()<<METHOD<<"(): FeynRules particle data file '"
	       <<m_partfile<<"' not found."<<std::endl;
    return;
  }
  std::vector<std::vector<std::string> > helpsvv;
  reader.MatrixFromFile(helpsvv);
  for(size_t i(1);i<helpsvv.size();++i) {
    if (helpsvv[i].size()!=13) {
      msg_Error()<<METHOD<<"(): Inconsistent entry in line "<<i
  		 <<" of '"<<reader.InputFile()<<"'."<<std::endl;
      continue;
    }

    if (helpsvv[i][0]==std::string("kf")) continue;

    kfc=ToType<int>(helpsvv[i][0]); 
    mass=ToType<double>(helpsvv[i][1]); width=ToType<double>(helpsvv[i][2]);
    charge=ToType<int>(helpsvv[i][3]); icharge=ToType<int>(helpsvv[i][4]);
    strong=ToType<int>(helpsvv[i][5]); spin=ToType<int>(helpsvv[i][6]);
    Majorana=ToType<int>(helpsvv[i][7]); Take=ToType<int>(helpsvv[i][8]);
    stable=ToType<int>(helpsvv[i][9]); massive=ToType<int>(helpsvv[i][10]);
    idname=helpsvv[i][11]; texname=helpsvv[i][12];
    s_kftable[kfc] = new Particle_Info(kfc,mass,width,charge,icharge,strong,spin,
				       Majorana,Take,stable,massive,idname,texname);
  }
  ReadParticleData();
  
  // add containers
  s_kftable[kf_none] = new
    Particle_Info(kf_none,-1,0,0,0,0,0,-1,0,1,0,"no_particle","no particle",0,1);
  s_kftable[kf_resummed] = new
    Particle_Info(kf_resummed,0.,0.,0,0,1,2,0,1,1,0,"r","resummed",0,1);
  s_kftable[kf_bjet] = new
    Particle_Info(kf_bjet,0.,0.,0,0,1,2,0,1,1,0,"bj","bjet",0,1);

  s_kftable[kf_fermion] = new
    Particle_Info(kf_fermion,0.,0., 0,0,0,1,0,1,1,0,"fermion","fermion",0,1);
  s_kftable[kf_jet] = new
    Particle_Info(kf_jet,0.,0.,0,0,1, 2,0,1,1,0,"j","jet",0,1);
  s_kftable[kf_quark] = new
    Particle_Info(kf_quark,0.,0.,0, 0,1,1,0,1,1,0,"Q","Quark",0,1);
  s_kftable[kf_lepton] = new
    Particle_Info(kf_lepton,0.,0.,-3,-1,0,1,0,1,1,0,"lepton","lepton",0,1);
  s_kftable[kf_neutrino] = new
    Particle_Info(kf_neutrino,0.,0.,0,1,0, 1,0,1,1,0,"neutrino","neutrino",0,1);
  s_kftable[kf_fermion]->Clear();
  s_kftable[kf_jet]->Clear();
  s_kftable[kf_resummed]->Clear();
  s_kftable[kf_resummed]->m_resummed=true;
  s_kftable[kf_quark]->Clear();
  s_kftable[kf_lepton]->Clear();
  s_kftable[kf_neutrino]->Clear();
  for (int i=1;i<7;i++) {
    Flavour addit((kf_code)i);
    if (addit.Mass()==0.0 || (!addit.IsMassive() && addit.IsOn())) {
      s_kftable[kf_jet]->Add(addit);
      s_kftable[kf_jet]->Add(addit.Bar());
      s_kftable[kf_quark]->Add(addit);
      s_kftable[kf_quark]->Add(addit.Bar());
      s_kftable[kf_fermion]->Add(addit);
      s_kftable[kf_fermion]->Add(addit.Bar());
    }
  }
  s_kftable[kf_jet]->Add(Flavour(kf_gluon));
  s_kftable[kf_jet]->SetResummed();
  for (int i=11;i<17;i+=2) {
    Flavour addit((kf_code)i);
    if (addit.Mass()==0.0 || (!addit.IsMassive() && addit.IsOn())) {
      s_kftable[kf_lepton]->Add(addit);
      s_kftable[kf_lepton]->Add(addit.Bar());
      s_kftable[kf_fermion]->Add(addit);
      s_kftable[kf_fermion]->Add(addit.Bar());
    }
  }
  for (int i=12;i<18;i+=2) {
    Flavour addit((kf_code)i);
    if (addit.Mass()==0.0 && addit.IsOn()) {
      s_kftable[kf_neutrino]->Add(addit);
      s_kftable[kf_neutrino]->Add(addit.Bar());
      s_kftable[kf_fermion]->Add(addit);
      s_kftable[kf_fermion]->Add(addit.Bar());
    }
  }
}
Exemplo n.º 6
0
Lund_Interface::Lund_Interface(string _m_path,string _m_file):
  m_path(_m_path),m_file(_m_file), m_maxtrials(2),
  p_hepevt(NULL), 
  m_compress(true),m_writeout(false),
  p_phep(new double[5*HEPEVT_CB_SIZE]),
  p_vhep(new double[4*HEPEVT_CB_SIZE]),
  p_jmohep(new int[2*HEPEVT_CB_SIZE]),
  p_jdahep(new int[2*HEPEVT_CB_SIZE])
{
  exh->AddTerminatorObject(this);
  double win;
  string beam[2], frame("CMS");
  Flavour flav[2];
  for (size_t i=0;i<2;++i) flav[i]=rpa->gen.Bunch(i);
  if (flav[0].Kfcode()==kf_e && flav[1].Kfcode()==kf_p_plus) {
    if (flav[0].IsAnti()) beam[0]="e+"; else beam[0]="e-";
    if (flav[1].IsAnti()) beam[1]="p-"; else beam[1]="p+";
    pysubs.msub[9]=1;    
  }
  else if (flav[0].Kfcode()==kf_p_plus && flav[1].Kfcode()==kf_e) {
    if (flav[0].IsAnti()) beam[0]="p-"; else beam[0]="p+";
    if (flav[1].IsAnti()) beam[1]="e+"; else beam[1]="e-";
    pysubs.msub[9]=1;    
  }
  else if (flav[0]==Flavour(kf_e) && flav[1]==Flavour(kf_photon)) {
    if (flav[0].IsAnti()) beam[0]="e+"; else beam[0]="e-";
    beam[1]="gamma";
    pysubs.msub[33]=1;    
  }
  else if (flav[0]==Flavour(kf_photon) && flav[1]==Flavour(kf_e)) {
    beam[0]="gamma";
    if (flav[1].IsAnti()) beam[1]="e+"; else beam[1]="e-";
    pysubs.msub[33]=1;    
  }
  else if (flav[0]==Flavour(kf_photon) && flav[1]==Flavour(kf_photon)) {
    for (size_t i=0;i<2;++i) beam[i]="gamma";
    pysubs.msub[57]=1;    
  }
  else if (flav[0].Kfcode()==kf_e && flav[1].Kfcode()==kf_e) {
    for (size_t i=0;i<2;++i) if (flav[i].IsAnti()) beam[i]="e+"; else beam[i]="e-";
    pysubs.msub[0]=1;    
    pypars.mstp[47]=1;
    pydat1.mstj[100]=5;
  }
  else {
    for (size_t i=0;i<2;++i) if (flav[i].IsAnti()) beam[i]="p-"; else beam[i]="p+";
    pysubs.msub[0]=1;    
    pypars.mstp[47]=1;
    pydat1.mstj[100]=5;
  }
  win=rpa->gen.Ecms();
  s_maxerrors=rpa->gen.NumberOfEvents();
  vector<vector<double> > help;
  Data_Reader *reader = new Data_Reader(" ",";","!","=");
  reader->AddComment("#");
  reader->AddWordSeparator("\t");
  reader->SetInputPath(m_path);
  reader->SetInputFile(m_file);
  reader->AddIgnore("(");
  reader->AddIgnore(")");
  reader->AddIgnore(",");
  pysubs.msel=0;
  reader->MatrixFromFile(help,"MSUB");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>1) if ((int)help[i][0]>0) pysubs.msub[(int)help[i][0]-1]=(int)help[i][1];
  }
  reader->MatrixFromFile(help,"KFIN");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>2) {
      if (((int)help[i][0]>0)&&((int)help[i][1]>-41)) {
	pysubs.kfin[(int)help[i][1]+40][(int)help[i][0]-1]=(int)help[i][2];
      }
    }
  }
  reader->MatrixFromFile(help,"CKIN");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>1) if ((int)help[i][0]>0) pysubs.ckin[(int)help[i][0]-1]=help[i][1];
  }
  reader->MatrixFromFile(help,"MSTJ");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>1) if ((int)help[i][0]>0) pydat1.mstj[(int)help[i][0]-1]=(int)help[i][1];
  }
  reader->MatrixFromFile(help,"MSTP");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>1) if ((int)help[i][0]>0) pypars.mstp[(int)help[i][0]-1]=(int)help[i][1];
  }
  reader->MatrixFromFile(help,"MSTU");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>1) if ((int)help[i][0]>0) pydat1.mstu[(int)help[i][0]-1]=(int)help[i][1];
  }
  reader->MatrixFromFile(help,"PARP");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>1) if ((int)help[i][0]>0) pypars.parp[(int)help[i][0]-1]=help[i][1];
  }
  reader->MatrixFromFile(help,"PARJ");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>1) if ((int)help[i][0]>0) pydat1.parj[(int)help[i][0]-1]=help[i][1];
  }
  reader->MatrixFromFile(help,"PARU");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>1) if ((int)help[i][0]>0) pydat1.paru[(int)help[i][0]-1]=help[i][1];
  }
  reader->MatrixFromFile(help,"MDME");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>2) {
      if ((int)help[i][0]>0 && abs((int)help[i][1]<2)) {
	pydat3.mdme[(int)help[i][1]-1][(int)help[i][0]-1]=(int)help[i][2];
      }
    }
  }
  reader->MatrixFromFile(help,"MDCYKF");
  for (size_t i=0;i<help.size();++i) {
    if (help[i].size()>2) {
      if ((int)help[i][0]>0 && abs((int)help[i][1]<2)) {
	msg_Tracking()<<"Lund_Interface::Lund_Interface(..): "
		      <<"Set MDCY("<<pycomp((int)help[i][0])<<","<<(int)help[i][1]
		      <<") ( from KF code "<<(int)help[i][0]<<" ) to "<<(int)help[i][2]<<endl;
	pydat3.mdcy[(int)help[i][1]-1][pycomp((int)help[i][0])-1]=(int)help[i][2];
      }
    }
  }
  // the next lines replace the apyinit_ call
  hepevt.nhep=100;
  for (int i=pydat3.mdcy[2-1][23-1];i<pydat3.mdcy[2-1][23-1]+pydat3.mdcy[3-1][23-1];++i) {
    if (abs(pydat3.kfdp[1-1][i-1])>=2) pydat3.mdme[1-1][i-1]=Min(0,pydat3.mdme[1-1][i-1]);
  }
  pyinit(frame.c_str(),beam[0].c_str(),beam[1].c_str(),100.0);
  // replacement ends here
  if (msg_LevelIsDebugging()) ListLundParameters();
  pylist(0);
  delete reader;
}