10 #include <tls/VTankResponse.h>
11 #include <tls/TankResponseFactory.h>
12 #include <tls/TankResponseUtilities.h>
14 #include <boost/program_options.hpp>
15 #include <boost/shared_ptr.hpp>
17 #include <utl/Reader.h>
18 #include <utl/AugerUnits.h>
19 #include <utl/AugerException.h>
20 #include <utl/ErrorLogger.h>
29 namespace po = boost::program_options;
41 int main(
int argc,
char* argv[]) {
46 TFile f(
"TankResponse.root",
"RECREATE");
51 vector<Branch> branchList;
52 while (branch) { branchList.
push_back(branch); branch = branch.GetNextSibling(); }
56 if (minMu<0) minMu = 0;
59 unsigned short nPoints = 400;
61 for (
unsigned short iz=0;iz<
gTheta.size();++iz) {
62 const double zenith =
gTheta[iz];
66 for (
int muons=gMuonMin;muons<=
gMuonMax;++muons)
67 for (
unsigned short ib=0;ib<branchList.size();++ib)
69 Branch& branch = branchList[ib];
71 printf(
"=============================================\n");
72 printf(
"Using %s",branch.
GetName().c_str());
73 printf(
" Theta = %.1f Deg, Muons = %i\n",zenith,muons);
74 printf(
"=============================================\n");
77 name << branch.
GetName() <<
"_" << int(zenith) <<
"_" << muons;
80 VTankResponse& tankResponse = TankResponseFactory::GetInstance().GetTankResponse(branch);
82 boost::shared_ptr<TH1D> h(
new TH1D(name.str().c_str(),
83 ";S / VEM;dp/dS / VEM^{-1}",nPoints,smin,smax));
86 name2 << branch.
GetName() <<
"_int_" << int(zenith) <<
"_" << muons;
87 boost::shared_ptr<TH1D> h2(
new TH1D(name2.str().c_str(),
88 ";S_{min} / VEM;P(S > S_{min})",
91 for (
int ix=1;ix<h->GetNbinsX()+1;++ix) {
92 double s = h->GetXaxis()->GetBinCenter(ix);
93 double p = tankResponse.
PDF(s, zenith*degree, 1000*
meter, muons);
94 double p2 = tankResponse.
CDF(s, zenith*degree, 1000*
meter, muons);
95 h->SetBinContent(ix,p);
96 h2->SetBinContent(ix,p2);
98 cerr <<
"WARNING: s = " << s <<
" VEM --> p = " << p << endl;
102 cerr <<
"WARNING: s = " << s <<
" VEM --> p2 = " << p2 << endl;
107 cout <<
" Average signal "
108 << tankResponse.
Mean(zenith*degree, 0, static_cast<int>(muons)) <<
"\n"
109 <<
" PDF for S < 3.0 VEM "
110 << 1.-tankResponse.
CDF(3.0,zenith*degree, 1000*
meter, static_cast<int>(muons))
127 msg <<
"Usage: " << argv[0] <<
" -c <xml_config_file> -z <zenith> [-z <zenith>...] --min <muons> --max <muons>\n"
128 <<
"Example: '" << argv[0] <<
" -z 60 -z 80 --min 1 --max 10' will histogram the tank\n"
129 <<
"response probability distributions at theta = 60 deg and theta = 80 deg, for 1 up\n"
130 <<
"up to 10 muons. Everything is saved in the file testTankResponse.root.\n"
131 <<
"\nAll options are";
132 po::options_description desc(msg.str());
135 "write this message")
138 "path to configuration file. Required.")
140 po::value< vector<double> >(&
gTheta),
141 "Zenith angle (in degrees). Required.")
144 "Minimal number of expected muons. Required.")
147 "Maximal number of expected muons. Required.")
151 po::variables_map vm;
153 po::store(po::parse_command_line(argc, argv, desc), vm);
156 catch (po::error& er) {
157 cerr <<
"Command line error : " << er.what() <<
'\n'
162 if (vm.count(
"help") || !vm.count(
"zenith") || !vm.count(
"min") || !vm.count(
"max")) {
163 cerr << desc << endl;
Branch GetTopBranch() const
virtual double PDF(const double signal, const double theta, const double r, const ulong muons) const =0
PDF of signal, given a fixed number of muons.
Base class for exceptions trying to access non-existing components.
Utility for parsing XML files.
Class representing a document branch.
Interface class for coupling different tank response calculations into the reconstruction code...
int main(int argc, char *argv[])
double TankMeanTrackLength(const double theta)
Mean track length of particle piercing Auger tank with zenith angle theta.
std::string GetName() const
function to get the Branch name
string gXMLConfigurationFileName
virtual double Mean(const double theta, const double r, const ulong muons) const =0
Average signal, given fixed number of muons.
Branch GetFirstChild() const
Get first child of this Branch.
#define ERROR(message)
Macro for logging error messages.
const std::string & GetMessage() const
Retrieve the message from the exception.
virtual double CDF(const double smax, const double theta, const double r, const ulong muons) const =0
Probability of signal begin smaller than smax, given a fixed number of muons.
void processOptions(int argc, char *argv[])