本文整理汇总了C++中Flavour类的典型用法代码示例。如果您正苦于以下问题:C++ Flavour类的具体用法?C++ Flavour怎么用?C++ Flavour使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Flavour类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FixHHDecay
void Soft_Cluster_Handler::FixHHDecay(Cluster * cluster,Blob * blob,
const Flavour had1,const Flavour had2,
const bool & constrained)
{
double M = cluster->Mass(), M2 = M*M;
double m12 = sqr(had1.HadMass()), m22 = sqr(had2.HadMass());
cluster->BoostInCMSAndRotateOnZ();
double E1((M2+m12-m22)/(2.*M)), pl2(sqr(E1)-m12);
bool isbeam(false);
double stheta, pt2;
double masscor((cluster->GetTrip()->m_flav.HadMass() *
cluster->GetAnti()->m_flav.HadMass())/m_pt02);
do {
stheta = 1.-2.*ran->Get();
pt2 = pl2*sqr(stheta);
} while (pt2>m_pt2max*m_pt2maxfac ||
sqr((*p_as)(pt2,false)/p_as->MaxValue())<ran->Get());
double pt = sqrt(pt2);
int sign = cluster->GetTrip()->m_mom[3]<0?-1:1;
double pl1 = sign*sqrt(sqr(E1)-sqr(pt)-m12);
double cosphi = cos(2.*M_PI*ran->Get()), sinphi = sqrt(1.-cosphi*cosphi);
Vec4D p1 = Vec4D(E1,pt*cosphi,pt*sinphi,pl1);
Vec4D p2 = cluster->Momentum()-p1;
if (p1[0]<0. || p2[0]<0.) throw Return_Value::Retry_Event;
cluster->RotateAndBoostBack(p1);
cluster->RotateAndBoostBack(p2);
cluster->RotateAndBoostBack();
Particle * left(new Particle(-1,had1,p1));
left->SetNumber();
left->SetInfo('P');
left->SetFinalMass(had1.HadMass());
Particle * right(new Particle(-1,had2,p2));
right->SetNumber();
right->SetInfo('P');
right->SetFinalMass(had2.HadMass());
control::s_AHAparticles+=2;
if (blob!=NULL) {
blob->AddToOutParticles(left);
blob->AddToOutParticles(right);
}
// if (cluster->GetTrip()->m_info=='B' || cluster->GetAnti()->m_info=='B') {
// msg_Out()<<"==========================================================\n"
// <<"Cluster decay (pt = "<<pt<<") for cluster \n"<<(*cluster)<<"\n"
// <<"==> "<<left->Momentum()<<" + "<<right->Momentum()<<" for "
// <<left->Flav()<<" + "<<right->Flav()<<"\n"
// <<"==========================================================\n";
// }
if (m_ana) {
Histogram* histo((m_histograms.find(std::string("PT_HH")))->second);
histo->Insert(pt);
Histogram* histo2((m_histograms.find(std::string("PT2_HH")))->second);
histo2->Insert(pt*pt);
}
}
示例2: Flavour
void Interaction_Model_QCD::c_FFV(std::vector<Single_Vertex>& vertex,int & vanz)
{
Kabbala kcpl0 = -g3*M_I;
Kabbala kcpl1 = kcpl0;
for (short int i=1;i<=(m_extension==2?8:6);i++) {
Flavour flav = Flavour((kf_code)(i));
if (flav.Strong() && flav.IsOn() && Flavour(kf_gluon).IsOn()) {
vertex[vanz].in[0] = flav;
vertex[vanz].in[1] = Flavour(kf_gluon);
vertex[vanz].in[2] = flav;
vertex[vanz].cpl[0] = kcpl0;
vertex[vanz].cpl[1] = kcpl1;
vertex[vanz].Str = (kcpl0*PR+kcpl1*PL).String();
vertex[vanz].Color.push_back(Color_Function(cf::T,1,2,0,'1','2','0'));
vertex[vanz].Lorentz.push_back(LF_Getter::GetObject("Gamma",LF_Key()));
vertex[vanz].Lorentz.back()->SetParticleArg(1);
vertex[vanz].on = 1;
vertex[vanz].oqcd = 1;
vertex[vanz].oew = 0;
vertex.push_back(Single_Vertex());vanz++;
}
}
}
示例3: plit
int Singlet::SplitParton(Parton * mother, Parton * part1, Parton * part2)
{
iterator plit(begin());
for (;plit!=end();++plit) if (*plit==mother) break;
if (plit==end()) THROW(fatal_error,"Internal error");
Flavour flav = mother->GetFlavour(), flav1 = part1->GetFlavour(), flav2 = part2->GetFlavour();
PLiter pos1,pos2;
plit = insert(plit,part1);
pos1 = plit;
plit++;
plit = insert(plit,part2);
pos2 = plit;
part1->SetSing(this);
part2->SetSing(this);
plit++;
m_dels.push_back(mother);
plit = erase(plit);
if (flav.StrongCharge()==8 &&
abs(flav1.StrongCharge())==3 &&
abs(flav2.StrongCharge())==3) { return 1; }
return 0;
}
示例4: InitialiseGenerator
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");
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();
if(hadrons->DecayMap()->FindDecay(mother_flav)==NULL)
THROW(fatal_error, "Didn't find "+ToString<Flavour>(mother_flav)+
" in HadronDecays.dat.");
// set all decay channel BR's equal, such that we generate the same amount of
// each decay channel to be tested
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);
rpa->gen.SetEcms(mother_flav.HadMass());
msg_Info()<<"Welcome. I am decaying a "<<mother_flav<<endl;
}
示例5: TransformKin
double Soft_Cluster_Handler::
TransformKin(const double MC,const Flavour & flav,const bool & enforce) {
double mass2(sqr(flav.HadMass()));
double width2(sqr(Max(flav.Width(),1.e-6)));
if (!enforce && sqr(MC*MC-mass2)>10.*mass2*width2) return 0.;
return
pow(sqr(mass2)/(sqr(MC*MC-mass2) + mass2*width2),m_kappa) *
pow(mass2*width2/(sqr(MC*MC-mass2) + mass2*width2),m_lambda);
}
示例6: Flavour
int Lund_Interface::PrepareFragmentationBlob(Blob * blob)
{
int nhep = 0;
hepevt.idhep[nhep]=SherpaToIdhep(Flavour(kf_photon));
for (short int j=1;j<4;++j) hepevt.phep[nhep][j-1]=blob->CMS()[j];
hepevt.phep[nhep][3]=blob->CMS()[0];
double pabs=(blob->CMS()).Abs2();
if (pabs<0) hepevt.phep[nhep][4]=0.0;
else hepevt.phep[nhep][4]=sqrt(pabs);
for (short int j=0;j<4;++j) hepevt.vhep[nhep][j]=0.0;
hepevt.isthep[nhep]=1;
hepevt.jmohep[nhep][0]=0;
hepevt.jmohep[nhep][1]=0;
hepevt.jdahep[nhep][0]=0;
hepevt.jdahep[nhep][1]=0;
// gluon splittings
for (int i(0);i<blob->NInP();++i) {
Particle * part = blob->InParticle(i);
if (part->GetFlow(1)!=0 && part->GetFlow(2)!=0) {
Flavour flav = Flavour(kf_d);
if (ran->Get()<0.5) flav = Flavour(kf_u);
Particle *help1(new Particle(-1,flav,0.5*part->Momentum()));
Particle *help2(new Particle(-1,flav.Bar(),help1->Momentum()));
help1->SetStatus(part_status::active);
help2->SetStatus(part_status::active);
AddPartonToString(help1,nhep);
delete help1;
unsigned int lastc(part->GetFlow(2));
for (++i;i<blob->NInP();++i) {
part = blob->InParticle(i);
AddPartonToString(part,nhep);
if (part->GetFlow(1)==lastc) {
lastc=0;
break;
}
}
if (lastc!=0)
msg_Error()<<METHOD<<"(): Error. Open color string."<<std::endl;
AddPartonToString(help2,nhep);
delete help2;
lastc=0;
}
else {
for (;i<blob->NInP();i++) {
part = blob->InParticle(i);
AddPartonToString(part,nhep);
if (part->GetFlow(1)==0) break;
}
}
}
return nhep;
}
示例7: AdjustProperties
void Lund_Interface::AdjustProperties(Flavour flav)
{
int kc = pycomp(SherpaToIdhep(flav));
if(kc>500) return;
// adjust mass
double pythiamass = pydat2.pmas[1-1][kc-1];
double sherpamass = flav.HadMass();
flav.SetMass(pythiamass);
if( !(abs(sherpamass-pythiamass)/sherpamass < 1.e-2) ) {
msg_Info()<<METHOD<<" Adjusted mass of "<<flav<<" ("<<flav.Kfcode()
<<") from "<<sherpamass<<" to "<<pythiamass<<" to allow Pythia decays."<<endl;
}
}
示例8: switch
size_t Comix1to3::NHel(const Flavour& fl)
{
switch(fl.IntSpin()) {
case 0:
return 1;
case 1:
return 2;
case 2:
if (IsZero(fl.Mass())) return 2;
else return 3;
default:
THROW(not_implemented, "Comix not yet capable of spin > 1.");
return 0;
}
}
示例9: FlavourSort
bool Decay_Channel::FlavourSort(const Flavour &fl1,const Flavour &fl2)
{
// TODO: Get rid of this custom sorting, but then the hadron decay channel
// files have to be changed as well (order mapping in MEs)
kf_code kf1(fl1.Kfcode()), kf2(fl2.Kfcode());
if (kf1>kf2) return true;
if (kf1<kf2) return false;
/*
anti anti -> true
anti part -> false
part anti -> true
anti anti -> true
*/
return !(fl1.IsAnti()&&!fl2.IsAnti());
}
示例10: found
double Hadron_Remnant::MinimalEnergy(const ATOOLS::Flavour &flavour)
{
if (!m_initialized) {
if (!flavour.Strong()) {
return p_beam->Beam().HadMass();
}
bool found(false);
kf_code di[3];
if (flavour.IsQuark()) {
short unsigned int j=0;
for (Flavour_Vector::const_iterator flit(m_constit.begin());
flit!=m_constit.end();++flit) {
if (found || flavour!=*flit) di[j++]=flit->Kfcode();
else found=true;
}
}
Flavour difl;
if (!found || flavour.IsGluon()) {
int single=-1;
for (size_t i=0;i<m_constit.size();++i) {
for (size_t j=i+1;j<m_constit.size();++j) {
if (m_constit[i]==m_constit[j]) {
single=j;
break;
}
}
if (single>0) break;
}
Flavour fl(m_constit[single]);
for (short unsigned int j=0, i=0;i<3;i++)
if (i!=single) di[j++]=m_constit[i].Kfcode();
if (di[0]>di[1]) difl=Flavour((kf_code)(di[0]*1000+di[1]*100+1));
else if (di[1]>di[0]) difl=Flavour((kf_code)(di[1]*1000+di[0]*100+1));
else difl=Flavour((kf_code)(di[0]*1100+3));
if (m_constit[single].IsAnti()) difl=difl.Bar();
return difl.Mass()+fl.Mass()+flavour.Bar().Mass();
}
if (di[0]>di[1]) difl=Flavour((kf_code)(di[0]*1000+di[1]*100+1));
else if (di[1]>di[0]) difl=Flavour((kf_code)(di[1]*1000+di[0]*100+1));
else difl=Flavour((kf_code)(di[0]*1100+3));
if (m_constit[0].IsAnti()) difl=difl.Bar();
return difl.Mass();
}
else {
if (flavour.IsQuark()) return flavour.Bar().Mass();
}
return 0.;
}
示例11: ReadDecayTable
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);
}
}
}
}
示例12: Proto_Particle
Proto_Particle::
Proto_Particle(Flavour flav,Vec4D mom,char info) :
m_flav(flav), m_mom(mom), m_info(info),
m_mass(hadpars->GetConstituents()->Mass(flav)), m_kt2max(0.),
p_partner(NULL)
{
if (!flav.IsGluon() && !flav.IsDiQuark()) {
if (flav.IsQuark() && flav.Kfcode()>5) {
std::cerr<<"Error in Proto_Particle::Proto_Particle():\n"
<<" Tried to form a cluster particle from a "<<flav<<".\n"
<<" Please make sure that heavy coloured objects decay "
<<"before they enter hadronization.\n"
<<" Will exit the run.\n";
abort();
}
}
control::s_AHAprotoparticles++;
s_actives.push_back(this);
}
示例13: sqr
T3Channel::T3Channel(int _nin,int _nout,Flavour * fl,Flavour res)
{
nin = _nin;
nout = _nout;
ms = new double[nin+nout];
for (int i=0;i<nin+nout;i++) ms[i] = ATOOLS::sqr(fl[i].Mass());
rannum = 3*nout-4;
rans = new double[rannum];
s = smax = pt2max = sqr(ATOOLS::rpa->gen.Ecms());
pt2min = 0.0;
E = 0.5 * sqrt(s);
name = "T3-Channel";
if (nout>2) name = ToString(nin)+"->"+ToString(nout)+"_"+name;
mass = width = 0.;
type = 0;
if (res!=Flavour(kf_none)) {
mass = res.Mass(); width = res.Width(); type = 1;
}
p_vegas = new Vegas(rannum,100,name,0);
}
示例14: InitialiseAnalysis
void InitialiseAnalysis()
{
#ifdef USING__ROOT
msg_Out()<<"initialising ROOT analysis ..."<<std::endl;
ATOOLS::MakeDir("PhotonAnalysisDirectory/SingleDecay/"+mother_flav.ShellName()+"_decays",true,493);
rootfile = new TFile(string("PhotonAnalysisDirectory/SingleDecay/"+
mother_flav.ShellName()+"_decays/"+
mother_flav.ShellName()+"__"+
"DAUGHTERS"+".root").c_str(), "RECREATE");
photonmultiplicity = makeTH1D("photon_multiplicity","",
10, -0.5, 10.5,
Flavour(kf_photon).RootName()+" multiplicity","Events");
decayframeenergy = makeTH1D("decayframeenergy","",
1000, 0., mother_flav.HadMass(),
"total energy radiated in decay frame","Events");
multipoleframeangles = makeTH1D("multipoleframeangles","",
1000, 0., M_PI,
"angular radiation pattern","Events");
#endif
}
示例15: PerformMixing
ATOOLS::Blob* Mixing_Handler::PerformMixing(Particle* decayer) const
{
// explicit mixing in event record
Flavour flav = decayer->Flav();
string tag = flav.IsAnti() ? flav.Bar().IDName() : flav.IDName();
if(m_model("Mixing_"+tag,0.0)!=0.0 && decayer->Info()!=char('M')) {
double t = DetermineMixingTime(decayer,true)/rpa->hBar();
if(t==0.0) return NULL;
double factor = decayer->Flav().QOverP2();
if(decayer->Flav().IsAnti()) factor = 1.0/factor;
double dG = decayer->Flav().DeltaGamma()*t/4.0;
double dm = decayer->Flav().DeltaM()*t/2.0;
Complex i(0.0,1.0);
double prob_not_mix = sqr(abs(exp(i*dm)*exp(dG)+exp(-i*dm)*exp(-dG)));
double prob_mix = factor*sqr(abs(exp(i*dm)*exp(dG)-exp(-i*dm)*exp(-dG)));
if(prob_mix > ran->Get()*(prob_mix+prob_not_mix)) {
if(decayer->DecayBlob()) {
decayer->DecayBlob()->RemoveOwnedParticles();
delete decayer->DecayBlob();
}
decayer->SetStatus(part_status::decayed);
decayer->SetInfo('m');
Particle* mixed_part = new Particle(0, decayer->Flav().Bar(),
decayer->Momentum(), 'M');
mixed_part->SetFinalMass(decayer->FinalMass());
mixed_part->SetStatus(part_status::active);
mixed_part->SetTime(decayer->Time());
Blob* mixingblob = new Blob();
mixingblob->SetType(btp::Hadron_Mixing);
mixingblob->SetId();
mixingblob->SetStatus(blob_status::inactive);
mixingblob->SetTypeSpec("HADRONS");
mixingblob->AddToInParticles(decayer);
mixingblob->AddToOutParticles(mixed_part);
mixingblob->SetPosition(decayer->ProductionBlob()->Position());
mixingblob->SetStatus(blob_status::needs_hadrondecays);
return mixingblob;
}
}
return NULL;
}