GENIEGenerator
Loading...
Searching...
No Matches
NtpMCTreeHeader.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Costas Andreopoulos <c.andreopoulos \at cern.ch>
7 University of Liverpool
8*/
9//____________________________________________________________________________
10
11#include <fstream>
12#include <iomanip>
13
14#include <TSystem.h>
15
18
19using namespace genie;
20
22
23using std::ifstream;
24using std::endl;
25using std::ios;
26
27//____________________________________________________________________________
28namespace genie {
29 ostream & operator<< (ostream& stream, const NtpMCTreeHeader & hdr)
30 {
31 hdr.PrintToStream(stream);
32 return stream;
33 }
34}
35//____________________________________________________________________________
37TNamed("header","GENIE output tree header")
38{
39 this->Init();
40}
41//____________________________________________________________________________
43TNamed("header","GENIE output tree header")
44{
45 this->Copy(hdr);
46}
47//____________________________________________________________________________
52//____________________________________________________________________________
53void NtpMCTreeHeader::PrintToStream(ostream & stream) const
54{
55 string sformat = NtpMCFormat::AsString(this->format);
56 string scvstag = this->cvstag.GetString().Data();
57 string stune = this->tune.GetString().Data();
58 string stuneDir = this->tuneDir.GetString().Data();
59 string scustomDirs = this->customDirs.GetString().Data();
60
61 stream << "Tree Header Info:" << endl
62 << "MC run number -> " << this->runnu << endl
63 << "MC run seed -> " << this->runseed << endl
64 << "NtpRecord Format -> " << sformat << endl
65 << "GENIE CVS Vrs Nu -> " << scvstag << endl
66 << "GENIE tune name -> " << stune << endl
67 << "tune directory -> " << stuneDir << endl
68 << "custom directories-> " << scustomDirs << endl
69 << "File generated at -> " << this->datime << endl;
70}
71//____________________________________________________________________________
73{
74 this->format = hdr.format;
75 this->cvstag.SetString(hdr.cvstag.GetString().Data());
76 this->datime.Copy(hdr.datime);
77 this->runnu = hdr.runnu;
78 this->runseed = hdr.runseed;
79 this->tune.SetString(hdr.tune.GetString().Data());
80 this->tuneDir.SetString(hdr.tuneDir.GetString().Data());
81 this->customDirs.SetString(hdr.customDirs.GetString().Data());
82}
83//____________________________________________________________________________
85{
86 string version;
87 string genie_path = gSystem->Getenv("GENIE");
88 string filename = genie_path + "/VERSION";
89 bool vrs_file_found = ! (gSystem->AccessPathName(filename.c_str()));
90 if (!vrs_file_found) {
91 LOG("Ntp", pERROR)
92 << "The GENIE version file [" << filename << "] is not accessible";
93 version = "NO CVS version number was specified";
94 } else {
95 ifstream gvinp(filename.c_str(), ios::in);
96 gvinp >> version;
97 gvinp.close();
98 }
99
100 string tunename("unknown");
101 string tuneDir("unknown");
102 string customDirs("");
103
104 this->format = kNFUndefined;
105 this->cvstag.SetString(version.c_str());
106 this->datime.Now();
107 this->runnu = 0;
108 this->runseed = 0;
109 this->tune.SetString(tunename.c_str());
110 this->tuneDir.SetString(tuneDir.c_str());
111 this->customDirs.SetString(customDirs.c_str());
112}
113//____________________________________________________________________________
ClassImp(EventRecord) namespace genie
#define pERROR
Definition Messenger.h:59
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
static const char * AsString(NtpMCFormat_t fmt)
Definition NtpMCFormat.h:36
MINOS-style Ntuple Class to hold an output MC Tree Header.
TObjString cvstag
GENIE CVS Tag (to keep track of GENIE's version)
TObjString tune
GENIE Tune Name.
void PrintToStream(ostream &stream) const
TObjString customDirs
any custom directories
NtpMCDTime datime
Date and Time that the event ntuple was generated.
NtpMCFormat_t format
Event Record format (GENIE support multiple formats)
void Copy(const NtpMCTreeHeader &hdr)
Long_t runnu
MC Job run number.
TObjString tuneDir
directory from when tune config came
Long_t runseed
Random seed used in the MC run.
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
@ kNFUndefined
Definition NtpMCFormat.h:29
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)