33 HeaderSet(std::vector<float> line)
35 if (line.size() == 19) {
37 for (
unsigned i = 1; i <= 19; i++) {
40 }
else {B2ERROR(
"ERROR! wrong lengthof relID vector!");}
42 void operator= (std::vector<float> line)
44 if (line.size() == 19) {
46 for (
unsigned i = 1; i <= 19; i++) {
49 }
else {B2ERROR(
"ERROR! wrong length of relID vector!");}
53 HeaderSet(
unsigned expert, std::vector<float> relevantID)
55 if (relevantID.size() == 18) {
56 for (
unsigned i = 0; i < 18; ++i) {relID[i] = relevantID[i];}
57 }
else {B2ERROR(
"ERROR! wrong length of relID vector!");}
60 friend std::ostream& operator << (std::ostream& out,
const HeaderSet& hset)
62 out << hset.exPert <<
'\t';
63 for (
unsigned i = 0; i < 18; ++i) { out << hset.relID[i] <<
'\t';}
66 friend std::istream& operator >> (std::istream& in, HeaderSet& hset)
72 std::getline(in, helpline,
'\n');
73 if (helpline.length() < 2) {
return in;}
74 std::stringstream ss(helpline);
75 std::getline(ss, help,
'\t');
77 hset.exPert = std::stoul(help);
78 for (
unsigned i = 0; i < 18; ++i) {
80 std::getline(ss, help,
'\t');
81 hset.relID[i] = std::stof(help);
94 std::vector<float> input;
95 std::vector<float> target;
111 std::string headline;
112 NeuroSet(
int inlen = 27)
114 headline =
"Experiment\tRun\tSubrun\tEvent\tTrack\tnTracks\tExpert\tiNodes\toNodes\t";
115 unsigned InputPerSL = inlen / 9;
116 for (
unsigned i = 0; i < inlen / InputPerSL; ++i) {
117 headline +=
"SL" + std::to_string(i) +
"-relID\t";
118 headline +=
"SL" + std::to_string(i) +
"-driftT\t";
119 headline +=
"SL" + std::to_string(i) +
"-alpha\t";
120 for (
unsigned j = 0; j < InputPerSL - 3; ++j) {
121 headline +=
"SL" + std::to_string(i) +
"-extra_input" + std::to_string(j) +
"\t";
124 headline +=
"RecoZ\tRecoTheta\tScaleZ\tRawZ\tScaleTheta\tRawTheta\t2DPhi\t3DTheta\t2DinvPt\t2DPt\n";
127 NeuroSet(std::vector<float> xin, std::vector<float> xout,
int xexp,
int xrun,
int xsubrun,
int xevt,
int xtrack,
unsigned xexpert,
128 int xntracks,
int xnnrawz,
int xnnrawtheta,
float xnnscalez,
float xnnscaletheta,
float xinphi,
float xintheta,
float xininvpt,
141 nnscalez = xnnscalez;
142 nnscaletheta = xnnscaletheta;
144 nnrawtheta = xnnrawtheta;
149 headline =
"Experiment\tRun\tSubrun\tEvent\tTrack\tnTracks\tExpert\tiNodes\toNodes\t";
150 unsigned inlen = input.size();
151 unsigned InputPerSL = inlen / 9;
152 for (
unsigned i = 0; i < inlen / InputPerSL; ++i) {
153 headline +=
"SL" + std::to_string(i) +
"-relID\t";
154 headline +=
"SL" + std::to_string(i) +
"-driftT\t";
155 headline +=
"SL" + std::to_string(i) +
"-alpha\t";
156 for (
unsigned j = 0; j < InputPerSL - 3; ++j) {
157 headline +=
"SL" + std::to_string(i) +
"-extra_input" + std::to_string(j) +
"\t";
160 headline +=
"RecoZ\tRecoTheta\tScaleZ\tRawZ\tScaleTheta\tRawTheta\t2DPhi\t3DTheta\t2DinvPt\t2DPt\n";
163 friend std::ostream& operator << (std::ostream& out,
const NeuroSet& dset)
165 out << dset.exp <<
'\t' << dset.run <<
'\t' << dset.subrun <<
'\t' << dset.evt <<
'\t' << dset.track <<
'\t' << dset.ntracks <<
'\t'
166 << dset.expert <<
'\t'
167 << dset.input.size() <<
'\t' << dset.target.size() <<
'\t';
168 for (
auto indata : dset.input) {out << indata <<
'\t';}
169 for (
auto outdata : dset.target) {out << outdata <<
'\t';}
170 out << dset.nnscalez <<
'\t' << dset.nnrawz <<
'\t' << dset.nnscaletheta <<
'\t' << dset.nnrawtheta <<
'\t' << dset.inphi <<
'\t' <<
171 dset.intheta <<
'\t' << dset.ininvpt <<
'\t' << dset.pt;
174 friend std::istream& operator >> (std::istream& in, NeuroSet& dset)
178 std::getline(in, help,
'\t');
179 if (help.length() < 2) {
return in;}
180 dset.exp = std::stoi(help);
182 std::getline(in, help,
'\t');
183 dset.run = std::stoi(help);
185 std::getline(in, help,
'\t');
186 dset.subrun = std::stoi(help);
188 std::getline(in, help,
'\t');
189 dset.evt = std::stoi(help);
191 std::getline(in, help,
'\t');
192 dset.track = std::stoi(help);
194 std::getline(in, help,
'\t');
195 dset.ntracks = std::stoi(help);
197 std::getline(in, help,
'\t');
198 dset.expert = std::stoul(help);
200 std::string insize =
"";
201 std::string outsize =
"";
202 std::getline(in, insize,
'\t');
203 dset.input.assign(std::stoul(insize), -1);
209 std::getline(in, outsize,
'\t');
210 dset.target.assign(std::stoul(outsize), -1);
216 for (
unsigned i = 0; i < std::stoul(insize); ++i) {
218 std::getline(in, help,
'\t');
220 dset.input[i] = std::stof(help);
221 }
catch (
const std::out_of_range& oor) {
222 B2WARNING(
"out of range error: " << help <<
" is not in float range!");
226 for (
unsigned i = 0; i < std::stoul(outsize); ++i) {
228 std::getline(in, help,
'\t');
230 dset.target[i] = std::stof(help);
231 }
catch (
const std::out_of_range& oor) {
232 B2WARNING(
"out of range error: " << help <<
" is not in float range!");
237 std::getline(in, help,
'\t');
238 dset.nnscalez = std::stof(help);
240 std::getline(in, help,
'\t');
241 dset.nnrawz = std::stoi(help);
243 std::getline(in, help,
'\t');
244 dset.nnscaletheta = std::stof(help);
246 std::getline(in, help,
'\t');
247 dset.nnrawtheta = std::stoi(help);
249 std::getline(in, help,
'\t');
250 dset.inphi = std::stof(help);
252 std::getline(in, help,
'\t');
253 dset.intheta = std::stof(help);
255 std::getline(in, help,
'\t');
256 dset.ininvpt = std::stof(help);
297 void addSample(
const std::vector<float>& input,
const std::vector<float>& target,
const int& expnumber,
const int& runnumber,
298 const int& subrunnumber,
const int& eventnumber,
const int& tracknumber)
303 m_runList.push_back(runnumber);
304 m_subRunList.push_back(subrunnumber);
306 m_trackList.push_back(tracknumber);