Public Member Functions | Protected Attributes | List of all members
gibuu::OnDemandRecordList Class Reference

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-02-24/EventGenerator/GiBUU/RecordList.h"

Inheritance diagram for gibuu::OnDemandRecordList:
gibuu::IRecordList

Public Member Functions

 OnDemandRecordList (const char *fname)
 
virtual ~OnDemandRecordList ()
 
const RecordGetRecord (float E) const override
 

Protected Attributes

RecordLoader fLoader
 
std::vector< std::pair< float, int > > fEnergies
 
Record fRecord
 

Detailed Description

Definition at line 78 of file RecordList.h.

Constructor & Destructor Documentation

gibuu::OnDemandRecordList::OnDemandRecordList ( const char *  fname)

Definition at line 115 of file RecordList.cxx.

References ana::assert(), om::cout, allTimeWatchdog::endl, MakeMiniprodValidationCuts::f, fEnergies, plot_validation_datamc::fname, MECModelEnuComparisons::i, and make_root_from_grid_output::tr.

116  : fLoader(fname)
117  {
118  std::cout << "Loading index to " << fname;
119 
120  TFile f(fname);
121  assert(!f.IsZombie());
122 
123  TTree* tr = (TTree*)f.Get("tr");
124  assert(tr);
125 
126  float Enu;
127  tr->SetBranchAddress("Enu", &Enu);
128 
129  const int N = tr->GetEntries();
130  fEnergies.reserve(N);
131 
132  for(int i = 0; i < N; ++i){
133  if(i%(N/8) == 0) std::cout << "." << std::flush;
134  tr->GetEntry(i);
135 
136  fEnergies.emplace_back(Enu, i);
137  } // end for i
138  std::cout << std::endl;
139 
140  std::sort(fEnergies.begin(), fEnergies.end());
141  }
std::vector< std::pair< float, int > > fEnergies
Definition: RecordList.h:88
OStream cout
Definition: OStream.cxx:6
assert(nhit_max >=nhit_nbins)
virtual gibuu::OnDemandRecordList::~OnDemandRecordList ( )
inlinevirtual

Definition at line 82 of file RecordList.h.

References gibuu::Particle::E.

82 {}

Member Function Documentation

const Record * gibuu::OnDemandRecordList::GetRecord ( float  E) const
overridevirtual

Implements gibuu::IRecordList.

Definition at line 144 of file RecordList.cxx.

References fEnergies, fLoader, fRecord, gibuu::RecordLoader::GetRecord(), it, make_pair(), and gibuu::Record::weight.

145  {
146  auto it = std::lower_bound(fEnergies.begin(), fEnergies.end(),
147  std::make_pair(E, 0));
148  if(it == fEnergies.end()) return 0;
149 
150  fRecord = fLoader.GetRecord(it->second);
151 
152  // TODO - This should really happen in convert.C
153  fRecord.weight *= fEnergies.size();
154 
155  return &fRecord;
156  }
set< int >::iterator it
std::pair< Spectrum *, CheatDecomp * > make_pair(SpectrumLoaderBase &loader_data, SpectrumLoaderBase &loader_mc, HistAxis *axis, Cut *cut, const SystShifts &shift, const Var &wei)
Definition: DataMCLoad.C:336
Float_t E
Definition: plot.C:20
std::vector< std::pair< float, int > > fEnergies
Definition: RecordList.h:88
Record GetRecord(int i) const
Definition: RecordList.cxx:68
float weight
Definition: RecordList.h:31

Member Data Documentation

std::vector<std::pair<float, int> > gibuu::OnDemandRecordList::fEnergies
protected

Definition at line 88 of file RecordList.h.

Referenced by GetRecord(), and OnDemandRecordList().

RecordLoader gibuu::OnDemandRecordList::fLoader
protected

Definition at line 86 of file RecordList.h.

Referenced by GetRecord().

Record gibuu::OnDemandRecordList::fRecord
mutableprotected

Definition at line 90 of file RecordList.h.

Referenced by GetRecord().


The documentation for this class was generated from the following files: