119 std::vector<G4ReweightTraj *> results;
124 std::map<size_t, std::string> proc_map;
125 for (
auto it = procs.begin(); it != procs.end(); ++it) {
129 std::vector<double> traj_X, traj_Y, traj_Z;
133 std::vector<std::pair<size_t, size_t>>
ranges;
136 bool found_material =
false;
137 size_t start = 0,
end = 0;
139 if (fVerbose) std::cout <<
"N traj pts: " <<
147 const TGeoMaterial * test_material = geo_serv->
Material(test_point);
148 if (!test_material)
continue;
152 std::cout << i <<
" " <<
"LAr: " << test_material->GetDensity() <<
" " <<
153 test_material->GetA() <<
" " << test_material->GetZ() <<
154 " " << x <<
" " << y <<
" " << z <<
158 if (!found_material) {
159 found_material =
true;
174 std::cout << i <<
" " << test_material->GetName() <<
" " <<
175 test_material->GetDensity() <<
" " <<
176 test_material->GetA() <<
" " << test_material->GetZ() <<
177 " " << x <<
" " << y <<
" " << z <<
180 if (found_material) {
181 found_material =
false;
183 ranges.push_back({start,
end});
190 if (found_material) {
198 double mass = part.
Mass()*1.e3;
222 for (
size_t i = 0; i < ranges.size(); ++i) {
224 G4ReweightTraj * theTraj =
new G4ReweightTraj(i, part.
PdgCode(), 0,
event, {0,0});
226 for (
size_t j = ranges[i].first; j < ranges[i].second; ++j) {
231 double len = sqrt(dx*dx + dy*dy + dz*dz);
233 double preStepP[3] = {part.
Px(j)*1.e3,
237 double postStepP[3] = {part.
Px(j + 1)*1.e3,
239 part.
Pz(j + 1)*1.e3};
240 if (j == ranges[i].first) {
241 double p_squared = preStepP[0]*preStepP[0] + preStepP[1]*preStepP[1] +
242 preStepP[2]*preStepP[2];
243 theTraj->SetEnergy(sqrt(p_squared + mass*mass));
247 auto itProc = proc_map.find(j);
248 if (itProc != proc_map.end() &&
250 proc = itProc->second;
261 G4ReweightStep *
step =
new G4ReweightStep(i, part.
PdgCode(),
262 0,
event, preStepP, postStepP,
264 theTraj->AddStep(step);
267 results.push_back(theTraj);
270 if (results.size()) {
274 auto d_part = plist[d_index];
276 int d_PDG = d_part->PdgCode();
277 int d_ID = d_part->TrackId();
279 results.back()->AddChild(
new G4ReweightTraj(d_ID, d_PDG,
280 results.size() - 1,
event, {0,0}));
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
unsigned int NumberTrajectoryPoints() const
const TLorentzVector & Position(const int i=0) const
double Py(const int i=0) const
const simb::MCTrajectory & Trajectory() const
std::string KeyToProcess(unsigned char const &key) const
double Px(const int i=0) const
int NumberDaughters() const
int Daughter(const int i) const
std::string EndProcess() const
ProcessMap const & TrajectoryProcesses() const
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double >, ROOT::Math::GlobalCoordinateSystemTag > Point_t
Type for representation of position in physical 3D space.
double Pz(const int i=0) const
TGeoMaterial const * Material(geo::Point_t const &point) const
Returns the material at the specified position.
QTextStream & endl(QTextStream &s)