7 #include <calobase/RawTowerDefs.h>
8 #include <calobase/RawTowerGeom.h>
9 #include <calobase/RawTowerGeomContainer.h>
10 #include <calobase/TowerInfo.h>
11 #include <calobase/TowerInfoContainer.h>
42 int counts = std::floor(rawE / (45.0 / 256));
44 return counts * (45.0 / 256);
55 std::cout <<
"CaloTriggerSim::process_event: entering" << std::endl;
60 TowerInfoContainer *towersEM3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_CEMC");
61 TowerInfoContainer *towersIH3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALIN");
62 TowerInfoContainer *towersOH3 = findNode::getClass<TowerInfoContainer>(topNode,
"TOWERINFO_CALIB_HCALOUT");
66 std::cout <<
"CaloTriggerSim::process_event: " << towersEM3->
size() <<
" TOWERINFO_CALIB_CEMC towers" << std::endl;
67 std::cout <<
"CaloTriggerSim::process_event: " << towersIH3->size() <<
" TOWERINFO_CALIB_HCALIN towers" << std::endl;
68 std::cout <<
"CaloTriggerSim::process_event: " << towersOH3->size() <<
" TOWERINFO_CALIB_HCALOUT towers" << std::endl;
72 RawTowerGeomContainer *geomIH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALIN");
73 RawTowerGeomContainer *geomOH = findNode::getClass<RawTowerGeomContainer>(topNode,
"TOWERGEOM_HCALOUT");
103 std::cout <<
"CaloTriggerSim::process_event: setting number of window in eta / phi,";
114 unsigned int ntowers_EM = towersEM3->
size();
130 std::cout <<
"CaloTriggerSim::process_event: EMCal 1x1 tower eta bin / phi bin / E = " << std::setprecision(6) << this_etabin <<
" / " << this_phibin <<
" / " << this_E << std::endl;
142 for (std::vector<double>::size_type ieta = 0; ieta <
m_EMCAL_2x2_NETA; ieta++)
144 for (std::vector<double>::size_type iphi = 0; iphi <
m_EMCAL_2x2_NPHI; iphi++)
167 this_phi -= 2 * M_PI;
169 if (this_phi < -M_PI)
171 this_phi += 2 * M_PI;
176 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;
200 int emcal_4x4_best_iphi = -1;
201 int emcal_4x4_best_ieta = -1;
217 this_phi -= 2 * M_PI;
219 if (this_phi < -M_PI)
221 this_phi += 2 * M_PI;
229 if (iphi != m_EMCAL_4x4_NPHI - 1)
246 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;
255 emcal_4x4_best_iphi = iphi;
256 emcal_4x4_best_ieta = ieta;
270 int deta = ieta - emcal_4x4_best_ieta;
271 int dphi = (iphi - emcal_4x4_best_iphi) % m_EMCAL_4x4_NPHI;
273 if (abs(deta) < 1.5 && abs(dphi) < 1.5)
283 this_phi -= 2 * M_PI;
285 if (this_phi < -M_PI)
287 this_phi += 2 * M_PI;
310 int geomOH_etabins = geomOH->get_etabins();
311 int geomOH_phibins = geomOH->get_phibins();
359 std::cout <<
"CaloTriggerSim::process_event: setting number of full calo window in eta / phi:" << std::endl;
385 this_phi += 2 * M_PI;
389 this_phi -= 2 * M_PI;
394 int this_etabin = geomOH->get_etabin(this_eta);
395 int this_phibin = geomOH->get_phibin(this_phi);
402 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;
408 unsigned int ntowers_IH = towersIH3->size();
412 unsigned int towerkey = towersIH3->encode_key(
channel);
413 int ieta = towersIH3->getTowerEtaBin(towerkey);
414 int iphi = towersIH3->getTowerPhiBin(towerkey);
416 float this_phi = geomIH->get_tower_geometry(key)->get_phi();
417 float this_eta = geomIH->get_tower_geometry(key)->get_eta();
421 this_phi += 2 * M_PI;
425 this_phi -= 2 * M_PI;
430 int this_etabin = geomOH->get_etabin(this_eta);
431 int this_phibin = geomOH->get_phibin(this_phi);
438 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;
444 unsigned int ntowers_OH = towersOH3->size();
448 unsigned int towerkey = towersOH3->encode_key(
channel);
449 int ieta = towersOH3->getTowerEtaBin(towerkey);
450 int iphi = towersOH3->getTowerPhiBin(towerkey);
452 float this_phi = geomIH->get_tower_geometry(key)->get_phi();
453 float this_eta = geomIH->get_tower_geometry(key)->get_eta();
457 this_phi += 2 * M_PI;
461 this_phi -= 2 * M_PI;
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;
778 std::cout <<
"CaloTriggerSim::process_event: exiting" << std::endl;
792 std::cout <<
PHWHERE <<
"DST Node missing, doing nothing." << std::endl;
810 trigNode->
addNode(TriggerNode);
814 std::cout <<
PHWHERE <<
"::ERROR - CaloTriggerInfo pre-exists, but should not" << std::endl;
826 std::cout <<
" ERROR -- can't find CaloTriggerInfo node after it should have been created" << std::endl;