#include "HADRONS++/Main/Hadron_Decay_Channel.H" #include "HADRONS++/ME_Library/HD_ME_Base.H" #include "HADRONS++/ME_Library/Generic.H" #include "HADRONS++/ME_Library/Current_ME.H" #include "HADRONS++/Current_Library/Current_Base.H" #include "HADRONS++/PS_Library/HD_PS_Base.H" #include "PHASIC++/Decays/Decay_Table.H" #include "PHASIC++/Channels/Multi_Channel.H" #include "ATOOLS/Org/MyStrStream.H" #include "ATOOLS/Math/Vector.H" #include "ATOOLS/Org/Shell_Tools.H" #include "ATOOLS/Phys/Blob.H" #include "ATOOLS/Org/Data_Reader.H" #include "ATOOLS/Org/My_MPI.H" using namespace HADRONS; using namespace ATOOLS; using namespace METOOLS; using namespace std; Hadron_Decay_Channel::Hadron_Decay_Channel(Flavour fl, const Mass_Selector* ms, string _path) : Decay_Channel(fl, ms), m_path(_path), m_always_integrate(false), m_cp_asymmetry_C(0.0), m_cp_asymmetry_S(0.0) { } Hadron_Decay_Channel::~Hadron_Decay_Channel() { } void Hadron_Decay_Channel::SetFileName(std::string filename) { if(filename=="") { filename += GetDecaying().ShellName(); if (filename=="B_{s}") filename = "Bs"; filename += string("_"); for ( int i=0; i > Hadron_Decay_Channel::Process(const string& content, const string& begin, const string& end) { Data_Reader reader(" ",";","!","="); reader.AddComment("#"); reader.AddComment("//"); reader.SetMatrixType(mtc::transposed); reader.AddLineSeparator("\n"); reader.RescanFileContent(SubString(content,begin,end),true); vector > helpsvv; reader.MatrixFromString(helpsvv,""); return helpsvv; } bool Hadron_Decay_Channel::Initialise(GeneralModel startmd) { m_physicalflavours=m_flavours; for (size_t i=0; i::const_iterator it = startmd.m_aliases.find(m_flavours[i].Kfcode()); if (it!=startmd.m_aliases.end()) m_physicalflavours[i] = Flavour(it->second, m_flavours[i].IsAnti()); } double totalmass=0.0; for (size_t i=1; im_flavours[0].HadMass()) { msg_Error()<<"Error in "<SetNin(1); Channels()->SetNout(NOut()); m_startmd=startmd; // check if dc file exists if (FileExists(m_path+m_filename)) { msg_Tracking()< decayindices(n); for(int i=0;i > helpsvv = Process(content,"",""); for (size_t i=0;i(helpsvv[i][1]); } else if (helpsvv[i][0]==string("CPAsymmetryC")) { m_cp_asymmetry_C = ToType(helpsvv[i][1]); } } // convert C and S to lambda, assuming DeltaGamma=0 for the determination // of C and S. // this allows DeltaGamma dependent terms in the asymmetry double Abs2 = -1.0*(m_cp_asymmetry_C-1.0)/(m_cp_asymmetry_C+1.0); double Im = m_cp_asymmetry_S/(m_cp_asymmetry_C+1.0); double Re = sqrt(Abs2-sqr(Im)); m_cp_asymmetry_lambda = Complex(Re, Im); } void Hadron_Decay_Channel::ProcessPhasespace(const string& content, const GeneralModel& model_for_ps) { vector > ps_svv = Process(content,"",""); int nr_of_channels=0; for (size_t i=0;i(ps_svv[i][0]); if(AddPSChannel( ps_svv[i][1], weight, model_for_ps ) ) nr_of_channels++; else { msg_Error()< > me_svv = Process(content,"",""); int nr_of_mes=0; Algebra_Interpreter ip; ip.AddTag("GF", "8.24748e-6"); for (size_t i=0;iSetPath(m_path); msg_Tracking()<<" "<Name()<","")); model_for_ps.AddParameters(SubString(content,"<"+me_svv[i][2]+">","")); me->SetModelParameters( me_model ); Complex factor = Complex(ToType(ip.Interprete(me_svv[i][0])), ToType(ip.Interprete(me_svv[i][1]))); me->SetFactor(factor); AddDiagram(me); nr_of_mes++; } if(me_svv[i].size()==4) { msg_Tracking()<<"Selecting currents for "<SetPath(m_path); GeneralModel current1_model = m_startmd; current1_model.AddParameters(SubString(content,"<"+me_svv[i][2]+">","")); model_for_ps.AddParameters(SubString(content,"<"+me_svv[i][2]+">","")); current1->SetModelParameters( current1_model ); Current_Base* current2 = SelectCurrent(me_svv[i][3]); current2->SetPath(m_path); GeneralModel current2_model = m_startmd; current2_model.AddParameters(SubString(content,"<"+me_svv[i][3]+">","")); model_for_ps.AddParameters(SubString(content,"<"+me_svv[i][3]+">","")); current2->SetModelParameters( current2_model ); msg_Tracking()<<" "<Name()<Name()<DecayIndices().size()+ current2->DecayIndices().size()) { msg_Error()<<"Error in "<(ip.Interprete(me_svv[i][0])), ToType(ip.Interprete(me_svv[i][1]))); vector indices (NOut()+1); for(int i=0; iSetCurrent1(current1); me->SetCurrent2(current2); me->SetFactor(factor); AddDiagram(me); nr_of_mes++; } } if(nr_of_mes == 0) { msg_Error()< decayindices(n); for(int i=0;i > result_svv = Process(content,"",""); if(result_svv.size()!=1) { msg_Info()<<"Calculating width (PR1) for "<(result_svv[0][0]); double oldmax=ToType(result_svv[0][2]); if(oldwidth!=m_iwidth || oldmax!=m_max) WriteOut(false,m_path,m_filename); } else if(result_svv[0].size()==3) { if (result_svv[0][0].find("nan")!=string::npos) { PRINT_INFO("Found nan in "<(result_svv[0][0]); m_ideltawidth=ToType(result_svv[0][1]); m_max=ToType(result_svv[0][2]); } else { THROW(fatal_error, "Result section of "+m_path+"/"+m_filename+" did not "+ "contain three entries. Aborting."); } } void Hadron_Decay_Channel::WriteOut(bool newfile, string path, string file) { string content, entry; My_Out_File to(path+file); to.Open(); to->precision(4); if ( newfile ) { // if DC file doesn't exist yet // write header *to<<"# Decay: "< "; int i=0; for (size_t i=1; i"<"<"<"<"<"<"<"<"<"<"); size_t found_end = content.find(""); resultline="\n "+ToString(m_iwidth)+" "+ToString(m_ideltawidth)+" "+ToString(m_max)+";\n\n"; if (found_begin!=string::npos) content.replace(found_begin,found_end,resultline); else content.append(resultline); msg_IODebugging()<NOutP();i++) { if(blob->OutParticle(i)->Flav().IsQuark()) n_q++; else if(blob->OutParticle(i)->Flav().IsGluon()) n_g++; } if(n_q>0 || n_g>0) { blob->SetStatus(blob_status::needs_showers); Particle_Vector outparts=blob->GetOutParticles(); if(m_diagrams.size()>0) { // try if the matrix element knows how to set the color flow HD_ME_Base* firstme=(HD_ME_Base*) m_diagrams[0]; bool anti=blob->InParticle(0)->Flav().IsAnti(); if(firstme->SetColorFlow(outparts,n_q,n_g,anti)) return true; } // otherwise try some common situations int n=outparts.size(); if(n_q==2 && n_g==0 && n==2) { if(outparts[0]->Flav().IsAnti()) { outparts[0]->SetFlow(2,-1); outparts[1]->SetFlow(1,outparts[0]->GetFlow(2)); } else { outparts[0]->SetFlow(1,-1); outparts[1]->SetFlow(2,outparts[0]->GetFlow(1)); } return true; } else if(n_q==0 && n_g==2) { int inflow(-1), outflow(-1); Particle_Vector::iterator pit; for(pit=outparts.begin(); pit!=outparts.end(); pit++) { if((*pit)->Flav().IsGluon()) { (*pit)->SetFlow(2,inflow); (*pit)->SetFlow(1,outflow); inflow=(*pit)->GetFlow(1); outflow=(*pit)->GetFlow(2); } } return true; } else if(n_q==0 && n_g==n) { outparts[0]->SetFlow(2,-1); outparts[0]->SetFlow(1,-1); for(int i=1;iSetFlow(2,c-1); outparts[i]->SetFlow(1,c); } outparts[n-1]->SetFlow(2,outparts[n-2]->GetFlow(1)); outparts[n-1]->SetFlow(1,outparts[0]->GetFlow(2)); return true; } else { msg_Error()< resultstrings; reader.SetString(current_string); reader.VectorFromString(resultstrings); int n=resultstrings.size()-1; vector indices(n); for(int i=0; i(resultstrings[i+1]); ME_Parameters fi(m_physicalflavours, indices); Current_Base* current=Current_Getter_Function::GetObject(resultstrings[0],fi); if(current==NULL) { msg_Error()< resultstrings; reader.SetString(me_string); reader.VectorFromString(resultstrings); if(resultstrings.size()==1 && resultstrings[0]=="Generic") { for(int i=0;i(i) ); } if(int(resultstrings.size())!=NOut()+2) { msg_Error()< indices(n); for(int i=0; i(resultstrings[i+1]); ME_Parameters fi(m_physicalflavours, indices); HD_ME_Base* me = HD_ME_Getter_Function::GetObject(resultstrings[0],fi); if(me==NULL) { msg_Error()< 0. ) { sprintf( helpstr, "%.4f", DeltaWidth()/totalwidth*100. ); f<<" $\\pm$ "<0 && ((HD_ME_Base*) m_diagrams[0])->Name()!="Generic")) { sprintf( helpstr, "%.4f", IWidth()/totalwidth*100. ); f<<" & "< 0. ) { sprintf( helpstr, "%.4f", IDeltaWidth()/totalwidth*100. ); f<<" $\\pm$ "<Name()=="Current_ME") { Current_ME* cme=(Current_ME*) me; f<<"\\verb;"<GetCurrent1()->Name() <<";$\\otimes$\\verb;"<GetCurrent2()->Name()<<"; & \\\\"<Name()=="Generic") { // do nothing } else { f<<"\\verb;"<Name()<<"; & \\\\"<SetAlpha(weight); Channels()->Add(sc); return true; } else return false; }