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"
24 fAvoidTauLeptonicDecays(
false),
25 fIsInitialized(
false),
43 std::vector<std::string> par =
fPSet->
getParameter< std::vector<std::string> >(
"parameterSets");
44 for (
unsigned int ip=0; ip<par.size(); ++ip ){
48 if(curSet==
"maxWtInterference") Photospp::Photos::maxWtInterference(
fPSet->
getParameter<
double>(curSet));
49 if(curSet==
"setInfraredCutOff") Photospp::Photos::setInfraredCutOff(
fPSet->
getParameter<
double>(curSet));
50 if(curSet==
"setAlphaQED") Photospp::Photos::setAlphaQED(
fPSet->
getParameter<
double>(curSet));
51 if(curSet==
"setInterference") Photospp::Photos::setInterference(
fPSet->
getParameter<
bool>(curSet));
52 if(curSet==
"setDoubleBrem") Photospp::Photos::setDoubleBrem(
fPSet->
getParameter<
bool>(curSet));
53 if(curSet==
"setQuatroBrem") Photospp::Photos::setQuatroBrem(
fPSet->
getParameter<
bool>(curSet));
54 if(curSet==
"setExponentiation") Photospp::Photos::setExponentiation(
fPSet->
getParameter<
bool>(curSet));
55 if(curSet==
"setCorrectionWtForW") Photospp::Photos::setCorrectionWtForW(
fPSet->
getParameter<
bool>(curSet));
56 if(curSet==
"setMeCorrectionWtForScalar") Photospp::Photos::setMeCorrectionWtForScalar(
fPSet->
getParameter<
bool>(curSet));
57 if(curSet==
"setMeCorrectionWtForW") Photospp::Photos::setMeCorrectionWtForW(
fPSet->
getParameter<
bool>(curSet));
58 if(curSet==
"setMeCorrectionWtForZ") Photospp::Photos::setMeCorrectionWtForZ(
fPSet->
getParameter<
bool>(curSet));
59 if(curSet==
"initializeKinematicCorrections") Photospp::Photos::initializeKinematicCorrections(
fPSet->
getParameter<
int>(curSet));
60 if(curSet==
"forceMassFrom4Vector") Photospp::Photos::forceMassFrom4Vector(
fPSet->
getParameter<
bool>(curSet));
61 if(curSet==
"forceMassFromEventRecord") Photospp::Photos::forceMassFromEventRecord(
fPSet->
getParameter<
int>(curSet));
62 if(curSet==
"ignoreParticlesOfStatus") Photospp::Photos::ignoreParticlesOfStatus(
fPSet->
getParameter<
int>(curSet));
63 if(curSet==
"deIgnoreParticlesOfStatus") Photospp::Photos::deIgnoreParticlesOfStatus(
fPSet->
getParameter<
int>(curSet));
64 if(curSet==
"setMomentumConservationThreshold") Photospp::Photos::setMomentumConservationThreshold(
fPSet->
getParameter<
double>(curSet));
65 if(curSet==
"suppressAll")
if(
fPSet->
getParameter<
bool>(curSet)==
true)Photospp::Photos::suppressAll();
68 if(curSet==
"suppressBremForBranch"){
70 std::vector<std::string>
v = cfg.
getParameter<std::vector<std::string> >(
"parameterSets");
71 for(
unsigned int i=0;
i<v.size();
i++){
73 std::vector<int> vpar = cfg.
getParameter<std::vector<int> >(vs);
74 if(vpar.size()==1) Photospp::Photos::suppressBremForBranch(0,vpar[0]);
75 if(vpar.size()==2) Photospp::Photos::suppressBremForBranch(0,vpar[1]);
76 if(vpar.size()==3) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2]);
77 if(vpar.size()==4) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3]);
78 if(vpar.size()==5) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
79 if(vpar.size()==6) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
80 if(vpar.size()==7) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
81 if(vpar.size()==8) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
82 if(vpar.size()==9) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8]);
83 if(vpar.size()==10) Photospp::Photos::suppressBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8],vpar[9]);
86 if(curSet==
"suppressBremForDecay"){
88 std::vector<std::string>
v = cfg.
getParameter<std::vector<std::string> >(
"parameterSets");
89 for(
unsigned int i=0;
i<v.size();
i++){
91 std::vector<int> vpar = cfg.
getParameter<std::vector<int> >(vs);
92 if(vpar.size()==1) Photospp::Photos::suppressBremForDecay(0,vpar[0]);
93 if(vpar.size()==2) Photospp::Photos::suppressBremForDecay(0,vpar[1]);
94 if(vpar.size()==3) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2]);
95 if(vpar.size()==4) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3]);
96 if(vpar.size()==5) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
97 if(vpar.size()==6) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
98 if(vpar.size()==7) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
99 if(vpar.size()==8) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
100 if(vpar.size()==9) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8]);
101 if(vpar.size()==10) Photospp::Photos::suppressBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8],vpar[9]);
105 if(curSet==
"forceBremForBranch"){
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) Photospp::Photos::forceBremForBranch(0,vpar[0]);
112 if(vpar.size()==2) Photospp::Photos::forceBremForBranch(0,vpar[1]);
113 if(vpar.size()==3) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2]);
114 if(vpar.size()==4) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3]);
115 if(vpar.size()==5) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
116 if(vpar.size()==6) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
117 if(vpar.size()==7) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
118 if(vpar.size()==8) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
119 if(vpar.size()==9) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8]);
120 if(vpar.size()==10) Photospp::Photos::forceBremForBranch(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8],vpar[9]);
123 if(curSet==
"forceBremForDecay"){
125 std::vector<std::string>
v = cfg.
getParameter<std::vector<std::string> >(
"parameterSets");
126 for(
unsigned int i=0;
i<v.size();
i++){
128 std::vector<int> vpar = cfg.
getParameter<std::vector<int> >(vs);
129 if(vpar.size()==1) Photospp::Photos::forceBremForDecay(0,vpar[0]);
130 if(vpar.size()==2) Photospp::Photos::forceBremForDecay(0,vpar[1]);
131 if(vpar.size()==3) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2]);
132 if(vpar.size()==4) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3]);
133 if(vpar.size()==5) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4]);
134 if(vpar.size()==6) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5]);
135 if(vpar.size()==7) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6]);
136 if(vpar.size()==8) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7]);
137 if(vpar.size()==9) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8]);
138 if(vpar.size()==10) Photospp::Photos::forceBremForDecay(vpar[0],vpar[1],vpar[2],vpar[3],vpar[4],vpar[5],vpar[6],vpar[7],vpar[8],vpar[9]);
142 if(curSet==
"forceMass"){
144 std::vector<std::string>
v = cfg.
getParameter<std::vector<std::string> >(
"parameterSets");
145 for(
unsigned int i=0;
i<v.size();
i++){
147 std::vector<double> vpar = cfg.
getParameter<std::vector<double> >(vs);
148 if(vpar.size()==2) Photospp::Photos::forceMass((
int)vpar[0], vpar[1]);
154 Photospp::Photos::suppressAll();
155 Photospp::Photos::forceBremForBranch(0,
fOnlyPDG);
156 Photospp::Photos::forceBremForBranch(0,-1*
fOnlyPDG);
159 Photospp::Photos::suppressBremForDecay(3, 15, 16, 11, -12);
160 Photospp::Photos::suppressBremForDecay(3, -15, -16, -11, 12);
161 Photospp::Photos::suppressBremForDecay(3, 15, 16, 13, -14);
162 Photospp::Photos::suppressBremForDecay(3, -15, -16, -13, -14);
164 Photospp::Photos::iniInfo();
172 int NPartBefore = evt->particles_size();
173 Photospp::PhotosHepMCEvent PhotosEvt(evt);
176 for (HepMC::GenEvent::vertex_const_iterator vtx=evt->vertices_begin(); vtx!=evt->vertices_end(); vtx++ ){
177 std::vector<int> BCodes;
180 for(HepMC::GenVertex::particle_iterator pitr=(*vtx)->particles_begin(HepMC::children);pitr!=(*vtx)->particles_end(HepMC::children);++pitr){
181 if((*pitr)->barcode()>10000){
182 BCodes.push_back((*pitr)->barcode());
186 if(BCodes.size() > 0){
187 for(
size_t ibc=0; ibc<BCodes.size(); ibc++){
189 int nbc = p1->barcode() - 10000 + NPartBefore;
190 p1->suggest_barcode(nbc);
200 <<
"PhotosppInterface::flat: Attempt to generate random number when engine pointer is null\n"
201 <<
"This might mean that the code was modified to generate a random number outside the\n"
202 <<
"event and beginLuminosityBlock methods, which is not allowed.\n";
T getParameter(std::string const &) const
static AlgebraicMatrix initialize()
void setRandomEngine(CLHEP::HepRandomEngine *decayRandomEngine)
static CLHEP::HepRandomEngine * fRandomEngine
CLHEP::HepRandomEngine * decayRandomEngine
PhotosppInterface(const edm::ParameterSet &pset)
edm::ParameterSet * fPSet
HepMC::GenEvent * apply(HepMC::GenEvent *)
void configureOnlyFor(int)
bool fAvoidTauLeptonicDecays
#define DEFINE_EDM_PLUGIN(factory, type, name)
volatile std::atomic< bool > shutdown_flag false
std::vector< std::string > fSpecialSettings