24 #include <calobase/TowerInfoContainer.h>
25 #include <calobase/TowerInfoContainerv3.h>
44 Double_t
v1 = par[0] *
h_template->Interpolate(x[0] - par[1]) + par[2];
64 const char *calibroot = getenv(
"CALIBRATIONROOT");
67 std::cout<<
"CaloWaveformSim::Init missing CALIBRATIONROOT" << std::endl;
73 TFile *ft =
new TFile(templatefilename.c_str());
76 h_template = (TProfile *) ft->Get(
"hpwaveform");
81 EventHeader *evtHeader = findNode::getClass<EventHeader>(topNode,
"EventHeader");
93 std::cout <<
"CaloWaveformSim::Init(PHCompositeNode *topNode) Run Number: " <<
m_runNumber << std::endl;
94 std::cout <<
"CaloWaveformSim getting calibration" << std::endl;
113 if (!calibdir.empty())
119 std::cout <<
"CaloWaveformSim::::InitRun No calibration file for domain " <<
m_calibName <<
" found" << std::endl;
140 if (!calibdir.empty())
146 std::cout <<
"CaloWaveformSim::::InitRun No calibration file for domain " <<
m_calibName <<
" found" << std::endl;
167 if (!calibdir.empty())
173 std::cout <<
"CaloWaveformSim:::InitRun No calibration file for domain " <<
m_calibName <<
" found" << std::endl;
192 std::cout <<
"CaloWaveformSim::process_event(PHCompositeNode *topNode) Processing Event" << std::endl;
200 std::cout <<
PHWHERE <<
" CYLINDERGEOM_CEMC Node missing, doing nothing." << std::endl;
213 std::cout <<
PHWHERE <<
" CYLINDERCELLGEOM_CEMC Node missing, doing nothing." << std::endl;
224 for (
auto &sample : waveform)
230 TF1 *f_fit =
new TF1(
231 "f_fit", [
this](
double *
x,
double *par)
234 f_fit->SetParameter(0, 1.0);
237 float _shiftval =
m_peakpos + shift_of_shift - f_fit->GetMaximumX();
238 f_fit->SetParameters(1, _shiftval, 0);
242 PHG4HitContainer *hits = findNode::getClass<PHG4HitContainer>(topNode, nodename);
245 std::cout <<
PHWHERE <<
" " << nodename <<
" Node missing, doing nothing." << std::endl;
253 PHG4Hit *hit = hititer->second;
262 unsigned short etabin = 0;
263 unsigned short phibin = 0;
264 float correction = 1.;
271 float ADC = (calibconst != 0) ? e_dep / calibconst : 0.;
276 f_fit->SetParameters(ADC, _shiftval + t0, 0.);
279 m_waveforms.at(tower_index).at(
i) += f_fit->Eval(
i);
292 std::cout <<
PHWHERE <<
" " << ped_nodename <<
" Node missing, doing nothing." << std::endl;
329 const int &tower_ID_z = tower_z_phi_ID.first;
330 const int &tower_ID_phi = tower_z_phi_ID.second;
331 PHG4CylinderGeom_Spacalv3::tower_map_t::const_iterator it_tower =
336 const int sub_tower_ID_x = it_tower->second.get_sub_tower_ID_x(decoder.
fiber_ID);
337 const int sub_tower_ID_y = it_tower->second.get_sub_tower_ID_y(decoder.
fiber_ID);
340 etabin = etabinshort;
341 phibin = phibin_cell;
347 assert(not std::isnan(z));
353 const double x = it_tower->second.get_position_fraction_x_in_sub_tower(decoder.
fiber_ID);
354 const double y = it_tower->second.get_position_fraction_y_in_sub_tower(decoder.
fiber_ID);
378 std::cout <<
PHWHERE <<
" Invalid detector type " <<
m_dettype << std::endl;
387 std::cout <<
"CaloWaveformSim::End(PHCompositeNode *topNode) This is the End..." << std::endl;
398 std::cout <<
"PHComposite node created: DST" << std::endl;
410 DetectorEnum = TowerInfoContainer::DETECTOR::EMCAL;
411 DetectorNodeName =
"CEMC";
415 DetectorEnum = TowerInfoContainer::DETECTOR::HCAL;
416 DetectorNodeName =
"HCALIN";
420 DetectorEnum = TowerInfoContainer::DETECTOR::HCAL;
421 DetectorNodeName =
"HCALOUT";
425 std::cout <<
PHWHERE <<
" Invalid detector type " <<
m_dettype << std::endl;
438 DetNode->
addNode(newTowerNode);