32int main(
int argc,
char **argv){
49 JParser<> zap(
"Auxiliary program to integrate atmospheric neutrino flux over apparent trajectory of a source.");
51 zap[
'D'] =
make_field(dec,
"declination [deg]");
52 zap[
'R'] =
make_field(RA,
"right ascension [deg]");
53 zap[
't'] =
make_field(T_start_int,
"start time + interval [MJD]");
54 zap[
'E'] =
make_field(E_min_max,
"energy range [GeV]") = Range(1e3,1e7);
55 zap[
'C'] =
make_field(detector_coord,
"detector coordinates [rad]") = Range(ARCA.getLatitude(),ARCA.getLongitude());
56 zap[
's'] =
make_field(sterrad,
"correction factor") = 1;
57 zap[
'o'] =
make_field(file_name) =
"./formula.txt";
61 catch(
const exception& error) {
62 FATAL(error.what() << endl);
65 Flux_Atmospheric
flux;
67 double epoch_mean = 2000.0;
80 const double xmax = log10(E_min_max.getUpperLimit());
81 const double xmin = log10(E_min_max.getLowerLimit());
84 for (
int i = 0; i < NE; ++i){
86 double x = (double(i))*(xmax-xmin)/(double(NE))+xmin;
91 for (
int i = 0; i < NT; ++i) {
96 double time = T_start_int.getUpperLimit()*i;
98 time += T_start_int.getLowerLimit();
101 double LST = slaGmst(time) + detector_coord.getUpperLimit();
102 slaMappa(epoch_mean, time, amprms);
103 slaMapqkz(LST-RA, dec, amprms, &RA_ap, &dec_ap);
107 slaDe2h(RA_ap, dec_ap, detector_coord.getLowerLimit(), &phi, &theta);
108 thetavec.push_back(theta);
109 phivec.push_back(phi);
112 theta = cos(M_PI/2 - theta);
115 for (
int j = 0; j < NE; ++j){
116 flx[j] +=
flux.dNdEdOmega(14, log10(E[j]), theta);
121 ostringstream oss_formula;
124 flx[0] *= (sterrad/NT) * pow(E[0],3.7);
125 flx[1] *= (sterrad/NT) * pow(E[1],3.7);
127 double rc = (flx[1]-flx[0])/(E[1]-E[0]);
128 oss_formula <<
"((x>=" << E[0] <<
"&&x<=" << E[1] <<
")*(" << rc <<
"*(x-" << E[0] <<
")+" << flx[0] <<
")+";
131 for (
int i = 2; i < NE; ++i){
132 flx[i] *= (sterrad/NT) * pow(E[i],3.7);
133 rc = (flx[i]-flx[i-1])/(E[i]-E[i-1]);
134 oss_formula <<
"(x>" << E[i-1] <<
"&&x<=" << E[i] <<
")*(" << rc <<
"*(x-" << E[i-1] <<
")+" << flx[i-1] <<
")+";
137 oss_formula <<
"(x>" << E[NE-1] <<
"&&x<=" << E_min_max.getUpperLimit() <<
")*(" << rc <<
"*(x-" << E[NE-1] <<
")+" << flx[NE-1] <<
"))*pow(x,-3.7)";
142 if (getFilenameExtension(file_name)==
"txt"){
143 ofstream out(file_name);
144 out << oss_formula.str();
149 if (getFilenameExtension(file_name)==
"root"){
150 TFile out(file_name.c_str(),
"recreate");
153 auto f1 =
new TF1(
"f1",oss_formula.str().c_str(),E_min_max.getLowerLimit(),E_min_max.getUpperLimit());
154 f1->SetTitle(
"Linear interpolation");
155 f1->Write(
"formula");
158 TGraph* graph =
new TGraph();
159 for (
int i = 0; i < NE; ++i){
160 double flx_norm = flx[i] * pow(E[i],-3.7);
161 graph->SetPoint(i,E[i],flx_norm);
164 graph->GetXaxis()->SetTitle(
"E");
165 graph->GetYaxis()->SetTitle(
"Flux");
166 graph->Write(
"flux");
169 TGraphErrors* graph_rec_coord =
new TGraphErrors(thetavec.size(),&(phivec[0]),&(thetavec[0]));
170 graph_rec_coord->SetLineWidth(0);
171 graph_rec_coord->SetMarkerStyle(1);
173 graph_rec_coord->GetXaxis()->SetTitle(
"Azimuth");
174 graph_rec_coord->GetYaxis()->SetTitle(
"Altitude");
175 graph_rec_coord->SetTitle(
"");
176 graph_rec_coord->GetXaxis()->SetLimits(0,2*M_PI);
177 graph_rec_coord-> Write(
"path");