Classes | Functions | Variables
pionana Namespace Reference

Classes

class  TruthAnalyzer
 

Functions

std::vector< int > MakeSlices (double E0, double Ef, double p, const simb::MCParticle *part)
 
std::map< size_t, double > GetEDepByTraj (const simb::MCParticle *part, int id, const std::vector< sim::SimEnergyDeposit > &dep_vec, const sim::ParticleList &plist)
 
std::map< size_t, std::vector< int > > GetEMDaughterByTraj (const simb::MCParticle *part, const sim::ParticleList &plist)
 
double gamma (double KE, const simb::MCParticle *part)
 
double beta (double KE, const simb::MCParticle *part)
 
double Tmax (double KE, const simb::MCParticle *part)
 
double dEdX (double KE, const simb::MCParticle *part)
 
double MPV (double KE, double p, const simb::MCParticle *part)
 

Variables

double K = .30705
 
double A = 39.95
 
double Z = 18
 
double I = 188.e-6
 
double me = .511
 
double rho = 1.39
 

Function Documentation

double pionana::beta ( double  KE,
const simb::MCParticle part 
)

Definition at line 59 of file TruthAnalyzer_module.cc.

59  {
60  return sqrt(1. - 1./(gamma(KE, part)*gamma(KE, part)));
61  }
double gamma(double KE, const simb::MCParticle *part)
double pionana::dEdX ( double  KE,
const simb::MCParticle part 
)

Definition at line 67 of file TruthAnalyzer_module.cc.

67  {
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  }
double beta(double KE, const simb::MCParticle *part)
double gamma(double KE, const simb::MCParticle *part)
#define A
Definition: memgrp.cpp:38
double Tmax(double KE, const simb::MCParticle *part)
double pionana::gamma ( double  KE,
const simb::MCParticle part 
)

Definition at line 55 of file TruthAnalyzer_module.cc.

55  {
56  return (KE + part->Mass())/part->Mass();
57  }
double Mass() const
Definition: MCParticle.h:239
std::map< size_t, double > pionana::GetEDepByTraj ( const simb::MCParticle part,
int  id,
const std::vector< sim::SimEnergyDeposit > &  dep_vec,
const sim::ParticleList &  plist 
)

Definition at line 96 of file TruthAnalyzer_module.cc.

99  {
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 }
double Z(const size_type i) const
Definition: MCTrajectory.h:151
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:253
std::map< size_t, std::vector< int > > GetEMDaughterByTraj(const simb::MCParticle *part, const sim::ParticleList &plist)
size_type size() const
Definition: MCTrajectory.h:166
Energy deposition in the active material.
std::map< size_t, std::vector< int > > pionana::GetEMDaughterByTraj ( const simb::MCParticle part,
const sim::ParticleList &  plist 
)

Definition at line 136 of file TruthAnalyzer_module.cc.

138  {
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 }
double Z(const size_type i) const
Definition: MCTrajectory.h:151
std::string string
Definition: nybbler.cc:12
const simb::MCTrajectory & Trajectory() const
Definition: MCParticle.h:253
int NumberDaughters() const
Definition: MCParticle.h:217
int Daughter(const int i) const
Definition: MCParticle.cxx:112
def process(f, kind)
Definition: search.py:254
size_type size() const
Definition: MCTrajectory.h:166
std::vector< int > pionana::MakeSlices ( double  E0,
double  Ef,
double  p,
const simb::MCParticle part 
)

Definition at line 82 of file TruthAnalyzer_module.cc.

82  {
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 }
double Mass() const
Definition: MCParticle.h:239
double MPV(double KE, double p, const simb::MCParticle *part)
p
Definition: test.py:223
std::vector< TCSlice > slices
Definition: DataStructs.cxx:12
static QCString * s
Definition: config.cpp:1042
double pionana::MPV ( double  KE,
double  p,
const simb::MCParticle part 
)

Definition at line 76 of file TruthAnalyzer_module.cc.

76  {
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  }
double beta(double KE, const simb::MCParticle *part)
p
Definition: test.py:223
double gamma(double KE, const simb::MCParticle *part)
#define A
Definition: memgrp.cpp:38
double pionana::Tmax ( double  KE,
const simb::MCParticle part 
)

Definition at line 63 of file TruthAnalyzer_module.cc.

63  {
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  }
double beta(double KE, const simb::MCParticle *part)
double Mass() const
Definition: MCParticle.h:239
double gamma(double KE, const simb::MCParticle *part)

Variable Documentation

double pionana::A = 39.95

Definition at line 38 of file TruthAnalyzer_module.cc.

double pionana::I = 188.e-6

Definition at line 40 of file TruthAnalyzer_module.cc.

double pionana::K = .30705

Definition at line 37 of file TruthAnalyzer_module.cc.

double pionana::me = .511

Definition at line 41 of file TruthAnalyzer_module.cc.

double pionana::rho = 1.39

Definition at line 42 of file TruthAnalyzer_module.cc.

double pionana::Z = 18

Definition at line 39 of file TruthAnalyzer_module.cc.