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 \created May 06, 2004
12 
13 \cpright Copyright (c) 2003-2017, GENIE Neutrino MC Generator Collaboration
14  For the full text of the license visit http://copyright.genie-mc.org
15  or see $GENIE/LICENSE
16 */
17 //____________________________________________________________________________
18 
19 #ifndef _INTERACTION_TYPE_H_
20 #define _INTERACTION_TYPE_H_
21 
22 #include <cassert>
23 #include <string>
24 #include <cstring>
25 
26 using std::string;
27 
28 namespace genie {
29 
30 
31 typedef enum EInteractionType {
32 
33  kIntNull = 0,
37  kIntWeakMix, /* cc+nc+interference */
40 
42 
43 
45 {
46 public:
47 
48  //__________________________________________________________________________
49  static string AsString(InteractionType_t type)
50  {
51  switch (type) {
52 
53  case(kIntEM) : return "EM"; break;
54  case(kIntWeakCC) : return "Weak[CC]"; break;
55  case(kIntWeakNC) : return "Weak[NC]"; break;
56  case(kIntWeakMix) : return "Weak[CC+NC+interference]"; break;
57  case(kIntNDecay) : return "NucleonDecay"; break;
58  case(kIntNOsc) : return "NeutronOsc"; break;
59  default : return "Unknown"; break;
60  }
61  return "Unknown";
62  }
63  //__________________________________________________________________________
64  static InteractionType_t FromString(string type)
65  {
66  //-- Make uppercase/lowercase irrelevant
67 
68  for(unsigned int i=0; i<type.size(); i++) type[i] = toupper(type[i]);
69 
70  //-- Figure out the ScatteringType_t from the input string
71 
72  const char * t = type.c_str();
73 
74  if ( strcmp(t,"EM") == 0 ||
75  strcmp(t,"E-M") == 0 ||
76  strcmp(t,"E/M") == 0 ||
77  strcmp(t,"ELECTROMAGNETIC") == 0 ||
78  strcmp(t,"ELECTRO-MAGNETIC") == 0 ) return kIntEM;
79 
80  else if ( strcmp(t,"WEAK-CC") == 0 ||
81  strcmp(t,"CHARGED-CURRENT") == 0 ||
82  strcmp(t,"CHARGED CURRENT") == 0 ||
83  strcmp(t,"WEAK-CHARGED-CURRENT") == 0 ||
84  strcmp(t,"WEAK CHARGED CURRENT") == 0 ||
85  strcmp(t,"CC") == 0 ) return kIntWeakCC;
86 
87  else if ( strcmp(t,"WEAK-NC") == 0 ||
88  strcmp(t,"NEUTRAL-CURRENT") == 0 ||
89  strcmp(t,"NEUTRAL CURRENT") == 0 ||
90  strcmp(t,"WEAK-NEUTRAL-CURRENT") == 0 ||
91  strcmp(t,"WEAK NEUTRAL CURRENT") == 0 ||
92  strcmp(t,"NC") == 0 ) return kIntWeakNC;
93 
94  else if ( strcmp(t,"NDECAY") == 0 ) return kIntNDecay;
95 
96  else if ( strcmp(t,"NOSC") == 0 ) return kIntNOsc;
97 
98  else return kIntNull;
99  }
100  //__________________________________________________________________________
101 };
102 
103 } // genie namespace
104 
105 #endif // _INTERACTION_TYPE_H_
#include "Numerical/GSFunc.h"
Definition: AlgCmp.h:26
std::string string
Definition: nybbler.cc:12
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