10 #include <top/modules/TOPChannelT0MC/TOPChannelT0MCModule.h>
13 #include <framework/datastore/StoreArray.h>
16 #include <framework/database/DBStore.h>
42 std::vector<double> frange = {100, 0., 1.};
44 setDescription(
"TOP channel T0 Calibration of MC extraction");
46 addParam(
"outputFile", m_outputFile,
"Output root file name",
48 addParam(
"fitRange", m_fitRange,
"fit range[nbins, xmin, xmax]", frange);
52 TOPChannelT0MCModule::~TOPChannelT0MCModule()
56 void TOPChannelT0MCModule::initialize()
59 m_digits.isRequired();
63 void TOPChannelT0MCModule::beginRun()
67 void TOPChannelT0MCModule::event()
70 for (
auto& digit : m_digits) {
71 unsigned channel = digit.getChannel();
72 if (channel < c_NumChannels) {
73 auto histo = m_histo[channel];
76 ss <<
"chan" << channel ;
79 string title =
"Times " + name;
80 histo =
new TH1F(name.c_str(), title.c_str(), (
int)m_fitRange[0], m_fitRange[1], m_fitRange[2]);
81 m_histo[channel] = histo;
83 if (digit.getTime() < m_fitRange[1] || digit.getTime() > m_fitRange[2])
continue;
84 histo->Fill(digit.getTime());
89 void TOPChannelT0MCModule::endRun()
93 void TOPChannelT0MCModule::terminate()
95 auto file =
new TFile(m_outputFile.c_str(),
"RECREATE");
96 auto otree =
new TTree(
"t0MC",
"extract channel t0 info. from MC");
101 otree->Branch(
"maxpos", &maxpos,
"maxpos/D");
102 otree->Branch(
"channel", &channel,
"channel/I");
104 for (
int i = 0; i < c_NumChannels; i++) {
106 maxpos = m_histo[i]->GetXaxis()->GetBinCenter(m_histo[i]->GetMaximumBin());
TOP Channel T0 MC Extraction module (under development)
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.