Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PHG4PileupGenerator.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file PHG4PileupGenerator.cc
1 #include "PHG4PileupGenerator.h"
2 
4 
5 #include <gsl/gsl_randist.h>
6 
7 #include <iostream> // for operator<<, endl, basic_ostream
8 
9 using namespace std;
10 
13 {
14  return;
15 }
16 
18 {
19  delete _generator;
20 }
21 
23 {
25  _generator->Init(topNode);
27 }
28 
30 {
31  //cout << "generator ptr: " << _generator << endl;
32 
34 
35  _generator->InitRun(topNode);
36 
38 
41 
43 }
44 
46 {
48 
49  // toss multiple crossings all the way back
50  for (int icrossing = _min_crossing; icrossing <= _max_crossing; ++icrossing)
51  {
52  double crossing_time = _time_between_crossings * icrossing;
53 
54  int ncollisions = gsl_ran_poisson(RandomGenerator(), _ave_coll_per_crossing);
55  if (icrossing == 0) --ncollisions;
56 
57  for (int icollision = 0; icollision < ncollisions; ++icollision)
58  {
59  _generator->set_t0(crossing_time);
60  _generator->process_event(topNode);
61  }
62  }
63 
65 }
66 
68 {
70  _generator->Reset(topNode);
72 }
73 
75 {
77  _generator->ResetEvent(topNode);
79 }
80 
82 {
84  _generator->EndRun(runnumber);
86 }
87 
89 {
91  _generator->End(topNode);
93 }