9 #include <ecl/modules/eclHitDebug/ECLHitDebugModule.h>
15 #include <framework/gearbox/Unit.h>
18 #include <ecl/dataobjects/ECLSimHit.h>
19 #include <ecl/dataobjects/ECLDebugHit.h>
20 #include <ecl/geometry/ECLGeometryPar.h>
38 setDescription(
"ECLHitDebugModule");
39 setPropertyFlags(c_ParallelProcessingCertified);
43 ECLHitDebugModule::~ECLHitDebugModule()
47 void ECLHitDebugModule::initialize()
54 m_timeCPU = clock() * Unit::us;
55 m_eclDebugHits.registerInDataStore();
58 void ECLHitDebugModule::beginRun()
62 void ECLHitDebugModule::event()
69 int const interval = 8000 / Nbin;
70 static float E_cell[8736][Nbin];
71 static float Tof_ave[8736][Nbin];
72 memset(E_cell, 0,
sizeof(
float) * 8736 * Nbin);
73 memset(Tof_ave, 0,
sizeof(
float) * 8736 * Nbin);
78 for (
int iHits = 0; iHits < m_eclSimArray.getEntries(); iHits++) {
80 ECLSimHit* aECLSimHit = m_eclSimArray[iHits];
83 int hitCellId = aECLSimHit->
getCellId() - 1;
86 G4ThreeVector t = aECLSimHit->
getPosIn();
87 TVector3 HitInPos(t.x(), t.y(), t.z());
91 double local_pos = (15. - (HitInPos - PosCell) * VecCell);
93 int iECLCell = hitCellId;
95 int TimeIndex = (int) hitTOF / interval;
96 E_cell[iECLCell][TimeIndex] = E_cell[iECLCell][TimeIndex] + hitE;
97 Tof_ave[iECLCell][TimeIndex] += (6.05 + 0.0749 * local_pos - 0.00112 * local_pos * local_pos + hitTOF) * hitE ;
103 for (
int iECLCell = 0; iECLCell < 8736; iECLCell++) {
104 for (
int TimeIndex = 0; TimeIndex < Nbin; TimeIndex++) {
106 if (E_cell[iECLCell][TimeIndex] > 0) {
107 m_eclDebugHits.appendNew();
108 m_hitNum = m_eclDebugHits.getEntries() - 1;
109 m_eclDebugHits[m_hitNum]->setCellId(iECLCell + 1);
110 m_eclDebugHits[m_hitNum]->setEnergyDep(E_cell[iECLCell][TimeIndex]);
111 m_eclDebugHits[m_hitNum]->setTimeAve(Tof_ave[iECLCell][TimeIndex] / E_cell[iECLCell][TimeIndex]);
120 void ECLHitDebugModule::endRun()
125 void ECLHitDebugModule::terminate()
Class to represent the hit of one cell.
ClassECLSimHit - Geant4 simulated hit for the ECL.
int getCellId() const
Get Cell ID.
double getFlightTime() const
Get Flight time from IP.
double getEnergyDep() const
Get Deposit energy.
G4ThreeVector getPosIn() const
Get Position.
The Class for ECL Geometry Parameters.
TVector3 GetCrystalVec(int cid)
The direction of crystal.
TVector3 GetCrystalPos(int cid)
The Position of crystal.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.