34 int main(
int argc,
char **argv)
39 string fileDescriptor;
54 zap[
'O'] =
make_field(option) =
"KM3NeT",
"Antares";
55 zap[
'E'] =
make_field(
E,
"muon/shower energy [GeV]");
56 zap[
'c'] =
make_field(cd,
"cosine emission angle");
57 zap[
'D'] =
make_field(dir,
"(theta, phi) of PMT [rad]");
58 zap[
'T'] =
make_field(TMax_ns,
"L1 coincidence time window [ns]") = 20.0;
65 catch(
const exception &error) {
66 FATAL(error.what() << endl);
78 if (option ==
"KM3NeT") {
80 PMT.push_back(JAngle3D(3.142, 0.000));
81 PMT.push_back(JAngle3D(2.582, 0.524));
82 PMT.push_back(JAngle3D(2.582, 1.571));
83 PMT.push_back(JAngle3D(2.582, 2.618));
84 PMT.push_back(JAngle3D(2.582, 3.665));
85 PMT.push_back(JAngle3D(2.582, 4.712));
86 PMT.push_back(JAngle3D(2.582, 5.760));
87 PMT.push_back(JAngle3D(2.162, 0.000));
88 PMT.push_back(JAngle3D(2.162, 1.047));
89 PMT.push_back(JAngle3D(2.162, 2.094));
90 PMT.push_back(JAngle3D(2.162, 3.142));
91 PMT.push_back(JAngle3D(2.162, 4.189));
92 PMT.push_back(JAngle3D(2.162, 5.236));
93 PMT.push_back(JAngle3D(1.872, 0.524));
94 PMT.push_back(JAngle3D(1.872, 1.571));
95 PMT.push_back(JAngle3D(1.872, 2.618));
96 PMT.push_back(JAngle3D(1.872, 3.665));
97 PMT.push_back(JAngle3D(1.872, 4.712));
98 PMT.push_back(JAngle3D(1.872, 5.760));
99 PMT.push_back(JAngle3D(1.270, 0.000));
100 PMT.push_back(JAngle3D(1.270, 1.047));
101 PMT.push_back(JAngle3D(1.270, 2.094));
102 PMT.push_back(JAngle3D(1.270, 3.142));
103 PMT.push_back(JAngle3D(1.270, 4.189));
104 PMT.push_back(JAngle3D(1.270, 5.236));
105 PMT.push_back(JAngle3D(0.980, 0.524));
106 PMT.push_back(JAngle3D(0.980, 1.571));
107 PMT.push_back(JAngle3D(0.980, 2.618));
108 PMT.push_back(JAngle3D(0.980, 3.665));
109 PMT.push_back(JAngle3D(0.980, 4.712));
110 PMT.push_back(JAngle3D(0.980, 5.760));
112 }
else if (option ==
"Antares") {
114 PMT.push_back(JAngle3D(2.36, +1.05));
115 PMT.push_back(JAngle3D(2.36, 3.14));
116 PMT.push_back(JAngle3D(2.36, -1.05));
120 FATAL(
"Fatal error at detector option " << option << endl);
126 const JRotation3D
R(dir);
129 *
i = JDirection3D(*i).rotate(R);
136 TH1D h0m(
"L0m", NULL, 300, 1.0, 151.0);
137 TH1D h1m(
"L1m", NULL, 300, 1.0, 151.0);
139 TH1D h0s(
"L0s", NULL, 300, 1.0, 151.0);
140 TH1D h1s(
"L1s", NULL, 300, 1.0, 151.0);
144 typedef JSplineFunction1S_t JFunction1D_t;
145 typedef JMAPLIST<JPolint1FunctionalMap,
146 JPolint1FunctionalGridMap,
147 JPolint1FunctionalGridMap>::maplist JMapList_t;
148 typedef JPDFTable<JFunction1D_t, JMapList_t> JPDF_t;
160 const double TTS = 2.0;
162 const double epsilon = 1.0e-10;
164 const int NUMBER_OF_PDFS =
sizeof(
type)/
sizeof(type[0]);
166 JPDF_t pdf[NUMBER_OF_PDFS];
168 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
170 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
174 const string file_name =
getFilename(fileDescriptor, type[
i]);
176 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
178 pdf[
i].load(file_name.c_str());
182 pdf[
i].setExceptionHandler(supervisor);
183 pdf[
i].blur(TTS, numberOfPoints, epsilon);
185 catch(
const JException& error) {
186 FATAL(error.what() << endl);
190 const double Tmin = -15.0;
191 const double Tmax = +250.0;
192 const double dt = 1.0;
194 for (
int ix = 1; ix <= h0m.GetNbinsX(); ++ix) {
196 const double R = h0m.GetBinCenter(ix);
202 const double theta = pi.constrain(pmt->getTheta());
203 const double phi = pi.constrain(fabs(pmt->getPhi()));
205 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
207 double yi = pdf[
i](
R, theta, phi, Tmax).V;
218 h0m.SetBinContent(ix, 1.0 - TMath::PoissonI(0,V));
226 for (
int ix = 1; ix <= h1m.GetNbinsX(); ++ix) {
228 const double R = h1m.GetBinCenter(ix);
232 for (
double x = Tmin;
x <= Tmax;
x += dt) {
240 const double theta = pi.constrain(
PMT[pmt].getTheta());
241 const double phi = pi.constrain(fabs(
PMT[pmt].getPhi()));
243 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
246 pdf[
i](
R, theta, phi,
x).
v,
247 pdf[
i](R, theta, phi,
x + TMax_ns).v
258 Vi[pmt] += yi[1] - yi[0];
266 const double theta = pi.constrain(
PMT[pmt].getTheta());
267 const double phi = pi.constrain(fabs(
PMT[pmt].getPhi()));
271 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
273 double yi = pdf[
i](
R, theta, phi,
x).
f;
285 Y += y * (1.0 - TMath::PoissonI(0, V - Vi[pmt])) * dt;
290 h1m.SetBinContent(ix, 1.0 - TMath::PoissonI(0,Y));
296 typedef JSplineFunction1S_t JFunction1D_t;
297 typedef JMAPLIST<JPolint1FunctionalMap,
298 JPolint1FunctionalMap,
299 JPolint1FunctionalGridMap,
300 JPolint1FunctionalGridMap>::maplist JMapList_t;
301 typedef JPDFTable<JFunction1D_t, JMapList_t> JPDF_t;
309 const double TTS = 2.0;
311 const double epsilon = 1.0e-10;
313 const int NUMBER_OF_PDFS =
sizeof(
type)/
sizeof(type[0]);
315 JPDF_t pdf[NUMBER_OF_PDFS];
317 const JPDF_t::JSupervisor supervisor(
new JPDF_t::JDefaultResult(
JMATH::zero));
319 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
323 const string file_name =
getFilename(fileDescriptor, type[
i]);
325 NOTICE(
"loading PDF from file " << file_name <<
"... " << flush);
327 pdf[
i].load(file_name.c_str());
331 pdf[
i].setExceptionHandler(supervisor);
332 pdf[
i].blur(TTS, numberOfPoints, epsilon);
334 catch(
const JException& error) {
335 FATAL(error.what() << endl);
339 const double Tmin = -15.0;
340 const double Tmax = +250.0;
341 const double dt = 1.0;
343 for (
int ix = 1; ix <= h0s.GetNbinsX(); ++ix) {
345 const double D = h0s.GetBinCenter(ix);
351 const double theta = pi.constrain(pmt->getTheta());
352 const double phi = pi.constrain(fabs(pmt->getPhi()));
354 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
356 double yi = pdf[
i](
D, cd, theta, phi, Tmax).V;
364 h0s.SetBinContent(ix, 1.0 - TMath::PoissonI(0,V));
372 for (
int ix = 1; ix <= h1s.GetNbinsX(); ++ix) {
374 const double D = h1s.GetBinCenter(ix);
378 for (
double x = Tmin;
x <= Tmax;
x += dt) {
386 const double theta = pi.constrain(
PMT[pmt].getTheta());
387 const double phi = pi.constrain(fabs(
PMT[pmt].getPhi()));
389 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
392 pdf[
i](
D, cd, theta, phi,
x).
v,
393 pdf[
i](D, cd, theta, phi,
x + TMax_ns).v
399 Vi[pmt] += yi[1] - yi[0];
407 const double theta = pi.constrain(
PMT[pmt].getTheta());
408 const double phi = pi.constrain(fabs(
PMT[pmt].getPhi()));
412 for (
int i = 0;
i != NUMBER_OF_PDFS; ++
i) {
414 double yi = pdf[
i](
D, cd, theta, phi,
x).
f;
422 Y += y * (1.0 - TMath::PoissonI(0, V - Vi[pmt])) * dt;
427 h1s.SetBinContent(ix, 1.0 - TMath::PoissonI(0,Y));
Utility class to parse command line options.
int main(int argc, char *argv[])
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
static const JPBS_t PMT(3, 4, 2, 3)
PBS of photo-multiplier tube (PMT)
scattered light from EM shower
direct light from EM showers
static const JZero zero
Function object to assign zero value.
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
Various implementations of functional maps.
double getDeltaRaysFromMuon(const double E, const JRange< double > T_GeV=JRange< double >(DELTARAY_TMIN, DELTARAY_TMAX))
Equivalent EM-shower energy due to delta-rays per unit muon track length.
Numbering scheme for PDF types.
bool is_bremsstrahlung(const int pdf)
Test if given PDF type corresponds to Cherenkov light from Bremsstrahlung.
scattered light from muon
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
scattered light from delta-rays
direct light from EM shower
static const double PI
Mathematical constants.
scattered light from EM showers
General purpose messaging.
direct light from delta-rays
Empty structure for specification of parser element that is not initialised (i.e. does require input)...
then JCookie sh JDataQuality D $DETECTOR_ID R
Auxiliary class to define a range between two values.
Utility class to parse command line options.
then JHobbit a $DETECTOR f
bool is_deltarays(const int pdf)
Test if given PDF type corresponds to Cherenkov light from delta-rays.
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
then set_variable DETECTOR set_variable OUTPUT_FILE set_variable DAQ_FILE set_variable PMT_FILE else fatal Wrong number of arguments fi JPrintTree f $DAQ_FILE type
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
do echo Generating $dir eval D