32 std::ifstream ifs(file.c_str(), std::ios::in);
34 if (!ifs.is_open())
return false;
37 const std::string searchPattern(
"Pythia total cross section normalisation:");
38 std::string normalisation;
42 std::getline(ifs, line);
43 size_t position = line.find(searchPattern);
44 if (position != std::string::npos) {
48 line.erase(0, position + searchPattern.length());
54 const std::string searchPattern2(
"Total Number of generated events");
55 position = line.find(searchPattern2);
56 if (position != std::string::npos) {
60 line.erase(0, position + searchPattern2.length());
70 std::cout <<
nEvents_.GetString().Atoi() << std::endl;
71 std::cout <<
"Extracted information from " << file << std::endl;
92 std::ifstream ifs(file.c_str(), std::ios::in);
93 if (!ifs.is_open())
return false;
95 const std::string searchPattern(
96 "total cross section in pb from MC simulation");
97 std::string normalisation;
100 std::getline(ifs, line);
101 size_t position = line.find(searchPattern);
102 if (position != std::string::npos) {
105 std::stringstream ss;
106 line.erase(0, position + searchPattern.length());
119 const std::string searchPattern2(
"Total Number of trials");
120 position = line.find(searchPattern2);
121 if (position != std::string::npos) {
124 std::stringstream ss;
125 line.erase(0, position + searchPattern2.length());
134 nEvents_.SetString(nEvents.c_str());
135 std::cout <<
nEvents_.GetString().Atoi() << std::endl;
136 std::cout <<
"Extracted information from " << file << std::endl;
156 std::ifstream ifs(file.c_str(), std::ios::in);
158 if (!ifs.is_open())
return false;
169 const std::string xsecPattern(
"Cross-section from HERACLES =");
170 const std::string xsecAltPattern(
"Total cross section is now SIGTOT =");
171 std::string normalisation;
175 std::getline(ifs, line);
178 size_t position = line.find(xsecPattern);
179 if (position != std::string::npos && normalisation.empty()) {
182 std::stringstream ss;
183 line.erase(0, position + xsecPattern.length());
194 position = line.find(xsecAltPattern);
196 if (position != std::string::npos) {
199 std::stringstream ss;
200 line.erase(0, position + xsecAltPattern.length());
211 const std::string searchPattern2(
"TOTAL EVENT NUMBER");
212 position = line.find(searchPattern2);
213 if (position != std::string::npos) {
216 std::stringstream ss;
217 line.erase(0, position + searchPattern2.length());
227 nEvents_.SetString(nEvents.c_str());
228 std::cout <<
nEvents_.GetString().Atoi() << std::endl;
230 std::cout <<
"Extracted information from " << file << std::endl;
243 std::ifstream ifs(file.c_str(), std::ios::in);
245 if (!ifs.is_open())
return false;
249 const std::string nEventPattern(
"Number of generated events =");
250 const std::string xsecPattern(
"Total cross-section (nb) :");
251 const std::string errorPattern(
"Error :");
255 std::stringstream ss;
258 std::getline(ifs, line);
262 if (line.find(nEventPattern) != std::string::npos) {
264 line.find(nEventPattern) + nEventPattern.length());
268 }
else if (line.find(xsecPattern) != std::string::npos) {
270 line.find(xsecPattern) + xsecPattern.length());
274 }
else if (line.find(errorPattern) != std::string::npos) {
276 line.find(errorPattern) + errorPattern.length());
284 return !(
nEvents_.GetString().IsNull() ||
299 , mCrossSection(
"") {
311 std::ifstream file(filename.c_str(), std::ios::in);
312 if (!file.is_open()) {
316 const std::string eventPattern(
"generated events (IEVGEN)");
318 const std::string xsecPattern(
"total xsec in microbarns after selector");
320 std::stringstream sstream;
322 while (file.good()) {
323 std::getline(file, line);
325 if (line.find(eventPattern) != std::string::npos) {
335 if (line.find(xsecPattern) != std::string::npos) {
344 return !(
mNEvents.GetString().IsNull() ||
374 TString name =
event.ClassName();
375 name.ReplaceAll(
"erhic::",
"");
376 name.ReplaceAll(
"Event",
"");
394 reader =
prototypes_.find(str.Data())->second->Create();
407 std::getline(is, line);
413 if (str.Contains(
"pythia")) {
415 }
else if (str.Contains(
"pepsi") || str.Contains(
"lepto")) {
417 }
else if (str.Contains(
"rapgap")) {
419 }
else if (str.Contains(
"djangoh")) {
423 }
else if (str.Contains(
"milou")) {
430 TString inFileName(mcFile);
432 std::string extension;
433 if (mcFile.find_last_of(
'.') != std::string::npos) {
434 extension = mcFile.substr(mcFile.find_last_of(
'.'));
437 if (std::string(
".") == gSystem->DirName(inFileName)) {
438 inFileName.Prepend(
"/").Prepend(gSystem->pwd());
447 if (inFileName.Contains(
"TXTFILES")) {
448 logFileName = inFileName;
449 logFileName.ReplaceAll(
"TXTFILES",
"LOGFILES");
450 logFileName.ReplaceAll(extension.c_str(),
".log");
454 if (gSystem->AccessPathName(logFileName, kFileExists)) {
458 if (logFileName.IsNull()) {
459 logFileName = inFileName;
460 if (extension.empty()) {
461 logFileName.Append(
".log");
463 logFileName.ReplaceAll(extension.c_str(),
".log");
468 if (gSystem->AccessPathName(logFileName, kFileExists)) {
471 return logFileName.Data();
508 TString name = t_->ClassName();
509 name.ReplaceAll(
"erhic::",
"");
510 name.ReplaceAll(
"Event",
"");
535 std::getline(is, line);
541 if (str.Contains(
"pythia")) {
543 }
else if (str.Contains(
"pepsi") || str.Contains(
"lepto")) {
545 }
else if (str.Contains(
"rapgap")) {
547 }
else if (str.Contains(
"djangoh")) {
549 }
else if (str.Contains(
"milou")) {
551 }
else if (str.Contains(
"beagle")) {
553 }
else if (str.Contains(
"gmctrans")) {
555 }
else if (str.Contains(
"dpmjet")) {
583 if (i->second)
delete i->second;