Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ana::NullLoader Class Reference

Dummy loader that doesn't load any files. More...

#include "/cvmfs/nova-development.opensciencegrid.org/novasoft/releases/N21-01-23/CAFAna/Core/SpectrumLoaderBase.h"

Inheritance diagram for ana::NullLoader:
ana::SpectrumLoaderBase

Public Member Functions

 NullLoader ()
 
 ~NullLoader ()
 
virtual void Go () override
 Load all the registered spectra. More...
 
void AddSpectrum (Spectrum &spect, const Var &var, const Cut &cut, const SystShifts &shift, const Var &wei=kUnweighted) override
 For use by the Spectrum constructor. More...
 
void AddSpectrum (Spectrum &spect, const MultiVar &var, const Cut &cut, const SystShifts &shift, const Var &wei=kUnweighted) override
 For use by the Spectrum constructor. More...
 
void AddSpectrum (Spectrum &spect, const NuTruthVar &var, const NuTruthCut &cut, const SystShifts &shift, const NuTruthVar &wei=kNuTruthUnweighted) override
 For use by the Spectrum constructor. More...
 
void AddSpectrum (Spectrum &spect, const NuTruthMultiVar &var, const NuTruthCut &cut, const SystShifts &shift, const NuTruthVar &wei=kNuTruthUnweighted) override
 
void AddReweightableSpectrum (ReweightableSpectrum &spect, const Var &xvar, const Var &yvar, const Cut &cut, const SystShifts &shift, const Var &wei) override
 For use by the constructors of ReweightableSpectrum subclasses. More...
 
void AccumulateExposures (const caf::SRSpillProxy *spill) override
 
void SetSpillCut (const SpillCut &cut)
 
virtual void AddSpillHistogram (TH1 *h, const SpillVar &var, const SpillCut &cut, const SpillVar &wei=kSpillUnweighted)
 Uses include counting the total POT or spills in a run. More...
 
virtual bool Gone () const
 Indicate whether or not Go has been called. More...
 
double GetWeightedPOT ()
 

Protected Member Functions

IFileSourceWildcardOrSAMQuery (const std::string &str) const
 Figure out if str is a wildcard or SAM query and return a source. More...
 
int NFiles () const
 Forwards to fFileSource. More...
 
TFile * GetNextFile ()
 Forwards to fFileSource but also accumulates POT and livetime. More...
 
WeightApplierGetSinkSCW (const SystShifts &shift, const Cut &cut, const Var &wei)
 

Protected Attributes

std::string fWildcard
 
std::unique_ptr< IFileSourcefFileSource
 
bool fGone
 Has Go() been called? Can't add more histograms after that. More...
 
double fPOT
 Accumulated by calls to GetNextFile. More...
 
double fRunPOT
 Crude measure, not including spill cuts. More...
 
double fSinglePOT
 
double fBeamNue
 
double fSingleNue
 
double fWeightedPOT
 
std::set< IRecordSink * > fSpectrumSinks
 
std::unordered_map< std::tuple< int, int, int >, WeightApplier * > fSinksSCW
 
std::unordered_map< std::pair< int, int >, CutApplier * > fSinksSC
 
std::unordered_map< int, SystApplier * > fSinksS
 
RecordMultiSink fSink
 
ExposureSource fExposureSource
 
std::list< SpillHistDeffSpillHistDefs
 
std::list< NuHistDeffNuHistDefs
 
std::unique_ptr< SpillCutfSpillCut
 Cut applied to the spill branch for every event. More...
 

Detailed Description

Dummy loader that doesn't load any files.

Useful when a loader is required for a component you want to ignore

Definition at line 239 of file SpectrumLoaderBase.h.

Constructor & Destructor Documentation

ana::NullLoader::NullLoader ( )
inline

Definition at line 242 of file SpectrumLoaderBase.h.

242 {}
ana::NullLoader::~NullLoader ( )

Definition at line 433 of file SpectrumLoaderBase.cxx.

434  {
435  }

Member Function Documentation

void ana::NullLoader::AccumulateExposures ( const caf::SRSpillProxy spill)
inlineoverridevirtual

Implements ana::SpectrumLoaderBase.

Definition at line 273 of file SpectrumLoaderBase.h.

273 {};
void ana::NullLoader::AddReweightableSpectrum ( ReweightableSpectrum spect,
const Var xvar,
const Var yvar,
const Cut cut,
const SystShifts shift,
const Var wei 
)
inlineoverridevirtual

For use by the constructors of ReweightableSpectrum subclasses.

Reimplemented from ana::SpectrumLoaderBase.

Definition at line 266 of file SpectrumLoaderBase.h.

271  {}
void ana::NullLoader::AddSpectrum ( Spectrum spect,
const Var var,
const Cut cut,
const SystShifts shift,
const Var wei = kUnweighted 
)
inlineoverridevirtual

For use by the Spectrum constructor.

Reimplemented from ana::SpectrumLoaderBase.

Definition at line 246 of file SpectrumLoaderBase.h.

250  {}
void ana::NullLoader::AddSpectrum ( Spectrum spect,
const MultiVar var,
const Cut cut,
const SystShifts shift,
const Var wei = kUnweighted 
)
inlineoverridevirtual

For use by the Spectrum constructor.

Reimplemented from ana::SpectrumLoaderBase.

Definition at line 251 of file SpectrumLoaderBase.h.

255  {}
void ana::NullLoader::AddSpectrum ( Spectrum spect,
const NuTruthVar var,
const NuTruthCut cut,
const SystShifts shift,
const NuTruthVar wei = kNuTruthUnweighted 
)
inlineoverridevirtual

For use by the Spectrum constructor.

Reimplemented from ana::SpectrumLoaderBase.

Definition at line 256 of file SpectrumLoaderBase.h.

260  {}
void ana::NullLoader::AddSpectrum ( Spectrum spect,
const NuTruthMultiVar var,
const NuTruthCut cut,
const SystShifts shift,
const NuTruthVar wei = kNuTruthUnweighted 
)
inlineoverridevirtual

Reimplemented from ana::SpectrumLoaderBase.

Definition at line 261 of file SpectrumLoaderBase.h.

265  {}
void ana::SpectrumLoaderBase::AddSpillHistogram ( TH1 *  h,
const SpillVar var,
const SpillCut cut,
const SpillVar wei = kSpillUnweighted 
)
virtualinherited
TFile * ana::SpectrumLoaderBase::GetNextFile ( )
protectedinherited

Forwards to fFileSource but also accumulates POT and livetime.

Definition at line 234 of file SpectrumLoaderBase.cxx.

References ana::SpectrumLoaderBase::AccumulateExposures(), ana::assert(), caf::SRProxySystController::BeginTransaction(), om::cout, allTimeWatchdog::endl, MakeMiniprodValidationCuts::f, ana::SpectrumLoaderBase::fBeamNue, ana::SpectrumLoaderBase::fFileSource, ana::SpectrumLoaderBase::fNuHistDefs, genie::utils::style::Format(), ana::SpectrumLoaderBase::fPOT, ana::SpectrumLoaderBase::fRunPOT, ana::SpectrumLoaderBase::fSingleNue, ana::SpectrumLoaderBase::fSinglePOT, ana::SpectrumLoaderBase::fSpillCut, ana::SpectrumLoaderBase::fSpillHistDefs, ana::SpectrumLoaderBase::fWildcard, caf::GetCAFType(), hd, findDuplicateFiles::key, caf::kFlatMultiTree, caf::kNested, getGoodRuns4SAM::n, cacheDefinitionData::prog, caf::SRProxySystController::Rollback(), ana::Progress::SetProgress(), caf_analysis::spill, caf::Proxy< caf::SRSpill >::spillpot, string, and febshutoff_auto::val.

Referenced by ana::SpectrumLoader::Go(), and ana::FileReducer::Go().

235  {
236  TFile* f = fFileSource->GetNextFile();
237  if(!f) return 0; // out of files
238 
239  if(f->IsZombie()){
240  std::cout << "Bad file (zombie): " << f->GetName() << std::endl;
241  abort();
242  }
243 
244  // Crude way to count POT, at a file level without referring to spill cuts
245  TH1* hPOT = (TH1*)f->Get("TotalPOT");
246 
247  if(!hPOT){
248  std::cout << "Bad file (no POT tree): " << f->GetName() << std::endl;
249  abort();
250  }
251 
252  fRunPOT += hPOT->Integral();
253 
254  TKey *key = f->FindKey("TotalSinglePOT");
255 
256  // Initialise and only fill these histos if they exist
257  // We know they exist for nue overlay files
258  TH1* hSinglePOT = 0;
259  TH1* hTotalTrueSingleNue = 0;
260  TH1* hTotalTrueNonswapNue = 0;
261  if(key != 0){
262  hSinglePOT = (TH1*)f->Get("TotalSinglePOT");
263  assert(hSinglePOT);
264  fSinglePOT = hSinglePOT->Integral();
265 
266  hTotalTrueNonswapNue = (TH1*)f->Get("TotalTrueNonswapNue");
267  assert(hTotalTrueNonswapNue);
268  fBeamNue = hTotalTrueNonswapNue->Integral();
269 
270  hTotalTrueSingleNue = (TH1*)f->Get("TotalTrueSingleNue");
271  assert(hTotalTrueSingleNue);
272  fSingleNue = hTotalTrueSingleNue->Integral();
273  }
274  else{
275  delete hSinglePOT;
276  delete hTotalTrueSingleNue;
277  delete hTotalTrueNonswapNue;
278  }
279 
280  TDirectory* spillDir = 0;
281  TTree* spillTree = 0;
282 
283  TObject* obj = f->Get("spillTree");
284  assert(obj); // Must exist in one form or the other
285 
286  // It might seem like you could use GetObject() to do the type-checking
287  // directly, but that method seems to have a memory leak in the case that
288  // the types don't match.
289  if(obj->ClassName() == std::string("TTree")){
290  spillTree = (TTree*)obj;
291  }
292  else{
293  spillDir = (TDirectory*)obj;
294  spillTree = (TTree*)spillDir->Get("spill");
295  assert(spillTree);
296  }
297 
298  const caf::CAFType type = caf::GetCAFType(spillDir, spillTree);
299 
300  long n = 0;
301  caf::SRSpillProxy spill(spillDir, spillTree, "spill", n, 0);
302 
303  // FloatingExceptionOnNaN fpnan;
304 
305  // With multiple files exposure counting alternates with histogram filling,
306  // but with one file they deserve to be reported as two separate steps.
307  Progress* prog = 0;
308  if(fFileSource->NFiles() == 1)
309  prog = new Progress(TString::Format("Counting exposure from 1 file matching '%s'", fWildcard.c_str()).Data());
310 
311  const int Nentries = spillTree->GetEntries();
312 
313  double totFilePOT = 0;
314 
315  for(n = 0; n < Nentries; ++n){
316  if(type != caf::kFlatMultiTree) spillTree->LoadTree(n); // for all single-tree modes
317 
318  if(!fSpillCut || (*fSpillCut)(&spill)){
320 
321  totFilePOT += spill.spillpot;
322 
323  for(const SpillHistDef& hd: fSpillHistDefs){
324  // No cut, or cut passes
325  if(hd.cut(&spill)){
326  const double wei = hd.wei(&spill);
327  if(wei){
328  const double val = hd.var(&spill);
329  hd.h->Fill(val, wei);
330  }
331  } // end if(cut passes)
332  } // end for hd
333  }
334 
335  if(prog && n%100 == 0) prog->SetProgress(double(n)/Nentries);
336  } // end for n
337 
338  // The POT we want to use is either the singles POT in case of overlay files
339  // i.e the singlepot histo exists, or the standard after spill cuts
340  // Note: must be sure to run spill cuts for the overlays otherwise this gets
341  // reset to the fRunPOT
342  if(key != 0) fPOT += fSinglePOT;
343  else fPOT += totFilePOT;
344 
345  delete prog;
346  prog = 0;
347 
348  if(!fNuHistDefs.empty()){
349  TDirectory* nuDir = 0;
350  TTree* nuTree = 0;
351 
352  TObject* obj = f->Get("nuTree");
353  assert(obj); // Must exist in one form or the other
354 
355  // It might seem like you could use GetObject() to do the type-checking
356  // directly, but that method seems to have a memory leak in the case that
357  // the types don't match.
358  if(obj->ClassName() == std::string("TTree")){
359  nuTree = (TTree*)obj;
360  }
361  else{
362  nuDir = (TDirectory*)obj;
363  nuTree = (TTree*)spillDir->Get("nu");
364  assert(nuTree);
365  }
366 
367  const caf::CAFType type = caf::GetCAFType(nuDir, nuTree);
368 
369  const int NNuEntries = nuTree->GetEntries();
370 
371  long n = 0;
372  caf::SRNeutrinoProxy nu(nuDir, nuTree, (type == caf::kNested) ? "mc.nu" : "nu", n, 0);
373 
374  if(fFileSource->NFiles() == 1)
375  prog = new Progress(TString::Format("Filling from nuTree from 1 file matching '%s'", fWildcard.c_str()).Data());
376 
377 
378  for(n = 0; n < NNuEntries; ++n){
379  if(type != caf::kFlatMultiTree) nuTree->LoadTree(n); // for all single-tree modes
380 
381  for(const NuHistDef& hd: fNuHistDefs){
383 
384  double systWeight = 1;
385  // Can special-case nominal to not pay cost of Shift()
386  if(!hd.shift.IsNominal()){
387  hd.shift.Shift(&nu, systWeight);
388  }
389 
390  if(hd.cut(&nu)){
391  const double wei = hd.wei(&nu)*systWeight;
392  if(wei){
393  if(hd.var){
394  const double val = (*hd.var)(&nu);
395  hd.spect.Fill(val, wei);
396  }
397  else{
398  for(double val: (*hd.multivar)(&nu)) hd.spect.Fill(val, wei);
399  }
400  }
401  }
402 
403  // Return SRNeutrino to its unshifted form ready for the next
404  // histogram.
406  } // end for hd
407 
408  if(prog && n%10000 == 0) prog->SetProgress(double(n)/NNuEntries);
409  } // end for n
410 
411  for(const NuHistDef& hd: fNuHistDefs) hd.spect.fPOT += totFilePOT;
412 
413  delete prog;
414  } // end if NuHistDefs
415 
416  return f;
417  }
Proxy for caf::SRNeutrino.
Definition: SRProxy.h:510
double fRunPOT
Crude measure, not including spill cuts.
CAFType GetCAFType(const TDirectory *dir, TTree *tr)
std::unique_ptr< SpillCut > fSpillCut
Cut applied to the spill branch for every event.
virtual void AccumulateExposures(const caf::SRSpillProxy *spill)=0
std::list< SpillHistDef > fSpillHistDefs
Proxy for caf::SRSpill.
Definition: SRProxy.h:1346
OStream cout
Definition: OStream.cxx:6
std::unique_ptr< IFileSource > fFileSource
assert(nhit_max >=nhit_nbins)
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
double fPOT
Accumulated by calls to GetNextFile.
std::list< NuHistDef > fNuHistDefs
TH1F * hd
Definition: Xdiff_gwt.C:57
enum BeamMode string
WeightApplier * ana::SpectrumLoaderBase::GetSinkSCW ( const SystShifts shift,
const Cut cut,
const Var wei 
)
protectedinherited

Definition at line 110 of file SpectrumLoaderBase.cxx.

References ana::RecordMultiSink::AddSink(), PandAna.Demos.tute_pid_validation::cid, ana::SpectrumLoaderBase::fSink, ana::SpectrumLoaderBase::fSinksS, ana::SpectrumLoaderBase::fSinksSC, ana::SpectrumLoaderBase::fSinksSCW, ana::SystShifts::ID(), ana::_Var< T >::ID(), and ana::_Cut< T >::ID().

Referenced by ana::SpectrumLoaderBase::AddReweightableSpectrum(), and ana::SpectrumLoaderBase::AddSpectrum().

113  {
114  const int sid = shift.ID();
115  const int cid = cut.ID();
116  const int wid = wei.ID();
117 
118  const std::pair<int, int> sc(sid, cid);
119  const std::tuple<int, int, int> scw(sid, cid, wid);
120 
121  if(fSinksS.find(sid) == fSinksS.end()){
122  SystApplier* sa = new SystApplier(shift);
123  fSinksS[sid] = sa;
124  fSink.AddSink(sa);
125  }
126  if(fSinksSC.find(sc) == fSinksSC.end()){
127  CutApplier* ca = new CutApplier(cut);
128  fSinksS[sid]->AddSink(ca);
129  fSinksSC[sc] = ca;
130  }
131  if(fSinksSCW.find(scw) == fSinksSCW.end()){
132  WeightApplier* wa = new WeightApplier(wei);
133  fSinksSC[sc]->AddSink(wa);
134  fSinksSCW[scw] = wa;
135  }
136 
137  return fSinksSCW[scw];
138  }
void AddSink(IRecordSink *s)
std::unordered_map< int, SystApplier * > fSinksS
std::unordered_map< std::pair< int, int >, CutApplier * > fSinksSC
const Cut cut
Definition: exporter_fd.C:30
std::unordered_map< std::tuple< int, int, int >, WeightApplier * > fSinksSCW
double ana::SpectrumLoaderBase::GetWeightedPOT ( )
inherited
void ana::NullLoader::Go ( )
overridevirtual

Load all the registered spectra.

Implements ana::SpectrumLoaderBase.

Definition at line 428 of file SpectrumLoaderBase.cxx.

Referenced by modularextrap_demo_nue(), and modularextrap_demo_numu().

429  {
430  }
virtual bool ana::SpectrumLoaderBase::Gone ( ) const
inlinevirtualinherited

Indicate whether or not Go has been called.

Definition at line 124 of file SpectrumLoaderBase.h.

References caf_analysis::spill, submit_syst::str, string, and wildcard().

Referenced by ana::TwoSampleDecomp::Decomp(), ana::CSVMaker::Go(), and ana::SpectrumHandler::Go().

124 {return fGone;}
bool fGone
Has Go() been called? Can&#39;t add more histograms after that.
int ana::SpectrumLoaderBase::NFiles ( ) const
protectedinherited

Forwards to fFileSource.

Definition at line 228 of file SpectrumLoaderBase.cxx.

References ana::SpectrumLoaderBase::fFileSource.

Referenced by ana::SpectrumLoader::Go(), and ana::FileReducer::Go().

229  {
230  return fFileSource->NFiles();
231  }
std::unique_ptr< IFileSource > fFileSource
void ana::SpectrumLoaderBase::SetSpillCut ( const SpillCut cut)
inherited

Definition at line 64 of file SpectrumLoaderBase.cxx.

References ana::assert(), cut, ana::SpectrumLoaderBase::fGone, ana::SpectrumLoaderBase::fSpillCut, and ana::SpectrumLoaderBase::WildcardOrSAMQuery().

Referenced by Ana2017_box_opening_macro(), Ana2017_sb_opening_macro(), Ana2018_box_opening_macro(), AnaResultsLoad(), BlessedPlotsLoad(), caf_nue_data_mc(), caf_numu_fd_validation_data(), caf_numu_fd_validation_MC(), caf_numu_fd_validation_MC_no_tau(), caf_numu_nd_cutflow(), caf_numu_nuenergy_vs_xy(), caf_numu_reco_minus_true(), caf_numu_sensitivity(), caf_numu_sensitivity_no_tau(), caf_numu_validation(), caf_numu_vars(), CalcCutVals(), compare_cos_numi(), Compare_Spectra(), ComparisonPlots_Data(), CosmicPred(), CreateAndFillSpectra(), CutFlow_Cosmic(), CutFlow_Data(), CutFlow_NearDet(), CutTableLoad(), datamc_ND_numu_kinematics(), datamc_ND_numu_kinematics_FHC(), datamc_ND_numu_kinematics_FHC_pTBins(), datamc_ND_numu_kinematics_FHC_REW(), datamc_ND_numu_kinematics_FHC_REW_pTBins(), datamc_ND_numu_kinematics_REW(), datamc_ND_numu_kinematics_RHC(), datamc_ND_numu_kinematics_RHC_pTBins(), datamc_ND_numu_kinematics_RHC_REW(), datamc_ND_numu_kinematics_RHC_REW_pTBins(), dataprocess_numuccinc(), DataVtxDistributionLoad(), demo_trivial_xsec_analysis(), drawIntensityEffect_2019(), drawLongTerm(), drawLongTerm_2019(), drawShortTerm_2019(), drawTimePlots(), drawVsPOT(), EnergyCont_macro(), energyResolution(), estimate_energy(), Evaluate_BDTMLP_Algs_Spectra(), ExampleCode(), exporter_fd(), exporter_nd(), ExtendedAxesLoad(), FD_Data_PosComp(), FDDataMC(), FDDataMCSystBandLoad(), FillSpectra(), FitSystEffectsLoad(), genie_syst_make(), get_cosmic_sample(), get_cosmic_spectra(), get_data_and_cosmic(), get_data_histogram(), get_fd_dataspectrum(), get_numi_data_histogram(), get_numu_data_histogram(), get_spectra_2dplots(), getCrossSectionAnalysis_Spectra(), getCrossSectionAnalysis_Spectra_systematics(), getCrossSectionAnalysisSpectra(), getData(), getFitTemplates(), GetHistsFD(), GetHistsND(), getSpectra_ForFitting(), getStabilitySpectra(), hadEFrac_nd_data_mc_systs(), hyperon_nom_macro(), make_DataMCComp_numu(), make_decomp(), make_michel(), make_nue_ana2018_pot(), make_nue_ana2019_epoch7d_pot(), make_nue_ana2019_epoch8b_pot(), make_nue_ana2019_fhc_ub_pot(), make_nue_ana2019_rhc_ub_pot(), make_nue_thirdana_pot(), make_numu_thirdana_pot(), make_nus17_pot(), make_pi0_xcheck(), make_pid(), make_quantiles_histogram_2020(), make_RHC_WrongSign_Nue(), make_RHC_WrongSign_Numu_MC(), make_RHC_WrongSign_Numu_Pd4_6Data(), make_RHC_WrongSign_Numu_Pd7dData(), make_RHC_WrongSign_Numu_Pd8Data(), make_RHC_WrongSign_NumuQ1(), make_RHC_WrongSign_NumuQ2(), make_RHC_WrongSign_NumuQ3(), make_RHC_WrongSign_NumuQ4(), make_rhcpred_2017(), make_rockpred_2017(), make_xsec_tuning_hists_mp5(), make_xsec_wgts_2018_hists(), MakeCosmics(), MakeNus17CosBkgd(), MakeNus17Prediction(), MakeNus18CosBkgd(), MakeNus18ExtrapPred(), MakeNus18SidebandPred(), MakeNusPrediction(), ana::MakeQuantileHistogram(), ana::MakeTextListFileHelper(), MakeUnoscPlots(), mrbrem_get_initial_spectra(), mrbrem_get_reweighted_spectra(), MRDiFStudy_FHC_Step1(), MRDiFStudy_FHC_Step2(), MRDiFStudy_RHC_Step1(), MRDiFStudy_RHC_Step2(), mre_blessed(), mre_comp_split(), ND_DataMC(), ND_DataMC_Comp_Systs(), NDDataMC(), NDDataMCSystBandLoad(), neutKEsyst(), neutronE_macro(), nue_data_mc_validation(), nue_decomp_scales(), nue_fd_mc_validation(), nue_michelDataMC(), NuMu2019_BasicPIDPlots_ND(), NuMu2019_BasicPIDPlots_Spectrum(), NuMu2020_BasicPIDPlots_FD(), NuMu2020_BasicPIDPlots_ND(), NuMu2020_BasicPIDPlots_Spectrum(), NuMu2020_TrimCAFs(), numu_cut_flow(), numu_data_mc_validation(), numu_validation_numuvars(), NumuCosmic(), nus17_box_opening(), nus17_fd_cut_tables(), nus17_fd_cut_tables2D(), nus17_fiducial_accounting(), nus18_box_opening(), nus_ana01_box_opening(), nus_ana01_sideband_box_opening(), pi0_xcheck(), PositionComparison(), ppfx_make_systs(), ppfx_smooth_weights_save(), preselection_cutflow(), resolutionscript(), resolutionspectrums(), rock(), saveSpectraForUnf(), sidebandfittest(), SideBandLoad(), signal_count(), specprod_numuccinc(), specprod_systematics(), Syst(), SystematicComp(), SystsBirksLoad(), SystsCalibAbsLoad(), SystsCalibAbsLoad17(), SystsCalibAbsMethod17(), SystsCalibRelLoad(), SystsCalibRelLoad17(), SystsNoiseLoad(), SystsPPFXLoad17(), test_genieweights(), test_predictionscalecomp(), test_xsecanalysis(), TrimCAFs(), uncertainty1png(), uncertainty2png(), and validation_numu_nd().

65  {
66  assert(!fGone);
67  fSpillCut = std::make_unique<SpillCut>(cut);
68  }
bool fGone
Has Go() been called? Can&#39;t add more histograms after that.
std::unique_ptr< SpillCut > fSpillCut
Cut applied to the spill branch for every event.
const Cut cut
Definition: exporter_fd.C:30
assert(nhit_max >=nhit_nbins)
IFileSource * ana::SpectrumLoaderBase::WildcardOrSAMQuery ( const std::string str) const
protectedinherited

Figure out if str is a wildcard or SAM query and return a source.

Definition at line 72 of file SpectrumLoaderBase.cxx.

References e, cet::getenv(), MECModelEnuComparisons::i, ProjMan::ifdh, ana::Limit(), ana::FileListSource::NFiles(), ana::Offset(), runNovaSAM::ret, and ana::Stride().

Referenced by ProducingSA(), ana::SpectrumLoaderBase::SetSpillCut(), ana::SpectrumLoaderBase::SpectrumLoaderBase(), and useBDTG().

73  {
74  // stat() blows up on strings with spaces
75  if(str.find(' ') == std::string::npos){
76  WildcardSource* ret = new WildcardSource(str, Stride(), Offset(), Limit());
77  if(ret->NFiles() > 0) return ret;
78  delete ret;
79  }
80 
81  // Maybe this the name of a SAM project?
82  {
83  IFDHSilent silent; // the usual case is for this to fail
85 
86  // findProject always gives back an address just by gluing bits together.
87  // (a tad annoying, because it _does_ go and look for the project,
88  // and even would print its 'didn't-find-this-project' error out to stderr
89  // if not for the IFDHSilent, but without scraping its stderr
90  // there's no way to know whether the project is there or not--
91  // you still get the URL.)
92  // however, the WebAPI call looking for the /status will return a 404 if
93  // the project doesn't exist. (suggested by Robert I. in INC000000925362.)
94  try
95  {
96  ifdh_util_ns::WebAPI webapi(i.findProject(str, getenv("SAM_STATION")) + "/status");
97  return new SAMProjectSource(str);
98  }
99  catch (ifdh_util_ns::WebAPIException &e)
100  {
101  ;
102  }
103  }
104 
105  // Maybe this is a SAM dataset or query?
106  return new SAMQuerySource(str, Stride(), Offset(), Limit());
107  }
int Limit()
Value passed to –limit, or -1 if not specified.
Definition: Utilities.cxx:420
std::string getenv(std::string const &name)
size_t Stride(bool allow_default)
Value passed to –stride, or 1 if not specified.
Definition: Utilities.cxx:372
ifdh
Definition: ProjMan.py:8
size_t Offset(bool allow_default)
Value passed to –offset, or 0 if not specified.
Definition: Utilities.cxx:396
Float_t e
Definition: plot.C:35

Member Data Documentation

double ana::SpectrumLoaderBase::fBeamNue
protectedinherited
ExposureSource ana::SpectrumLoaderBase::fExposureSource
protectedinherited
std::unique_ptr<IFileSource> ana::SpectrumLoaderBase::fFileSource
protectedinherited
bool ana::SpectrumLoaderBase::fGone
protectedinherited
std::list<NuHistDef> ana::SpectrumLoaderBase::fNuHistDefs
protectedinherited
double ana::SpectrumLoaderBase::fPOT
protectedinherited

Accumulated by calls to GetNextFile.

Definition at line 160 of file SpectrumLoaderBase.h.

Referenced by ana::SpectrumLoaderBase::GetNextFile(), and ana::SpectrumLoaderBase::GetWeightedPOT().

double ana::SpectrumLoaderBase::fRunPOT
protectedinherited

Crude measure, not including spill cuts.

Definition at line 161 of file SpectrumLoaderBase.h.

Referenced by ana::SpectrumLoaderBase::GetNextFile(), ana::SpectrumLoader::Go(), and DecTreeLoader::HandlePOT().

double ana::SpectrumLoaderBase::fSingleNue
protectedinherited
double ana::SpectrumLoaderBase::fSinglePOT
protectedinherited
RecordMultiSink ana::SpectrumLoaderBase::fSink
protectedinherited
std::unordered_map<int, SystApplier*> ana::SpectrumLoaderBase::fSinksS
protectedinherited
std::unordered_map<std::pair<int, int>, CutApplier*> ana::SpectrumLoaderBase::fSinksSC
protectedinherited
std::unordered_map<std::tuple<int, int, int>, WeightApplier*> ana::SpectrumLoaderBase::fSinksSCW
protectedinherited
std::set<IRecordSink*> ana::SpectrumLoaderBase::fSpectrumSinks
protectedinherited
std::unique_ptr<SpillCut> ana::SpectrumLoaderBase::fSpillCut
protectedinherited
std::list<SpillHistDef> ana::SpectrumLoaderBase::fSpillHistDefs
protectedinherited
double ana::SpectrumLoaderBase::fWeightedPOT
protectedinherited

Definition at line 166 of file SpectrumLoaderBase.h.

Referenced by ana::SpectrumLoaderBase::GetWeightedPOT().

std::string ana::SpectrumLoaderBase::fWildcard
protectedinherited

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