TuneId.h
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*!
3 
4 \class genie::TuneId
5 
6 \brief GENIE tune ID
7 
8 \author Marco Roda <Marco.Roda \at liverpool.ac.uk>
9  University of Liverpool
10 
11  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
12  University of Liverpool & STFC Rutherford Appleton Laboratory
13 
14 \created April 19, 2018
15 
16 \cpright Copyright (c) 2003-2020, The GENIE Collaboration
17  For the full text of the license visit http://copyright.genie-mc.org
18 */
19 //____________________________________________________________________________
20 
21 #ifndef _TUNE_ID_H_
22 #define _TUNE_ID_H_
23 
24 #include <string>
25 #include <iostream>
26 
27 using std::string;
28 using std::ostream;
29 
30 namespace genie {
31 
32 class TuneId;
33 ostream & operator << (ostream & stream, const TuneId & id);
34 bool operator == (const TuneId & id1, const TuneId & id2);
35 bool operator != (const TuneId & id1, const TuneId & id2);
36 
37 class TuneId {
38 
39 public:
40 
41  TuneId(const string & id_str, bool failOnInvalid=true);
42  TuneId(const TuneId & id);
43  ~TuneId() {;}
44 
45  // The typical tune name in neutrino mode is : Gdd_MMv_PP_xxx
46  string Name (void) const { return fName; } // Gdd_MMv_PP_xxx
47  string Prefix (void) const { return fPrefix; } // G
48  string Year (void) const { return fYear; } // dd
49  string ModelId (void) const { return fMajorModelId + fMinorModelId; } // MMv
50  string MajorModelId (void) const { return fMajorModelId; } // MM
51  string MinorModelId (void) const { return fMinorModelId; } // v
52  string TunedParamSetId (void) const { return fTunedParamSetId; } // PP
53  string FitDataSetId (void) const { return fFitDataSetId; } // xxx
54 
55  bool IsConfigured (void) const { return fIsConfigured; }
56  // this is true if the name of the tune (correctly) has been decoded into its parts
57  // must match pattern: "([A-Za-z]+)(\\d{2})_(\\d{2})([a-z])_([a-z0-9]{2})_([a-z0-9]{3})"
58 
59  bool IsValidated (void) const { return fIsValidated; }
60  // this is true if the existence of the tune directory in the system has been checked
61 
62  bool IsCustom (void) const { return fCustomSource.size() > 0 ; }
63  // this check if the configuration had a GXMLPATH configuration that took priority
64  // over the standard $GXMLPATH
65  // This boolean is reliable only if IsValidated() is true
66 
67  // A tune can be a simple configuration of models or the ouput of a complete tuning procedure
68  // This changes the position the tune files are stored so we need a quick way to know this
69  bool OnlyConfiguration() const { return (TunedParamSetId() == "00") ; }
70 
71  // Methods related to config directory
72  string CMC (void) const ; // Comprehensive Model Confguration
73  string Tail (void) const ;
74  string CMCDirectory (void) const ;
75  string TuneDirectory (void) const ;
76  string BaseDirectory (void) const { return fBaseDirectory; }
77  string CustomSource (void) const { return fCustomSource; }
78 
79  void Build (const string & name = "" ) ;
80  void Decode (string id_str);
81  void Copy (const TuneId & id);
82  bool Compare (const TuneId & id) const;
83  void Print (ostream & stream) const;
84 
85  friend ostream & operator << (ostream & stream, const TuneId & id);
86 
87 private:
88 
89  TuneId() {;}
90 
91  bool CheckDirectory() ;
92 
93  string fName;
94 
95  string fPrefix;
96  string fYear;
97  string fModelId;
98  string fMajorModelId;
99  string fMinorModelId;
102 
103  string fBaseDirectory ;
104  string fCustomSource ;
105 
108 };
109 
110 } // genie namespace
111 
112 #endif // _TUNE_ID_H_
static QCString name
Definition: declinfo.cpp:673
string fMajorModelId
Definition: TuneId.h:98
string fYear
Definition: TuneId.h:96
string Name(void) const
Definition: TuneId.h:46
void Copy(const TuneId &id)
Definition: TuneId.cxx:165
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
bool fIsConfigured
Definition: TuneId.h:106
void Decode(string id_str)
Definition: TuneId.cxx:140
bool operator!=(const TuneId &id1, const TuneId &id2)
Definition: TuneId.cxx:46
string MajorModelId(void) const
Definition: TuneId.h:50
string CMCDirectory(void) const
Definition: TuneId.cxx:107
std::string string
Definition: nybbler.cc:12
string Year(void) const
Definition: TuneId.h:48
string FitDataSetId(void) const
Definition: TuneId.h:53
bool IsCustom(void) const
Definition: TuneId.h:62
bool OnlyConfiguration() const
Definition: TuneId.h:69
bool IsValidated(void) const
Definition: TuneId.h:59
string fTunedParamSetId
Definition: TuneId.h:100
string fBaseDirectory
Definition: TuneId.h:103
string fCustomSource
Definition: TuneId.h:104
bool fIsValidated
Definition: TuneId.h:107
string TuneDirectory(void) const
Definition: TuneId.cxx:116
string CustomSource(void) const
Definition: TuneId.h:77
string fMinorModelId
Definition: TuneId.h:99
friend ostream & operator<<(ostream &stream, const TuneId &id)
Definition: TuneId.cxx:35
string fModelId
Definition: TuneId.h:97
string MinorModelId(void) const
Definition: TuneId.h:51
bool operator==(const TuneId &id1, const TuneId &id2)
Definition: TuneId.cxx:41
string fPrefix
Definition: TuneId.h:95
string ModelId(void) const
Definition: TuneId.h:49
bool IsConfigured(void) const
Definition: TuneId.h:55
string Tail(void) const
Definition: TuneId.cxx:100
string fName
Definition: TuneId.h:93
bool CheckDirectory()
Definition: TuneId.cxx:205
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
string Prefix(void) const
Definition: TuneId.h:47
string TunedParamSetId(void) const
Definition: TuneId.h:52
GENIE tune ID.
Definition: TuneId.h:37
string CMC(void) const
Definition: TuneId.cxx:90
string fFitDataSetId
Definition: TuneId.h:101
void Build(const string &name="")
Definition: TuneId.cxx:124
void Print(ostream &stream) const
Definition: TuneId.cxx:184
bool Compare(const TuneId &id) const
Definition: TuneId.cxx:179
string BaseDirectory(void) const
Definition: TuneId.h:76