source: GLBFrejus/HEAD/src/dm31theta23meas.cxx@ 4

Last change on this file since 4 was 2, checked in by campagne, 20 years ago

first import

File size: 6.7 KB
Line 
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 Mesaurements of dm31 and theta_23
24 use glbChiNP to marginalized other all parameters except of
25 the current dm31 and theta23
26
27 21/7/05 JEC creation
28 22/7/05 JEC laod Data Cards
29*/
30
31//oscillation parameters
32float TH12;
33float TH23;
34float TH13;
35float DELTA;
36float DMQ21;
37float DMQ31;
38
39//Binning to scan in Dm^2_31 and Sin^2(theta23)
40int NDM;
41float DMMIN;
42float DMMAX;
43int NTH;
44float SQ2THMIN;
45float SQ2THMAX;
46
47
48/**************************************/
49/* main */
50/**************************************/
51
52int main(int argc, char *argv[])
53{
54
55 //Process data card file
56 std::string ROOTDIR = getenv("GLBFREJUSROOT");
57 std::string DATACARD;
58 DATACARD = ROOTDIR + "/run/dm31th23.data";
59 std::ifstream fileDataCard;
60 std::cout << "Open DataCard file : " << DATACARD <<std::endl;
61 fileDataCard.open(DATACARD.data());
62 std::string DUMMYSTR; //comment string of the variables
63
64 std::string ROOTFILENAME;
65
66
67 fileDataCard >> DUMMYSTR >> TH12;
68 std::cout << DUMMYSTR << TH12 << std::endl;
69 fileDataCard >> DUMMYSTR >> TH23;
70 std::cout << DUMMYSTR << TH23 << std::endl;
71 fileDataCard >> DUMMYSTR >> TH13;
72 std::cout << DUMMYSTR << TH13 << std::endl;
73 fileDataCard >> DUMMYSTR >> DELTA;
74 std::cout << DUMMYSTR << DELTA << std::endl;
75 fileDataCard >> DUMMYSTR >> DMQ21;
76 std::cout << DUMMYSTR << DMQ21 << std::endl;
77 fileDataCard >> DUMMYSTR >> DMQ31;
78 std::cout << DUMMYSTR << DMQ31 << std::endl;
79
80 fileDataCard >> DUMMYSTR >> ROOTFILENAME;
81 ROOTFILENAME += ".root";
82 std::cout << DUMMYSTR <<ROOTFILENAME << std::endl;
83
84 fileDataCard >> DUMMYSTR >> NDM;
85 std::cout << DUMMYSTR << NDM << std::endl;
86 fileDataCard >> DUMMYSTR >> NTH;
87 std::cout << DUMMYSTR << NTH << std::endl;
88
89 fileDataCard >> DUMMYSTR >> DMMIN;
90 std::cout << DUMMYSTR << DMMIN << std::endl;
91 fileDataCard >> DUMMYSTR >> DMMAX;
92 std::cout << DUMMYSTR << DMMAX << std::endl;
93
94 fileDataCard >> DUMMYSTR >> SQ2THMIN;
95 std::cout << DUMMYSTR << SQ2THMIN << std::endl;
96 fileDataCard >> DUMMYSTR >> SQ2THMAX;
97 std::cout << DUMMYSTR << SQ2THMAX << std::endl;
98
99
100 //init AIDA for Histo/Tuple
101 AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
102 if(!aida) {
103 std::cerr << " AIDA not found." << std::endl;
104 return 0;
105 }
106
107 //ROOT tree :
108 AIDA::ITreeFactory* treeFactory = aida->createTreeFactory();
109 std::string opts = "export=root";
110 AIDA::ITree* fTree =
111 treeFactory->create(ROOTFILENAME,"root",false,true,opts);
112 delete treeFactory;
113
114 //Booking Tuple
115 AIDA::ITupleFactory* tf = aida->createTupleFactory(*fTree);
116
117 int NumberOfColumn = 7;
118 std::vector<std::string> column(NumberOfColumn);
119 const char* c_column[] = {"theta12", "theta13", "theta23",
120 "deltaCP", "dm21", "dm31",
121 "chi2"};
122 std::vector<std::string> coltype(NumberOfColumn);
123 const char* c_coltype[] = {"double","double","double",
124 "double","double","double",
125 "double"};
126 for (int icol = 0; icol<NumberOfColumn; ++icol) {
127 column[icol] = c_column[icol];
128 coltype[icol] = c_coltype[icol];
129 }
130
131 AIDA::ITuple* myTuple =
132 tf->create("SplGlb","dm31 - theta23",column,coltype);
133
134
135 //Init Globes
136 glbInit(argv[0]);
137 glbInitExperiment("../data/SPL.glb",
138 &glb_experiment_list[0],
139 &glb_num_of_exps);
140
141 // input errors
142 glb_params input_errors = glbAllocParams();
143 glbDefineParams(input_errors,
144 TH12*0.05, 0., 0., 0.,
145 DMQ21*0.05, 0.);
146 glbSetDensityParams(input_errors, 0.05, GLB_ALL);
147 glbSetInputErrors(input_errors);
148
149
150
151 glb_params true_values = glbAllocParams();
152 glb_params start_values = glbAllocParams();
153 glb_params test_values = glbAllocParams();
154
155 //Projection. Theta23-Dm31
156 glb_projection proj = glbAllocProjection();
157 glbDefineProjection(proj, GLB_FREE, GLB_FREE, GLB_FIXED,
158 GLB_FREE, GLB_FREE, GLB_FIXED);
159 glbSetProjection(proj);
160
161 std::cout << "Start to loop...." << std::endl;
162
163
164 double res;
165 double fit_theta12, fit_theta13,fit_theta23,fit_deltaCP,fit_dmSol,fit_dmAtm;
166 double log10s2, sq2th, th;
167 double log10dm, dm;
168
169 //Define the True Values (the default experiment)
170 glbDefineParams(true_values, TH12, TH13, TH23, DELTA, DMQ21, DMQ31);
171 glbSetOscillationParameters(true_values);
172 glbSetRates();
173 // set Starting Values
174 glbDefineParams(start_values, TH12, TH13, TH23, DELTA, DMQ21, DMQ31);
175 glbSetStartingValues(start_values);
176
177
178 for(int j = 0; j < NDM; j++)
179 {
180 //scan de DM31
181 dm = DMMIN + (DMMAX - DMMIN) * double(j) / (NDM-1);
182
183
184 for(int k = 0; k < NTH; k++)
185 {
186 //scan de THETA23
187 sq2th = SQ2THMIN + (SQ2THMAX-SQ2THMIN) * double(k) / (NTH-1);
188 th = asin(sqrt(sq2th));
189
190 std::cout << "dm31 j:" << j << " theta13 k:" << k << std::endl;
191
192 // init test values
193 glbDefineParams(test_values, TH12, TH13, th, DELTA, DMQ21, dm);
194 //Chi2
195 if ( (dm>2.2e-3) && (dm<2.6e-3) && (sq2th>0.35) && (sq2th<0.65) ) {
196 res = glbChiNP(test_values,NULL,GLB_ALL);
197 } else {
198 res = glbChiSys(test_values,GLB_ALL,GLB_ALL);
199 }
200 //store the true_values theta13,dm31, the other variables are there
201 //just for compatibility for the Tuple definition
202 fit_theta12 = glbGetOscParams(test_values, GLB_THETA_12);
203 fit_theta13 = glbGetOscParams(test_values, GLB_THETA_13);
204 fit_theta23 = glbGetOscParams(test_values, GLB_THETA_23);
205 fit_deltaCP = glbGetOscParams(test_values, GLB_DELTA_CP);
206 fit_dmSol = glbGetOscParams(test_values, GLB_DM_SOL);
207 fit_dmAtm = glbGetOscParams(test_values, GLB_DM_ATM);
208
209
210// std::cout << "Theta_12(rad) " << fit_theta12 << " "
211// << "Theta_13(rad) " << fit_theta13 << " "
212// << "Theta_23(deg) " << fit_theta23*180./M_PI << " "
213// << "Delta_CP(deg) " << fit_deltaCP*180./M_PI << " "
214// << "DM_21 " << fit_dmSol << " "
215// << "DM_31 " << fit_dmAtm << " "
216// << "Chi2 (fin) " << res
217// << std::endl;
218
219
220 //Store in the Tuple
221 myTuple->fill(0,fit_theta12);
222 myTuple->fill(1,fit_theta13);
223 myTuple->fill(2,fit_theta23);
224 myTuple->fill(3,fit_deltaCP);
225 myTuple->fill(4,fit_dmSol);
226 myTuple->fill(5,fit_dmAtm);
227 myTuple->fill(6,res);
228 myTuple->addRow();
229
230
231
232 }//Loop on Theta13
233 }//Loop on Dm31
234
235 //free GLoBES arrays
236 glbFreeParams(true_values);
237 glbFreeParams(test_values);
238 glbFreeParams(start_values);
239
240 //save Tuple
241 fTree->commit();
242 delete fTree;
243
244 delete aida;
245 return 0;
246}
247
248
249
250
251
Note: See TracBrowser for help on using the repository browser.