TruthAnitaEvent.h
1 
9 #ifndef TRUTHANITAEVENT_H
10 #define TRUTHANITAEVENT_H
11 
12 //Includes
13 #include <TObject.h>
14 #include "TVector3.h"
15 #include <ctime>
16 #include <cmath>
17 
18 #include "AnitaConventions.h"
19 
21 
25 class TruthAnitaEvent: public TObject
26 {
27  public:
28  TruthAnitaEvent();
30 
31  Int_t run;
32  UInt_t realTime;
33  UInt_t eventNumber;
34 
35  Double_t balloonPos[3];
36  Double_t balloonDir[3];
37  Double_t nuPos[3];
38  Double_t nuDir[3];
39  Double_t nuMom;
40  Double_t showerE;
41  Double_t rfExitNor[5][3];
42  Double_t rfExitPos[5][3];
43  Int_t nu_pdg;
44  Int_t canary_c0fefe;
45  Double_t e_component[48];
46  Double_t h_component[48];
47  Double_t n_component[48];
48  Double_t e_component_k[48];
49  Double_t h_component_k[48];
50  Double_t n_component_k[48];
52  Double_t hitangle_e[48];
53  Double_t hitangle_h[48];
54  Double_t vmmhz[128];
55  Double_t vmmhz_max;
56  Double_t payloadPhi;
57  Double_t payloadTheta;
58  Double_t sourceLon;
59  Double_t sourceLat;
60  Double_t sourceAlt;
61  Double_t weight;
62  Double_t weight_prob;
63  Double_t weight1;
64  Double_t phaseWeight;
65  Double_t timeWeight;
66  Double_t sourceTimeWeight;
67  Double_t projectedArea;
68  // Source origin info
69  Double_t RA;
70  Double_t dec;
71  TString objName;
72  Int_t source_index;
73  Int_t canary_12345; //should always equal 0x12345
74 
75 
76  Double_t fTimes[NUM_DIGITZED_CHANNELS][NUM_SAMP];
77  Double_t fSignalAtTrigger[NUM_DIGITZED_CHANNELS][NUM_SAMP];
78  Double_t fNoiseAtTrigger[NUM_DIGITZED_CHANNELS][NUM_SAMP];
79  Double_t fSignalAtDigitizer[NUM_DIGITZED_CHANNELS][NUM_SAMP];
80  Double_t fNoiseAtDigitizer[NUM_DIGITZED_CHANNELS][NUM_SAMP];
81  Double_t fDiodeOutput[NUM_DIGITZED_CHANNELS][NUM_SAMP];
82  Double_t SNRAtTrigger[NUM_DIGITZED_CHANNELS];
83  Double_t maxSNRAtTriggerV;
84  Double_t maxSNRAtTriggerH;
85  Double_t SNRAtDigitizer[NUM_DIGITZED_CHANNELS];
86  Double_t maxSNRAtDigitizerV;
87  Double_t maxSNRAtDigitizerH;
88  Double_t thresholds[NUM_DIGITZED_CHANNELS];
89  Short_t tuffIndex;
90  Int_t canary_09f91102; //should always equal 09f91102
91 
92 
93  ClassDef(TruthAnitaEvent,20);
94 };
95 
96 
102 {
103  public:
104 
105  double nuE() const {return pow(10,log10_nuMom); }
106  double showerE() const { return nuE() * (hadFrac() + emFrac()); }
107  TVector3 nuDir() const { return TVector3(_nuDir); }
108  TVector3 nuPos() const { return haveNu() ? TVector3(nupos_R_km*1e3 * cos(nupos_phi) * cos(nupos_theta),
109  nupos_R_km*1e3 * sin(nupos_phi) * cos(nupos_theta),
110  nupos_R_km*1e3*sin(nupos_theta)) : TVector3(0,0,0); }
111 
112  TVector3 anitaPos() const { return TVector3(anita_R_km*1e3 * cos(anita_phi) * cos(anita_theta),
113  anita_R_km*1e3 * sin(anita_phi) * cos(anita_theta),
114  anita_R_km*1e3*sin(anita_theta)); }
115 
116  bool weightWasSet() const { return have_weight; }
117  double weight() const { return !have_weight ? 0 : pow(10,log10_weight); }
118  double phaseSpaceWeight() const { return !have_weight ? 0 : pow(10,log10_phase_weight); }
119  double timeWeight() const { return !have_weight ? 0 : pow(10,log10_time_weight); }
120 
121 
122  bool fracWasSet() const { return have_frac; }
123  double hadFrac() const { return !have_frac ? 0 : _had_frac; }
124  double emFrac() const { return !have_frac ? 0 : _em_frac; }
125  int nuPdg() const { return haveNu() ? _nu_pdg : -1; }
126 
127  void setSkipped(bool skip, bool zero_frac = true, bool zero_weights = true, bool zero_dir = true) {
128  if (skip)
129  {
130  //these won't be defined yet
131  if (zero_weights)
132  {
133  log10_weight=0;
134  log10_phase_weight =0;
135  log10_time_weight =0;
136  have_weight = false;
137  }
138  if (zero_frac)
139  {
140  _had_frac=0;
141  _em_frac=0;
142  have_frac = false;
143  }
144  if (zero_dir)
145  {
146  setNoDir();
147  }
148  }
149  skipped = skip;
150  }
151  bool isSkipped() const { return skipped; }
152 
153 
154  void setWeights(double weight =1e-100, double phase_space_weight = 1e-4, double time_weight = 1e-10)
155  {
156  log10_weight = log10(weight);
157  log10_phase_weight=log10(phase_space_weight);
158  log10_time_weight=log10(time_weight);
159  have_weight = true;
160  }
161 
162  void setPos(double x, double y, double z,
163  double bx, double by, double bz,
164  int t)
165  {
166  TVector3 v(x,y,z);
167  nupos_R_km = v.Mag()/1e3;
168  nupos_theta = v.Theta();
169  nupos_phi = v.Phi();
170 
171  setBalloon(bx,by,bz,t);
172  }
173 
174  void setNoDir()
175  {
176  have_dir = false;
177  _nuDir[0] = 0;
178  _nuDir[1] = 0;
179  _nuDir[2] = 0;
180  }
181  void setDir(double dx, double dy, double dz)
182  {
183  double maginv = pow(dx*dx+dy*dy+dz*dz,-0.5);
184  _nuDir[0] = dx*maginv;
185  _nuDir[1] = dy*maginv;
186  _nuDir[2] = dz*maginv;
187  have_dir = true;
188  }
189 
190  void setFrac(double had_frac ,double em_frac)
191  {
192 
193  _had_frac = had_frac;
194  _em_frac = em_frac;
195  have_frac = true;
196  }
197 
198  void setNu(double nuE, double nupdg)
199  {
200  log10_nuMom = log10(nuE);
201  _nu_pdg = nupdg;
202  have_nu = true;
203  }
204 
205 
206  void setNoNu(double bx, double by, double bz, int t)
207  {
208  have_nu = false;
209  setBalloon(bx,by,bz,t);
210  setSkipped(true);
211  //Set these to something for compression goodness
212  log10_nuMom = 15;
213  nupos_R_km = 6350;
214  nupos_theta = 0;
215  nupos_phi = 0;
216  }
217 
218  virtual ~TruthAnitaNeutrino() {; }
219 
220  bool haveDir() const {return have_dir; }
221  bool haveFrac() const { return have_frac; }
222  bool haveWeight() const {return have_weight; }
223  bool haveNu() const {return have_nu; }
224 
225  int time() const
226  {
227  struct tm tinfo;
228  tinfo.tm_sec = sec;
229  tinfo.tm_min = min;
230  tinfo.tm_hour = hour;
231  tinfo.tm_mday = day;
232  tinfo.tm_year = year + 100;
233  tinfo.tm_isdst = 0;
234  return mktime(&tinfo);
235  }
236 
237  private:
238  Double32_t log10_nuMom; //[15,23,13]
239  Double32_t _nuDir[3]; //[-1,1,16]
240  Double32_t nupos_R_km; //[6350, 6400, 16];
241  Double32_t nupos_theta; // [0,pi,26];
242  Double32_t nupos_phi; // [-pi,pi,26];
243  Double32_t anita_R_km; //[6350, 6450, 17];
244  Double32_t anita_theta; // [0,pi,26];
245  Double32_t anita_phi; // [-pi,pi,26];
246  Double32_t log10_weight; //[-100,0,16]
247  Double32_t log10_phase_weight; //[-4,0,16]
248  Double32_t _had_frac; //[0,1,10];
249  Double32_t _em_frac; //[0,1,10];
250  Double32_t log10_time_weight; //[-5,3,16];
251 
252  void setBalloon(double bx, double by, double bz, int t)
253  {
254  TVector3 b(bx,by,bz);
255  anita_R_km = b.Mag()/1e3;
256  anita_theta = b.Theta();
257  anita_phi = b.Phi();
258 
259  time_t tmp_t = t;
260  struct tm * T = gmtime(&tmp_t);
261  year = T->tm_year-100;
262  day = T->tm_mday;
263  hour = T->tm_hour;
264  min = T->tm_min;
265  sec = T->tm_sec;
266  }
267 
268  //store time as ymdms since I think it will compress better!
269  int year;
270  int day;
271  int hour;
272  int min;
273  int sec;
274  int _nu_pdg;
275  bool skipped;
276  bool have_weight;
277  bool have_frac;
278  bool have_dir;
279  bool have_nu;
280  ClassDef(TruthAnitaNeutrino,4);
281 };
282 
283 
284 #endif //TRUTHANITAEVENT_H
Double_t h_component_k[48]
Component of the e-field along the rx h-plane.
Double_t rfExitPos[5][3]
Position where the RF exits the ice- 5 iterations, 3 dimensions each.
Double_t payloadPhi
Phi of signal in payload coordinates (degrees)
Double_t projectedArea
If in unbiased mode, the appropriate sampling area for this interaction.
Double_t weight
Weight assigned by icemc.
Int_t nu_pdg
Neutrino PDG code.
Double_t sourceLat
RF position when leaving the ice: Latitude (using icemc model)
Double_t showerE
Shower energy.
Double_t timeWeight
Relative Time weight assigned by icemc.
Double_t n_component_k[48]
Component of the e-field along the normal.
Int_t source_index
Name of the source.
Int_t canary_deadbeef
this shoudl always equal 0xdeadbeef
Double_t sourceLon
RF position when leaving the ice: Longitude (using icemc model)
Double_t sourceAlt
RF position when leaving the ice: Altitude (using icemc model)
Double_t fSignalAtDigitizer[12 *9][260]
Array of signal at digitizer.
Double_t sourceTimeWeight
Relative Time weight for the given source assigned by icemc.
Double_t n_component[48]
Normal comp along polarization.
TruthAnitaEvent()
Default constructor.
Double_t balloonPos[3]
Balloon position.
Int_t canary_c0fefe
this shoudl always equal 0xc0fefe
Double_t vmmhz[128]
V/m/MHz at balloon (128 frequency bins)
Double_t fNoiseAtDigitizer[12 *9][260]
Array of noise at digitizer.
TString objName
Declination of source.
Double_t fNoiseAtTrigger[12 *9][260]
Array of noise at trigger.
Double_t maxSNRAtTriggerV
Max SNR at trigger V-POL.
Short_t tuffIndex
TUFF configuration index.
Double_t dec
Right ascension of source.
Double_t h_component[48]
H comp along polarization.
UInt_t realTime
unixTime of readout
Double_t rfExitNor[5][3]
Normal vector in direction of exit point to balloon - 5 iterations.
Double_t hitangle_h[48]
Hit angles rel. to h plane stored for each antenna.
TruthAnitaEvent – The Truth ANITA Event.
Double_t e_component[48]
E comp along polarization.
Double_t weight1
Absorption weight assigned by icemc.
Double_t weight_prob
weight including probability of interacting!
~TruthAnitaEvent()
Destructor.
Double_t nuDir[3]
Neutrino direction.
Double_t e_component_k[48]
Component of e-field along the rx e-plane.
Double_t maxSNRAtDigitizerV
Max SNR at digitizer V-POL.
Double_t nuMom
Neutrino momentum.
Double_t vmmhz_max
Maximum signal at balloon (V/m/MHz)
Double_t payloadTheta
Theta of signal in payload coordinates (degrees)
Double_t SNRAtTrigger[12 *9]
Array of SNR at trigger.
Double_t SNRAtDigitizer[12 *9]
Array of SNR at digitizer.
Double_t maxSNRAtTriggerH
Max SNR at trigger H-POL.
Double_t thresholds[12 *9]
Channel thresholds used in icemc.
Double_t fSignalAtTrigger[12 *9][260]
Array of signal at trigger.
UInt_t eventNumber
Software event number.
Double_t nuPos[3]
Neutrino position.
Double_t hitangle_e[48]
Hit angles rel. to e plane stored for each antenna.
Int_t run
Run number.
Double_t fTimes[12 *9][260]
Array of unwrapped (unless kNoCalib) times for each channel.
Double_t maxSNRAtDigitizerH
Max SNR at digitizer H-POL.
Double_t phaseWeight
Phase weight assigned by icemc.
Double_t fDiodeOutput[12 *9][260]
Array of tunnel diode output.
Double_t balloonDir[3]
Balloon direction.