Prod5Loaders.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "CAFAna/Core/Loaders.h"
4 
5 #include <map>
6 #include <string>
7 
8 namespace ana
9 {
10  /// Base class for prod4 loaders.
11  class Prod5LoadersBase: public Loaders
12  {
13  protected:
14  /// Set a range of FD and ND MC and ND data paths.
15  ///
16  /// Provides this method for all derived classes. Can use this method to
17  /// set any number of paths - any blank paths will be ignored.
18  ///
19  /// \param fdmc_nonswap String describing the path/samweb definition for
20  /// FarDet MC non-swap files.
21  /// \param fdmc_fluxswap String describing the path/samweb definition for
22  /// FarDet MC flux-swap files.
23  /// \param fdmc_tauswap String describing the path/samweb definition for
24  /// FarDet MC tau files (default empty sting).
25  /// \param ndmc String describing the path/samweb definition for
26  /// NearDet MC files (default empty string).
27  /// \param nddata String describing the path/samweb definition for
28  /// NearDet data files (default empty string).
29  void SetLoaderPaths(const std::string& fdmc_nonswap,
30  const std::string& fdmc_fluxswap,
31  const std::string& fdmc_tauswap="",
32  const std::string& ndmc="",
33  const std::string& nddata="");
34 
35  /// Set FarDet MC paths.
36  ///
37  /// Sets nonswap, fluxswap and tau (if applicable) using the format:
38  /// prefix_[nonswap|fluxswap|tau]_suffix.
39  ///
40  /// \param prefix String describing the first part of the file path (e.g.
41  /// "prod_caf_R17-11-14-prod4reco.d_fd_genie").
42  /// \param suffix String describing the second part of the file path (e.g.
43  /// "fhc_nova_v08_full_caf_v1").
44  /// \param noTau Boolean flag not to set tau file path (default is false,
45  /// tau file paths will be set).
47  const std::string& suffix,
48  const bool noTau=false);
49 
50  /// Set NearDet MC paths.
51  ///
52  /// \param ndmc String describing the path/samweb definition for
53  /// NearDet MC files (default empty string).
54  void SetLoaderNDMCPath(const std::string& ndmc);
55 
56  /// Utility to convert CAF type enum to a string description.
57  ///
58  /// \param type ECAFType that specifies the CAF type.
59  /// \return String describing the CAF type.
63  bool flatCAFsExist) const;
64 
65  /// Get string describing the associated systematic.
66  ///
67  /// \return String describing the systematic associated with this loader.
68  virtual std::string GetSystString() const = 0;
69  };
70 
71  /// Provide the data loaders only, base class for other loaders
73  {
74  public:
75  /// Create data loaders instance.
76  ///
77  /// \param type ECAFType to specify the CAF type.
78  /// \param flux FluxType to specify the flux (kFHC/kRHC).
79  /// \param WhichPeriod String describing the desired range
80  /// (e.g. "full" - default, "period4", "epoch6a").
81  /// \param WhichNDPeriod String describing the desired range
82  /// (e.g. "full" - default, "period4", "epoch6a").
84  FluxType flux,
85  std::string WhichPeriod="full",
86  std::string WhichNDPeriod="full",
88 
89  std::string GetSystString() const override {return "Data";}
90 
91  // Some useful protected members
92  protected:
93  const std::string cafType; ///< A string describing the CAF type,
94  ///< e.g nueconcat2018
95  const std::string dataTier; ///< from "caf" to "flatsumdecaf"
96  const std::string fluxType; ///< A string describing the flux,
97  ///< e.g nonswap
98  };
99 
100  /// For nominal spectra and reweighting systs (xsec/flux)
102  {
103  public:
104  /// Create Nominal loaders instance.
105  ///
106  /// \param type ECAFType to specify the CAF type.
107  /// \param flux FluxType to specify the flux (kFHC/kRHC).
108  /// \param WhichPeriod String describing the desired range
109  /// (e.g. "full" - default, "period4", "epoch6a").
110  /// \param WhichNDPeriod String describing the desired range
111  /// (e.g. "full" - default, "period4", "epoch6a").
113  FluxType flux,
114  std::string WhichPeriod="full",
115  std::string WhichNDPeriod="full",
117 
118  std::string GetSystString() const override {return "Nominal";}
119  };
120 
121  /// Loaders for absolute calibration paths/definitions.
123  {
124  public:
125  /// Create absolute calibration loaders instance.
126  ///
127  /// \a sign should be +1 (scale energies up) or -1 (scale energies down)
128  ///
129  /// \param type ECAFType to specify the CAF type.
130  /// \param flux FluxType to specify the flux (kFHC/kRHC).
131  /// \param sign Integer specifying shift up or down.
132  /// \param WhichPeriod String describing the desired range
133  /// ("full" only).
134  /// \param WhichNDPeriod String describing the desired range
135  /// ("full" only).
137  FluxType flux,
138  int sign,
139  std::string WhichPeriod="full",
140  std::string WhichNDPeriod="full",
142 
143  std::string GetSystString() const override {return "Calibration";}
144  };
145 
146  /// Loaders for light level paths/definitions.
148  {
149  public:
150  /// Create light level loaders instance.
151  ///
152  /// \warning Prod4 light level file definitions do not exist at present.
153  ///
154  /// \param type ECAFType to specify the CAF type.
155  /// \param flux FluxType to specify the flux (kFHC/kRHC).
156  /// \param sign Integer specifying shift up or down: +1 sigma is light
157  /// levels up, calibration down, 0 is no shift photon rewriter.
158  /// \param WhichPeriod String describing the desired range
159  /// ("full" only).
160  /// \param WhichNDPeriod String describing the desired range
161  /// ("full" only).
163  FluxType flux,
164  int sign,
165  std::string WhichPeriod="full",
166  std::string WhichNDPeriod="full",
168 
169  std::string GetSystString() const override {return "Lightlevel";}
170  };
171 
172  /// Loaders for Cherenkov paths/definitions.
174  {
175  public:
176  /// Create Cherenkov loaders instance.
177  ///
178  /// \warning Prod4 Cherenkov file definitions do not exist at present.
179  ///
180  /// \param type ECAFType to specify the CAF type.
181  /// \param flux FluxType to specify the flux (kFHC/kRHC).
182  /// \param WhichPeriod String describing the desired range
183  /// ("full" only).
184  /// \param WhichNDPeriod String describing the desired range
185  /// ("full" only).
187  FluxType flux,
188  std::string WhichPeriod="full",
189  std::string WhichNDPeriod="full",
191 
192  std::string GetSystString() const override {return "Cherenkov";}
193  };
194 
195  /// Loaders for calibration shape paths/definitions.
197  {
198  public:
199  /// Create calibration shape loaders instance.
200  ///
201  /// \param type ECAFType to specify the CAF type
202  /// (e.g. kFullCAF, kNueConcat)
203  /// \param flux FluxType to specify the flux (kFHC/kRHC).
204  /// \param WhichPeriod String describing the desired range
205  /// ("full" only).
206  /// \param WhichNDPeriod String describing the desired range
207  /// ("full" only).
209  FluxType flux,
210  std::string WhichPeriod="full",
211  std::string WhichNDPeriod="full",
213 
214  std::string GetSystString() const override {return "CalibShape";}
215  };
216 
217  /// Loaders for calibration drift (detector aging) paths/definitions.
219  {
220  public:
221  /// Create calibration drift loaders instance.
222  ///
223  /// \param type ECAFType to specify the CAF type
224  /// (e.g. kFullCAF, kNueConcat)
225  /// \param flux FluxType to specify the flux (kFHC/kRHC).
226  /// \param WhichPeriod String describing the desired range
227  /// ("full" only).
228  /// \param WhichNDPeriod String describing the desired range
229  /// ("full" only).
231  FluxType flux,
232  std::string WhichPeriod="full",
233  std::string WhichNDPeriod="full",
235 
236  std::string GetSystString() const override {return "CalibDrift";}
237  };
238 
239 } //namespace
const std::string ECAFTypeToString(ECAFType type)
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
void SetLoaderNDMCPath(const std::string &ndmc)
std::string ECAFTypeFlatToTier(ECAFType type, EFlatness flat, bool flatCAFsExist) const
EFlatness
Definition: Loaders.h:20
std::string GetSystString() const override
Definition: Prod5Loaders.h:118
Collection of SpectrumLoaders for many configurations.
Definition: Loaders.h:23
std::string GetSystString() const override
Definition: Prod5Loaders.h:143
void SetLoaderFDMCPaths(const std::string &prefix, const std::string &suffix, const bool noTau=false)
Provide the data loaders only, base class for other loaders.
Definition: Prod5Loaders.h:72
Loaders::FluxType flux
Loaders for absolute calibration paths/definitions.
Definition: Prod5Loaders.h:122
Loaders for Cherenkov paths/definitions.
Definition: Prod5Loaders.h:173
std::string GetSystString() const override
Definition: Prod5Loaders.h:214
const std::string dataTier
from "caf" to "flatsumdecaf"
Definition: Prod5Loaders.h:95
For nominal spectra and reweighting systs (xsec/flux)
Definition: Prod5Loaders.h:101
Base class for prod4 loaders.
Definition: Prod5Loaders.h:11
Loaders for calibration drift (detector aging) paths/definitions.
Definition: Prod5Loaders.h:218
std::string GetSystString() const override
Definition: Prod5Loaders.h:236
std::string GetSystString() const override
Definition: Prod5Loaders.h:169
const XML_Char * prefix
Definition: expat.h:380
void SetLoaderPaths(const std::string &fdmc_nonswap, const std::string &fdmc_fluxswap, const std::string &fdmc_tauswap="", const std::string &ndmc="", const std::string &nddata="")
Definition: Prod5Loaders.cxx:9
Loaders for light level paths/definitions.
Definition: Prod5Loaders.h:147
virtual std::string GetSystString() const =0
const std::string cafType
Definition: Prod5Loaders.h:93
const std::string fluxType
Definition: Prod5Loaders.h:96
Loaders for calibration shape paths/definitions.
Definition: Prod5Loaders.h:196
std::string GetSystString() const override
Definition: Prod5Loaders.h:89
std::string GetSystString() const override
Definition: Prod5Loaders.h:192
def sign(x)
Definition: canMan.py:197
ECAFType
Definition: Loaders.h:19
enum BeamMode string