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 | 24/10/05 (JEC)
|
---|
29 | . transfert the #defined variables to Data Cards
|
---|
30 | . polish the code
|
---|
31 |
|
---|
32 | */
|
---|
33 |
|
---|
34 | float TH12, TH23,DMQ21,DMQ31; //theta12,theta23,Dm^2_21,Dm^2_31
|
---|
35 |
|
---|
36 | //The true value Theta13 and Delta_CP
|
---|
37 | #define TH13_0 0.0
|
---|
38 | #define DELTA_0 0.0
|
---|
39 |
|
---|
40 | int ND; //number of bins to scan delta parameter [-pi,+pi]
|
---|
41 | int NTH; //number of bins to scan theta13 parameter
|
---|
42 | float LOG10MIN; //minimal Log10(sin^2(2theta13))
|
---|
43 | float LOG10MAX; //minimal Log10(sin^2(2theta13))
|
---|
44 |
|
---|
45 | /**************************************/
|
---|
46 | /* main */
|
---|
47 | /**************************************/
|
---|
48 |
|
---|
49 | int main(int argc, char *argv[])
|
---|
50 | {
|
---|
51 | //Process data card file
|
---|
52 | std::string ROOTDIR = getenv("GLBFREJUSROOT");
|
---|
53 | std::string DATACARD;
|
---|
54 | DATACARD = ROOTDIR + "/run/sensi.data";
|
---|
55 | std::ifstream fileDataCard;
|
---|
56 | std::cout << "Open DataCard file : " << DATACARD <<std::endl;
|
---|
57 | fileDataCard.open(DATACARD.data());
|
---|
58 | std::string DUMMYSTR; //comment string of the variables
|
---|
59 |
|
---|
60 | std::string ROOTFILENAME;
|
---|
61 |
|
---|
62 | fileDataCard >> DUMMYSTR >> TH12;
|
---|
63 | std::cout << DUMMYSTR << TH12 << std::endl;
|
---|
64 | fileDataCard >> DUMMYSTR >> TH23;
|
---|
65 | std::cout << DUMMYSTR << TH23 << std::endl;
|
---|
66 | fileDataCard >> DUMMYSTR >> DMQ21;
|
---|
67 | std::cout << DUMMYSTR << DMQ21 << std::endl;
|
---|
68 | fileDataCard >> DUMMYSTR >> DMQ31;
|
---|
69 | std::cout << DUMMYSTR << DMQ31 << std::endl;
|
---|
70 | fileDataCard >> DUMMYSTR >> ROOTFILENAME;
|
---|
71 | ROOTFILENAME += ".root";
|
---|
72 | std::cout << DUMMYSTR <<ROOTFILENAME << std::endl;
|
---|
73 |
|
---|
74 | fileDataCard >> DUMMYSTR >> ND;
|
---|
75 | std::cout << DUMMYSTR << ND << std::endl;
|
---|
76 | fileDataCard >> DUMMYSTR >> NTH;
|
---|
77 | std::cout << DUMMYSTR << NTH << std::endl;
|
---|
78 | fileDataCard >> DUMMYSTR >> LOG10MIN;
|
---|
79 | std::cout << DUMMYSTR << LOG10MIN << std::endl;
|
---|
80 | fileDataCard >> DUMMYSTR >> LOG10MAX;
|
---|
81 | std::cout << DUMMYSTR << LOG10MAX << std::endl;
|
---|
82 |
|
---|
83 |
|
---|
84 | //init AIDA for Histo/Tuple
|
---|
85 | AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
|
---|
86 | if(!aida) {
|
---|
87 | std::cerr << " AIDA not found." << std::endl;
|
---|
88 | return 0;
|
---|
89 | }
|
---|
90 |
|
---|
91 | //ROOT tree :
|
---|
92 | AIDA::ITreeFactory* treeFactory = aida->createTreeFactory();
|
---|
93 | std::string opts = "export=root";
|
---|
94 | AIDA::ITree* fTree =
|
---|
95 | treeFactory->create(ROOTFILENAME,"root",false,true,opts);
|
---|
96 | delete treeFactory;
|
---|
97 |
|
---|
98 | //Booking Tuple
|
---|
99 | AIDA::ITupleFactory* tf = aida->createTupleFactory(*fTree);
|
---|
100 |
|
---|
101 | int NumberOfColumn = 7;
|
---|
102 | std::vector<std::string> column(NumberOfColumn);
|
---|
103 | const char* c_column[] = {"theta12", "theta13", "theta23",
|
---|
104 | "deltaCP", "dm21", "dm31",
|
---|
105 | "chi2"};
|
---|
106 | std::vector<std::string> coltype(NumberOfColumn);
|
---|
107 | const char* c_coltype[] = {"double","double","double",
|
---|
108 | "double","double","double",
|
---|
109 | "double"};
|
---|
110 | for (int icol = 0; icol<NumberOfColumn; ++icol) {
|
---|
111 | column[icol] = c_column[icol];
|
---|
112 | coltype[icol] = c_coltype[icol];
|
---|
113 | }
|
---|
114 |
|
---|
115 | AIDA::ITuple* myTuple =
|
---|
116 | tf->create("SplGlb","Delta-Theta sensibility",column,coltype);
|
---|
117 |
|
---|
118 | //Init Globes
|
---|
119 | glbInit(argv[0]);
|
---|
120 | glbInitExperiment("../data/SPL.glb",
|
---|
121 | &glb_experiment_list[0],
|
---|
122 | &glb_num_of_exps);
|
---|
123 |
|
---|
124 | // true values (reference for future Chi2 computations)
|
---|
125 | glb_params true_values = glbAllocParams();
|
---|
126 | glbDefineParams(true_values, TH12, TH13_0, TH23, DELTA_0, DMQ21, DMQ31);
|
---|
127 | glbPrintParams(stdout,true_values);
|
---|
128 |
|
---|
129 | glbSetOscillationParameters(true_values);
|
---|
130 | glbSetRates();
|
---|
131 |
|
---|
132 | // set Starting Values
|
---|
133 | glb_params start_values = glbAllocParams();
|
---|
134 | glbDefineParams(start_values, TH12, TH13_0, TH23, DELTA_0, DMQ21, DMQ31);
|
---|
135 | glbSetStartingValues(start_values);
|
---|
136 | glbPrintParams(stdout,start_values);
|
---|
137 | glbFreeParams(start_values);
|
---|
138 |
|
---|
139 | // init test values
|
---|
140 | glb_params test_values = glbAllocParams();
|
---|
141 | glbDefineParams(test_values, TH12, TH13_0, TH23, DELTA_0, DMQ21, DMQ31);
|
---|
142 | glbPrintParams(stdout,test_values);
|
---|
143 |
|
---|
144 |
|
---|
145 | // input errors
|
---|
146 | // 5% on Solar parameters, the atmospheric parameters are
|
---|
147 | // better determined by disappearence channels here 30% to drive the
|
---|
148 | // minimizer
|
---|
149 | glb_params input_errors = glbAllocParams();
|
---|
150 | glbDefineParams(input_errors,
|
---|
151 | TH12*0.05, 0., TH23*0.30, 0.,
|
---|
152 | DMQ21*0.05, fabs(DMQ31)*0.30);
|
---|
153 | glbSetDensityParams(input_errors, 0.05, GLB_ALL);
|
---|
154 | glbSetInputErrors(input_errors);
|
---|
155 |
|
---|
156 |
|
---|
157 | glb_params fit_values = glbAllocParams(); //final minimization
|
---|
158 |
|
---|
159 |
|
---|
160 | std::cout << "Start to loop...." << std::endl;
|
---|
161 |
|
---|
162 | double res;
|
---|
163 | double fit_theta12, fit_theta13,fit_theta23,fit_deltaCP,fit_dmSol,fit_dmAtm;
|
---|
164 | double delta, log10s2, sq2th, th;
|
---|
165 |
|
---|
166 | for(int j = 0; j < ND; j++)
|
---|
167 | {
|
---|
168 | //scan de -Pi a +Pi pour delta_CP
|
---|
169 | delta = -M_PI + 2.0 * M_PI * double(j) / (ND-1);
|
---|
170 |
|
---|
171 | glbSetOscParams(test_values, delta, GLB_DELTA_CP);
|
---|
172 |
|
---|
173 | for(int k = 0; k < NTH; k++)
|
---|
174 | {
|
---|
175 | log10s2 = LOG10MIN + (LOG10MAX-LOG10MIN) * double(k) / (NTH-1);
|
---|
176 | sq2th = pow(10.,log10s2);
|
---|
177 | th = 0.5 * asin(sqrt(sq2th));
|
---|
178 | glbSetOscParams(test_values, th, GLB_THETA_13);
|
---|
179 |
|
---|
180 | std::cout << "Consider (k,j) = (" << k << "," << j << ")" << std::endl;
|
---|
181 | //Param correlation
|
---|
182 | res = glbChiThetaDelta(test_values,fit_values,0);
|
---|
183 |
|
---|
184 |
|
---|
185 | //For sensitivity plot store the outcome of the fit
|
---|
186 | fit_theta12 = glbGetOscParams(fit_values, GLB_THETA_12);
|
---|
187 | fit_theta13 = glbGetOscParams(fit_values, GLB_THETA_13);
|
---|
188 | fit_theta23 = glbGetOscParams(fit_values, GLB_THETA_23);
|
---|
189 | fit_deltaCP = glbGetOscParams(fit_values, GLB_DELTA_CP);
|
---|
190 | fit_dmSol = glbGetOscParams(fit_values, GLB_DM_SOL);
|
---|
191 | fit_dmAtm = glbGetOscParams(fit_values, GLB_DM_ATM);
|
---|
192 |
|
---|
193 | myTuple->fill(0,fit_theta12);
|
---|
194 | myTuple->fill(1,fit_theta13);
|
---|
195 | myTuple->fill(2,fit_theta23);
|
---|
196 | myTuple->fill(3,fit_deltaCP);
|
---|
197 | myTuple->fill(4,fit_dmSol);
|
---|
198 | myTuple->fill(5,fit_dmAtm);
|
---|
199 | myTuple->fill(6,res);
|
---|
200 | myTuple->addRow();
|
---|
201 |
|
---|
202 | // std::cout << "Theta_12(rad) " << fit_theta12 << " "
|
---|
203 | // << "Theta_13(rad) " << fit_theta13 << " "
|
---|
204 | // << "Theta_23(deg) " << fit_theta23*180./M_PI << " "
|
---|
205 | // << "Delta_CP(deg) " << fit_deltaCP*180./M_PI << " "
|
---|
206 | // << "DM_21 " << fit_dmSol << " "
|
---|
207 | // << "DM_31 " << fit_dmAtm << " "
|
---|
208 | // << "Chi2 (fin) " << res
|
---|
209 | // << std::endl;
|
---|
210 |
|
---|
211 | }//Loop on Theta13
|
---|
212 | }//Loop on DeltaCP
|
---|
213 |
|
---|
214 | glbFreeParams(true_values);
|
---|
215 | glbFreeParams(test_values);
|
---|
216 | glbFreeParams(fit_values);
|
---|
217 |
|
---|
218 |
|
---|
219 | //save Tuple
|
---|
220 | fTree->commit();
|
---|
221 | delete fTree;
|
---|
222 |
|
---|
223 | delete aida;
|
---|
224 | return 0;
|
---|
225 | }
|
---|
226 |
|
---|
227 |
|
---|
228 |
|
---|
229 |
|
---|
230 |
|
---|