[2] | 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 |
|
---|
| 29 | 29/6/05 JEC clean the code
|
---|
| 30 | 7/7/05 JEC introduce the Mass hierachy and Octant degeneracy from Th.Schwetz
|
---|
| 31 | 8/7/05 JEC introduce data card management
|
---|
[149] | 32 | 17/5/06 JEC add TEST_OCTANT to avoid pb if theta23=pi/4.
|
---|
[2] | 33 | */
|
---|
| 34 |
|
---|
| 35 |
|
---|
| 36 | #define DELTA_0 0.0
|
---|
| 37 | #define DELTA_PI M_PI
|
---|
[149] | 38 | #define TEST_OCTANT false
|
---|
[2] | 39 |
|
---|
| 40 |
|
---|
| 41 | int WRONG_TH23, WRONG_HIER; //condition on octant/hierarchy
|
---|
| 42 | float TH12, TH23,DMQ21,DMQ31; //theta12,theta23,Dm^2_21,Dm^2_31
|
---|
| 43 |
|
---|
| 44 | int ND; //number of bins to scan delta parameter [0,2pi]
|
---|
| 45 | int NTH; //number of bins to scan theta13 parameter
|
---|
| 46 | float LOG10MIN; //minimal Log10(sin^2(2theta13))
|
---|
| 47 | float LOG10MAX; //minimal Log10(sin^2(2theta13))
|
---|
| 48 |
|
---|
| 49 | //---------------------------------------------------------------------
|
---|
| 50 | bool test_th23(glb_params fit_values) {
|
---|
[149] | 51 | if(TEST_OCTANT) {
|
---|
| 52 | double fit_th23 = glbGetOscParams(fit_values, GLB_THETA_23);
|
---|
| 53 |
|
---|
| 54 | // testing if fit_th23 is at the same side as the true value
|
---|
| 55 |
|
---|
| 56 | return (
|
---|
| 57 | (WRONG_TH23 == 0 &&
|
---|
| 58 | (TH23 > M_PI/4. && fit_th23 > M_PI/4.) ||
|
---|
| 59 | (TH23 < M_PI/4. && fit_th23 < M_PI/4.))
|
---|
| 60 | ||
|
---|
| 61 | (WRONG_TH23 == 1 &&
|
---|
| 62 | (TH23 > M_PI/4. && fit_th23 < M_PI/4.) ||
|
---|
| 63 | (TH23 < M_PI/4. && fit_th23 > M_PI/4.))
|
---|
| 64 | );
|
---|
| 65 | }
|
---|
| 66 | return true;
|
---|
[2] | 67 | }//same_th23
|
---|
| 68 |
|
---|
| 69 | //---------------------------------------------------------------------
|
---|
| 70 | bool test_hier(glb_params fit_values) {
|
---|
| 71 | double fit_dmq = glbGetOscParams(fit_values, GLB_DM_ATM);
|
---|
| 72 |
|
---|
| 73 | // testing if fit_dmq has the same sign as the true value
|
---|
| 74 | return (
|
---|
| 75 | (WRONG_HIER == 0 && fit_dmq * DMQ31 > 0) ||
|
---|
| 76 | (WRONG_HIER == 1 && fit_dmq * DMQ31 < 0)
|
---|
| 77 | );
|
---|
| 78 | }//same_hier
|
---|
| 79 |
|
---|
| 80 | //---------------------------------------------------------------------
|
---|
| 81 |
|
---|
| 82 | bool test(glb_params fit_values) {
|
---|
| 83 | // testing Octant and Hierarchy
|
---|
| 84 | return test_th23(fit_values) && test_hier(fit_values);
|
---|
| 85 | }//test
|
---|
| 86 |
|
---|
| 87 | //---------------------------------------------------------------------
|
---|
| 88 |
|
---|
| 89 | /**************************************/
|
---|
| 90 | /* main */
|
---|
| 91 | /**************************************/
|
---|
| 92 |
|
---|
| 93 | int main(int argc, char *argv[]) {
|
---|
| 94 |
|
---|
| 95 | //Process data card file
|
---|
| 96 | std::string ROOTDIR = getenv("GLBFREJUSROOT");
|
---|
| 97 | std::string DATACARD;
|
---|
| 98 | DATACARD = ROOTDIR + "/run/discoCP.data";
|
---|
| 99 | std::ifstream fileDataCard;
|
---|
| 100 | std::cout << "Open DataCard file : " << DATACARD <<std::endl;
|
---|
| 101 | fileDataCard.open(DATACARD.data());
|
---|
| 102 | std::string DUMMYSTR; //comment string of the variables
|
---|
| 103 |
|
---|
| 104 | std::string ROOTFILENAME;
|
---|
| 105 |
|
---|
| 106 |
|
---|
| 107 | fileDataCard >> DUMMYSTR >> WRONG_TH23;
|
---|
[149] | 108 | std::cout << DUMMYSTR << " " << WRONG_TH23 << std::endl;
|
---|
[2] | 109 | fileDataCard >> DUMMYSTR >> WRONG_HIER;
|
---|
[149] | 110 | std::cout << DUMMYSTR << " " << WRONG_HIER << std::endl;
|
---|
[2] | 111 | fileDataCard >> DUMMYSTR >> TH12;
|
---|
[149] | 112 | std::cout << DUMMYSTR << " " << TH12 << std::endl;
|
---|
[2] | 113 | fileDataCard >> DUMMYSTR >> TH23;
|
---|
[149] | 114 | std::cout << DUMMYSTR << " " << TH23 << std::endl;
|
---|
[2] | 115 | fileDataCard >> DUMMYSTR >> DMQ21;
|
---|
[149] | 116 | std::cout << DUMMYSTR << " " << DMQ21 << std::endl;
|
---|
[2] | 117 | fileDataCard >> DUMMYSTR >> DMQ31;
|
---|
[149] | 118 | std::cout << DUMMYSTR << " " << DMQ31 << std::endl;
|
---|
[2] | 119 | fileDataCard >> DUMMYSTR >> ROOTFILENAME;
|
---|
| 120 |
|
---|
| 121 | //add to ROOT file name the conditions on the Octant/Hierarchy
|
---|
| 122 | ROOTFILENAME += "-h";
|
---|
| 123 | char hier[40];
|
---|
| 124 | sprintf(hier,"%d",WRONG_HIER);
|
---|
| 125 | ROOTFILENAME += hier;
|
---|
| 126 | char octo[40];
|
---|
| 127 | sprintf(octo,"%d",WRONG_TH23);
|
---|
| 128 | ROOTFILENAME += "-o";
|
---|
| 129 | ROOTFILENAME += octo;
|
---|
| 130 | ROOTFILENAME += ".root";
|
---|
| 131 | std::cout << DUMMYSTR <<ROOTFILENAME << std::endl;
|
---|
| 132 |
|
---|
| 133 | fileDataCard >> DUMMYSTR >> ND;
|
---|
[149] | 134 | std::cout << DUMMYSTR << " " << ND << std::endl;
|
---|
[2] | 135 | fileDataCard >> DUMMYSTR >> NTH;
|
---|
[149] | 136 | std::cout << DUMMYSTR << " " << NTH << std::endl;
|
---|
[2] | 137 | fileDataCard >> DUMMYSTR >> LOG10MIN;
|
---|
[149] | 138 | std::cout << DUMMYSTR << " " << LOG10MIN << std::endl;
|
---|
[2] | 139 | fileDataCard >> DUMMYSTR >> LOG10MAX;
|
---|
[149] | 140 | std::cout << DUMMYSTR << " " << LOG10MAX << std::endl;
|
---|
[2] | 141 |
|
---|
| 142 |
|
---|
| 143 |
|
---|
| 144 |
|
---|
| 145 | //init AIDA for Histo/Tuple
|
---|
| 146 | AIDA::IAnalysisFactory* aida = AIDA_createAnalysisFactory();
|
---|
| 147 | if(!aida) {
|
---|
| 148 | std::cerr << " AIDA not found." << std::endl;
|
---|
| 149 | return 0;
|
---|
| 150 | }
|
---|
| 151 |
|
---|
| 152 | //ROOT tree :
|
---|
| 153 | AIDA::ITreeFactory* treeFactory = aida->createTreeFactory();
|
---|
| 154 | std::string opts = "export=root";
|
---|
| 155 | AIDA::ITree* fTree =
|
---|
| 156 | treeFactory->create(ROOTFILENAME,"root",false,true,opts);
|
---|
| 157 | delete treeFactory;
|
---|
| 158 |
|
---|
| 159 | //Booking Tuple
|
---|
| 160 | AIDA::ITupleFactory* tf = aida->createTupleFactory(*fTree);
|
---|
| 161 |
|
---|
| 162 | int NumberOfColumn = 7;
|
---|
| 163 | std::vector<std::string> column(NumberOfColumn);
|
---|
| 164 | const char* c_column[] = {"theta12", "theta13", "theta23",
|
---|
| 165 | "deltaCP", "dm21", "dm31",
|
---|
| 166 | "chi2"};
|
---|
| 167 | std::vector<std::string> coltype(NumberOfColumn);
|
---|
| 168 | const char* c_coltype[] = {"double","double","double",
|
---|
| 169 | "double","double","double",
|
---|
| 170 | "double"};
|
---|
| 171 | for (int icol = 0; icol<NumberOfColumn; ++icol) {
|
---|
| 172 | column[icol] = c_column[icol];
|
---|
| 173 | coltype[icol] = c_coltype[icol];
|
---|
| 174 | }
|
---|
| 175 |
|
---|
| 176 | AIDA::ITuple* myTuple =
|
---|
| 177 | tf->create("SplGlb","CP violation discovery",column,coltype);
|
---|
| 178 |
|
---|
| 179 |
|
---|
| 180 | //Init Globes
|
---|
| 181 | glbInit(argv[0]);
|
---|
| 182 | glbInitExperiment("../data/SPL.glb",
|
---|
| 183 | &glb_experiment_list[0],
|
---|
| 184 | &glb_num_of_exps);
|
---|
| 185 |
|
---|
| 186 | // input Prior errors:
|
---|
| 187 | // 5% on Solar parameters, the atmospheric parameters are
|
---|
| 188 | // better determined by disappearence channels here 30% to drive the
|
---|
| 189 | // minimizer
|
---|
| 190 | glb_params input_errors = glbAllocParams();
|
---|
[149] | 191 | //JEC 17-05-06 use 10% except for Dm2_21 4%
|
---|
| 192 | // glbDefineParams(input_errors,
|
---|
| 193 | // TH12*0.05, 0., TH23*0.30, 0.,
|
---|
| 194 | // DMQ21*0.05, fabs(DMQ31)*0.30);
|
---|
[2] | 195 | glbDefineParams(input_errors,
|
---|
[149] | 196 | TH12*0.10, 0., TH23*0.10, 0.,
|
---|
| 197 | DMQ21*0.04, fabs(DMQ31)*0.10);
|
---|
[2] | 198 | glbSetDensityParams(input_errors, 0.05, GLB_ALL);
|
---|
| 199 | glbSetInputErrors(input_errors);
|
---|
| 200 |
|
---|
| 201 |
|
---|
| 202 |
|
---|
| 203 |
|
---|
| 204 | std::cout << "Start to loop...." << std::endl;
|
---|
| 205 |
|
---|
| 206 |
|
---|
| 207 | double res,res0,resPi;
|
---|
| 208 | double fit_theta12, fit_theta13,fit_theta23,fit_deltaCP,fit_dmSol,fit_dmAtm;
|
---|
| 209 | double delta, log10s2, sq2th, th;
|
---|
| 210 |
|
---|
| 211 |
|
---|
| 212 | glb_params true_values = glbAllocParams();
|
---|
| 213 | glb_params start_values = glbAllocParams();
|
---|
| 214 | glb_params test_values = glbAllocParams();
|
---|
| 215 | glb_params fit_values = glbAllocParams();
|
---|
| 216 |
|
---|
| 217 | for(int k = 0; k < NTH; k++) {
|
---|
| 218 |
|
---|
| 219 | log10s2 = LOG10MIN + (LOG10MAX-LOG10MIN) * double(k) / (NTH-1);
|
---|
| 220 | sq2th = pow(10.,log10s2);
|
---|
| 221 | th = 0.5 * asin(sqrt(sq2th));
|
---|
| 222 |
|
---|
| 223 | for(int j = 0; j < ND; j++) {
|
---|
[149] | 224 | //scan de 0 a +2Pi pour delta_CP
|
---|
| 225 | delta = 2.0 * M_PI * double(j) / (ND-1);
|
---|
[2] | 226 |
|
---|
| 227 | std::cout << "Consider (k,j) = (" << k << "," << j << ")" << std::endl;
|
---|
| 228 |
|
---|
| 229 | // true values (reference for future Chi2 computations)
|
---|
| 230 | glbDefineParams(true_values, TH12, th, TH23, delta, DMQ21, DMQ31);
|
---|
| 231 |
|
---|
| 232 | glbSetOscillationParameters(true_values);
|
---|
| 233 | glbSetRates();
|
---|
| 234 |
|
---|
| 235 | // set Starting Values
|
---|
| 236 | glbDefineParams(start_values, TH12, th, TH23, delta, DMQ21, DMQ31);
|
---|
| 237 | if(WRONG_HIER == 1)
|
---|
| 238 | glbSetOscParams(start_values, -DMQ31+DMQ21, GLB_DM_ATM);
|
---|
| 239 | if(WRONG_TH23 == 1)
|
---|
| 240 | glbSetOscParams(start_values, 0.5*M_PI - TH23, GLB_THETA_23);
|
---|
| 241 |
|
---|
| 242 | glbSetStartingValues(start_values);
|
---|
| 243 |
|
---|
| 244 | // init test values with current TRUE Theta13 but Fixed DELTA=0
|
---|
| 245 | glbDefineParams(test_values, TH12, th, TH23, DELTA_0, DMQ21, DMQ31);
|
---|
| 246 | if(WRONG_HIER == 1)
|
---|
| 247 | glbSetOscParams(test_values, -DMQ31+DMQ21, GLB_DM_ATM);
|
---|
| 248 |
|
---|
| 249 | if(WRONG_TH23 == 1)
|
---|
| 250 | glbSetOscParams(test_values, 0.5*M_PI - TH23, GLB_THETA_23);
|
---|
| 251 |
|
---|
| 252 |
|
---|
| 253 | //check whether the data can be fitted with the CP conserving values
|
---|
| 254 | res0 = glbChiDelta(test_values,fit_values,GLB_ALL);
|
---|
| 255 | //Add a big factor in case if fit_values does not respect the Octant &
|
---|
| 256 | //Mass Hierarchy of the true values
|
---|
| 257 | if (!test(fit_values)) res0 += 1e6;
|
---|
| 258 |
|
---|
| 259 | // init test values with current TRUE Theta13 but Fixed DELTA=PI
|
---|
| 260 | glbDefineParams(test_values, TH12, th, TH23, DELTA_PI, DMQ21, DMQ31);
|
---|
| 261 | if(WRONG_HIER == 1)
|
---|
| 262 | glbSetOscParams(test_values, -DMQ31+DMQ21, GLB_DM_ATM);
|
---|
| 263 |
|
---|
| 264 | if(WRONG_TH23 == 1)
|
---|
| 265 | glbSetOscParams(test_values, 0.5*M_PI - TH23, GLB_THETA_23);
|
---|
| 266 |
|
---|
| 267 | //check whether the data can be fitted with the CP conserving values
|
---|
| 268 | resPi = glbChiDelta(test_values,fit_values,GLB_ALL);
|
---|
| 269 | //Add a big factor in case if fit_values does not respect the Octant &
|
---|
| 270 | //Mass Hierarchy of the true values
|
---|
| 271 | if (!test(fit_values)) resPi += 1e6;
|
---|
| 272 |
|
---|
| 273 | //store the true_values theta13,delta_CP, the other variables are there
|
---|
| 274 | //just for compatibility for the Tuple definition
|
---|
| 275 | fit_theta12 = glbGetOscParams(true_values, GLB_THETA_12);
|
---|
| 276 | fit_theta13 = glbGetOscParams(true_values, GLB_THETA_13);
|
---|
| 277 | fit_theta23 = glbGetOscParams(true_values, GLB_THETA_23);
|
---|
| 278 | fit_deltaCP = glbGetOscParams(true_values, GLB_DELTA_CP);
|
---|
| 279 | fit_dmSol = glbGetOscParams(true_values, GLB_DM_SOL);
|
---|
| 280 | fit_dmAtm = glbGetOscParams(true_values, GLB_DM_ATM);
|
---|
| 281 |
|
---|
| 282 | //Get the Minimum Chi2 between the 2 hypothesis Delta=0 Delta=PI
|
---|
| 283 | res = res0;
|
---|
| 284 | if (resPi < res0) res = resPi;
|
---|
| 285 |
|
---|
| 286 | // std::cout << "Theta_12(rad) " << fit_theta12 << " "
|
---|
| 287 | // << "Theta_13(rad) " << fit_theta13 << " "
|
---|
| 288 | // << "Theta_23(deg) " << fit_theta23*180./M_PI << " "
|
---|
| 289 | // << "Delta_CP(deg) " << fit_deltaCP*180./M_PI << " "
|
---|
| 290 | // << "DM_21 " << fit_dmSol << " "
|
---|
| 291 | // << "DM_31 " << fit_dmAtm << " "
|
---|
| 292 | // << "Chi2 (fin) " << res
|
---|
| 293 | // << std::endl;
|
---|
| 294 |
|
---|
| 295 | //Store in the Tuple
|
---|
| 296 | myTuple->fill(0,fit_theta12);
|
---|
| 297 | myTuple->fill(1,fit_theta13);
|
---|
| 298 | myTuple->fill(2,fit_theta23);
|
---|
| 299 | myTuple->fill(3,fit_deltaCP);
|
---|
| 300 | myTuple->fill(4,fit_dmSol);
|
---|
| 301 | myTuple->fill(5,fit_dmAtm);
|
---|
| 302 | myTuple->fill(6,res);
|
---|
| 303 | myTuple->addRow();
|
---|
| 304 |
|
---|
| 305 |
|
---|
| 306 | }//Loop on Theta13
|
---|
| 307 | }//Loop on DeltaCP
|
---|
| 308 |
|
---|
| 309 | //free GLoBES arrays
|
---|
| 310 | glbFreeParams(true_values);
|
---|
| 311 | glbFreeParams(test_values);
|
---|
| 312 | glbFreeParams(start_values);
|
---|
| 313 | glbFreeParams(fit_values);
|
---|
| 314 |
|
---|
| 315 |
|
---|
| 316 | //save Tuple
|
---|
| 317 | fTree->commit();
|
---|
| 318 |
|
---|
| 319 | //Clean Tuple management
|
---|
| 320 | delete fTree;
|
---|
| 321 | delete aida;
|
---|
| 322 |
|
---|
| 323 | return 0;
|
---|
| 324 | }
|
---|
| 325 |
|
---|
| 326 |
|
---|
| 327 |
|
---|
| 328 |
|
---|
| 329 |
|
---|