17 #include "TObjArray.h"
18 #include "TObjString.h"
30 using namespace genie;
54 , fIsConfigured(false)
86 LOG(
"TuneId",
pWARN) <<
"No valid subdirectory associated with " <<
Name() ;
125 LOG(
"TuneId",
pDEBUG)<<
"Building tune "<<name;
126 if ( name.size() > 0 )
fName = name ;
135 LOG(
"TuneId",
pFATAL) <<
"No valid tune directory associated with " <<
Name() ;
142 static TPRegexp pattern(
"^([A-Za-z]+)(\\d{2})_(\\d{2})([a-z])_([a-z0-9]{2})_([a-z0-9]{3})$");
145 TString tstr(id_str.c_str());
146 TObjArray * matches = pattern.MatchS(tstr);
147 if ( matches -> GetEntries() != 7) {
148 LOG(
"TuneId",
pFATAL) <<
"Bad tune pattern "<<id_str<<
" - form is eg G18_01a_00_000";
155 this ->
fPrefix = ((TObjString*)matches->At(1))->String().Data();
156 this ->
fYear = ((TObjString*)matches->At(2))->String().Data();
157 this ->
fMajorModelId = ((TObjString*)matches->At(3))->String().Data();
158 this ->
fMinorModelId = ((TObjString*)matches->At(4))->String().Data();
160 this ->
fFitDataSetId = ((TObjString*)matches->At(6))->String().Data();
167 this->
fName =
id.Name();
169 this->
fYear =
id.Year();
186 std::string status =
"Standard";
187 if (
IsCustom() ) status =
"Custom";
190 stream << status <<
" GENIE tune: " <<
this ->
Name() << std::endl;
191 stream <<
" - Prefix ............... : " << this->
Prefix() << std::endl;
192 stream <<
" - Year ................. : " << this->
Year() << std::endl;
193 stream <<
" - Major model ID ....... : " << this->
MajorModelId() << std::endl;
194 stream <<
" - Minor model ID ....... : " << this->
MinorModelId() << std::endl;
195 stream <<
" - Tuned param set ID ... : " << this->
TunedParamSetId() << std::endl;
196 stream <<
" - Fit dataset ID ....... : " << this->
FitDataSetId() << std::endl;
197 stream <<
" - Tune directory ....... : " << this->
TuneDirectory() << std::endl;
198 stream <<
" - Base directory ....... : " << this->
fBaseDirectory << std::endl;
200 stream <<
" - Custom directory ..... : " <<
this ->
fCustomSource << std::endl;
202 stream << std::flush;
210 string top_path = gSystem->ExpandPathName( paths[0].c_str() ) ;
213 if ( top_path != def_path ) {
218 LOG(
"TuneId",
pDEBUG) <<
"Base dir validation " ;
220 for (
size_t i=0; i< paths.size(); ++i ) {
221 const char* tmppath = paths[i].c_str();
222 std::string onepath = gSystem->ExpandPathName(tmppath);
223 string test = onepath +
"/" +
CMC() ;
224 LOG(
"TuneId",
pDEBUG) <<
" Testing " << test <<
" directory" ;
232 LOG(
"TuneId",
pWARN) <<
" No " <<
CMC() <<
" subdirectory found in pathlist";
238 LOG(
"TuneId",
pWARN) <<
"No " <<
Name() <<
" subdirectory found in " <<
CMC() ;
string GetXMLPathList(bool add_tune=true)
void Copy(const TuneId &id)
void Decode(string id_str)
bool operator!=(const TuneId &id1, const TuneId &id2)
string MajorModelId(void) const
string CMCDirectory(void) const
string FitDataSetId(void) const
bool IsCustom(void) const
bool OnlyConfiguration() const
bool IsValidated(void) const
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
string TuneDirectory(void) const
string MinorModelId(void) const
bool operator==(const TuneId &id1, const TuneId &id2)
string ModelId(void) const
bool IsConfigured(void) const
string TrimSpaces(string input)
vector< string > Split(string input, string delim)
bool DirectoryExists(const char *path)
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
string Prefix(void) const
string TunedParamSetId(void) const
string GetXMLDefaultPath()
void Build(const string &name="")
void Print(ostream &stream) const
bool Compare(const TuneId &id) const