11 #include "evt/Head.hh"
50 int main(
int argc,
char **argv)
55 JMultipleFileScanner<Evt> inputFile;
59 JPMTParametersMap pmtParameters;
65 JParser<> zap(
"Example program to test hit coincidence building with Monte Carlo events.");
69 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
77 catch(
const exception &error) {
78 FATAL(error.what() << endl);
90 load(detectorFile, detector);
92 catch(
const JException& error) {
96 JDetectorSimulator simbad(detector);
98 simbad.reset(
new JPMTDefaultSimulator(pmtParameters, detector));
99 simbad.reset(
new JCLBDefaultSimulator());
104 TProfile hn(
"hn", NULL, 31, 0.5, +31.5);
105 TProfile hc(
"hc", NULL, 21, -1.05, +1.05);
106 TProfile ht(
"ht", NULL, 20, 0.5, +20.5);
109 const JModuleRouter moduleRouter(detector);
111 typedef double hit_type;
113 typedef JSuperFrame2D<hit_type> JSuperFrame2D_t;
114 typedef JBuildL1 <hit_type> JBuildL1_t;
117 const JBuildL1_t buildL1(JBuildL1Parameters((hit_type) Tmax_ns,
true));
118 JSuperFrame2D_t buffer;
121 for (JMultipleFileScanner<Evt>& in = inputFile; in.hasNext(); ) {
123 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
125 Evt*
event = in.next();
127 const int frame_index = 1;
135 for (JDAQTimeslice::const_iterator super_frame = timeslice.begin(); super_frame != timeslice.end(); ++super_frame) {
137 if (moduleRouter.hasModule(super_frame->getModuleID())) {
141 const JModule& module = detector.getModule(moduleRouter.getAddress(super_frame->getModuleID()));
143 buffer(*super_frame, module);
147 buildL1(buffer, back_inserter(dataL1));
149 if (!dataL1.empty()) {
151 JBuildL2<hit_type> buildL2(JL2Parameters(1, Tmax_ns, -1.0));
153 JFrameL1_t d1(dataL1);
156 for (
int i = 1; i <= hn.GetNbinsX(); ++i) {
158 buildL2.numberOfHits = (int) hn.GetBinCenter(i);
162 buildL2(buffer, d1, back_inserter(d2));
164 hn.Fill((
double) buildL2.numberOfHits, (
double) d2.size() / (double) dataL1.size());
171 if (!dataL1.empty()) {
173 JBuildL2<hit_type> buildL2(JL2Parameters(2, Tmax_ns, -1.0));
175 JFrameL1_t d1(dataL1);
178 for (
int i = 1; i <= hc.GetNbinsX(); ++i) {
180 buildL2.ctMin = hc.GetBinCenter(i);
184 buildL2(buffer, d1, back_inserter(d2));
186 hc.Fill(buildL2.ctMin, (
double) d2.size() / (double) dataL1.size());
193 if (!dataL1.empty()) {
195 JBuildL2<hit_type> buildL2(JL2Parameters(2, 0.0, -1.0));
197 JFrameL1_t d1(dataL1);
200 for (
int i = ht.GetNbinsX(); i != 0; --i) {
202 buildL2.TMaxLocal_ns = ht.GetBinCenter(i);
206 buildL2(buffer, d1, back_inserter(d2));
208 ht.Fill(buildL2.TMaxLocal_ns, (
double) d2.size() / (double) dataL1.size());