Ticket #59: aliasdecays.patch
File aliasdecays.patch, 8.0 KB (added by , 15 years ago) |
---|
-
HADRONS++/Main/Hadrons.C
35 35 msg_Tracking()<<"In Hadrons: ("<<path<<") "<<constfile<<std::endl; 36 36 p_decaymap = new Hadron_Decay_Map(path, file, constfile); 37 37 p_decaymap->ReadInConstants(); 38 p_decaymap->ReadHadronAliases(path, "HadronAliases.dat"); 38 39 p_decaymap->SetHadronProperties(); 39 p_decaymap->Read(); 40 p_decaymap->Read(path, file); 41 p_decaymap->Read(path, "AliasDecays.dat"); 40 42 p_decaymap->Initialise(); 41 43 p_decaymap->ReadFixedTables(); 42 44 p_mixinghandler = new Mixing_Handler(p_decaymap); -
HADRONS++/Main/Hadron_Decay_Map.H
39 39 std::string file, 40 40 std::string constfile ); 41 41 ~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); 43 44 void Initialise(); 44 45 void ReadFixedTables(); 45 46 void ReadInConstants(); -
HADRONS++/Main/Tools.H
24 24 typedef std::map<std::string,double> String_Map; 25 25 26 26 struct GeneralModel: public String_Map { 27 std::map<kf_code, kf_code> m_aliases; 28 27 29 public: 28 30 inline double operator()(const std::string &tag,const double &def) const 29 31 { -
HADRONS++/Main/Hadron_Decay_Channel.C
27 27 if(p_amplitudes) delete p_amplitudes; p_amplitudes=NULL; 28 28 if(p_momenta) delete [] p_momenta; p_momenta=NULL; 29 29 if(p_flavours) delete [] p_flavours; p_flavours=NULL; 30 if(p_physicalflavours) delete [] p_physicalflavours; p_physicalflavours=NULL; 30 31 for(size_t i=0;i<m_mes.size();i++) delete m_mes[i].second; 31 32 for(size_t i=0;i<m_currents.size();i++) { 32 33 delete m_currents[i].second.first; … … 65 66 msg_Error()<<" Total outgoing mass heavier than incoming particle. Will abort."<<endl; 66 67 abort(); 67 68 } 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)); 69 79 p_ps = new HD_PS_Base(this); 70 80 // check for identical particles 71 81 Flavour refflav; 72 82 double symfactor (1); 73 83 int l(0), lfac (1); 74 84 for( int i=0; i<NOut(); ++i ) { 75 refflav = p_ flavours[i+1];85 refflav = p_physicalflavours[i+1]; 76 86 l = 0; 77 87 lfac = 1; 78 88 for( int j=0; j<NOut(); ++j ) { 79 if( p_ flavours[j+1]==refflav ) {89 if( p_physicalflavours[j+1]==refflav ) { 80 90 l++; 81 91 lfac *= l; 82 92 } … … 147 157 for(int i=0;i<NOut()+1;i++) { 148 158 decayindices[i]=i; 149 159 } 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, 151 161 decayindices,"Generic"))); 152 162 delete [] decayindices; 153 163 p_ps->AddChannel( string("Isotropic"), 1., m_startmd ); … … 266 276 for(int i=0;i<NOut()+1;i++) { 267 277 decayindices[i]=i; 268 278 } 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, 270 280 decayindices,"Generic"))); 271 281 delete [] decayindices; 272 282 } … … 498 508 // differential with random PS points; just for weight 499 509 double Hadron_Decay_Channel::Differential() 500 510 { 501 p_momenta[0] = Vec4D(p_ flavours[0].HadMass(),0.,0.,0.); // decay from rest511 p_momenta[0] = Vec4D(p_physicalflavours[0].HadMass(),0.,0.,0.); // decay from rest 502 512 p_ps->GeneratePoint(p_momenta,(PHASIC::Cut_Data*)(NULL)); // generate a PS point 503 513 p_ps->GenerateWeight(p_momenta,(PHASIC::Cut_Data*)(NULL)); // calculate its weight factor 504 514 double weight = p_ps->Weight(); // get weight factor … … 539 549 fi.n=resultstrings.size()-1; 540 550 int* indices = new int[fi.n]; // will get deleted by Current_Base 541 551 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; 543 553 544 554 Current_Base* current = Current_Getter_Function::GetObject(resultstrings[0],fi); 545 555 if(current==NULL) { … … 573 583 fi.n=NOut()+1; 574 584 int* indices = new int[fi.n]; // will get deleted by HD_ME_Base 575 585 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; 577 587 578 588 HD_ME_Base* me = HD_ME_Getter_Function::GetObject(resultstrings[0],fi); 579 589 if(me==NULL) { -
HADRONS++/Main/Hadron_Decay_Channel.H
27 27 class Hadron_Decay_Channel : public ATOOLS::Decay_Channel { 28 28 private: 29 29 ATOOLS::Flavour * p_flavours; 30 ATOOLS::Flavour * p_physicalflavours; 30 31 ATOOLS::Vec4D * p_momenta; 31 32 std::vector<MEPair> m_mes; // MEs with their relative factors 32 33 std::vector<CurrentsPair> m_currents; -
HADRONS++/Main/Hadron_Decay_Map.C
72 72 } 73 73 } 74 74 75 void Hadron_Decay_Map::Read ()75 void Hadron_Decay_Map::ReadHadronAliases(const string& path, const string& file) 76 76 { 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 103 void Hadron_Decay_Map::Read(const string& path, const string& file) 104 { 77 105 Data_Reader reader = Data_Reader(" ",";","!","->"); 78 106 reader.AddWordSeparator("\t"); 79 107 reader.SetAddCommandLine(false); 80 108 reader.AddComment("#"); 81 109 reader.AddComment("//"); 82 reader.SetInputPath( m_decaypath);83 reader.SetInputFile( m_decayfile);110 reader.SetInputPath(path); 111 reader.SetInputFile(file); 84 112 85 113 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." 93 117 <<endl; 94 118 } 95 119