CacheBranchNtp.cxx
Go to the documentation of this file.
1 //____________________________________________________________________________
2 /*
3  Copyright (c) 2003-2020, The GENIE Collaboration
4  For the full text of the license visit http://copyright.genie-mc.org
5 
6  Costas Andreopoulos <constantinos.andreopoulos \at cern.ch>
7  University of Liverpool & STFC Rutherford Appleton Laboratory
8 */
9 //____________________________________________________________________________
10 
11 #include <TNtupleD.h>
12 
14 
15 using namespace genie;
16 
18 
19 //____________________________________________________________________________
20 namespace genie
21 {
22  ostream & operator << (ostream & stream, const CacheBranchNtp & cbntp)
23  {
24  cbntp.Print(stream);
25  return stream;
26  }
27 }
28 //____________________________________________________________________________
31 {
32  this->Init();
33 }
34 //____________________________________________________________________________
35 CacheBranchNtp::CacheBranchNtp(string name, string branch_def) :
37 {
38  this->Init();
39  this->CreateNtuple(name, branch_def);
40 }
41 //____________________________________________________________________________
43 {
44  this->CleanUp();
45 }
46 //____________________________________________________________________________
48 {
49  fNtp = 0;
50 }
51 //____________________________________________________________________________
53 {
54  if(fNtp) delete fNtp;
55 }
56 //____________________________________________________________________________
58 {
59  this->CleanUp();
60  this->Init();
61 }
62 //____________________________________________________________________________
63 void CacheBranchNtp::CreateNtuple(string name, string branch_def)
64 {
65  this->Reset();
66 
67  fNtp = new TNtupleD(name.c_str(), "CacheBranchNtp", branch_def.c_str());
68  fNtp->SetDirectory(0);
69  fNtp->SetCircular(1600000);
70 }
71 //____________________________________________________________________________
72 void CacheBranchNtp::Print(ostream & stream) const
73 {
74  if(fNtp) {
75  stream << "type: [CacheBranchNtp] - nentries: " << fNtp->GetEntries();
76  } else {
77  stream << " *** NULL ***";
78  }
79 }
80 //____________________________________________________________________________
81 TNtupleD * CacheBranchNtp::operator () (void) const
82 {
83  return this->Ntuple();
84 }
85 //____________________________________________________________________________
static QCString name
Definition: declinfo.cpp:673
THE MAIN GENIE PROJECT NAMESPACE
Definition: AlgCmp.h:25
TNtupleD * operator()(void) const
void CreateNtuple(string name, string branch_def)
ClassImp(CacheBranchNtp)
void Print(ostream &stream) const
ostream & operator<<(ostream &stream, const AlgConfigPool &config_pool)
A simple cache branch storing the cached data in a TNtuple.
TNtupleD * Ntuple(void) const
The TObject at the root of concrete cache branches.
Definition: CacheBranchI.h:25