Line | Branch | Exec | Source |
---|---|---|---|
1 | #include "Algorithm.h" | ||
2 | |||
3 | // ROOT | ||
4 | #include <Math/Vector4D.h> | ||
5 | |||
6 | namespace iguana::physics { | ||
7 | |||
8 | REGISTER_IGUANA_ALGORITHM(InclusiveKinematics, "physics::InclusiveKinematics"); | ||
9 | |||
10 | 8 | void InclusiveKinematics::Start(hipo::banklist& banks) | |
11 | { | ||
12 |
2/4✓ Branch 0 (3→4) taken 8 times.
✗ Branch 1 (3→175) not taken.
✓ Branch 2 (4→5) taken 8 times.
✗ Branch 3 (4→7) not taken.
|
8 | b_particle = GetBankIndex(banks, "REC::Particle"); |
13 |
2/4✓ Branch 0 (10→11) taken 8 times.
✗ Branch 1 (10→181) not taken.
✓ Branch 2 (11→12) taken 8 times.
✗ Branch 3 (11→14) not taken.
|
16 | b_config = GetBankIndex(banks, "RUN::config"); |
14 | |||
15 | // create the output bank | ||
16 |
1/2✓ Branch 0 (17→18) taken 8 times.
✗ Branch 1 (17→187) not taken.
|
8 | auto result_schema = CreateBank(banks, b_result, GetClassName()); |
17 |
1/2✓ Branch 0 (23→24) taken 8 times.
✗ Branch 1 (23→301) not taken.
|
8 | i_pindex = result_schema.getEntryOrder("pindex"); |
18 |
1/2✓ Branch 0 (24→25) taken 8 times.
✗ Branch 1 (24→301) not taken.
|
8 | i_Q2 = result_schema.getEntryOrder("Q2"); |
19 |
1/2✓ Branch 0 (25→26) taken 8 times.
✗ Branch 1 (25→301) not taken.
|
8 | i_x = result_schema.getEntryOrder("x"); |
20 |
1/2✓ Branch 0 (26→27) taken 8 times.
✗ Branch 1 (26→301) not taken.
|
8 | i_y = result_schema.getEntryOrder("y"); |
21 |
1/2✓ Branch 0 (27→28) taken 8 times.
✗ Branch 1 (27→301) not taken.
|
8 | i_W = result_schema.getEntryOrder("W"); |
22 |
1/2✓ Branch 0 (28→29) taken 8 times.
✗ Branch 1 (28→301) not taken.
|
8 | i_nu = result_schema.getEntryOrder("nu"); |
23 |
1/2✓ Branch 0 (29→30) taken 8 times.
✗ Branch 1 (29→301) not taken.
|
8 | i_qx = result_schema.getEntryOrder("qx"); |
24 |
1/2✓ Branch 0 (30→31) taken 8 times.
✗ Branch 1 (30→301) not taken.
|
8 | i_qy = result_schema.getEntryOrder("qy"); |
25 |
1/2✓ Branch 0 (31→32) taken 8 times.
✗ Branch 1 (31→301) not taken.
|
8 | i_qz = result_schema.getEntryOrder("qz"); |
26 |
1/2✓ Branch 0 (32→33) taken 8 times.
✗ Branch 1 (32→301) not taken.
|
8 | i_qE = result_schema.getEntryOrder("qE"); |
27 |
1/2✓ Branch 0 (33→34) taken 8 times.
✗ Branch 1 (33→301) not taken.
|
8 | i_beamPz = result_schema.getEntryOrder("beamPz"); |
28 |
2/4✓ Branch 0 (34→35) taken 8 times.
✗ Branch 1 (34→301) not taken.
✓ Branch 2 (35→36) taken 8 times.
✗ Branch 3 (35→301) not taken.
|
8 | i_targetM = result_schema.getEntryOrder("targetM"); |
29 | |||
30 | // instantiate RCDB reader | ||
31 |
3/6✓ Branch 0 (35→36) taken 8 times.
✗ Branch 1 (35→301) not taken.
✓ Branch 2 (36→37) taken 8 times.
✗ Branch 3 (36→301) not taken.
✓ Branch 4 (39→40) taken 8 times.
✗ Branch 5 (39→193) not taken.
|
24 | m_rcdb = std::make_unique<RCDBReader>("RCDB|" + GetName(), m_log->GetLevel()); |
32 | |||
33 | // parse config file | ||
34 |
1/2✓ Branch 0 (52→53) taken 8 times.
✗ Branch 1 (52→301) not taken.
|
8 | ParseYAMLConfig(); |
35 |
1/2✓ Branch 0 (53→54) taken 8 times.
✗ Branch 1 (53→301) not taken.
|
8 | o_runnum = ConcurrentParamFactory::Create<int>(); |
36 |
1/2✓ Branch 0 (57→58) taken 8 times.
✗ Branch 1 (57→301) not taken.
|
8 | o_target_PxPyPzM = ConcurrentParamFactory::Create<std::vector<double>>(); |
37 |
2/4✓ Branch 0 (61→62) taken 8 times.
✗ Branch 1 (61→301) not taken.
✓ Branch 2 (65→66) taken 8 times.
✗ Branch 3 (65→218) not taken.
|
16 | o_beam_PxPyPzM = ConcurrentParamFactory::Create<std::vector<double>>(); |
38 | |||
39 | // get reconstruction method configuration | ||
40 |
5/10✓ Branch 0 (67→68) taken 8 times.
✗ Branch 1 (67→213) not taken.
✓ Branch 2 (68→69) taken 8 times.
✗ Branch 3 (68→211) not taken.
✓ Branch 4 (69→70) taken 8 times.
✗ Branch 5 (69→205) not taken.
✓ Branch 6 (77→78) taken 16 times.
✓ Branch 7 (77→80) taken 8 times.
✗ Branch 8 (214→215) not taken.
✗ Branch 9 (214→217) not taken.
|
32 | auto method_reconstruction_str = GetOptionScalar<std::string>("reconstruction", {"method", "reconstruction"}); |
41 |
1/2✓ Branch 0 (80→81) taken 8 times.
✗ Branch 1 (80→83) not taken.
|
8 | if(method_reconstruction_str == "scattered_lepton") { |
42 |
1/2✓ Branch 0 (81→82) taken 8 times.
✗ Branch 1 (81→244) not taken.
|
8 | o_method_reconstruction = method_reconstruction::scattered_lepton; |
43 | } | ||
44 | else { | ||
45 | ✗ | m_log->Error("Unknown reconstruction method {:?}", method_reconstruction_str); | |
46 | ✗ | throw std::runtime_error("Start failed"); | |
47 | } | ||
48 | |||
49 | // get scattered lepton finder configuration | ||
50 |
5/12✓ Branch 0 (96→97) taken 8 times.
✗ Branch 1 (96→239) not taken.
✓ Branch 2 (97→98) taken 8 times.
✗ Branch 3 (97→237) not taken.
✓ Branch 4 (98→99) taken 8 times.
✗ Branch 5 (98→231) not taken.
✓ Branch 6 (106→107) taken 16 times.
✓ Branch 7 (106→109) taken 8 times.
✗ Branch 8 (240→241) not taken.
✗ Branch 9 (240→243) not taken.
✗ Branch 10 (295→296) not taken.
✗ Branch 11 (295→298) not taken.
|
32 | auto method_lepton_finder_str = GetOptionScalar<std::string>("lepton_finder", {"method", "lepton_finder"}); |
51 |
1/2✓ Branch 0 (109→110) taken 8 times.
✗ Branch 1 (109→112) not taken.
|
8 | if(method_lepton_finder_str == "highest_energy_FD_trigger") { |
52 | 8 | o_method_lepton_finder = method_lepton_finder::highest_energy_FD_trigger; | |
53 | } | ||
54 | else { | ||
55 | ✗ | m_log->Error("Unknown lepton finder method {:?}", method_lepton_finder_str); | |
56 | ✗ | throw std::runtime_error("Start failed"); | |
57 | } | ||
58 | |||
59 | // get beam PDG and mass | ||
60 |
1/2✓ Branch 0 (110→111) taken 8 times.
✗ Branch 1 (110→270) not taken.
|
8 | o_beam_pdg = 0; |
61 |
5/12✓ Branch 0 (125→126) taken 8 times.
✗ Branch 1 (125→265) not taken.
✓ Branch 2 (126→127) taken 8 times.
✗ Branch 3 (126→263) not taken.
✓ Branch 4 (127→128) taken 8 times.
✗ Branch 5 (127→257) not taken.
✓ Branch 6 (135→136) taken 16 times.
✓ Branch 7 (135→138) taken 8 times.
✗ Branch 8 (266→267) not taken.
✗ Branch 9 (266→269) not taken.
✗ Branch 10 (289→290) not taken.
✗ Branch 11 (289→292) not taken.
|
32 | auto beam_particle = GetOptionScalar<std::string>("beam_particle", {"method", "beam_particle"}); |
62 |
1/2✓ Branch 0 (143→139) taken 80 times.
✗ Branch 1 (143→144) not taken.
|
80 | for(auto const& [pdg, name] : particle::name) { |
63 |
2/2✓ Branch 0 (139→140) taken 8 times.
✓ Branch 1 (139→142) taken 72 times.
|
80 | if(name == beam_particle) { |
64 |
1/2✓ Branch 0 (140→141) taken 8 times.
✗ Branch 1 (140→283) not taken.
|
8 | o_beam_pdg = pdg; |
65 | 8 | o_beam_mass = particle::mass.at(pdg); | |
66 | 8 | break; | |
67 | } | ||
68 | } | ||
69 |
1/2✗ Branch 0 (144→145) not taken.
✓ Branch 1 (144→158) taken 8 times.
|
8 | if(o_beam_pdg == 0) { |
70 | ✗ | m_log->Error("Unknown beam particle {:?}", beam_particle); | |
71 | ✗ | throw std::runtime_error("Start failed"); | |
72 | } | ||
73 |
0/6✗ Branch 0 (219→220) not taken.
✗ Branch 1 (219→222) not taken.
✗ Branch 2 (245→246) not taken.
✗ Branch 3 (245→248) not taken.
✗ Branch 4 (271→272) not taken.
✗ Branch 5 (271→274) not taken.
|
8 | } |
74 | |||
75 | /////////////////////////////////////////////////////////////////////////////// | ||
76 | |||
77 | 8000 | void InclusiveKinematics::Run(hipo::banklist& banks) const | |
78 | { | ||
79 |
1/2✓ Branch 0 (3→4) taken 8000 times.
✗ Branch 1 (3→74) not taken.
|
8000 | auto& particle_bank = GetBank(banks, b_particle, "REC::Particle"); |
80 |
1/2✓ Branch 0 (10→11) taken 8000 times.
✗ Branch 1 (10→80) not taken.
|
16000 | auto& config_bank = GetBank(banks, b_config, "RUN::config"); |
81 |
1/2✓ Branch 0 (17→18) taken 8000 times.
✗ Branch 1 (17→86) not taken.
|
8000 | auto& result_bank = GetBank(banks, b_result, GetClassName()); |
82 |
1/2✓ Branch 0 (26→27) taken 8000 times.
✗ Branch 1 (26→92) not taken.
|
16000 | ShowBank(particle_bank, Logger::Header("INPUT PARTICLES")); |
83 | |||
84 | 8000 | auto key = PrepareEvent(config_bank.getInt("run",0)); | |
85 | |||
86 | 8000 | auto lepton_pindex = FindScatteredLepton(particle_bank, key); | |
87 |
2/2✓ Branch 0 (35→36) taken 7032 times.
✓ Branch 1 (35→46) taken 968 times.
|
8000 | if(lepton_pindex < 0) { |
88 |
1/2✓ Branch 0 (39→40) taken 7032 times.
✗ Branch 1 (39→98) not taken.
|
14064 | ShowBank(result_bank, Logger::Header("CREATED BANK IS EMPTY")); |
89 | 7032 | return; | |
90 | } | ||
91 | |||
92 | 968 | auto result_vars = ComputeFromLepton( | |
93 | 968 | particle_bank.getFloat("px", lepton_pindex), | |
94 | 968 | particle_bank.getFloat("py", lepton_pindex), | |
95 | 968 | particle_bank.getFloat("pz", lepton_pindex), | |
96 | key); | ||
97 | result_vars.pindex = lepton_pindex; // FIXME: should be done in `ComputeFromLepton`, but need a proper action function first... | ||
98 | |||
99 | 968 | result_bank.setRows(1); | |
100 | 968 | result_bank.putShort(i_pindex, 0, static_cast<int16_t>(result_vars.pindex)); | |
101 | 968 | result_bank.putDouble(i_Q2, 0, result_vars.Q2); | |
102 | 968 | result_bank.putDouble(i_x, 0, result_vars.x); | |
103 | 968 | result_bank.putDouble(i_y, 0, result_vars.y); | |
104 | 968 | result_bank.putDouble(i_W, 0, result_vars.W); | |
105 | 968 | result_bank.putDouble(i_nu, 0, result_vars.nu); | |
106 | 968 | result_bank.putDouble(i_qx, 0, result_vars.qx); | |
107 | 968 | result_bank.putDouble(i_qy, 0, result_vars.qy); | |
108 | 968 | result_bank.putDouble(i_qz, 0, result_vars.qz); | |
109 | 968 | result_bank.putDouble(i_qE, 0, result_vars.qE); | |
110 | 968 | result_bank.putDouble(i_beamPz, 0, result_vars.beamPz); | |
111 | 968 | result_bank.putDouble(i_targetM, 0, result_vars.targetM); | |
112 | |||
113 |
1/2✓ Branch 0 (66→67) taken 968 times.
✗ Branch 1 (66→104) not taken.
|
2904 | ShowBank(result_bank, Logger::Header("CREATED BANK")); |
114 | } | ||
115 | |||
116 | /////////////////////////////////////////////////////////////////////////////// | ||
117 | |||
118 | 8000 | int InclusiveKinematics::FindScatteredLepton(hipo::bank const& particle_bank, concurrent_key_t const key) const | |
119 | { | ||
120 | bool lepton_found = false; | ||
121 | int lepton_row = -1; | ||
122 | double lepton_energy = 0; | ||
123 | |||
124 |
1/2✓ Branch 0 (2→3) taken 8000 times.
✗ Branch 1 (2→24) not taken.
|
8000 | switch(o_method_lepton_finder) { |
125 | 8000 | case method_lepton_finder::highest_energy_FD_trigger: { | |
126 | |||
127 |
2/2✓ Branch 0 (17→5) taken 57144 times.
✓ Branch 1 (17→18) taken 8000 times.
|
65144 | for(auto const& row : particle_bank.getRowList()) { |
128 |
2/2✓ Branch 0 (6→7) taken 51936 times.
✓ Branch 1 (6→8) taken 5208 times.
|
57144 | if(particle_bank.getInt("pid", row) == o_beam_pdg) { // if beam PDG |
129 | 5208 | auto status = particle_bank.getShort("status", row); | |
130 |
2/2✓ Branch 0 (9→7) taken 4240 times.
✓ Branch 1 (9→10) taken 968 times.
|
5208 | if(status > -3000 && status <= -2000) { // if in FD trigger |
131 | 968 | m_log->Trace("row {} status {} is in FD trigger", row, status); | |
132 | 968 | double en = std::sqrt( | |
133 | 968 | std::pow(particle_bank.getFloat("px", row), 2) + | |
134 | 968 | std::pow(particle_bank.getFloat("py", row), 2) + | |
135 | 968 | std::pow(particle_bank.getFloat("pz", row), 2) + | |
136 | 968 | std::pow(o_beam_mass, 2)); | |
137 |
1/2✗ Branch 0 (14→7) not taken.
✓ Branch 1 (14→15) taken 968 times.
|
968 | if(en > lepton_energy) { // select max-E |
138 | lepton_found = true; | ||
139 | 968 | lepton_row = row; | |
140 | lepton_energy = en; | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | } | ||
145 |
1/2✗ Branch 0 (18→19) not taken.
✓ Branch 1 (18→21) taken 8000 times.
|
8000 | if(lepton_found && lepton_row != 0) |
146 | ✗ | m_log->Warn("Found scattered lepton which is NOT at pindex 0"); | |
147 | break; | ||
148 | } | ||
149 | } | ||
150 |
2/2✓ Branch 0 (21→22) taken 968 times.
✓ Branch 1 (21→24) taken 7032 times.
|
8000 | if(lepton_found) |
151 | 968 | m_log->Debug("Found scattered lepton: row={}, energy={}", lepton_row, lepton_energy); | |
152 | else | ||
153 | 7032 | m_log->Debug("Scattered lepton not found"); | |
154 | 8000 | return lepton_row; | |
155 | } | ||
156 | |||
157 | /////////////////////////////////////////////////////////////////////////////// | ||
158 | |||
159 | 8000 | concurrent_key_t InclusiveKinematics::PrepareEvent(int const runnum, double const beam_energy) const | |
160 | { | ||
161 |
2/2✓ Branch 0 (3→4) taken 4000 times.
✓ Branch 1 (3→8) taken 4000 times.
|
8000 | m_log->Trace("calling PrepareEvent({})", runnum); |
162 |
2/2✓ Branch 0 (3→4) taken 4000 times.
✓ Branch 1 (3→8) taken 4000 times.
|
8000 | if(o_runnum->NeedsHashing()) { |
163 | std::hash<int> hash_ftn; | ||
164 | auto hash_key = hash_ftn(runnum); | ||
165 |
2/2✓ Branch 0 (5→6) taken 4 times.
✓ Branch 1 (5→7) taken 3996 times.
|
4000 | if(!o_runnum->HasKey(hash_key)) |
166 | 4 | Reload(runnum, beam_energy, hash_key); | |
167 | return hash_key; | ||
168 | } else { | ||
169 |
3/4✓ Branch 0 (8→9) taken 3996 times.
✓ Branch 1 (8→11) taken 4 times.
✗ Branch 2 (10→11) not taken.
✓ Branch 3 (10→12) taken 3996 times.
|
4000 | if(o_runnum->IsEmpty() || o_runnum->Load(0) != runnum) |
170 | 4 | Reload(runnum, beam_energy, 0); | |
171 | 4000 | return 0; | |
172 | } | ||
173 | } | ||
174 | |||
175 | /////////////////////////////////////////////////////////////////////////////// | ||
176 | |||
177 | 8 | void InclusiveKinematics::Reload(int const runnum, double const user_beam_energy, concurrent_key_t key) const | |
178 | { | ||
179 | 8 | std::lock_guard<std::mutex> const lock(m_mutex); | |
180 |
2/4✓ Branch 0 (3→4) taken 8 times.
✗ Branch 1 (3→202) not taken.
✓ Branch 2 (4→5) taken 8 times.
✗ Branch 3 (4→202) not taken.
|
8 | m_log->Trace("-> calling Reload({}, {}, {})", runnum, user_beam_energy, key); |
181 |
1/2✓ Branch 0 (4→5) taken 8 times.
✗ Branch 1 (4→202) not taken.
|
8 | o_runnum->Save(runnum, key); |
182 | |||
183 | // parse config params | ||
184 |
2/4✓ Branch 0 (5→6) taken 8 times.
✗ Branch 1 (5→7) not taken.
✓ Branch 2 (6→7) taken 8 times.
✗ Branch 3 (6→202) not taken.
|
8 | auto beam_energy = user_beam_energy < 0 ? m_rcdb->GetBeamEnergy(runnum) : user_beam_energy; |
185 |
10/20✓ Branch 0 (7→8) taken 8 times.
✗ Branch 1 (7→142) not taken.
✓ Branch 2 (8→9) taken 8 times.
✗ Branch 3 (8→142) not taken.
✓ Branch 4 (9→10) taken 8 times.
✗ Branch 5 (9→142) not taken.
✓ Branch 6 (10→11) taken 8 times.
✗ Branch 7 (10→136) not taken.
✓ Branch 8 (14→15) taken 8 times.
✗ Branch 9 (14→128) not taken.
✓ Branch 10 (15→16) taken 8 times.
✗ Branch 11 (15→126) not taken.
✓ Branch 12 (16→17) taken 8 times.
✗ Branch 13 (16→120) not taken.
✓ Branch 14 (24→25) taken 24 times.
✓ Branch 15 (24→27) taken 8 times.
✓ Branch 16 (34→35) taken 8 times.
✗ Branch 17 (34→169) not taken.
✗ Branch 18 (129→130) not taken.
✗ Branch 19 (129→132) not taken.
|
56 | auto beam_direction = GetOptionVector<double>("beam_direction", {"initial_state", GetConfig()->InRange("runs", runnum), "beam_direction"}); |
186 |
8/18✓ Branch 0 (35→36) taken 8 times.
✗ Branch 1 (35→169) not taken.
✓ Branch 2 (36→37) taken 8 times.
✗ Branch 3 (36→169) not taken.
✓ Branch 4 (37→38) taken 8 times.
✗ Branch 5 (37→163) not taken.
✓ Branch 6 (41→42) taken 8 times.
✗ Branch 7 (41→155) not taken.
✓ Branch 8 (42→43) taken 8 times.
✗ Branch 9 (42→153) not taken.
✓ Branch 10 (43→44) taken 8 times.
✗ Branch 11 (43→147) not taken.
✓ Branch 12 (51→52) taken 24 times.
✓ Branch 13 (51→54) taken 8 times.
✗ Branch 14 (156→157) not taken.
✗ Branch 15 (156→159) not taken.
✗ Branch 16 (198→199) not taken.
✗ Branch 17 (198→201) not taken.
|
56 | auto target_particle = GetOptionScalar<std::string>("target_particle", {"initial_state", GetConfig()->InRange("runs", runnum), "target_particle"}); |
187 | |||
188 | // get the target mass and momentum | ||
189 | double target_mass = -1; | ||
190 |
1/2✓ Branch 0 (66→62) taken 56 times.
✗ Branch 1 (66→67) not taken.
|
56 | for(auto const& [pdg, name] : particle::name) { |
191 |
2/2✓ Branch 0 (62→63) taken 8 times.
✓ Branch 1 (62→65) taken 48 times.
|
56 | if(name == target_particle) { |
192 | 8 | target_mass = particle::mass.at(pdg); | |
193 | 8 | break; | |
194 | } | ||
195 | } | ||
196 |
1/2✗ Branch 0 (67→68) not taken.
✓ Branch 1 (67→81) taken 8 times.
|
8 | if(target_mass < 0) { |
197 | ✗ | m_log->Error("Unknown target particle {:?}", target_particle); | |
198 | ✗ | throw std::runtime_error("Reload failed"); | |
199 | } | ||
200 | double target_px = 0.0; | ||
201 | double target_py = 0.0; | ||
202 | double target_pz = 0.0; | ||
203 | |||
204 | // get the beam momentum | ||
205 | double beam_px, beam_py, beam_pz; | ||
206 |
1/2✗ Branch 0 (83→84) not taken.
✓ Branch 1 (83→88) taken 8 times.
|
8 | if(beam_direction.size() != 3) { |
207 | ✗ | m_log->Error("Beam direction is not a 3-vector; assuming it is (0, 0, 1) instead"); | |
208 | ✗ | beam_direction = {0.0, 0.0, 1.0}; | |
209 | } | ||
210 | 8 | auto dir_mag = std::hypot(beam_direction[0], beam_direction[1], beam_direction[2]); | |
211 | 8 | auto beam_p = std::sqrt(std::pow(beam_energy, 2) - std::pow(o_beam_mass, 2)); | |
212 |
1/2✓ Branch 0 (93→94) taken 8 times.
✗ Branch 1 (93→96) not taken.
|
8 | if(dir_mag > 0) { |
213 | 8 | beam_px = beam_direction[0] * beam_p / dir_mag; | |
214 | 8 | beam_py = beam_direction[1] * beam_p / dir_mag; | |
215 |
1/2✓ Branch 0 (94→95) taken 8 times.
✗ Branch 1 (94→192) not taken.
|
8 | beam_pz = beam_direction[2] * beam_p / dir_mag; |
216 | } | ||
217 | else { | ||
218 | ✗ | m_log->Error("Beam direction magnitude is not > 0"); | |
219 | ✗ | throw ::std::runtime_error("Reload failed"); | |
220 | } | ||
221 | |||
222 | // save the configuration | ||
223 |
1/2✓ Branch 0 (95→100) taken 8 times.
✗ Branch 1 (95→192) not taken.
|
8 | m_log->Trace("-> Reloaded beam: ({}, {}, {}, {})", beam_px, beam_py, beam_pz, o_beam_mass); |
224 |
1/2✓ Branch 0 (100→101) taken 8 times.
✗ Branch 1 (100→192) not taken.
|
8 | m_log->Trace("-> Reloaded target: ({}, {}, {}, {})", target_px, target_py, target_pz, target_mass); |
225 |
3/6✓ Branch 0 (100→101) taken 8 times.
✗ Branch 1 (100→192) not taken.
✓ Branch 2 (101→102) taken 8 times.
✗ Branch 3 (101→184) not taken.
✓ Branch 4 (105→106) taken 8 times.
✗ Branch 5 (105→192) not taken.
|
16 | o_beam_PxPyPzM->Save({beam_px, beam_py, beam_pz, o_beam_mass}, key); |
226 |
3/8✓ Branch 0 (105→106) taken 8 times.
✗ Branch 1 (105→192) not taken.
✓ Branch 2 (106→107) taken 8 times.
✗ Branch 3 (106→188) not taken.
✓ Branch 4 (110→111) taken 8 times.
✗ Branch 5 (110→113) not taken.
✗ Branch 6 (192→193) not taken.
✗ Branch 7 (192→195) not taken.
|
16 | o_target_PxPyPzM->Save({target_px, target_py, target_pz, target_mass}, key); |
227 |
0/4✗ Branch 0 (143→144) not taken.
✗ Branch 1 (143→146) not taken.
✗ Branch 2 (170→171) not taken.
✗ Branch 3 (170→173) not taken.
|
8 | } |
228 | |||
229 | /////////////////////////////////////////////////////////////////////////////// | ||
230 | |||
231 | 968 | InclusiveKinematicsVars InclusiveKinematics::ComputeFromLepton( | |
232 | vector_element_t const lepton_px, | ||
233 | vector_element_t const lepton_py, | ||
234 | vector_element_t const lepton_pz, | ||
235 | concurrent_key_t const key | ||
236 | ) const | ||
237 | { | ||
238 | 968 | InclusiveKinematicsVars result; | |
239 | |||
240 | 968 | m_log->Trace("Reconstruct inclusive kinematics from lepton with p=({}, {}, {}), key={}", lepton_px, lepton_py, lepton_pz, key); | |
241 | |||
242 | enum {px, py, pz, m}; | ||
243 | 968 | auto beam = o_beam_PxPyPzM->Load(key); | |
244 |
1/2✓ Branch 0 (4→5) taken 968 times.
✗ Branch 1 (4→57) not taken.
|
968 | auto target = o_target_PxPyPzM->Load(key); |
245 | |||
246 | ROOT::Math::PxPyPzMVector vec_beam(beam[px], beam[py], beam[pz], beam[m]); | ||
247 | ROOT::Math::PxPyPzMVector vec_target(target[px], target[py], target[pz], target[m]); | ||
248 | ROOT::Math::PxPyPzMVector vec_lepton(lepton_px, lepton_py, lepton_pz, beam[m]); | ||
249 | |||
250 | auto vec_q = vec_beam - vec_lepton; | ||
251 | 968 | result.qx = vec_q.Px(); | |
252 | 968 | result.qy = vec_q.Py(); | |
253 | 968 | result.qz = vec_q.Pz(); | |
254 |
1/2✗ Branch 0 (26→27) not taken.
✓ Branch 1 (26→28) taken 968 times.
|
968 | result.qE = vec_q.E(); |
255 | 968 | result.Q2 = -1 * vec_q.M2(); | |
256 | 968 | result.x = result.Q2 / (2 * vec_q.Dot(vec_target)); | |
257 |
1/2✓ Branch 0 (32→33) taken 968 times.
✗ Branch 1 (32→53) not taken.
|
968 | result.y = vec_target.Dot(vec_q) / vec_target.Dot(vec_beam); |
258 | ✗ | result.W = (vec_beam + vec_target - vec_lepton).M(); | |
259 |
1/2✗ Branch 0 (41→42) not taken.
✓ Branch 1 (41→43) taken 968 times.
|
1936 | result.nu = vec_target.Dot(vec_q) / target[m]; |
260 | 968 | result.beamPz = beam[pz]; | |
261 |
1/2✓ Branch 0 (45→46) taken 968 times.
✗ Branch 1 (45→53) not taken.
|
968 | result.targetM = target[m]; |
262 | |||
263 |
1/2✓ Branch 0 (46→47) taken 968 times.
✗ Branch 1 (46→49) not taken.
|
968 | m_log->Trace("Result: Q2={} x={} W={}", result.Q2, result.x, result.W); |
264 | |||
265 | 968 | return result; | |
266 | } | ||
267 | |||
268 | /////////////////////////////////////////////////////////////////////////////// | ||
269 | |||
270 | 4 | void InclusiveKinematics::Stop() | |
271 | { | ||
272 | 4 | } | |
273 | |||
274 | } | ||
275 |