56 using namespace KM3NETDAQ;
58 JTriggeredFileScanner<> inputFile;
68 JParser<> zap(
"Example program to determine time slewing of L1 hits.");
73 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
80 catch(
const exception& error) {
81 FATAL(error.what() << endl);
91 load(detectorFile, detector);
93 catch(
const JException& error) {
97 const JModuleRouter router(detector);
99 detector -= get<JPosition3D>(
getHeader(inputFile));
107 const double xmin = -25.0;
108 const double xmax = +25.0;
114 os <<
"M[" << setfill(
'0') << setw(2) << i <<
"]";
116 H1D.push_back(
new TH1D(os.str().c_str(), NULL, nx, xmin, xmax));
123 JSuperFrame2D <JHit> buffer;
124 const JBuildL0<JHitL0> buildL0;
125 const JBuildL2<JHitL2> buildL2(2, Tmax_ns, ctMin);
128 while (inputFile.hasNext()) {
130 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
132 JTriggeredFileScanner<>::multi_pointer_type ps = inputFile.next();
135 const Evt*
event = ps;
137 const JTimeConverter converter(*
event, *tev);
141 if (muon !=
event->mc_trks.end()) {
145 const JTrack3D trk =
getTrack(*muon);
150 buildL0(*tev, router,
true, back_inserter(dataL0));
151 buildL2(*tev, router,
true, back_inserter(dataL2));
155 sort(dataL2.begin(), dataL2.end(), timeSorter<JHitL2>);
157 dataL2.erase(unique(dataL2.begin(), dataL2.end(), equal_to<JDAQModuleIdentifier>()), dataL2.end());
159 for (JDataL0_t::const_iterator hit = dataL0.begin(); hit != dataL0.end(); ++hit) {
161 const double t0 = trk.getT(*hit);
162 const double t1 = converter.getTime(hit->getT());
164 H1D[1]->Fill(t1 - t0);
168 for (JDataL2_t::const_iterator hit = dataL2.begin(); hit != dataL2.end(); ++hit) {
170 const double t0 = trk.getT(*hit);
171 const double t1 = converter.getTime(hit->begin()->getT());
172 const size_t index = min(hit->size(), H1D.size() - 1);
174 H1D[index]->Fill(t1 - t0);
181 TF1 f1(
"f1",
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2])) + [3]");
183 string option =
"LL";
196 Double_t sigma = 2.0;
199 for (
int i = 1; i != (*h1)->GetNbinsX(); ++i) {
201 const Double_t x = (*h1)->GetBinCenter (i);
202 const Double_t y = (*h1)->GetBinContent(i);
210 f1.SetParameter(0, ymax);
211 f1.SetParameter(1, x0);
212 f1.SetParameter(2, sigma);
213 f1.FixParameter(3, ymin);
218 (*h1)->Fit(&f1, option.c_str(),
"same", x0 - 3 * sigma, x0 + 3 * sigma);
221 cout <<
"\tt0.push_back(" << showpos <<
FIXED(4,2) << f1.GetParameter(1) <<
");" << endl;
Utility class to parse command line options.
JTrack3E getTrack(const Trk &track)
Get track.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
Structure to store the ToT mean and standard deviation of the hits produced by a nanobeacon in a sour...
Auxiliary data structure for floating point format specification.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
JLimit JLimit_t
Type definition of limit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
const JLimit & getLimit() const
Get limit.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
#define DEBUG(A)
Message macros.