sherpa is hosted by Hepforge, IPPP Durham
close Warning: Can't synchronize with repository "(default)" (/hepforge/svn/sherpa does not appear to be a Subversion repository.). Look in the Trac log for more information.

Ticket #59: aliasdecays.patch

File aliasdecays.patch, 8.0 KB (added by Frank Siegert, 15 years ago)
  • HADRONS++/Main/Hadrons.C

     
    3535  msg_Tracking()<<"In Hadrons: ("<<path<<") "<<constfile<<std::endl;
    3636  p_decaymap = new Hadron_Decay_Map(path, file, constfile);
    3737  p_decaymap->ReadInConstants();
     38  p_decaymap->ReadHadronAliases(path, "HadronAliases.dat");
    3839  p_decaymap->SetHadronProperties();
    39   p_decaymap->Read();
     40  p_decaymap->Read(path, file);
     41  p_decaymap->Read(path, "AliasDecays.dat");
    4042  p_decaymap->Initialise();
    4143  p_decaymap->ReadFixedTables();
    4244  p_mixinghandler = new Mixing_Handler(p_decaymap);
  • HADRONS++/Main/Hadron_Decay_Map.H

     
    3939              std::string file,
    4040              std::string constfile );
    4141    ~Hadron_Decay_Map();
    42     void Read();
     42    void Read(const std::string& path, const std::string& file);
     43    void ReadHadronAliases(const std::string& path, const std::string& file);
    4344    void Initialise();
    4445    void ReadFixedTables();
    4546    void ReadInConstants();
  • HADRONS++/Main/Tools.H

     
    2424  typedef std::map<std::string,double> String_Map;
    2525
    2626  struct GeneralModel: public String_Map {
     27    std::map<kf_code, kf_code> m_aliases;
     28   
    2729  public:
    2830    inline double operator()(const std::string &tag,const double &def) const
    2931    {
  • HADRONS++/Main/Hadron_Decay_Channel.C

     
    2727  if(p_amplitudes) delete p_amplitudes; p_amplitudes=NULL;
    2828  if(p_momenta)    delete [] p_momenta; p_momenta=NULL;
    2929  if(p_flavours)   delete [] p_flavours; p_flavours=NULL;
     30  if(p_physicalflavours) delete [] p_physicalflavours; p_physicalflavours=NULL;
    3031  for(size_t i=0;i<m_mes.size();i++)      delete m_mes[i].second;
    3132  for(size_t i=0;i<m_currents.size();i++) {
    3233    delete m_currents[i].second.first;
     
    6566    msg_Error()<<"  Total outgoing mass heavier than incoming particle. Will abort."<<endl;
    6667    abort();
    6768  }
    68   p_amplitudes = new Spin_Amplitudes(Flavours(),GetN(),Complex(0.0,0.0));
     69  p_physicalflavours=new Flavour[GetN()];
     70  for (int i=0; i<GetN(); ++i) {
     71    map<kf_code,kf_code>::const_iterator it =
     72        startmd.m_aliases.find(p_flavours[i].Kfcode());
     73    if (it!=startmd.m_aliases.end())
     74      p_physicalflavours[i] = Flavour(it->second, p_flavours[i].IsAnti());
     75    else
     76      p_physicalflavours[i] = p_flavours[i];
     77  }
     78  p_amplitudes = new Spin_Amplitudes(p_physicalflavours,GetN(),Complex(0.0,0.0));
    6979  p_ps = new HD_PS_Base(this);
    7080  // check for identical particles
    7181  Flavour refflav;
    7282  double symfactor (1);         
    7383  int l(0), lfac (1);             
    7484  for( int i=0; i<NOut(); ++i ) {
    75     refflav = p_flavours[i+1];
     85    refflav = p_physicalflavours[i+1];
    7686    l = 0;
    7787    lfac = 1;
    7888    for( int j=0; j<NOut(); ++j ) {
    79       if( p_flavours[j+1]==refflav ) {
     89      if( p_physicalflavours[j+1]==refflav ) {
    8090        l++;
    8191        lfac *= l;
    8292      }
     
    147157    for(int i=0;i<NOut()+1;i++) {
    148158      decayindices[i]=i;
    149159    }
    150     m_mes.push_back(MEPair(1.0,new Generic(p_flavours,NOut()+1,
     160    m_mes.push_back(MEPair(1.0,new Generic(p_physicalflavours,NOut()+1,
    151161                                           decayindices,"Generic")));
    152162    delete [] decayindices;
    153163    p_ps->AddChannel( string("Isotropic"), 1., m_startmd );
     
    266276    for(int i=0;i<NOut()+1;i++) {
    267277      decayindices[i]=i;
    268278    }
    269     m_mes.push_back(MEPair(1.0,new Generic(p_flavours,NOut()+1,
     279    m_mes.push_back(MEPair(1.0,new Generic(p_physicalflavours,NOut()+1,
    270280                                           decayindices,"Generic")));
    271281    delete [] decayindices;
    272282  }
     
    498508// differential with random PS points; just for weight
    499509double Hadron_Decay_Channel::Differential()
    500510{
    501   p_momenta[0] = Vec4D(p_flavours[0].HadMass(),0.,0.,0.);        // decay from rest
     511  p_momenta[0] = Vec4D(p_physicalflavours[0].HadMass(),0.,0.,0.);        // decay from rest
    502512  p_ps->GeneratePoint(p_momenta,(PHASIC::Cut_Data*)(NULL));     // generate a PS point
    503513  p_ps->GenerateWeight(p_momenta,(PHASIC::Cut_Data*)(NULL));    // calculate its weight factor
    504514  double weight = p_ps->Weight();                               // get weight factor
     
    539549  fi.n=resultstrings.size()-1;
    540550  int* indices = new int[fi.n]; // will get deleted by Current_Base
    541551  for(int i=0; i<fi.n; i++) indices[i] = ToType<int>(resultstrings[i+1]);
    542   fi.flavs=p_flavours; fi.indices=indices;
     552  fi.flavs=p_physicalflavours; fi.indices=indices;
    543553
    544554  Current_Base* current = Current_Getter_Function::GetObject(resultstrings[0],fi);
    545555  if(current==NULL) {
     
    573583  fi.n=NOut()+1;
    574584  int* indices = new int[fi.n]; // will get deleted by HD_ME_Base
    575585  for(int i=0; i<fi.n; i++) indices[i] = ToType<int>(resultstrings[i+1]);
    576   fi.flavs=p_flavours; fi.indices=indices;
     586  fi.flavs=p_physicalflavours; fi.indices=indices;
    577587
    578588  HD_ME_Base* me = HD_ME_Getter_Function::GetObject(resultstrings[0],fi);
    579589  if(me==NULL) {
  • HADRONS++/Main/Hadron_Decay_Channel.H

     
    2727  class Hadron_Decay_Channel : public ATOOLS::Decay_Channel {
    2828  private:
    2929    ATOOLS::Flavour       * p_flavours;
     30    ATOOLS::Flavour       * p_physicalflavours;
    3031    ATOOLS::Vec4D         * p_momenta;
    3132    std::vector<MEPair>     m_mes;    // MEs with their relative factors
    3233    std::vector<CurrentsPair> m_currents;
  • HADRONS++/Main/Hadron_Decay_Map.C

     
    7272  }
    7373}
    7474
    75 void Hadron_Decay_Map::Read()
     75void Hadron_Decay_Map::ReadHadronAliases(const string& path, const string& file)
    7676{
     77  Data_Reader reader = Data_Reader("->", ";", "#", "");
     78  reader.AddWordSeparator("\t");
     79  reader.SetAddCommandLine(false);
     80  reader.AddComment("#");
     81  reader.AddComment("//");
     82  reader.SetInputPath(path);
     83  reader.SetInputFile(file);
     84 
     85  vector<vector<string> > aliases;
     86  reader.MatrixFromFile(aliases);
     87 
     88  for (size_t i=0;i<aliases.size();++i) {
     89    if (aliases[i].size()!=2) {
     90      msg_Error()<<METHOD<<": Wrong syntax in hadron alias file."<<endl
     91          <<"  "<<aliases[i]<<endl;
     92    }
     93    kf_code alias = ToType<kf_code>(aliases[i][0]);
     94    kf_code real = ToType<kf_code>(aliases[i][1]);
     95    m_startmd.m_aliases[alias]=real;
     96    Particle_Info* aliasinfo = new Particle_Info(*s_kftable[real]);
     97    aliasinfo->m_kfc=alias;
     98    s_kftable[alias]=aliasinfo;
     99    msg_Info()<<METHOD<<" created alias "<<alias<<" for "<<Flavour(alias)<<endl;
     100  }
     101}
     102
     103void Hadron_Decay_Map::Read(const string& path, const string& file)
     104{
    77105  Data_Reader reader = Data_Reader(" ",";","!","->");
    78106  reader.AddWordSeparator("\t");
    79107  reader.SetAddCommandLine(false);
    80108  reader.AddComment("#");
    81109  reader.AddComment("//");
    82   reader.SetInputPath(m_decaypath);
    83   reader.SetInputFile(m_decayfile);
     110  reader.SetInputPath(path);
     111  reader.SetInputFile(file);
    84112 
    85113  vector<vector<string> > Decayers;
    86   if(!reader.MatrixFromFile(Decayers)) {
    87     msg_Error()<<METHOD<<" Warning:\n"
    88       <<"   No decayers found in "<<m_decaypath<<m_decayfile<<"."<<endl;
    89   }
    90   else {
    91     msg_Info()<<METHOD<<":"<<endl
    92               <<"   Initializing hadron decay tables. This may take some time."
     114  if(reader.MatrixFromFile(Decayers)) {
     115    msg_Info()<<METHOD<<":"
     116              <<"   Initializing from "<<file<<", this may take some time."
    93117              <<endl;
    94118  }
    95119