Ejemplo n.º 1
0
void dcpvst23_cpv(double osc[], double vrange[2])
{
  //Compute CPV sensitivity as a function of deltaCP and t23
  //for input true values in osc, and over vrange in t23.
  double chi2[8];
  double minvars[4]={0,0,0,0};
  double lowt23=vrange[0];
  double hight23=vrange[1];
  double steps=35;
  
  glb_projection proj= glbAllocProjection();
  //keeping t12 and DM21 fixed to speed things up
  glbDefineProjection(proj, GLB_FIXED, GLB_FREE, GLB_FREE, GLB_FIXED, GLB_FIXED, GLB_FREE);
  glbSetDensityProjectionFlag(proj, GLB_FIXED, GLB_ALL);
  glbSetProjection(proj);
  
  glbDefineParams(true_values,osc[0],osc[1],osc[2],osc[3],osc[4],osc[5]);
  glbSetDensityParams(true_values,1.0,GLB_ALL);
  glbSetOscillationParameters(true_values);
  glbSetRates();
	double osc3[]={0,M_PI,0,M_PI,0,M_PI,0,M_PI};
	double osc5[]={osc[5],osc[5],-osc[5]+osc[4],-osc[5]+osc[4],osc[5],osc[5],-osc[5]+osc[4],-osc[5]+osc[4]};
	double minchi2=1e6;
  for(double this_dcp=-M_PI;this_dcp<=M_PI;this_dcp=this_dcp+(M_PI/steps)){
    for(double thist23=lowt23;thist23<=hight23;thist23+=(hight23-lowt23)/steps){	
			double osc2[] = {thist23,thist23,thist23,thist23,(M_PI/2)-thist23,(M_PI/2)-thist23,(M_PI/2)-thist23,(M_PI/2)-thist23};
			minchi2=1e6;
			for(int k=0;k<8;k++){ //profile octant, deltaCP=0,PI, and MH
				glbDefineParams(true_values,osc[0],osc[1],thist23,this_dcp,osc[4],osc[5]);
				glbSetDensityParams(true_values,1.0,GLB_ALL);
				glbSetOscillationParameters(true_values);
				glbSetRates();
			
				glbDefineParams(test_values,osc[0],osc[1],osc2[k],osc3[k],osc[4],osc5[k]);
				glbSetDensityParams(test_values,1.0,GLB_ALL);
				//set central values to match test_values
				glbDefineParams(central_values,osc[0],osc[1],osc2[k],osc3[k],osc[4],osc5[k]);
				glbSetCentralValues(central_values); 
			  
				if(arguments.test)
					chi2[k]=glbChiSys(test_values,GLB_ALL,GLB_ALL);
				else
					chi2[k]=glbChiNP(test_values,test_values,GLB_ALL);
					
				if(chi2[k]<minchi2){
					minchi2=chi2[k];
					minvars[0]=glbGetOscParams(test_values,GLB_THETA_13);
					minvars[1]=glbGetOscParams(test_values,GLB_THETA_23);
					minvars[2]=glbGetOscParams(test_values,GLB_DELTA_CP);
					minvars[3]=glbGetOscParams(test_values,GLB_DM_31);
				}
			}
						
			double a[]={this_dcp,thist23, minchi2, minvars[0], minvars[1], minvars[2], minvars[3]};
			AddArrayToOutput(a,7);
		}
	AddToOutputBlankline();
  }
}
Ejemplo n.º 2
0
/* myprior_prior is mandatory (for prior modules).
 *
 * This is the default prior, i.e. priors are only added for free
 * parameters, and the prior accepts starting values as stored in sv
 * and input errors as stored in er.
 */
double tmyprior_prior(const glb_params in, void *user_data)
{
  int i;
  double res=0;
  glb_projection pro;
  pro=glbAllocProjection();
  glbGetProjection(pro);
  for(i=0;i<GLB_OSCP;i++)
    {
      if(glbGetProjectionFlag(pro,i)==GLB_FREE) 
	{
      res +=
        tsprior(glbGetOscParams(in,i),
         glbGetOscParams(tsv,i),
         glbGetOscParams(ter,i)
         );                                              
      gpriors[i][0]=glbGetOscParams(in,i);
      gpriors[i][1]=glbGetOscParams(tsv,i);
      gpriors[i][2]=glbGetOscParams(ter,i);
      gpriors[i][3]=tsprior(glbGetOscParams(in,i),
         glbGetOscParams(tsv,i),
         glbGetOscParams(ter,i)
         );
	}
    }

  for(i=0;i<glb_num_of_exps;i++)
    {

      if(glbGetDensityProjectionFlag(pro,i)==GLB_FREE)
        res +=
          tsprior(glbGetDensityParams(in,i),
                 glbGetDensityParams(tsv,i),
                 glbGetDensityParams(ter,i)
                 );
        gpriors[6][0]=glbGetDensityParams(in,i);
        gpriors[6][1]=glbGetOscParams(tsv,i);
        gpriors[6][2]=glbGetDensityParams(tsv,i);
        gpriors[6][3]=tsprior(glbGetDensityParams(in,i),
                 glbGetDensityParams(tsv,i),
                 glbGetDensityParams(ter,i)
                 );
    }

  glbFreeProjection(pro);

  return res;
}
Ejemplo n.º 3
0
/***************************************************************************
 * Store oscillation parameters in internal data structures.               *
 * For more sophisticated probability engines, this would be the right     *
 * place to pre-compute the mixing matrix and parts of the Hamiltonian in  *
 * order to speed up the calls to the actual probability matrix function.  *
 ***************************************************************************/
int my_set_oscillation_parameters(glb_params p, void *user_data)
{
  th12    = glbGetOscParams(p, GLB_THETA_12);
  th13    = glbGetOscParams(p, GLB_THETA_13);
  th23    = glbGetOscParams(p, GLB_THETA_23);
  deltacp = glbGetOscParams(p, GLB_DELTA_CP);
  sdm     = glbGetOscParams(p, GLB_DM_21) * 1.0e-18;   /* Convert to GeV^2 */
  ldm     = glbGetOscParams(p, GLB_DM_31) * 1.0e-18;   /* Convert to GeV^2 */
  sigma_E = glbGetOscParams(p, GLB_SIGMA_E);

  return 0;
}
Ejemplo n.º 4
0
void dcpvst13(double osc[], double vrange[2])
{
  //Compute allowed regions in DeltaCP vs t13 for true values in osc over range vrange in t13
  double chi2[2];
  double mindeltas[2];
  double lowt13=vrange[0];
  double hight13=vrange[1];
  double res;
  //set resolution
  if(arguments.tSteps==10){
    res=35;
  }else{
    res=arguments.tSteps;
  }
  
  glb_projection projT13dcp = glbAllocProjection();
  glbDefineProjection(projT13dcp, GLB_FREE, GLB_FIXED, GLB_FREE, GLB_FIXED, GLB_FREE, GLB_FREE);
  glbSetDensityProjectionFlag(projT13dcp, GLB_FREE, GLB_ALL);
  glbSetProjection(projT13dcp);
  
  glbDefineParams(true_values,osc[0],osc[1],osc[2],osc[3],osc[4],osc[5]);
  glbSetDensityParams(true_values,1.0,GLB_ALL);
  glbSetOscillationParameters(true_values);
  glbSetRates();
  double osc5[]={osc[5],-osc[5]+osc[4]};
  for(double this_dcp=-M_PI;this_dcp<=M_PI;this_dcp=this_dcp+(M_PI/res)){
    for(double thist13=lowt13;thist13<=hight13;thist13+=(hight13-lowt13)/res){
			for(int k=0;k<2;k++){ //profile MH
				glbDefineParams(test_values,osc[0],thist13,osc[2],this_dcp,osc[4],osc5[k]);
				glbSetDensityParams(test_values,1.0,GLB_ALL);
				glbDefineParams(central_values,osc[0],osc[1],osc[2],osc[3],osc[4],osc5[k]);
				glbSetCentralValues(central_values); 
				if(arguments.test){
					chi2[k]=glbChiSys(test_values,GLB_ALL,GLB_ALL);
				}else{
					chi2[k]=glbChiTheta13Delta(test_values,test_values,GLB_ALL);
				}
				mindeltas[k]=glbGetOscParams(test_values,GLB_THETA_23);
			}
			double a[]={this_dcp,thist13, chi2[0], chi2[1], mindeltas[0], mindeltas[1]};
			AddArrayToOutput(a,6);
    }
	AddToOutputBlankline();
  }
}
Ejemplo n.º 5
0
void dcpvst13_nzt(double osc[], double vrange[2])
{
  //Compute deltachisq for non-zero t13 as a function of deltaCP and t13
  //for input true values in osc and over vrange in t13.
  double chi2[2];
  double mindeltas[2];
  double lowt13=vrange[0];
  double hight13=vrange[1];
  
  glb_projection projT13dcp = glbAllocProjection();
  glbDefineProjection(projT13dcp, GLB_FREE, GLB_FIXED, GLB_FREE, GLB_FIXED, GLB_FREE, GLB_FREE);
  glbSetDensityProjectionFlag(projT13dcp, GLB_FREE, GLB_ALL);
  glbSetProjection(projT13dcp);
  

  double osc5[]={osc[5],-osc[5]+osc[4]};
  for(double this_dcp=-M_PI;this_dcp<=M_PI;this_dcp=this_dcp+(M_PI/35)){
    for(double thist13=lowt13;thist13<=hight13;thist13+=(hight13-lowt13)/35){
			glbDefineParams(true_values,osc[0],thist13,osc[2],this_dcp,osc[4],osc[5]);
			glbSetDensityParams(true_values,1.0,GLB_ALL);
			glbSetOscillationParameters(true_values);
			glbSetRates();
			
			for(int k=0;k<2;k++){ //profile MH
				glbDefineParams(test_values,osc[0],0,osc[2],this_dcp,osc[4],osc5[k]);
				glbSetDensityParams(test_values,1.0,GLB_ALL);
				glbDefineParams(central_values,osc[0],0,osc[2],osc[3],osc[4],osc5[k]);
				glbSetCentralValues(central_values);
				if(arguments.test){
					chi2[k]=glbChiSys(test_values,GLB_ALL,GLB_ALL);
				}else{
					chi2[k]=glbChiTheta13Delta(test_values,test_values,GLB_ALL);
				}
				mindeltas[k]=glbGetOscParams(test_values,GLB_THETA_23);
			}
			double a[]={this_dcp,thist13, chi2[0], chi2[1], mindeltas[0], mindeltas[1]};
			AddArrayToOutput(a,6);
    }
	AddToOutputBlankline();
  }
}
Ejemplo n.º 6
0
void dcpvst23_mh(double osc[], double vrange[2])
{
  //Compute MH sensitivity as a function of deltaCP and t23
  //for input true values in osc, and over vrange in t23.
  double lowt23=vrange[0];
  double hight23=vrange[1];
  double steps=35;
  double minvars[4];
  double mindcp, mint23;

  glb_projection proj= glbAllocProjection();
  //keeping t12 and DM21 fixed to speed things up
  glbDefineProjection(proj, GLB_FIXED, GLB_FREE, GLB_FREE, GLB_FIXED, GLB_FIXED, GLB_FREE);
  glbSetDensityProjectionFlag(proj, GLB_FIXED, GLB_ALL);
  glbSetProjection(proj);
  
  glbDefineParams(true_values,osc[0],osc[1],osc[2],osc[3],osc[4],osc[5]);
  glbSetDensityParams(true_values,1.0,GLB_ALL);
  glbSetOscillationParameters(true_values);
  glbSetRates();

	double minchi2=1e6, tminchi2=1e6;
  for(double this_dcp=-M_PI;this_dcp<=M_PI;this_dcp=this_dcp+(M_PI/steps)){
    for(double thist23=lowt23;thist23<=hight23;thist23+=(hight23-lowt23)/steps){	
			double osc2[] = {thist23,(M_PI/2)-thist23};
			glbDefineParams(true_values,osc[0],osc[1],thist23,this_dcp,osc[4],osc[5]);
			glbSetDensityParams(true_values,1.0,GLB_ALL);
			glbSetOscillationParameters(true_values);
			glbSetRates();
		
			//profile without systematics in deltacp, t23 octant
			tminchi2=1e6;
			mindcp=this_dcp;
			mint23=thist23;
			for(double this_tdcp=-M_PI;this_tdcp<M_PI;this_tdcp=this_tdcp+(M_PI/36)){
				for(int tk=0;tk<2;tk++){
					glbDefineParams(test_values,osc[0],osc[1],osc2[tk],this_tdcp,osc[4],-osc[5]+osc[4]);  
					glbSetDensityParams(test_values,1.0,GLB_ALL);
					double tchi2=glbChiSys(test_values,GLB_ALL,GLB_ALL);
					if(tchi2<tminchi2){
						tminchi2=tchi2;
						mindcp=this_tdcp;
						mint23=osc2[tk];
					}
				}
			}

			glbDefineParams(test_values,osc[0],osc[1],mint23,mindcp,osc[4],-osc[5]+osc[4]);  
			glbSetDensityParams(test_values,1.0,GLB_ALL);
			glbDefineParams(central_values,osc[0],osc[1],mint23,this_dcp,osc[4],-osc[5]+osc[4]);
			glbSetCentralValues(central_values);   
			if(arguments.test)
				minchi2=glbChiSys(test_values,GLB_ALL,GLB_ALL);
			else{
				minchi2=glbChiDelta(test_values,test_values,GLB_ALL);
			}
			minvars[0]=glbGetOscParams(test_values,GLB_THETA_13);
			minvars[1]=glbGetOscParams(test_values,GLB_THETA_23);
			minvars[2]=glbGetOscParams(test_values,GLB_DELTA_CP);
			minvars[3]=glbGetOscParams(test_values,GLB_DM_31);

			double a[]={this_dcp,thist23, minchi2, minvars[0], minvars[1], minvars[2], minvars[3]};
			AddArrayToOutput(a,7);
		}
		AddToOutputBlankline();
	}
}
Ejemplo n.º 7
0
void dcpvst23_nmq(double osc[], double vrange[2])
{
  //Compute deltachisq for non-maximal t23 sensitivity as a function of deltaCP and t23
  //for input true values in osc, and over vrange in t23.
  double chi2[2];
  double minvars[2][4];
  double lowt23=vrange[0];
  double hight23=vrange[1];
	double tminchi2, tchi2;
  double steps=35; //note that both axes use double this number of steps
  double mindcp=osc[3];
  
  glb_projection proj= glbAllocProjection();
  //keeping t12 and DM21 fixed to speed things up
  glbDefineProjection(proj, GLB_FIXED, GLB_FREE, GLB_FIXED, GLB_FREE, GLB_FIXED, GLB_FREE);
  glbSetDensityProjectionFlag(proj, GLB_FIXED, GLB_ALL);
  glbSetProjection(proj);
  
  glbDefineParams(true_values,osc[0],osc[1],osc[2],osc[3],osc[4],osc[5]);
  glbSetDensityParams(true_values,1.0,GLB_ALL);
  glbSetOscillationParameters(true_values);
  glbSetRates();
	double osc5[]={osc[5],-osc[5]+osc[4]};
  for(double this_dcp=-M_PI;this_dcp<=M_PI;this_dcp=this_dcp+(M_PI/steps)){
    for(double thist23=lowt23;thist23<=hight23;thist23+=(hight23-lowt23)/(2*steps)){	
			for(int k=0;k<2;k++){ //profile MH
				glbDefineParams(true_values,osc[0],osc[1],thist23,this_dcp,osc[4],osc[5]);
				glbSetDensityParams(true_values,1.0,GLB_ALL);
				glbSetOscillationParameters(true_values);
				glbSetRates();
				
				//do prescan without systematics in deltacp, t23 octant
				tminchi2=1e6;
				for(double this_tdcp=-M_PI;this_tdcp<M_PI;this_tdcp=this_tdcp+(M_PI/36)){
					glbDefineParams(test_values,osc[0],osc[1],(M_PI/4),this_tdcp,osc[4],osc5[k]);  
					glbSetDensityParams(test_values,1.0,GLB_ALL);
					tchi2=glbChiSys(test_values,GLB_ALL,GLB_ALL);
					if(tchi2<tminchi2){
						tminchi2=tchi2;
						mindcp=this_tdcp;
					}
				}
				
				glbDefineParams(test_values,osc[0],osc[1],(M_PI/4),mindcp,osc[4],osc5[k]);
				glbSetDensityParams(test_values,1.0,GLB_ALL);
				glbDefineParams(central_values,osc[0],osc[1],(M_PI/4),this_dcp,osc[4],osc5[k]);
				glbSetCentralValues(central_values); 
				if(arguments.test)
					chi2[k]=glbChiSys(test_values,GLB_ALL,GLB_ALL);
				else
					chi2[k]=glbChiNP(test_values,test_values,GLB_ALL);
					
				minvars[k][0]=glbGetOscParams(test_values,GLB_THETA_13);
				minvars[k][1]=glbGetOscParams(test_values,GLB_THETA_23);
				minvars[k][2]=glbGetOscParams(test_values,GLB_DELTA_CP);
				minvars[k][3]=glbGetOscParams(test_values,GLB_DM_31);
			}
			double minchi2=1e6; int mini=0;
			for(int i=0;i<2;i++) if(chi2[i]<minchi2) {minchi2=chi2[i]; mini=i;}
			double a[]={this_dcp,thist23, minchi2, minvars[mini][0], minvars[mini][1], minvars[mini][2], minvars[mini][3]};
			AddArrayToOutput(a,7);
		}
	AddToOutputBlankline();
  }
}
Ejemplo n.º 8
0
int main(int argc, char *argv[])
{
  /* Initialize libglobes */
  glbInit(argv[0]);

  glbInitExperiment("T2HK.glb",&glb_experiment_list[0],&glb_num_of_exps);

  glbSelectMinimizer(GLB_MIN_POWELL); // Use experimental minimizer to speed up things

  double theta12 = asin(sqrt(0.3));
  double theta13 = asin(sqrt(0.1))/2.0;
  double theta23 = M_PI/4.0;
  double deltacp = 3*M_PI/2.0;
  double sdm = 8.0e-5;
  double ldm = 2.5e-3;
  
  /* Parameter is output file name; if empty string, write to screen: */
  mioInitOutput("tut1.dat"); 

  glb_params central_values = glbAllocParams();
  glb_params fit_values = glbAllocParams();
  glb_params true_values = glbAllocParams();
  glb_params input_errors = glbAllocParams();
  glb_params foundmin = glbAllocParams();
  
  glbDefineParams(true_values,theta12,theta13,theta23,deltacp,sdm,ldm);
  glbSetDensityParams(true_values,1.0,GLB_ALL);  		 
  glbDefineParams(input_errors,theta12*0.1,0,0,0,sdm*0.1,0);     /* 10% external error for solar parameters */ 
  glbSetDensityParams(input_errors,0.05,GLB_ALL);  		 /* 5% matter density uncertainty */
  
  double res;

  /* scan parameter space as function of true x = log sin^2 2 theta_13 */
  double x;  
  double minx = -4.0;
  double maxx = -1.0;
  double steps = 12.0;

  for(x=minx;x<maxx+0.0001;x+=(maxx-minx)/steps)
  {
     glbSetOscParams(true_values,asin(sqrt(pow(10,x))/2),GLB_THETA_13);

     glbSetOscillationParameters(true_values);
     glbSetRates();

     glbCopyParams(true_values,central_values);

     /* Educated guess: start minimizer at -dm_31 */
     glbSetOscParams(central_values,-glbGetOscParams(true_values,GLB_DM_31),GLB_DM_31);
     glbCopyParams(central_values,fit_values);
  
     glbSetCentralValues(central_values);
     glbSetInputErrors(input_errors);

     res=glbChiAll(fit_values,foundmin,GLB_ALL);

     printf("\nx=%g, Minimum found at %g:\n",x,res);
     glbPrintParams(stdout,foundmin);
 
     /* Write to file */
     mioAddToOutput(x,res);
  }
 
  /* Close output stream: */
  mioCloseOutput();
    
  glbFreeParams(fit_values);
  glbFreeParams(central_values);
  glbFreeParams(true_values);
  glbFreeParams(input_errors);
  glbFreeParams(foundmin);
  
 
  exit(0);
}