39 #ifndef Pythia8_ResonanceDecayFilterHooks_H 40 #define Pythia8_ResonanceDecayFilterHooks_H 43 #include "Pythia8/Pythia.h" 44 #include "Pythia8/UserHooks.h" 45 #include "Pythia8/Event.h" 63 unsigned long int returnCounter() {
return counter;};
71 bool filter, exclusive, eMuAsEquivalent, eMuTauAsEquivalent,
72 allNuAsEquivalent, udscAsEquivalent, udscbAsEquivalent, wzAsEquivalent;
73 unsigned long int counter;
75 vector<int> daughters;
76 unordered_map<int, int> requestedDaughters, observedDaughters;
86 settings.
addFlag(
"ResonanceDecayFilter:filter",
false);
87 settings.
addFlag(
"ResonanceDecayFilter:exclusive",
false);
88 settings.
addFlag(
"ResonanceDecayFilter:eMuAsEquivalent",
false);
89 settings.
addFlag(
"ResonanceDecayFilter:eMuTauAsEquivalent",
false);
90 settings.
addFlag(
"ResonanceDecayFilter:allNuAsEquivalent",
false);
91 settings.
addFlag(
"ResonanceDecayFilter:udscAsEquivalent",
false);
92 settings.
addFlag(
"ResonanceDecayFilter:udscbAsEquivalent",
false);
93 settings.
addFlag(
"ResonanceDecayFilter:wzAsEquivalent",
false);
94 settings.addMVec(
"ResonanceDecayFilter:mothers", vector<int>(),
false,
96 settings.addMVec(
"ResonanceDecayFilter:daughters", vector<int>(),
false,
104 int ResonanceDecayFilterHook::idCat(
int id) {
106 if (
id == 13 && (eMuAsEquivalent || eMuTauAsEquivalent))
id = 11;
107 else if (
id == 15 && eMuTauAsEquivalent)
id = 11;
108 else if ((
id == 14 ||
id == 16) && allNuAsEquivalent)
id = 12;
109 else if ((
id == 2 ||
id == 3 ||
id == 4) && udscAsEquivalent)
id = 1;
110 else if ((
id == 2 ||
id == 3 ||
id == 4 ||
id == 5) &&
111 udscbAsEquivalent)
id = 1;
112 else if ((
id == 23 ||
id == 24) && wzAsEquivalent)
id = 23;
123 eMuAsEquivalent =
settingsPtr->
flag(
"ResonanceDecayFilter:eMuAsEquivalent");
125 flag(
"ResonanceDecayFilter:eMuTauAsEquivalent");
127 (
"ResonanceDecayFilter:allNuAsEquivalent");
129 flag(
"ResonanceDecayFilter:udscAsEquivalent");
131 flag(
"ResonanceDecayFilter:udscbAsEquivalent");
132 wzAsEquivalent =
settingsPtr->
flag(
"ResonanceDecayFilter:wzAsEquivalent");
133 auto mothersIn =
settingsPtr->mvec(
"ResonanceDecayFilter:mothers");
135 mothers.insert(mothersIn.begin(), mothersIn.end());
136 daughters =
settingsPtr->mvec(
"ResonanceDecayFilter:daughters");
137 requestedDaughters.clear();
140 for (
int id : daughters) ++requestedDaughters[idCat(
id)];
150 if (!filter)
return false;
154 observedDaughters.clear();
157 for (
int i = 0; i < process.
size(); ++i) {
159 int mid = p.mother1() > 0 ? abs(process[p.mother1()].id()) : 0;
163 if (mothers.empty() || mothers.count(mid) || mothers.count(-mid))
164 ++observedDaughters[idCat(p.
id())];
172 for (
const auto &reqDau : requestedDaughters) {
173 int reqId = reqDau.first;
174 int reqCount = reqDau.second;
175 auto obsItr = observedDaughters.find(reqId);
176 int obsCount = ( obsItr != observedDaughters.end() ) ? obsItr->second : 0;
179 if (obsCount < reqCount)
return true;
182 if (exclusive && obsCount > reqCount)
return true;
bool flag(string keyIn)
Give back current value, with check that key exists.
Definition: Settings.cc:1478
Settings * settingsPtr
Pointer to the settings database.
Definition: PhysicsBase.h:81
The Event class holds all info on the generated event.
Definition: Event.h:453
ResonanceDecayFilterHook(Settings &settings)
Constructor.
Definition: ResonanceDecayFilterHook.h:84
void id(int idIn)
Member functions for input.
Definition: Event.h:88
bool initAfterBeams() override
Intialize the user hook after the beams.
Definition: ResonanceDecayFilterHook.h:120
Definition: ResonanceDecayFilterHook.h:49
int size() const
Event record size.
Definition: Event.h:504
bool canVetoResonanceDecays() override
Override base class methods.
Definition: ResonanceDecayFilterHook.h:56
bool doVetoResonanceDecays(Event &process) override
Definition: ResonanceDecayFilterHook.h:57
Header for classes to set beam momentum and interaction vertex spread.
Definition: Analysis.h:20
UserHooks is base class for user access to program execution.
Definition: UserHooks.h:32
bool checkVetoResonanceDecays(const Event &process)
Class specific.
Definition: ResonanceDecayFilterHook.h:149
bool flag(string key) const
Shorthand to read settings values.
Definition: PhysicsBase.h:45
Definition: Settings.h:195
void addFlag(string keyIn, bool defaultIn)
Add new entry.
Definition: Settings.h:267