Update the pythia event.
43 {
44
45
46 std::vector<int> photons;
47
48 int trials = 0;
49
50 bool checkEvent = true;
51
52 Pythia8::Event& event = pythia.event;
53
54 while(checkEvent){
55
56 int higgsIndex = -1;
57 for(int ii=0; ii != event.size(); ++ii){
58
59
60
61
62 if(event[ii].
id() == 25 && abs(event[ii].
status()) == 22){
63 higgsIndex = ii;
64 break;
65 }
66 }
67
68 if(higgsIndex <0){
69
71 return StatusCode::FAILURE;
72 }
73
74 std::vector<int> daughters = event[higgsIndex].daughterList();
75 while(daughters.size()==1){
76 daughters=event[daughters[0]].daughterList();
77 }
78
79 std::vector<int> photons;
80
81 for(const auto d: daughters){
82 if(event[d].id() == 22){
83 photons.push_back(d);
84 }
85 }
86
87 if(photons.size() < 2){
88 ATH_MSG_ERROR(
"Wrong number of photons from H decay. Expected >= 2, got " + std::to_string(photons.size()));
89 return StatusCode::FAILURE;
90 }
91
92 for(const auto p: photons){
93 daughters =
event[
p].daughterList();
94 while(daughters.size() == 1){
95 daughters = event[daughters[0]].daughterList();
96 }
97
98 if(daughters.size() < 2) continue;
99 size_t nLeptons=0;
100
101 for(const auto d: daughters){
103 }
104
105 if(nLeptons >= 2){
106 checkEvent = false;
107 break;
108 }
109 }
110
111 if(checkEvent){
112 pythia.forceTimeShower( photons[0], photons[1], 1000000);
113 ++trials;
115 if(trials % 1000 == 0 ){
116 ATH_MSG_WARNING(
"Has the decay been setup in Pythia correctly? Possibly stuck in loop so far " << trials <<
" attempts have been made");
117 }
118 }else{
119 pythia.forceHadronLevel();
121 }
122 }
123
124 return StatusCode::SUCCESS;
125 }
bool isLepton(const T &p)
APID: the fourth generation leptons are leptons.