DAS  3.0
Das Analysis System
Event.h
Go to the documentation of this file.
1 #pragma once
2 
3 // STD
4 #include <vector>
5 
6 // Darwin
7 #include <Variation.h>
8 #include <Weight.h>
9 
10 // ROOT
11 #include <TRandom3.h>
12 
13 namespace Darwin::Physics {
14 
18 class AbstractEvent {
19 protected:
20  virtual std::string_view weight_group () const = 0;
21 
22  AbstractEvent () = default;
23  virtual ~AbstractEvent () = default;
24 
25 public:
26  Weights weights = {{1.,0}};
27 
28  inline double Weight (const Variation& v) const
29  {
30  if (v.Group() == weight_group()) {
31  namespace DP = Darwin::Physics;
32  const DP::Weight& w = weights.at(v.Index());
33  if (w.i == v.Bit()) return w;
34  }
35  return weights.front();
36  }
37 
38  virtual void clear () = 0;
39 };
40 
43 class GenEvent : public AbstractEvent {
44 
45  std::string_view weight_group () const override { return WeightVar; }
46 
47 public:
48  static inline const char * const WeightVar = "GenEvtWgts"; //< Name of gen weights in variations
49 
50  float hard_scale = 0;
51 
52  GenEvent () = default;
53  virtual ~GenEvent () = default;
54 
55  void clear () override
56  {
57  hard_scale = 0;
58  weights = {{1.,0}};
59  }
60 };
61 
64 class RecEvent : public AbstractEvent {
65 
66  std::string_view weight_group () const override { return WeightVar; }
67 
68 public:
69  static inline const char * const WeightVar = "RecEvtWgts"; //< Name of rec weights in variations
70 
71  int fill = 0,
72  runNo = 0,
73  lumi = 0;
74  unsigned long long evtNo = 0;
75 
76  RecEvent () = default;
77  virtual ~RecEvent () = default;
78 
79  void clear () override
80  {
81  fill = 0;
82  runNo = 0;
83  lumi = 0;
84  evtNo = 0;
85  weights = {{1.,0}};
86  }
87 };
88 
89 } // end of Darwin::Physics
90 
91 inline std::ostream& operator<< (std::ostream& s, const Darwin::Physics::GenEvent& event)
92 {
93  return s << event.hard_scale;
94 }
95 
96 inline std::ostream& operator<< (std::ostream& s, const Darwin::Physics::RecEvent& event)
97 {
98  return s << event.fill << ' ' << event.runNo << ' ' << event.lumi << ' ' << event.evtNo;
99 }
Darwin::Physics::RecEvent::~RecEvent
virtual ~RecEvent()=default
Darwin::Physics::Weight
Definition: Weight.h:17
Darwin::Physics::GenEvent::GenEvent
GenEvent()=default
Darwin::Physics::GenEvent::WeightVar
static const char *const WeightVar
Definition: Event.h:48
operator<<
std::ostream & operator<<(std::ostream &s, const Darwin::Physics::GenEvent &event)
Definition: Event.h:91
Darwin::Physics::RecEvent::evtNo
unsigned long long evtNo
event number
Definition: Event.h:74
Darwin::Physics::AbstractEvent::clear
virtual void clear()=0
DAS::JetEnergy::w
static const float w
Definition: common.h:51
Darwin::Physics::Weights
std::vector< Weight > Weights
Definition: Weight.h:42
Weight.h
Darwin::Physics::RecEvent::runNo
int runNo
at LHC, typically a 6-digit run number
Definition: Event.h:72
Darwin::Physics::AbstractEvent
Definition: Event.h:18
Darwin::Physics::Variation
Definition: Variation.h:20
Darwin::Physics::GenEvent::weight_group
std::string_view weight_group() const override
Definition: Event.h:45
Variation.h
Darwin::Physics::GenEvent
Generic generator-level event.
Definition: Event.h:43
Darwin::Physics::RecEvent
Generic detector-level event.
Definition: Event.h:64
Darwin::Physics::RecEvent::WeightVar
static const char *const WeightVar
Definition: Event.h:69
Darwin::Physics::GenEvent::hard_scale
float hard_scale
hard scale, corresponding to pthat in Pythia 8
Definition: Event.h:50
Darwin::Physics::GenEvent::~GenEvent
virtual ~GenEvent()=default
Darwin::Physics::AbstractEvent::weight_group
virtual std::string_view weight_group() const =0
Darwin::Physics::RecEvent::clear
void clear() override
< to clear for each new event in n-tupliser
Definition: Event.h:79
Darwin::Physics::RecEvent::fill
int fill
at LHC, typically a 4-digit number
Definition: Event.h:71
Darwin::Physics::AbstractEvent::Weight
double Weight(const Variation &v) const
< weight
Definition: Event.h:28
Darwin::Physics::GenEvent::clear
void clear() override
< to clear for each new event in n-tupliser
Definition: Event.h:55
Darwin::Physics::AbstractEvent::AbstractEvent
AbstractEvent()=default
Darwin::Physics::AbstractEvent::weights
Weights weights
e.g. cross section normalisation
Definition: Event.h:26
Darwin::Physics::RecEvent::lumi
int lumi
lumi section (shortest unit time in LHC jargon)
Definition: Event.h:73
Darwin::Physics
Everything what concerns physics analysis directly.
Definition: darwin.h:23
Darwin::Physics::RecEvent::weight_group
std::string_view weight_group() const override
Definition: Event.h:66
Darwin::Physics::RecEvent::RecEvent
RecEvent()=default
Darwin::Physics::AbstractEvent::~AbstractEvent
virtual ~AbstractEvent()=default