secondaries.hh
1 //class Secondaries:
4 
5 
6 #ifndef ICEMC_SECONDARIES_HH
7 #define ICEMC_SECONDARIES_HH
8 
9 #include <algorithm>
10 #include <numeric>
11 #include <iostream>
12 #include <string>
13 #include <sstream>
14 #include <fstream>
15 #include <iomanip>
16 #include <vector>
17 #include "Primaries.h"
18 class TH1F;
19 class Vector;
20 class Settings;
21 class Primaries;
22 
23 using std::vector;
24 using std::ifstream;
25 using std::string;
26 
28 class Secondaries {
29 
30 private:
31 
32  void Picky(double *y_cumulative,int NPROB_MAX,double rnd,double& y);
33  // secondaries
34  static const int NPROB_MAX=100; // this sets the maximum length of the arrays
35  int NPROB; // this counts how many of those array elements are actually used
36  double plepton; // energy of charged lepton after interaction(s)
37  double em_secondaries_max; // em energy due to secondary interactions
38  double had_secondaries_max; // had energy due to secondary interactions
39  // first index=energy from 10^18 to 10^21 in half-decades
40  // second index=y (100 bins)
41  double dsdy_muon_brems[7][NPROB_MAX]; // probability distribution vs. y for brem
42  double dsdy_muon_epair[7][NPROB_MAX]; // prob. dist. vs. y for pair production
43  double dsdy_muon_pn[7][NPROB_MAX]; // photonuclear interactions
44 
45  double y_muon_brems[7][NPROB_MAX]; // inelasticity corresponding to each bin,brem
46  double y_muon_epair[7][NPROB_MAX]; // same for pair production
47  double y_muon_pn[7][NPROB_MAX]; // same for photonuclear
48 
49  vector<double> vy_muon_brems[7]; // vectors containing inelasticities distributed such
50  //that they follow the dsdy curves above.
51  vector<double> vy_muon_epair[7];
52  vector<double> vy_muon_pn[7];
53 
54  double y_cumulative_muon_brems[7][NPROB_MAX];
55  double y_cumulative_muon_epair[7][NPROB_MAX];
56  double y_cumulative_muon_pn[7][NPROB_MAX];
57 
58  double int_muon_brems[7]; // integral of prob. dist.=# of expected interactions.
59  // for each energy
60  double int_muon_epair[7]; // same for pair prod.
61  double int_muon_pn[7]; // same for photnuclear
62 
63  double max_muon_brems; // maximum value of prob. dist., brems
64  double max_muon_epair; // max value of prob. dist., pair prod.
65  double max_muon_pn; // same for photonucl.
66 
67  double min_muon_brems; // minimum value of prob. dist., brems
68  double min_muon_epair; // min value of prob. dist., pair prod.
69  double min_muon_pn; // same for photonucl.
70 
71  double dsdy_tauon_brems[7][NPROB_MAX]; // same as above, but for taus
72  double dsdy_tauon_epair[7][NPROB_MAX];
73  double dsdy_tauon_pn[7][NPROB_MAX];
74  double dsdy_tauon_hadrdecay[7][NPROB_MAX]; // hadronic decay of taus
75  double dsdy_tauon_edecay[7][NPROB_MAX]; // tau decay to electrons
76  double dsdy_tauon_mudecay[7][NPROB_MAX]; // tau decay to muons.
77 
78  double y_tauon_brems[7][NPROB_MAX];
79  double y_tauon_epair[7][NPROB_MAX];
80  double y_tauon_pn[7][NPROB_MAX];
81  double y_tauon_hadrdecay[7][NPROB_MAX];
82  double y_tauon_edecay[7][NPROB_MAX];
83  double y_tauon_mudecay[7][NPROB_MAX];
84 
85  double y_cumulative_tauon_brems[7][NPROB_MAX];
86  double y_cumulative_tauon_epair[7][NPROB_MAX];
87  double y_cumulative_tauon_pn[7][NPROB_MAX];
88  double y_cumulative_tauon_hadrdecay[7][NPROB_MAX];
89  double y_cumulative_tauon_edecay[7][NPROB_MAX];
90  double y_cumulative_tauon_mudecay[7][NPROB_MAX];
91 
92  vector<double> vy_tauon_brems[7]; // vectors containing inelasticities distributed such
93  //that they follow the dsdy curves above.
94  vector<double> vy_tauon_epair[7];
95  vector<double> vy_tauon_pn[7];
96  vector<double> vy_tauon_hadrdecay[7];
97  vector<double> vy_tauon_edecay[7];
98  vector<double> vy_tauon_mudecay[7];
99 
100  double int_tauon_brems[7];
101  double int_tauon_epair[7];
102  double int_tauon_pn[7];
103  double int_tauon_hadrdecay[7];
104  double int_tauon_edecay[7];
105  double int_tauon_mudecay[7];
106 
107  double max_tauon_brems;
108  double max_tauon_epair;
109  double max_tauon_pn;
110  double max_tauon_hadrdecay;
111  double max_tauon_edecay;
112  double max_tauon_mudecay;
113 
114  double min_tauon_brems; // minimum value of prob. dist., brems
115  double min_tauon_epair; // min value of prob. dist., pair prod.
116  double min_tauon_pn; // same for photonucl.
117  double min_tauon_hadrdecay; // minimum value of prob. dist., brems
118  double min_tauon_edecay; // min value of prob. dist., pair prod.
119  double min_tauon_mudecay; // same for photonucl.
120 
121 
122 // double weight_doublebang=0;
123 // double dtime_doublebang=0;
124 
125 
126  static const int N_TAUOLA=10001;
127  double tauola[N_TAUOLA][6];//tau decay energy fractions, [0]=tau neutrino, [1]=mu neutrino, [2]=Electron neutrino, [3]=hadrons, [4]=electromagnetic, [5]=muons
128  ifstream tauolainfile;
129 
130 
131  void readData(string,string,double (*)[NPROB_MAX], double (*)[NPROB_MAX]);
132  void ReadSecondaries(); // read in prob. dist. for secondary interactions
133 
134  //For Tau Weight & Survival probability equations.
135  //n.b. not in SI units.
136  //from Tau neutrino propagaiton and tau energy loss 2005 Dutta, Huang, & Reno.
137  //Equation 16 & used in Equation 30.
138  double B0,B1,E0;//parameterization using a logarithmic dependence on energy
139  //for B, the tau elecromagnetic energy loss parameter.
140  double mT;//mass of the Tau in Gev
141  double cT;//Tau Decay length in cm
142  // double p;//Density of Standard Rock. g/cm^3
143 
144  //Used in Connolly Calc 2011.(d_dzPsurvNu())
145  //p, the Density of Standard Rock. g/cm^3
146  double A;
147  double Mn;// nucleon/ proton mass in grams,also equal to 0.938 GeV.
148 
149 
150 public:
151  Secondaries();
152 
153 
154  int SECONDARIES;
155  int TAUDECAY; // is tau decay counted as a secondary interaction
156  double TAUFRAC; //fraction of tau neutrino-cc current events where the primare interaction point is the first bang
157  int count_nfb;
158  int secondary_e_noncons;
159 
160  void GetSecondaries(Settings *settings1,string,double,double&,double&,int&,TH1F*);
161 
162  void InitTauola();
163  void GetTauDecay(string nuflavor,string current,string& taudecay, double& emfrac_db, double& hadfrac_db);
164 
165  void GetEMFracDB(double& emfrac_db, double& hadfrac_db);
166  double GetDBViewAngle(const Vector &refr, const Vector &nnu);
167  //void GetFirstBang(const Position &r_in, const Vector &nnu, Position &posnu, double len_int_kgm2, double d1, double &nuentrancelength);
168  double NFBWeight(double ptau, double taulength);
169 
170  int GetEMFrac(Settings *settings1,
171  string nuflavor,
172  string current,
173  string taudecay,
174  double y,
175  TH1F *hy,
176  double pnu,
177  int inu,
178 
179  double& emfrac,
180  double& hadfrac,
181  int& n_interactions, int taumodes1);
182 
183  bool secondbang;
184  static const bool interestedintaus=false;
185 
186  //string flavors[3]={"nue","numu","nutau"}; // the gps path of the anita-lite flight
187 string flavors[3]; // the gps path of the anita-lite flight
188 
189 }; //class Secondaries
190 
191 
192 #endif
Reads in and stores input settings for the run.
Definition: Settings.h:37
Functions you need to generate a primary interaction including cross sections and picking charged cur...
Definition: Primaries.h:83
Secondary interactions.
Definition: secondaries.hh:28
This class represents a three-vector. Operators are overloaded to provide for the familiar operations...
Definition: vector.hh:27