60 struct JHashEvaluator_t {
83 int main(
int argc,
char **argv)
99 JParser<> zap(
"Auxiliary program to verify processing of Monte Carlo events.");
101 zap[
'f'] =
make_field(inputFile,
"input file (output of detector simulation)");
102 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
103 zap[
'a'] =
make_field(detectorFileA,
"detector used for converion from Monte Carlo truth to raw data.");
104 zap[
'b'] =
make_field(detectorFileB,
"detector used for conversion of raw data to calibrated data.") =
"";
112 catch(
const exception &error) {
113 FATAL(error.what() << endl);
118 if (detectorFileB ==
"") {
119 detectorFileB = detectorFileA;
127 load(detectorFileA, detectorA);
128 load(detectorFileB, detectorB);
134 NOTICE(
"Number of modules in detector A <" << detectorFileA <<
">: " << setw(4) << detectorA.size() << endl);
135 NOTICE(
"Number of modules in detector B <" << detectorFileB <<
">: " << setw(4) << detectorB.size() << endl);
137 JPMTParametersMap::Throw(
true);
139 if (!pmtParameters.is_valid()) {
140 FATAL(
"Invalid PMT parameters " << pmtParameters << endl);
143 if (pmtParameters.getQE() != 1.0) {
145 NOTICE(
"Correct background rates with global efficiency " << pmtParameters.getQE() << endl);
147 rates_Hz.correct(pmtParameters.getQE());
149 NOTICE(
"Back ground rates: " << rates_Hz << endl);
158 DEBUG(
"PMT parameters:" << endl << pmtParameters << endl);
169 const JPosition3D center = get<JPosition3D>(header);
171 NOTICE(
"Apply detector offset from Monte Carlo run header (" << center <<
")" << endl);
183 while (inputFile.hasNext()) {
185 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
187 Evt*
event = inputFile.next();
189 if (!event->mc_hits.empty()) {
195 if (!pmtRouter.
hasPMT(hit->pmt_id)) {
197 miss[hit->pmt_id].put(hit->pure_a);
206 lost[
pmt].put(hit->pure_a);
211 const double t0 = hit->pure_t;
212 const double t1 =
putTime(t0, pmtRouter .getPMT(hit->pmt_id));
215 if (fabs(t2 - t0) >
parameters.TMaxLocal_ns) {
216 slip[
pmt].put(hit->pure_a);
222 npe[
pmt][0].put(hit->pure_a);
223 npe[
pmt][1].put(hit->pure_a * P);
224 npe[
pmt][2].put(hit->pure_a * P * data.
QE);
230 NOTICE(
"Number of PMTs absent in detector A: " << setw(6) << miss.size() << endl);
233 DEBUG(setw(5) << i->first <<
' ' <<
FIXED(8,0) << i->second.getTotal() << endl);
236 NOTICE(
"Number of PMTs absent in detector B: " << setw(6) << lost.size() << endl);
239 DEBUG(setw(8) << i->first.getModuleID() <<
"[" << setw(2) << i->first.getPMTAddress() <<
"] " <<
FIXED(8,0) << i->second.getTotal() << endl);
242 NOTICE(
"Number of PMTs with t0 detector A - B > " <<
FIXED(4,1) <<
parameters.TMaxLocal_ns <<
" [ns]: " << setw(6) << slip.size() << endl);
245 DEBUG(setw(8) << i->first.getModuleID() <<
"[" << setw(2) << i->first.getPMTAddress() <<
"] " <<
FIXED(8,0) << i->second.getTotal() << endl);
249 NOTICE(
"Number of true photo-electrons, passed threshold and survived QE." << endl);
255 DEBUG(setw(8) << p->first.getModuleID() <<
"[" << setw(2) << p->first.getPMTAddress() <<
"]");
257 for (
size_t i = 0; i != p->second.size(); ++i) {
258 DEBUG(
' ' <<
FIXED(8,0) << p->second[i].getTotal());
262 for (
size_t i = 0; i != p->second.size(); ++i) {
263 total[i].put(p->second[i].getTotal());
267 NOTICE(setw(12) <<
"total");
269 for (
size_t i = 0; i != total.size(); ++i) {
275 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.
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.
esac $JPP_DIR examples JDetector JTransitTime o $OUTPUT_FILE n N $NPE T $TTS_NS d $DEBUG for HISTOGRAM in tts tt2 pmt
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.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
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.
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.
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
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
#define DEBUG(A)
Message macros.
Auxiliary class for K40 rates.
int main(int argc, char *argv[])