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>
38 , m_EmulateTruncationFlag(0)
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)
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)
94 int counts = std::floor(rawE / (45.0 / 256));
96 return counts * (45.0 / 256);
106 std::cout <<
"CaloTriggerSim::process_event: entering" << std::endl;
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");
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;
120 RawTowerGeomContainer *geomIH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALIN");
121 RawTowerGeomContainer *geomOH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALOUT");
151 std::cout <<
"CaloTriggerSim::process_event: setting number of window in eta / phi,";
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);
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;
213 if (this_phi >
M_PI) this_phi -= 2 *
M_PI;
214 if (this_phi < -
M_PI) this_phi += 2 *
M_PI;
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;
242 int emcal_4x4_best_iphi = -1;
243 int emcal_4x4_best_ieta = -1;
257 if (this_phi >
M_PI) this_phi -= 2 *
M_PI;
258 if (this_phi < -
M_PI) this_phi += 2 *
M_PI;
265 if (iphi != m_EMCAL_4x4_NPHI - 1)
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;
291 emcal_4x4_best_iphi = iphi;
292 emcal_4x4_best_ieta = ieta;
306 int deta = ieta - emcal_4x4_best_ieta;
307 int dphi = (iphi - emcal_4x4_best_iphi) % m_EMCAL_4x4_NPHI;
309 if (
abs(deta) < 1.5 &&
abs(dphi) < 1.5)
315 if (this_phi >
M_PI) this_phi -= 2 *
M_PI;
316 if (this_phi < -
M_PI) this_phi += 2 *
M_PI;
338 int geomOH_etabins = geomOH->get_etabins();
339 int geomOH_phibins = geomOH->get_phibins();
387 std::cout <<
"CaloTriggerSim::process_event: setting number of full calo window in eta / phi:" << std::endl;
407 double this_eta = tower_geom->
get_eta();
408 double this_phi = tower_geom->
get_phi();
414 int this_etabin = geomOH->get_etabin(this_eta);
415 int this_phibin = geomOH->get_phibin(this_phi);
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;
433 double this_eta = tower_geom->
get_eta();
434 double this_phi = tower_geom->
get_phi();
440 int this_etabin = geomOH->get_etabin(this_eta);
441 int this_phibin = geomOH->get_phibin(this_phi);
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;
459 double this_eta = tower_geom->
get_eta();
460 double this_phi = tower_geom->
get_phi();
466 int this_etabin = geomOH->get_etabin(this_eta);
467 int this_phibin = geomOH->get_phibin(this_phi);
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;
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));
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;
538 double this_eta = geomOH->get_etacenter(2 * ieta) + 1.5 * (geomOH->get_etacenter(1) - geomOH->get_etacenter(0));
541 double this_phi = geomOH->get_phicenter(2 * iphi) + 1.5 * (geomOH->get_phicenter(1) - geomOH->get_phicenter(0));
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;
588 double this_eta = geomOH->get_etacenter(2 * ieta) + 2.5 * (geomOH->get_etacenter(1) - geomOH->get_etacenter(0));
591 double this_phi = geomOH->get_phicenter(2 * iphi) + 2.5 * (geomOH->get_phicenter(1) - geomOH->get_phicenter(0));
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;
645 double this_eta = geomOH->get_etacenter(2 * ieta) + 3.5 * (geomOH->get_etacenter(1) - geomOH->get_etacenter(0));
648 double this_phi = geomOH->get_phicenter(2 * iphi) + 3.5 * (geomOH->get_phicenter(1) - geomOH->get_phicenter(0));
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;
711 double this_eta = geomOH->get_etacenter(2 * ieta) + 4.5 * (geomOH->get_etacenter(1) - geomOH->get_etacenter(0));
714 double this_phi = geomOH->get_phicenter(2 * iphi) + 4.5 * (geomOH->get_phicenter(1) - geomOH->get_phicenter(0));
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;
776 if (
Verbosity() > 0) std::cout <<
"CaloTriggerSim::process_event: exiting" << std::endl;
789 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
807 trigNode->
addNode(TriggerNode);
811 std::cout <<
PHWHERE <<
"::ERROR - CaloTriggerInfo pre-exists, but should not" << std::endl;
823 std::cout <<
" ERROR -- can't find CaloTriggerInfo node after it should have been created" << std::endl;