ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackJetInput.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackJetInput.cc
1 #include "TrackJetInput.h"
2 
3 #include "Jet.h"
4 #include "Jetv1.h"
5 
8 
9 #include <phool/getClass.h>
10 
11 // standard includes
12 #include <iostream>
13 #include <map> // for _Rb_tree_const_iterator
14 #include <utility> // for pair
15 #include <vector>
16 
17 using namespace std;
18 
19 TrackJetInput::TrackJetInput(Jet::SRC input, const string &nodename)
20  : m_NodeName(nodename)
21  , _input(input)
22 {
23 }
24 
25 void TrackJetInput::identify(std::ostream &os)
26 {
27  os << " TrackJetInput: SvtxTrackMap to Jet::TRACK" << endl;
28 }
29 
30 std::vector<Jet *> TrackJetInput::get_input(PHCompositeNode *topNode)
31 {
32  if (Verbosity() > 0) cout << "TrackJetInput::process_event -- entered" << endl;
33 
34  // Pull the reconstructed track information off the node tree...
35  SvtxTrackMap *trackmap = findNode::getClass<SvtxTrackMap>(topNode, m_NodeName);
36  if (!trackmap)
37  {
38  return std::vector<Jet *>();
39  }
40 
41  std::vector<Jet *> pseudojets;
42  for (SvtxTrackMap::ConstIter iter = trackmap->begin();
43  iter != trackmap->end();
44  ++iter)
45  {
46  const SvtxTrack *track = iter->second;
47 
48  Jet *jet = new Jetv1();
49  jet->set_px(track->get_px());
50  jet->set_py(track->get_py());
51  jet->set_pz(track->get_pz());
52  jet->set_e(track->get_p());
53  jet->insert_comp(Jet::TRACK, track->get_id());
54  pseudojets.push_back(jet);
55  }
56 
57  if (Verbosity() > 0) cout << "TrackJetInput::process_event -- exited" << endl;
58 
59  return pseudojets;
60 }