Sample.h
Go to the documentation of this file.
1 #pragma once
2 
3 // CAFAna includes
4 #include "CAFAna/Core/HistAxis.h"
5 #include "CAFAna/Core/Cut.h"
7 
8 // c++ includes
9 #include <vector>
10 #include <string>
11 #include <sstream>
12 
13 namespace ana {
14 
15  // Forward declarations
16  class Spectrum;
17  class IPrediction;
18 
19  namespace covmx {
20 
21  // Define some useful enums
22 
24  enum Polarity { kFHC, kRHC, kNoPol };
26  enum Quantile { kQ1, kQ2, kQ3, kQ4, kNoQ };
27 
28  // Sample class
29 
30  class Sample {
31 
32  public:
33 
34  // Constructors
36  Sample(Sample const& sample);
37  Sample(unsigned int id);
38 
39  // Destructor
40  ~Sample();
41 
42  std::string GetSelection() const;
43  std::string GetPolarity() const;
44  std::string GetDetector() const;
45  std::string GetQuantile() const;
46  std::string GetName() const;
47  std::string GetTag() const;
48  std::string GetLatexName() const;
49 
50  void SetAxis(const HistAxis* a) { axis = a; };
51  void SetCut(const Cut* c) { cut = c; };
52  void SetPOT(double d) { pot = d; };
53  void SetLivetime(double l) { livetime = l; };
54 
55  void SetPrediction(IPrediction* p);
56  void SetCosmic(Spectrum* s);
57  void SetData(Spectrum* s);
58 
59  void SetSystAlias(const ISyst* key, const ISyst* val) { systMap[key] = val; };
60 
61  const HistAxis* GetAxis() const;
62  Binning GetBinning() const;
63  const Cut* GetCut() const;
64  double GetPOT() const;
65  double GetLivetime() const;
66 
67  IPrediction* GetPrediction() const;
68  Spectrum* GetCosmic() const;
69  Spectrum* GetData() const;
70 
71  SystShifts GetSystShifts(SystShifts shifts) const;
72 
73  bool HasPrediction() const { return (prediction!=nullptr); };
74  void ResetPrediction() { prediction = nullptr; };
75  bool HasCosmic() const { return (cosmic!=nullptr); };
76  void ResetCosmic() { cosmic = nullptr; };
77  bool HasData() const { return (data!=nullptr); };
78  void ResetData() { data = nullptr; };
79 
80  unsigned int GetID() const;
81 
82  bool operator< (const Sample& lhs) const {
83  return lhs.GetID() < this->GetID();
84  }
85 
86  bool operator==(const Sample& lhs) {
87  return lhs.GetID() == this->GetID();
88  }
89 
90  bool operator!=(const Sample& lhs) {
91  return lhs.GetID() != this->GetID();
92  }
93 
94  // Mandatory member variables
99 
100  private:
101 
102  // Optional member variables
103  const HistAxis* axis;
104  const Cut* cut;
105  double pot;
106  double livetime;
107 
111 
112  std::map<const ISyst*, const ISyst*> systMap;
113 
114  }; // class Sample
115 
116  } // namespace covmx
117 } // namespace ana
std::map< const ISyst *, const ISyst * > systMap
Definition: Sample.h:112
IPrediction * prediction
Definition: Sample.h:108
Represent the binning of a Spectrum&#39;s x-axis.
Definition: Binning.h:16
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
std::string GetQuantile() const
Definition: Sample.cxx:64
void ResetCosmic()
Definition: Sample.h:76
Simple record of shifts applied to systematic parameters.
Definition: SystShifts.h:20
const HistAxis * axis
Definition: Sample.h:103
const char * p
Definition: xmltok.h:285
bool operator<(const Sample &lhs) const
Definition: Sample.h:82
void SetLivetime(double l)
Definition: Sample.h:53
std::string GetTag() const
Definition: Sample.cxx:94
void ResetData()
Definition: Sample.h:78
Spectrum * data
Definition: Sample.h:109
Encapsulate code to systematically shift a caf::SRProxy.
Definition: ISyst.h:14
Representation of a spectrum in any variable, with associated POT.
Definition: Spectrum.h:40
void SetCut(const Cut *c)
Definition: Sample.h:51
const XML_Char const XML_Char * data
Definition: expat.h:268
std::string GetLatexName() const
Definition: Sample.cxx:81
const XML_Char * s
Definition: expat.h:262
std::string GetPolarity() const
Definition: Sample.cxx:52
void SetAxis(const HistAxis *a)
Definition: Sample.h:50
Sum up livetimes from individual cosmic triggers.
void SetSystAlias(const ISyst *key, const ISyst *val)
Definition: Sample.h:59
bool HasPrediction() const
Definition: Sample.h:73
void SetPrediction(IPrediction *p)
Definition: Sample.cxx:103
const double a
Selection selection
Definition: Sample.h:95
std::string GetSelection() const
Definition: Sample.cxx:46
Detector detector
Definition: Sample.h:97
Float_t d
Definition: plot.C:236
void SetCosmic(Spectrum *s)
Definition: Sample.cxx:108
Sample(Selection s, Polarity p, Detector d, Quantile q=kNoQ)
Definition: Sample.cxx:18
const Cut * cut
Definition: Sample.h:104
std::vector< float > Spectrum
Definition: Constants.h:759
Spectrum * GetCosmic() const
Definition: Sample.cxx:158
double GetPOT() const
Definition: Sample.cxx:136
const Cut * GetCut() const
Definition: Sample.cxx:130
std::string GetDetector() const
Definition: Sample.cxx:58
unsigned int GetID() const
Definition: Sample.cxx:185
Binning GetBinning() const
Definition: Sample.cxx:124
bool operator==(const Sample &lhs)
Definition: Sample.h:86
Quantile quantile
Definition: Sample.h:98
double livetime
Definition: Sample.h:106
std::string GetName() const
Definition: Sample.cxx:72
bool operator!=(const Sample &lhs)
Definition: Sample.h:90
Spectrum * cosmic
Definition: Sample.h:110
void SetPOT(double d)
Definition: Sample.h:52
Standard interface to all prediction techniques.
Definition: IPrediction.h:57
Spectrum * GetData() const
Definition: Sample.cxx:164
void ResetPrediction()
Definition: Sample.h:74
void SetData(Spectrum *s)
Definition: Sample.cxx:113
double GetLivetime() const
Definition: Sample.cxx:142
bool HasCosmic() const
Definition: Sample.h:75
Polarity polarity
Definition: Sample.h:96
IPrediction * GetPrediction() const
Definition: Sample.cxx:148
bool HasData() const
Definition: Sample.h:77
const HistAxis * GetAxis() const
Definition: Sample.cxx:118
SystShifts GetSystShifts(SystShifts shifts) const
Definition: Sample.cxx:170
enum BeamMode string