3 #include <Pythia8/Pythia.h>
27 _doAbsEtaHighCut(false),
28 _doAbsEtaLowCut(false),
29 _doBothAbsEtaCut(false),
57 cout <<
"PHPy8ParticleTrigger::Apply - pythia event size: "
58 << pythia->event.size() << endl;
62 for (
int i = 0; i < pythia->event.size(); ++i) {
65 for (
int j = 0; j < int(_theParticles.size()); j++) {
67 bool passedParents =
false;
68 if (pythia->event[i].id() == _theParticles[j] &&
69 pythia->event[i].status() > 0) {
71 if (_doBothEtaCut && (pythia->event[i].eta() < _theEtaLow ||
72 pythia->event[i].eta() > _theEtaHigh))
continue;
73 if (_doEtaLowCut && pythia->event[i].eta() < _theEtaLow)
continue;
74 if (_doEtaHighCut && pythia->event[i].eta() > _theEtaHigh)
continue;
76 if (_doBothAbsEtaCut && (abs(pythia->event[i].eta()) < _theEtaLow ||
77 abs(pythia->event[i].eta()) > _theEtaHigh))
continue;
78 if (_doAbsEtaLowCut && abs(pythia->event[i].eta()) < _theEtaLow)
continue;
79 if (_doAbsEtaHighCut && abs(pythia->event[i].eta()) > _theEtaHigh)
continue;
81 if (_doBothPtCut && (pythia->event[i].pT() < _thePtLow ||
82 pythia->event[i].pT() > _thePtHigh))
continue;
83 if (_doPtHighCut && pythia->event[i].pT() > _thePtHigh )
continue;
84 if (_doPtLowCut && pythia->event[i].pT() < _thePtLow)
continue;
86 if (_doBothPCut && (pythia->event[i].pAbs() < _thePLow ||
87 pythia->event[i].pAbs() > _thePHigh))
continue;
88 if (_doPHighCut && pythia->event[i].pAbs() > _thePHigh )
continue;
89 if (_doPLowCut && pythia->event[i].pAbs() < _thePLow)
continue;
91 if (_doBothPxCut && (pythia->event[i].px() < _thePxLow ||
92 pythia->event[i].px() > _thePxHigh))
continue;
93 if (_doPxHighCut && pythia->event[i].px() > _thePxHigh )
continue;
94 if (_doPxLowCut && pythia->event[i].px() < _thePxLow)
continue;
96 if (_doBothPyCut && (pythia->event[i].py() < _thePyLow ||
97 pythia->event[i].py() > _thePyHigh))
continue;
98 if (_doPyHighCut && pythia->event[i].py() > _thePyHigh )
continue;
99 if (_doPyLowCut && pythia->event[i].py() < _thePyLow)
continue;
101 if (_doBothPzCut && (pythia->event[i].pz() < _thePzLow ||
102 pythia->event[i].pz() > _thePzHigh))
continue;
103 if (_doPzHighCut && pythia->event[i].pz() > _thePzHigh )
continue;
104 if (_doPzLowCut && pythia->event[i].pz() < _thePzLow)
continue;
107 cout <<
"stable " << pythia->event[i].id()
108 <<
" pt: " << pythia->event[i].pT()
109 <<
" pz: " << pythia->event[i].pz()
110 <<
" p: " << pythia->event[i].pAbs()
111 <<
" eta: " << pythia->event[i].eta() << endl;
115 for (
int k = 0; k < int(_theParents.size()); k++) {
117 std::vector<int> moms = pythia->event[i].motherList();
118 for (
int m = 0; m < int(moms.size()) ; m++) {
119 if (abs(pythia->event[ moms[m] ].id()) == abs(_theParents[k])) {
120 passedParents =
true;
121 if (
_verbosity > 5) cout <<
"found parent!" << endl;
125 if (passedParents)
break;
129 if (_theParents.size() == 0 || passedParents)
return true;
141 _theParticles.insert(_theParticles.end(),addedParts.begin(),addedParts.end());
145 _theParticles.push_back(particle);
149 _theParticles.insert(_theParticles.end(),particles.begin(),particles.end());
154 _theParents.insert(_theParents.end(),addedParents.begin(),addedParents.end());
158 _theParents.push_back(parent);
162 _theParents.insert(_theParents.end(),parents.begin(),parents.end());
167 if (_doPtLowCut) _doBothPtCut =
true;
168 else _doPtHighCut =
true;
173 if (_doPtHighCut) _doBothPtCut =
true;
174 else _doPtLowCut =
true;
178 if (ptHigh < ptLow) {
187 _doPtHighCut =
false;
226 _doBothEtaCut =
true;
227 _doEtaLowCut =
false;
229 _doEtaHighCut =
true;
236 _doBothEtaCut =
true;
237 _doEtaHighCut =
false;
244 _theEtaHigh = etaHigh;
246 _doBothEtaCut =
true;
247 _doEtaHighCut =
false;
248 _doEtaLowCut =
false;
253 if (_doAbsEtaLowCut) {
254 _doBothAbsEtaCut =
true;
255 _doAbsEtaLowCut =
false;
257 _doAbsEtaHighCut =
true;
263 if (_doAbsEtaHighCut) {
264 _doBothAbsEtaCut =
true;
265 _doAbsEtaHighCut =
false;
267 _doAbsEtaLowCut =
true;
272 _theEtaHigh = etaHigh;
274 _doBothAbsEtaCut =
true;
275 _doAbsEtaLowCut =
false;
276 _doAbsEtaHighCut =
false;
293 _doPxHighCut =
false;
300 if (pxHigh < pxLow) {
309 _doPxHighCut =
false;
326 _doPyHighCut =
false;
333 if (pyHigh < pyLow) {
342 _doPyHighCut =
false;
359 _doPzHighCut =
false;
366 if (pzHigh < pzLow) {
375 _doPzHighCut =
false;
379 cout <<
"---------------- PHPy8ParticleTrigger::PrintConfig --------------------" << endl;
380 cout <<
" Particles: ";
381 for (
int i = 0; i < int(_theParticles.size()); i++) cout << _theParticles[i] <<
" ";
384 cout <<
" Parents: ";
385 for (
int i = 0; i < int(_theParents.size()); i++) cout << _theParents[i] <<
" ";
388 if (_doEtaHighCut||_doEtaLowCut||_doBothEtaCut)
389 cout <<
" doEtaCut: " << _theEtaLow <<
" < eta < " << _theEtaHigh << endl;
390 if (_doAbsEtaHighCut||_doAbsEtaLowCut||_doBothAbsEtaCut)
391 cout <<
" doAbsEtaCut: " << _theEtaLow <<
" < |eta| < " << _theEtaHigh << endl;
392 if (_doPtHighCut||_doPtLowCut||_doBothPtCut)
393 cout <<
" doPtCut: " << _thePtLow <<
" < pT < " << _thePtHigh << endl;
394 if (_doPHighCut||_doPLowCut||_doBothPCut)
395 cout <<
" doPCut: " << _thePLow <<
" < p < " << _thePHigh << endl;
396 if (_doPxHighCut||_doPxLowCut||_doBothPxCut)
397 cout <<
" doPxCut: " << _thePxLow <<
" < px < " << _thePxHigh << endl;
398 if (_doPyHighCut||_doPyLowCut||_doBothPyCut)
399 cout <<
" doPyCut: " << _thePyLow <<
" < py < " << _thePyHigh << endl;
400 if (_doPzHighCut||_doPzLowCut||_doBothPzCut)
401 cout <<
" doPzCut: " << _thePzLow <<
" < pz < " << _thePzHigh << endl;
402 cout <<
"-----------------------------------------------------------------------" << endl;
void SetPtHigh(double pt)
void AddParents(std::string parents)
bool Apply(Pythia8::Pythia *pythia)
void SetPxHigh(double pz)
void AddParticles(std::string particles)
void SetEtaHigh(double eta)
void SetPHighLow(double pHigh, double pLow)
void SetPyHighLow(double pzHigh, double pzLow)
void SetAbsEtaLow(double eta)
void SetPzHighLow(double pzHigh, double pzLow)
void SetAbsEtaHigh(double eta)
void SetEtaLow(double eta)
void SetPzHigh(double pz)
void SetPxHighLow(double pzHigh, double pzLow)
void SetEtaHighLow(double etaHigh, double etaLow)
void SetPyHigh(double pz)
virtual ~PHPy8ParticleTrigger()
std::vector< int > convertToInts(std::string s)
void SetAbsEtaHighLow(double etaHigh, double etaLow)
void SetPtHighLow(double ptHigh, double ptLow)
PHPy8ParticleTrigger(const std::string &name="PHPy8ParticleTrigger")