16#include <TClonesArray.h>
30using std::ostringstream;
45 LOG(
"Ntp",
pNOTICE) <<
"Run number: " << runnu;
59 LOG(
"Ntp",
pINFO) <<
"Adding event " << ievent <<
" to output tree";
62 LOG(
"Ntp",
pERROR) <<
"NULL input EventRecord!";
66 LOG(
"Ntp",
pERROR) <<
"No open output TTree to add the input EventRecord!";
85 LOG(
"Ntp",
pINFO) <<
"Initializing GENIE output MC tree";
97 string tunename(
"unknown");
98 string tuneDir(
"unknown");
99 string customDirs(
"");
103 <<
"No TuneId is available from RunOpt";
105 tunename = tuneId->
Name();
121 configuration.
Load()->Write();
141 fnstr << filename_prefix <<
"."
154 <<
"Opening the output ROOT file: " << filename;
158 fOutFile = TFile::Open(filename.c_str(),
"RECREATE");
165 LOG(
"Ntp",
pINFO) <<
"Creating the output GENIE/ROOT tree";
168 title <<
"GENIE MC Truth TTree"
171 fOutTree =
new TTree(
"gtree",title.str().c_str());
183 <<
"Unknown TTree format. Can not create TBranches";
192 LOG(
"Ntp",
pINFO) <<
"Creating a NtpMCEventRecord TBranch";
195 TTree::SetBranchStyle(1);
197#if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0)
212 LOG(
"Ntp",
pINFO) <<
"Creating the NtpMCTreeHeader";
227 LOG(
"Ntp",
pINFO) <<
"Saving the output tree";
237 LOG(
"Ntp",
pERROR) <<
"No open ROOT file was found";
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
MINOS-style ntuple record. Each such ntuple record holds a generated EventRecord object....
Stores the GENIE configuration in ROOT TFolders along with the output event tree.
Stores a snapshot of your environment in ROOT TFolder along with the output event tree.
TFolder * TakeSnapshot(void)
void CreateGHEPEventBranch(void)
void SetDefaultFilename(string filename_prefix="gntp")
TBranch * fEventBranch
the generated event branch
~NtpWriter()
initialize the ntuple writer
void CustomizeFilename(string filename)
void OpenFile(string filename)
void Initialize(void)
add event
void Save(void)
get the even tree
void CreateEventBranch(void)
NtpMCEventRecord * fNtpMCEventRecord
NtpMCTreeHeader * fNtpMCTreeHeader
void AddEventRecord(int ievent, const EventRecord *ev_rec)
save the event tree
void CustomizeFilenamePrefix(string prefix)
TFile * fOutFile
output file
TTree * fOutTree
output tree
void CreateTreeHeader(void)
NtpMCFormat_t fNtpFormat
enumeration of event formats
string fOutFilename
output filename
NtpWriter(NtpMCFormat_t fmt=kNFGHEP, Long_t runnu=0, Long_t runseed=-1)
TuneId * Tune(void) const
static RunOpt * Instance(void)
string CustomSource(void) const
bool IsCustom(void) const
string TuneDirectory(void) const
THE MAIN GENIE PROJECT NAMESPACE
enum genie::ENtpMCFormat NtpMCFormat_t