20 int branchtype_t = -1;
21 int branchtype_tbar = -1;
42 TLorentzVector t_before, t_after;
45 TLorentzVector WpDecay1;
46 TLorentzVector WpDecay2;
52 WpDecay1_pdgId, WpDecay2, WpDecay2_pdgId, has_ph_t, branchtype_t,
55 TLorentzVector ph_tbar;
57 TLorentzVector tbar_before, tbar_after;
60 TLorentzVector WmDecay1;
61 TLorentzVector WmDecay2;
65 WmDecay1, WmDecay1_pdgId, WmDecay2, WmDecay2_pdgId, has_ph_tbar,
66 branchtype_tbar, init_type, missTop);
68 if (event_top && missTbar && has_ph_t && branchtype_t != 10 && branchtype_t != 50 && branchtype_t != 15 &&
70 bool Wonshell =
false;
73 for (
size_t q = 0;
q <
particle->nChildren();
q++) {
80 for (
size_t Wc = 0; Wc <
particle->child(
q)->nChildren(); Wc++) {
81 if (
particle->child(
q)->child(Wc)->pdgId() > 0) {
83 WmDecay1_pdgId =
particle->child(
q)->child(Wc)->pdgId();
85 if (
particle->child(
q)->child(Wc)->pdgId() < 0) {
87 WmDecay2_pdgId =
particle->child(
q)->child(Wc)->pdgId();
95 WmDecay1_pdgId =
particle->child(
q)->pdgId();
100 WmDecay2_pdgId =
particle->child(
q)->pdgId();
102 Wm = WmDecay1 + WmDecay2;
105 if (WmDecay1_pdgId >= 1 && WmDecay1_pdgId <= 4) branchtype_tbar = 50;
106 else if (WmDecay1_pdgId >= 11 && WmDecay1_pdgId <= 16) branchtype_tbar = 10;
108 if (branchtype_tbar == 50 || branchtype_tbar == 10) {
113 }
else if (event_topbar && missTop && has_ph_tbar && branchtype_tbar != 10 && branchtype_tbar != 50 &&
114 branchtype_tbar != 15 && branchtype_tbar != 55) {
115 bool Wonshell =
false;
118 for (
size_t q = 0;
q <
particle->nChildren();
q++) {
125 for (
size_t Wc = 0; Wc <
particle->child(
q)->nChildren(); Wc++) {
126 if (
particle->child(
q)->child(Wc)->pdgId() > 0) {
128 WmDecay1_pdgId =
particle->child(
q)->child(Wc)->pdgId();
130 if (
particle->child(
q)->child(Wc)->pdgId() < 0) {
132 WmDecay2_pdgId =
particle->child(
q)->child(Wc)->pdgId();
140 WmDecay1_pdgId =
particle->child(
q)->pdgId();
145 WmDecay2_pdgId =
particle->child(
q)->pdgId();
147 Wp = WpDecay1 + WpDecay2;
150 if (abs(WmDecay1_pdgId) >= 1 && abs(WmDecay1_pdgId) <= 4) branchtype_t = 50;
151 else if (abs(WmDecay1_pdgId) >= 11 && abs(WmDecay1_pdgId) <= 16) branchtype_t = 10;
152 if (branchtype_t == 50 || branchtype_t == 10) {
186 if ((event_top && !event_topbar) || (!event_top && event_topbar) || (!event_top && !event_topbar)) {
189 if (abs(
particle->pdgId()) == 21) init_type = 1;
190 else if (abs(
particle->pdgId()) < 6) init_type = 2;
196 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_branchtype_t") = branchtype_t;
197 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_branchtype_tbar") = branchtype_tbar;
198 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_initial_parton") = init_type;
200 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_ph_from_t_tbar") = ph_source;
202 else if (event_top && event_topbar) {
203 if (has_ph_t && has_ph_tbar) {
204 if (ph_t.Pt() > ph_tbar.Pt()) {
211 }
else if (has_ph_t) {
215 else if (has_ph_tbar) {
219 else if (!has_ph_t && !has_ph_tbar) {
225 if (ph_source == 0) {
226 if (init_type == 2) {
228 if (branchtype_t == 15 && branchtype_tbar == 15) {
232 else if (init_type == 1) {
234 if (branchtype_t == 15 && branchtype_tbar == 15) {
238 }
else if (ph_source == 1 || ph_source == 2) {
239 if ((branchtype_t == 12 && branchtype_tbar == 50) || (branchtype_t == 50 && branchtype_tbar == 12)) {
242 else if ((branchtype_t == 52 && branchtype_tbar == 10) || (branchtype_t == 10 && branchtype_tbar == 52)) {
245 else if ((branchtype_t == 14 && branchtype_tbar == 50) || (branchtype_t == 50 && branchtype_tbar == 14)) {
248 else if ((branchtype_t == 54 && branchtype_tbar == 10) || (branchtype_t == 10 && branchtype_tbar == 54)) {
251 else if ((branchtype_t == 18 && branchtype_tbar == 50) || (branchtype_t == 50 && branchtype_tbar == 18)) {
254 else if ((branchtype_t == 58 && branchtype_tbar == 10) || (branchtype_t == 10 && branchtype_tbar == 58)) {
257 else if ((branchtype_t == 12 && branchtype_tbar == 10) || (branchtype_t == 10 && branchtype_tbar == 12)) {
260 else if ((branchtype_t == 14 && branchtype_tbar == 10) || (branchtype_t == 10 && branchtype_tbar == 14)) {
263 else if ((branchtype_t == 18 && branchtype_tbar == 10) || (branchtype_t == 10 && branchtype_tbar == 18)) {
266 else if (branchtype_t == 1 || branchtype_tbar == 1) {
272 }
else if (ph_source == -1) {
281 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_branchtype_t") = branchtype_t;
282 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_branchtype_tbar") = branchtype_tbar;
283 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_initial_parton") = init_type;
284 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_ph_from_t_tbar") = ph_source;
288 TLorentzVector temp = t_before + tbar_before;
290 fillEtaBranch(ttbarGammaPartonHistory,
"MC_ttbar_beforeFSR_eta", temp);
292 temp = WmDecay1 + WmDecay2 +
b + WpDecay1 + WpDecay2 + bbar + ph;
294 fillEtaBranch(ttbarGammaPartonHistory,
"MC_ttbar_afterFSR_eta", temp);
300 fillEtaBranch(ttbarGammaPartonHistory,
"MC_t_beforeFSR_eta", t_before);
303 fillEtaBranch(ttbarGammaPartonHistory,
"MC_t_afterFSR_eta", t_after);
306 fillEtaBranch(ttbarGammaPartonHistory,
"MC_W_from_t_eta", Wp);
312 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_Wdecay1_from_t_pdgId") = WpDecay1_pdgId;
313 fillEtaBranch(ttbarGammaPartonHistory,
"MC_Wdecay1_from_t_eta", WpDecay1);
316 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_Wdecay2_from_t_pdgId") = WpDecay2_pdgId;
317 fillEtaBranch(ttbarGammaPartonHistory,
"MC_Wdecay2_from_t_eta", WpDecay2);
324 fillEtaBranch(ttbarGammaPartonHistory,
"MC_tbar_beforeFSR_eta", tbar_before);
327 fillEtaBranch(ttbarGammaPartonHistory,
"MC_tbar_afterFSR_eta", tbar_after);
330 fillEtaBranch(ttbarGammaPartonHistory,
"MC_W_from_tbar_eta", Wm);
333 fillEtaBranch(ttbarGammaPartonHistory,
"MC_b_from_tbar_eta", bbar);
336 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_Wdecay1_from_tbar_pdgId") = WmDecay1_pdgId;
337 fillEtaBranch(ttbarGammaPartonHistory,
"MC_Wdecay1_from_tbar_eta", WmDecay1);
340 ttbarGammaPartonHistory->
auxdecor<
int >(
"MC_Wdecay2_from_tbar_pdgId") = WmDecay2_pdgId;
341 fillEtaBranch(ttbarGammaPartonHistory,
"MC_Wdecay2_from_tbar_eta", WmDecay2);
349 if(
m_config->getDerivationStream() ==
"PHYS")
352 std::vector<std::string> collections = {
"TruthTop",
"TruthBosonsWithDecayParticles",
"HardScatterParticles"};
367 partonCont->setStore(partonAuxCont.release());
370 partonCont->
push_back(ttbarGammaPartonHistory);
376 std::string outputSGKey =
m_config->sgKeyTopPartonHistory();
377 std::string outputSGKeyAux = outputSGKey +
"Aux.";
380 StatusCode saveAux =
evtStore()->tds()->record(partonAuxCont.release(), outputSGKeyAux);
381 if (!
save || !saveAux) {
382 return StatusCode::FAILURE;
385 return StatusCode::SUCCESS;