GENIEGenerator
Loading...
Searching...
No Matches
NtpMCEventRecord.cxx
Go to the documentation of this file.
1//____________________________________________________________________________
2/*
3 Copyright (c) 2003-2025, The GENIE Collaboration
4 For the full text of the license visit http://copyright.genie-mc.org
5
6 Costas Andreopoulos <c.andreopoulos \at cern.ch>
7 University of Liverpool
8*/
9//____________________________________________________________________________
10
13#include "TBuffer.h"
15
16using std::endl;
17
18using namespace genie;
19
21
22//____________________________________________________________________________
23namespace genie {
24 ostream & operator<< (ostream& stream, const NtpMCEventRecord & ntpp)
25 {
26 ntpp.PrintToStream(stream);
27 return stream;
28 }
29}
30//____________________________________________________________________________
36//____________________________________________________________________________
39{
40 this->Copy(ntpmcrec);
41}
42//____________________________________________________________________________
47//____________________________________________________________________________
48void NtpMCEventRecord::PrintToStream(ostream & stream) const
49{
50 stream << this->hdr << endl;
51 stream << *this->event << endl;
52}
53//____________________________________________________________________________
54void NtpMCEventRecord::Fill(unsigned int ievent, const EventRecord * ev_rec)
55{
56 this->event->Copy(*ev_rec);
57 this->hdr.ievent = ievent;
58}
59//____________________________________________________________________________
61{
62 this->event->Copy(*ntpmcrec.event);
63 this->hdr.ievent = ntpmcrec.hdr.ievent;
64}
65//____________________________________________________________________________
67{
68 this->event = new EventRecord;
69 this->hdr.ievent = 0;
70}
71//____________________________________________________________________________
72void NtpMCEventRecord::Clear(Option_t * /*opt*/)
73{
74 delete (this->event);
75 this->event = 0;
76 this->hdr.ievent = 0;
77}
78//____________________________________________________________________________
79
80// Extracted from the code ROOT generated
81// added check-and-delete before streaming to
82// avoid memory leak
83void NtpMCEventRecord::Streamer(TBuffer &R__b) {
84 // Stream an object of class genie::NtpMCEventRecord.
85
86 UInt_t R__s, R__c;
87 if (R__b.IsReading()) {
88 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
89 if (R__v) {
90 }
91 genie::NtpMCRecordI::Streamer(R__b);
92 if (event) {
93 delete event;
94 event = nullptr;
95 }
96 R__b >> event;
97 R__b.CheckByteCount(R__s, R__c, ::genie::NtpMCEventRecord::IsA());
98 } else {
99 R__c = R__b.WriteVersion(::genie::NtpMCEventRecord::IsA(), kTRUE);
100 genie::NtpMCRecordI::Streamer(R__b);
101 R__b << event;
102 R__b.SetByteCount(R__c, kTRUE);
103 }
104}
ClassImp(NtpMCEventRecord) namespace genie
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....
void Fill(unsigned int ievent, const EventRecord *ev_rec)
void Copy(const NtpMCEventRecord &ntpmcrec)
EventRecord * event
event
void PrintToStream(ostream &stream) const
void Clear(Option_t *opt="")
unsigned int ievent
Event number.
NtpMCRecHeader hdr
record header
THE MAIN GENIE PROJECT NAMESPACE
Definition AlgCmp.h:25
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)