-
Notifications
You must be signed in to change notification settings - Fork 0
Kf particle #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Kf particle #9
Changes from all commits
5adbf5c
35a6b31
2e9ccc7
ce0d3af
6ddbed5
3394890
67423a3
014600a
2a654bd
3e94777
667a5cc
45a8c5b
1ba5701
815ceef
d0a251d
0f8adaa
49ff81c
0c648ef
9e7cf18
514cbf6
5c1fb73
3f30522
0785178
e06322f
89660ef
ab568eb
7e9afac
2f32421
3fe3cd3
774e982
34e66d1
c6b077c
f5a6ec8
af55b25
8d61916
3a535f0
16716a5
83bb8a6
5ec7de1
15b6eed
66f7822
ed4562e
7e92dc7
a573ec3
fcb6312
c3eb9c5
36cd47a
b4b37c2
c361551
23ef520
498393a
e18445b
ebbee62
3d0a2e4
5628bd2
c7adbfd
62c7a10
5d5a980
fd44486
3505cae
51336ae
b0df38c
ee08eb4
2b02a79
11cb711
f63acd8
47ab938
7eb599f
5d10d3e
f9373cf
90a2f62
7b52f16
ce2f8a3
bcc0827
5b6afda
0f402d4
85e50bb
e3fffce
2cbb506
d7d58e1
63e54e6
04e747f
53eb479
1fe3891
bfcf35d
69de5bb
3d19299
64138d4
2525b3b
bd1ae49
04d5376
7b60428
99b5ed4
bea795c
774ed82
d1152d0
6c11c5d
7030fb8
ec8e8a6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,369 @@ | ||||||||||||||||||||||||||||||||||
| #include "HepMCParticleTrigger.h" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #include <fun4all/SubsysReco.h> | ||||||||||||||||||||||||||||||||||
| #include <phhepmc/PHHepMCGenEvent.h> | ||||||||||||||||||||||||||||||||||
| #include <phhepmc/PHHepMCGenEventMap.h> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #include <fun4all/Fun4AllReturnCodes.h> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #include <phool/PHCompositeNode.h> | ||||||||||||||||||||||||||||||||||
| #include <phool/getClass.h> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #include <fastjet/JetDefinition.hh> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #include <HepMC/GenEvent.h> | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| #include <fastjet/PseudoJet.hh> | ||||||||||||||||||||||||||||||||||
| #include <map> | ||||||||||||||||||||||||||||||||||
| #include <string> | ||||||||||||||||||||||||||||||||||
| #include <vector> | ||||||||||||||||||||||||||||||||||
| //____________________________________________________________________________.. | ||||||||||||||||||||||||||||||||||
| // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) | ||||||||||||||||||||||||||||||||||
| HepMCParticleTrigger::HepMCParticleTrigger(float trigger_thresh, int n_incom, bool up_lim, const std::string& name) | ||||||||||||||||||||||||||||||||||
| : SubsysReco(name) | ||||||||||||||||||||||||||||||||||
| , threshold(trigger_thresh) | ||||||||||||||||||||||||||||||||||
| , goal_event_number(n_incom) | ||||||||||||||||||||||||||||||||||
| , set_event_limit(up_lim) | ||||||||||||||||||||||||||||||||||
| , _theEtaHigh(1.1) | ||||||||||||||||||||||||||||||||||
| , _theEtaLow(-1.1) | ||||||||||||||||||||||||||||||||||
| , _thePtHigh(999.9) | ||||||||||||||||||||||||||||||||||
| , _thePtLow(0) | ||||||||||||||||||||||||||||||||||
| , _thePHigh(999.9) | ||||||||||||||||||||||||||||||||||
| , _thePLow(-999.9) | ||||||||||||||||||||||||||||||||||
| , _thePzHigh(999.9) | ||||||||||||||||||||||||||||||||||
| , _thePzLow(-999.9) | ||||||||||||||||||||||||||||||||||
| , | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| _doEtaHighCut(true) | ||||||||||||||||||||||||||||||||||
| , _doEtaLowCut(true) | ||||||||||||||||||||||||||||||||||
| , _doBothEtaCut(true) | ||||||||||||||||||||||||||||||||||
| , | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| _doAbsEtaHighCut(false) | ||||||||||||||||||||||||||||||||||
| , _doAbsEtaLowCut(false) | ||||||||||||||||||||||||||||||||||
| , _doBothAbsEtaCut(false) | ||||||||||||||||||||||||||||||||||
| , | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| _doPtHighCut(false) | ||||||||||||||||||||||||||||||||||
| , _doPtLowCut(false) | ||||||||||||||||||||||||||||||||||
| , _doBothPtCut(false) | ||||||||||||||||||||||||||||||||||
| , | ||||||||||||||||||||||||||||||||||
| _doPHighCut(false) | ||||||||||||||||||||||||||||||||||
| , _doPLowCut(false) | ||||||||||||||||||||||||||||||||||
| , _doBothPCut(false) | ||||||||||||||||||||||||||||||||||
| , | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| _doPzHighCut(false) | ||||||||||||||||||||||||||||||||||
| , _doPzLowCut(false) | ||||||||||||||||||||||||||||||||||
| , _doBothPzCut(false) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| if (threshold != 0) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doPtLowCut = true; | ||||||||||||||||||||||||||||||||||
| _thePtLow = threshold; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| //____________________________________________________________________________.. | ||||||||||||||||||||||||||||||||||
| int HepMCParticleTrigger::process_event(PHCompositeNode* topNode) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| // std::cout << "HepMCParticleTrigger::process_event(PHCompositeNode *topNode) Processing Event" << std::endl; | ||||||||||||||||||||||||||||||||||
| n_evts++; | ||||||||||||||||||||||||||||||||||
| if (this->set_event_limit == true) | ||||||||||||||||||||||||||||||||||
| { // needed to keep all HepMC output at the same number of events | ||||||||||||||||||||||||||||||||||
| if (n_good >= this->goal_event_number) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| return Fun4AllReturnCodes::ABORTEVENT; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| bool good_event{false}; | ||||||||||||||||||||||||||||||||||
| PHHepMCGenEventMap* phg = findNode::getClass<PHHepMCGenEventMap>(topNode, "PHHepMCGenEventMap"); | ||||||||||||||||||||||||||||||||||
| if (!phg) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| return Fun4AllReturnCodes::ABORTEVENT; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| for (PHHepMCGenEventMap::ConstIter eventIter = phg->begin(); eventIter != phg->end(); ++eventIter) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| PHHepMCGenEvent* hepev = eventIter->second; | ||||||||||||||||||||||||||||||||||
| if (!hepev) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| return Fun4AllReturnCodes::ABORTEVENT; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| HepMC::GenEvent* ev = hepev->getEvent(); | ||||||||||||||||||||||||||||||||||
| if (!ev) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| return Fun4AllReturnCodes::ABORTEVENT; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| good_event = isGoodEvent(ev); | ||||||||||||||||||||||||||||||||||
| if (!good_event) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| return Fun4AllReturnCodes::ABORTEVENT; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if (good_event) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| n_good++; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return Fun4AllReturnCodes::EVENT_OK; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::AddParticle(int particlePid) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _theParticles.push_back(particlePid); | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::AddParticles(const std::vector<int>& particles) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| for (auto p : particles) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _theParticles.push_back(p); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetPtHigh(double pt) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _thePtHigh = pt; | ||||||||||||||||||||||||||||||||||
| _doPtHighCut = true; | ||||||||||||||||||||||||||||||||||
| if (_doPtLowCut) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doBothPtCut = true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetPtLow(double pt) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _thePtLow = pt; | ||||||||||||||||||||||||||||||||||
| _doPtLowCut = true; | ||||||||||||||||||||||||||||||||||
| if (_doPtHighCut) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doBothPtCut = true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetPtHighLow(double ptHigh, double ptLow) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _thePtHigh = ptHigh; | ||||||||||||||||||||||||||||||||||
| _doPtHighCut = true; | ||||||||||||||||||||||||||||||||||
| _thePtLow = ptLow; | ||||||||||||||||||||||||||||||||||
| _doPtLowCut = true; | ||||||||||||||||||||||||||||||||||
| _doBothPtCut = true; | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetPHigh(double pt) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _thePHigh = pt; | ||||||||||||||||||||||||||||||||||
| _doPHighCut = true; | ||||||||||||||||||||||||||||||||||
| if (_doPLowCut) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doBothPCut = true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetPLow(double pt) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _thePLow = pt; | ||||||||||||||||||||||||||||||||||
| _doPLowCut = true; | ||||||||||||||||||||||||||||||||||
| if (_doPHighCut) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doBothPCut = true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetPHighLow(double ptHigh, double ptLow) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _thePHigh = ptHigh; | ||||||||||||||||||||||||||||||||||
| _doPHighCut = true; | ||||||||||||||||||||||||||||||||||
| _thePLow = ptLow; | ||||||||||||||||||||||||||||||||||
| _doPLowCut = true; | ||||||||||||||||||||||||||||||||||
| _doBothPCut = true; | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetPzHigh(double pt) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _thePzHigh = pt; | ||||||||||||||||||||||||||||||||||
| _doPzHighCut = true; | ||||||||||||||||||||||||||||||||||
| if (_doPzLowCut) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doBothPzCut = true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetPzLow(double pt) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _thePzLow = pt; | ||||||||||||||||||||||||||||||||||
| _doPzLowCut = true; | ||||||||||||||||||||||||||||||||||
| if (_doPzHighCut) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doBothPzCut = true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetPzHighLow(double ptHigh, double ptLow) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _thePzHigh = ptHigh; | ||||||||||||||||||||||||||||||||||
| _doPzHighCut = true; | ||||||||||||||||||||||||||||||||||
| _thePzLow = ptLow; | ||||||||||||||||||||||||||||||||||
| _doPzLowCut = true; | ||||||||||||||||||||||||||||||||||
| _doBothPzCut = true; | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetEtaHigh(double pt) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _theEtaHigh = pt; | ||||||||||||||||||||||||||||||||||
| _doEtaHighCut = true; | ||||||||||||||||||||||||||||||||||
| if (_doEtaLowCut) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doBothEtaCut = true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetEtaLow(double pt) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _theEtaLow = pt; | ||||||||||||||||||||||||||||||||||
| _doEtaLowCut = true; | ||||||||||||||||||||||||||||||||||
| if (_doEtaHighCut) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doBothEtaCut = true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetEtaHighLow(double ptHigh, double ptLow) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _theEtaHigh = ptHigh; | ||||||||||||||||||||||||||||||||||
| _doEtaHighCut = true; | ||||||||||||||||||||||||||||||||||
| _theEtaLow = ptLow; | ||||||||||||||||||||||||||||||||||
| _doEtaLowCut = true; | ||||||||||||||||||||||||||||||||||
| _doBothEtaCut = true; | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetAbsEtaHigh(double pt) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _theEtaHigh = pt; | ||||||||||||||||||||||||||||||||||
| _doAbsEtaHighCut = true; | ||||||||||||||||||||||||||||||||||
| if (_doAbsEtaLowCut) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doBothAbsEtaCut = true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetAbsEtaLow(double pt) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _theEtaLow = pt; | ||||||||||||||||||||||||||||||||||
| _doAbsEtaLowCut = true; | ||||||||||||||||||||||||||||||||||
| if (_doAbsEtaHighCut) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _doBothAbsEtaCut = true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| void HepMCParticleTrigger::SetAbsEtaHighLow(double ptHigh, double ptLow) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| _theEtaHigh = ptHigh; | ||||||||||||||||||||||||||||||||||
| _doAbsEtaHighCut = true; | ||||||||||||||||||||||||||||||||||
| _theEtaLow = ptLow; | ||||||||||||||||||||||||||||||||||
| _doAbsEtaLowCut = true; | ||||||||||||||||||||||||||||||||||
| _doBothAbsEtaCut = true; | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| bool HepMCParticleTrigger::isGoodEvent(HepMC::GenEvent* e1) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| // this is really just the call to actually evaluate and return the filter | ||||||||||||||||||||||||||||||||||
| /*if (this->threshold == 0) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||
| }*/ | ||||||||||||||||||||||||||||||||||
| std::vector<int> n_trigger_particles = getParticles(e1); | ||||||||||||||||||||||||||||||||||
| for (auto ntp : n_trigger_particles) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| if (ntp <= 0) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| return false; // make sure all particles have at least 1 | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| std::vector<int> HepMCParticleTrigger::getParticles(HepMC::GenEvent* e1) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| std::vector<int> n_trigger{}; | ||||||||||||||||||||||||||||||||||
| std::map<int, int> particle_types; | ||||||||||||||||||||||||||||||||||
| for (HepMC::GenEvent::particle_const_iterator iter = e1->particles_begin(); iter != e1->particles_end(); ++iter) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| if (m_doStableParticleOnly && ((*iter)->end_vertex() || (*iter)->status() != 1)) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| auto p = (*iter)->momentum(); | ||||||||||||||||||||||||||||||||||
| float px = p.px(); | ||||||||||||||||||||||||||||||||||
| float py = p.py(); | ||||||||||||||||||||||||||||||||||
| float pz = p.pz(); | ||||||||||||||||||||||||||||||||||
| float p_M = std::sqrt(std::pow(px, 2) + std::pow(py, 2) + std::pow(pz, 2)); | ||||||||||||||||||||||||||||||||||
| float pt = std::sqrt(std::pow(px, 2) + std::pow(py, 2)); | ||||||||||||||||||||||||||||||||||
| int pid = std::abs((*iter)->pdg_id()); | ||||||||||||||||||||||||||||||||||
| double eta = p.eta(); | ||||||||||||||||||||||||||||||||||
| if ((_doEtaHighCut || _doBothEtaCut) && eta > _theEtaHigh) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if ((_doEtaLowCut || _doBothEtaCut) && eta < _theEtaLow) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if ((_doAbsEtaHighCut || _doBothAbsEtaCut) && std::abs(eta) > _theEtaHigh) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if ((_doAbsEtaLowCut || _doBothAbsEtaCut) && std::abs(eta) < _theEtaLow) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if ((_doPtHighCut || _doBothPtCut) && pt > _thePtHigh) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if ((_doPtLowCut || _doBothPtCut) && pt < _thePtLow) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if ((_doPHighCut || _doBothPCut) && p_M > _thePHigh) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if ((_doPLowCut || _doBothPCut) && p_M < _thePLow) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if ((_doPzHighCut || _doBothPzCut) && pz > _thePzHigh) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if ((_doPzLowCut || _doBothPzCut) && pz < _thePzLow) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| continue; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| if (particle_types.contains(pid)) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| particle_types[pid]++; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| particle_types[pid] = 1; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+344
to
+351
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Search for build configuration files
find . -maxdepth 3 -type f \( -name "CMakeLists.txt" -o -name "configure.ac" -o -name "Makefile.am" \) | head -20Repository: sPHENIX-Test/coresoftware Length of output: 852 🏁 Script executed: # Search for C++ standard declarations across the repository
rg -i 'c\+\+20|c\+\+2a|cxx_std_20|CXX_STANDARD.*20|std=c\+\+20' --type-list | head -5
rg -i 'c\+\+20|c\+\+2a|cxx_std_20|CXX_STANDARD.*20|std=c\+\+20' -g "*.txt" -g "*.ac" -g "*.am" -g "*.cmake" 2>/dev/null | head -20Repository: sPHENIX-Test/coresoftware Length of output: 458 🏁 Script executed: # Look for any C++ standard specifications
rg -i 'CXX_STANDARD|c\+\+17|c\+\+11|c\+\+14' -g "CMakeLists.txt" -g "configure.ac" -g "Makefile.am" 2>/dev/null | head -30Repository: sPHENIX-Test/coresoftware Length of output: 471 🏁 Script executed: # Check the specific directory and parent directories for build files
ls -la generators/Herwig/HepMCTrigger/ 2>/dev/null | head -20
ls -la generators/Herwig/ 2>/dev/null | head -20
ls -la generators/ 2>/dev/null | grep -i cmakeRepository: sPHENIX-Test/coresoftware Length of output: 816 🏁 Script executed: # Check the Makefile.am in the HepMCTrigger directory
cat generators/Herwig/HepMCTrigger/Makefile.amRepository: sPHENIX-Test/coresoftware Length of output: 1134 🏁 Script executed: # Check the configure.ac in the HepMCTrigger directory
cat generators/Herwig/HepMCTrigger/configure.acRepository: sPHENIX-Test/coresoftware Length of output: 440 🏁 Script executed: # Check if there's a parent configure.ac in generators/Herwig
find generators/Herwig -maxdepth 1 -name "configure.ac" -o -name "Makefile.am" 2>/dev/nullRepository: sPHENIX-Test/coresoftware Length of output: 51 🏁 Script executed: # Search for CXX_STANDARD or C++ flag declarations in the entire generators directory
rg -i 'CXX_STANDARD|AM_CXXFLAGS|std=' generators/Herwig/HepMCTrigger/ --type=make --type=cmake 2>/dev/null || echo "No matches found"Repository: sPHENIX-Test/coresoftware Length of output: 85 🏁 Script executed: # Check if there's a root configure.ac or global C++ standard configuration
head -50 configure.ac 2>/dev/null || echo "No root configure.ac"Repository: sPHENIX-Test/coresoftware Length of output: 89 🏁 Script executed: # Search for any other C++20 features in the HepMCTrigger files
rg 'contains\(|spaceship|concepts|requires|co_await' generators/Herwig/HepMCTrigger/ --type=cc --type=hRepository: sPHENIX-Test/coresoftware Length of output: 95 🏁 Script executed: # Check if there's a toplevel CMakeLists.txt
ls -la CMakeLists.txt 2>/dev/null || echo "No CMakeLists.txt at root"Repository: sPHENIX-Test/coresoftware Length of output: 94 🏁 Script executed: # Check the specific line in HepMCParticleTrigger.cc to confirm context
sed -n '340,355p' generators/Herwig/HepMCTrigger/HepMCParticleTrigger.ccRepository: sPHENIX-Test/coresoftware Length of output: 366 Replace The build configuration for this module does not explicitly require C++20. The code uses C++17-compatible fix- if (particle_types.contains(pid))
+ if (particle_types.find(pid) != particle_types.end())
{
particle_types[pid]++;
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| n_trigger.reserve(_theParticles.size()); | ||||||||||||||||||||||||||||||||||
| for (auto p : _theParticles) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| n_trigger.push_back(particleAboveThreshold(particle_types, p)); // make sure we have at least one of each required particle | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return n_trigger; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| int HepMCParticleTrigger::particleAboveThreshold(const std::map<int, int>& n_particles, int trigger_particle) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| // search through for the number of identified trigger particles passing cuts | ||||||||||||||||||||||||||||||||||
| auto it = n_particles.find(std::abs(trigger_particle)); | ||||||||||||||||||||||||||||||||||
| if (it != n_particles.end()) | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| return it->second; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| return 0; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty event map returns EVENT_OK with
good_event=false.If
PHHepMCGenEventMapis non-null but empty, the for-loop never executes,good_eventremainsfalse, and the function returnsEVENT_OKwithout incrementingn_good. This may not be the intended behavior.🐛 Proposed fix
PHHepMCGenEventMap* phg = findNode::getClass<PHHepMCGenEventMap>(topNode, "PHHepMCGenEventMap"); if (!phg) { return Fun4AllReturnCodes::ABORTEVENT; } + if (phg->size() == 0) + { + return Fun4AllReturnCodes::ABORTEVENT; + } for (PHHepMCGenEventMap::ConstIter eventIter = phg->begin(); eventIter != phg->end(); ++eventIter)📝 Committable suggestion
🤖 Prompt for AI Agents