Commit 5b5ed446 authored by Frank Krauss's avatar Frank Krauss

bug debugged^2 with massive restructuring of SoftClusterHandler

parent a52807ba
......@@ -31,8 +31,9 @@ int Cluster_Decay_Handler::DecayClusters(Blob * blob)
cluster = p_clulist->front();
if (!cluster->Active()) return -1;
if (p_clus->TestDecay(cluster)) {
//msg_Out()<<METHOD<<": decay ok for\n"<<(*cluster);
Cluster_List * clist(cluster->GetClusters());
if (!p_softclusters->TreatClusterDecay(clist,blob)) {
if (!p_softclusters->TreatClusterList(clist,blob)) {
msg_Error()<<"Error in "<<METHOD<<" : \n"
<<" Did not find a kinematically allowed "
<<"solution for the cluster list.\n"
......@@ -45,12 +46,14 @@ int Cluster_Decay_Handler::DecayClusters(Blob * blob)
}
}
else {
//msg_Out()<<METHOD<<" --> EnforcedDecay of\n"<<(*cluster)<<"\n";
if (!p_softclusters->EnforcedDecay(cluster,blob,true,NULL,true))
return -1;
//msg_Out()<<"Found "<<cluster->size()<<" hadrons: "
//<<(*cluster)[0]<<" + "<<(*cluster)[1]<<".\n";
//msg_Out()<<"Success:\n"<<(*blob)<<"\n\n\n";
//if (cluster==NULL) msg_Out()<<"Aha.\n";
//msg_Out()<<"Enter soft cluster treatment with \n"<<(*cluster);
Cluster_List clist;
clist.push_back(cluster);
if (!p_softclusters->TreatClusterList(&clist,blob)) {
msg_Error()<<"Error in "<<METHOD<<".\n";
exit(1);
}
}
delete (p_clulist->front()->GetTrip());
delete (p_clulist->front()->GetAnti());
......
......@@ -91,23 +91,18 @@ int Cluster_Formation_Handler::FormClusters(Blob * blob) {
if (!ClustersToHadrons(blob)) {
Reset(); return -1;
}
Vec4D blobmom(0.,0.,0.,0.);
for (size_t i(0);i<blob->NOutP();i++)
/*
Vec4D blobmom(0.,0.,0.,0.);
for (size_t i(0);i<blob->NOutP();i++)
blobmom+=blob->OutParticle(i)->Momentum();
// msg_Out()<<"____________________________________________________\n"
// <<"____________________________________________________\n"
// <<"Cluster list after all merging etc.:\n"<<(*p_clulist)
// <<"____________________________________________________\n"
// <<"Blob momentum: "<<blobmom<<";\n"<<(*blob)<<"\n"
// <<"____________________________________________________\n"
// <<"____________________________________________________\n";
//msg_Out()<<METHOD<<" was successful: "
// <<p_clulist->size()<<" clusters left to decay.\n"
// <<(*p_clulist)<<"\n";
//if (blob->NOutP()>0) msg_Out()<<(*blob);
//msg_Out()<<"##################################################\n";
//msg_Out()<<METHOD<<":"<<(*blob)<<"\n";
msg_Out()<<"____________________________________________________\n"
<<"____________________________________________________\n"
<<"Cluster list after all merging etc.:\n"<<(*p_clulist)
<<"____________________________________________________\n"
<<"Blob momentum: "<<blobmom<<";\n"<<(*blob)<<"\n"
<<"____________________________________________________\n"
<<"____________________________________________________\n";
*/
return 1;
}
......@@ -434,7 +429,7 @@ bool Cluster_Formation_Handler::MergeClusterListsIntoOne() {
bool Cluster_Formation_Handler::ClustersToHadrons(Blob * blob)
{
// msg_Out()<<METHOD<<" for: \n"<<(*p_clulist)<<"\n";
//msg_Out()<<"====== "<<METHOD<<" for: \n"<<(*p_clulist)<<"\n";
if (!p_softclusters->TreatClusterList(p_clulist,blob)) return false;
if (m_analyse) {
......
......@@ -55,6 +55,10 @@ Return_Value::code Ahadic::Hadronize(Blob_List * blobs)
if ((*blit)->Has(blob_status::needs_hadronization) &&
(*blit)->Type()==btp::Fragmentation) {
blob = (*blit);
//msg_Out()<<"====================================================\n"
// <<"====================================================\n"
// <<"====================================================\n"
// <<(*blob)<<"\n";
moveon = false;
Reset();
for (short int i=0;i<m_maxtrials;i++) {
......@@ -196,9 +200,12 @@ Return_Value::code Ahadic::Hadronize(Blob * blob,int retry) {
}
assert(m_clulist.empty());
if (blob->CheckMomentumConservation().Abs2()>1.e-6)
msg_Error()<<"Error in "<<METHOD<<": blob seem to be fishy.\n"
if (blob->CheckMomentumConservation().Abs2()>1.e-6) {
msg_Error()<<"Error in "<<METHOD<<": blob seem to be fishy: "
<<blob->CheckMomentumConservation()<<"\n"
<<(*blob)<<"\n";
exit(1);
}
return Return_Value::Success;
}
......
......@@ -80,8 +80,6 @@ bool Cluster_Splitter::ConstructSystem(Cluster * cluster) {
ConstructKinematics(exponents.first,exponents.second);
hit = SelectFlavour(m_popped.back()->m_sqq) && AcceptSystem(pt2max);
} while (!hit && calls++<=1000);
//msg_Out()<<METHOD<<" accepts with "
// <<m_popped.back()->m_kt2<<" < "<<m_pt2max<<".\n";
if (hit) {
m_sumx += m_popped.back()->m_x;
m_sumy += m_popped.back()->m_y;
......@@ -109,8 +107,8 @@ ConstructKinematics(const double & etax,const double & etay) {
do {
x = SelectY(xmin,xmax,etax,offsetx);
ymin = sqqmin/(x*m_LC.m_smandel);
ymax = Min(Max(x,ymin*4.),1.-mspect2hat-m_sumy);
//ymax = 1.-mspect2hat-m_sumy;
//was before: ymax = Min(Max(x,ymin*4.),1.-mspect2hat-m_sumy);
ymax = 1.-mspect2hat-m_sumy;
offsety = offsetx/x;
y = SelectY(ymin,ymax,etay,offsety);
sqq = x*y*m_LC.m_smandel;
......
......@@ -36,7 +36,7 @@ Proto_Particle(Flavour flav,Vec4D mom,char info) :
m_mass(hadpars->GetConstituents()->Mass(flav)), m_kt2max(0.),
p_partner(NULL)
{
if (!(flav.IsGluon() || flav.IsDiQuark())) {
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"
......
This diff is collapsed.
......@@ -28,44 +28,29 @@ namespace AHADIC {
bool m_ana;
std::map<std::string,ATOOLS::Histogram *> m_histograms;
bool TreatSingleCluster(Cluster *,bool=false);
bool CheckListForTreatment(Cluster_List *);
int CheckCluster(Cluster *,bool,bool=false);
int CheckCluster(Cluster *);
double TransformWeight(Cluster *,ATOOLS::Flavour &,
const bool & lighter=false,
double TransformWeight(Cluster * cluster,ATOOLS::Flavour & flav,
const bool & enforce=false);
double TransformKin(const double MC,const ATOOLS::Flavour & flav,
const bool & enforce=false);
const bool & enforce);
double DecayWeight(Cluster *,ATOOLS::Flavour &,ATOOLS::Flavour &,
const bool & enforce=false);
bool ClusterAnnihilation(Cluster * cluster,
ATOOLS::Flavour &,ATOOLS::Flavour &);
double DecayWeight(Cluster * cluster,
ATOOLS::Flavour & had1,ATOOLS::Flavour & had2);
bool Annihilation(Cluster * cluster,
ATOOLS::Flavour & had1,ATOOLS::Flavour & had2);
void FixHHDecay(Cluster * cluster,ATOOLS::Blob * blob,
const ATOOLS::Flavour had1,
const ATOOLS::Flavour had2,
const bool & constrained=false);
bool CheckIfAllowed(Cluster_List * clin,double & E);
bool UpdateTransitions(Cluster_List * clin);
bool EnforcedTransition(Cluster_List * clin);
bool ShiftMomenta(Cluster_List *);
bool TryLocalCompensation(Cluster_List *);
bool ForceMomenta(Cluster_List *);
bool UpdateClusterDecayKinematics(Cluster * cluster);
bool AttachHadronsToBlob(Cluster_List * clin,ATOOLS::Blob * blob);
ATOOLS::Vec4D SumMomentum(Cluster_List * clin);
public:
Soft_Cluster_Handler(bool ana=false);
~Soft_Cluster_Handler();
bool TreatClusterList(Cluster_List *,ATOOLS::Blob *);
bool TreatClusterDecay(Cluster_List *,ATOOLS::Blob *);
bool EnforcedDecay(Cluster * cluster,ATOOLS::Blob * blob,
const bool & constrained,
Cluster_List * clin=0,
const bool & attach=false);
};
/*!
......
......@@ -159,7 +159,7 @@ double Splitter_Base::SelectY(const double & ymin,const double & ymax,
y = logdist?
ylow * pow(yup/ylow,ran->Get()):
pow(pow(ylow,etap)+ran->Get()*(pow(yup,etap)-pow(ylow,etap)),1./etap);
} while (pow(1.-y,2.)<ran->Get());
} while (wt<ran->Get()); // was pow(1.-y,2) before
return y-offset;
}
......@@ -167,7 +167,7 @@ double Splitter_Base::SelectZ(const double & delta,const bool & lead) {
double zmin(0.5*(1.-sqrt(1.-delta))), zmax(0.5*(1.+sqrt(1.-delta))), z;
do {
z = zmin+ran->Get()*sqrt(1.-delta);
} while (4.*z*(1.-z) < ran->Get()); // 1.-2.*z*(1.-z)
} while (1.-2.*z*(1.-z) < ran->Get()); // was 4.*z*(1.-z) before
return z;
}
......
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