#include "HADRONS++/Main/Hadron_Decay_Table.H" #include "HADRONS++/Main/Hadron_Decay_Channel.H" #include "HADRONS++/Main/Mixing_Handler.H" #include "HADRONS++/Main/Tools.H" #include "ATOOLS/Phys/Blob.H" #include "ATOOLS/Org/Data_Reader.H" #include "ATOOLS/Org/Shell_Tools.H" #include "ATOOLS/Org/My_MPI.H" using namespace HADRONS; using namespace ATOOLS; using namespace PHASIC; using namespace std; Hadron_Decay_Table::Hadron_Decay_Table(Flavour decayer, const Mass_Selector* ms, Mixing_Handler* mh) : Decay_Table(decayer, ms), p_mixinghandler(mh) { } Hadron_Decay_Table::~Hadron_Decay_Table() { } void Hadron_Decay_Table::Read(std::string path, std::string file) { Data_Reader reader = Data_Reader("|",";","!"); reader.AddComment("#"); reader.AddComment("//"); reader.SetInputPath(path); reader.SetInputFile(file); // read decay table file vector > helpsvv; if(!reader.MatrixFromFile(helpsvv,"")) { msg_Error()<<"ERROR in "< helpkfc; double BR, dBR, totBR(0.); string origin; bool haspartonics(false); std::vector specs; std::vector specweights; for (size_t i=0;i1 && Tools::ExtractFlavours(helpkfc,helpsvv[i][0])) { Tools::ExtractBRInfo(helpsvv[i][1], BR, dBR, origin); Hadron_Decay_Channel* hdc = new Hadron_Decay_Channel(Flav(),p_ms,path); int charge = Flav().IntCharge(); double mass = Flav().HadMass(); for (size_t j=0;jAddDecayProduct(flav); charge-=flav.IntCharge(); mass-=flav.HadMass(); } if (mass<0.) { msg_Tracking()<<"Found too low mass."; BR = 0.; dBR = 0.; continue; } totBR += BR; hdc->SetWidth(BR*Flav().Width()); hdc->SetDeltaWidth(dBR*Flav().Width()); hdc->SetOrigin(origin); if(helpsvv[i].size()==3) hdc->SetFileName(StringTrim(helpsvv[i][2])); else { hdc->SetFileName(); double dBR=hdc->DeltaWidth()/Flav().Width(); msg_Info()<<"{"<Flavs()[1]); if (hdc->Flavs().size()>2) { for (size_t k=2; kFlavs().size();++k) msg_Info()<<","<Flavs()[k]); } msg_Info()<<"}\t | "; msg_Info()<Width()/Flav().Width(); if(dBR>0.0) msg_Info()<<"("<Origin()!="") msg_Info()<<"["<Origin()<<"]"; msg_Info()<<"\t | "; msg_Info()<FileName()<<";"<FileName()); if(mass<-Accu()) THROW(fatal_error,"Decaying mass "+ToString(mass)+" too low in "+ hdc->FileName()); AddDecayChannel(hdc); nchannels++; } } if (rewrite) { PRINT_INFO("Found new decay channels. Please add the above lines to "< anti = "<TotalWidth()*totspec)); for (size_t i=0;isize();i++) { BR = ((*dectable)[i]->Width()*specweights[k]); int charge = Flav().IntCharge(); double mass = Flav().HadMass(); charge-=spec.IntCharge(); mass-=spec.HadMass(); for (size_t j=0;j<(*dectable)[i]->NOut();j++) { mass -= ((*dectable)[i]->GetDecayProduct(j)).HadMass(); } if (mass<0.) { msg_Tracking()<<"Mass too low for "<"; for (size_t j=0;j<(*dectable)[i]->NOut();j++) { msg_Tracking()<<" "<<(*dectable)[i]->GetDecayProduct(j); } msg_Tracking()<<".\n"; continue; } Hadron_Decay_Channel* hdc = new Hadron_Decay_Channel(Flav(),p_ms,path); hdc->AddDecayProduct(spec,false); std::string filename=m_flin.LegacyShellName(); filename += "_"+spec.LegacyShellName(); msg_Tracking()<<" Add partonic decay: "< "; for (size_t j=0;j<(*dectable)[i]->NOut();j++) { Flavour flav = (*dectable)[i]->GetDecayProduct(j); if (isAnti) flav=flav.Bar(); msg_Tracking()<AddDecayProduct(flav,false); charge -= flav.IntCharge(); mass -= flav.HadMass(); filename += flav.LegacyShellName(); } hdc->SetWidth(BR*partWidth); hdc->SetDeltaWidth(0.); hdc->SetOrigin(""); filename += ".dat"; msg_Tracking()<<" ---> "<SetFileName(filename); AddDecayChannel(hdc); nchannels++; } } } ScaleToWidth(); } void Hadron_Decay_Table::Initialise(GeneralModel& startmd) { if(size()==0) { msg_Error()<<"WARNING in "<Initialise(startmd); } } void Hadron_Decay_Table::LatexOutput(std::ostream& f) { f<<"\\subsection{\\texorpdfstring{Decaying Particle: $"<Width()!=0.0) at(i)->LatexOutput(f, TotalWidth()); } // skip inclusives for now f<<"\\hline"<Active()>=0) delta_tot+=at(i)->DeltaWidth(); if (delta_tot>0.0) { for (size_t i=0;iActive()>=0) { double scale_fac=at(i)->DeltaWidth()/delta_tot; at(i)->SetWidth(at(i)->Width()+ scale_fac*(m_flin.Width()-m_totalwidth)); } } UpdateWidth(); } } } Decay_Channel * Hadron_Decay_Table::Select(Blob* blob) const { Blob_Data_Base* data = (*blob)["dc"]; //msg_Tracking()<Status()<<"\n" // <<(*blob)<<"\n"; if (data) { if (blob->Has(blob_status::internal_flag)) { bool partonic_finalstate(false); Decay_Channel* dc; do { dc = Decay_Table::Select(); for (size_t i=0; iFlavs().size(); ++i) { if(dc->Flavs()[i].Strong()) { partonic_finalstate=true; break; } } } while (!partonic_finalstate); //msg_Tracking()<Get()->Name()<<",\n" // <<" retrying with "<Name()<<".\n"; DEBUG_INFO("retrying with "<Name()); blob->UnsetStatus(blob_status::internal_flag); blob->AddData("dc",new Blob_Data(dc)); return dc; } return data->Get(); } Decay_Channel* dec_channel=p_mixinghandler->Select(blob->InParticle(0),*this); blob->AddData("dc",new Blob_Data(dec_channel)); return dec_channel; }