DAS  3.0
Das Analysis System
Variation.h
Go to the documentation of this file.
1 #pragma once
2 
3 // STD
4 #include <iostream>
5 #include <memory>
6 #include <string>
7 
8 // Darwin
9 #include <Weight.h>
10 
11 // ROOT
12 class TList;
13 
14 namespace Darwin::Physics {
15 
20 class Variation {
21 
22  std::string group;
23  std::string name;
24 
25  std::size_t index;
26  int bit;
27 
28 public:
29 
32  ~Variation () = default;
33 
36  Variation (const char * group, const char * name,
37  size_t index = 0, int bit = 0) :
39  { }
40 
43  Variation (const std::string& group, const std::string& name,
44  size_t index = 0, int bit = 0) :
46  { }
47 
50  Variation (const Variation& v) :
51  group(v.group), name(v.name), index(v.index), bit(v.bit)
52  { }
53 
57  group(std::move(v.group)), name(std::move(v.name)), index(v.index), bit(v.bit)
58  { }
59 
60  inline std::string_view Group () const { return group; }
61  inline std::string_view Name () const { return name ; }
62  inline size_t Index () const { return index; }
63  inline int Bit () const { return bit ; }
64 };
65 
66 const Variation nominal("", "nominal");
67 
79 void AppendGroupVariations (const TList&,
80  std::vector<Variation>&,
81  std::ostream& = std::cout
82  );
83 
120 std::vector<Variation> GetVariations (const TList&,
121  size_t = 100,
122  std::ostream& = std::cout
123  );
124 
125 } // end of namespace Darwin::Physics
126 
127 inline std::ostream& operator<< (std::ostream& s, const Darwin::Physics::Variation& v)
128 {
129  return s << v.Group() << ' ' << v.Name() << ' ' << v.Index() << ' ' << v.Bit();
130 }
Darwin::Physics::Variation::Variation
Variation(Variation &&v)
Move constructor.
Definition: Variation.h:56
Darwin::Physics::Variation::Index
size_t Index() const
Definition: Variation.h:62
Darwin::Physics::Variation::Variation
Variation(const std::string &group, const std::string &name, size_t index=0, int bit=0)
Normal constructor with std::strings.
Definition: Variation.h:43
Darwin::Physics::Variation::Group
std::string_view Group() const
Definition: Variation.h:60
Weight.h
Darwin::Physics::Variation
Definition: Variation.h:20
Darwin::Physics::GetVariations
std::vector< Variation > GetVariations(const TList &, size_t=100, std::ostream &=std::cout)
Definition: Variation.cc:33
Darwin::Physics::Variation::Bit
int Bit() const
Definition: Variation.h:63
Darwin::Physics::Variation::bit
int bit
correlation bit (needed for binned corrections with own stat. unc.)
Definition: Variation.h:26
Darwin::Physics::Variation::~Variation
~Variation()=default
Destructor.
Darwin::Physics::nominal
const Variation nominal("", "nominal")
Darwin::Physics::AppendGroupVariations
void AppendGroupVariations(const TList &, std::vector< Variation > &, std::ostream &=std::cout)
Definition: Variation.cc:20
Darwin::Physics::Variation::name
std::string name
variation name (including "Up" or "Down")
Definition: Variation.h:23
Darwin::Physics::Variation::group
std::string group
e.g. "GenEventWgts"
Definition: Variation.h:22
Darwin::Physics::Variation::Variation
Variation(const Variation &v)
Copy constructor.
Definition: Variation.h:50
Darwin::Physics
Everything what concerns physics analysis directly.
Definition: darwin.h:23
Darwin::Physics::Variation::Name
std::string_view Name() const
Definition: Variation.h:61
Darwin::Physics::Variation::Variation
Variation(const char *group, const char *name, size_t index=0, int bit=0)
Normal constructor with C-style strings.
Definition: Variation.h:36
operator<<
std::ostream & operator<<(std::ostream &s, const Darwin::Physics::Variation &v)
Definition: Variation.h:127
Darwin::Physics::Variation::index
std::size_t index
e.g. index in PhysicsObject::scales
Definition: Variation.h:25