22 #include "StMcEventTypes.hh"
23 #include "StEventTypes.h"
24 #include "StFmsDbMaker/StFmsDbMaker.h"
25 #include "StFmsSimulatorMaker.h"
29 int StFmsSimulatorMaker::getDetectorId(
int ew,
int nstb)
const
70 const int MAX_ADC = 4095;
71 const int ew = hit->module();
72 const int nstb = hit->sub();
73 const int channel = hit->eta();
74 int detectorId = getDetectorId(ew,nstb);
75 int qtCrate, qtSlot, qtChannel;
76 mFmsDbMaker->getMap(detectorId,channel,&qtCrate,&qtSlot,&qtChannel);
77 float gain = mFmsDbMaker->getGain(detectorId,channel);
79 int adc = int(hit->dE()/(gain*gainCorrection)+0.5);
81 if (adc > MAX_ADC) adc = MAX_ADC;
83 float energy = adc*gain*gainCorrection;
84 return new StFmsHit(detectorId,channel,qtCrate,qtSlot,qtChannel,adc,tdc,energy);
92 LOG_ERROR <<
"No StMcEvent" << endm;
97 if (!mcEvent->fpdHitCollection())
return kStOk;
107 if (!event->fmsCollection()) event->setFmsCollection(
new StFmsCollection);
109 mFmsDbMaker =
static_cast<StFmsDbMaker*
>(GetMaker(
"fmsDb"));
111 LOG_ERROR <<
"No StFmsDbMaker" << endm;
116 fillStEvent(mcEvent,event);
117 printStEventSummary(event);
122 void StFmsSimulatorMaker::fillStEvent(
const StMcEvent* mcEvent,
StEvent* event)
124 for (
size_t m = 1; m <= mcEvent->fpdHitCollection()->numberOfModules(); ++m) {
127 for (
size_t i = 0; i < module->detectorHits().size(); ++i)
128 event->fmsCollection()->addHit(makeFmsHit(module->detectorHits()[i]));
132 void StFmsSimulatorMaker::printStEventSummary(
const StEvent* event)
135 const int NDETECTORS = 14;
136 const char* detectorNames[NDETECTORS] = {
"FPD-North ",
"FPD-South",
"FPD-North-Pres",
"FPD-South-Pres",
"FPD-North-SMDV",
"FPD-South-SMDV",
"FPD-North-SMDH",
"FPD-South-SMDH",
"FMS-North-Large",
"FMS-South-Large",
"FMS-North-Small",
"FMS-South-Small",
"FHC-North",
"FHC-South" };
137 int nhits[NDETECTORS];
138 float detectorEnergy[NDETECTORS];
141 fill(nhits,nhits+NDETECTORS,0);
142 fill(detectorEnergy,detectorEnergy+NDETECTORS,0.);
145 const StSPtrVecFmsHit& hits =
event->fmsCollection()->hits();
146 for (
size_t i = 0; i < hits.size(); ++i) {
148 if (Debug()) hit->print();
149 ++nhits[hit->detectorId()];
150 detectorEnergy[hit->detectorId()] += hit->energy();
154 LOG_INFO <<
"ID\tNAME\t\tNHITS\tENERGY" << endm;
155 for (
int detectorId = 0; detectorId < NDETECTORS; ++detectorId) {
156 LOG_INFO << detectorId <<
'\t' << detectorNames[detectorId] <<
'\t' << nhits[detectorId] <<
'\t' << detectorEnergy[detectorId] << endm;
Float_t getGainCorrection(Int_t detectorId, Int_t ch) const
get the gain for the channel
virtual void AddData(TDataSet *data, const char *dir=".data")
User methods.
Event data structure to hold all information from a Monte Carlo simulation. This class is the interfa...