11 #include <ecl/modules/eclHitDebug/ECLHitDebugModule.h>
17 #include <framework/gearbox/Unit.h>
20 #include <ecl/dataobjects/ECLSimHit.h>
21 #include <ecl/dataobjects/ECLDebugHit.h>
22 #include <ecl/geometry/ECLGeometryPar.h>
40 setDescription(
"ECLHitDebugModule");
41 setPropertyFlags(c_ParallelProcessingCertified);
45 ECLHitDebugModule::~ECLHitDebugModule()
49 void ECLHitDebugModule::initialize()
56 m_timeCPU = clock() * Unit::us;
57 m_eclDebugHits.registerInDataStore();
60 void ECLHitDebugModule::beginRun()
64 void ECLHitDebugModule::event()
71 int const interval = 8000 / Nbin;
72 static float E_cell[8736][Nbin];
73 static float Tof_ave[8736][Nbin];
74 memset(E_cell, 0,
sizeof(
float) * 8736 * Nbin);
75 memset(Tof_ave, 0,
sizeof(
float) * 8736 * Nbin);
80 for (
int iHits = 0; iHits < m_eclSimArray.getEntries(); iHits++) {
82 ECLSimHit* aECLSimHit = m_eclSimArray[iHits];
85 int hitCellId = aECLSimHit->
getCellId() - 1;
88 G4ThreeVector t = aECLSimHit->
getPosIn();
89 TVector3 HitInPos(t.x(), t.y(), t.z());
93 double local_pos = (15. - (HitInPos - PosCell) * VecCell);
95 int iECLCell = hitCellId;
96 if (hitCellId == iECLCell && hitTOF < 8000) {
97 int TimeIndex = (int) hitTOF / interval;
98 E_cell[iECLCell][TimeIndex] = E_cell[iECLCell][TimeIndex] + hitE;
99 Tof_ave[iECLCell][TimeIndex] += (6.05 + 0.0749 * local_pos - 0.00112 * local_pos * local_pos + hitTOF) * hitE ;
105 for (
int iECLCell = 0; iECLCell < 8736; iECLCell++) {
106 for (
int TimeIndex = 0; TimeIndex < Nbin; TimeIndex++) {
108 if (E_cell[iECLCell][TimeIndex] > 0) {
109 m_eclDebugHits.appendNew();
110 m_hitNum = m_eclDebugHits.getEntries() - 1;
111 m_eclDebugHits[m_hitNum]->setCellId(iECLCell + 1);
112 m_eclDebugHits[m_hitNum]->setEnergyDep(E_cell[iECLCell][TimeIndex]);
113 m_eclDebugHits[m_hitNum]->setTimeAve(Tof_ave[iECLCell][TimeIndex] / E_cell[iECLCell][TimeIndex]);
122 void ECLHitDebugModule::endRun()
127 void ECLHitDebugModule::terminate()