Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MinimumBiasClassifier.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file MinimumBiasClassifier.cc
2 
3 #include "MinimumBiasInfov1.h"
4 
5 #include <calobase/TowerInfo.h>
6 #include <calobase/TowerInfoContainer.h>
7 
10 
11 #include <mbd/MbdOut.h>
12 
14 
15 #include <phool/PHCompositeNode.h>
16 #include <phool/PHIODataNode.h>
17 #include <phool/PHNode.h>
18 #include <phool/PHNodeIterator.h>
19 #include <phool/PHObject.h>
20 
21 #include <phool/getClass.h>
22 #include <phool/phool.h>
23 
24 #include <cmath>
25 #include <iostream>
26 #include <map> // for _Rb_tree_iterator
27 #include <string>
28 #include <utility> // for pair
29 
31  : SubsysReco(name)
32 {
33 
34 }
35 
37 {
38  if (Verbosity() > 1)
39  {
40  std::cout << __FILE__ << " :: " << __FUNCTION__ << std::endl;
41  }
42  CreateNodes(topNode);
43 
45  ;
46 }
47 
49 {
50 
51  _zdc_energy_sum.fill(0);
52 
54 
55 }
56 
58 {
59 
60  if (Verbosity() > 1)
61  {
62  std::cout << __FILE__ << " :: " << __FUNCTION__ << std::endl;
63  }
64 
65  bool is_it_min_bias = true;
66 
67  if (!_global_vertex_map)
68  {
71  }
72 
74  {
77  }
78 
79  GlobalVertex *vtx = _global_vertex_map->begin()->second;
80 
81 
82  if (!vtx)
83  {
84  std::cout << "nothing in vertex " << std::endl;
85 
88  }
89 
90  if (!vtx->isValid())
91  {
92  std::cout << "invalid vertex " << std::endl;
93 
96  }
97 
98  if (!_towers_zdc)
99  {
100  std::cout << "nothing in zdc " << std::endl;
101 
104  }
105 
106  int j = 0;
107 
108  for (unsigned int i = 0; i < _towers_zdc->size(); i++)
109  {
111  float energy = _tmp_tower->get_energy();
112  if (energy > 0)
113  {
114  _zdc_energy_sum[j / 3] += energy;
115  j++;
116  }
117  }
118  if (Verbosity())
119  {
120  std::cout << " MBD Z vertex: " << vtx->get_z() << std::endl;
121  std::cout << " MBD Number PMTs: " << std::endl;
122  std::cout << " North: " << _mbd_out->get_npmt(1) << std::endl;
123  std::cout << " South: " << _mbd_out->get_npmt(0) << std::endl;
124  std::cout << " MBD Charge Sum: " << std::endl;
125  std::cout << " North: " << _mbd_out->get_q(1) << std::endl;
126  std::cout << " South: " << _mbd_out->get_q(0) << std::endl;
127 
128  }
129 
130  if (std::fabs(vtx->get_z()) > _z_vtx_cut)
131  {
132  is_it_min_bias = false;
133  }
134 
135  for (int i = 0; i < 2; i++)
136  {
138  {
139  is_it_min_bias = false;
140  }
141  if (_zdc_energy_sum[i] < _zdc_cut)
142  {
143  is_it_min_bias = false;
144  }
145  }
146 
148  {
149  is_it_min_bias = false;
150  }
151  _mb_info->setIsAuAuMinimumBias(is_it_min_bias);
153 
154 }
155 
157 {
158  if (Verbosity())
159  {
160  std::cout << "------------MinimumBiasClassifier-------------" << std::endl;
161  }
162 
163  // Get Nodes from the Tree
164  if (GetNodes(topNode))
165  {
167  }
168 
169  if (FillMinimumBiasInfo())
170  {
172  }
173 
175 }
176 
178 {
179  if (Verbosity() > 1)
180  {
181  std::cout << __FILE__ << " :: " << __FUNCTION__ << " :: " << __LINE__ << std::endl;
182  }
183 
184  _mb_info = findNode::getClass<MinimumBiasInfo>(topNode, "MinimumBiasInfo");
185 
186  if (!_mb_info)
187  {
188  std::cout << "no minimum bias node " << std::endl;
190  }
191 
192  _mbd_out = findNode::getClass<MbdOut>(topNode, "MbdOut");
193 
194  if (!_mbd_out)
195  {
196  std::cout << "no MBD out node " << std::endl;
198  }
199 
200  _towers_zdc = findNode::getClass<TowerInfoContainer>(topNode, "TOWERINFO_CALIB_ZDC");
201 
202  if (!_towers_zdc)
203  {
204  std::cout << "no zdc towers node " << std::endl;
206  }
207 
208  _global_vertex_map = findNode::getClass<GlobalVertexMap>(topNode, "GlobalVertexMap");
209 
210  if (!_global_vertex_map)
211  {
212  std::cout << "no vertex map node " << std::endl;
214  }
216 }
217 
219 {
220  if (Verbosity())
221  {
222  std::cout << __FILE__ << " :: " << __FUNCTION__ << " :: " << __LINE__ << std::endl;
223  }
224 
225  PHNodeIterator iter(topNode);
226  PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
227  if (!dstNode)
228  {
229  std::cout << PHWHERE << "DST Node missing doing nothing" << std::endl;
230  }
231 
232  PHNodeIterator dstIter(dstNode);
233 
234  PHCompositeNode *detNode = dynamic_cast<PHCompositeNode *>(dstIter.findFirst("PHCompositeNode", "GLOBAL"));
235  if (!detNode)
236  {
237  std::cout << PHWHERE << "Detector Node missing, making one" << std::endl;
238  detNode = new PHCompositeNode("GLOBAL");
239  dstNode->addNode(detNode);
240  }
241 
242 
244 
245  PHIODataNode<PHObject> *mbNode = new PHIODataNode<PHObject>(mb, "MinimumBiasInfo", "PHObject");
246  detNode->addNode(mbNode);
247 
248  return;
249 }
250