FileReducer.cxx
Go to the documentation of this file.
2 
3 #include "CAFAna/Core/Progress.h"
5 
7 
10 
11 #include <cassert>
12 #include <iostream>
13 
14 #include <fenv.h>
15 
16 #include "TChain.h"
17 #include "TFile.h"
18 #include "TH2.h"
19 #include "TTree.h"
20 
21 
22 namespace ana
23 {
24  //----------------------------------------------------------------------
26  {
27  sr->mc.allnus.clear();
28  sr->mc.nallnus = 0;
29 
30  sr->mc.allcosmics.clear();
31  sr->mc.nallcosmics = 0;
32  }
33 
34  //----------------------------------------------------------------------
36  {
37  for(caf::SRNeutrino& nu: sr->mc.nu) nu.prim.clear();
38  for(caf::SRNeutrino& nu: sr->mc.allnus) nu.prim.clear();
39  }
40 
41  //----------------------------------------------------------------------
43  {
44  for(caf::SRNeutrino& nu: sr->mc.nu) nu.michel.clear();
45  for(caf::SRNeutrino& nu: sr->mc.allnus) nu.michel.clear();
46  }
47 
48  //----------------------------------------------------------------------
49  // void ClearRemidMuID(caf::StandardRecord* sr)
50  // {
51  // sr->sel.remid.muid.clear();
52  // sr->sel.remid.nmuid = 0;
53  // }
54 
55  //----------------------------------------------------------------------
57  {
58  // Have always been included in decaf cuts
59  ClearMultiNuInfo(sr);
60 
61  // nu.prim
62  ClearPrimaryInfo(sr);
63 
64  // Numu-specific
65  ClearTrackInfo(sr);
66  // ClearRemidMuID(sr);
67  ResetNumuEnergy(sr);
68  ResetBPFEnergy(sr);
69  // ResetContainInfo(sr);
70 
71  // Nue-specific but marginal
73  Clear2DProngInfo(sr);
74  ResetRVPInfo(sr);
75  //ClearShowerLIDEnergyInfo(sr);
76  //ClearSecondaryShowerLIDPIDInfo(sr);
77  }
78 
79  //----------------------------------------------------------------------
81  {
82  // Have always been included in decaf cuts
83  ClearMultiNuInfo(sr);
84 
85  // nu.prim
86  //ClearPrimaryInfo(sr);
87 
89  ResetBeamInfo(sr);
90 
91  // Numu-specific
92  ClearTrackInfo(sr);
93  // ClearRemidMuID(sr);
94  ResetNumuEnergy(sr);
95  ResetBPFEnergy(sr);
96  ResetContainInfo(sr);
97 
98  // Nue-specific but marginal
100  Clear2DProngInfo(sr);
101  ResetRVPInfo(sr);
102  // ClearShowerLIDEnergyInfo(sr);
103  // ClearSecondaryShowerLIDPIDInfo(sr);
104  ResetLEMInfo(sr);
105  ResetNueEnergyInfo(sr);
106 
107  }
108 
109  //----------------------------------------------------------------------
111  {
112  ClearMultiNuInfo(sr);
113  ClearPrimaryInfo(sr);
115 
116  sr->trk.kalman.tracks2d.clear();
117  sr->trk.kalman.ntracks2d = 0;
118 
121 
122  // ClearShowerLIDRecoInfo(sr);
124  // ClearShowerLIDPIDInfo(sr);
125  // ClearShowerLIDEnergyInfo(sr);
126 
127  ResetLEMInfo(sr);
128  // ResetLIDInfo(sr);
129  ResetRVPInfo(sr);
130  // ResetNueCosRejInfo(sr);
131  ResetNueEnergyInfo(sr);
132 
134 
135  ResetBeamInfo(sr);
136 
137  // todo if worth effort: energy.numusimp.hadclus
138  }
139 
140  //----------------------------------------------------------------------
142  {
143  for(caf::SRNeutrino& nu: sr->mc.nu) {
144  nu.rwgt.genie.clear();
146  }
147  }
148 
149  //----------------------------------------------------------------------
151  {
152  sr->trk.kalman.tracks.clear();
153  sr->trk.kalman.ntracks = 0;
154 
155  sr->trk.kalman.tracks2d.clear();
156  sr->trk.kalman.ntracks2d = 0;
157  }
158 
159  //----------------------------------------------------------------------
161  {
162  sr->trk.cosmic.tracks.clear();
163  sr->trk.cosmic.ntracks = 0;
164  }
165 
166  //----------------------------------------------------------------------
168  {
169  sr->trk.window.tracks.clear();
170  sr->trk.window.ntracks = 0;
171  }
172 
173  //----------------------------------------------------------------------
175  {
176  sr->trk.discrete.tracks.clear();
177  sr->trk.discrete.ntracks = 0;
178  }
179 
180  //----------------------------------------------------------------------
182  {
183  // ClearKalmanInfo(sr);
184  sr->trk.kalman.tracks.clear();
185  sr->trk.kalman.ntracks = 0;
186  sr->trk.kalman.tracks2d.clear();
187  sr->trk.kalman.ntracks2d = 0;
191  }
192 
193  //----------------------------------------------------------------------
194  void ClearSecondaryTrackInfo(caf::StandardRecord* sr) // the stuff we never use
195  {
196  sr->trk.kalman.tracks2d.clear();
197  sr->trk.kalman.ntracks2d = 0;
200  }
201 
202  //----------------------------------------------------------------------
203  // void ClearShowerLIDRecoInfo(caf::StandardRecord* sr)
204  // {
205  // sr->shw.shwlid.clear();
206  // sr->shw.nshwlid = 0;
207  // }
208 
209  //----------------------------------------------------------------------
210  // void ClearShowerLIDPIDInfo(caf::StandardRecord* sr)
211  // {
212  // sr->sel.elecid.shwlid.clear();
213  // sr->sel.elecid.nshwlid = 0;
214  // }
215 
216  //----------------------------------------------------------------------
217  // void ClearSecondaryShowerLIDPIDInfo(caf::StandardRecord* sr)
218  // {
219  // if(sr->sel.elecid.nshwlid > 1){
220  // sr->sel.elecid.shwlid.resize(1);
221  // sr->sel.elecid.nshwlid = 1;
222  // }
223  // }
224 
225  //----------------------------------------------------------------------
226  // void ClearShowerLIDEnergyInfo(caf::StandardRecord* sr)
227  // {
228  // sr->energy.shwlid.clear();
229  // sr->energy.nshwlid = 0;
230 
231  // sr->energy.shwlid.clear();
232  // sr->energy.nshwlid = 0;
233  // }
234 
235  //----------------------------------------------------------------------
236 
238  {
239  sr->vtx.elastic = caf::SRElastic();
240  sr->vtx.elastic.IsValid = false;
241  }
242 
243  //----------------------------------------------------------------------
245  {
246 
247  sr->vtx.elastic.fuzzyk.png.clear();
248  sr->vtx.elastic.fuzzyk.npng = 0;
249 
250  sr->vtx.elastic.fuzzyk.png2d.clear();
251  sr->vtx.elastic.fuzzyk.npng2d = 0;
252 
253  }
254 
255  //----------------------------------------------------------------------
257  {
258 
259  sr->vtx.elastic.fuzzyk.png2d.clear();
260  sr->vtx.elastic.fuzzyk.npng2d = 0;
261 
262  }
263 
264  //----------------------------------------------------------------------
266  {
267  sr->vtx.hough.clear();
268  sr->vtx.nhough = 0;
269  }
270 
271  //----------------------------------------------------------------------
273  {
274  for(caf::SRNeutrino& nu: sr->mc.nu) nu.beam = caf::SRBeam();
275  for(caf::SRNeutrino& nu: sr->mc.allnus) nu.beam = caf::SRBeam();
276  }
277 
278  //----------------------------------------------------------------------
280  {
281  sr->energy.numu = caf::SRNumuEnergy();
282  }
283 
284  //----------------------------------------------------------------------
286  {
288  }
289 
290  //----------------------------------------------------------------------
292  {
293  sr->sel.lem = caf::SRLem();
294  }
295 
296  //----------------------------------------------------------------------
298  {
299  sr->sel.lid = caf::SRELid();
300  }
301 
302  //----------------------------------------------------------------------
304  {
305  sr->sel.rvp = caf::SRRvp();
306  }
307 
308  //----------------------------------------------------------------------
310  {
311  sr->sel.cosrej = caf::SRCosRej();
312  }
313 
314  //----------------------------------------------------------------------
316  {
318  }
319 
320  //----------------------------------------------------------------------
322  {
323  sr->sel.contain = caf::SRContain();
324  }
325 
326  //----------------------------------------------------------------------
328  {
329  sr->energy.nue = caf::SRNueEnergy();
330  }
331 
332  //----------------------------------------------------------------------
334  const std::string& outfile,
335  const bool copyNuTree)
336  : SpectrumLoaderBase(wildcard),
337  fOutfile(outfile),
338  fEventCut(nullptr),
339  fNuTruthCut(nullptr),
340  fOmitBadFiles(true),
341  fCopyMetadata(true),
342  fCopyNuTree(copyNuTree)
343  {
344  }
345 
346  //----------------------------------------------------------------------
347  FileReducer::FileReducer(const std::vector<std::string>& fnames,
348  const std::string& outfile,
349  const bool copyNuTree)
350  : SpectrumLoaderBase(fnames),
351  fOutfile(outfile),
352  fEventCut(nullptr),
353  fNuTruthCut(nullptr),
354  fOmitBadFiles(true),
355  fCopyMetadata(true),
356  fCopyNuTree(copyNuTree)
357  {
358  }
359 
360  //----------------------------------------------------------------------
362  {
363  if(fEventCut) delete fEventCut;
364  if(fNuTruthCut) delete fNuTruthCut;
365  }
366 
367  //----------------------------------------------------------------------
369  {
370  if(fEventCut){
371  *fEventCut = *fEventCut && cut;
372  }
373  else{
374  fEventCut = new Cut(cut);
375  }
376  }
377 
378  //----------------------------------------------------------------------
380  {
381  if(fNuTruthCut){
382  *fNuTruthCut = *fNuTruthCut && cut;
383  }
384  else{
385  fNuTruthCut = new NuTruthCut(cut);
386  }
387  }
388 
389  //----------------------------------------------------------------------
391  {
392  FILE* f = fopen(fname.c_str(), "r");
393  assert(f);
394 
395  while(!feof(f)){
396  int run, subrun, event;
397  fscanf(f, "%d %d %d", &run, &subrun, &event);
398  fEventList.insert(std::make_tuple(run, subrun, event));
399  }
400 
401  fclose(f);
402  }
403 
404  //----------------------------------------------------------------------
406  {
407  // FloatingExceptionOnNaN fpnan;
408 
409  // Don't want overflow to happen. Set to 1 petabyte: effectively infinite.
410  TTree::SetMaxTreeSize(1e15);
411 
412  if(fGone){
413  std::cerr << "Error: can only call Go() once on a FileReducer" << std::endl;
414  abort();
415  }
416  fGone = true;
417 
418  const int Nfiles = NFiles();
419 
420  Progress* prog = 0;
421 
422  TFile fout(fOutfile.c_str(), "RECREATE");
423  TTree* trOut = new TTree("recTree", "recTree");
424  TTree* spillOut = new TTree("spillTree", "spillTree");
425  TTree* nuOut = new TTree("nuTree", "nuTree");
426  {
427  // FloatingExceptionOnNaN fpnan(false);
429  trOut->Branch("rec", &dummy);
430  caf::SRSpill dummySpill;
431  spillOut->Branch("spill", &dummySpill);
432  caf::SRSpillTruthBranch dummyNu;
433  nuOut->Branch("mc", &dummyNu);
434  }
435 
436  TH1* hPOTOut = new TH1F("TotalPOT", "", 1, 0, 1);
437  TH1* hEventsOut = new TH1F("TotalEvents", "", 1, 0, 1);
438  TH1* hLivetimeOut = new TH1F("TotalLivetime", "", 1, 0, 1);
439 
440  std::vector<std::string> fnames;
441 
442  std::map<std::string, std::string> meta;
443  std::set<std::string> meta_mask;
444 
445  caf::StandardRecord* oldsr = 0;
446 
447  long nRecSeen = 0;
448  long nRecPassed = 0;
449  long nNuSeen = 0;
450  long nNuPassed = 0;
451 
452  int fileIdx = -1;
453  while(TFile* f = GetNextFile()){
454  ++fileIdx;
455 
456  if(fOmitBadFiles){
457  if(f->IsZombie()) continue;
458  }
459  else{
460  assert(!f->IsZombie());
461  }
462 
463  TH1* hPOT = (TH1*)f->Get("TotalPOT");
464  if(fOmitBadFiles && !hPOT) continue;
465 
466  assert(hPOT);
467  hPOTOut->Add(hPOT);
468 
469  fnames.push_back(f->GetName());
470 
471  if(fCopyMetadata){
472  TDirectory* meta_dir = (TDirectory*)f->Get("metadata");
473  assert(meta_dir);
474  CombineMetadata(meta, GetCAFMetadata(meta_dir), meta_mask);
475  }
476 
477  TH1* hEvents = (TH1*)f->Get("TotalEvents");
478  assert(hEvents);
479  hEventsOut->Add(hEvents);
480 
481  TH1* hLivetime = (TH1*)f->Get("TotalLivetime");
482  assert(hLivetime);
483  hLivetimeOut->Add(hLivetime);
484 
485  TTree* recTree = (TTree*)f->Get("recTree");
486  assert(recTree);
487 
488  // Use this one for assessing cuts etc
489  caf::SRProxy srProxy(0, recTree, "rec", 0, 0);
490 
491  // And if they pass load into this one for writing out
492  caf::StandardRecord* sr = 0;
493  recTree->SetBranchAddress("rec", &sr);
494 
495  const int Nentries = recTree->GetEntries();
496  for(int n = 0; n < Nentries; ++n){
497  ++nRecSeen;
498  recTree->LoadTree(n);
499 
500  /// TODO potentially reenable systematically shifts via FileReducer
501  // Restorer restorer;
502  // double weight = 1;
503  // fSystShifts.Shift(restorer, sr, weight);
504  // if(weight != 1){
505  // std::cerr << "Warning: cannot apply weighting shift with FileReducer. Event's weight will be unaltered." << std::endl;
506  // }
507 
508  // First up, check this spill passes the global quality cuts
509  if(fSpillCut && !(*fSpillCut)(&srProxy.spill)) continue;
510 
511  // Apply EventList cut if it's been enabled
512  if(!fEventList.empty() &&
513  !fEventList.count(std::make_tuple(srProxy.hdr.run,
514  srProxy.hdr.subrun,
515  srProxy.hdr.evt))) continue;
516 
517  /// see if we want to omit the event
518  if(!fEventCut || (*fEventCut)(&srProxy)){
519  recTree->GetEntry(n);
520 
521  if(sr != oldsr){
522  trOut->SetBranchAddress("rec", &sr);
523  oldsr = sr;
524  }
525 
526  // Apply any additional reduction steps
527  for(const auto & f: fReductionFuncs) f(sr);
528  for(const auto & f: fReductionFuncsWithProxy) f(sr, &srProxy);
529 
530  ++nRecPassed;
531  trOut->Fill();
532  }
533 
534  if(Nfiles >= 0 && !prog) prog = new Progress(TString::Format("Filling from %d files matching '%s'", Nfiles, fWildcard.c_str()).Data());
535 
536  if(n%1000 == 0 && Nfiles == 1 && prog)
537  prog->SetProgress(double(n)/Nentries);
538  } // end for n
539 
540  // Copy over all the spillTree variables without modification
541  TTree* spillTree = (TTree*)f->Get("spillTree");
542  assert(spillTree);
543  spillTree->SetBranchStatus("*", 1);
545  caf::SRSpill* pspill = &spill;
546  spillTree->SetBranchAddress("spill", &pspill);
547  spillOut->SetBranchAddress("spill", &pspill);
548  caf::SRSpillProxy spillProxy(0, spillTree, "spill", 0, 0);
549  const int NspillEntries = spillTree->GetEntries();
550  for(int n = 0; n < NspillEntries; ++n){
551  spillTree->GetEntry(n);
552  spillTree->LoadTree(n);
553  for(const auto & f: fSpillReductionFuncs) f(pspill, &spillProxy);
554  spillOut->Fill();
555  }
556 
557  // Copy over all the nuTree variables without modification, unless spilltruthcuts are applied
558  TTree* nuTree = (TTree*)f->Get("nuTree");
559  if(nuTree && fCopyNuTree){
560  nuTree->SetBranchStatus("*", 1);
562  caf::SRSpillTruthBranch* pnu = &nu;
563  nuTree->SetBranchAddress("mc", &pnu);
564  nuOut->SetBranchAddress("mc", &pnu);
565 
566 
567  caf::SRNeutrinoProxy neutrinoProxy(0, nuTree, "mc.nu", 0, 0);
568  const int NNuEntries = nuTree->GetEntries();
569 
570  for(int n = 0; n < NNuEntries; ++n){
571  ++nNuSeen;
572  nuTree->LoadTree(n);
573 
574  if(!fNuTruthCut || (*fNuTruthCut)(&neutrinoProxy)){
575 
576  nuTree->GetEntry(n);
577  for(const auto & f: fNuTruthReductionFuncs) f(pnu, &neutrinoProxy);
578  ++nNuPassed;
579  nuOut->Fill();
580  }
581  }
582  }
583 
584  if(prog) prog->SetProgress((fileIdx+1.)/Nfiles);
585  } // end while GetNextFile
586 
587  fout.cd();
588  trOut->Write();
589  spillOut->Write();
590  if(nuOut->GetEntries() > 0) nuOut->Write();
591  hPOTOut->Write();
592  hEventsOut->Write();
593  hLivetimeOut->Write();
594 
595  UpdateMetadata(meta, meta_mask, fnames);
596  WriteCAFMetadata(fout.mkdir("metadata"), meta);
597 
598  fout.Close();
599 
600  if(prog){
601  prog->Done();
602  delete prog;
603  }
604 
605  std::cout << "Passed " << nRecPassed << " / " << nRecSeen << " records";
606  if(fCopyNuTree) std::cout << " and " << nNuPassed << " / " << nNuSeen << " from the nuTree";
607  std::cout << std::endl;
608  }
609 
610  //----------------------------------------------------------------------
611  void FileReducer::UpdateMetadata(std::map<std::string, std::string>& meta,
612  const std::set<std::string>& mask,
613  const std::vector<std::string>& fnames) const
614  {
615  for(const std::string& m: mask){
616  std::cerr << "Warning: metadata parameter '" << m << "' differs between input files and has been dropped from the output." << std::endl;
617  meta.erase(m);
618  }
619 
620  // change caf -> decaf in the metadata field,
621  // if we actually reduced anything
622  // and if parents have data_tier
623  if ( (!fReductionFuncs.empty() || !fReductionFuncsWithProxy.empty() || !fSpillReductionFuncs.empty() || !fNuTruthReductionFuncs.empty())
624  && meta.find("data_tier") != meta.end())
625  {
626  std::string decaf_tier = meta["data_tier"];
627  assert(decaf_tier.size() >= 3);
628  assert(decaf_tier.substr(decaf_tier.size()-3,3) == "caf");
629  // don't make 'decaf' into 'dedecaf', however
630  if (decaf_tier.size() < 5 || decaf_tier.substr(decaf_tier.size()-5,5) != "decaf")
631  decaf_tier.replace(decaf_tier.size()-3,3,"decaf");
632  meta["data_tier"] = decaf_tier;
633  }
634 
635  const char* rel = getenv("SRT_BASE_RELEASE");
636  if(rel) meta["decaf.base_release"] = rel;
637 
638  std::string parents = "[";
639  for(const std::string& f: fnames){
640  parents += "{\"file_name\":\""+std::string(basename((char *)f.c_str()))+"\"},";
641  }
642  if(parents[parents.size()-1] == ',') parents.resize(parents.size()-1);
643  parents += "]";
644 
645  meta["parents"] = parents;
646 
647  // if there's one more than one parent, this is a concat.
648  // then we need "sumcaf", "sumdecaf", etc. as appropriate
649  if (fnames.size() > 1 && meta.find("data_tier") != meta.end())
650  {
651  auto & tier = meta["data_tier"];
652  // if it ends with 'caf' and doesn't start with 'sum',
653  // it should now start with 'sum'
654  if (tier.substr(tier.size()-3, 3) == "caf" && tier.substr(0, 3) != "sum")
655  tier = "sum" + tier;
656  }
657 
658  // Allow user to override any metadata
659  for(auto it: fMetaMap) meta[it.first] = it.second;
660  }
661 
662 } // namespace
Information about the neutrino production. Docs from http://www.hep.utexas.edu/~zarko/wwwgnumi/v19/v1...
Definition: SRBeam.h:14
caf::Proxy< caf::SRSpill > spill
Definition: SRProxy.h:2143
void ReduceForNusDecaf(caf::StandardRecord *sr)
Definition: FileReducer.cxx:80
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
void ClearDiscreteTrackInfo(caf::StandardRecord *sr)
set< int >::iterator it
SRBeam beam
Information about neutrino production.
Definition: SRNeutrino.h:93
void ClearTrackInfo(caf::StandardRecord *sr)
std::string fOutfile
Definition: FileReducer.h:119
void ResetCosRejInfo(caf::StandardRecord *sr)
void ClearSecondaryTrackInfo(caf::StandardRecord *sr)
TFile * GetNextFile()
Forwards to fFileSource but also accumulates POT and livetime.
caf::Proxy< unsigned int > subrun
Definition: SRProxy.h:254
std::vector< SRProng > png2d
Vector of 2D prong objects.
Definition: SRFuzzyK.h:20
SRCosRej cosrej
Output from CosRej (Cosmic Rejection)
Definition: SRIDBranch.h:47
void ReduceForNumuDecaf(caf::StandardRecord *sr)
NuTruthCut * fNuTruthCut
Definition: FileReducer.h:121
bool fGone
Has Go() been called? Can&#39;t add more histograms after that.
size_t ntracks
Definition: SRKalman.h:23
Proxy for caf::SRNeutrino.
Definition: SRProxy.h:510
void ResetBeamInfo(caf::StandardRecord *sr)
caf::Proxy< caf::SRHeader > hdr
Definition: SRProxy.h:2137
std::vector< SRFuzzyKProng > png
Vector of 3D prong objects.
Definition: SRFuzzyK.h:19
Proxy for caf::StandardRecord.
Definition: SRProxy.h:2126
std::vector< SRCosmic > allcosmics
vector holding all Cosmics
Definition: SRTruthBranch.h:29
std::vector< SRTrueParticle > prim
Primary daughters, lepton comes first in vector.
Definition: SRNeutrino.h:84
SRMCReweight rwgt
Definition: SRNeutrino.h:91
void CombineMetadata(std::map< std::string, std::string > &base, const std::map< std::string, std::string > &add, std::set< std::string > &mask)
base += add
Definition: Utilities.cxx:251
Truth info for all neutrinos in the spill.
OStream cerr
Definition: OStream.cxx:7
SRTrackBase discrete
3D tracks produced by DiscreteTrack
Definition: SRTrackBranch.h:25
Reweight information for flux systematic.
Definition: SRFluxWeights.h:12
size_t ntracks2d
Definition: SRKalman.h:24
Output from Cosmic Rejection (CosRej) module.
Definition: SRCosRej.h:8
SRNueEnergy nue
Nue energy variables.
std::vector< SRHoughVertex > hough
Vector of vertices found by HoughVertex.
void AddNuTruthCut(const NuTruthCut &cut)
Only copy nuTree neutrinos to the output file if they pass this cut.
SRRvp rvp
Output from RecoVariablePID (RVP)
Definition: SRIDBranch.h:46
_Cut< caf::SRNeutrinoProxy > NuTruthCut
Cut designed to be used over the nuTree, ie all neutrinos, not just those that got slices...
Definition: Cut.h:104
caf::Proxy< unsigned int > run
Definition: SRProxy.h:248
The SRNeutrino is a representation of neutrino interaction information.
Definition: SRNeutrino.h:21
std::unique_ptr< SpillCut > fSpillCut
Cut applied to the spill branch for every event.
fclose(fg1)
void ResetRVPInfo(caf::StandardRecord *sr)
short nallcosmics
Number of cosmics in allcosmics vector.
Definition: SRTruthBranch.h:40
FileReducer(const std::string &wildcard, const std::string &outfile, const bool copyNuTree=false)
SRKalman kalman
Tracks produced by KalmanTrack.
Definition: SRTrackBranch.h:24
size_t nhough
Number of vertices in HoughVertex (hough.size())
void ClearKalmanInfo(caf::StandardRecord *sr)
void ClearHoughVertexInfo(caf::StandardRecord *sr)
void ClearMichelTruthInfo(caf::StandardRecord *sr)
Definition: FileReducer.cxx:42
void ClearProngInfo(caf::StandardRecord *sr)
2D and 3D
std::vector< std::string > wildcard(const std::string &wildcardString)
Definition: convert.C:9
std::string getenv(std::string const &name)
std::map< std::string, std::string > fMetaMap
Definition: FileReducer.h:130
SRNueCosRej nuecosrej
Output from NueCosRej (Nue Cosmic Rejection)
Definition: SRIDBranch.h:48
void AddEventCut(const Cut &cut)
Only copy records to the output file if they pass this cut.
Numu energy estimator output.
Definition: SRNumuEnergy.h:17
_Cut< caf::SRProxy > Cut
Representation of a cut (selection) to be applied to a caf::StandardRecord object.
Definition: Cut.h:96
Class for parsing *.fcl files for their metadata information.
void WriteCAFMetadata(TDirectory *dir, const std::map< std::string, std::string > &meta)
Write map of metadata parameters into a CAF file.
Definition: Utilities.cxx:312
caf::StandardRecord * sr
This class contains the LEM PID output.
Definition: SRLem.h:18
void ClearWindowTrackInfo(caf::StandardRecord *sr)
string rel
Definition: shutoffs.py:11
SRBPFEnergy bpfenergy
BreakPointFitter energy estimator.
Definition: SRNumuEnergy.h:52
size_t npng
Definition: SRFuzzyK.h:26
void ResetContainInfo(caf::StandardRecord *sr)
Output of the LIDBuilder module (slid::lid objects).
Definition: SRELid.h:18
virtual void Go() override
Load all the registered spectra.
std::vector< SRNeutrino > allnus
vector holding all Neutrinos
Definition: SRTruthBranch.h:28
Output from Cosmic Rejection (Nuecosrej) module.
Definition: SRNueCosRej.h:10
virtual ~FileReducer()
caf::Proxy< unsigned int > evt
Definition: SRProxy.h:237
Proxy for caf::SRSpill.
Definition: SRProxy.h:1346
OStream cout
Definition: OStream.cxx:6
Contains the RVP PID output.
Definition: SRRvp.h:13
void ResetNumuEnergy(caf::StandardRecord *sr)
size_t npng2d
Definition: SRFuzzyK.h:27
Base class for the various types of spectrum loader.
std::vector< std::function< ReductionFunc > > fReductionFuncs
Definition: FileReducer.h:124
void ClearPrimaryInfo(caf::StandardRecord *sr)
Definition: FileReducer.cxx:35
The StandardRecord is the primary top-level object in the Common Analysis File trees.
const Cut cut
Definition: exporter_fd.C:30
BPF energy estimator output.
Definition: SRBPFEnergy.h:12
void ResetBPFEnergy(caf::StandardRecord *sr)
int run
Definition: NusVarsTemp.cxx:51
SRNumuEnergy numu
Numu energy estimator.
Containment variables.
Definition: SRContain.h:12
void SetProgress(double frac)
Update the progress fraction between zero and one.
Definition: Progress.cxx:41
void ResetLEMInfo(caf::StandardRecord *sr)
SRTrackBase window
Tracks produced by WindowTrack.
Definition: SRTrackBranch.h:27
void ResetNueCosRejInfo(caf::StandardRecord *sr)
SRELid lid
Output from LIDBuilder (LID) package.
Definition: SRIDBranch.h:42
SRIDBranch sel
Selector (PID) branch.
SRElastic elastic
Single vertex found by Elastic Arms.
std::vector< std::function< NuTruthReductionFunc > > fNuTruthReductionFuncs
Definition: FileReducer.h:127
void ClearReweightInfo(caf::StandardRecord *sr)
void ResetNueEnergyInfo(caf::StandardRecord *sr)
std::map< std::string, std::string > GetCAFMetadata(TDirectory *dir)
Extract map of metadata parameters from a CAF file.
Definition: Utilities.cxx:229
std::set< std::tuple< int, int, int > > fEventList
Definition: FileReducer.h:122
void UpdateMetadata(std::map< std::string, std::string > &meta, const std::set< std::string > &mask, const std::vector< std::string > &fnames) const
assert(nhit_max >=nhit_nbins)
A simple ascii-art progress bar.
Definition: Progress.h:9
std::vector< SRTrack > tracks2d
2D Tracks produced by KalmanTrack
Definition: SRKalman.h:19
void ClearElasticArmsInfo(caf::StandardRecord *sr)
SRTruthBranch mc
Truth branch for MC: energy, flavor, etc.
void ClearCosmicTrackInfo(caf::StandardRecord *sr)
SRFuzzyK fuzzyk
Primary 3D prong object.
Definition: SRElastic.h:44
void ReduceForNueDecaf(caf::StandardRecord *sr)
Definition: FileReducer.cxx:56
SRLem lem
Output from Library Event Matching (LEM)
Definition: SRIDBranch.h:43
void Format(TGraph *gr, int lcol, int lsty, int lwid, int mcol, int msty, double msiz)
Definition: Style.cxx:154
void SetEventList(const std::string &fname)
If called, only events whose run/subrun/event occur in fname will be retained.
int NFiles() const
Forwards to fFileSource.
std::vector< SRGenieWeights > genie
GENIE weights.
Definition: SRMCReweight.h:23
std::vector< std::function< SpillReductionFunc > > fSpillReductionFuncs
Definition: FileReducer.h:126
void ResetLIDInfo(caf::StandardRecord *sr)
std::vector< SRTrueMichelE > michel
Vector of true Michel electrons.
Definition: SRNeutrino.h:48
SRTrackBranch trk
Track branch: nhit, len, etc.
SREnergyBranch energy
Energy estimator branch.
short nallnus
Number of neutrinos in allnus vector.
Definition: SRTruthBranch.h:39
void Done()
Call this when action is completed.
Definition: Progress.cxx:90
SRTrackBase cosmic
Tracks produced by CosmicTrack.
Definition: SRTrackBranch.h:26
Nue energy estimator output in the standard record.
Definition: SRNueEnergy.h:13
std::vector< std::function< ReductionFuncWithProxy > > fReductionFuncsWithProxy
Definition: FileReducer.h:125
void Clear2DProngInfo(caf::StandardRecord *sr)
SRContain contain
Output from SRContain (containment related variables)
Definition: SRIDBranch.h:51
std::vector< SRNeutrino > nu
implemented as a vector to maintain mc.nu structure, i.e. not a pointer, but with 0 or 1 entries...
Definition: SRTruthBranch.h:25
std::vector< SRTrack > tracks
Definition: SRTrackBase.h:15
A potential interaction point from the ElasticArms algorithm.
Definition: SRElastic.h:19
SRFluxWeights ppfx
ppfx weights
Definition: SRMCReweight.h:24
void ClearMultiNuInfo(caf::StandardRecord *sr)
Definition: FileReducer.cxx:25
FILE * outfile
Definition: dump_event.C:13
std::vector< SRKalmanTrack > tracks
3D Tracks produced by KalmanTrack
Definition: SRKalman.h:16
int subrun
Definition: NusVarsTemp.cxx:52
SRVertexBranch vtx
Vertex branch: location, time, etc.
enum BeamMode string