46{
49
51
53 JLimit_t& numberOfEvents = inputFile.getLimit();
55 string detectorFile;
57 unsigned int L_cut;
59
60 try {
61
62 JParser<> zap(
"Example program to verify Monte Carlo data.");
63
71
72 zap(argc, argv);
73 }
74 catch(const exception &error) {
75 FATAL(error.what() << endl);
76 }
77
78
80
81 if (detectorFile != "") {
82
83 try {
85 }
88 }
89 }
90
92
95
96 NOTICE(
"Apply detector offset " << offset << endl);
97
99
101
103
104 for ( ;
x < -10.0;
x += 5.0) { X.push_back(x); }
105 for ( ;
x < +20.0;
x += 1.0) { X.push_back(x); }
106 for ( ;
x < +50.0;
x += 2.0) { X.push_back(x); }
107 for ( ;
x < +100.0;
x += 5.0) { X.push_back(x); }
108 for ( ;
x < +250.0;
x += 10.0) { X.push_back(x); }
109 for ( ;
x < +500.0;
x += 25.0) { X.push_back(x); }
110 for ( ;
x < +900.0;
x += 50.0) { X.push_back(x); }
111
113
115
116 size_t number_of_events = 0;
117
119
121
122 const Evt*
event = inputFile.
next();
123
124 if (!event->mc_hits.empty()) {
125 ++number_of_events;
126 }
127
128 size_t number_of_muons = 0;
129
130 for (vector<Trk>::const_iterator track = event->mc_trks.begin(); track != event->mc_trks.end(); ++track) {
132 number_of_muons += 1;
133 }
134 }
135
136 if (!M(number_of_muons)) {
137 continue;
138 }
139
140 if (event->mc_hits.size() < L_cut) continue;
141
142 for (vector<Hit>::const_iterator hit = event->mc_hits.begin(); hit != event->mc_hits.end(); ++hit) {
143
144 npe[hit->type] += hit->a;
145
146 const double t1 =
getTime(*hit);
147
148 vector<Trk>::const_iterator track = find_if(event->mc_trks.begin(),
149 event->mc_trks.end(),
150 make_predicate(&
Trk::id, hit->origin));
151
152 if (track != event->mc_trks.end() &&
is_muon(*track)) {
153
155
156 if (router.hasPMT(hit->pmt_id)) {
157
158 const JPMT& pmt = router.getPMT(hit->pmt_id);
159 const double t0 = muon.
getT(pmt);
160
161 H1[pmt.
getID()]->Fill(t1 - t0, hit->a);
162
163 H1->Fill(t1 - t0, hit->a);
164 }
165 }
166 }
167 }
169
170 if (number_of_events != 0) {
171
172 const double W = 1.0 / (double) number_of_events;
173
175
176 for (auto& i : H1) {
178 }
179 }
180
182
183 cout << "photon-electron statistics" << endl;
184
185 for (const auto& i : npe) {
186 cout << setw(3) << i.first << ' ' << setw(6) << i.second << endl;
187 }
188 }
189
191
192 out << *H1 << H1;
193
194 out.Write();
195 out.Close();
196}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Router for direct addressing of PMT data in detector data structure.
Data structure for PMT geometry, calibration and status.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
int getID() const
Get identifier.
Utility class to parse command line options.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
counter_type getCounter() const
Get counter.
virtual const pointer_type & next() override
Get next element.
JTrack3E getTrack(const Trk &track)
Get track.
JPosition3D getPosition(const Vec &pos)
Get position.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
Vec getOffset(const JHead &header)
Get offset.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
void convertToPDF(TH1 &h1, const std::string &option="NW", const double factor=1.0)
Convert 1D histogram to PDF.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
const char * getTime()
Get current local time conform ISO-8601 standard.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Type definition of range.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
The Vec class is a straightforward 3-d vector, which also works in pyroot.