Iguana LATEST
Implementation Guardian of Analysis Algorithms
Loading...
Searching...
No Matches
Algorithm.h
1#pragma once
2
3#include "iguana/algorithms/Algorithm.h"
6
7namespace iguana::physics {
8
14 {
15
17
18 private: // hooks
19 void ConfigHook() override;
20 void StartHook(hipo::banklist& banks) override;
21 bool RunHook(hipo::banklist& banks) const override;
22
23 public:
24
31 bool Run(
32 hipo::bank const& particle_bank,
33 hipo::bank const& config_bank,
34 hipo::bank& result_bank) const;
35
40 concurrent_key_t PrepareEvent(int const runnum) const;
41
49 vector_element_t const lepton_px,
50 vector_element_t const lepton_py,
51 vector_element_t const lepton_pz,
52 concurrent_key_t const key) const;
53
54 private:
55
63 std::optional<int> const FindScatteredLepton(hipo::bank const& particle_bank, concurrent_key_t const key) const; // FIXME: this could be changed to a vector action function
64
65 // banklist indices
66 hipo::banklist::size_type b_particle;
67 hipo::banklist::size_type b_config;
68 hipo::banklist::size_type b_result;
69
70 // `b_result` bank item indices
71 int i_pindex;
72 int i_Q2;
73 int i_x;
74 int i_y;
75 int i_W;
76 int i_nu;
77 int i_qx;
78 int i_qy;
79 int i_qz;
80 int i_qE;
81 int i_beamPx;
82 int i_beamPy;
83 int i_beamPz;
84 int i_beamM;
85 int i_targetPx;
86 int i_targetPy;
87 int i_targetPz;
88 int i_targetM;
89
90 // enums
91 enum method_reconstruction {
92 scattered_lepton
93 };
94 enum method_lepton_finder {
95 highest_energy_FD_trigger,
96 lund_beam_daughter,
97 };
98
99 // config options
100 mutable std::unique_ptr<ConcurrentParam<int>> o_runnum;
101 mutable std::unique_ptr<ConcurrentParam<int>> o_beam_pdg;
102 mutable std::unique_ptr<ConcurrentParam<int>> o_target_pdg;
103 mutable std::unique_ptr<ConcurrentParam<double>> o_beam_mass;
104 mutable std::unique_ptr<ConcurrentParam<double>> o_target_mass;
105 mutable std::unique_ptr<ConcurrentParam<std::vector<double>>> o_beam_PxPyPzM;
106 mutable std::unique_ptr<ConcurrentParam<std::vector<double>>> o_target_PxPyPzM;
107 std::string o_particle_bank;
108 double o_theta_between_FD_and_FT;
109 method_reconstruction o_method_reconstruction;
110 method_lepton_finder o_method_lepton_finder;
111
112 // keysmith
113 std::unique_ptr<Keysmith<int>> m_keysmith;
114
115 // ==================================================================================
116
117 // initial state class, for representing the beam or the target
118 class InitialState
119 {
120 public:
121
122 // constructor
123 InitialState(
124 std::string const id,
125 std::unique_ptr<Logger> const& log,
126 std::string const name,
127 std::vector<double> const direction,
128 double const energy)
129 : id(id)
130 , m_log(log)
131 , name(name)
132 , direction(direction)
133 , energy(energy)
134 {}
135
136 // determine the 4-momentum
137 void SetMomentum();
138
139 // constant members
140 std::string const id;
141 std::unique_ptr<Logger> const& m_log;
142 std::string const name;
143 std::vector<double> const direction{};
144
145 // variable members
146 double energy = -1.0;
147 int pdg = 0;
148 double mass = 0.0;
149 double px = 0.0;
150 double py = 0.0;
151 double pz = 0.0;
152 };
153 };
154
155
156}
#define DEFINE_IGUANA_ALGORITHM(ALGO_NAME, ALGO_FULL_NAME)
std::size_t concurrent_key_t
concurrent key type for ConcurrentParam objects
common objects used in algorithms
double vector_element_t
Vector element type.
Definition TypeDefs.h:12
Algorithm(std::string_view name)
Definition Algorithm.h:74
std::unique_ptr< Logger > m_log
Logger instance for this object
Definition Object.h:52
Algorithm: Calculate inclusive kinematics quantities
Definition Algorithm.h:14
concurrent_key_t PrepareEvent(int const runnum) const
Action Function: prepare the event
InclusiveKinematicsVars ComputeFromLepton(vector_element_t const lepton_px, vector_element_t const lepton_py, vector_element_t const lepton_pz, concurrent_key_t const key) const
Action Function: compute kinematics from the scattered lepton.
bool Run(hipo::bank const &particle_bank, hipo::bank const &config_bank, hipo::bank &result_bank) const
Run Function: Process an event's hipo::bank objects
Physics algorithms.
Definition Algorithm.h:5
Set of variables created by creator algorithm iguana::physics::InclusiveKinematics.
Definition BankDefs.h:44