30 #include <TClonesArray.h> 43 using std::ostringstream;
45 using namespace genie;
57 LOG(
"Ntp",
pNOTICE) <<
"Run number: " << runnu;
71 LOG(
"Ntp",
pINFO) <<
"Adding event " << ievent <<
" to output tree";
74 LOG(
"Ntp",
pERROR) <<
"NULL input EventRecord!";
78 LOG(
"Ntp",
pERROR) <<
"No open output TTree to add the input EventRecord!";
97 LOG(
"Ntp",
pINFO) <<
"Initializing GENIE output MC tree";
111 configuration.
Load()->Write();
131 fnstr << filename_prefix <<
"." 144 <<
"Opening the output ROOT file: " <<
filename;
148 fOutFile = TFile::Open(filename.c_str(),
"RECREATE");
155 LOG(
"Ntp",
pINFO) <<
"Creating the output GENIE/ROOT tree";
158 title <<
"GENIE MC Truth TTree" 161 fOutTree =
new TTree(
"gtree",title.str().c_str());
173 <<
"Unknown TTree format. Can not create TBranches";
182 LOG(
"Ntp",
pINFO) <<
"Creating a NtpMCEventRecord TBranch";
185 TTree::SetBranchStyle(1);
187 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,0,0) 202 LOG(
"Ntp",
pINFO) <<
"Creating the NtpMCTreeHeader";
216 LOG(
"Ntp",
pINFO) <<
"Saving the output tree";
226 LOG(
"Ntp",
pERROR) <<
"No open ROOT file was found";
void split(double tt, double *fr)
Stores the GENIE configuration in ROOT TFolders along with the output event tree. ...
void OpenFile(string filename)
THE MAIN GENIE PROJECT NAMESPACE
Stores a snapshot of your environment in ROOT TFolder along with the output event tree...
void CustomizeFilename(string filename)
void SetDefaultFilename(string filename_prefix="gntp")
MINOS-style ntuple record. Each such ntuple record holds a generated EventRecord object. Ntuples of this type are intended for feeding GENIE events into other applications (for example the GEANT4 based MC generation framework of an experiment) if no direct interface exists.
void Fill(unsigned int ievent, const EventRecord *ev_rec)
void CreateGHEPEventBranch(void)
NtpMCFormat_t fNtpFormat
enumeration of event formats
string fOutFilename
output filename
TFile * fOutFile
output file
NtpMCTreeHeader * fNtpMCTreeHeader
TBranch * fEventBranch
the generated event branch
~NtpWriter()
initialize the ntuple writer
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
void CreateEventBranch(void)
void Save(void)
get the even tree
void AddEventRecord(int ievent, const EventRecord *ev_rec)
save the event tree
void CreateTreeHeader(void)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
void CustomizeFilenamePrefix(string prefix)
void Initialize(void)
add event
TTree * fOutTree
output tree
assert(nhit_max >=nhit_nbins)
enum genie::ENtpMCFormat NtpMCFormat_t
NtpWriter(NtpMCFormat_t fmt=kNFGHEP, Long_t runnu=0)
NtpMCEventRecord * fNtpMCEventRecord
TFolder * TakeSnapshot(void)