37{
41
43 JLimit_t& numberOfEvents = inputFile.getLimit();
45 string pmtFile;
46 double rate_kHz;
47 string rings;
49
50 try {
51
52 JParser<> zap(
"Example program to equalize QE of PMTs based on summary data.");
53
57 zap[
'P'] =
make_field(pmtFile,
"specify PMT file name that can be given to JTriggerEfficiency.") =
"";
58 zap[
'R'] =
make_field(rate_kHz,
"specify expected singles rate [Hz]") = 0.0;
59 zap[
'r'] =
make_field(rings,
"rings, e.g. \"AB\"") =
"ABCDEF";
61
62 zap(argc, argv);
63 }
64 catch(const exception& error) {
65 FATAL(error.what() << endl);
66 }
67
68
69 const double factor = 1.0e-3;
70
72
73
75
76 if (pmtFile != "") {
77 parameters.
load(pmtFile.c_str());
78 }
79
80
82
83 for (JPMTParametersMap::const_iterator i = parameters.begin(); i != parameters.end(); ++i) {
85 }
86
87
90
92
94
96
98
100
102
103 for (JDAQSummaryslice::const_iterator frame = summary->begin(); frame != summary->end(); ++frame) {
104
106
107 TH1D* h0 = H0[frame->getModuleID()];
108 TProfile* h1 = H1[frame->getModuleID()];
109
111
113
115
117
118 double R = frame->getRate (pmt, factor);
119 double W = frame->getWeight(pmt, factor);
120 double P = 1.0;
121
122 if (p != QE.end()) {
123 P = p->second;
124 }
125
126 if (P > 0.0) {
127
128 h0->Fill(R / P, W);
129 H0->Fill(R / P, W);
130
131 h1->Fill(pmt, R / P);
132 H1->Fill(pmt, R / P);
133 }
134 }
135 }
136 }
137 }
139
140
141 if (pmtFile != "" && rate_kHz > 0.0) {
142
143 NOTICE(
"Write QEs in PMT file " << pmtFile << endl);
144
146
148
150
151 parameters[id].
QE *= i->second->GetBinContent(pmt + 1) / rate_kHz;
152 }
153 }
154
155 parameters.
store(pmtFile.c_str());
156 }
157
158
160
162
165 }
166
167
169
170 H0.Write(out, true);
171 H1.Write(out, true);
172
173 out.Write();
174 out.Close();
175}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Lookup table for PMT addresses in detector.
const JModuleAddressMap & get(const int id) const
Get module address map.
virtual const JModuleAddressMap & getDefaultModuleAddressMap() const =0
Get default module address map.
Lookup table for PMT addresses in optical module.
const JPMTPhysicalAddress & getPMTPhysicalAddress(const int tdc) const
Get PMT physical address.
Auxiliary class for map of PMT parameters.
char ring
ring number ['A','F']
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.
int getDetectorID() const
Get detector identifier.
static int getN()
Get number of bins.
static const double * getData(const double factor=1.0)
Get abscissa values.
JDetectorAddressMap & getDetectorAddressMap()
Get detector address map.
double getSurvivalProbability(const JPMTParameters ¶meters)
Get model dependent probability that a one photo-electron hit survives the simulation of the PMT assu...
void setAxisLabels(TAxis *axis, const JModuleAddressMap &memo)
Set axis with PMT address labels.
std::string to_upper(const std::string &value)
Convert all character to upper case.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
void store(const char *file_name) const
Store to output file.
void load(const char *file_name)
Load from input file.
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.