InteractionType.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::InteractionType
5 
6 \brief Enumeration of interaction types: e/m, weak cc, weak nc
7 
8 \author Costas Andreopoulos <costas.andreopoulos \at stfc.ac.uk>
9  University of Liverpool & STFC Rutherford Appleton Lab
10 
11  Changes required to implement the GENIE Boosted Dark Matter module
12  were installed by Josh Berger (Univ. of Wisconsin)
13 
14 \created May 06, 2004
15 
16 \cpright Copyright (c) 2003-2019, The GENIE Collaboration
17  For the full text of the license visit http://copyright.genie-mc.org
18  or see $GENIE/LICENSE
19 */
20 //____________________________________________________________________________
21 
22 #ifndef _INTERACTION_TYPE_H_
23 #define _INTERACTION_TYPE_H_
24 
25 #include <cassert>
26 #include <string>
27 #include <cstring>
28 
29 using std::string;
30 
31 namespace genie {
32 
33 
34 typedef enum EInteractionType {
35 
36  kIntNull = 0,
37  kIntEM, //
40  kIntWeakMix, // CC + NC + interference
44 
46 
47 
49 {
50 public:
51 
52  //__________________________________________________________________________
53  static string AsString(InteractionType_t type)
54  {
55  switch (type) {
56 
57  case(kIntEM) : return "EM"; break;
58  case(kIntWeakCC) : return "Weak[CC]"; break;
59  case(kIntWeakNC) : return "Weak[NC]"; break;
60  case(kIntWeakMix) : return "Weak[CC+NC+interference]"; break;
61  case(kIntDarkMatter) : return "DarkMatter"; break;
62  case(kIntNDecay) : return "NucleonDecay"; break;
63  case(kIntNOsc) : return "NeutronOsc"; break;
64  default : return "Unknown"; break;
65  }
66  return "Unknown";
67  }
68  //__________________________________________________________________________
69  static InteractionType_t FromString(string type)
70  {
71  //-- Make uppercase/lowercase irrelevant
72 
73  for(unsigned int i=0; i<type.size(); i++) type[i] = toupper(type[i]);
74 
75  //-- Figure out the ScatteringType_t from the input string
76 
77  const char * t = type.c_str();
78 
79  if ( strcmp(t,"EM") == 0 ||
80  strcmp(t,"E-M") == 0 ||
81  strcmp(t,"E/M") == 0 ||
82  strcmp(t,"ELECTROMAGNETIC") == 0 ||
83  strcmp(t,"ELECTRO-MAGNETIC") == 0 ) return kIntEM;
84 
85  else if ( strcmp(t,"WEAK-CC") == 0 ||
86  strcmp(t,"CHARGED-CURRENT") == 0 ||
87  strcmp(t,"CHARGED CURRENT") == 0 ||
88  strcmp(t,"WEAK-CHARGED-CURRENT") == 0 ||
89  strcmp(t,"WEAK CHARGED CURRENT") == 0 ||
90  strcmp(t,"CC") == 0 ) return kIntWeakCC;
91 
92  else if ( strcmp(t,"WEAK-NC") == 0 ||
93  strcmp(t,"NEUTRAL-CURRENT") == 0 ||
94  strcmp(t,"NEUTRAL CURRENT") == 0 ||
95  strcmp(t,"WEAK-NEUTRAL-CURRENT") == 0 ||
96  strcmp(t,"WEAK NEUTRAL CURRENT") == 0 ||
97  strcmp(t,"NC") == 0 ) return kIntWeakNC;
98 
99  else if ( strcmp(t,"NDECAY") == 0 ) return kIntNDecay;
100 
101  else if ( strcmp(t,"NOSC") == 0 ) return kIntNOsc;
102 
103  else return kIntNull;
104  }
105  //__________________________________________________________________________
106 };
107 
108 } // genie namespace
109 
110 #endif // _INTERACTION_TYPE_H_
THE MAIN GENIE PROJECT NAMESPACE
Definition: GeneratorBase.h:8
static InteractionType_t FromString(string type)
static string AsString(InteractionType_t type)
Enumeration of interaction types: e/m, weak cc, weak nc.
enum genie::EInteractionType InteractionType_t
enum BeamMode string