#include <NueGenConfig.h>
Public Types | |
| typedef enum NueGenConfig::GenMethod | GCTypes_t |
| enum | GenMethod { kFileList = 1, kSetList = 2 } |
Public Member Functions | |
| NueGenConfig () | |
| NueGenConfig (std::string input) | |
| void | ReadInput (std::string input) |
| bool | CheckConfig () |
| void | Reset () |
| bool | LoadNextNumberSet (double *num) |
| double * | GetErrors () |
| double * | GetOscPar () |
| int | GetDataMethod () |
| void | SetDataRange (int nuClass, std::string line, GCCompleteSet &set) |
| void | AddInputFile (std::string file) |
| void | SetOffset (int in) |
| void | SetReadNumber (int in) |
Private Member Functions | |
| void | SetErrorVal (int pos, std::string line) |
Private Attributes | |
| int | fOffSet |
| int | fReadUntil |
| int | fDataMethod |
| bool | found [6] |
| std::vector< std::string > | files |
| double | fErrors [6] |
| std::vector< GCCompleteSet > | EventGroups |
| double | fOscPar [6] |
|
|
|
|
|
Definition at line 38 of file NueGenConfig.h.
|
|
|
Definition at line 10 of file NueGenConfig.cxx. References Reset(). 00010 {
00011 Reset();
00012 }
|
|
|
Definition at line 14 of file NueGenConfig.cxx. References ReadInput(), and Reset().
|
|
|
Definition at line 58 of file NueGenConfig.h. References files. Referenced by NueExpGenerator::Run(). 00058 {files.push_back(file);}
|
|
|
Definition at line 169 of file NueGenConfig.cxx. References fDataMethod, and found. Referenced by ReadInput(), and NueExpGenerator::Run(). 00169 {
00170
00171 if(fDataMethod < 0 || fDataMethod > 2) return false;
00172 if(fDataMethod == 1 || fDataMethod == 0){
00173 for(int i = 0; i < 6; i++) { if(!found[i]) return false; }
00174 }
00175
00176 return true;
00177 }
|
|
|
Definition at line 55 of file NueGenConfig.h. 00055 {return fDataMethod;}
|
|
|
Definition at line 51 of file NueGenConfig.h. Referenced by NueExpGenerator::Run(). 00051 { return fErrors;};
|
|
|
Definition at line 52 of file NueGenConfig.h. Referenced by NueExpGenerator::Run(). 00052 { return fOscPar;};
|
|
|
Definition at line 179 of file NueGenConfig.cxx. References count, fDataMethod, files, fOffSet, fOscPar, and fReadUntil. Referenced by NueExpGenerator::Run(). 00180 {
00181 static ifstream ins;
00182 static int count = 0;
00183 // static place pos;
00184 // std::cout<<"Entering number loader"<<std::endl;
00185
00186 if(fDataMethod == NueGenConfig::kFileList)
00187 {
00188 std::string dum;
00189 if(count >= fReadUntil && fReadUntil > 0) return false;
00190
00191 if(!ins.is_open()){
00192 ins.open(files[0].c_str());
00193 int skipped = 0;
00194
00195 if(fOffSet > 0){
00196 do{
00197 ins>>fOscPar[0]>>fOscPar[1]>>fOscPar[2]>>fOscPar[3];
00198 ins>>num[0]>>num[1]>>num[4]>>num[3]>>num[2]>>dum;
00199 skipped++;
00200 }while(skipped < fOffSet && !ins.eof());
00201
00202 }
00203 std::cout<<"Reading: "<<fReadUntil<<" skipped: "<<fOffSet<<std::endl;
00204 }
00205 ins>>fOscPar[0]>>fOscPar[1]>>fOscPar[2]>>fOscPar[3];
00206 ins>>num[0]>>num[1]>>num[4]>>num[3]>>num[2]>>dum;
00207 count++;
00208 if(ins.eof()){ ins.close(); return false; }
00209 }
00210 if(fDataMethod == NueGenConfig::kSetList)
00211 {
00212
00213 }
00214
00215
00216
00217
00218
00219
00220 return true;
00221 }
|
|
|
Definition at line 33 of file NueGenConfig.cxx. References CheckConfig(), EventGroups, fDataMethod, files, SetDataRange(), and SetErrorVal(). Referenced by NueGenConfig(). 00034 {
00035 std::ifstream stream;
00036 stream.open(input.c_str());
00037 assert(stream.is_open() && "Can't open input file");
00038 std::cout <<"Reading Nue Data from "<<input<<std::endl;
00039
00040 std::string line, temp;
00041 char cline[200];
00042
00043 while (stream.getline(cline,200)){
00044 line=cline;
00045 if (line.find("/",0)==0||line.size()==0) continue; //ignore comments
00046 if(line.find("BEGINDATA") != std::string::npos){
00047 while (line.substr(0,7) != "ENDDATA"){
00048 stream.getline(cline,200);
00049 line=cline;
00050 if (line.find("/",0)==0||line.size()==0) continue;
00051
00052 if (line.find("METHOD") != std::string::npos) {
00053 fDataMethod = atoi((line.substr(7,line.size()-7)).c_str());
00054 // std::cout<<"Setting method "<<fDataMethod<<std::endl;
00055 }
00056 if(line.find("FILE")!=std::string::npos){
00057 if(fDataMethod != NueGenConfig::kFileList){
00058 std::cout<<"Error in config file, invalid data input"<<std::endl;
00059 continue;
00060 }
00061 temp = line.substr(line.find("{")+1,
00062 line.find_first_of("}")-line.find("{")-1);
00063 files.push_back(temp);
00064 continue;
00065 }
00066 // std::cout<<"On line: "<<line<<std::endl;
00067 }
00068 }
00069 if(line.find("BEGINERROR") != std::string::npos){
00070 while (line.substr(0,8) != "ENDERROR"){
00071 stream.getline(cline,200);
00072 line=cline;
00073 if (line.find("NuMu")!=std::string::npos){
00074 SetErrorVal(ClassType::numu, line); continue;
00075 }
00076 if (line.find("NC")!=std::string::npos){
00077 SetErrorVal(ClassType::NC, line); continue;
00078 }
00079 if (line.find("BNue")!=std::string::npos){
00080 SetErrorVal(ClassType::bnue, line); continue;
00081 }
00082 if (line.find("NuTau")!=std::string::npos) {
00083 SetErrorVal(ClassType::nutau, line); continue;
00084 }
00085 if (line.find("SigNue")!=std::string::npos){
00086 SetErrorVal(ClassType::nue, line); continue;
00087 }
00088 if (line.find("Total")!=std::string::npos){
00089 SetErrorVal(5, line); continue;
00090 }
00091 // std::cout<<" err stuff "<<line<<std::endl;
00092
00093 }
00094 std::cout<<"Err section"<<std::endl;
00095 } //End of Parsing the input data
00096
00097 if(line.find("BEGINSET") != std::string::npos){
00098 GCCompleteSet set;
00099 std::cout<<"beg set"<<std::endl;
00100 while (line.substr(0,6) != "ENDSET"){
00101 stream.getline(cline,200);
00102 line=cline;
00103 if (line.find("/",0)==0||line.size()==0) continue;
00104 if (line.find("NuMu")!=std::string::npos){
00105 SetDataRange(ClassType::numu, line, set); continue;
00106 }
00107 if (line.find("NC")!=std::string::npos){
00108 SetDataRange(ClassType::NC, line, set); continue;
00109 }
00110 if (line.find("BNue")!=std::string::npos){
00111 SetDataRange(ClassType::bnue, line, set); continue;
00112 }
00113 if (line.find("NuTau")!=std::string::npos) {
00114 SetDataRange(ClassType::nutau, line, set); continue;
00115 }
00116 if (line.find("SigNue")!=std::string::npos){
00117 SetDataRange(ClassType::nue, line,set); continue;
00118 }
00119 // std::cout<<" set stuff "<<line<<std::endl;
00120
00121 } //End of while loop
00122 EventGroups.push_back(set);
00123 std::cout<<" set stuff "<<line<<std::endl;
00124 } //End of Par data
00125
00126 }
00127 std::cout <<"Finished Reading Nue Data "<<std::endl;
00128
00129 CheckConfig();
00130 }
|
|
|
Definition at line 20 of file NueGenConfig.cxx. References fDataMethod, fErrors, fOffSet, found, and fReadUntil. Referenced by NueGenConfig(). 00021 {
00022 fDataMethod = NueGenConfig::kSetList;
00023
00024 for(int i = 0; i < 6; i++){
00025 fErrors[i] = 0.0;
00026 found[i] = true;
00027 }
00028
00029 fReadUntil = -1;
00030 fOffSet = 0;
00031 }
|
|
||||||||||||||||
|
Definition at line 132 of file NueGenConfig.cxx. References GCDataParam::end, GCCompleteSet::EventClass, fDataMethod, GCDataParam::isfixed, GCDataParam::start, and GCDataParam::step. Referenced by ReadInput(). 00133 {
00134 if(fDataMethod != NueGenConfig::kSetList){
00135 // std::cout<<"Error in config file, invalid data input"<<std::endl;
00136 return;
00137 }
00138
00139 std::string temp;
00140 while (line.find(" ",0)<line.size())
00141 line.replace(line.find(" ",0),1,"");
00142
00143 temp = line.substr(line.find("{")+1,
00144 line.find_first_of(",")-line.find("{")-1);
00145 set.EventClass[nuClass].start = atof(temp.c_str());
00146
00147 temp = line.substr(line.find_first_of(",")+1,
00148 line.find_last_of(",")-line.find_first_of(",")-1);
00149 set.EventClass[nuClass].end = atof(temp.c_str());
00150
00151 temp = line.substr(line.find_last_of(",")+1,
00152 line.find("}")-line.find_last_of(",")-1);
00153 set.EventClass[nuClass].step = atof(temp.c_str());
00154
00155 set.EventClass[nuClass].isfixed = false;
00156 if(line.find("fix")!=std::string::npos) set.EventClass[nuClass].isfixed = true;
00157
00158 }
|
|
||||||||||||
|
Definition at line 160 of file NueGenConfig.cxx. References fErrors, and found. Referenced by ReadInput(). 00161 {
00162 std::string temp = line.substr(line.find("{")+1,
00163 line.find("}")-line.find("{")-1);
00164 fErrors[pos] = atof(temp.c_str());
00165 found[pos] = true;
00166
00167 }
|
|
|
Definition at line 60 of file NueGenConfig.h. Referenced by NueExpGenerator::Run(). 00060 { fOffSet = in; };
|
|
|
Definition at line 61 of file NueGenConfig.h. Referenced by NueExpGenerator::Run(). 00061 {fReadUntil = in; };
|
|
|
Definition at line 74 of file NueGenConfig.h. Referenced by ReadInput(). |
|
|
Definition at line 69 of file NueGenConfig.h. Referenced by CheckConfig(), LoadNextNumberSet(), ReadInput(), Reset(), and SetDataRange(). |
|
|
Definition at line 73 of file NueGenConfig.h. Referenced by Reset(), and SetErrorVal(). |
|
|
Definition at line 71 of file NueGenConfig.h. Referenced by LoadNextNumberSet(), and ReadInput(). |
|
|
Definition at line 67 of file NueGenConfig.h. Referenced by LoadNextNumberSet(), and Reset(). |
|
|
Definition at line 76 of file NueGenConfig.h. Referenced by LoadNextNumberSet(). |
|
|
Definition at line 70 of file NueGenConfig.h. Referenced by CheckConfig(), Reset(), and SetErrorVal(). |
|
|
Definition at line 68 of file NueGenConfig.h. Referenced by LoadNextNumberSet(), and Reset(). |
1.3.9.1