EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CaloTriggerSim.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CaloTriggerSim.cc
1 #include "CaloTriggerSim.h"
2 
3 #include "CaloTriggerInfo.h"
4 #include "CaloTriggerInfov1.h"
5 
6 // sPHENIX includes
7 #include <calobase/RawTower.h>
8 #include <calobase/RawTowerContainer.h>
9 #include <calobase/RawTowerGeom.h>
10 #include <calobase/RawTowerGeomContainer.h>
11 #include <calobase/RawTowerGeomContainer_Cylinderv1.h>
12 
14 #include <fun4all/SubsysReco.h>
15 
16 #include <phool/PHCompositeNode.h>
17 #include <phool/PHIODataNode.h>
18 #include <phool/PHNode.h>
19 #include <phool/PHNodeIterator.h>
20 #include <phool/PHObject.h>
21 #include <phool/getClass.h>
22 #include <phool/phool.h>
23 
24 // standard includes
25 #include <algorithm>
26 #include <cmath>
27 #include <cstdlib>
28 #include <iomanip>
29 #include <iostream>
30 #include <map>
31 #include <utility>
32 #include <vector>
33 
34 using namespace std;
35 
37  : SubsysReco(name)
38  , m_EmulateTruncationFlag(0)
39  // initiate sizes as -1 to tell module they can be set when it sees
40  // the EMCal geometry for the first time
41  , m_EMCAL_1x1_NETA(-1)
42  , m_EMCAL_1x1_NPHI(-1)
43  , m_EMCAL_2x2_NETA(-1)
44  , m_EMCAL_2x2_NPHI(-1)
45  , m_EMCAL_4x4_NETA(-1)
46  , m_EMCAL_4x4_NPHI(-1)
47  , m_EMCAL_2x2_BEST_E(0)
48  , m_EMCAL_2x2_BEST_PHI(0)
49  , m_EMCAL_2x2_BEST_ETA(0)
50  , m_EMCAL_4x4_BEST_E(0)
51  , m_EMCAL_4x4_BEST_PHI(0)
52  , m_EMCAL_4x4_BEST_ETA(0)
53  , m_EMCAL_4x4_BEST2_E(0)
54  , m_EMCAL_4x4_BEST2_PHI(0)
55  , m_EMCAL_4x4_BEST2_ETA(0)
56  // do the same for full calo
57  , m_FULLCALO_PHI_START(0)
58  , m_FULLCALO_PHI_END(2 * M_PI)
59  , m_FULLCALO_0p1x0p1_NETA(-1)
60  , m_FULLCALO_0p1x0p1_NPHI(-1)
61  , m_FULLCALO_0p2x0p2_NETA(-1)
62  , m_FULLCALO_0p2x0p2_NPHI(-1)
63  , m_FULLCALO_0p4x0p4_NETA(-1)
64  , m_FULLCALO_0p4x0p4_NPHI(-1)
65  , m_FULLCALO_0p6x0p6_NETA(-1)
66  , m_FULLCALO_0p6x0p6_NPHI(-1)
67  , m_FULLCALO_0p8x0p8_NETA(-1)
68  , m_FULLCALO_0p8x0p8_NPHI(-1)
69  , m_FULLCALO_1p0x1p0_NETA(-1)
70  , m_FULLCALO_1p0x1p0_NPHI(-1)
71  , m_FULLCALO_0p2x0p2_BEST_E(0)
72  , m_FULLCALO_0p2x0p2_BEST_PHI(0)
73  , m_FULLCALO_0p2x0p2_BEST_ETA(0)
74  , m_FULLCALO_0p4x0p4_BEST_E(0)
75  , m_FULLCALO_0p4x0p4_BEST_PHI(0)
76  , m_FULLCALO_0p4x0p4_BEST_ETA(0)
77  , m_FULLCALO_0p6x0p6_BEST_E(0)
78  , m_FULLCALO_0p6x0p6_BEST_PHI(0)
79  , m_FULLCALO_0p6x0p6_BEST_ETA(0)
80  , m_FULLCALO_0p8x0p8_BEST_E(0)
81  , m_FULLCALO_0p8x0p8_BEST_PHI(0)
82  , m_FULLCALO_0p8x0p8_BEST_ETA(0)
83  , m_FULLCALO_1p0x1p0_BEST_E(0)
84  , m_FULLCALO_1p0x1p0_BEST_PHI(0)
85  , m_FULLCALO_1p0x1p0_BEST_ETA(0)
86 
87 {
88  return;
89 }
90 
91 double CaloTriggerSim::truncate_8bit(const double raw_E) const
92 {
93  double rawE = std::min(raw_E, 45.0);
94  int counts = std::floor(rawE / (45.0 / 256));
95 
96  return counts * (45.0 / 256);
97 }
99 {
100  return CreateNode(topNode);
101 }
102 
104 {
105  if (Verbosity() > 0)
106  std::cout << "CaloTriggerSim::process_event: entering" << std::endl;
107 
108  // pull out the tower containers and geometry objects at the start
109  RawTowerContainer *towersEM3 = findNode::getClass<RawTowerContainer>(topNode, "TOWER_CALIB_CEMC");
110  RawTowerContainer *towersIH3 = findNode::getClass<RawTowerContainer>(topNode, "TOWER_CALIB_HCALIN");
111  RawTowerContainer *towersOH3 = findNode::getClass<RawTowerContainer>(topNode, "TOWER_CALIB_HCALOUT");
112  if (Verbosity() > 0)
113  {
114  std::cout << "CaloTriggerSim::process_event: " << towersEM3->size() << " TOWER_CALIB_CEMC towers" << std::endl;
115  std::cout << "CaloTriggerSim::process_event: " << towersIH3->size() << " TOWER_CALIB_HCALIN towers" << std::endl;
116  std::cout << "CaloTriggerSim::process_event: " << towersOH3->size() << " TOWER_CALIB_HCALOUT towers" << std::endl;
117  }
118 
119  RawTowerGeomContainer_Cylinderv1 *geomEM = findNode::getClass<RawTowerGeomContainer_Cylinderv1>(topNode, "TOWERGEOM_CEMC");
120  RawTowerGeomContainer *geomIH = findNode::getClass<RawTowerGeomContainer>(topNode, "TOWERGEOM_HCALIN");
121  RawTowerGeomContainer *geomOH = findNode::getClass<RawTowerGeomContainer>(topNode, "TOWERGEOM_HCALOUT");
122 
123  // get the binning from the geometry (different for 1D vs 2D...)
124  int geom_etabins = geomEM->get_etabins();
125  int geom_phibins = geomEM->get_phibins();
126 
127  // if internal knowledge of geometry is unset, set it now (should
128  // only happen once, on the first event)
129  if (m_EMCAL_1x1_NETA < 0)
130  {
131  m_EMCAL_1x1_NETA = geom_etabins;
132  m_EMCAL_1x1_NPHI = geom_phibins;
133 
134  // half as many 2x2 windows along each axis as 1x1
135  m_EMCAL_2x2_NETA = geom_etabins / 2;
136  m_EMCAL_2x2_NPHI = geom_phibins / 2;
137 
138  // each 2x2 window defines a 4x4 window for which that 2x2 window
139  // is the upper-left corner, so there are as many 4x4's as 2x2's
140  // (except in eta, where the edge effect means there is 1 fewer)
141  m_EMCAL_4x4_NETA = geom_etabins / 2 - 1;
142  m_EMCAL_4x4_NPHI = geom_phibins / 2;
143 
144  // reset all maps
145  m_EMCAL_1x1_MAP.resize(m_EMCAL_1x1_NETA, std::vector<double>(m_EMCAL_1x1_NPHI, 0));
146  m_EMCAL_2x2_MAP.resize(m_EMCAL_2x2_NETA, std::vector<double>(m_EMCAL_2x2_NPHI, 0));
147  m_EMCAL_4x4_MAP.resize(m_EMCAL_4x4_NETA, std::vector<double>(m_EMCAL_4x4_NPHI, 0));
148 
149  if (Verbosity() > 0)
150  {
151  std::cout << "CaloTriggerSim::process_event: setting number of window in eta / phi,";
152  std::cout << "1x1 are " << m_EMCAL_1x1_NETA << " / " << m_EMCAL_1x1_NPHI << ", ";
153  std::cout << "2x2 are " << m_EMCAL_2x2_NETA << " / " << m_EMCAL_2x2_NPHI << ", ";
154  std::cout << "4x4 are " << m_EMCAL_4x4_NETA << " / " << m_EMCAL_4x4_NPHI << std::endl;
155  }
156  }
157 
158  // reset 1x1 map
159  fill(m_EMCAL_1x1_MAP.begin(), m_EMCAL_1x1_MAP.end(), vector<double>(m_EMCAL_1x1_NPHI, 0));
160 
161  // iterate over EMCal towers, constructing 1x1's
162  RawTowerContainer::ConstRange begin_end = towersEM3->getTowers();
163  for (RawTowerContainer::ConstIterator rtiter = begin_end.first; rtiter != begin_end.second; ++rtiter)
164  {
165  RawTower *tower = rtiter->second;
166  RawTowerGeom *tower_geom = geomEM->get_tower_geometry(tower->get_key());
167 
168  double this_eta = tower_geom->get_eta();
169  double this_phi = tower_geom->get_phi();
170  int this_etabin = geomEM->get_etabin(this_eta);
171  int this_phibin = geomEM->get_phibin(this_phi);
172  double this_E = tower->get_energy();
173 
174  m_EMCAL_1x1_MAP[this_etabin][this_phibin] += this_E;
175 
176  if (Verbosity() > 1 && tower->get_energy() > 1)
177  {
178  std::cout << "CaloTriggerSim::process_event: EMCal 1x1 tower eta ( bin ) / phi ( bin ) / E = " << std::setprecision(6) << this_eta << " ( " << this_etabin << " ) / " << this_phi << " ( " << this_phibin << " ) / " << this_E << std::endl;
179  }
180  }
181 
182  // reset 2x2 map and best
183  fill(m_EMCAL_2x2_MAP.begin(), m_EMCAL_2x2_MAP.end(), vector<double>(m_EMCAL_2x2_NPHI, 0));
184 
185  m_EMCAL_2x2_BEST_E = 0;
188 
189  // now reconstruct 2x2 map from 1x1 map
190  for (int ieta = 0; ieta < m_EMCAL_2x2_NETA; ieta++)
191  {
192  for (int iphi = 0; iphi < m_EMCAL_2x2_NPHI; iphi++)
193  {
194  double this_sum = 0;
195 
196  this_sum += m_EMCAL_1x1_MAP[2 * ieta][2 * iphi];
197  this_sum += m_EMCAL_1x1_MAP[2 * ieta][2 * iphi + 1]; // 2 * iphi + 1 is safe, since m_EMCAL_2x2_NPHI = m_EMCAL_1x1_NPHI / 2
198  this_sum += m_EMCAL_1x1_MAP[2 * ieta + 1][2 * iphi]; // 2 * ieta + 1 is safe, since m_EMCAL_2x2_NETA = m_EMCAL_1x1_NETA / 2
199  this_sum += m_EMCAL_1x1_MAP[2 * ieta + 1][2 * iphi + 1];
200 
202  {
203  this_sum = truncate_8bit(this_sum);
204  }
205 
206  // populate 2x2 map
207  m_EMCAL_2x2_MAP[ieta][iphi] = this_sum;
208 
209  // to calculate the eta, phi position, take the average of that of the 1x1's
210  double this_eta = 0.5 * (geomEM->get_etacenter(2 * ieta) + geomEM->get_etacenter(2 * ieta + 1));
211  double this_phi = 0.5 * (geomEM->get_phicenter(2 * iphi) + geomEM->get_phicenter(2 * iphi + 1));
212  // wrap-around phi (apparently needed for 2D geometry?)
213  if (this_phi > M_PI) this_phi -= 2 * M_PI;
214  if (this_phi < -M_PI) this_phi += 2 * M_PI;
215 
216  if (Verbosity() > 1 && this_sum > 1)
217  {
218  std::cout << "CaloTriggerSim::process_event: EMCal 2x2 tower eta ( bin ) / phi ( bin ) / E = " << std::setprecision(6) << this_eta << " ( " << ieta << " ) / " << this_phi << " ( " << iphi << " ) / " << this_sum << std::endl;
219  }
220 
221  if (this_sum > m_EMCAL_2x2_BEST_E)
222  {
223  m_EMCAL_2x2_BEST_E = this_sum;
224  m_EMCAL_2x2_BEST_PHI = this_phi;
225  m_EMCAL_2x2_BEST_ETA = this_eta;
226  }
227  }
228  }
229 
230  if (Verbosity() > 0)
231  {
232  std::cout << "CaloTriggerSim::process_event: best EMCal 2x2 window is at eta / phi = " << m_EMCAL_2x2_BEST_ETA << " / " << m_EMCAL_2x2_BEST_PHI << " and E = " << m_EMCAL_2x2_BEST_E << std::endl;
233  }
234 
235  // reset 4x4 map & best
236  fill(m_EMCAL_4x4_MAP.begin(), m_EMCAL_4x4_MAP.end(), vector<double>(m_EMCAL_4x4_NPHI, 0));
237 
238  m_EMCAL_4x4_BEST_E = 0;
241 
242  int emcal_4x4_best_iphi = -1;
243  int emcal_4x4_best_ieta = -1;
244 
245  // now reconstruct (sliding) 4x4 map from 2x2 map
246  for (int ieta = 0; ieta < m_EMCAL_4x4_NETA; ieta++)
247  {
248  for (int iphi = 0; iphi < m_EMCAL_4x4_NPHI; iphi++)
249  {
250  // for eta calculation (since eta distribution is potentially
251  // non-uniform), average positions of all four towers
252  double this_eta = 0.25 * (geomEM->get_etacenter(2 * ieta) + geomEM->get_etacenter(2 * ieta + 1) + geomEM->get_etacenter(2 * ieta + 2) + geomEM->get_etacenter(2 * ieta + 3));
253  // for phi calculation (since phi distribution is uniform), take
254  // first tower and add 1.5 tower widths
255  double this_phi = geomEM->get_phicenter(2 * iphi) + 1.5 * (geomEM->get_phicenter(2 * iphi + 1) - geomEM->get_phicenter(2 * iphi));
256  // wrap-around phi (apparently needed for 2D geometry?)
257  if (this_phi > M_PI) this_phi -= 2 * M_PI;
258  if (this_phi < -M_PI) this_phi += 2 * M_PI;
259 
260  double this_sum = 0;
261 
262  this_sum += m_EMCAL_2x2_MAP[ieta][iphi];
263  this_sum += m_EMCAL_2x2_MAP[ieta + 1][iphi]; // ieta + 1 is safe, since m_EMCAL_4x4_NETA = m_EMCAL_2x2_NETA - 1
264 
265  if (iphi != m_EMCAL_4x4_NPHI - 1)
266  {
267  // if we are not in the last phi row, can safely access 'iphi+1'
268  this_sum += m_EMCAL_2x2_MAP[ieta][iphi + 1];
269  this_sum += m_EMCAL_2x2_MAP[ieta + 1][iphi + 1];
270  }
271  else
272  {
273  // if we are in the last phi row, wrap back around to zero
274  this_sum += m_EMCAL_2x2_MAP[ieta][0];
275  this_sum += m_EMCAL_2x2_MAP[ieta + 1][0];
276  }
277 
278  m_EMCAL_4x4_MAP[ieta][iphi] = this_sum;
279 
280  if (Verbosity() > 1 && this_sum > 1)
281  {
282  std::cout << "CaloTriggerSim::process_event: EMCal 4x4 tower eta ( bin ) / phi ( bin ) / E = " << std::setprecision(6) << this_eta << " ( " << ieta << " ) / " << this_phi << " ( " << iphi << " ) / " << this_sum << std::endl;
283  }
284 
285  if (this_sum > m_EMCAL_4x4_BEST_E)
286  {
287  m_EMCAL_4x4_BEST_E = this_sum;
288  m_EMCAL_4x4_BEST_PHI = this_phi;
289  m_EMCAL_4x4_BEST_ETA = this_eta;
290 
291  emcal_4x4_best_iphi = iphi;
292  emcal_4x4_best_ieta = ieta;
293  }
294  }
295  }
296 
300 
301  // find second-largest 4x4 which is > 1 tower away...
302  for (int ieta = 0; ieta < m_EMCAL_4x4_NETA; ieta++)
303  {
304  for (int iphi = 0; iphi < m_EMCAL_4x4_NPHI; iphi++)
305  {
306  int deta = ieta - emcal_4x4_best_ieta;
307  int dphi = (iphi - emcal_4x4_best_iphi) % m_EMCAL_4x4_NPHI;
308 
309  if (abs(deta) < 1.5 && abs(dphi) < 1.5)
310  continue;
311 
312  double this_eta = 0.25 * (geomEM->get_etacenter(2 * ieta) + geomEM->get_etacenter(2 * ieta + 1) + geomEM->get_etacenter(2 * ieta + 2) + geomEM->get_etacenter(2 * ieta + 3));
313  double this_phi = geomEM->get_phicenter(2 * iphi) + 1.5 * (geomEM->get_phicenter(2 * iphi + 1) - geomEM->get_phicenter(2 * iphi));
314 
315  if (this_phi > M_PI) this_phi -= 2 * M_PI;
316  if (this_phi < -M_PI) this_phi += 2 * M_PI;
317 
318  double this_sum = m_EMCAL_4x4_MAP[ieta][iphi];
319 
320  if (this_sum > m_EMCAL_4x4_BEST2_E)
321  {
322  m_EMCAL_4x4_BEST2_E = this_sum;
323  m_EMCAL_4x4_BEST2_PHI = this_phi;
324  m_EMCAL_4x4_BEST2_ETA = this_eta;
325  }
326  }
327  }
328 
329  if (Verbosity() > 0)
330  {
331  std::cout << "CaloTriggerSim::process_event: best EMCal 4x4 window is at eta / phi = " << m_EMCAL_4x4_BEST_ETA << " / " << m_EMCAL_4x4_BEST_PHI << " and E = " << m_EMCAL_4x4_BEST_E << std::endl;
332  std::cout << "CaloTriggerSim::process_event: 2nd best EMCal 4x4 window is at eta / phi = " << m_EMCAL_4x4_BEST2_ETA << " / " << m_EMCAL_4x4_BEST2_PHI << " and E = " << m_EMCAL_4x4_BEST2_E << std::endl;
333  }
334 
335  // begin full calo sim
336 
337  // get the 0.1x0.1 binning from the OHCal geometry
338  int geomOH_etabins = geomOH->get_etabins();
339  int geomOH_phibins = geomOH->get_phibins();
340 
341  // if internal knowledge of geometry is unset, set it now
342  if (m_FULLCALO_0p1x0p1_NETA < 0)
343  {
344  m_FULLCALO_PHI_START = geomOH->get_phibounds(0).first;
345  m_FULLCALO_PHI_END = geomOH->get_phibounds(geomOH_phibins - 1).second;
346 
347  m_FULLCALO_0p1x0p1_NETA = geomOH_etabins;
348  m_FULLCALO_0p1x0p1_NPHI = geomOH_phibins;
349 
350  // half as many 0.2x0.2 windows along each axis as 0.1x0.1
351  m_FULLCALO_0p2x0p2_NETA = geomOH_etabins / 2;
352  m_FULLCALO_0p2x0p2_NPHI = geomOH_phibins / 2;
353 
354  // each 0.2x0.2 window defines a 0.4x0.4 window for which that
355  // 0.2x0.2 window is the upper-left corner, so there are as many
356  // 0.4x0.4's as 0.2x0.2's (except in eta, where the edge effect
357  // means there is 1 fewer)
358  m_FULLCALO_0p4x0p4_NETA = geomOH_etabins / 2 - 1;
359  m_FULLCALO_0p4x0p4_NPHI = geomOH_phibins / 2;
360 
361  // for 0.6x0.6 windows, the above logic applies, except that the
362  // edge effect causes there to be 2 fewer less in eta
363  m_FULLCALO_0p6x0p6_NETA = geomOH_etabins / 2 - 2;
364  m_FULLCALO_0p6x0p6_NPHI = geomOH_phibins / 2;
365 
366  // for 0.8x0.8 windows, the above logic applies, except that the
367  // edge effect causes there to be 3 fewer less in eta
368  m_FULLCALO_0p8x0p8_NETA = geomOH_etabins / 2 - 3;
369  m_FULLCALO_0p8x0p8_NPHI = geomOH_phibins / 2;
370 
371  // for 1.0x1.0 windows, the above logic applies, except that the
372  // edge effect causes there to be 4 fewer less in eta
373  m_FULLCALO_1p0x1p0_NETA = geomOH_etabins / 2 - 4;
374  m_FULLCALO_1p0x1p0_NPHI = geomOH_phibins / 2;
375 
376  // reset all maps
383 
384  if (Verbosity() > 0)
385  {
386  std::cout << "CaloTriggerSim::process_event: determining phi range for 0.1x0.1 full calo map: " << m_FULLCALO_PHI_START << " to " << m_FULLCALO_PHI_END << std::endl;
387  std::cout << "CaloTriggerSim::process_event: setting number of full calo window in eta / phi:" << std::endl;
388  std::cout << " 0.1x0.1 are " << m_FULLCALO_0p1x0p1_NETA << " / " << m_FULLCALO_0p1x0p1_NPHI << ", ";
389  std::cout << "0.2x0.2 are " << m_FULLCALO_0p2x0p2_NETA << " / " << m_FULLCALO_0p2x0p2_NPHI << ", ";
390  std::cout << "0.4x0.4 are " << m_FULLCALO_0p4x0p4_NETA << " / " << m_FULLCALO_0p4x0p4_NPHI << ", ";
391  std::cout << "0.6x0.6 are " << m_FULLCALO_0p6x0p6_NETA << " / " << m_FULLCALO_0p6x0p6_NPHI << ", ";
392  std::cout << "0.8x0.8 are " << m_FULLCALO_0p8x0p8_NETA << " / " << m_FULLCALO_0p8x0p8_NPHI << ", ";
393  std::cout << "1.0x1.0 are " << m_FULLCALO_1p0x1p0_NETA << " / " << m_FULLCALO_1p0x1p0_NPHI << std::endl;
394  }
395  }
396 
397  // reset 0.1x0.1 map
398  fill(m_FULLCALO_0p1x0p1_MAP.begin(), m_FULLCALO_0p1x0p1_MAP.end(), vector<double>(m_FULLCALO_0p1x0p1_NPHI, 0));
399 
400  // iterate over EMCal towers, filling in the 0.1x0.1 region they contribute to
401  RawTowerContainer::ConstRange begin_end_EM = towersEM3->getTowers();
402  for (RawTowerContainer::ConstIterator rtiter = begin_end_EM.first; rtiter != begin_end_EM.second; ++rtiter)
403  {
404  RawTower *tower = rtiter->second;
405  RawTowerGeom *tower_geom = geomEM->get_tower_geometry(tower->get_key());
406 
407  double this_eta = tower_geom->get_eta();
408  double this_phi = tower_geom->get_phi();
409  if (this_phi < m_FULLCALO_PHI_START) this_phi += 2 * M_PI;
410  if (this_phi > m_FULLCALO_PHI_END) this_phi -= 2 * M_PI;
411 
412  // note: look up eta/phi index based on OHCal geometry, since this
413  // defines the 0.1x0.1 regions
414  int this_etabin = geomOH->get_etabin(this_eta);
415  int this_phibin = geomOH->get_phibin(this_phi);
416  double this_E = tower->get_energy();
417 
418  m_FULLCALO_0p1x0p1_MAP[this_etabin][this_phibin] += this_E;
419 
420  if (Verbosity() > 1 && tower->get_energy() > 1)
421  {
422  std::cout << "CaloTriggerSim::process_event: EMCal tower at eta / phi (added to fullcalo map with etabin / phibin ) / E = " << std::setprecision(6) << this_eta << " / " << this_phi << " ( " << this_etabin << " / " << this_phibin << " ) / " << this_E << std::endl;
423  }
424  }
425 
426  // iterate over IHCal towers, filling in the 0.1x0.1 region they contribute to
427  RawTowerContainer::ConstRange begin_end_IH = towersIH3->getTowers();
428  for (RawTowerContainer::ConstIterator rtiter = begin_end_IH.first; rtiter != begin_end_IH.second; ++rtiter)
429  {
430  RawTower *tower = rtiter->second;
431  RawTowerGeom *tower_geom = geomIH->get_tower_geometry(tower->get_key());
432 
433  double this_eta = tower_geom->get_eta();
434  double this_phi = tower_geom->get_phi();
435  if (this_phi < m_FULLCALO_PHI_START) this_phi += 2 * M_PI;
436  if (this_phi > m_FULLCALO_PHI_END) this_phi -= 2 * M_PI;
437 
438  // note: look up eta/phi index based on OHCal geometry, even though I
439  // think it is by construction the same as the IHCal geometry...
440  int this_etabin = geomOH->get_etabin(this_eta);
441  int this_phibin = geomOH->get_phibin(this_phi);
442  double this_E = tower->get_energy();
443 
444  m_FULLCALO_0p1x0p1_MAP[this_etabin][this_phibin] += this_E;
445 
446  if (Verbosity() > 1 && tower->get_energy() > 0.5)
447  {
448  std::cout << "CaloTriggerSim::process_event: IHCal tower at eta / phi (added to fullcalo map with etabin / phibin ) / E = " << std::setprecision(6) << this_eta << " / " << this_phi << " ( " << this_etabin << " / " << this_phibin << " ) / " << this_E << std::endl;
449  }
450  }
451 
452  // iterate over OHCal towers, filling in the 0.1x0.1 region they contribute to
453  RawTowerContainer::ConstRange begin_end_OH = towersOH3->getTowers();
454  for (RawTowerContainer::ConstIterator rtiter = begin_end_OH.first; rtiter != begin_end_OH.second; ++rtiter)
455  {
456  RawTower *tower = rtiter->second;
457  RawTowerGeom *tower_geom = geomOH->get_tower_geometry(tower->get_key());
458 
459  double this_eta = tower_geom->get_eta();
460  double this_phi = tower_geom->get_phi();
461  if (this_phi < m_FULLCALO_PHI_START) this_phi += 2 * M_PI;
462  if (this_phi > m_FULLCALO_PHI_END) this_phi -= 2 * M_PI;
463 
464  // note: use the nominal eta/phi index, since the fullcalo 0.1x0.1
465  // map is defined by the OHCal geometry itself
466  int this_etabin = geomOH->get_etabin(this_eta);
467  int this_phibin = geomOH->get_phibin(this_phi);
468  double this_E = tower->get_energy();
469 
470  m_FULLCALO_0p1x0p1_MAP[this_etabin][this_phibin] += this_E;
471 
472  if (Verbosity() > 1 && tower->get_energy() > 0.5)
473  {
474  std::cout << "CaloTriggerSim::process_event: OHCal tower at eta / phi (added to fullcalo map with etabin / phibin ) / E = " << std::setprecision(6) << this_eta << " / " << this_phi << " ( " << this_etabin << " / " << this_phibin << " ) / " << this_E << std::endl;
475  }
476  }
477 
478  // reset 0.2x0.2 map and best
479  fill(m_FULLCALO_0p2x0p2_MAP.begin(), m_FULLCALO_0p2x0p2_MAP.end(), vector<double>(m_FULLCALO_0p2x0p2_NPHI, 0));
480 
484 
485  // now reconstruct (non-sliding) 0.2x0.2 map from 0.1x0.1 map
486  for (int ieta = 0; ieta < m_FULLCALO_0p2x0p2_NETA; ieta++)
487  {
488  for (int iphi = 0; iphi < m_FULLCALO_0p2x0p2_NPHI; iphi++)
489  {
490  double this_sum = 0;
491 
492  this_sum += m_FULLCALO_0p1x0p1_MAP[2 * ieta][2 * iphi];
493  this_sum += m_FULLCALO_0p1x0p1_MAP[2 * ieta][2 * iphi + 1]; // 2 * iphi + 1 is safe, since m_FULLCALO_0p2x0p2_NPHI = m_FULLCALO_0p1x0p1_NPHI / 2
494  this_sum += m_FULLCALO_0p1x0p1_MAP[2 * ieta + 1][2 * iphi]; // 2 * ieta + 1 is safe, since m_FULLCALO_0p2x0p2_NETA = m_FULLCALO_0p1x0p1_NETA / 2
495  this_sum += m_FULLCALO_0p1x0p1_MAP[2 * ieta + 1][2 * iphi + 1];
496 
497  // populate 0.2x0.2 map
498  m_FULLCALO_0p2x0p2_MAP[ieta][iphi] = this_sum;
499 
500  // to calculate the eta, phi position, take the average of that
501  // of the contributing 0.1x0.1's (which are defined by the OHCal geometry)
502  double this_eta = 0.5 * (geomOH->get_etacenter(2 * ieta) + geomOH->get_etacenter(2 * ieta + 1));
503  double this_phi = 0.5 * (geomOH->get_phicenter(2 * iphi) + geomOH->get_phicenter(2 * iphi + 1));
504 
505  if (Verbosity() > 1 && this_sum > 1)
506  {
507  std::cout << "CaloTriggerSim::process_event: FullCalo 0.2x0.2 window eta ( bin ) / phi ( bin ) / E = " << std::setprecision(6) << this_eta << " ( " << ieta << " ) / " << this_phi << " ( " << iphi << " ) / " << this_sum << std::endl;
508  }
509 
510  if (this_sum > m_FULLCALO_0p2x0p2_BEST_E)
511  {
512  m_FULLCALO_0p2x0p2_BEST_E = this_sum;
513  m_FULLCALO_0p2x0p2_BEST_PHI = this_phi;
514  m_FULLCALO_0p2x0p2_BEST_ETA = this_eta;
515  }
516  }
517  }
518 
519  if (Verbosity() > 0)
520  {
521  std::cout << "CaloTriggerSim::process_event: best FullCalo 0.2x0.2 window is at eta / phi = " << m_FULLCALO_0p2x0p2_BEST_ETA << " / " << m_FULLCALO_0p2x0p2_BEST_PHI << " and E = " << m_FULLCALO_0p2x0p2_BEST_E << std::endl;
522  }
523 
524  // reset fullcalo 0.4x0.4 map & best
525  fill(m_FULLCALO_0p4x0p4_MAP.begin(), m_FULLCALO_0p4x0p4_MAP.end(), vector<double>(m_FULLCALO_0p4x0p4_NPHI, 0));
526 
530 
531  // now reconstruct (sliding) 0.4x0.4 map from 0.2x0.2 map
532  for (int ieta = 0; ieta < m_FULLCALO_0p4x0p4_NETA; ieta++)
533  {
534  for (int iphi = 0; iphi < m_FULLCALO_0p4x0p4_NPHI; iphi++)
535  {
536  // for eta calculation, use position of corner tower and add 1.5
537  // tower widths
538  double this_eta = geomOH->get_etacenter(2 * ieta) + 1.5 * (geomOH->get_etacenter(1) - geomOH->get_etacenter(0));
539  // for phi calculation, use position of corner tower and add 1.5
540  // tower widths
541  double this_phi = geomOH->get_phicenter(2 * iphi) + 1.5 * (geomOH->get_phicenter(1) - geomOH->get_phicenter(0));
542 
543  double this_sum = 0;
544 
545  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][iphi];
546  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][iphi]; // 2 * ieta + 1 is safe, since m_FULLCALO_0p4x0p4_NETA = m_FULLCALO_0p4x0p4_NETA - 1
547 
548  // add 1 to phi, but take modulus w.r.t. m_FULLCALO_0p2x0p2_NPHI
549  // in case we have wrapped back around
550  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
551  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
552 
553  m_FULLCALO_0p4x0p4_MAP[ieta][iphi] = this_sum;
554 
555  if (Verbosity() > 1 && this_sum > 2)
556  {
557  std::cout << "CaloTriggerSim::process_event: FullCalo 0.4x0.4 tower eta ( bin ) / phi ( bin ) / E = " << std::setprecision(6) << this_eta << " ( " << ieta << " ) / " << this_phi << " ( " << iphi << " ) / " << this_sum << std::endl;
558  }
559 
560  if (this_sum > m_FULLCALO_0p4x0p4_BEST_E)
561  {
562  m_FULLCALO_0p4x0p4_BEST_E = this_sum;
563  m_FULLCALO_0p4x0p4_BEST_PHI = this_phi;
564  m_FULLCALO_0p4x0p4_BEST_ETA = this_eta;
565  }
566  }
567  }
568 
569  if (Verbosity() > 0)
570  {
571  std::cout << "CaloTriggerSim::process_event: best FullCalo 0.4x0.4 window is at eta / phi = " << m_FULLCALO_0p4x0p4_BEST_ETA << " / " << m_FULLCALO_0p4x0p4_BEST_PHI << " and E = " << m_FULLCALO_0p4x0p4_BEST_E << std::endl;
572  }
573 
574  // reset fullcalo 0.6x0.6 map & best
575  fill(m_FULLCALO_0p6x0p6_MAP.begin(), m_FULLCALO_0p6x0p6_MAP.end(), vector<double>(m_FULLCALO_0p6x0p6_NPHI, 0));
576 
580 
581  // now reconstruct (sliding) 0.6x0.6 map from 0.2x0.2 map
582  for (int ieta = 0; ieta < m_FULLCALO_0p6x0p6_NETA; ieta++)
583  {
584  for (int iphi = 0; iphi < m_FULLCALO_0p6x0p6_NPHI; iphi++)
585  {
586  // for eta calculation, use position of corner tower and add 2.5
587  // tower widths
588  double this_eta = geomOH->get_etacenter(2 * ieta) + 2.5 * (geomOH->get_etacenter(1) - geomOH->get_etacenter(0));
589  // for phi calculation, use position of corner tower and add 2.5
590  // tower widths
591  double this_phi = geomOH->get_phicenter(2 * iphi) + 2.5 * (geomOH->get_phicenter(1) - geomOH->get_phicenter(0));
592 
593  double this_sum = 0;
594 
595  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][iphi];
596  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][iphi]; // ieta + 1 is safe, since m_FULLCALO_0p6x0p6_NETA = m_FULLCALO_0p2x0p2_NETA - 2
597  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][iphi]; // ieta + 2 is safe, since m_FULLCALO_0p6x0p6_NETA = m_FULLCALO_0p2x0p2_NETA - 2
598 
599  // add 1 to phi, but take modulus w.r.t. m_FULLCALO_0p2x0p2_NPHI
600  // in case we have wrapped back around
601  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
602  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
603  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
604  // add 2 to phi, but take modulus w.r.t. m_FULLCALO_0p2x0p2_NPHI
605  // in case we have wrapped back around
606  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
607  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
608  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
609 
610  m_FULLCALO_0p6x0p6_MAP[ieta][iphi] = this_sum;
611 
612  if (Verbosity() > 1 && this_sum > 3)
613  {
614  std::cout << "CaloTriggerSim::process_event: FullCalo 0.6x0.6 tower eta ( bin ) / phi ( bin ) / E = " << std::setprecision(6) << this_eta << " ( " << ieta << " ) / " << this_phi << " ( " << iphi << " ) / " << this_sum << std::endl;
615  }
616 
617  if (this_sum > m_FULLCALO_0p6x0p6_BEST_E)
618  {
619  m_FULLCALO_0p6x0p6_BEST_E = this_sum;
620  m_FULLCALO_0p6x0p6_BEST_PHI = this_phi;
621  m_FULLCALO_0p6x0p6_BEST_ETA = this_eta;
622  }
623  }
624  }
625 
626  if (Verbosity() > 0)
627  {
628  std::cout << "CaloTriggerSim::process_event: best FullCalo 0.6x0.6 window is at eta / phi = " << m_FULLCALO_0p6x0p6_BEST_ETA << " / " << m_FULLCALO_0p6x0p6_BEST_PHI << " and E = " << m_FULLCALO_0p6x0p6_BEST_E << std::endl;
629  }
630 
631  // reset fullcalo 0.8x0.8 map & best
632  fill(m_FULLCALO_0p8x0p8_MAP.begin(), m_FULLCALO_0p8x0p8_MAP.end(), vector<double>(m_FULLCALO_0p8x0p8_NPHI, 0));
633 
637 
638  // now reconstruct (sliding) 0.8x0.8 map from 0.2x0.2 map
639  for (int ieta = 0; ieta < m_FULLCALO_0p8x0p8_NETA; ieta++)
640  {
641  for (int iphi = 0; iphi < m_FULLCALO_0p8x0p8_NPHI; iphi++)
642  {
643  // for eta calculation, use position of corner tower and add 3.5
644  // tower widths
645  double this_eta = geomOH->get_etacenter(2 * ieta) + 3.5 * (geomOH->get_etacenter(1) - geomOH->get_etacenter(0));
646  // for phi calculation, use position of corner tower and add 3.5
647  // tower widths
648  double this_phi = geomOH->get_phicenter(2 * iphi) + 3.5 * (geomOH->get_phicenter(1) - geomOH->get_phicenter(0));
649 
650  double this_sum = 0;
651 
652  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][iphi];
653  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][iphi]; // ieta + 1 is safe, since m_FULLCALO_0p8x0p8_NETA = m_FULLCALO_0p2x0p2_NETA - 3
654  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][iphi]; // ieta + 2 is safe, since m_FULLCALO_0p8x0p8_NETA = m_FULLCALO_0p2x0p2_NETA - 3
655  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 3][iphi]; // ieta + 3 is safe, since m_FULLCALO_0p8x0p8_NETA = m_FULLCALO_0p2x0p2_NETA - 3
656 
657  // add 1 to phi, but take modulus w.r.t. m_FULLCALO_0p2x0p2_NPHI
658  // in case we have wrapped back around
659  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
660  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
661  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
662  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 3][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
663  // add 2 to phi, but take modulus w.r.t. m_FULLCALO_0p2x0p2_NPHI
664  // in case we have wrapped back around
665  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
666  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
667  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
668  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 3][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
669  // add 3 to phi, but take modulus w.r.t. m_FULLCALO_0p2x0p2_NPHI
670  // in case we have wrapped back around
671  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][(iphi + 3) % m_FULLCALO_0p2x0p2_NPHI];
672  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][(iphi + 3) % m_FULLCALO_0p2x0p2_NPHI];
673  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][(iphi + 3) % m_FULLCALO_0p2x0p2_NPHI];
674  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 3][(iphi + 3) % m_FULLCALO_0p2x0p2_NPHI];
675 
676  m_FULLCALO_0p8x0p8_MAP[ieta][iphi] = this_sum;
677 
678  if (Verbosity() > 1 && this_sum > 4)
679  {
680  std::cout << "CaloTriggerSim::process_event: FullCalo 0.8x0.8 tower eta ( bin ) / phi ( bin ) / E = " << std::setprecision(6) << this_eta << " ( " << ieta << " ) / " << this_phi << " ( " << iphi << " ) / " << this_sum << std::endl;
681  }
682 
683  if (this_sum > m_FULLCALO_0p8x0p8_BEST_E)
684  {
685  m_FULLCALO_0p8x0p8_BEST_E = this_sum;
686  m_FULLCALO_0p8x0p8_BEST_PHI = this_phi;
687  m_FULLCALO_0p8x0p8_BEST_ETA = this_eta;
688  }
689  }
690  }
691 
692  if (Verbosity() > 0)
693  {
694  std::cout << "CaloTriggerSim::process_event: best FullCalo 0.8x0.8 window is at eta / phi = " << m_FULLCALO_0p8x0p8_BEST_ETA << " / " << m_FULLCALO_0p8x0p8_BEST_PHI << " and E = " << m_FULLCALO_0p8x0p8_BEST_E << std::endl;
695  }
696 
697  // reset fullcalo 1.0x1.0 map & best
698  fill(m_FULLCALO_1p0x1p0_MAP.begin(), m_FULLCALO_1p0x1p0_MAP.end(), vector<double>(m_FULLCALO_1p0x1p0_NPHI, 0));
699 
703 
704  // now reconstruct (sliding) 1.0x1.0 map from 0.2x0.2 map
705  for (int ieta = 0; ieta < m_FULLCALO_1p0x1p0_NETA; ieta++)
706  {
707  for (int iphi = 0; iphi < m_FULLCALO_1p0x1p0_NPHI; iphi++)
708  {
709  // for eta calculation, use position of corner tower and add 4.5
710  // tower widths
711  double this_eta = geomOH->get_etacenter(2 * ieta) + 4.5 * (geomOH->get_etacenter(1) - geomOH->get_etacenter(0));
712  // for phi calculation, use position of corner tower and add 4.5
713  // tower widths
714  double this_phi = geomOH->get_phicenter(2 * iphi) + 4.5 * (geomOH->get_phicenter(1) - geomOH->get_phicenter(0));
715 
716  double this_sum = 0;
717 
718  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][iphi];
719  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][iphi]; // ieta + 1 is safe, since m_FULLCALO_1p0x1p0_NETA = m_FULLCALO_0p2x0p2_NETA - 4
720  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][iphi]; // ieta + 2 is safe, since m_FULLCALO_1p0x1p0_NETA = m_FULLCALO_0p2x0p2_NETA - 4
721  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 3][iphi]; // ieta + 3 is safe, since m_FULLCALO_1p0x1p0_NETA = m_FULLCALO_0p2x0p2_NETA - 4
722  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 4][iphi]; // ieta + 4 is safe, since m_FULLCALO_1p0x1p0_NETA = m_FULLCALO_0p2x0p2_NETA - 4
723 
724  // add 1 to phi, but take modulus w.r.t. m_FULLCALO_0p2x0p2_NPHI
725  // in case we have wrapped back around
726  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
727  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
728  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
729  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 3][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
730  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 4][(iphi + 1) % m_FULLCALO_0p2x0p2_NPHI];
731  // add 2 to phi, but take modulus w.r.t. m_FULLCALO_0p2x0p2_NPHI
732  // in case we have wrapped back around
733  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
734  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
735  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
736  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 3][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
737  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 4][(iphi + 2) % m_FULLCALO_0p2x0p2_NPHI];
738  // add 3 to phi, but take modulus w.r.t. m_FULLCALO_0p2x0p2_NPHI
739  // in case we have wrapped back around
740  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][(iphi + 3) % m_FULLCALO_0p2x0p2_NPHI];
741  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][(iphi + 3) % m_FULLCALO_0p2x0p2_NPHI];
742  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][(iphi + 3) % m_FULLCALO_0p2x0p2_NPHI];
743  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 3][(iphi + 3) % m_FULLCALO_0p2x0p2_NPHI];
744  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 4][(iphi + 3) % m_FULLCALO_0p2x0p2_NPHI];
745  // add 4 to phi, but take modulus w.r.t. m_FULLCALO_0p2x0p2_NPHI
746  // in case we have wrapped back around
747  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta][(iphi + 4) % m_FULLCALO_0p2x0p2_NPHI];
748  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 1][(iphi + 4) % m_FULLCALO_0p2x0p2_NPHI];
749  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 2][(iphi + 4) % m_FULLCALO_0p2x0p2_NPHI];
750  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 3][(iphi + 4) % m_FULLCALO_0p2x0p2_NPHI];
751  this_sum += m_FULLCALO_0p2x0p2_MAP[ieta + 4][(iphi + 4) % m_FULLCALO_0p2x0p2_NPHI];
752 
753  m_FULLCALO_1p0x1p0_MAP[ieta][iphi] = this_sum;
754 
755  if (Verbosity() > 1 && this_sum > 5)
756  {
757  std::cout << "CaloTriggerSim::process_event: FullCalo 1.0x1.0 tower eta ( bin ) / phi ( bin ) / E = " << std::setprecision(6) << this_eta << " ( " << ieta << " ) / " << this_phi << " ( " << iphi << " ) / " << this_sum << std::endl;
758  }
759 
760  if (this_sum > m_FULLCALO_1p0x1p0_BEST_E)
761  {
762  m_FULLCALO_1p0x1p0_BEST_E = this_sum;
763  m_FULLCALO_1p0x1p0_BEST_PHI = this_phi;
764  m_FULLCALO_1p0x1p0_BEST_ETA = this_eta;
765  }
766  }
767  }
768 
769  if (Verbosity() > 0)
770  {
771  std::cout << "CaloTriggerSim::process_event: best FullCalo 1.0x1.0 window is at eta / phi = " << m_FULLCALO_1p0x1p0_BEST_ETA << " / " << m_FULLCALO_1p0x1p0_BEST_PHI << " and E = " << m_FULLCALO_1p0x1p0_BEST_E << std::endl;
772  }
773 
774  FillNode(topNode);
775 
776  if (Verbosity() > 0) std::cout << "CaloTriggerSim::process_event: exiting" << std::endl;
777 
779 }
780 
782 {
783  PHNodeIterator iter(topNode);
784 
785  // Looking for the DST node
786  PHCompositeNode *dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST"));
787  if (!dstNode)
788  {
789  std::cout << PHWHERE << "DST Node missing, doing nothing." << std::endl;
791  }
792 
793  // store the trigger stuff under a sub-node directory
794  PHCompositeNode *trigNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "TRIG"));
795  if (!trigNode)
796  {
797  trigNode = new PHCompositeNode("TRIG");
798  dstNode->addNode(trigNode);
799  }
800 
801  // create the CaloTriggerInfo
802  CaloTriggerInfo *triggerinfo = findNode::getClass<CaloTriggerInfo>(topNode, !m_EmulateTruncationFlag ? "CaloTriggerInfo" : "CaloTriggerInfo_Truncate");
803  if (!triggerinfo)
804  {
805  triggerinfo = new CaloTriggerInfov1();
806  PHIODataNode<PHObject> *TriggerNode = new PHIODataNode<PHObject>(triggerinfo, !m_EmulateTruncationFlag ? "CaloTriggerInfo" : "CaloTriggerInfo_Truncate", "PHObject");
807  trigNode->addNode(TriggerNode);
808  }
809  else
810  {
811  std::cout << PHWHERE << "::ERROR - CaloTriggerInfo pre-exists, but should not" << std::endl;
812  exit(-1);
813  }
814 
816 }
817 
819 {
820  CaloTriggerInfo *triggerinfo = findNode::getClass<CaloTriggerInfo>(topNode, !m_EmulateTruncationFlag ? "CaloTriggerInfo" : "CaloTriggerInfo_Truncate");
821  if (!triggerinfo)
822  {
823  std::cout << " ERROR -- can't find CaloTriggerInfo node after it should have been created" << std::endl;
824  return;
825  }
826  else
827  {
831 
835 
839 
843 
847 
851 
855 
859  }
860 
861  return;
862 }