9 #define TRGECLBGTCHit_SHORT_NAMES
12 #include <framework/logging/Logger.h>
15 #include "trg/ecl/modules/trgeclBGOverlay/TRGECLBGTCHitModule.h"
34 TRGECLBGTCHitModule::version()
const
36 return string(
"TRGECLBGTCHitModule 1.00");
41 TRGECLBGTCHitModule::TRGECLBGTCHitModule()
44 m_TCTimingCutLow(-1500),
45 m_TCTimingCutHigh(1500),
48 string desc =
"TRGECLBGTCHitModule(" +
version() +
")";
54 "TC energy cut: TC(E)<X (GeV), X=",
58 "TC Timing cut low: TC(T)>X (ns), X=",
62 "TC Timing cut high: TC(T)<X (ns), X=",
71 B2DEBUG(100,
"TRGECLBGTCHitModule ... created");
78 B2DEBUG(100,
"TRGECLBGTCHitModule ... destructed ");
86 B2DEBUG(100,
"TRGECLBGTCHitModule::initialize>");
88 B2INFO(
"[TRGECLBGTCHitModule] TCEnergyCut : TC(E) GeV = "
90 B2INFO(
"[TRGECLBGTCHitModule] TCTimingCutLow : TC(T) ns = "
92 B2INFO(
"[TRGECLBGTCHitModule] TCTimingCutHigh : TC(T) ns = "
93 << m_TCTimingCutHigh);
95 m_eclHits.registerInDataStore();
96 m_trgeclUnpackerStores.registerInDataStore();
97 m_trgeclBGTCHits.registerInDataStore();
105 B2DEBUG(200,
"TRGECLBGTCHitModule ... beginRun called ");
113 B2DEBUG(200,
"TRGECLBGTCHitMoudle ... event called");
115 if (m_eclHits.getEntries() > 0) {
117 }
else if (m_trgeclUnpackerStores.getEntries() > 0) {
127 B2DEBUG(200,
"TRGECLBGTCHitModule ... endRun called ");
135 B2DEBUG(100,
"TRGECLBGTCHitModule ... terminate called ");
144 struct hit_t {
double e, t; };
147 for (
const ECLHit& t : m_eclHits) {
148 double txtal = t.getTimeAve();
150 if (txtal >= 8000.0 || txtal < -8000.0)
continue;
151 double edep = t.getEnergyDep();
152 int TimeIndex = (txtal + 8000.0) * (1. / 100);
153 int cellId = t.getCellId() - 1;
156 int key = iTCIdm * 160 + TimeIndex;
158 double old_edep = h.e, old_txtal = h.t;
159 double new_edep = old_edep + edep;
161 h.t = (old_edep * old_txtal + edep * txtal) / new_edep;
164 for (pair<int, hit_t> t : a) {
166 int tcid = key / 160;
167 const hit_t& h = t.second;
169 if (h.e < m_TCEnergyCut) {
continue; }
171 if (h.t < m_TCTimingCutLow || h.t > m_TCTimingCutHigh) {
continue; }
173 m_trgeclBGTCHits.appendNew(tcid + 1, h.e, h.t);
181 TRGECLBGTCHitModule::genRandomTrgObj()
185 int tcID = ttt.getTCId();
187 double tcEnergyADC = (double) ttt.getTCEnergy();
189 double tcTime = (double) ttt.getTCTime();
190 if (tcID <= 0) {
continue;}
192 double adc2energy = 5.231;
194 double tcEnergy = tcEnergyADC * (adc2energy / 1000);
196 if (tcEnergy < m_TCEnergyCut) {
continue; }
198 if (tcTime < m_TCTimingCutLow || tcTime > m_TCTimingCutHigh) {
continue; }
200 m_trgeclBGTCHits.appendNew(tcID,
Class to store simulated hits which equate to average of ECLSImHit on crystals input for digitization...
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
int getTCIdFromXtalId(int)
get [TC ID] from [Xtal ID]
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
virtual void initialize() override
Initilizes TRGECLBGTCHitModule.
virtual void event() override
Called event by event.
virtual void endRun() override
Called when run ended.
virtual void terminate() override
Called when processing ended.
void genSimulationObj()
Parameters.
virtual void beginRun() override
Called when new run started.
virtual ~TRGECLBGTCHitModule()
Destructor.
std::string version(void) const
returns version of TRGECLBGTCHitModule.
Abstract base class for different kinds of events.