21 #include "Framework/Messenger/Messenger.h"
22 #define LOG_BEGIN(a,b) LOG(a,b)
35 for (jin=0; jin<7; ++jin) {
36 for (jout=0; jout<7; ++jout ) {
37 fProb[jin][jout] = ( (jin==jout) ? 1. : 0. );
49 <<
"GFlavorMap::Config \"" << config <<
"\"" <<
LOG_END;
51 if ( config.find(
"swap") == 0 ||
52 config.find(
"map") == 0 ||
53 config.find(
"genie::flux::GFlavorMap") == 0 ) {
55 }
else if ( config.find(
"fixedfrac") == 0 ) {
59 <<
"GFlavorMap::Config don't know how to parse \""
62 <<
" ... will attempt \"map\" strategy" <<
LOG_END;
72 <<
"GFlavorMap::ParseMapString \"" << config <<
"\"" <<
LOG_END;
74 for (
unsigned int jtok = 0; jtok < tokens.size(); ++jtok ) {
75 string tok1 = tokens[jtok];
76 if ( tok1 ==
"" )
continue;
77 if ( tok1 ==
"swap" || tok1 ==
"map" )
continue;
78 if ( tok1 ==
"genie::flux::GFlavorMap" )
continue;
81 if ( pair.size() != 2 ) {
83 <<
"could not parse " << tok1 <<
" split size=" << pair.size()
87 int pdg_in = strtol(pair[0].c_str(),NULL,0);
89 int pdg_out = strtol(pair[1].c_str(),NULL,0);
91 for (
int jout = 0; jout < 7; ++jout ) {
92 fProb[indx_in][jout] = ( ( jout == indx_out ) ? 1 : 0 );
102 <<
"GFlavorMap::ParseFixedFracString \"" << config <<
"\"" <<
LOG_END;
104 for (
unsigned int jtok = 0; jtok< tokens.size(); ++jtok ) {
106 if ( tok1 ==
"" )
continue;
107 if ( tok1 ==
"fixedfrac" )
continue;
110 if ( pair.size() != 2 ) {
112 <<
"could not parse \"" << tok1 <<
"\" split size=" << pair.size()
116 int pdg_in = strtol(pair[0].c_str(),NULL,0);
119 if ( fracs.size() != 7 ) {
121 <<
"could not parse frac list \"" << pair[1] <<
"\" split size=" << fracs.size()
127 for (
int indx_out = 0; indx_out < 7; ++indx_out ) {
128 double p = strtod(fracs[indx_out].c_str(),NULL);
130 fProb[indx_in][indx_out] = p;
134 for (
int indx_out = 0; indx_out < 7; ++indx_out )
135 fProb[indx_in][indx_out] /= psum;
147 <<
"Probability " << pdg_initial <<
"=>" << pdg_final
158 <<
"GFlavorMap::PrintConfig():" <<
LOG_END;
161 std::cout <<
" in \\ out ";
162 for (jout=0; jout<7; ++jout )
163 std::cout <<
" " << std::setw(3) <<
Indx2PDG(jout) <<
" ";
164 std::cout << std::endl;
166 std::cout <<
"----------------+";
167 for (jout=0; jout<7; ++jout ) std::cout <<
"----------";
168 std::cout << std::endl;
170 for (jin=0; jin<7; ++jin) {
171 std::cout << std::setw(10) <<
IndxName(jin)
172 <<
"[" << std::setw(3) <<
Indx2PDG(jin) <<
"] | ";
173 for (jout=0; jout<7; ++jout )
174 std::cout << std::setw(8) <<
fProb[jin][jout] <<
" ";
175 std::cout << std::endl;
182 static const char* name[] = {
"sterile",
183 "nu_e",
"nu_mu",
"nu_tau",
184 "nu_e_bar",
"nu_mu_bar",
"nu_tau_bar" };
double Probability(int pdg_initial, int pdg_final, double energy, double dist)
GENIE interface for flavor modification.
#define FLAVORMIXREG4(_nsa, _nsb, _name, _fqname)
const char * IndxName(int indx)
void ParseMapString(std::string config)
void Config(std::string config)
string TrimSpaces(string input)
void ParseFixedfracString(std::string config)
vector< string > Split(string input, string delim)
void PrintConfig(bool verbose=true)
provide a means of printing the configuration