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/RawTowerv1.h>
10 #include <calobase/RawTowerv2.h>
16 #include <phparameter/PHParameters.h>
26 #include <gsl/gsl_cdf.h>
27 #include <gsl/gsl_randist.h>
28 #include <gsl/gsl_rng.h>
43 , m_DigiAlgorithm(kNo_digitization)
44 , m_SimTowers(nullptr)
45 , m_RawTowers(nullptr)
46 , m_RawTowerGeom(nullptr)
49 , m_SimTowerNodePrefix(
"SIM")
50 , m_RawTowerNodePrefix(
"RAW")
51 , m_PhotonElecYieldVisibleGeV(NAN)
52 , m_PhotonElecADC(NAN)
53 , m_PedstalCentralADC(NAN)
54 , m_PedstalWidthADC(NAN)
55 , m_pedestalFile(
false)
56 , m_ZeroSuppressionADC(-1000)
57 , m_ZeroSuppressionFile(
false)
59 , m_SiPMEffectivePixel(40000 * 4)
88 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
89 <<
"DST Node missing, doing nothing." << endl;
97 catch (std::exception &
e)
99 cout << e.what() << endl;
109 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
110 <<
"Process event entered. "
111 <<
"Digitalization method: ";
115 cout <<
"directly pass the energy of sim tower to digitalized tower";
119 cout <<
"simple digitization with photon statistics, ADC conversion and pedstal";
127 double deadChanEnergy = 0;
130 it != all_towers.second; ++
it)
134 const int eta =
it->second->get_bineta();
135 const int phi =
it->second->get_binphi();
139 const int l =
it->second->get_binl();
168 const string pedCentralName =
"PedCentral_ADC_eta" +
to_string(eta) +
"_phi" +
to_string(phi);
171 const string pedWidthName =
"PedWidth_ADC_eta" +
to_string(eta) +
"_phi" +
to_string(phi);
193 if (sim_tower) deadChanEnergy += sim_tower->
get_energy();
199 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
200 <<
" apply dead tower " << key << endl;
227 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
240 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
250 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
252 <<
", dead channel masked energy = " << deadChanEnergy <<
" GeV"
274 const int sum_ADC = signal_ADC + (
int) pedstal;
292 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
302 cout <<
"None" << endl;
304 cout <<
"output based on "
305 <<
"sum_ADC = " << sum_ADC <<
", zero_sup = "
313 cout <<
"None" << endl;
337 const double prob_activated_per_pixel = gsl_cdf_poisson_Q(0, poission_param_per_pixel);
343 const int sum_ADC = signal_ADC + (
int) pedstal;
361 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
371 cout <<
"None" << endl;
373 cout <<
"output based on "
374 <<
"sum_ADC = " << sum_ADC <<
", zero_sup = "
382 cout <<
"None" << endl;
395 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
396 <<
"Run Node missing, doing nothing." << endl;
397 throw std::runtime_error(
398 "Failed to find Run node in RawTowerDigitizer::CreateNodes");
401 string TowerGeomNodeName =
"TOWERGEOM_" +
m_Detector;
402 m_RawTowerGeom = findNode::getClass<RawTowerGeomContainer>(topNode, TowerGeomNodeName);
405 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
406 <<
" " << TowerGeomNodeName <<
" Node missing, doing bail out!"
408 throw std::runtime_error(
"Failed to find " + TowerGeomNodeName +
" node in RawTowerDigitizer::CreateNodes");
416 const string deadMapName =
"DEADMAP_" +
m_Detector;
417 m_DeadMap = findNode::getClass<RawTowerDeadMap>(topNode, deadMapName);
420 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
421 <<
" use dead map: ";
428 cout <<
Name() <<
"::" <<
m_Detector <<
"::" << __PRETTY_FUNCTION__
429 <<
"DST Node missing, doing nothing." << endl;
430 throw std::runtime_error(
"Failed to find DST node in RawTowerDigitizer::CreateNodes");
434 m_SimTowers = findNode::getClass<RawTowerContainer>(dstNode, SimTowerNodeName);
437 cout <<
Name() <<
"::" << m_Detector <<
"::" << __PRETTY_FUNCTION__
438 <<
" " << SimTowerNodeName <<
" Node missing, doing bail out!"
440 throw std::runtime_error(
"Failed to find " + SimTowerNodeName +
" node in RawTowerDigitizer::CreateNodes");
449 dstNode->addNode(DetNode);
454 m_RawTowers = findNode::getClass<RawTowerContainer>(DetNode, RawTowerNodeName);
459 RawTowerNodeName,
"PHObject");
460 DetNode->addNode(towerNode);