Analysis Software
Documentation for
sPHENIX
simulation software
Home page
Related Pages
Modules
Namespaces
Classes
Files
Examples
External Links
File List
File Members
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
7
#include <
fun4all/Fun4AllReturnCodes.h
>
8
#include <
phool/PHCompositeNode.h
>
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
20
int
JetProbeMaker::process_event
(
PHCompositeNode
*
/*topNode*/
) {
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
39
return
Fun4AllReturnCodes::EVENT_OK
;
40
}
41
42
JetProbeMaker::JetProbeMaker
(
const
std::string
&
name
)
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
51
int
JetProbeMaker::InitRun
(
PHCompositeNode
*topNode) {
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;
60
return
Fun4AllReturnCodes::ABORTRUN
;
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
81
return
Fun4AllReturnCodes::EVENT_OK
;
82
}
83
coresoftware
blob
master
offline
packages
jetbase
JetProbeMaker.cc
Built by
Jin Huang
. updated:
Sat Feb 17 2024 22:18:06
using
1.8.2 with
sPHENIX GitHub integration