float calcula_bg(float dec_, float ethres) { //gROOT->LoadMacro("radec2llbb.C"); //gROOT->LoadMacro("radec2spdetec.C"); //gSystem->Load("libcoordinate-service.so"); using namespace std; //using namespace SLACoordinateTransform; gROOT->LoadMacro("volkova.C"); //NeutrinoFlux nf("conv+prompt","bartol","naumov_rqpm","neutrinoflux/resources/data/"); //gROOT->LoadMacro("calcula_flujo.C"); //Step size: //float stepsize=360; //one hour //TFile *ff=new TFile("Aeffnu_astro_specaart.root"); TFile *ff=new TFile("Aeffnu_2d_aart.root"); Float_t pre, cose; float inte_cos, energy, costheta; int mjd=53300; int sec=0; int nsec=0; int ninter=2400; float nor=1e-8; float spec=-2; //float ethres=1e1; int nbinsx=h2b->GetNbinsX(); int nbinsy=h2b->GetNbinsY(); TH1F *hzen=new TH1F("hzen","",ninter,0,ninter); TH1F *hcos=new TH1F("hcos","",nbinsy,0,1); TH2F *hflux=new TH2F("hflux","",nbinsx,1,7,nbinsy,0,1); TH2F *hflux2=new TH2F("hflux2","",nbinsx,1,7,nbinsy,0,1); TH2F *hev=new TH2F("hev","",nbinsx,1,7,nbinsy,0,1); //LocalToEqua lt; //double ra_=30*TMath::DegToRad(); //double dec_=-15*TMath::DegToRad(); //ra_=ra_*TMath::DegToRad(); //dec_=dec_*TMath::DegToRad(); double theta; double phi; double flux, flux1, flux2; float fondo; for (int i=0;i<=(ninter-1);i++) { float dPhi = 2.*3.141 / ninter; float fac = 3.141/180.; // float fLatDet=-90; float fLatDet=42.8; float zenith = acos(cos(dPhi*i)*cos(fLatDet*fac)*cos(dec_*fac) + sin(fLatDet*fac)*sin(dec_*fac)); zenith = 180.-zenith/fac; // float zenith2 = acos(cos(dPhi*i)*cos(fLatDet*fac)*cos((dec_+1)*fac) + sin(fLatDet*fac)*sin((dec_+1)*fac)); // zenith2 = 180.-zenith2/fac; // float day=float(i)/24.; // lt.set_equatorial_coordinates(2000,ra_,dec_,53300+day); // lt.get_equatorial_coordinates(theta,phi); theta=zenith*TMath::DegToRad(); float thetad=zenith; // cout << i << " " << thetad << endl; // theta=Equa2LocalZenith(ra_,dec_,date); // phi=Equa2LocalAzimuth(ra_,dec_,date); hzen->SetBinContent(i+1,thetad); hcos->Fill(cos(theta)); } // inte_cos=hcos->Integral(); //if(inte_cos>0) hcos->Scale(1./ninter); hcos->Scale(1./ninter); float ene1, ene2, cos1, cos2; for (int i=1; i<=nbinsx; i++) { for (int j=1; j<=nbinsy; j++) { ene1=pow(10,hflux->GetXaxis()->GetBinLowEdge(i)); ene2=pow(10,hflux->GetXaxis()->GetBinLowEdge(i+1)); // cos1=hflux->GetYaxis()->GetBinLowEdge(j); // cos2=hflux->GetYaxis()->GetBinLowEdge(j+1); energy=pow(10,hflux->GetXaxis()->GetBinCenter(i)); costheta=hflux->GetYaxis()->GetBinCenter(j); // For using Bartol // flux1=3600*24*365*1e4*(nf.FluxAtmo(202,ene1,costheta)+nf.FluxAtmo(205,ene1,costheta)); // flux2=3600*24*365*1e4*(nf.FluxAtmo(202,ene2,costheta)+nf.FluxAtmo(205,ene2,costheta)); // For using Volkova //flux1=3600*24*365*1e4*volkova(ene1,costheta); //flux2=3600*24*365*1e4*volkova(ene2,costheta); flux1=3600*24*365*1e4*nor*pow(ene1,spec); flux2=3600*24*365*1e4*nor*pow(ene2,spec); //Flux per year flux=(flux1+flux2)*(ene2-ene1)/2; //flux=3600*24*365*1e4*(nf.FluxAtmo(202,energy,costheta)+nf.FluxAtmo(205,energy,costheta))*(ene2-ene1); // cout << "energy range: " << ene1 << " " << ene2 << endl; // flux=3600*24*365*1e4*(nf.FluxAtmo(202,energy,costheta)+nf.FluxAtmo(205,energy,costheta)); hflux->SetBinContent(i,j,flux); // cout << "energy= " << energy << " cos(theta)= " << cos(theta) << " flux= " << flux << endl; } } //hcos->Draw(); for (int i=1; i<=nbinsx; i++) { for (int j=1; j<=nbinsy; j++) { pre=hflux->GetBinContent(i,j); cose=hcos->GetBinContent(j); hflux2->SetBinContent(i,j,pre*cose); } } for (int i=1; i<=nbinsx; i++) { for (int j=1; j<=nbinsy; j++) { float con=hflux2->GetBinContent(i,j)*h2b->GetBinContent(i,j); hev->SetBinContent(i,j,con); } } // hev->Multiply(hflux2,h2b); hev->Draw("colz"); float nbin1=(log10(ethres)-1)/6*nbinsx; fondo=hev->Integral(int(nbin1),nbinsx,1,nbinsy); return fondo; }