3 #include <calobase/RawTower.h>
4 #include <calobase/RawTowerContainer.h>
5 #include <calobase/RawTowerDeadMap.h>
6 #include <calobase/RawTowerDefs.h>
7 #include <calobase/RawTowerGeom.h>
8 #include <calobase/RawTowerGeomContainer.h>
9 #include <calobase/RawTowerv2.h>
11 #include <calobase/TowerInfoContainer.h>
12 #include <calobase/TowerInfoContainerv1.h>
13 #include <calobase/TowerInfo.h>
14 #include <calobase/TowerInfov1.h>
16 #include <phparameter/PHParameters.h>
38 #include <gsl/gsl_cdf.h>
39 #include <gsl/gsl_randist.h>
40 #include <gsl/gsl_rng.h>
82 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
83 <<
"DST Node missing, doing nothing." << std::endl;
91 catch (std::exception &
e)
93 std::cout << e.what() << std::endl;
104 std::cout <<
PHWHERE <<
" Could not get Hcal Calibration for domain HCALGAINSCORR" << std::endl;
116 std::cout <<
PHWHERE <<
" Could not get Cemc Calibration for domain CEMCGAINSCORR" << std::endl;
125 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
126 <<
"Calo Decal requested but Detector Name not HCALOUT/IN or CEMC"
140 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
141 <<
"Process event entered. "
142 <<
"Digitalization method: ";
146 std::cout <<
"directly pass the energy of sim tower to digitalized tower";
150 std::cout <<
"simple digitization with photon statistics, ADC conversion and pedstal";
152 std::cout << std::endl;
158 double deadChanEnergy = 0;
161 it != all_towers.second; ++
it)
165 const int eta =
it->second->get_bineta();
166 const int phi =
it->second->get_binphi();
170 const int l =
it->second->get_binl();
225 if (sim_tower) deadChanEnergy += sim_tower->
get_energy();
231 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
232 <<
" apply dead tower " << key << std::endl;
256 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
267 unsigned int etaphikey =
phi;
268 etaphikey = (etaphikey << 16U) + eta;
273 decal_fctr = 1.0 / decal_fctr;
281 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
292 unsigned int towerkey = (eta << 16U) + phi;
299 if (sim_tower) deadChanEnergy += sim_tower->
get_energy();
303 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
304 <<
" apply dead tower " << key << std::endl;
328 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
339 unsigned int etaphikey =
phi;
340 etaphikey = (etaphikey << 16U) + eta;
344 decal_fctr = 1.0 / decal_fctr;
347 digi_towerinfo->
set_energy(e_dec * decal_fctr);
366 delete digi_towerinfo;
374 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
376 <<
", dead channel masked energy = " << deadChanEnergy <<
" GeV"
400 const int sum_ADC = signal_ADC + (int) pedestal;
402 double sum_ADC_d = (
double) sum_ADC;
410 double signal_ADC_d = 1. * photon_count;
413 sum_ADC_d = signal_ADC_d +
pedestal;
432 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
435 std::cout <<
"input: ";
442 std::cout <<
"None" << std::endl;
444 std::cout <<
"output based on "
445 <<
"sum_ADC = " << sum_ADC <<
", zero_sup = "
453 std::cout <<
"None" << std::endl;
484 const int sum_ADC = signal_ADC + (int) pedestal;
486 double sum_ADC_d = (
double) sum_ADC;
494 double signal_ADC_d = 1. * photon_count;
497 sum_ADC_d = signal_ADC_d +
pedestal;
507 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
510 std::cout <<
"input: ";
517 std::cout <<
"None" << std::endl;
519 std::cout <<
"output based on "
520 <<
"sum_ADC = " << sum_ADC <<
", zero_sup = "
528 std::cout <<
"None" << std::endl;
553 const double prob_activated_per_pixel = gsl_cdf_poisson_Q(0, poission_param_per_pixel);
559 const int sum_ADC = signal_ADC + (int) pedstal;
577 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
580 std::cout <<
"input: ";
587 std::cout <<
"None" << std::endl;
589 std::cout <<
"output based on "
590 <<
"sum_ADC = " << sum_ADC <<
", zero_sup = "
598 std::cout <<
"None" << std::endl;
626 const double prob_activated_per_pixel = gsl_cdf_poisson_Q(0, poission_param_per_pixel);
632 const int sum_ADC = signal_ADC + (int) pedstal;
650 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
653 std::cout <<
"input: ";
660 std::cout <<
"None" << std::endl;
662 std::cout <<
"output based on "
663 <<
"sum_ADC = " << sum_ADC <<
", zero_sup = "
671 std::cout <<
"None" << std::endl;
694 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
695 <<
"Run Node missing, doing nothing." << std::endl;
696 throw std::runtime_error(
"Failed to find Run node in RawTowerDigitizer::CreateNodes");
700 m_RawTowerGeom = findNode::getClass<RawTowerGeomContainer>(topNode, TowerGeomNodeName);
703 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
704 <<
" " << TowerGeomNodeName <<
" Node missing, doing bail out!"
706 throw std::runtime_error(
"Failed to find " + TowerGeomNodeName +
" node in RawTowerDigitizer::CreateNodes");
715 m_DeadMap = findNode::getClass<RawTowerDeadMap>(topNode, deadMapName);
718 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
719 <<
" use dead map: ";
726 std::cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
727 <<
"DST Node missing, doing nothing." << std::endl;
728 throw std::runtime_error(
"Failed to find DST node in RawTowerDigitizer::CreateNodes");
735 m_SimTowers = findNode::getClass<RawTowerContainer>(dstNode, SimTowerNodeName);
738 std::cout <<
Name() <<
"::" << m_Detector <<
"::" << __PRETTY_FUNCTION__
739 <<
" " << SimTowerNodeName <<
" Node missing, doing bail out!"
741 throw std::runtime_error(
"Failed to find " + SimTowerNodeName +
" node in RawTowerDigitizer::CreateNodes");
747 m_SimTowerInfos = findNode::getClass<TowerInfoContainer>(dstNode, SimTowerInfoNodeName);
750 std::cout <<
Name() <<
"::" << m_Detector <<
"::" << __PRETTY_FUNCTION__
751 <<
" " << SimTowerInfoNodeName <<
" Node missing, doing bail out!"
753 throw std::runtime_error(
"Failed to find " + SimTowerInfoNodeName +
" node in RawTowerDigitizer::CreateNodes");
778 m_RawTowers = findNode::getClass<RawTowerContainer>(DetNode, RawTowerNodeName);
783 RawTowerNodeName,
"PHObject");
784 DetNode->addNode(towerNode);
790 m_RawTowerInfos = findNode::getClass<TowerInfoContainer>(DetNode,TowerInfoNodeName);
794 if (m_Detector ==
"CEMC")
796 detec = TowerInfoContainer::DETECTOR::EMCAL;
798 else if (m_Detector ==
"HCALIN" || m_Detector ==
"HCALOUT")
800 detec = TowerInfoContainer::DETECTOR::HCAL;
804 std::cout <<
PHWHERE <<
"Detector not implemented into the TowerInfoContainer object, defaulting to HCal implementation." << std::endl;
805 detec = TowerInfoContainer::DETECTOR::HCAL;
809 DetNode->addNode(towerinfoNode);