Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
Generator
src
Framework
Ntuple
NtpMCTreeHeader.cxx
Go to the documentation of this file.
1
//____________________________________________________________________________
2
/*
3
Copyright (c) 2003-2020, The GENIE Collaboration
4
For the full text of the license visit http://copyright.genie-mc.org
5
6
Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7
University of Liverpool & STFC Rutherford Appleton Laboratory
8
*/
9
//____________________________________________________________________________
10
11
#include <fstream>
12
#include <iomanip>
13
14
#include <TSystem.h>
15
16
#include "
Framework/Messenger/Messenger.h
"
17
#include "
Framework/Ntuple/NtpMCTreeHeader.h
"
18
19
using namespace
genie
;
20
21
ClassImp
(
NtpMCTreeHeader
)
22
23
using
std
::ifstream;
24
using
std
::
endl
;
25
using
std
::ios;
26
27
//____________________________________________________________________________
28
namespace
genie
{
29
ostream &
operator<<
(ostream&
stream
,
const
NtpMCTreeHeader
& hdr)
30
{
31
hdr.
PrintToStream
(stream);
32
return
stream
;
33
}
34
}
35
//____________________________________________________________________________
36
NtpMCTreeHeader::NtpMCTreeHeader
() :
37
TNamed(
"header"
,
"GENIE output tree header"
)
38
{
39
this->
Init
();
40
}
41
//____________________________________________________________________________
42
NtpMCTreeHeader::NtpMCTreeHeader
(
const
NtpMCTreeHeader
& hdr) :
43
TNamed(
"header"
,
"GENIE output tree header"
)
44
{
45
this->
Copy
(hdr);
46
}
47
//____________________________________________________________________________
48
NtpMCTreeHeader::~NtpMCTreeHeader
()
49
{
50
51
}
52
//____________________________________________________________________________
53
void
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
//____________________________________________________________________________
72
void
NtpMCTreeHeader::Copy
(
const
NtpMCTreeHeader
& hdr)
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
//____________________________________________________________________________
84
void
NtpMCTreeHeader::Init
(
void
)
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
//____________________________________________________________________________
SortModuleTimes.version
version
Definition:
SortModuleTimes.py:878
genie
THE MAIN GENIE PROJECT NAMESPACE
Definition:
AlgCmp.h:25
pERROR
#define pERROR
Definition:
Messenger.h:59
genie::kNFUndefined
Definition:
NtpMCFormat.h:29
genie::NtpMCTreeHeader::tune
TObjString tune
GENIE Tune Name.
Definition:
NtpMCTreeHeader.h:61
genie::NtpMCTreeHeader::datime
NtpMCDTime datime
Date and Time that the event ntuple was generated.
Definition:
NtpMCTreeHeader.h:58
std
STL namespace.
train.filename
string filename
Definition:
train.py:213
genie::NtpMCTreeHeader::~NtpMCTreeHeader
virtual ~NtpMCTreeHeader()
Definition:
NtpMCTreeHeader.cxx:48
genie::NtpMCTreeHeader::Copy
void Copy(const NtpMCTreeHeader &hdr)
Definition:
NtpMCTreeHeader.cxx:72
genie::NtpMCTreeHeader::Init
void Init(void)
Definition:
NtpMCTreeHeader.cxx:84
genie::NtpMCTreeHeader::tuneDir
TObjString tuneDir
directory from when tune config came
Definition:
NtpMCTreeHeader.h:62
genie::NtpMCTreeHeader::cvstag
TObjString cvstag
GENIE CVS Tag (to keep track of GENIE's version)
Definition:
NtpMCTreeHeader.h:57
LOG
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition:
Messenger.h:96
genie::NtpMCTreeHeader
MINOS-style Ntuple Class to hold an output MC Tree Header.
Definition:
NtpMCTreeHeader.h:37
genie::NtpMCTreeHeader::PrintToStream
void PrintToStream(ostream &stream) const
Definition:
NtpMCTreeHeader.cxx:53
generate_datataset.stream
stream
Definition:
generate_datataset.py:30
NtpMCTreeHeader.h
genie::NtpMCTreeHeader::runnu
Long_t runnu
MC Job run number.
Definition:
NtpMCTreeHeader.h:59
genie::NtpMCFormat::AsString
static const char * AsString(NtpMCFormat_t fmt)
Definition:
NtpMCFormat.h:36
Messenger.h
genie::NtpMCDTime::Copy
void Copy(const NtpMCDTime &dt)
Definition:
NtpMCDTime.cxx:54
genie::NtpMCTreeHeader::customDirs
TObjString customDirs
any custom directories
Definition:
NtpMCTreeHeader.h:63
genie::NtpMCDTime::Now
void Now(void)
Definition:
NtpMCDTime.cxx:76
genie::NtpMCTreeHeader::format
NtpMCFormat_t format
Event Record format (GENIE support multiple formats)
Definition:
NtpMCTreeHeader.h:56
ClassImp
ClassImp(EDep::TEventChangeManager) namespace
Definition:
TEventChangeManager.cxx:21
genie::operator<<
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
Definition:
AlgConfigPool.cxx:41
genie::NtpMCTreeHeader::runseed
Long_t runseed
Random seed used in the MC run.
Definition:
NtpMCTreeHeader.h:60
genie::NtpMCTreeHeader::NtpMCTreeHeader
NtpMCTreeHeader()
Definition:
NtpMCTreeHeader.cxx:36
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
Generated by
1.8.11