61 struct JHashEvaluator_t {
84 int main(
int argc,
char **argv)
100 JParser<> zap(
"Auxiliary program to verify processing of Monte Carlo events.");
102 zap[
'f'] =
make_field(inputFile,
"input file (output of detector simulation)");
103 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
104 zap[
'a'] =
make_field(detectorFileA,
"detector used for converion from Monte Carlo truth to raw data.");
105 zap[
'b'] =
make_field(detectorFileB,
"detector used for conversion of raw data to calibrated data.") =
"";
113 catch(
const exception &error) {
114 FATAL(error.what() << endl);
119 if (detectorFileB ==
"") {
120 detectorFileB = detectorFileA;
128 load(detectorFileA, detectorA);
129 load(detectorFileB, detectorB);
135 NOTICE(
"Number of modules in detector A <" << detectorFileA <<
">: " << setw(4) << detectorA.size() << endl);
136 NOTICE(
"Number of modules in detector B <" << detectorFileB <<
">: " << setw(4) << detectorB.size() << endl);
138 JPMTParametersMap::Throw(
true);
140 if (!pmtParameters.is_valid()) {
141 FATAL(
"Invalid PMT parameters " << pmtParameters << endl);
144 if (pmtParameters.getQE() != 1.0) {
146 NOTICE(
"Correct background rates with global efficiency " << pmtParameters.getQE() << endl);
148 rates_Hz.correct(pmtParameters.getQE());
150 NOTICE(
"Back ground rates: " << rates_Hz << endl);
159 DEBUG(
"PMT parameters:" << endl << pmtParameters << endl);
170 const JPosition3D center = get<JPosition3D>(header);
172 NOTICE(
"Apply detector offset from Monte Carlo run header (" << center <<
")" << endl);
184 while (inputFile.hasNext()) {
186 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
188 Evt*
event = inputFile.next();
190 if (!event->mc_hits.empty()) {
196 if (!pmtRouter.
hasPMT(hit->pmt_id)) {
198 miss[hit->pmt_id].put(
getNPE(*hit));
207 lost[pmt].put(
getNPE(*hit));
212 const double t0 =
getTime(*hit);
213 const double t1 =
putTime(t0, pmtRouter .getPMT(hit->pmt_id));
216 if (fabs(t2 - t0) >
parameters.TMaxLocal_ns) {
217 slip[pmt].put(
getNPE(*hit));
223 npe[pmt][0].put(
getNPE(*hit));
224 npe[pmt][1].put(
getNPE(*hit) * P);
225 npe[pmt][2].put(
getNPE(*hit) * P * data.
QE);
231 NOTICE(
"Number of PMTs absent in detector A: " << setw(6) << miss.size() << endl);
234 DEBUG(setw(5) << i->first <<
' ' <<
FIXED(8,0) << i->second.getTotal() << endl);
237 NOTICE(
"Number of PMTs absent in detector B: " << setw(6) << lost.size() << endl);
240 DEBUG(setw(8) << i->first.getModuleID() <<
"[" << setw(2) << i->first.getPMTAddress() <<
"] " <<
FIXED(8,0) << i->second.getTotal() << endl);
243 NOTICE(
"Number of PMTs with t0 detector A - B > " <<
FIXED(4,1) <<
parameters.TMaxLocal_ns <<
" [ns]: " << setw(6) << slip.size() << endl);
246 DEBUG(setw(8) << i->first.getModuleID() <<
"[" << setw(2) << i->first.getPMTAddress() <<
"] " <<
FIXED(8,0) << i->second.getTotal() << endl);
250 NOTICE(
"Number of true photo-electrons, passed threshold and survived QE." << endl);
256 DEBUG(setw(8) << p->first.getModuleID() <<
"[" << setw(2) << p->first.getPMTAddress() <<
"]");
258 for (
size_t i = 0; i != p->second.size(); ++i) {
259 DEBUG(
' ' <<
FIXED(8,0) << p->second[i].getTotal());
263 for (
size_t i = 0; i != p->second.size(); ++i) {
264 total[i].put(p->second[i].getTotal());
268 NOTICE(setw(12) <<
"total");
270 for (
size_t i = 0; i != total.size(); ++i) {
276 NOTICE(
"Time range of hits [ns]: " << QT.getMin() <<
" - " << QT.getMax() << endl);
Router for direct addressing of PMT data in detector data structure.
Utility class to parse command line options.
ROOT TTree parameter settings of various packages.
JPMTIdentifier getIdentifier(const JPMTAddress &address) const
Get identifier of PMT.
General purpose class for hash map of unique elements.
Router for direct addressing of module data in detector data structure.
const JPMTParameters & getPMTParameters() const
Get PMT parameters.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
bool hasPMT(const JObjectID &id) const
Has PMT.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary data structure for floating point format specification.
double getTime(const Hit &hit)
Get true time of hit.
Data structure for detector geometry and calibration.
JTimeRange getTimeRange(const Evt &event)
Get time range (i.e. time between earliest and latest hit) of Monte Carlo event.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Auxiliary class for defining the range of iterations of objects.
double putTime(const T &t1, const JCalibration &cal)
Get de-calibrated time.
double getMaximalDistance(const JDetector &detector)
Get maximal distance between modules in detector.
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getID() const
Get identifier.
int getPMTAddress() const
Get PMT identifier (= TDC).
Auxiliary class for map of PMT parameters.
Direct access to PMT in detector data structure.
General purpose messaging.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Scanning of objects from multiple files according a format that follows from the extension of each fi...
const JPMT & getPMT(const JPMTIdentifier &id) const
Get PMT parameters.
Direct access to module in detector data structure.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
General purpose class for object reading from a list of file names.
Utility class to parse command line options.
double getSurvivalProbability(const JPMTParameters ¶meters)
Get model dependent probability that a one photo-electron hit survives the simulation of the PMT assu...
bool hasModule(const JObjectID &id) const
Has module.
double getNPE(const Hit &hit)
Get true charge of hit.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
Data structure for PMT parameters.
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
double QE
relative quantum efficiency
Auxiliary class for K40 rates.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])