7 #include "secondaries.hh" 17 #include "Constants.h" 19 #include "TTreeIndex.h" 28 #include "TPostScript.h" 33 #include "TGraphErrors.h" 38 #include "TRotation.h" 40 #include "Taumodel.hh" 41 #include "icemc_random.h" 43 using std::stringstream;
44 using std::setprecision;
45 using std::accumulate;
46 using std::max_element;
47 using std::partial_sum;
68 mydensityvector.clear();
69 myavgdensityvector.clear();
70 myenergyvector.clear();
71 myPsurvvector.clear();
101 chord3 = nuexitice - earth_in;
102 double Distance=chord3.Mag();
103 nchord = chord3 / Distance;
106 double Etaui,Etau_final;
112 double TauWeight_tmp=0;
120 double len_int_kgm2 =0;
122 primary1->
GetSigma(pnu,sigma,len_int_kgm2,settings1,nu_nubar,currentint);
124 double step=Tools::dMin(len_int_kgm2/densities[1]/10,25);
136 double dEtauidEtauf=0;
141 double totaltaudistance=0;
144 double enter_ice_mag = r_enterice.
Distance(earth_in);
146 mydensityvector.clear();
147 myavgdensityvector.clear();
148 this->GetDensityVectors(antarctica1,interaction1,nchord,step,Distance,totalnusteps, crust_entered);
151 for(
double logEtau_final=log10(Emin);logEtau_final<=log10(pnu);logEtau_final+=.01){
152 Etau_final= pow(10,logEtau_final);
157 double gamma = Etau_final/mT;
161 this->GetEnergyVector(Etau_final,step,totalnusteps,totalsteps,totaltaudistance, pnu);
163 this->GetTauSurvVector(step,totalsteps);
165 startingz = Distance-totaltaudistance;
177 for(zdistance = startingz; zdistance<=Distance; zdistance +=step){
178 int nustep = (int)(zdistance/step);
179 int tauenergystep=totalsteps-i;
181 nchord1 = zdistance*nchord;
182 posnunow = earth_in + nchord1;
184 avgdensity = myavgdensityvector[nustep];
185 taudensity=mydensityvector[nustep];
186 Etaui=myenergyvector[tauenergystep];
187 tau_surv = myPsurvvector[i];
190 if(zdistance >=enter_ice_mag){
194 if (Etaui>=pnu || Etaui<Etau_final || Etaui!=Etaui){
198 yweight=primary1->
Getyweight(pnu,y,nu_nubar,currentint);
199 Prob_Nu_Surv = avgdensity/len_int_kgm2*exp(-zdistance*avgdensity*1./len_int_kgm2);
200 dEtauidEtauf = exp(B1*taudensity*(Distance-zdistance))*Etaui/Etau_final;
201 prob_at_z = Prob_Nu_Surv*yweight*1./pnu*dEtauidEtauf*step*tau_surv;
213 if(zdistance<=enter_ice_mag){
214 prob_at_z*=1.-exp(-1.*(r_enterice.
Distance(nuexitice)/(gamma*cT)));
216 else if(zdistance>enter_ice_mag){
217 prob_at_z*=1.-exp(-1.*(posnunow.
Distance(nuexitice)/(gamma*cT)));
219 TauWeight_tmp+=prob_at_z;
227 TauWeight_tmp*=log(10)*Etau_final;
230 TauWeight+=TauWeight_tmp;
233 etaufarray.push_back(Etau_final);
234 PDFarray.push_back(TauWeight);
241 double xrandom= TauWeight*getRNG(RNG_XRNDM)->Rndm();
244 for(
size_t loopthrough =0; loopthrough<=PDFarray.size();loopthrough++){
245 if(xrandom >PDFarray[loopthrough] && xrandom <PDFarray[loopthrough+1]){
246 ptauf=etaufarray[loopthrough];
261 void Taumodel::GetDensityVectors(
IceModel *antarctica1,
Interaction *interaction1,
Vector nchord,
double step,
double Distance,
int &totalnusteps,
int &crust_entered){
264 double avgdensity =0;
265 double density_total=0;
266 double density_now=0;
275 for(
double taudistance=0;taudistance<=Distance;taudistance+=step){
276 nchord1=taudistance*nchord;
277 postaunow=earth_in+nchord1;
278 lat_tau=postaunow.
Lat();
279 altitude_tau = postaunow.Mag()-antarctica1->Geoid(lat_tau);
280 density_now=antarctica1->GetDensity(altitude_tau,postaunow,crust_entered);
281 mydensityvector.push_back(density_now);
283 density_total+=density_now;
284 avgdensity=density_total/(totalnusteps+1);
285 myavgdensityvector.push_back(avgdensity);
295 void Taumodel::GetEnergyVector(
double Etau_final,
double step,
int totalnusteps,
int &totalsteps,
double &totaltaudistance,
double pnu){
297 myenergyvector.clear();
298 myenergyvector.push_back(Etau_final);
299 double Etau_now=Etau_final;
301 ofstream myNewFile_1;
305 for(
int energysteps=totalnusteps-1;energysteps>0;energysteps--){
306 density_now=mydensityvector[energysteps];
308 Etau_now=Etau_now + (B0+B1*log(Etau_now/E0))*density_now*Etau_now*step;
311 totaltaudistance=(totalnusteps-energysteps)*step;
313 myenergyvector.push_back(Etau_now);
315 else if(Etau_now >pnu){
328 void Taumodel::GetTauSurvVector(
double step,
int totalsteps){
329 myPsurvvector.clear();
332 for(
int k1=totalsteps;k1>=0;k1--){
334 for(
int k2=k1-1;k2>=0;k2--){
335 Etau_now=myenergyvector[k2];
337 tau_surv=tau_surv*(1-step*mT/(cT*Etau_now));
341 myPsurvvector.push_back(tau_surv);
int currentint
Ditto - Stephen.
int GetSigma(double pnu, double &sigma, double &len_int_kgm2, Settings *settings1, int nu_nubar, int currentint)
Neutrino-nucleon cross-sections using model chosen.
double weight_tau_prob
Weight for tau neutrino to interact, create a tau, tau survives and decays in the ice...
Reads in and stores input settings for the run.
double Lat() const
Returns latitude, where the +z direction is at 0 latitude.
Functions you need to generate a primary interaction including cross sections and picking charged cur...
This class is a 3-vector that represents a position on the Earth's surface.
Stores everything about a particular neutrino interaction. Interaction.
double GetTauWeight(Primaries *primary1, Settings *settings1, IceModel *antarctica1, Interaction *interaction1, double pnu, int nu_nubar, double &ptauf, int &crust_entered)
GetTauWeight is the function that will calculate the probability that a tau neutrino will interact al...
double Getyweight(double pnu, double y, int nu_nubar, int currentint)
in case you choose y from a flat distribution, this is the weight you should give it according to Con...
Position r_in
position where neutrino enters the earth
Position nuexitice
place where neutrino would have left the ice
This class represents a three-vector. Operators are overloaded to provide for the familiar operations...
double ptauf
Final energy of the tau.
double Distance(const Position &second) const
Returns chord distance (direct distance between two vectors)
Position r_enterice
position where neutrino enters the ice
Ice thicknesses and water depth.