21 #include <pdbcalbase/PdbParameterMap.h>
22 #include <phparameter/PHParameters.h>
42 #define LogDebug(exp) std::cout << "DEBUG: " << __FILE__ << ": " << __LINE__ << ": " << exp << "\n"
43 #define LogError(exp) std::cout << "ERROR: " << __FILE__ << ": " << __LINE__ << ": " << exp << "\n"
44 #define LogWarning(exp) std::cout << "WARNING: " << __FILE__ << ": " << __LINE__ << ": " << exp << "\n"
46 const std::string
xyzt[] = {
"x",
"y",
"z",
"t"};
54 , m_TruthInfoContainer(nullptr)
56 , m_VertexMap(nullptr)
57 , m_TracksEvalTree(nullptr)
58 , m_VertexEvalTree(nullptr)
59 , m_H2D_DeltaMomVsTruthMom(nullptr)
60 , m_H2D_DeltaMomVsTruthEta(nullptr)
82 , m_TTree_layer{0,0,0}
141 PHParameters B0TrackFastSim_Parameter(
"B0TrackFastSim");
143 PdbParameterMap *nodeparams = findNode::getClass<PdbParameterMap>(topNode,
144 "B0TrackFastSim_Parameter");
147 std::cout << __PRETTY_FUNCTION__ <<
" : Warning, missing B0TrackFastSim_Parameter node and skip saving hits"
152 B0TrackFastSim_Parameter.
FillFrom(nodeparams);
155 std::cout << __PRETTY_FUNCTION__ <<
" B0TrackFastSim_Parameter : ";
156 B0TrackFastSim_Parameter.
Print();
160 for (
auto iter = range.first; iter != range.second; ++iter)
162 const std::string &phg4hit_node_name = iter->first;
163 const int &phg4hit_node_id = iter->second;
165 std::cout << __PRETTY_FUNCTION__ <<
" Prepare PHG4Hit node name " << phg4hit_node_name
166 <<
" with ID = " << phg4hit_node_id << std::endl;
168 std::string branch_name = std::string(
"nHit_") + phg4hit_node_name;
171 (branch_name +
"/I").c_str());
176 "#frac{#Delta p}{truth p} vs. truth #eta", 54, -4.5, +4.5, 1000, -1,
180 "#frac{#Delta p}{truth p} vs. truth p", 41, -0.5, 40.5, 1000, -1,
203 for (
int i = 0; i < 4; i++)
205 std::string bname = iter->first +
"_proj_" +
xyzt[i];
206 std::string bdef = bname +
"/F";
211 bdef = iter->first +
"_proj_path_length" +
"/F";
217 for (
int i = 0; i < 3; i++)
219 std::string bname = iter->first +
"_proj_p" +
xyzt[i];
220 std::string bdef = bname +
"/F";
223 std::string nodename =
"G4HIT_" + iter->first;
227 for (
int i = 0; i < 4; i++)
229 std::string bname = iter->first +
"_" +
xyzt[i];
230 std::string bdef = bname +
"/F";
233 for (
int i = 0; i < 3; i++)
235 std::string bname = iter->first +
"_p" +
xyzt[i];
236 std::string bdef = bname +
"/F";
243 std::cout <<
"InitRun: could not find " << nodename << std::endl;
301 LogError(
"m_TruthInfoContainer not found!");
314 truth_itr != range.second; ++truth_itr)
339 std::cout <<
"B0TrackFastSimEval::fill_track_tree - ignore track that is not a SvtxTrack_FastSim:";
344 if (
Verbosity()) std::cout << __PRETTY_FUNCTION__ <<
" PARTICLE!" << std::endl;
402 if (
Verbosity()) std::cout << __PRETTY_FUNCTION__ <<
" checking " << trkstates->second->get_name() << std::endl;
403 std::map<std::string, unsigned int>::const_iterator iter =
m_ProjectionNameMap.find(trkstates->second->get_name());
407 std::cout << __PRETTY_FUNCTION__ <<
" found " << trkstates->second->get_name() << std::endl;
409 for (
int i = 0; i < 3; i++)
417 std::string nodename =
"G4HIT_" + trkstates->second->get_name();
418 if (nodename.find(
"b0Truth_0") != std::string::npos)
m_TTree_layer[0] = 1;
419 if (nodename.find(
"b0Truth_1") != std::string::npos)
m_TTree_layer[1] = 1;
420 if (nodename.find(
"b0Truth_2") != std::string::npos)
m_TTree_layer[2] = 1;
421 if (nodename.find(
"b0Truth_3") != std::string::npos)
m_TTree_layer[3] = 1;
425 if (
Verbosity()) std::cout << __PRETTY_FUNCTION__ <<
" could not find " << nodename << std::endl;
428 if (
Verbosity()) std::cout << __PRETTY_FUNCTION__ <<
" number of hits: " << hits->
size() << std::endl;
432 if (
Verbosity()) std::cout << __PRETTY_FUNCTION__ <<
" checking hit id " << hit_iter->second->get_trkid() <<
" against " << track->
get_truth_track_id() << std::endl;
435 if (
Verbosity()) std::cout << __PRETTY_FUNCTION__ <<
" found hit with id " << hit_iter->second->get_trkid() << std::endl;
438 std::cout <<
"bad index: " << iter->second << std::endl;
455 for (
const auto &g4hit_id_hitset : track->
g4hit_ids())
457 const int &g4hit_id = g4hit_id_hitset.first;
458 const std::set<PHG4HitDefs::keytype> &g4hit_set = g4hit_id_hitset.second;
463 nhit_iter->second = g4hit_set.size();
482 LogError(
"m_TruthInfoContainer not found!");
527 int best_n_match = -1;
528 std::map<PHG4VtxPoint *, int> vertex_match_map;
531 const auto &trackid = *iter_2;
545 int n_match = ++vertex_match_map[vtx];
547 if (n_match > best_n_match)
549 best_n_match = n_match;
611 for (
auto &elem :
m_TTree_proj_vec) std::fill(elem.begin(), elem.end(), -9999);
613 for (
auto &elem :
m_TTree_ref_vec) std::fill(elem.begin(), elem.end(), -9999);
630 std::cout <<
PHWHERE <<
" PHG4TruthInfoContainer node not found on node tree"
635 m_TrackMap = findNode::getClass<SvtxTrackMap>(topNode,
640 std::cout <<
PHWHERE <<
"SvtxTrackMap node with name "
642 <<
" not found on node tree"
647 m_VertexMap = findNode::getClass<SvtxVertexMap>(topNode,
"SvtxVertexMap");
650 std::cout <<
PHWHERE <<
"SvtxTrackMap node with name SvtxVertexMap not found on node tree. Will not build the vertex eval tree"
659 if (
Verbosity() > 0) std::cout <<
"B0TrackFastSimEval::AddProjection: Adding " << name << std::endl;
660 std::vector<float> floatvec{-9999, -9999, -9999, -9999};