Public Member Functions | Private Attributes | List of all members
IOManager Class Reference

Public Member Functions

 IOManager (std::string hornCurrent, std::string dataSet, std::string dataMC)
 
ana::Loaders::DataMC GetDataMC () const
 
ana::SpectrumLoaderBaseGetLoader () const
 
std::string TagNameBySample (const std::string &name) const
 

Private Attributes

std::string fDataSet
 
std::string fHornCurrent
 
ana::Loaders::DataMC fDataMC
 
std::unique_ptr< ana::SpectrumLoaderBasefLoader
 

Detailed Description

Definition at line 178 of file KinematicsHistos.C.

Constructor & Destructor Documentation

IOManager::IOManager ( std::string  hornCurrent,
std::string  dataSet,
std::string  dataMC 
)
inline

Definition at line 181 of file KinematicsHistos.C.

References ana::Loaders::kData, ana::Loaders::kMC, and PandAna.Demos.pi0_spectra::transform.

182  : fDataSet(dataSet), fHornCurrent(hornCurrent), fDataMC(ana::Loaders::kMC),
183  fLoader(nullptr)
184  {
185  if (dataMC.size() > 0)
186  {
187  std::transform(dataMC.begin(), dataMC.end(), dataMC.begin(), ::tolower);
188  if (dataMC == "mc")
190  else if (dataMC == "data")
192  else
193  throw std::runtime_error("Choose 'data' or 'mc'. You passed: '" + dataMC + "'");
194 
195  }
196 
197  if (hornCurrent.size() > 0)
198  {
199  std::transform(hornCurrent.begin(), hornCurrent.end(), hornCurrent.begin(), ::toupper);
200  if (hornCurrent != "FHC" && hornCurrent != "RHC")
201  throw std::runtime_error("Choose 'FHC' or 'RHC'. You passed: '" + hornCurrent + "'");
202  fHornCurrent = hornCurrent;
203  }
204  }
std::string fDataSet
std::string fHornCurrent
ana::Loaders::DataMC fDataMC
std::unique_ptr< ana::SpectrumLoaderBase > fLoader

Member Function Documentation

ana::Loaders::DataMC IOManager::GetDataMC ( ) const
inline

Definition at line 206 of file KinematicsHistos.C.

References string.

Referenced by KinematicsHistos(), and MakeObservablesSpectra().

206 { return fDataMC; };
ana::Loaders::DataMC fDataMC
ana::SpectrumLoaderBase & IOManager::GetLoader ( ) const

Definition at line 219 of file KinematicsHistos.C.

References plot_validation_datamc::fname, ana::Loaders::kData, ana::Loaders::kMC, KNOWN_DATASETS, ana::kStandardSpillCuts, and string.

Referenced by KinematicsHistos(), MakeObservablesSpectra(), and MakeTruthSpectra().

220 {
221  // cached after the first time
222  if (fLoader != nullptr)
223  return *fLoader;
224 
225 
226  if (KNOWN_DATASETS.find(fDataSet) == KNOWN_DATASETS.end())
227  throw std::runtime_error("Unrecognized dataset: '" + fDataSet + "'");
228 
229 
231  if (fHornCurrent == "FHC")
232  {
233  if (fDataSet == "prod4")
234  switch (fDataMC)
235  {
236  case ana::Loaders::kData:
237  fname = "prod_sumdecaf_R17-09-05-prod4recopreview.f_nd_numi_fhc_full_v1_addShortSimpleCVN_goodruns_numu2018";
238  break;
239 
240  case ana::Loaders::kMC:
241  fname = "prod_sumdecaf_R17-11-14-prod4reco.d_nd_genie_nonswap_fhc_nova_v08_full_v1_numu2018";
242  break;
243  }
244  else if (fDataSet == "test")
245  {
246  switch(fDataMC)
247  {
248  case ana::Loaders::kMC:
249  fname = "/pnfs/nova/persistent/production/concat/R17-11-14-prod4reco.d/nd/sumdecaf/numu_contain/genie/*period5*57*.root";
250  break;
251 
252  case ana::Loaders::kData:
253  fname = "/pnfs/nova/persistent/production/concat/R17-09-05-prod4recopreview.f/nd/sumdecaf/numu_contain/numi/*period5*7*.root";
254  break;
255  }
256  } // if (dataSet == "test")
257  } // if (FHC)
258  else if (fHornCurrent == "RHC")
259  {
260  if (fDataSet == "prod4")
261  switch (fDataMC)
262  {
263  case ana::Loaders::kData:
264  fname = "prod_sumdecaf_R17-09-05-prod4recopreview.f_nd_numi_rhc_full_v1_addShortSimpleCVN_goodruns_numu2018";
265  break;
266 
267  case ana::Loaders::kMC:
268  fname = "prod_sumdecaf_R17-11-14-prod4reco.e_nd_genie_nonswap_rhc_nova_v08_full_v1_numu2018";
269  break;
270  }
271  else if (fDataSet == "test")
272  {
273  switch(fDataMC)
274  {
275  case ana::Loaders::kMC:
276  fname = "/pnfs/nova/persistent/production/concat/R17-11-14-prod4reco.e/nd/sumdecaf/numu_contain/genie/*period4*57*.root";
277  break;
278 
279  case ana::Loaders::kData:
280  fname = "/pnfs/nova/persistent/production/concat/R17-09-05-prod4recopreview.f/nd/sumdecaf/numu_contain/numi/*period4*7*.root";
281  break;
282  }
283  } // if (dataSet == "test")
284  }
285 
286  if (!fLoader && fname != "")
287  fLoader.reset(new ana::SpectrumLoader(fname));
288 
289  fLoader->SetSpillCut(ana::kStandardSpillCuts);
290  return *fLoader;
291 }
std::string fDataSet
const std::set< std::string > KNOWN_DATASETS
std::string fHornCurrent
ana::Loaders::DataMC fDataMC
Collaborates with Spectrum and OscillatableSpectrum to fill spectra from CAF files.
std::unique_ptr< ana::SpectrumLoaderBase > fLoader
const SpillCut kStandardSpillCuts
Apply this unless you&#39;re doing something special.
Definition: SpillCuts.h:49
enum BeamMode string
std::string IOManager::TagNameBySample ( const std::string name) const

Definition at line 295 of file KinematicsHistos.C.

References BASE_DIR, galleryMaker::ext, cet::getenv(), ana::Loaders::kData, ana::Loaders::kMC, and string.

Referenced by SaveSpectra().

296 {
297  // split at last period, if any
298  std::string work(name);
299  if (name.find("/") != std::string::npos)
300  work = name.substr(name.rfind("/"));
301  auto splitPoint = work.rfind('.');
302  std::string basename(work.substr(0, splitPoint));
303  std::string ext(name.substr(splitPoint));
304 
305  std::string infix = fDataSet + "_" + fHornCurrent + "_";
306  switch (fDataMC)
307  {
308  case ana::Loaders::kMC:
309  infix += "MC";
310  break;
311 
312  case ana::Loaders::kData:
313  infix += "Data";
314  break;
315  }
316 
317  // on the grid we don't look for an absolute directory
318  std::string base_dir = getenv("_CONDOR_SCRATCH_DIR") ? "" : BASE_DIR + "/";
319  return std::move(base_dir + basename + "_" + infix + ext);
320 }
const XML_Char * name
Definition: expat.h:151
std::string fDataSet
std::string fHornCurrent
ana::Loaders::DataMC fDataMC
std::string getenv(std::string const &name)
const std::string BASE_DIR
enum BeamMode string

Member Data Documentation

ana::Loaders::DataMC IOManager::fDataMC
private

Definition at line 213 of file KinematicsHistos.C.

std::string IOManager::fDataSet
private

Definition at line 211 of file KinematicsHistos.C.

std::string IOManager::fHornCurrent
private

Definition at line 212 of file KinematicsHistos.C.

std::unique_ptr<ana::SpectrumLoaderBase> IOManager::fLoader
mutableprivate

Definition at line 215 of file KinematicsHistos.C.


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