1 | //std
|
---|
2 | #include <stdio.h>
|
---|
3 | #include <stdlib.h>
|
---|
4 | #include <math.h>
|
---|
5 | #include <string.h>
|
---|
6 | #include <cmath>
|
---|
7 | #include <fstream>
|
---|
8 | #include <iostream>
|
---|
9 |
|
---|
10 | //Globes
|
---|
11 | #include <globes/globes.h>
|
---|
12 |
|
---|
13 | // AIDA :
|
---|
14 | #include <AIDA/IAnalysisFactory.h>
|
---|
15 | #include <AIDA/ITreeFactory.h>
|
---|
16 | #include <AIDA/IHistogramFactory.h>
|
---|
17 | #include <AIDA/ITree.h>
|
---|
18 | #include <AIDA/ITupleFactory.h>
|
---|
19 | #include <AIDA/ITuple.h>
|
---|
20 |
|
---|
21 |
|
---|
22 | /*
|
---|
23 | Sensibility to delta and theta_13
|
---|
24 | Theta_13=0 and Delta=0 for the true value of the reference experiment
|
---|
25 | use glbChiDeltaTheta to marginalized other all parameters except of
|
---|
26 | the current delta and theta
|
---|
27 | */
|
---|
28 | //FIXME: transfert the #defined variables to Data Cards
|
---|
29 | #define TH12 ( 0.5 * asin(sqrt(0.82)) )
|
---|
30 | #define TH23 ( M_PI/4.0 )
|
---|
31 |
|
---|
32 | #define TH13 0.0
|
---|
33 | #define DELTA 0.0
|
---|
34 |
|
---|
35 | #define DMQ21 8.2e-5
|
---|
36 | #define DMQ31 2.5e-3
|
---|
37 |
|
---|
38 |
|
---|
39 | int WRONG_TH23, WRONG_HIER;
|
---|
40 |
|
---|
41 |
|
---|
42 | /**************************************/
|
---|
43 | /* main */
|
---|
44 | /**************************************/
|
---|
45 |
|
---|
46 | int main(int argc, char *argv[])
|
---|
47 | {
|
---|
48 | //init AIDA for Histo/Tuple
|
---|
49 | AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
|
---|
50 | if(!aida) {
|
---|
51 | std::cerr << " AIDA not found." << std::endl;
|
---|
52 | return 0;
|
---|
53 | }
|
---|
54 |
|
---|
55 | //ROOT tree :
|
---|
56 | AIDA::ITreeFactory* treeFactory = aida->createTreeFactory();
|
---|
57 | std::string opts = "export=root";
|
---|
58 | AIDA::ITree* fTree =
|
---|
59 | treeFactory->create("SPLDeltaTheta2+8OldFluxCorr.root","root",false,true,opts);
|
---|
60 | delete treeFactory;
|
---|
61 |
|
---|
62 | //Booking Tuple
|
---|
63 | AIDA::ITupleFactory* tf = aida->createTupleFactory(*fTree);
|
---|
64 |
|
---|
65 | int NumberOfColumn = 7;
|
---|
66 | std::vector<std::string> column(NumberOfColumn);
|
---|
67 | const char* c_column[] = {"theta12", "theta13", "theta23",
|
---|
68 | "deltaCP", "dm21", "dm31",
|
---|
69 | "chi2"};
|
---|
70 | std::vector<std::string> coltype(NumberOfColumn);
|
---|
71 | const char* c_coltype[] = {"double","double","double",
|
---|
72 | "double","double","double",
|
---|
73 | "double"};
|
---|
74 | for (int icol = 0; icol<NumberOfColumn; ++icol) {
|
---|
75 | column[icol] = c_column[icol];
|
---|
76 | coltype[icol] = c_coltype[icol];
|
---|
77 | }
|
---|
78 |
|
---|
79 | AIDA::ITuple* myTuple =
|
---|
80 | tf->create("SplGlb","Delta-Theta sensibility",column,coltype);
|
---|
81 |
|
---|
82 | //Init Globes
|
---|
83 | glbInit(argv[0]);
|
---|
84 | glbInitExperiment("../data/SPL.glb",
|
---|
85 | &glb_experiment_list[0],
|
---|
86 | &glb_num_of_exps);
|
---|
87 |
|
---|
88 | // true values (reference for future Chi2 computations)
|
---|
89 | glb_params true_values = glbAllocParams();
|
---|
90 | glbDefineParams(true_values, TH12, TH13, TH23, DELTA, DMQ21, DMQ31);
|
---|
91 | glbPrintParams(stdout,true_values);
|
---|
92 |
|
---|
93 | glbSetOscillationParameters(true_values);
|
---|
94 | glbSetRates();
|
---|
95 |
|
---|
96 | // set Starting Values
|
---|
97 | glb_params start_values = glbAllocParams();
|
---|
98 | glbDefineParams(start_values, TH12, TH13, TH23, DELTA, DMQ21, DMQ31);
|
---|
99 | glbSetStartingValues(start_values);
|
---|
100 | glbPrintParams(stdout,start_values);
|
---|
101 | glbFreeParams(start_values);
|
---|
102 |
|
---|
103 | // init test values
|
---|
104 | glb_params test_values = glbAllocParams();
|
---|
105 | glbDefineParams(test_values, TH12, TH13, TH23, DELTA, DMQ21, DMQ31);
|
---|
106 | glbPrintParams(stdout,test_values);
|
---|
107 |
|
---|
108 |
|
---|
109 | // input errors
|
---|
110 | // 5% on Solar parameters, the atmospheric parameters are
|
---|
111 | // better determined by disappearence channels here 30% to drive the
|
---|
112 | // minimizer
|
---|
113 | glb_params input_errors = glbAllocParams();
|
---|
114 | glbDefineParams(input_errors,
|
---|
115 | TH12*0.05, 0., TH23*0.30, 0.,
|
---|
116 | DMQ21*0.05, fabs(DMQ31)*0.30);
|
---|
117 | glbSetDensityParams(input_errors, 0.05, GLB_ALL);
|
---|
118 | glbSetInputErrors(input_errors);
|
---|
119 |
|
---|
120 |
|
---|
121 | glb_params fit_values = glbAllocParams(); //final minimization
|
---|
122 |
|
---|
123 |
|
---|
124 | #define ND 31
|
---|
125 | #define NTH 41
|
---|
126 | #define LOG10MIN -4.0
|
---|
127 | #define LOG10MAX -1.0
|
---|
128 |
|
---|
129 | std::cout << "Start to loop...." << std::endl;
|
---|
130 |
|
---|
131 | double res;
|
---|
132 | double fit_theta12, fit_theta13,fit_theta23,fit_deltaCP,fit_dmSol,fit_dmAtm;
|
---|
133 | double delta, log10s2, sq2th, th;
|
---|
134 |
|
---|
135 | for(int j = 0; j < ND; j++)
|
---|
136 | {
|
---|
137 | //scan de -Pi a +Pi pour delta_CP
|
---|
138 | delta = -M_PI + 2.0 * M_PI * double(j) / (ND-1);
|
---|
139 |
|
---|
140 | glbSetOscParams(test_values, delta, GLB_DELTA_CP);
|
---|
141 |
|
---|
142 | for(int k = 0; k < NTH; k++)
|
---|
143 | {
|
---|
144 | log10s2 = LOG10MIN + (LOG10MAX-LOG10MIN) * double(k) / (NTH-1);
|
---|
145 | sq2th = pow(10.,log10s2);
|
---|
146 | th = 0.5 * asin(sqrt(sq2th));
|
---|
147 | glbSetOscParams(test_values, th, GLB_THETA_13);
|
---|
148 |
|
---|
149 | //Param correlation
|
---|
150 | res = glbChiThetaDelta(test_values,fit_values,0);
|
---|
151 |
|
---|
152 | std::cout << "delta j:" << j << " theta13 k:" << k
|
---|
153 | << " chi2 : " << res
|
---|
154 | << std::endl;
|
---|
155 |
|
---|
156 | fit_theta12 = glbGetOscParams(fit_values, GLB_THETA_12);
|
---|
157 | fit_theta13 = glbGetOscParams(fit_values, GLB_THETA_13);
|
---|
158 | fit_theta23 = glbGetOscParams(fit_values, GLB_THETA_23);
|
---|
159 | fit_deltaCP = glbGetOscParams(fit_values, GLB_DELTA_CP);
|
---|
160 | fit_dmSol = glbGetOscParams(fit_values, GLB_DM_SOL);
|
---|
161 | fit_dmAtm = glbGetOscParams(fit_values, GLB_DM_ATM);
|
---|
162 |
|
---|
163 | myTuple->fill(0,fit_theta12);
|
---|
164 | myTuple->fill(1,fit_theta13);
|
---|
165 | myTuple->fill(2,fit_theta23);
|
---|
166 | myTuple->fill(3,fit_deltaCP);
|
---|
167 | myTuple->fill(4,fit_dmSol);
|
---|
168 | myTuple->fill(5,fit_dmAtm);
|
---|
169 | myTuple->fill(6,res);
|
---|
170 | myTuple->addRow();
|
---|
171 |
|
---|
172 | // std::cout << "Theta_12(rad) " << fit_theta12 << " "
|
---|
173 | // << "Theta_13(rad) " << fit_theta13 << " "
|
---|
174 | // << "Theta_23(deg) " << fit_theta23*180./M_PI << " "
|
---|
175 | // << "Delta_CP(deg) " << fit_deltaCP*180./M_PI << " "
|
---|
176 | // << "DM_21 " << fit_dmSol << " "
|
---|
177 | // << "DM_31 " << fit_dmAtm << " "
|
---|
178 | // << "Chi2 (fin) " << res
|
---|
179 | // << std::endl;
|
---|
180 |
|
---|
181 | }//Loop on Theta13
|
---|
182 | }//Loop on DeltaCP
|
---|
183 |
|
---|
184 | glbFreeParams(true_values);
|
---|
185 | glbFreeParams(test_values);
|
---|
186 | glbFreeParams(fit_values);
|
---|
187 |
|
---|
188 |
|
---|
189 | //save Tuple
|
---|
190 | fTree->commit();
|
---|
191 | delete fTree;
|
---|
192 |
|
---|
193 | delete aida;
|
---|
194 | return 0;
|
---|
195 | }
|
---|
196 |
|
---|
197 |
|
---|
198 |
|
---|
199 |
|
---|
200 |
|
---|