Create smaller CAFs. More...
#include <FileReducer.h>
Public Types | |
typedef void( | ReductionFunc )(caf::StandardRecord *) |
Public Member Functions | |
FileReducer (const std::string &wildcard, const std::string &outfile) | |
FileReducer (const std::vector< std::string > &fnames, const std::string &outfile) | |
virtual | ~FileReducer () |
void | AddSpillCut (const SpillCut &cut) |
Only copy records to the output file if they pass this cut. More... | |
void | AddSliceCut (const SliceCut &cut) |
void | SetEventList (const std::string &fname) |
If called, only events whose run/subrun/event occur in fname will be retained. More... | |
void | AddReductionStep (const std::function< ReductionFunc > &f) |
Run the specified reduction function over each event. More... | |
void | SetMetadata (const std::string &key, const std::string &val) |
Override any metadata key in the output file. More... | |
virtual void | Go () override |
Load all the registered spectra. More... | |
Protected Member Functions | |
void | HandleFile (TFile *fin, TFile *fout, TTree *&trOut, Progress *prog, long &nRecSeen, long &nRecPassed) |
void | HandleNestedTree (TFile *fout, TTree *recTree, TTree *&trOut, Progress *prog, long &nRecSeen, long &nRecPassed) |
void | HandleFlatTree (TFile *fout, TTree *recTree, TTree *&trOut, Progress *prog, long &nRecSeen, long &nRecPassed) |
void | CopyGlobalTree (TFile *fin, TFile *fout) |
void | UpdateMetadata (std::map< std::string, std::string > &meta, const std::set< std::string > &mask, const std::vector< std::string > &fnames) const |
void | Huskify (caf::StandardRecord *sr) const |
Strip all information out of this record and tag it as a husk. More... | |
Protected Member Functions inherited from ana::SpectrumLoaderBase | |
SpectrumLoaderBase (DataSource src=kBeam) | |
Component of other constructors. More... | |
SpectrumLoaderBase (const std::string &wildcard, DataSource src=kBeam) | |
Construct from a filename, wildcard, SAM definition, or SAM query. More... | |
SpectrumLoaderBase (const std::vector< std::string > &fnames, DataSource src=kBeam) | |
Construct from an explicit list of files. More... | |
SpectrumLoaderBase (SpectrumLoaderBase &&)=default | |
SpectrumLoaderBase & | operator= (SpectrumLoaderBase &&)=default |
SpectrumLoaderBase (const SpectrumLoaderBase &)=delete | |
SpectrumLoaderBase & | operator= (const SpectrumLoaderBase &)=delete |
IFileSource * | WildcardOrSAMQuery (const std::string &str) const |
Figure out if str is a wildcard or SAM query and return a source. More... | |
virtual void | RemoveSpectrum (Spectrum *) |
virtual void | RemoveReweightableSpectrum (ReweightableSpectrum *) |
int | NFiles () const |
Forwards to fFileSource. More... | |
TFile * | GetNextFile () |
virtual | ~SpectrumLoaderBase () |
virtual void | AddSpectrum (Spectrum &spect, const Var &var, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift, const Var &wei=kUnweighted) |
For use by the Spectrum constructor. More... | |
virtual void | AddSpectrum (Spectrum &spect, const MultiVar &var, const SpillCut &spillcut, const Cut &cut, const SystShifts &shift, const Var &wei=kUnweighted) |
For use by the Spectrum constructor. More... | |
virtual void | AddSpectrum (Spectrum &spect, const SpillVar &var, const SpillCut &cut, const SpillVar &wei=kSpillUnweighted) |
For use by the Spectrum constructor. More... | |
virtual void | AddSpectrum (Spectrum &spect, const SpillMultiVar &var, const SpillCut &cut, const SpillVar &wei=kSpillUnweighted) |
For use by the Spectrum constructor. More... | |
virtual void | AddReweightableSpectrum (ReweightableSpectrum &spect, const Var &var, const Cut &cut, const SystShifts &shift, const Var &wei) |
For use by the constructors of ReweightableSpectrum subclasses. More... | |
virtual void | AddReweightableSpectrum (ReweightableSpectrum &spect, const Var &var, const SpillCut &spillcut, const SliceCut &slicecut, const SystShifts &shift, const Var &wei) |
For use by the constructors of ReweightableSpectrum subclasses. More... | |
virtual bool | Gone () const |
Indicate whether or not Go has been called. More... | |
Protected Attributes | |
std::string | fOutfile |
SpillCut * | fSpillCut |
SliceCut * | fSliceCut |
std::set< std::tuple< int, int, int > > | fEventList |
std::vector< std::function < ReductionFunc > > | fReductionFuncs |
std::map< std::string, std::string > | fMetaMap |
Protected Attributes inherited from ana::SpectrumLoaderBase | |
std::string | fWildcard |
std::unique_ptr< IFileSource > | fFileSource |
DataSource | fSource |
bool | fGone |
Has Go() been called? Can't add more histograms after that. More... | |
double | fPOT |
double | fPOTFromHist |
Accumulated by calls to GetNextFile. More... | |
int | fNReadouts |
IDMap< SpillCut, IDMap < SystShifts, IDMap< Cut, IDMap< Var, IDMap < VarOrMultiVar, SpectList > > > > > | fHistDefs |
All the spectra that need to be filled. More... | |
IDMap< SpillCut, IDMap < SpillVar, IDMap < SpillVarOrMultiVar, SpectList > > > | fSpillHistDefs |
[spillcut][spillwei][spillvar] More... | |
Additional Inherited Members | |
Protected Types inherited from ana::SpectrumLoaderBase | |
typedef _VarOrMultiVar < caf::SRSliceProxy > | VarOrMultiVar |
typedef _VarOrMultiVar < caf::SRSpillProxy > | SpillVarOrMultiVar |
Create smaller CAFs.
This class produces new CAFs, removing entries that fail a cut. It also allows the event record to be edited in custom ways.
Definition at line 19 of file FileReducer.h.
typedef void( ana::FileReducer::ReductionFunc)(caf::StandardRecord *) |
Definition at line 36 of file FileReducer.h.
ana::FileReducer::FileReducer | ( | const std::string & | wildcard, |
const std::string & | outfile | ||
) |
Definition at line 32 of file FileReducer.cxx.
ana::FileReducer::FileReducer | ( | const std::vector< std::string > & | fnames, |
const std::string & | outfile | ||
) |
Definition at line 41 of file FileReducer.cxx.
|
virtual |
Definition at line 51 of file FileReducer.cxx.
|
inline |
Run the specified reduction function over each event.
Definition at line 41 of file FileReducer.h.
void ana::FileReducer::AddSliceCut | ( | const SliceCut & | cut | ) |
Definition at line 69 of file FileReducer.cxx.
void ana::FileReducer::AddSpillCut | ( | const SpillCut & | cut | ) |
Only copy records to the output file if they pass this cut.
Definition at line 58 of file FileReducer.cxx.
|
protected |
Definition at line 322 of file FileReducer.cxx.
|
overridevirtual |
Load all the registered spectra.
Implements ana::SpectrumLoaderBase.
Definition at line 95 of file FileReducer.cxx.
|
protected |
Definition at line 172 of file FileReducer.cxx.
|
protected |
Definition at line 282 of file FileReducer.cxx.
|
protected |
Do we need to include the event? Either based on the selection...
Definition at line 204 of file FileReducer.cxx.
|
protected |
Strip all information out of this record and tag it as a husk.
Definition at line 384 of file FileReducer.cxx.
void ana::FileReducer::SetEventList | ( | const std::string & | fname | ) |
If called, only events whose run/subrun/event occur in fname will be retained.
Definition at line 80 of file FileReducer.cxx.
|
inline |
|
protected |
Definition at line 342 of file FileReducer.cxx.
|
protected |
Definition at line 78 of file FileReducer.h.
|
protected |
Definition at line 83 of file FileReducer.h.
|
protected |
Definition at line 74 of file FileReducer.h.
|
protected |
Definition at line 80 of file FileReducer.h.
|
protected |
Definition at line 76 of file FileReducer.h.
|
protected |
Definition at line 75 of file FileReducer.h.