16 #include <b2bii/utility/BelleMdstToGenHepevt.h>
19 static const Belle::Gen_hepevt& gen_level_step1(
const Belle::Gen_hepevt& gen)
21 return (gen && gen.mother() && gen.isthep() < 0 && gen.isthep() != -10)
22 ? gen_level_step1(gen.mother()) : gen;
26 static const Belle::Gen_hepevt& gen_level_step2(
const Belle::Gen_hepevt& gen)
28 return (gen && gen.mother() && gen.isthep() < 0)
29 ? gen_level_step2(gen.mother()) : gen;
32 const Belle::Gen_hepevt& gen_level(
const Belle::Gen_hepevt& gen)
34 const Belle::Gen_hepevt& level1(gen_level_step1(gen));
35 if (!level1 || level1.isthep() >= 0) {
37 }
else if (level1.isthep() == -10) {
38 const Belle::Gen_hepevt& level2(gen_level_step2(gen));
40 if (level2.idhep() == 310 || abs(level2.idhep()) == 3122)
return level1;
47 const Belle::Gen_hepevt& get_hepevt(
const Belle::Mdst_trk& trk,
int i)
49 Belle::Mdst_sim_trk_Manager& xrefmgr = Belle::Mdst_sim_trk_Manager::get_manager();
50 Belle::Mdst_sim_trk_Index index(xrefmgr.index(
"trk"));
52 Belle::Panther_ID trackID(trk.get_ID());
53 std::vector<Belle::Mdst_sim_trk> point = point_from(trackID, index);
54 if (i >= 0 && i < (
int)point.size())
return point[i].hepevt();
55 else return Belle::Gen_hepevt_Manager::get_manager().get_NULL();
58 const Belle::Gen_hepevt& get_hepevt(
const Belle::Mdst_charged& ch,
int i)
60 if (!Belle::Mdst_sim_trk_Manager::get_manager().count()) {
62 Belle::Mdst_sim_xref_Manager& xrefmgr = Belle::Mdst_sim_xref_Manager::get_manager();
63 Belle::Mdst_sim_xref_Index index(xrefmgr.index(
"charged"));
65 Belle::Panther_ID trackID(ch.get_ID());
66 std::vector<Belle::Mdst_sim_xref> point = point_from(trackID, index);
67 if (i >= 0 && i < (
int)point.size())
return point[i].hepevt();
68 else return Belle::Gen_hepevt_Manager::get_manager().get_NULL();
70 return get_hepevt(ch.trk(), i);
73 const Belle::Gen_hepevt& get_hepevt(
const Belle::Mdst_ecl& ecl,
int i)
75 Belle::Mdst_sim_ecl_Manager& xrefmgr = Belle::Mdst_sim_ecl_Manager::get_manager();
76 Belle::Mdst_sim_ecl_Index index(xrefmgr.index(
"ecl"));
78 Belle::Panther_ID eclID(ecl.get_ID());
79 std::vector<Belle::Mdst_sim_ecl> point = point_from(eclID, index);
80 if (i >= 0 && i < (
int)point.size())
return point[i].hepevt();
81 else return Belle::Gen_hepevt_Manager::get_manager().get_NULL();
84 const Belle::Gen_hepevt& get_hepevt(
const Belle::Mdst_gamma& gamma,
int i)
86 if (!Belle::Mdst_sim_ecl_Manager::get_manager().count()) {
89 return Belle::Gen_hepevt_Manager::get_manager().get_NULL();
91 return get_hepevt(gamma.ecl(), i);