47 double lheHT = 0, lheHTIncoming = 0;
48 unsigned int lheNj = 0, lheNb = 0, lheNc = 0, lheNuds = 0, lheNglu = 0;
51 const auto & hepeup = lheProd.
hepeup();
52 const auto & pup = hepeup.
PUP;
53 int lep = -1, lepBar = -1, nu = -1, nuBar = -1;
54 std::vector<float> vals_pt;
55 std::vector<float> vals_eta;
56 std::vector<float> vals_phi;
57 std::vector<float> vals_mass;
58 std::vector<int> vals_pid;
59 for (
unsigned int i = 0,
n = pup.size();
i <
n; ++
i) {
63 TLorentzVector
p4(pup[
i][0], pup[i][1], pup[i][2], pup[i][3]);
64 vals_pt.push_back(
p4.Pt());
65 vals_eta.push_back(
p4.Eta());
66 vals_phi.push_back(
p4.Phi());
67 vals_mass.push_back(
p4.M());
68 vals_pid.push_back(hepeup.IDUP[
i]);
70 if ( (status == 1) && ( ( idabs == 21 ) || (idabs > 0 && idabs < 7) ) ) {
73 if (idabs==5) lheNb++;
74 else if (idabs==4) lheNc++;
75 else if (idabs <= 3 ) lheNuds++;
76 else if (idabs == 21) lheNglu++;
78 double pt = std::hypot( pup[
i][0], pup[i][1] );
80 int mothIdx =
std::max(hepeup.MOTHUP[
i].first-1,0);
81 int mothIdxTwo =
std::max(hepeup.MOTHUP[
i].second-1,0);
82 int mothStatus = hepeup.ISTUP[mothIdx];
83 int mothStatusTwo = hepeup.ISTUP[mothIdxTwo];
84 bool hasIncomingAsMother = mothStatus<0 || mothStatusTwo<0;
85 if (hasIncomingAsMother) lheHTIncoming +=
pt;
86 }
else if (idabs == 12 || idabs == 14 || idabs == 16) {
87 (hepeup.IDUP[
i] > 0 ? nu : nuBar) =
i;
88 }
else if (idabs == 11 || idabs == 13 || idabs == 15) {
89 (hepeup.IDUP[
i] > 0 ? lep : lepBar) =
i;
92 std::pair<int,int>
v(0,0);
93 if (lep != -1 && lepBar != -1)
v = std::make_pair(lep,lepBar);
94 else if (lep != -1 && nuBar != -1)
v = std::make_pair(lep, nuBar);
95 else if (nu != -1 && lepBar != -1)
v = std::make_pair(nu ,lepBar);
96 else if (nu != -1 && nuBar != -1)
v = std::make_pair(nu , nuBar);
97 if (
v.first != -1 &&
v.second != -1) {
98 lheVpt = std::hypot( pup[
v.first][0] + pup[
v.second][0], pup[
v.first][1] + pup[
v.second][1] );
113 auto outPart = std::make_unique<nanoaod::FlatTable>(vals_pt.size(),
"LHEPart",
false);
const lhef::HEPEUP & hepeup() const
const unsigned int precision_
std::vector< FiveVector > PUP
Abs< T >::type abs(const T &t)
void addColumnValue(const std::string &name, const C &value, const std::string &docString, ColumnType type=defaultColumnType< T >(), int mantissaBits=-1)