source: GLBFrejus/HEAD/src/discovery3.cxx@ 151

Last change on this file since 151 was 150, checked in by campagne, 19 years ago

add new appli

  • Property svn:executable set to *
File size: 5.9 KB
RevLine 
[150]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 CP discovery potential (Test delta = 0, and delta = pi)
23 Xi2 as the function of the true delta and the true theta_13 to test if the
24 experiment may be fit by CP conserving oscillations
25 the true values are used to build the referenced experiments
26 use chi2Delta to marginalized over all parameters except delta
27
28 NO degeneracy included
29 29/6/05 JEC clean the code
30 */
31
32//FIXME: transfert the #defined variables to Data Cards
33#define TH12 ( 0.5 * asin(sqrt(0.82)) )
34#define TH23 ( M_PI/4.0 )
35
36#define DELTA_0 0.0
37#define DELTA_PI M_PI
38
39#define DMQ21 8.2e-5
40#define DMQ31 2.5e-3
41
42
43/**************************************/
44/* main */
45/**************************************/
46
47int main(int argc, char *argv[])
48{
49 //init AIDA for Histo/Tuple
50 AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
51 if(!aida) {
52 std::cerr << " AIDA not found." << std::endl;
53 return 0;
54 }
55
56 //ROOT tree :
57 AIDA::ITreeFactory* treeFactory = aida->createTreeFactory();
58 std::string opts = "export=root";
59 AIDA::ITree* fTree =
60 treeFactory->create("SPLCPDiscovery.root","root",false,true,opts);
61 delete treeFactory;
62
63 //Booking Tuple
64 AIDA::ITupleFactory* tf = aida->createTupleFactory(*fTree);
65
66 int NumberOfColumn = 7;
67 std::vector<std::string> column(NumberOfColumn);
68 const char* c_column[] = {"theta12", "theta13", "theta23",
69 "deltaCP", "dm21", "dm31",
70 "chi2"};
71 std::vector<std::string> coltype(NumberOfColumn);
72 const char* c_coltype[] = {"double","double","double",
73 "double","double","double",
74 "double"};
75 for (int icol = 0; icol<NumberOfColumn; ++icol) {
76 column[icol] = c_column[icol];
77 coltype[icol] = c_coltype[icol];
78 }
79
80 AIDA::ITuple* myTuple =
81 tf->create("SplGlb","CP violation discovery",column,coltype);
82
83
84 //Init Globes
85 glbInit(argv[0]);
86 glbInitExperiment("../data/SPL.glb",
87 &glb_experiment_list[0],
88 &glb_num_of_exps);
89
90 // input Prior errors:
91 // 5% on Solar parameters, the atmospheric parameters are
92 // better determined by disappearence channels here 30% to drive the
93 // minimizer
94 glb_params input_errors = glbAllocParams();
95 glbDefineParams(input_errors,
96 TH12*0.05, 0., TH23*0.30, 0.,
97 DMQ21*0.05, fabs(DMQ31)*0.30);
98 glbSetDensityParams(input_errors, 0.05, GLB_ALL);
99 glbSetInputErrors(input_errors);
100
101
102
103 //change ND=31 [0,PI/2] to 121 [0,2PI] scan
104#define ND 121
105#define NTH 41
106#define LOG10MIN -4.0
107#define LOG10MAX -1.0
108
109 std::cout << "Start to loop...." << std::endl;
110
111
112 double res,res0,resPi;
113 double fit_theta12, fit_theta13,fit_theta23,fit_deltaCP,fit_dmSol,fit_dmAtm;
114 double delta, log10s2, sq2th, th;
115
116
117 glb_params true_values = glbAllocParams();
118 glb_params start_values = glbAllocParams();
119 glb_params test_values = glbAllocParams();
120
121 for(int k = 0; k < NTH; k++) {
122
123 log10s2 = LOG10MIN + (LOG10MAX-LOG10MIN) * double(k) / (NTH-1);
124 sq2th = pow(10.,log10s2);
125 th = 0.5 * asin(sqrt(sq2th));
126
127 for(int j = 0; j < ND; j++) {
128 //scan de 0 a +Pi pour delta_CP
129 delta = 2. * M_PI * double(j) / (ND-1);
130
131 // true values (reference for future Chi2 computations)
132 glbDefineParams(true_values, TH12, th, TH23, delta, DMQ21, DMQ31);
133
134 glbSetOscillationParameters(true_values);
135 glbSetRates();
136
137 // set Starting Values
138 glbDefineParams(start_values, TH12, th, TH23, delta, DMQ21, DMQ31);
139 glbSetStartingValues(start_values);
140
141 // init test values with current TRUE Theta13 but Fixed DELTA=0
142 glbDefineParams(test_values, TH12, th, TH23, DELTA_0, DMQ21, DMQ31);
143
144 //check whether the data can be fitted with the CP conserving values
145 res0 = glbChiDelta(test_values,NULL,GLB_ALL);
146
147 // init test values with current TRUE Theta13 but Fixed DELTA=PI
148 glbDefineParams(test_values, TH12, th, TH23, DELTA_PI, DMQ21, DMQ31);
149
150 //check whether the data can be fitted with the CP conserving values
151 resPi = glbChiDelta(test_values,NULL,GLB_ALL);
152
153
154 //store the true_values theta13,delta_CP, the other variables are there
155 //just for compatibility for the Tuple definition
156 fit_theta12 = glbGetOscParams(true_values, GLB_THETA_12);
157 fit_theta13 = glbGetOscParams(true_values, GLB_THETA_13);
158 fit_theta23 = glbGetOscParams(true_values, GLB_THETA_23);
159 fit_deltaCP = glbGetOscParams(true_values, GLB_DELTA_CP);
160 fit_dmSol = glbGetOscParams(true_values, GLB_DM_SOL);
161 fit_dmAtm = glbGetOscParams(true_values, GLB_DM_ATM);
162
163 //Get the Minimum Chi2 between the 2 hypothesis Delta=0 Delta=PI
164 res = res0;
165 if (resPi < res0) res = resPi;
166
167// std::cout << "Theta_12(rad) " << fit_theta12 << " "
168// << "Theta_13(rad) " << fit_theta13 << " "
169// << "Theta_23(deg) " << fit_theta23*180./M_PI << " "
170// << "Delta_CP(deg) " << fit_deltaCP*180./M_PI << " "
171// << "DM_21 " << fit_dmSol << " "
172// << "DM_31 " << fit_dmAtm << " "
173// << "Chi2 (fin) " << res
174// << std::endl;
175
176 //Store in the Tuple
177 myTuple->fill(0,fit_theta12);
178 myTuple->fill(1,fit_theta13);
179 myTuple->fill(2,fit_theta23);
180 myTuple->fill(3,fit_deltaCP);
181 myTuple->fill(4,fit_dmSol);
182 myTuple->fill(5,fit_dmAtm);
183 myTuple->fill(6,res);
184 myTuple->addRow();
185
186
187 }//Loop on Theta13
188 }//Loop on DeltaCP
189
190 //free GLoBES arrays
191 glbFreeParams(true_values);
192 glbFreeParams(test_values);
193 glbFreeParams(start_values);
194
195
196 //save Tuple
197 fTree->commit();
198
199 //Clean Tuple management
200 delete fTree;
201 delete aida;
202
203 return 0;
204}
205
206
207
208
209
Note: See TracBrowser for help on using the repository browser.