Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:17:57

0001 #include "ParticleFlowJetInput.h"
0002 
0003 #include "ParticleFlowElement.h"
0004 #include "ParticleFlowElementContainer.h"
0005 
0006 #include <jetbase/Jet.h>
0007 #include <jetbase/Jetv2.h>
0008 
0009 #include <phool/getClass.h>
0010 
0011 // standard includes
0012 #include <cassert>
0013 #include <iostream>
0014 #include <map>      // for _Rb_tree_const_iterator
0015 #include <utility>  // for pair
0016 #include <vector>
0017 
0018 void ParticleFlowJetInput::identify(std::ostream &os)
0019 {
0020   os << "   ParticleFlowJetInput: ";
0021   os << std::endl;
0022 }
0023 
0024 std::vector<Jet *> ParticleFlowJetInput::get_input(PHCompositeNode *topNode)
0025 {
0026   if (_verbosity > 0)
0027   {
0028     std::cout << "ParticleFlowJetInput::process_event -- entered" << std::endl;
0029   }
0030 
0031   ParticleFlowElementContainer *pflowContainer = findNode::getClass<ParticleFlowElementContainer>(topNode, "ParticleFlowElements");
0032   if (!pflowContainer)
0033   {
0034     return std::vector<Jet *>();
0035   }
0036 
0037   std::vector<Jet *> pseudojets;
0038   ParticleFlowElementContainer::ConstRange begin_end = pflowContainer->getParticleFlowElements();
0039   ParticleFlowElementContainer::ConstIterator rtiter;
0040 
0041   for (rtiter = begin_end.first; rtiter != begin_end.second; ++rtiter)
0042   {
0043     ParticleFlowElement *pflow = rtiter->second;
0044 
0045     Jet *jet = new Jetv2();
0046     jet->set_px(pflow->get_px());
0047     jet->set_py(pflow->get_py());
0048     jet->set_pz(pflow->get_pz());
0049     jet->set_e(pflow->get_e());
0050     jet->insert_comp(Jet::SRC::PARTICLE, pflow->get_id());
0051     pseudojets.push_back(jet);
0052     if (_verbosity > 15)
0053     {
0054       for (auto c : pseudojets[pseudojets.size() - 1]->get_comp_vec())
0055       {
0056         std::cout << " GOT " << ((int) c.first) << " and " << ((int) c.second) << std::endl;
0057       }
0058     }
0059   }
0060 
0061   if (_verbosity > 0)
0062   {
0063     std::cout << "ParticleFlowJetInput::process_event -- exited" << std::endl;
0064   }
0065 
0066   return pseudojets;
0067 }