GFluxExposureI.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3  Copyright (c) 2003-2020, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Robert Hatcher <rhatcher@fnal.gov>
7  Fermi National Accelerator Laboratory
8 */
9 //____________________________________________________________________________
10 
12 
13 #include "TMath.h"
14 #include <cstring>
15 
16 namespace genie {
17 namespace flux {
18 
20  {
21  switch (etype) {
22  case kUnknown: return "UnknownExposureUnits"; break;
23  case kPOTs: return "POT"; break;
24  case kSeconds: return "Seconds"; break;
25  default: return "?UnknownExposureUnits?"; break;
26  }
27  }
28 
30  GFluxExposureI::StringToEnum(const char* chars, int maxChar)
31  {
32  int len = strlen(chars);
33  if (maxChar == 0 ) maxChar = len;
34  if (maxChar > len) maxChar = len;
35  if (maxChar <= 0 ) return genie::flux::kUnknown;
36 
37  char* lowchars = new char [maxChar];
38  for (int i=0; i<maxChar; ++i) lowchars[i] = tolower(chars[i]);
39 
41  if ( 0 == strncmp(lowchars,"pot",TMath::Min(maxChar,3))) {
42  etype = genie::flux::kPOTs;
43  } else if ( 0 == strncmp(lowchars,"sec",TMath::Min(maxChar,3))) {
44  etype = genie::flux::kSeconds;
45  }
46  delete [] lowchars;
47  return etype;
48  }
49 
51  { fEType = etype; }
52 
54 
56  { return fEType; }
57 
60 
61 } // namespace flux
62 } // namespace genie
const char * GetExposureUnits() const
what units are returned by GetTotalExposure?
static const char * AsString(genie::flux::Exposure_t etype)
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
genie::flux::Exposure_t GetExposureType() const
static genie::flux::Exposure_t StringToEnum(const char *chars, int maxChar=0)
enum genie::flux::EExposure Exposure_t
genie::flux::Exposure_t fEType
GFluxExposureI(genie::flux::Exposure_t etype)