ghep_dump.C
Go to the documentation of this file.
1 //
2 // Prints the events in the input GHEP event file
3 //
4 // Usage:
5 // shell% genie
6 // genie[0] .x ghep_dump.C("/path/to/my/genie_file.root");
7 //
8 // Costas Andreopoulos, Dec 13, 2006
9 //
10 
11 void ghep_dump(const char * filename)
12 {
13 
14  // open the ROOT file and get the event TTree
15  TFile inpfile(filename,"READ");
16  TTree * tree = dynamic_cast <TTree *> (inpfile.Get("gtree"));
17 
18  // set the branch address
19  genie::NtpMCEventRecord * mcrec = 0;
20  tree->SetBranchAddress("gmcrec", &mcrec);
21 
22  // loop over event tree
23  for(int i = 0; i< tree->GetEntries(); i++) {
24  tree->GetEntry(i);
25 
26  genie::NtpMCRecHeader rec_header = mcrec->hdr;
27  genie::EventRecord & event = *(mcrec->event);
28 
29  // print-out
30  cout << rec_header;
31  cout << event;
32 
33  mcrec->Clear();
34  }
35 
36  inpfile.Close();
37 }
38 
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 ghep_dump(const char *filename)
Definition: ghep_dump.C:11
string filename
Definition: shutoffs.py:106
OStream cout
Definition: OStream.cxx:6
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Definition: EventRecord.h:38
MINOS-style Ntuple Class to hold an MC Event Record Header.