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