GENIEGenerator
Loading...
Searching...
No Matches
NtpWriter.h
Go to the documentation of this file.
1//____________________________________________________________________________
2/*!
3
4\class genie::NtpWriter
5
6\brief A utility class to facilitate creating the GENIE MC Ntuple from the
7 output GENIE GHEP event records.
8
9\author Costas Andreopoulos <c.andreopoulos \at cern.ch>
10 University of Liverpool
11
12\created October 1, 2004
13
14\cpright Copyright (c) 2003-2025, The GENIE Collaboration
15 For the full text of the license visit http://copyright.genie-mc.org
16*/
17//____________________________________________________________________________
18
19#ifndef _NTP_WRITER_H_
20#define _NTP_WRITER_H_
21
22#include <string>
23
25
26class TFile;
27class TTree;
28class TBranch;
29class TClonesArray;
30
31using std::string;
32
33namespace genie {
34
35class EventRecord;
37class NtpMCTreeHeader;
38
39class NtpWriter {
40
41public :
42 NtpWriter(NtpMCFormat_t fmt = kNFGHEP, Long_t runnu = 0, Long_t runseed = -1);
43 ~NtpWriter();
44
45 ///< initialize the ntuple writer
46 void Initialize (void);
47
48 ///< add event
49 void AddEventRecord (int ievent, const EventRecord * ev_rec);
50
51 ///< save the event tree
52 void Save (void);
53
54 ///< get the even tree
55 TTree * EventTree (void) { return fOutTree; }
56
57 ///< use before Initialize() only if you wish to override the default
58 ///< filename, or the default filename prefix
59 void CustomizeFilename (string filename);
60 void CustomizeFilenamePrefix (string prefix);
61
62private:
63
64 void SetDefaultFilename (string filename_prefix="gntp");
65 void OpenFile (string filename);
66 void CreateTree (void);
67 void CreateTreeHeader (void);
68 void CreateEventBranch (void);
69 void CreateGHEPEventBranch (void);
70
71 NtpMCFormat_t fNtpFormat; ///< enumeration of event formats
72 Long_t fRunNu; ///< run nu
73 Long_t fRunSeed; ///< run seed
74 string fOutFilename; ///< output filename
75 TFile * fOutFile; ///< output file
76 TTree * fOutTree; ///< output tree
77 TBranch * fEventBranch; ///< the generated event branch
80};
81
82} // genie namespace
83#endif // _NTP_WRITER_H_
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Definition EventRecord.h:37
MINOS-style ntuple record. Each such ntuple record holds a generated EventRecord object....
MINOS-style Ntuple Class to hold an output MC Tree Header.
void CreateGHEPEventBranch(void)
void SetDefaultFilename(string filename_prefix="gntp")
Long_t fRunNu
run nu
Definition NtpWriter.h:72
TBranch * fEventBranch
the generated event branch
Definition NtpWriter.h:77
~NtpWriter()
initialize the ntuple writer
Definition NtpWriter.cxx:52
void CustomizeFilename(string filename)
void OpenFile(string filename)
void Initialize(void)
add event
Definition NtpWriter.cxx:83
void CreateTree(void)
void Save(void)
get the even tree
void CreateEventBranch(void)
NtpMCEventRecord * fNtpMCEventRecord
Definition NtpWriter.h:78
NtpMCTreeHeader * fNtpMCTreeHeader
Definition NtpWriter.h:79
void AddEventRecord(int ievent, const EventRecord *ev_rec)
save the event tree
Definition NtpWriter.cxx:57
Long_t fRunSeed
run seed
Definition NtpWriter.h:73
void CustomizeFilenamePrefix(string prefix)
TFile * fOutFile
output file
Definition NtpWriter.h:75
TTree * fOutTree
output tree
Definition NtpWriter.h:76
void CreateTreeHeader(void)
NtpMCFormat_t fNtpFormat
enumeration of event formats
Definition NtpWriter.h:71
string fOutFilename
output filename
Definition NtpWriter.h:74
NtpWriter(NtpMCFormat_t fmt=kNFGHEP, Long_t runnu=0, Long_t runseed=-1)
Definition NtpWriter.cxx:35
TTree * EventTree(void)
Definition NtpWriter.h:55
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
@ kNFGHEP
Definition NtpMCFormat.h:30
enum genie::ENtpMCFormat NtpMCFormat_t