14 #include <g4hough/SvtxVertexMap.h>
15 #include <g4hough/SvtxVertex.h>
16 #include <g4hough/SvtxTrackMap.h>
17 #include <g4hough/SvtxTrack.h>
24 #include <calobase/RawTowerContainer.h>
25 #include <calobase/RawTowerGeomContainer.h>
26 #include <calobase/RawTower.h>
27 #include <calobase/RawClusterContainer.h>
28 #include <calobase/RawCluster.h>
32 #include <TDatabasePDG.h>
39 #include <boost/format.hpp>
40 #include <boost/math/special_functions/sign.hpp>
64 fname << _file_prefix <<
"_Event" << _event <<
".dat";
67 for (
auto & calo_name : _calo_names)
69 string towernodename =
"TOWER_CALIB_" + calo_name;
72 towernodename.c_str());
75 std::cout <<
PHWHERE <<
": Could not find node "
76 << towernodename.c_str() << std::endl;
79 string towergeomnodename =
"TOWERGEOM_" + calo_name;
84 cout <<
PHWHERE <<
": Could not find node "
85 << towergeomnodename.c_str() << endl;
89 set<const RawTower *> good_towers;
93 for (rtiter = begin_end.first; rtiter != begin_end.second; ++rtiter)
99 good_towers.insert(tower);
105 % good_towers.size()) << endl;
108 for (
const auto &
tower : good_towers)
115 phi = atan2(cos(phi), sin(phi));
126 %
tower->get_energy());
134 fdata <<
"Track list" << endl;
141 cerr <<
PHWHERE <<
" ERROR: Can't find G4TruthInfo" << endl;
156 iter != range.second; ++iter)
160 const TVector3 mom(g4particle->
get_px(), g4particle->
get_py(),
163 std::set<PHG4Hit*> g4hits = trutheval->
all_truth_hits(g4particle);
165 map<float, PHG4Hit *> time_sort;
166 map<float, PHG4Hit *> layer_sort;
167 for (
auto & hit : g4hits)
171 time_sort[hit->get_avg_t()] = hit;
175 for (
auto & hit_pair : time_sort)
178 if (hit_pair.second->get_layer() != UINT_MAX
179 and layer_sort.find(hit_pair.second->get_layer())
182 layer_sort[hit_pair.second->get_layer()] = hit_pair.second;
191 TVector3 last_pos(0, 0, 0);
194 for (
auto & hit_pair : layer_sort)
196 TVector3
pos(hit_pair.second->get_avg_x(),
197 hit_pair.second->get_avg_y(),
198 hit_pair.second->get_avg_z());
202 and hit_pair.first != (layer_sort.rbegin()->first)
203 and hit_pair.first != (layer_sort.begin()->first))
224 const int abs_pid = abs(g4particle->
get_pid());
227 == TDatabasePDG::Instance()->GetParticle(
"pi+")->PdgCode())
232 == TDatabasePDG::Instance()->GetParticle(
"proton")->PdgCode())
237 == TDatabasePDG::Instance()->GetParticle(
"K+")->PdgCode())
242 == TDatabasePDG::Instance()->GetParticle(
"e-")->PdgCode())
247 const TParticlePDG * pdg_part =
248 TDatabasePDG::Instance()->GetParticle(11);
250 (pdg_part !=
nullptr) ? (
copysign(1, pdg_part->Charge())) : 0;
254 "{ \"pt\": %1%, \"t\": %2%, \"e\": %3%, \"p\": %4%, \"c\": %5%, \"pts\":[ %6% ]}")
255 % mom.Pt() % t % mom.PseudoRapidity() % mom.Phi() % c
256 % spts.str()) << endl;