TruthAnalyzer_module.cc
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////
2 // Class: TruthAnalyzer
3 // Plugin Type: analyzer (art v3_05_01)
4 // File: TruthAnalyzer_module.cc
5 //
6 // Generated at Tue Nov 24 17:23:39 2020 by Jacob Calcutt using cetskelgen
7 // from cetlib version v3_10_00.
8 ////////////////////////////////////////////////////////////////////////
9 
17 #include "fhiclcpp/ParameterSet.h"
23 
25 
28 
29 #include "TTree.h"
30 #include "art_root_io/TFileService.h"
31 
32 #include <deque>
33 
34 namespace pionana {
35  class TruthAnalyzer;
36 
37  double K = .30705;
38  double A = 39.95;
39  double Z = 18;
40  double I = 188.e-6;
41  double me = .511;
42  double rho = 1.39;
43 
44  std::vector<int> MakeSlices(double E0, double Ef, double p, const simb::MCParticle * part);
45 
46  std::map<size_t, double> GetEDepByTraj(
47  const simb::MCParticle * part, int id,
48  const std::vector<sim::SimEnergyDeposit> & dep_vec,
49  const sim::ParticleList & plist);
50 
51  std::map<size_t, std::vector<int>> GetEMDaughterByTraj(
52  const simb::MCParticle * part,
53  const sim::ParticleList & plist);
54 
55  double gamma(double KE, const simb::MCParticle * part) {
56  return (KE + part->Mass())/part->Mass();
57  }
58 
59  double beta(double KE, const simb::MCParticle * part) {
60  return sqrt(1. - 1./(gamma(KE, part)*gamma(KE, part)));
61  }
62 
63  double Tmax(double KE, const simb::MCParticle * part) {
64  return 2*me*(beta(KE, part)*beta(KE, part))*(gamma(KE, part)*gamma(KE, part))/(1 + 2*gamma(KE, part)*me/part->Mass() + (me*me)/(part->Mass()*part->Mass()));
65  }
66 
67  double dEdX(double KE, const simb::MCParticle * part) {
68  double dedx = (rho*K*Z/A);
69  dedx /= (beta(KE, part)*beta(KE, part));
70  double post_factor = .5*log(2*me*(beta(KE, part)*beta(KE, part))*(gamma(KE, part)*gamma(KE, part))*Tmax(KE, part)/(I*I));
71  post_factor -= beta(KE, part)*beta(KE, part);
72  dedx *= post_factor;
73  return dedx;
74  }
75 
76  double MPV(double KE, double p, const simb::MCParticle * part) {
77  return (K/2)*(Z/A)*(p*rho/(beta(KE, part)*beta(KE, part)))*(log(2*me*beta(KE, part)*beta(KE, part)*gamma(KE, part)*gamma(KE, part)/I) + log((K/2)*(Z/A)*p*rho/(beta(KE, part)*beta(KE, part)*I)) + .2 - beta(KE, part)*beta(KE, part));
78  }
79 
80 }
81 
82 std::vector<int> pionana::MakeSlices(double E0, double Ef, double p, const simb::MCParticle * part) {
83  std::vector<int> slices;
84  int s = 0;
85  while (E0 > Ef) {
86  slices.push_back(s);
87  ++s;
88  //std::cout << E0 - 1.e3*part->Mass() << " " << dEdX(E0 - 1.e3*part->Mass(), part) << " " << MPV(E0 - 1.e3*part->Mass(), part)<< std::endl;
89  //E0 -= dEdX(E0 - 1.e3*part->Mass(), part)*p;
90  E0 -= MPV(E0 - 1.e3*part->Mass(), p, part);
91  }
92 
93  return slices;
94 }
95 
96 std::map<size_t, double> pionana::GetEDepByTraj(
97  const simb::MCParticle * part, int id,
98  const std::vector<sim::SimEnergyDeposit> & dep_vec,
99  const sim::ParticleList & plist) {
100 
101  const simb::MCTrajectory & traj = part->Trajectory();
102 
103  //First build up the trajectory points
104  std::map<size_t, double> results;
105  for (size_t i = 0; i < traj.size() - 1; ++i) {
106  results[i] = 0.;
107  }
108 
109  std::map<size_t, std::vector<int>> daughters_by_traj
110  = GetEMDaughterByTraj(part, plist);
111 
112  //Iterate over the deposits
113  for (const sim::SimEnergyDeposit & dep : dep_vec) {
114  if (dep.TrackID() == id) {
115  for (size_t i = 1; i < traj.size(); ++i) {
116  if (traj.Z(i-1) <= dep.MidPointZ() && traj.Z(i) > dep.MidPointZ()) {
117  results[i-1] += dep.Energy();
118  break;
119  }
120  }
121  }
122  else {
123  for (auto it = daughters_by_traj.begin();
124  it != daughters_by_traj.end(); ++it) {
125  for (size_t i = 0; i < it->second.size(); ++i) {
126  if (it->second[i] == dep.TrackID()) {
127  results[it->first] += dep.Energy();
128  }
129  }
130  }
131  }
132  }
133  return results;
134 }
135 
136 std::map<size_t, std::vector<int>> pionana::GetEMDaughterByTraj(
137  const simb::MCParticle * part,
138  const sim::ParticleList & plist) {
139 
140  const simb::MCTrajectory & traj = part->Trajectory();
141  std::map<size_t, std::vector<int>> results;
142 
143  for (int i = 0; i < part->NumberDaughters(); ++i) {
144  int id = part->Daughter(i);
145  auto daughter = plist[id];
146  std::string process = daughter->Process();
147 
148  if ((process.find("Ioni") == std::string::npos) &&
149  (process.find("Brem") == std::string::npos) &&
150  (process.find("annihil") == std::string::npos)) {
151  continue;
152  }
153 
154  for (size_t j = 1; j < traj.size(); ++j) {
155  if (traj.Z(j-1) < daughter->Position().Z() &&
156  daughter->Position().Z() < traj.Z(j)) {
157  //results[j-1].push_back(id);
158  std::deque<int> downstream;
159  downstream.push_back(id);
160 
161 
162  while (!downstream.empty()) {
163  int d_id = downstream.front();
164  auto d_part = plist[d_id];
165  results[j-1].push_back(d_id);
166  for (int k = 0; k < d_part->NumberDaughters(); ++k) {
167  downstream.push_back(d_part->Daughter(k));
168  }
169  downstream.pop_front();
170  }
171  break;
172  }
173  }
174  }
175 
176  return results;
177 }
178 
180 public:
181  explicit TruthAnalyzer(fhicl::ParameterSet const& p);
182  // The compiler-generated destructor is fine for non-base
183  // classes without bare pointers or other resource use.
184 
185  // Plugins should not be copied or assigned.
186  TruthAnalyzer(TruthAnalyzer const&) = delete;
187  TruthAnalyzer(TruthAnalyzer&&) = delete;
188  TruthAnalyzer& operator=(TruthAnalyzer const&) = delete;
190 
191  // Required functions.
192  void analyze(art::Event const& e) override;
193 
194  void beginJob() override;
195  void reset();
196 
197 private:
198 
199  // Declare member data here.
201  int fView;
203  TTree *fTree;
204 
205  double traj_delta_E;
206  double IDE_delta_E;
210  int event, run, subrun;
211  double first_IDE_Z;
213 
215 
216 };
217 
218 
220  : EDAnalyzer{p},
221  fGeneratorTag(p.get<art::InputTag>("GeneratorTag")),
222  fView(p.get<int>("View")),
223  fSimEDepTag(p.get<art::InputTag>("SimEDepTag")) {
224 }
225 
227 {
228  reset();
232  const sim::ParticleList & plist = pi_serv->ParticleList();
233  auto mcTruths = e.getValidHandle<std::vector<simb::MCTruth>>(fGeneratorTag);
235  const simb::MCParticle* true_beam_particle
236  = truthUtil.GetGeantGoodParticle((*mcTruths)[0],e);
237  if (!true_beam_particle) return;
238  const simb::MCTrajectory & true_beam_trajectory = true_beam_particle->Trajectory();
239 
240  run = e.run();
241  subrun = e.subRun();
242  event = e.id().event();
243 
244  double init_KE = 0.;
245  //size_t init_pt = 0;
246  //Get the mass for the beam particle
247  int true_beam_ID = true_beam_particle->TrackId();
248  true_beam_endZ = true_beam_particle->EndPosition().Z();
249  true_beam_PDG = true_beam_particle->PdgCode();
250 
251  //std::vector<int> daughters;
252  //std::vector<std::vector<const sim::IDE *>> d_IDEs;
253  //std::vector<double> d_edep;
254  double total_d_edep = 0.;
255 
256  std::deque<int> to_check;
257  std::vector<const sim::IDE *> daughter_IDEs;
258  for (int i = 0; i < true_beam_particle->NumberDaughters(); ++i) {
259  int id = true_beam_particle->Daughter(i);
260  auto part = plist[id];
261  std::string process = part->Process();
262  if ((process.find("Ioni") == std::string::npos) &&
263  (process.find("Brem") == std::string::npos) &&
264  (process.find("annihil") == std::string::npos)) {
265  std::cout << "Skipping " << process << std::endl;
266  continue;
267  }
268  //std::cout << "Adding " << id << " " << part->PdgCode() << std::endl;
269  to_check.push_back(id);
270  }
271 
272  while (!to_check.empty()) {
273  const int id = to_check.front();
274  to_check.pop_front();
275 
276  std::vector<const sim::IDE *> ides
277  = bt_serv->TrackIdToSimIDEs_Ps(id, geo::View_t(fView));
278  daughter_IDEs.insert(daughter_IDEs.end(), ides.begin(), ides.end());
279 
280  for (size_t i = 0; i < ides.size(); ++i) {
281  total_d_edep += ides[i]->energy;
282  }
283 
284  //Get the daughters of this one
285  auto part = plist[id];
286  std::cout << id << " Has daughters: ";
287  for (int i = 0; i < part->NumberDaughters(); ++i) {
288  to_check.push_back(part->Daughter(i));
289  std::cout << part->Daughter(i) << " ";
290  //auto next_part = plist[part->Daughter(i)];
291  //std::cout << next_part->Process() << std::endl;
292  }
293  std::cout << std::endl;
294  }
295 
296  /*double mass = 139.57;
297  if( true_beam_PDG == 2212 ) mass = 938.27;
298  else if( abs(true_beam_PDG) == 211 ) mass = 139.57;
299  else if( abs(true_beam_PDG) == 11 ) mass = .511;
300  else if( abs(true_beam_PDG) == 321 ) mass = 321;
301  else if( abs(true_beam_PDG) == 13 ) mass = 105.66;*/
302 
303  std::cout << "Getting IDEs from " << fView << std::endl;
304  auto view2_IDEs = bt_serv->TrackIdToSimIDEs_Ps( true_beam_ID, geo::View_t(fView) );
305  std::sort(view2_IDEs.begin(), view2_IDEs.end(),
306  [](const sim::IDE * i1, const sim::IDE * i2) {return (i1->z < i2->z);});
307 
308  double ide_z = (view2_IDEs.size() ? view2_IDEs[0]->z : -999.);
309  first_IDE_Z = ide_z;
310  std::cout << "First IDE: " << ide_z << std::endl;
311 
312  for (size_t i = 0; i < view2_IDEs.size(); ++i) {
313  std::cout << i << " " << view2_IDEs[i]->z << std::endl;
314  }
315 
316  std::sort(daughter_IDEs.begin(), daughter_IDEs.end(),
317  [](const sim::IDE * i1, const sim::IDE * i2) {return (i1->z < i2->z);});
318  if (daughter_IDEs.size())
319  std::cout << "First daughter IDE: " << daughter_IDEs[0]->z << std::endl;
320 
321  auto true_beam_procs = true_beam_trajectory.TrajectoryProcesses();
322  std::map<size_t, unsigned char> proc_map(true_beam_procs.begin(),
323  true_beam_procs.end());
324 
325  size_t first_point_in_TPC = 0;
326  for (size_t i = 1; i < true_beam_trajectory.size(); ++i) {
327  double z0 = true_beam_trajectory.Z(i-1);
328  double x0 = true_beam_trajectory.X(i-1);
329  double y0 = true_beam_trajectory.Y(i-1);
330  geo::Point_t test_point{x0, y0, z0};
331  const TGeoMaterial * mat = geom->Material(test_point);
332  std::cout << "Point " << i-1 << " (" << x0 << ", " << y0 <<
333  ", " << z0 << ") Material " << mat->GetName() << " " <<
334  (proc_map.find(i-1) != proc_map.end() ?
335  true_beam_trajectory.KeyToProcess(proc_map[i-1]) :
336  "") << " " << 1.e3*true_beam_trajectory.E(i-1) <<
337  std::endl;
338  std::string proc_name =
339  (proc_map.find(i-1) != proc_map.end() ?
340  true_beam_trajectory.KeyToProcess(proc_map[i-1]) :
341  "");
342  std::string mat_name = mat->GetName();
343  if (mat_name == "LAr" && proc_name == "Transportation") {
344  first_point_in_TPC = i-1;
345  std::cout << "Found first point " << first_point_in_TPC << std::endl;
346  }
347  if (view2_IDEs.size()) {
348  double z1 = true_beam_trajectory.Z(i);
349  double x1 = true_beam_trajectory.X(i);
350  double y1 = true_beam_trajectory.Y(i);
351  if (z0 < ide_z && z1 > ide_z) {
352  geo::Point_t test_point_1{x1, y1, z1};
353  const TGeoMaterial * mat1 = geom->Material(test_point_1);
354  init_KE = 1.e3 * true_beam_trajectory.E(i-1);
355  std::cout << "Found matching position " << z0 << " " << ide_z <<
356  " " << z1 << " Material " << mat1->GetName() << std::endl;
357  std::cout << "init KE: " << init_KE << std::endl;
358  //init_pt = i - 1;
359 
360  std::cout << "energies: " << 1.e3 * true_beam_trajectory.E(i-1) <<
361  " " << 1.e3 * true_beam_trajectory.E(i) << std::endl;
362  std::cout << "Second to last, last point -- (Z, E): " << "(" <<
363  true_beam_trajectory.Z(true_beam_trajectory.size()-2) << ", " <<
364  1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-2) << "), (" <<
365  true_beam_trajectory.Z(true_beam_trajectory.size()-1) << ", " <<
366  1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-1) << ")" <<
367  std::endl;
368  std::cout << "End process: " << true_beam_particle->EndProcess() << std::endl;
369  break;
370  }
371  }
372  std::cout << std::endl;
373  }
374 
375  traj_delta_E = (true_beam_trajectory.E(first_point_in_TPC) -
376  true_beam_trajectory.E(true_beam_trajectory.size() - 2));
377  output_first_point = first_point_in_TPC;
378  first_point_Z = true_beam_trajectory.Z(first_point_in_TPC);
379  first_point_E = true_beam_trajectory.E(first_point_in_TPC);
380 
381  for (size_t i = 0; i < true_beam_trajectory.size(); ++i) {
382  std::cout << "Z, E: " << true_beam_trajectory.Z(i) << " " <<
383  true_beam_trajectory.E(i) << std::endl;
384  true_traj_X.push_back(true_beam_trajectory.X(i));
385  true_traj_Y.push_back(true_beam_trajectory.Y(i));
386  true_traj_Z.push_back(true_beam_trajectory.Z(i));
387  true_traj_E.push_back(true_beam_trajectory.E(i));
388  }
389  if (view2_IDEs.size()) {
390  std::cout << std::endl;
391  double total_edep = 0.;
392  for (size_t i = 0; i < view2_IDEs.size(); ++i) {
393  total_edep += view2_IDEs[i]->energy;
394  //std::cout << "\t" << " " << view2_IDEs[i]->trackID << " " <<
395  // view2_IDEs[i]->z << " " << view2_IDEs[i]->energy <<
396  // std::endl;
397  }
398 
399  std::cout << "Total edep: " << total_edep << std::endl;
400  std::cout << "From daughters: " << total_d_edep << std::endl;
401  std::cout << "Combined: " << total_edep + total_d_edep << std::endl;
402  IDE_delta_E = total_edep + total_d_edep;
403  std::cout << "DeltaE: " << init_KE - (1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-2)) << std::endl;
404  std::cout << "IDE - traj: " << total_edep + total_d_edep - (init_KE - (1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-2))) << std::endl;
405  std::cout << "Energies: " << (1.e3*true_beam_trajectory.E(0)) << " " << init_KE << " " <<
406  (1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-2)) << " " << (1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-1))
407  << std::endl;
408  std::cout << "PDG: " << true_beam_PDG << std::endl;
409 
410  int n_elast = 0;
411  auto true_beam_procs = true_beam_trajectory.TrajectoryProcesses();
412  for (auto it = true_beam_procs.begin();
413  it != true_beam_procs.end(); ++it) {
414  if (true_beam_trajectory.KeyToProcess(it->second) == "hadElastic") {
415  ++n_elast;
416  }
417  }
418  std::cout << "N Elastics " << n_elast << std::endl;
419  }
420 
421  try{
422  auto sim_edep_vec
423  = e.getValidHandle<std::vector<sim::SimEnergyDeposit>>(fSimEDepTag);
424  double total_sim_edep = 0.;
425  double dep_min_z = std::numeric_limits<double>::max();
426  for (const sim::SimEnergyDeposit & dep : (*sim_edep_vec)) {
427  if (dep.TrackID() != true_beam_ID) continue;
428  total_sim_edep += dep.Energy();
429  if (dep.MidPointZ() < dep_min_z) dep_min_z = dep.StartZ();
430  }
431  std::cout << "Min dep z: " << dep_min_z << std::endl;
432 
433  to_check.clear();
434  for (int i = 0; i < true_beam_particle->NumberDaughters(); ++i) {
435  int id = true_beam_particle->Daughter(i);
436  auto part = plist[id];
437  std::string process = part->Process();
438  if ((process.find("Ioni") == std::string::npos) &&
439  (process.find("Brem") == std::string::npos) &&
440  (process.find("annihil") == std::string::npos)) {
441  std::cout << "Skipping " << process << std::endl;
442  continue;
443  }
444  to_check.push_back(id);
445  }
446 
447  while (!to_check.empty()) {
448  const int id = to_check.front();
449  to_check.pop_front();
450 
451  for (const sim::SimEnergyDeposit & dep : (*sim_edep_vec)) {
452  if (dep.TrackID() != id) continue;
453  total_sim_edep += dep.Energy();
454  }
455 
456  //Get the daughters of this one
457  auto part = plist[id];
458  for (int i = 0; i < part->NumberDaughters(); ++i) {
459  to_check.push_back(part->Daughter(i));
460  }
461  }
462  std::cout << "Total Sim EDep: " << total_sim_edep << " " << true_beam_PDG << std::endl;
463 
464  size_t first_point = 0;
465  for (size_t i = 1; i < true_beam_trajectory.size(); ++i) {
466  double z0 = true_beam_trajectory.Z(i-1);
467  double x0 = true_beam_trajectory.X(i-1);
468  double y0 = true_beam_trajectory.Y(i-1);
469  geo::Point_t test_point{x0, y0, z0};
470  const TGeoMaterial * mat = geom->Material(test_point);
471  double z1 = true_beam_trajectory.Z(i);
472  std::cout << "checking " << z0 << " " << dep_min_z << " " << z1 << " " <<
473  1.e3*(true_beam_trajectory.E(i-1) -
474  true_beam_trajectory.E(true_beam_trajectory.size()-2)) <<
475  std::endl;
476  if (z0 <= dep_min_z && z1 > dep_min_z) {
477  first_point = i - 1;
478  init_KE = 1.e3 * true_beam_trajectory.E(i-1);
479  std::cout << "Found matching position " << z0 << " " << dep_min_z <<
480  " " << z1 << " " << mat->GetName() << std::endl;
481  std::cout << "init KE: " << init_KE << std::endl;
482  //init_pt = i - 1;
483 
484  std::cout << "energies: " << 1.e3 * true_beam_trajectory.E(i-1) <<
485  " " << 1.e3 * true_beam_trajectory.E(i) << std::endl;
486  std::cout << "Second to last, last point -- (Z, E): " << "(" <<
487  true_beam_trajectory.Z(true_beam_trajectory.size()-2) << ", " <<
488  1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-2) << "), (" <<
489  true_beam_trajectory.Z(true_beam_trajectory.size()-1) << ", " <<
490  1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-1) << ")" <<
491  std::endl;
492  break;
493  }
494  }
495  std::cout << "SimEDep Delta E: " << init_KE - 1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-2) << std::endl;
496  std::cout << "SimEDep Diff: " <<
497  total_sim_edep - (init_KE - 1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-2)) << " " <<
498  (total_sim_edep - (init_KE - 1.e3*true_beam_trajectory.E(true_beam_trajectory.size()-2)))/total_sim_edep << std::endl;
499 
500  std::map<size_t, double> edep_by_traj
501  = GetEDepByTraj(true_beam_particle, true_beam_ID, (*sim_edep_vec), plist);
502  for (auto it = edep_by_traj.begin(); it != edep_by_traj.end(); ++it) {
503  if (it->second == 0.) continue;
504  std::cout << it->second << " " <<
505  1.e3*(true_beam_trajectory.E(it->first) -
506  true_beam_trajectory.E(it->first + 1)) << std::endl;
507  }
508 
509  std::cout << "First Point: " << first_point << " " <<
510  true_beam_trajectory.Z(first_point) << std::endl;
511  double total = 0.;
512  for (size_t i = first_point; i < true_beam_trajectory.size() - 2; ++i) {
513  std::cout << (true_beam_trajectory.Position(i+1) -
514  true_beam_trajectory.Position(i)).Vect().Mag() << std::endl;
515  total += (true_beam_trajectory.Position(i+1) -
516  true_beam_trajectory.Position(i)).Vect().Mag();
517  }
518  std::cout << "Total len in LAr: " << total << std::endl;
519 
520  double pitch = geom->WirePitch( 2, 1, 0);
521 
522  std::vector<int> slices = MakeSlices(
523  1.e3*true_beam_trajectory.E(first_point),
524  1.e3*true_beam_trajectory.E(true_beam_trajectory.size() - 2),
525  pitch/.96,
526  true_beam_particle);
527  std::cout << "Slices: " << slices.size() << " " << slices.size() * pitch <<
528  std::endl;
529 
530  }
531  catch(const std::exception & e) {
532  std::cout << "can't get sim edep. Moving on" << std::endl;
533  }
534 
535  fTree->Fill();
536 
537 }
538 
540  traj_delta_E = -999.;
541  IDE_delta_E = -999.;
542  true_beam_endZ = -999.;
543  true_beam_PDG = -999;
544  output_first_point = -999.;
545  first_point_Z = -999.;
546  first_point_E = -999.;
547  event = -999;
548  first_IDE_Z = -999.;
549  run = -999;
550  subrun = -999;
551 
552  true_traj_X.clear();
553  true_traj_Y.clear();
554  true_traj_Z.clear();
555  true_traj_E.clear();
556 }
557 
559 
561  fTree = tfs->make<TTree>("beamana","beam analysis tree");
562 
563  fTree->Branch("traj_delta_E", &traj_delta_E);
564  fTree->Branch("IDE_delta_E", &IDE_delta_E);
565  fTree->Branch("true_beam_endZ", &true_beam_endZ);
566  fTree->Branch("true_beam_PDG", &true_beam_PDG);
567  fTree->Branch("output_first_point", &output_first_point);
568  fTree->Branch("first_point_Z", &first_point_Z);
569  fTree->Branch("first_point_E", &first_point_E);
570  fTree->Branch("event", &event);
571  fTree->Branch("run", &run);
572  fTree->Branch("subrun", &subrun);
573  fTree->Branch("first_IDE_Z", &first_IDE_Z);
574  fTree->Branch("true_traj_X", &true_traj_X);
575  fTree->Branch("true_traj_Y", &true_traj_Y);
576  fTree->Branch("true_traj_Z", &true_traj_Z);
577  fTree->Branch("true_traj_E", &true_traj_E);
578 }
579 
double Z(const size_type i) const
Definition: MCTrajectory.h:151
double X(const size_type i) const
Definition: MCTrajectory.h:149
float z
z position of ionization [cm]
Definition: SimChannel.h:117
int PdgCode() const
Definition: MCParticle.h:212
double beta(double KE, const simb::MCParticle *part)
const simb::MCParticle * GetGeantGoodParticle(const simb::MCTruth &genTruth, const art::Event &evt) const
std::map< size_t, double > GetEDepByTraj(const simb::MCParticle *part, int id, const std::vector< sim::SimEnergyDeposit > &dep_vec, const sim::ParticleList &plist)
const TLorentzVector & EndPosition() const
Definition: MCParticle.h:225
double E(const size_type i) const
Definition: MCTrajectory.h:156
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::string string
Definition: nybbler.cc:12
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:253
TruthAnalyzer(fhicl::ParameterSet const &p)
double Mass() const
Definition: MCParticle.h:239
std::string KeyToProcess(unsigned char const &key) const
std::map< size_t, std::vector< int > > GetEMDaughterByTraj(const simb::MCParticle *part, const sim::ParticleList &plist)
double MPV(double KE, double p, const simb::MCParticle *part)
std::vector< const sim::IDE * > TrackIdToSimIDEs_Ps(int const &id) const
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition: EDAnalyzer.h:25
Particle class.
std::vector< double > true_traj_Y
int NumberDaughters() const
Definition: MCParticle.h:217
double dEdX(double KE, const simb::MCParticle *part)
art framework interface to geometry description
int TrackId() const
Definition: MCParticle.h:210
int Daughter(const int i) const
Definition: MCParticle.cxx:112
std::vector< double > true_traj_X
def process(f, kind)
Definition: search.py:254
const double e
double Y(const size_type i) const
Definition: MCTrajectory.h:150
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:67
std::string EndProcess() const
Definition: MCParticle.h:216
Ionization at a point of the TPC sensitive volume.
Definition: SimChannel.h:84
ValidHandle< PROD > getValidHandle(InputTag const &tag) const
Definition: DataViewImpl.h:441
p
Definition: test.py:223
SubRunNumber_t subRun() const
Definition: DataViewImpl.cc:78
TruthAnalyzer & operator=(TruthAnalyzer const &)=delete
RunNumber_t run() const
Definition: DataViewImpl.cc:71
static int max(int a, int b)
double gamma(double KE, const simb::MCParticle *part)
const TLorentzVector & Position(const size_type) const
The accessor methods described above.
ProcessMap const & TrajectoryProcesses() const
Definition: MCTrajectory.h:188
std::vector< TCSlice > slices
Definition: DataStructs.cxx:12
void analyze(art::Event const &e) override
const sim::ParticleList & ParticleList() const
std::vector< double > true_traj_Z
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
Definition: geo_vectors.h:184
size_type size() const
Definition: MCTrajectory.h:166
contains information for a single step in the detector simulation
Energy deposition in the active material.
EventNumber_t event() const
Definition: EventID.h:116
std::vector< int > MakeSlices(double E0, double Ef, double p, const simb::MCParticle *part)
std::vector< double > true_traj_E
static QCString * s
Definition: config.cpp:1042
double Tmax(double KE, const simb::MCParticle *part)
EventID id() const
Definition: Event.cc:34
cet::coded_exception< error, detail::translate > exception
Definition: exception.h:33
QTextStream & endl(QTextStream &s)
Event finding and building.