forked from maikeJung/LLH_M2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspectrum.h
39 lines (30 loc) · 1.56 KB
/
spectrum.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdbool.h>
/*define size of the grid*/
#define RESE 600
#define REST 1000
#define EMAX 60.0
#define TMAX 10.0
#define STEPE EMAX/RESE
#define STEPT TMAX/REST
/* normalized LL energy spectrum - 15.4: average energy, 3.8: betha, 4802: normalization factor*/
#define LL_energy_spectrum(E) pow(E, 3.8)*exp(-(1.0+3.8)*E/15.4)/4802.516160
/* normalized LL arrival time spectrum - approximated by log-normal-dist */
#define MY -1.0324
#define SIGMA 0.9134
#define LL_time_spectrum(t) exp( - (log(t)-MY)*(log(t)-MY)/(2*SIGMA*SIGMA) ) / (t*SIGMA*sqrt(2*M_PI))
/*gaussian (around 0): error for the energy smearing from photon counts:
N is proportional to E -> N = 1/alpha*E -> N=alpha*E -> factor of alpha for sigma2 (sigma2=E)
*/
#define ALPHA 2.22
#define GAUSS(i, sigma2) 1/sqrt(2.0*M_PI*sigma2*ALPHA)*exp(-(i*i)/(2.0*sigma2*ALPHA))
#ifndef SPECTRUM_H_
#define SPECTRUM_H_
void createSpectrum(double *spectrum, double mass2, double distance, double events, bool useEnergyRes, bool useTriggerEff, double noise, double *logTime, double *logTimeConv);
double getLLH(double mass2, double distance, double events, bool triggEff, bool energyRes, double noise, int *eventTime, int *eventEnergy, double *logTime, double *logTimeConv);
void createEventsArray(double events, double *spectrum, double max, int *timeArray, int *energyArray, int filenumber, double *logTime);
void getSeed(double distance, double mass2, double events, double noise);
double findSpectrumMax(double *spectrum);
#endif