Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JetProbeMaker.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file JetProbeMaker.cc
1 #include "JetProbeMaker.h"
2 
3 #include "Jetv2.h"
4 #include "JetContainer.h"
5 #include "JetContainerv1.h"
6 
9 #include <phool/PHIODataNode.h>
10 #include <phool/PHRandomSeed.h> // for PHRandomSeed
11 #include <phool/PHNode.h> // for PHNode
12 #include <phool/PHNodeIterator.h>
13 #include <phool/PHObject.h> // for PHObject
14 #include <phool/phool.h> // for PHWHERE
15 #include <phool/getClass.h>
16 
17 #include <TRandom3.h>
18 #include <fastjet/PseudoJet.hh>
19 
21  // update the jet probe
22  float phi = M_PI*(1.-2.*gsl_rng_uniform(m_rng.get()));
23  float eta = _eta_min+gsl_rng_uniform(m_rng.get()) * _eta_range;
24  float pt = (_pt_range == 0.
25  ? _pt_min
26  : _pt_min + gsl_rng_uniform(m_rng.get()) * _pt_range
27  );
28 
29  fastjet::PseudoJet fjet {};
30  fjet.reset_PtYPhiM(pt, eta, phi);
31 
32  Jetv2* jet = (Jetv2*) _jets->add_jet();
33  jet->set_px(fjet.px());
34  jet->set_py(fjet.py());
35  jet->set_pz(fjet.pz());
36  jet->set_e(fjet.e());
37  jet->insert_comp(Jet::SRC::JET_PROBE, 0, false);
38 
40 }
41 
43  : SubsysReco(name)
44 {
45  // initialize rng
46  const uint seed = PHRandomSeed();
47  m_rng.reset(gsl_rng_alloc(gsl_rng_mt19937));
48  gsl_rng_set(m_rng.get(), seed);
49 };
50 
52  // Create the Input node if required
53  PHNodeIterator iter(topNode);
54 
55  // Looking for the DST node
56  PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
57  if (!dstNode)
58  {
59  std::cout << PHWHERE << "DST Node missing, doing nothing." << std::endl;
61  }
62 
63  // Create the Input node if required
64  PHCompositeNode *probeNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "JetProbeNode"));
65  if (!probeNode)
66  {
67  probeNode = new PHCompositeNode("JetProbeNode");
68  dstNode->addNode(probeNode);
69  }
70 
71  _jets = findNode::getClass<JetContainer>(topNode, "JetProbeContainer");
72  if (!_jets)
73  {
74  _jets = new JetContainerv1();
75  PHIODataNode<PHObject> *JetContainerNode = new
76  PHIODataNode<PHObject>(_jets, "JetProbeContainer", "PHObject");
77  dstNode->addNode(JetContainerNode);
78  }
79 
80 
82 }
83