9 #include "HepMC/GenEvent.h"
10 #include "HepMC/IO_HEPEVT.h"
11 #include "HepMC/HEPEVT_Wrapper.h"
17 #include "Photos/Photos.h"
18 #include "Photos/PhotosHepMCEvent.h"
23 : fOnlyPDG(-1), fAvoidTauLeptonicDecays(
false), fIsInitialized(
false), fPSet(nullptr) {
25 bool UseHadronizerQEDBrem =
false;
27 std::vector<std::string> par =
fPSet->
getParameter<std::vector<std::string> >(
"parameterSets");
28 for (
unsigned int ip = 0; ip < par.size(); ++ip) {
31 if (curSet ==
"UseHadronizerQEDBrem")
32 UseHadronizerQEDBrem =
true;
34 if (!UseHadronizerQEDBrem)
52 Photospp::Photos::createHistoryEntries(
true, 746);
53 std::vector<std::string> par =
fPSet->
getParameter<std::vector<std::string> >(
"parameterSets");
54 for (
unsigned int ip = 0; ip < par.size(); ++ip) {
58 if (curSet ==
"maxWtInterference")
60 if (curSet ==
"setInfraredCutOff")
62 if (curSet ==
"setAlphaQED")
64 if (curSet ==
"setInterference")
66 if (curSet ==
"setDoubleBrem")
68 if (curSet ==
"setQuatroBrem")
70 if (curSet ==
"setExponentiation")
72 if (curSet ==
"setCorrectionWtForW")
74 if (curSet ==
"setMeCorrectionWtForScalar")
76 if (curSet ==
"setMeCorrectionWtForW")
78 if (curSet ==
"setMeCorrectionWtForZ")
80 if (curSet ==
"initializeKinematicCorrections")
81 Photospp::Photos::initializeKinematicCorrections(
fPSet->
getParameter<
int>(curSet));
82 if (curSet ==
"forceMassFrom4Vector")
84 if (curSet ==
"forceMassFromEventRecord")
86 if (curSet ==
"ignoreParticlesOfStatus")
88 if (curSet ==
"deIgnoreParticlesOfStatus")
90 if (curSet ==
"setMomentumConservationThreshold")
91 Photospp::Photos::setMomentumConservationThreshold(
fPSet->
getParameter<
double>(curSet));
92 if (curSet ==
"suppressAll")
94 Photospp::Photos::suppressAll();
95 if (curSet ==
"setPairEmission")
97 if (curSet ==
"setPhotonEmission")
99 if (curSet ==
"setStopAtCriticalError")
101 if (curSet ==
"createHistoryEntries")
105 if (curSet ==
"suppressBremForBranch") {
107 std::vector<std::string>
v = cfg.
getParameter<std::vector<std::string> >(
"parameterSets");
108 for (
unsigned int i = 0;
i < v.size();
i++) {
110 std::vector<int> vpar = cfg.
getParameter<std::vector<int> >(vs);
111 if (vpar.size() == 1)
112 Photospp::Photos::suppressBremForBranch(0, vpar[0]);
113 if (vpar.size() == 2)
114 Photospp::Photos::suppressBremForBranch(0 , vpar[1]);
115 if (vpar.size() == 3)
116 Photospp::Photos::suppressBremForBranch(vpar[0], vpar[1], vpar[2]);
117 if (vpar.size() == 4)
118 Photospp::Photos::suppressBremForBranch(vpar[0], vpar[1], vpar[2], vpar[3]);
119 if (vpar.size() == 5)
120 Photospp::Photos::suppressBremForBranch(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4]);
121 if (vpar.size() == 6)
122 Photospp::Photos::suppressBremForBranch(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5]);
123 if (vpar.size() == 7)
124 Photospp::Photos::suppressBremForBranch(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6]);
125 if (vpar.size() == 8)
126 Photospp::Photos::suppressBremForBranch(
127 vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7]);
128 if (vpar.size() == 9)
129 Photospp::Photos::suppressBremForBranch(
130 vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7], vpar[8]);
131 if (vpar.size() == 10)
132 Photospp::Photos::suppressBremForBranch(
133 vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7], vpar[8], vpar[9]);
136 if (curSet ==
"suppressBremForDecay") {
138 std::vector<std::string>
v = cfg.
getParameter<std::vector<std::string> >(
"parameterSets");
139 for (
unsigned int i = 0;
i < v.size();
i++) {
141 std::vector<int> vpar = cfg.
getParameter<std::vector<int> >(vs);
142 if (vpar.size() == 1)
143 Photospp::Photos::suppressBremForDecay(0, vpar[0]);
144 if (vpar.size() == 2)
145 Photospp::Photos::suppressBremForDecay(0 , vpar[1]);
146 if (vpar.size() == 3)
147 Photospp::Photos::suppressBremForDecay(vpar[0], vpar[1], vpar[2]);
148 if (vpar.size() == 4)
149 Photospp::Photos::suppressBremForDecay(vpar[0], vpar[1], vpar[2], vpar[3]);
150 if (vpar.size() == 5)
151 Photospp::Photos::suppressBremForDecay(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4]);
152 if (vpar.size() == 6)
153 Photospp::Photos::suppressBremForDecay(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5]);
154 if (vpar.size() == 7)
155 Photospp::Photos::suppressBremForDecay(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6]);
156 if (vpar.size() == 8)
157 Photospp::Photos::suppressBremForDecay(
158 vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7]);
159 if (vpar.size() == 9)
160 Photospp::Photos::suppressBremForDecay(
161 vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7], vpar[8]);
162 if (vpar.size() == 10)
163 Photospp::Photos::suppressBremForDecay(
164 vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7], vpar[8], vpar[9]);
168 if (curSet ==
"forceBremForBranch") {
170 std::vector<std::string>
v = cfg.
getParameter<std::vector<std::string> >(
"parameterSets");
171 for (
unsigned int i = 0;
i < v.size();
i++) {
173 std::vector<int> vpar = cfg.
getParameter<std::vector<int> >(vs);
174 if (vpar.size() == 1)
175 Photospp::Photos::forceBremForBranch(0, vpar[0]);
176 if (vpar.size() == 2)
177 Photospp::Photos::forceBremForBranch(0 , vpar[1]);
178 if (vpar.size() == 3)
179 Photospp::Photos::forceBremForBranch(vpar[0], vpar[1], vpar[2]);
180 if (vpar.size() == 4)
181 Photospp::Photos::forceBremForBranch(vpar[0], vpar[1], vpar[2], vpar[3]);
182 if (vpar.size() == 5)
183 Photospp::Photos::forceBremForBranch(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4]);
184 if (vpar.size() == 6)
185 Photospp::Photos::forceBremForBranch(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5]);
186 if (vpar.size() == 7)
187 Photospp::Photos::forceBremForBranch(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6]);
188 if (vpar.size() == 8)
189 Photospp::Photos::forceBremForBranch(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7]);
190 if (vpar.size() == 9)
191 Photospp::Photos::forceBremForBranch(
192 vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7], vpar[8]);
193 if (vpar.size() == 10)
194 Photospp::Photos::forceBremForBranch(
195 vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7], vpar[8], vpar[9]);
198 if (curSet ==
"forceBremForDecay") {
200 std::vector<std::string>
v = cfg.
getParameter<std::vector<std::string> >(
"parameterSets");
201 for (
unsigned int i = 0;
i < v.size();
i++) {
203 std::vector<int> vpar = cfg.
getParameter<std::vector<int> >(vs);
204 if (vpar.size() == 1)
205 Photospp::Photos::forceBremForDecay(0, vpar[0]);
206 if (vpar.size() == 2)
207 Photospp::Photos::forceBremForDecay(0 , vpar[1]);
208 if (vpar.size() == 3)
209 Photospp::Photos::forceBremForDecay(vpar[0], vpar[1], vpar[2]);
210 if (vpar.size() == 4)
211 Photospp::Photos::forceBremForDecay(vpar[0], vpar[1], vpar[2], vpar[3]);
212 if (vpar.size() == 5)
213 Photospp::Photos::forceBremForDecay(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4]);
214 if (vpar.size() == 6)
215 Photospp::Photos::forceBremForDecay(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5]);
216 if (vpar.size() == 7)
217 Photospp::Photos::forceBremForDecay(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6]);
218 if (vpar.size() == 8)
219 Photospp::Photos::forceBremForDecay(vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7]);
220 if (vpar.size() == 9)
221 Photospp::Photos::forceBremForDecay(
222 vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7], vpar[8]);
223 if (vpar.size() == 10)
224 Photospp::Photos::forceBremForDecay(
225 vpar[0], vpar[1], vpar[2], vpar[3], vpar[4], vpar[5], vpar[6], vpar[7], vpar[8], vpar[9]);
229 if (curSet ==
"forceMass") {
231 std::vector<std::string>
v = cfg.
getParameter<std::vector<std::string> >(
"parameterSets");
232 for (
unsigned int i = 0;
i < v.size();
i++) {
234 std::vector<double> vpar = cfg.
getParameter<std::vector<double> >(vs);
235 if (vpar.size() == 2)
236 Photospp::Photos::forceMass((
int)vpar[0], vpar[1]);
242 Photospp::Photos::suppressAll();
243 Photospp::Photos::forceBremForBranch(0,
fOnlyPDG);
244 Photospp::Photos::forceBremForBranch(0, -1 *
fOnlyPDG);
247 Photospp::Photos::suppressBremForDecay(3, 15, 16, 11, -12);
248 Photospp::Photos::suppressBremForDecay(3, -15, -16, -11, 12);
249 Photospp::Photos::suppressBremForDecay(3, 15, 16, 13, -14);
250 Photospp::Photos::suppressBremForDecay(3, -15, -16, -13, -14);
252 Photospp::Photos::iniInfo();
261 int NPartBefore = evt->particles_size();
262 Photospp::PhotosHepMCEvent PhotosEvt(evt);
265 for (HepMC::GenEvent::vertex_const_iterator vtx = evt->vertices_begin(); vtx != evt->vertices_end(); vtx++) {
266 std::vector<int> BCodes;
269 for (HepMC::GenVertex::particle_iterator pitr = (*vtx)->particles_begin(HepMC::children);
270 pitr != (*vtx)->particles_end(HepMC::children);
272 if ((*pitr)->barcode() > 10000) {
273 BCodes.push_back((*pitr)->barcode());
277 if (!BCodes.empty()) {
278 for (
size_t ibc = 0; ibc < BCodes.size(); ibc++) {
280 int nbc = p1->barcode() - 10000 + NPartBefore;
281 p1->suggest_barcode(nbc);
291 <<
"PhotosppInterface::flat: Attempt to generate random number when engine pointer is null\n"
292 <<
"This might mean that the code was modified to generate a random number outside the\n"
293 <<
"event and beginLuminosityBlock methods, which is not allowed.\n";
static AlgebraicMatrix initialize()
static CLHEP::HepRandomEngine * fRandomEngine
void setRandomEngine(CLHEP::HepRandomEngine *decayRandomEngine) override
void statistics() override
PhotosppInterface(const edm::ParameterSet &pset)
void configureOnlyFor(int) override
edm::ParameterSet * fPSet
T getParameter(std::string const &) const
bool fAvoidTauLeptonicDecays
#define DEFINE_EDM_PLUGIN(factory, type, name)
HepMC::GenEvent * apply(HepMC::GenEvent *) override
std::vector< std::string > fSpecialSettings