Exemple #1
0
BOOL CZSingleton::Check(wchar_t **arg,int num,const wchar_t *key)
{
	CString gg(AfxGetApp()->m_pszExeName);
	HANDLE hMutex = ::CreateMutex(NULL,TRUE,key); 
	if(GetLastError() == ERROR_ALREADY_EXISTS) 
	{ 
		CloseHandle(hMutex);
		hMutex = NULL;
		// note:this will not work if you don't run as an adminstrator
		HWND  hWndPrevious = ::GetWindow(::GetDesktopWindow(),GW_CHILD);   
		while   (::IsWindow(hWndPrevious))   
		{ 
			if(::GetProp(hWndPrevious,gg))   
			{   
				if(::IsIconic(hWndPrevious))   
					::ShowWindow(hWndPrevious,SW_RESTORE); 
				if(num >=2 )
				{
					CString mes;
					for(int i = 1;i < num;i++)
						mes.AppendFormat(L"%s|",arg[i]);
					COPYDATASTRUCT cpd; 
					cpd.dwData = 0;
					cpd.cbData = mes.GetLength()*sizeof(wchar_t) ;
					cpd.lpData = (void*)mes.GetBuffer();
					SendMessage(hWndPrevious,WM_COPYDATA,0,(LPARAM)&cpd);
					mes.ReleaseBuffer();
					mes.Empty();
				}
				::SetForegroundWindow(hWndPrevious);   
				::SetForegroundWindow(::GetLastActivePopup(hWndPrevious)); 
				gg.Empty();
				return TRUE; 
			}    
			hWndPrevious   =   ::GetWindow(hWndPrevious,GW_HWNDNEXT); 
		}
		return TRUE;
	} 
	return FALSE;
}
//отрисовка для диалогового окна
void OnPaint_for_dialog(HWND h)
{

    Color color(255,0,0); 
    Pen pen(color,5); 
    Image image(name_img);
    HDC hdc = GetDC(h);
	Graphics gg(hdc);	

	//Контроль за тем, чтобы диалоговое окно было не больше размера экрана пользователя.
	static int max_x = GetSystemMetrics(SM_CXSCREEN);
    static int max_y = GetSystemMetrics(SM_CYSCREEN);
	 Bitmap buffer( max_x, max_y,&gg);
	 Graphics g(&buffer);

	gg.DrawImage(
		&image,
		0,
		0,
		(image.GetWidth() > max_x) 
					 ? max_x  
					 : image.GetWidth()
					 ,(image.GetHeight() > max_y)
					 ? max_y - 50 
					 : image.GetHeight()
            );

	//тянуть прямоугольник пока левая кнопка не отжата
	if(ButtonPush || ButtonIsUp ) gg.DrawRectangle(
		&pen,
		_left,
		_top,
		_right - _left ,
		_bottom - _top
		); 

	g.DrawImage(&buffer,0,0);
	DeleteDC(hdc);	
}
Exemple #3
0
void get_dens_and_vel(real psi, real& dens, real& v2)

// Return density d and local velocity dispersion v2,
// given scaled potential psi (< 0).

{
  dens = 0;
  if (psi >= -beta_w0) return;

  // Distribution function is
  //
  //	f(r,v) = A exp(-psi) (exp(-v^2 / 2 sig^2) - exp(psi - beta*psi0)),
  //
  // where psi = phi/sig^2 and psi0 = -w0.
  //
  // Density is the integral of 4 pi v^2 f, velocity dispersion v2
  // is (integral of 4 pi v^4 f) / density.

  real g2, g4 = v2;

  real p_max = -psi - beta_w0;		// v_max^2 / (2 sig^2)

  real y_max = sqrt(p_max);
  real ep = exp(-psi);

  gg(y_max, g2, g4);

  dens = ep * g2 - scale_fac * y_max * p_max / 3;

  // Note that this expression for dens excludes an overall factor
  // of 8 pi sqrt(2) sig^3 A.  Scaling to the central density
  // is handled elsewhere (in rhs).

  if (v2 > 0 && dens > 0)
      v2 = 2 * (ep * g4 - 0.2 * scale_fac * y_max * p_max * p_max) / dens;

  // The unit of v2 is sig^2.

}
Exemple #4
0
 ECMultConsts() {
     const GroupElem &g = GetGroupConst().g;
     GroupElemJac g128j(g);
     for (int i=0; i<128; i++)
         g128j.SetDouble(g128j);
     GroupElem g128; g128.SetJac(g128j);
     wpg.Build(g);
     wpg128.Build(g128);
     GroupElemJac gg(g);
     GroupElem ad(g);
     GroupElemJac fn;
     for (int j=0; j<64; j++) {
         prec[j][0].SetJac(gg);
         fn.SetAdd(fn, gg);
         for (int i=1; i<16; i++) {
             gg.SetAdd(gg, ad);
             prec[j][i].SetJac(gg);
         }
         ad = prec[j][15];
     }
     fn.SetNeg(fn);
     fin.SetJac(fn);
 }
Exemple #5
0
main(){
    ios_base::sync_with_stdio(0);
    cin>>n>>m>>s;
    pl=s.size();
    s='#'+s;
    P1[0]=P2[0]=1;
    for(int i=1;i<=n;++i){
        P1[i]=(P1[i-1]*B1)%md1;
        P2[i]=(P2[i-1]*B2)%md2;
    }
    for(int i=1;i<s.size();++i){
        H1[i]=(H1[i-1]+(s[i]-'a'+1)*P1[i])%md1;
        H2[i]=(H2[i-1]+(s[i]-'a'+1)*P2[i])%md2;
    }
    for(int i=1;i<=m;++i){
        cin>>b[i];
        ss[b[i]]++;
        ss[b[i]+pl]--;
    }
    for(int i=2;i<=m;++i){
        q=(b[i-1]+pl)-b[i];
        if(q<=0)continue;
        r1=(H1[pl]-H1[pl-q]+md1);
        if(r1>=md1)r1-=md1;
        r2=(H2[pl]-H2[pl-q]+md2);
        if(r2>=md2)r2-=md2;
        l1=(H1[q]*P1[pl-q])%md1;
        l2=(H2[q]*P2[pl-q])%md2;
        if(l1!=r1||l2!=r2)gg();
    }
    ans=1;
    for(int i=1;i<=n;++i){
        csum+=ss[i];
        if(csum==0)ans=(ans*26)%md;
    }
    cout<<ans;
}
int main(){
	Graaf<GERICHT> gg(7);
	gg.voeg_verbinding_toe(0,1);
	gg.voeg_verbinding_toe(0,2);
	gg.voeg_verbinding_toe(2,6);
	gg.voeg_verbinding_toe(1,3);
	gg.voeg_verbinding_toe(1,4);
	gg.voeg_verbinding_toe(1,5);
	cout<<gg;
	Printspecial("nu postnummering bepalen");
	gg.diepte_eerst_zoeken();
	
	
	
	
//	
//	MijnGraaf g("makefile.txt");
//	std::vector<string> v;// = g.rangschik_topologisch2();
//	schrijf(v);
//	v = g.rangschik_topologisch1();
//	schrijf(v);
//	std::vector<string> compileer_volgorde = g.compileer_volgorde("timestamps.txt");
//	schrijf(compileer_volgorde);
}
Exemple #7
0
/**
 * Description not yet available.
 * \param
 */
dvector laplace_approximation_calculator::get_uhat_quasi_newton_block_diagonal
  (const dvector& x,function_minimizer * pfmin)
{
  if (separable_function_difference)
  {
    delete separable_function_difference;
    separable_function_difference=0;
  }
#ifndef OPT_LIB
  assert(num_separable_calls > 0);
#endif

  separable_function_difference = new dvector(1,num_separable_calls);

  fmm** pfmc1 = new pfmm[static_cast<unsigned int>(num_separable_calls)];
  pfmc1--;
  ivector ishape(1,num_separable_calls);
  dvector gmax(1,num_separable_calls);
  gmax.initialize();

  for (int i=1;i<=num_separable_calls;i++)
  {
    int m=(*derindex)(i).indexmax();
    ishape(i)=m;
    if (m>0)
    {
    pfmc1[i] = new fmm(m);
    pfmc1[i]->iprint=0;
    pfmc1[i]->crit=inner_crit;
    pfmc1[i]->ireturn=0;
    pfmc1[i]->itn=0;
    pfmc1[i]->ifn=0;
    pfmc1[i]->ialph=0;
    pfmc1[i]->ihang=0;
    pfmc1[i]->ihflag=0;
    pfmc1[i]->maxfn=100;
    pfmc1[i]->gmax=1.e+100;
    pfmc1[i]->use_control_c=0;
    }
    else
    {
      pfmc1[i]= (fmm *)(0);
    }
  }
  dmatrix gg(1,num_separable_calls,1,ishape);
  dmatrix ggb(1,num_separable_calls,1,ishape);
  dmatrix uu(1,num_separable_calls,1,ishape);
  dmatrix uub(1,num_separable_calls,1,ishape);
  dvector ff(1,num_separable_calls);
  dvector ffb(1,num_separable_calls);
  ivector icon(1,num_separable_calls);
  icon.initialize();
  ffb=1.e+100;

  double f=0.0;
  double fb=1.e+100;
  dvector g(1,usize);
  dvector ub(1,usize);
  independent_variables u(1,usize);
  gradcalc(0,g);
  fmc1.itn=0;
  fmc1.ifn=0;
  fmc1.ireturn=0;
  initial_params::xinit(u);    // get the initial values into the
  fmc1.ialph=0;
  fmc1.ihang=0;
  fmc1.ihflag=0;

  if (init_switch)
  {
    u.initialize();
  }

  for (int ii=1;ii<=2;ii++)
  {
    // get the initial u into the uu's
    for (int i=1;i<=num_separable_calls;i++)
    {
      int m=(*derindex)(i).indexmax();
      for (int j=1;j<=m;j++)
      {
        uu(i,j)=u((*derindex)(i)(j));
      }
    }

#ifdef DIAG
    bool loop_flag = false;
    int loop_counter = 0;
#endif

    fmc1.dfn=1.e-2;
    dvariable pen=0.0;
    int converged=0;
    int initrun_flag=1;
    while (converged==0)
    {
#ifdef DIAG
      if (loop_flag) loop_counter++;
      if (loop_counter > 18)
      {
        cout << loop_counter;
      }
#endif
      if (!initrun_flag)
      {
        converged=1;
      }
      for (int i=1;i<=num_separable_calls;i++)
      {
        if (ishape(i)>0) //check to see if there are any active randoem effects
        {               // in this function call
          if (!icon(i))
          {
            independent_variables& uuu=*(independent_variables*)(&(uu(i)));
            (pfmc1[i])->fmin(ff[i],uuu,gg(i));
            gmax(i)=fabs(pfmc1[i]->gmax);
            if (!initrun_flag)
            {
              if (gmax(i)<1.e-4  || pfmc1[i]->ireturn<=0)
              {
                icon(i)=1;
              }
              else
              {
                converged=0;
              }
            }
          }
        }
      }
      initrun_flag=0;
      for (int i2=1;i2<=num_separable_calls;i2++)
      {
        int m=(*derindex)(i2).indexmax();
        for (int j=1;j<=m;j++)
        {
          u((*derindex)(i2)(j))=uu(i2,j);
        }
      }
      // put the
      //if (fmc1.ireturn>0)
      {
        dvariable vf=0.0;
        pen=initial_params::reset(dvar_vector(u));
        *objective_function_value::pobjfun=0.0;

        //num_separable_calls=0;

        pmin->inner_opt_flag=1;
        pfmin->AD_uf_inner();
        pmin->inner_opt_flag=0;

        if (saddlepointflag)
        {
          *objective_function_value::pobjfun*=-1.0;
        }
        if ( no_stuff==0 && quadratic_prior::get_num_quadratic_prior()>0)
        {
          quadratic_prior::get_M_calculations();
        }
        vf+=*objective_function_value::pobjfun;

        objective_function_value::fun_without_pen=value(vf);
        vf+=pen;

        gradcalc(usize,g);
        for (int i=1;i<=num_separable_calls;i++)
        {
          int m=(*derindex)(i).indexmax();
          for (int j=1;j<=m;j++)
          {
            gg(i,j)=g((*derindex)(i)(j));
          }
        }
        {
          ofstream ofs("l:/temp1.dat");
          ofs << g.indexmax() << " " << setprecision(15) << g << endl;
        }
        if (saddlepointflag==2)
        {
          ff[1]=-(*separable_function_difference)(1);
          for (int i=2;i<=num_separable_calls;i++)
          {
            ff[i]=-(*separable_function_difference)(i);
            //ff[i]=-(*separable_function_difference)(i)
             // +(*separable_function_difference)(i-1);

            if (ff[i] < ffb[i])
            {
              ffb[i]=ff[i];
              uub[i]=uu[i];
              ggb[i]=gg[i];
            }
          }
        }
        else
        {
          ff[1]=(*separable_function_difference)(1);
          for (int i=2;i<=num_separable_calls;i++)
          {
            ff[i]=(*separable_function_difference)(i);
            //ff[i]=(*separable_function_difference)(i)
             // -(*separable_function_difference)(i-1);

            if (ff[i] < ffb[i])
            {
              ffb[i]=ff[i];
              uub[i]=uu[i];
              ggb[i]=gg[i];
            }
          }
        }
        f=0.0;
        for (int i2=1;i2<=num_separable_calls;i2++)
        {
          f+=ff[i2];
        }
        if (f<fb)
        {
          fb=f;
          ub=u;
        }
      }
      u=ub;
    }
    double tmax=max(gmax);
    cout <<  " inner maxg = " << tmax << endl;

    if (tmax< 1.e-4) break;
  }
  fmc1.ireturn=0;
  fmc1.fbest=fb;
  gradient_structure::set_NO_DERIVATIVES();
  //num_separable_calls=0;
  pmin->inner_opt_flag=1;
  pfmin->AD_uf_inner();
  pmin->inner_opt_flag=0;
  if ( no_stuff==0 && quadratic_prior::get_num_quadratic_prior()>0)
  {
    quadratic_prior::get_M_calculations();
  }
  gradient_structure::set_YES_DERIVATIVES();
  for (int i=1;i<=num_separable_calls;i++)
  {
    if (pfmc1[i])
    {
      delete pfmc1[i];
    }
  }
  pfmc1++;
  delete [] pfmc1;
  pfmc1 = 0;
  return u;
}
Exemple #8
0
/* MDblock(MDp,X)
 * Update message digest buffer MDp->buffer using 16-word data block X.
 * Assumes all 16 words of X are full of data.
 * Does not update MDp->count.
 * This routine is not user-callable.
 */
static void
MDblock(MD4_CTX *MDp, unsigned char *Xb)
{
	register unsigned int tmp, A, B, C, D;
	unsigned int X[16];
	int i;

	for (i = 0; i < 16; ++i) {
		X[i] = Xb[0] + (Xb[1] << 8) + (Xb[2] << 16) + (Xb[3] << 24);
		Xb += 4;
	}

	A = MDp->buffer[0];
	B = MDp->buffer[1];
	C = MDp->buffer[2];
	D = MDp->buffer[3];
	/* Update the message digest buffer */
	ff(A, B, C, D,  0, fs1); /* Round 1 */
	ff(D, A, B, C,  1, fs2);
	ff(C, D, A, B,  2, fs3);
	ff(B, C, D, A,  3, fs4);
	ff(A, B, C, D,  4, fs1);
	ff(D, A, B, C,  5, fs2);
	ff(C, D, A, B,  6, fs3);
	ff(B, C, D, A,  7, fs4);
	ff(A, B, C, D,  8, fs1);
	ff(D, A, B, C,  9, fs2);
	ff(C, D, A, B, 10, fs3);
	ff(B, C, D, A, 11, fs4);
	ff(A, B, C, D, 12, fs1);
	ff(D, A, B, C, 13, fs2);
	ff(C, D, A, B, 14, fs3);
	ff(B, C, D, A, 15, fs4);
	gg(A, B, C, D,  0, gs1); /* Round 2 */
	gg(D, A, B, C,  4, gs2);
	gg(C, D, A, B,  8, gs3);
	gg(B, C, D, A, 12, gs4);
	gg(A, B, C, D,  1, gs1);
	gg(D, A, B, C,  5, gs2);
	gg(C, D, A, B,  9, gs3);
	gg(B, C, D, A, 13, gs4);
	gg(A, B, C, D,  2, gs1);
	gg(D, A, B, C,  6, gs2);
	gg(C, D, A, B, 10, gs3);
	gg(B, C, D, A, 14, gs4);
	gg(A, B, C, D,  3, gs1);
	gg(D, A, B, C,  7, gs2);
	gg(C, D, A, B, 11, gs3);
	gg(B, C, D, A, 15, gs4);
	hh(A, B, C, D,  0, hs1); /* Round 3 */
	hh(D, A, B, C,  8, hs2);
	hh(C, D, A, B,  4, hs3);
	hh(B, C, D, A, 12, hs4);
	hh(A, B, C, D,  2, hs1);
	hh(D, A, B, C, 10, hs2);
	hh(C, D, A, B,  6, hs3);
	hh(B, C, D, A, 14, hs4);
	hh(A, B, C, D,  1, hs1);
	hh(D, A, B, C,  9, hs2);
	hh(C, D, A, B,  5, hs3);
	hh(B, C, D, A, 13, hs4);
	hh(A, B, C, D,  3, hs1);
	hh(D, A, B, C, 11, hs2);
	hh(C, D, A, B,  7, hs3);
	hh(B, C, D, A, 15, hs4);
	MDp->buffer[0] += A;
	MDp->buffer[1] += B;
	MDp->buffer[2] += C;
	MDp->buffer[3] += D;
}
void DirectMultipleShootingInternal::init(){
  // Initialize the base classes
  OCPSolverInternal::init();

  // Create an integrator instance
  integratorCreator integrator_creator = getOption("integrator");
  integrator_ = integrator_creator(ffcn_,Function());
  if(hasSetOption("integrator_options")){
    integrator_.setOption(getOption("integrator_options"));
  }

  // Set t0 and tf
  integrator_.setOption("t0",0);
  integrator_.setOption("tf",tf_/nk_);
  integrator_.init();
  
  // Path constraints present?
  bool path_constraints = nh_>0;
  
  // Count the total number of NLP variables
  int NV = np_ + // global parameters
           nx_*(nk_+1) + // local state
           nu_*nk_; // local control
           
  // Declare variable vector for the NLP
  // The structure is as follows:
  // np x 1  (parameters)
  // ------
  // nx x 1  (states at time i=0)
  // nu x 1  (controls in interval i=0)
  // ------
  // nx x 1  (states at time i=1)
  // nu x 1  (controls in interval i=1)
  // ------
  // .....
  // ------
  // nx x 1  (states at time i=nk)
  
  MX V = MX::sym("V",NV);

  // Global parameters
  MX P = V(Slice(0,np_));

  // offset in the variable vector
  int v_offset=np_; 
  
  // Disretized variables for each shooting node
  vector<MX> X(nk_+1), U(nk_);
  for(int k=0; k<=nk_; ++k){ // interior nodes
    // Local state
    X[k] = V[Slice(v_offset,v_offset+nx_)];
    v_offset += nx_;
    
    // Variables below do not appear at the end point
    if(k==nk_) break;
    
    // Local control
    U[k] = V[Slice(v_offset,v_offset+nu_)];
    v_offset += nu_;
  }
  
  // Make sure that the size of the variable vector is consistent with the number of variables that we have referenced
  casadi_assert(v_offset==NV);

  // Input to the parallel integrator evaluation
  vector<vector<MX> > int_in(nk_);
  for(int k=0; k<nk_; ++k){
    int_in[k].resize(INTEGRATOR_NUM_IN);
    int_in[k][INTEGRATOR_P] = vertcat(P,U[k]);
    int_in[k][INTEGRATOR_X0] = X[k];
  }

  // Input to the parallel function evaluation
  vector<vector<MX> > fcn_in(nk_);
  for(int k=0; k<nk_; ++k){
    fcn_in[k].resize(DAE_NUM_IN);
    fcn_in[k][DAE_T] = (k*tf_)/nk_;
    fcn_in[k][DAE_P] = vertcat(P,U.at(k));
    fcn_in[k][DAE_X] = X[k];
  }

  // Options for the parallelizer
  Dictionary paropt;
  
  // Transmit parallelization mode
  if(hasSetOption("parallelization"))
    paropt["parallelization"] = getOption("parallelization");
  
  // Evaluate function in parallel
  vector<vector<MX> > pI_out = integrator_.callParallel(int_in,paropt);

  // Evaluate path constraints in parallel
  vector<vector<MX> > pC_out;
  if(path_constraints)
    pC_out = cfcn_.callParallel(fcn_in,paropt);
  
  //Constraint function
  vector<MX> gg(2*nk_);

  // Collect the outputs
  for(int k=0; k<nk_; ++k){
    //append continuity constraints
    gg[2*k] = pI_out[k][INTEGRATOR_XF] - X[k+1];
    
    // append the path constraints
    if(path_constraints)
      gg[2*k+1] = pC_out[k][0];
  }

  // Terminal constraints
  MX g = vertcat(gg);

  // Objective function
  MX f;
  if (mfcn_.getNumInputs()==1) {
    f = mfcn_(X.back()).front();
  } else {
    vector<MX> mfcn_argin(MAYER_NUM_IN); 
    mfcn_argin[MAYER_X] = X.back();
    mfcn_argin[MAYER_P] = P;
    f = mfcn_.call(mfcn_argin).front();
  }

  // NLP
  nlp_ = MXFunction(nlpIn("x",V),nlpOut("f",f,"g",g));
  nlp_.setOption("ad_mode","forward");
  nlp_.init();
  
  // Get the NLP creator function
  NLPSolverCreator nlp_solver_creator = getOption("nlp_solver");
  
  // Allocate an NLP solver
  nlp_solver_ = nlp_solver_creator(nlp_);
  
  // Pass user options
  if(hasSetOption("nlp_solver_options")){
    const Dictionary& nlp_solver_options = getOption("nlp_solver_options");
    nlp_solver_.setOption(nlp_solver_options);
  }
  
  // Initialize the solver
  nlp_solver_.init();
}
long preferences::downloadInstallPlugin (FXObject * sender, FXSelector sel, void *)
{
FXushort id=FXSELID(sel);
string file;

	if(id==ID_DOWNLOAD_INSTALL_CMD_PLUGIN)
	file=string(FXFile::getUserDirectory ("").text ()) +"/.openspace/plugins/cmddialog/commandPluginsList.txt";
	else
	file=string(FXFile::getUserDirectory ("").text ()) +"/.openspace/plugins/filelist/vfsPluginsList.txt";
	
	if(FXFile::exists(file.c_str()))
	{
	
	std::string line;
   	std::ifstream infile (file.c_str());

  		  while (std::getline (infile, line))
   		 {
		string name;
		string download;
		std::stringstream parser (line);	
		parser >> name;
		parser >> download;
		
		if(id==ID_DOWNLOAD_INSTALL_CMD_PLUGIN)
			if(name==availableCommandPluginsList->getItem(availableCommandPluginsList->getCurrentItem()).text())
			{
				if(name=="")
				return 0;
				
			string cmd="cd "+ string(FXFile::getUserDirectory ("").text ()) +"/.openspace/plugins/cmddialog/ && wget -N --connect-timeout=5  "+ download;
			system(cmd.c_str());

			
			 command_container ct=commandsMap[name];
   			 if(ct.name!="") // already exists
   			 return 0;
    
   			  ct.name=name;
  			  ct.rescan=false;
  			  ct.capture=false;
			  ct.type="PLUGIN";
   			  commandsCombo->appendItem(ct.name.c_str());
    			  commandsMap[name]=ct;   
 		          commandsCombo->setCurrentItem (commandsCombo->getNumItems () - 1);
   			  this->onCommandChange(NULL,0,NULL);
    
  			  fileTypeDefaultBox->appendItem(ct.name.c_str());
  			  additionalCommands->appendItem(ct.name.c_str());
			
			break;
			}
		else
			if(name==availableVfsPluginsList->getItem(availableVfsPluginsList->getCurrentItem()).text())
			{
				if(name=="")
				return 0;
			
			string cmd="cd "+ string(FXFile::getUserDirectory ("").text ()) +"/.openspace/plugins/filelist/ && wget -N --connect-timeout=5  "+ download;
			system(cmd.c_str());

			string plugin_path = FXFile::getUserDirectory ("").text ()+string("/.openspace/plugins/filelist/libfilelist")+ name+".so";

    
   			 	void *dllhandle = fxdllOpen (plugin_path.c_str ());
    				if (dllhandle)
    				{
	
				filelist_base *(*gg) (void);
				gg = (filelist_base * (*)(void)) fxdllSymbol (dllhandle, "get_filelist");
				filelist_base *fb = gg ();	
				
				vfs v=fb->setup();
				
				conf->removestring ("/OpenspaceConfig/filelist/"+name);
				conf->addstring("/OpenspaceConfig/filelist",name,"");
				conf->addstring("/OpenspaceConfig/filelist/"+name,"type",v.type);
				conf->addstring("/OpenspaceConfig/filelist/"+name,"properties","");
				
				
				
				vector <vfsheader_container>::iterator iter;
				
					for(iter=v.vfsheaders.begin();iter!=v.vfsheaders.end();iter++)
					{
					conf->addstring("/OpenspaceConfig/filelist/"+name+"/properties",iter->name,"");
					conf->addstring("/OpenspaceConfig/filelist/"+name+"/properties/"+ iter->name,"width",iter->width);
					conf->addstring("/OpenspaceConfig/filelist/"+name+"/properties/"+ iter->name,"type",iter->type);
					}
				vfsList->appendItem(name.c_str());
			
				}

			}	
			
		
		}
	}
Exemple #11
0
void	test_sorted_ops2(){
	bj_ostream& os = bj_out;
	os << "test_sorted_ops2" << bj_eol;

	unsigned long init_val = 10;
	tak_mak gg(init_val);

	row_long_t orig_rr;
	row_long_t tmp_rr;
	row_long_t to_red;
	row_long_t diff_rr;
	row_long_t shrd_rr;

	orig_rr.set_cap((SOR_MAX_VARS_TEST * 2) + 4);
	tmp_rr.set_cap((SOR_MAX_VARS_TEST * 2) + 4);
	to_red.set_cap((SOR_MAX_VARS_TEST * 2) + 4);
	diff_rr.set_cap((SOR_MAX_VARS_TEST * 2) + 4);
	shrd_rr.set_cap((SOR_MAX_VARS_TEST * 2) + 4);

	for(long aa = 0; aa < SOR_NUM_ASSIGS; aa++){
		orig_rr.clear();
		tmp_rr.clear();
		to_red.clear();
		diff_rr.clear();
		shrd_rr.clear();

		long num_vars = gg.gen_rand_int32_ie(2, SOR_MAX_VARS_TEST);

		gen_clause(gg, orig_rr, SOR_MAX_VARS_ROW, num_vars);

		orig_rr.copy_to(tmp_rr);
		long cc = 0;
		long num_red = gg.gen_rand_int32_ie(0, tmp_rr.size());
		for(cc = 0; cc < num_red; cc++){
			long idx_red = gg.gen_rand_int32_ie(0, tmp_rr.size());
			long alp = tmp_rr.swap_pop(idx_red);
			to_red.push(alp);
		}
		to_red.mix_sort(cmp_canon_ids);
		tmp_rr.mix_sort(cmp_canon_ids);

		orig_rr.copy_to(diff_rr);

		//os << "BEFORE" << bj_eol;
		//os << "rr1=" << rr1 << bj_eol;
		//os << "rr2=" << rr2 << bj_eol;
		//os << "to_adh=" << to_adh << bj_eol;
		//os << "to_red=" << to_red << bj_eol;

		diff_rr.sorted_set_reduce(to_red, cmp_canon_ids);

		bool eq_sh = diff_rr.equal_to(tmp_rr);
		if(! eq_sh){
			os << "FAILED=" << bj_eol;
			os << "orig_rr=" << orig_rr << bj_eol;
			os << "to_red=" << to_red << bj_eol;
			os << "diff_rr=" << diff_rr << bj_eol;
			os << "tmp_rr=" << tmp_rr << bj_eol;
		}
		TEST_CK(eq_sh);

		DBG(
			bool r_eq = false;
			cmp_is_sub cmp_val;

			cmp_val = cmp_sorted_rows<long>(to_red, orig_rr, cmp_canon_ids, r_eq);
			TEST_CK(cmp_val == k_lft_is_sub);

			cmp_val = cmp_sorted_rows<long>(diff_rr, orig_rr, cmp_canon_ids, r_eq);
			TEST_CK(cmp_val == k_lft_is_sub);
		);

		diff_rr.sorted_set_shared(shrd_rr, to_red, cmp_canon_ids);
		TEST_CK(shrd_rr.is_empty());
		
		//os << "AFTER" << bj_eol;
		//os << "rr1=" << rr1 << bj_eol;
		//os << "rr2=" << rr2 << bj_eol;
		//getchar();
		

		os << CARRIAGE_RETURN << aa;
		os.flush();
		//os << "ALL_OK" << bj_eol;
	}
Exemple #12
0
/***********************************************************************************************
* 函数名称:void md5_ProChunk()
* 函数功能:md5分组处理
***********************************************************************************************/
void md5_ProChunk()
{
	md5_a=md5_data[0];
	md5_b=md5_data[1];
	md5_c=md5_data[2];
	md5_d=md5_data[3];
	
	/* 第一轮运算 */
	ff(md5_x[ 0], S11, 0xd76aa478); /* 1 */
	ff(md5_x[ 1], S12, 0xe8c7b756); /* 2 */
	ff(md5_x[ 2], S13, 0x242070db); /* 3 */
	ff(md5_x[ 3], S14, 0xc1bdceee); /* 4 */
	ff(md5_x[ 4], S11, 0xf57c0faf); /* 5 */
	ff(md5_x[ 5], S12, 0x4787c62a); /* 6 */
	ff(md5_x[ 6], S13, 0xa8304613); /* 7 */
	ff(md5_x[ 7], S14, 0xfd469501); /* 8 */
	ff(md5_x[ 8], S11, 0x698098d8); /* 9 */
	ff(md5_x[ 9], S12, 0x8b44f7af); /* 10 */
	ff(md5_x[10], S13, 0xffff5bb1); /* 11 */
	ff(md5_x[11], S14, 0x895cd7be); /* 12 */
	ff(md5_x[12], S11, 0x6b901122); /* 13 */
	ff(md5_x[13], S12, 0xfd987193); /* 14 */
	ff(md5_x[14], S13, 0xa679438e); /* 15 */
	ff(md5_x[15], S14, 0x49b40821); /* 16 */
	
	/* 第二轮运算 */
	gg(md5_x[ 1], S21, 0xf61e2562); /* 17 */
	gg(md5_x[ 6], S22, 0xc040b340); /* 18 */
	gg(md5_x[11], S23, 0x265e5a51); /* 19 */
	gg(md5_x[ 0], S24, 0xe9b6c7aa); /* 20 */
	gg(md5_x[ 5], S21, 0xd62f105d); /* 21 */
	gg(md5_x[10], S22,  0x2441453); /* 22 */
	gg(md5_x[15], S23, 0xd8a1e681); /* 23 */
	gg(md5_x[ 4], S24, 0xe7d3fbc8); /* 24 */
	gg(md5_x[ 9], S21, 0x21e1cde6); /* 25 */
	gg(md5_x[14], S22, 0xc33707d6); /* 26 */
	gg(md5_x[ 3], S23, 0xf4d50d87); /* 27 */
	gg(md5_x[ 8], S24, 0x455a14ed); /* 28 */
	gg(md5_x[13], S21, 0xa9e3e905); /* 29 */
	gg(md5_x[ 2], S22, 0xfcefa3f8); /* 30 */
	gg(md5_x[ 7], S23, 0x676f02d9); /* 31 */
	gg(md5_x[12], S24, 0x8d2a4c8a); /* 32 */
	
	/* 第三轮运算 */
	hh(md5_x[ 5], S31, 0xfffa3942); /* 33 */
	hh(md5_x[ 8], S32, 0x8771f681); /* 34 */
	hh(md5_x[11], S33, 0x6d9d6122); /* 35 */
	hh(md5_x[14], S34, 0xfde5380c); /* 36 */
	hh(md5_x[ 1], S31, 0xa4beea44); /* 37 */
	hh(md5_x[ 4], S32, 0x4bdecfa9); /* 38 */
	hh(md5_x[ 7], S33, 0xf6bb4b60); /* 39 */
	hh(md5_x[10], S34, 0xbebfbc70); /* 40 */
	hh(md5_x[13], S31, 0x289b7ec6); /* 41 */
	hh(md5_x[ 0], S32, 0xeaa127fa); /* 42 */
	hh(md5_x[ 3], S33, 0xd4ef3085); /* 43 */
	hh(md5_x[ 6], S34,  0x4881d05); /* 44 */
	hh(md5_x[ 9], S31, 0xd9d4d039); /* 45 */
	hh(md5_x[12], S32, 0xe6db99e5); /* 46 */
	hh(md5_x[15], S33, 0x1fa27cf8); /* 47 */ 
	hh(md5_x[ 2], S34, 0xc4ac5665); /*48 */
	
	/* 第四轮运算 */
	ii(md5_x[ 0], S41, 0xf4292244); /* 49 */
	ii(md5_x[ 7], S42, 0x432aff97); /* 50 */
	ii(md5_x[14], S43, 0xab9423a7); /* 51 */
	ii(md5_x[ 5], S44, 0xfc93a039); /* 52 */
	ii(md5_x[12], S41, 0x655b59c3); /* 53 */
	ii(md5_x[ 3], S42, 0x8f0ccc92); /* 54 */
	ii(md5_x[10], S43, 0xffeff47d); /* 55 */
	ii(md5_x[ 1], S44, 0x85845dd1); /* 56 */
	ii(md5_x[ 8], S41, 0x6fa87e4f); /* 57 */
	ii(md5_x[15], S42, 0xfe2ce6e0); /* 58 */
	ii(md5_x[ 6], S43, 0xa3014314); /* 59 */
	ii(md5_x[13], S44, 0x4e0811a1); /* 60 */
	ii(md5_x[ 4], S41, 0xf7537e82); /* 61 */
	ii(md5_x[11], S42, 0xbd3af235); /* 62 */
	ii(md5_x[ 2], S43, 0x2ad7d2bb); /* 63 */
	ii(md5_x[ 9], S44, 0xeb86d391); /* 64 */
	
	md5_data[0] += md5_a;
	md5_data[1] += md5_b;
	md5_data[2] += md5_c;
	md5_data[3] += md5_d;
}
Exemple #13
0
void CZSingleton::SetDrop()
{
	CString gg(AfxGetApp()->m_pszExeName);
	::SetProp(AfxGetApp()->GetMainWnd()->GetSafeHwnd(), gg, (HANDLE)1);
	gg.Empty();
}
Exemple #14
0
EvolDC1Buras::EvolDC1Buras(unsigned int dim_i, schemes scheme, orders order, const StandardModel& model) 
:           RGEvolutor(dim_i, scheme, order), model(model),
            v(dim_i,0.), vi(dim_i,0.), js(dim_i,0.), h(dim_i,0.), gg(dim_i,0.), s_s(dim_i,0.),
            jssv(dim_i,0.), jss(dim_i,0.), jv(dim_i,0.), vij(dim_i,0.), e(dim_i,0.), dim(dim_i)  
{
    
    /*magic numbers a & b */
    
    for(int L=2; L>-1; L--){
        
    /* L=2 --> u,d,s,c (nf=4)  L=1 --> u,d,s,c,b (nf=5) L=0 --> u,d,s,c,b,t (nf=6)*/
        
    nu = L;  nd = L;
    if(L == 1){nd = 3; nu = 2;} 
    if(L == 0){nd = 3; nu = 3;}
    
    AnomalousDimension_DC1_Buras(LO,nu,nd).transpose().eigensystem(v,e);
    vi = v.inverse();
    for(unsigned int i = 0; i < dim; i++){
       a[L][i] = e(i).real();
       for (unsigned int j = 0; j < dim; j++) {
           for (unsigned int k = 0; k < dim; k++)  {
                b[L][i][j][k] = v(i, k).real() * vi(k, j).real();
               }
           }
       }
    
    // LO evolutor in the standard basis
    
    gg = vi * AnomalousDimension_DC1_Buras(NLO,nu,nd).transpose() * v;
    double b0 = model.Beta0(6-L);
    double b1 = model.Beta1(6-L);
    for (unsigned int i = 0; i < dim; i++){
        for (unsigned int j = 0; j < dim; j++){
            s_s.assign( i, j, (b1 / b0) * (i==j) * e(i).real() - gg(i,j));    
            if(fabs(e(i).real() - e(j).real() + 2. * b0)>0.00000000001){
                h.assign( i, j, s_s(i,j) / (2. * b0 + e(i) - e(j)));
                }
            }
        }
    js = v * h * vi;
    jv = js * v;
    vij = vi * js;
    jss = v * s_s * vi;
    jssv = jss * v;        
    for (unsigned int i = 0; i < dim; i++){
        for (unsigned int j = 0; j < dim; j++){
            if(fabs(e(i).real() - e(j).real() + 2. * b0) > 0.00000000001){
                for(unsigned int k = 0; k < dim; k++){
                        c[L][i][j][k] = jv(i, k).real() * vi(k, j).real();
                        d[L][i][j][k] = -v(i, k).real() * vij(k, j).real();
                        }
                    }
            else{    
                for(unsigned int k = 0; k < dim; k++){
                   c[L][i][j][k] = (1./(2. * b0)) * jssv(i, k).real() * vi(k, j).real();
                   d[L][i][j][k] = 0.;
                   }   
                }
            }
        }
    }
}
Exemple #15
0
void Md5::transformBlock(const uint8_t *block)
{
	uint32_t a = a0, b = b0, c = c0, d = d0, m[16];
	const uint8_t *p = block;

	for (int i = 0; i < 16; ++i)
	{
		uint8_t b0 = p[0];
		uint8_t b1 = p[1];
		uint8_t b2 = p[2];
		uint8_t b3 = p[3];
		p += 4;
		m[i] = Convert::combineQuadBytes(b0, b1, b2, b3);
	}

	ff(a, b, c, d, m[ 0], S11, (uint32_t)K11);
	ff(d, a, b, c, m[ 1], S12, (uint32_t)K12);
	ff(c, d, a, b, m[ 2], S13, (uint32_t)K13);
	ff(b, c, d, a, m[ 3], S14, (uint32_t)K14);
	ff(a, b, c, d, m[ 4], S11, (uint32_t)K15);
	ff(d, a, b, c, m[ 5], S12, (uint32_t)K16);
	ff(c, d, a, b, m[ 6], S13, (uint32_t)K17);
	ff(b, c, d, a, m[ 7], S14, (uint32_t)K18);
	ff(a, b, c, d, m[ 8], S11, (uint32_t)K19);
	ff(d, a, b, c, m[ 9], S12, (uint32_t)K110);
	ff(c, d, a, b, m[10], S13, (uint32_t)K111);
	ff(b, c, d, a, m[11], S14, (uint32_t)K112);
	ff(a, b, c, d, m[12], S11, (uint32_t)K113);
	ff(d, a, b, c, m[13], S12, (uint32_t)K114);
	ff(c, d, a, b, m[14], S13, (uint32_t)K115);
	ff(b, c, d, a, m[15], S14, (uint32_t)K116);

	gg(a, b, c, d, m[ 1], S21, (uint32_t)K21);
	gg(d, a, b, c, m[ 6], S22, (uint32_t)K22);
	gg(c, d, a, b, m[11], S23, (uint32_t)K23);
	gg(b, c, d, a, m[ 0], S24, (uint32_t)K24);
	gg(a, b, c, d, m[ 5], S21, (uint32_t)K25);
	gg(d, a, b, c, m[10], S22, (uint32_t)K26);
	gg(c, d, a, b, m[15], S23, (uint32_t)K27);
	gg(b, c, d, a, m[ 4], S24, (uint32_t)K28);
	gg(a, b, c, d, m[ 9], S21, (uint32_t)K29);
	gg(d, a, b, c, m[14], S22, (uint32_t)K210);
	gg(c, d, a, b, m[ 3], S23, (uint32_t)K211);
	gg(b, c, d, a, m[ 8], S24, (uint32_t)K212);
	gg(a, b, c, d, m[13], S21, (uint32_t)K213);
	gg(d, a, b, c, m[ 2], S22, (uint32_t)K214);
	gg(c, d, a, b, m[ 7], S23, (uint32_t)K215);
	gg(b, c, d, a, m[12], S24, (uint32_t)K216);

	hh(a, b, c, d, m[ 5], S31, (uint32_t)K31);
	hh(d, a, b, c, m[ 8], S32, (uint32_t)K32);
	hh(c, d, a, b, m[11], S33, (uint32_t)K33);
	hh(b, c, d, a, m[14], S34, (uint32_t)K34);
	hh(a, b, c, d, m[ 1], S31, (uint32_t)K35);
	hh(d, a, b, c, m[ 4], S32, (uint32_t)K36);
	hh(c, d, a, b, m[ 7], S33, (uint32_t)K37);
	hh(b, c, d, a, m[10], S34, (uint32_t)K38);
	hh(a, b, c, d, m[13], S31, (uint32_t)K39);
	hh(d, a, b, c, m[ 0], S32, (uint32_t)K310);
	hh(c, d, a, b, m[ 3], S33, (uint32_t)K311);
	hh(b, c, d, a, m[ 6], S34, (uint32_t)K312);
	hh(a, b, c, d, m[ 9], S31, (uint32_t)K313);
	hh(d, a, b, c, m[12], S32, (uint32_t)K314);
	hh(c, d, a, b, m[15], S33, (uint32_t)K315);
	hh(b, c, d, a, m[ 2], S34, (uint32_t)K316);

	ii(a, b, c, d, m[ 0], S41, (uint32_t)K41);
	ii(d, a, b, c, m[ 7], S42, (uint32_t)K42);
	ii(c, d, a, b, m[14], S43, (uint32_t)K43);
	ii(b, c, d, a, m[ 5], S44, (uint32_t)K44);
	ii(a, b, c, d, m[12], S41, (uint32_t)K45);
	ii(d, a, b, c, m[ 3], S42, (uint32_t)K46);
	ii(c, d, a, b, m[10], S43, (uint32_t)K47);
	ii(b, c, d, a, m[ 1], S44, (uint32_t)K48);
	ii(a, b, c, d, m[ 8], S41, (uint32_t)K49);
	ii(d, a, b, c, m[15], S42, (uint32_t)K410);
	ii(c, d, a, b, m[ 6], S43, (uint32_t)K411);
	ii(b, c, d, a, m[13], S44, (uint32_t)K412);
	ii(a, b, c, d, m[ 4], S41, (uint32_t)K413);
	ii(d, a, b, c, m[11], S42, (uint32_t)K414);
	ii(c, d, a, b, m[ 2], S43, (uint32_t)K415);
	ii(b, c, d, a, m[ 9], S44, (uint32_t)K416);

	a0 += a; b0 += b; c0 += c; d0 += d;
}
Exemple #16
0
void getlist_active(SERVER *server, int sock, char *glist)
{
	char group[512], end[11], begin[11], mode[2];
	int num = 0;
	int i;
	int ng;

	sprintf(buf, "MODE READER\r\n");

	if ( write_socket(sock, buf, strlen(buf), server->Timeout) == -1 ) 
		die("Cant write to server");

	if ( fgetsrn(buf, BUFSIZE, sock) == NULL )
		die("Cant read mode reader response");

	sprintf(buf, "LIST active %s\r\n", glist);

	if ( write_socket(sock, buf, strlen(buf), server->Timeout) == -1 ) 
		die("Cant write to server");

	if ( fgetsrn(buf, BUFSIZE, sock) == NULL )
		die("Cant read list active response");

	if ( atoi(buf) != 215 )
		die("Invalid response from server: %s", buf);

	ng = master->numgroups;
	while ( 1 )
	{
		if ( fgetsrn(buf, BUFSIZE, sock) == NULL )
			die("Cant read active file");

		if ( buf[0] == '.' && buf[1] == '\r' )
			break;

		if ( sscanf(buf, "%511s %10s %10s %2s", group, end, begin, mode) != 4 )
		{
			info("Invalid active entry: %s %d %d", buf, buf[0], buf[1]);
		}
		else
		{
			if ( strlen(group) >= MAX_GROUP )
			{
				info("Skipping too long groupname: %s", group);
				continue;
			}

			if ( gg(group, ng) == NULL )
			{
				if ( master->numgroups == MAX_GROUPS )
					die("Too many newsgroups, increase MAX_GROUPS in nntpd.h");

				i=master->numgroups;
				strncpy((groups+i)->newsgroup, group, 191);
				strncpy((groups+i)->server, server->Name, 31);	
				(groups+i)->hi = atol(end);
				(groups+i)->lo = atol(begin);
				(groups+i)->mode = mode[0];
				(groups+i)->times = 0;

				master->numgroups++;
				num++;
			}
		}
	}

	qsort(groups, master->numgroups, sizeof(ACTIVE), cmp_active);

	printf("Loaded %d groups, %d total\n", num, master->numgroups);
}
Exemple #17
0
void getSpectrumPP05(const char *pid)
{
  gStyle->SetOptStat(0);
  gStyle->SetOptFit(0);

  gStyle->SetErrorX(0);



  bool subtractNEUTRONS=kTRUE;

  //neutron data:
  //hadron data for Levy function, nucl-ex/0601033:
  //-->  d^2N/(2*pi*pT*N*dpT*dy) = B/((1+((mT - m0)/nT))^n)
  // {p-dAu; pbar-dAu; p-pp; pbar-pp} and m0 = m_neutron = 1.0 GeV.
  double B[]={0.3,0.23,0.072,0.061};//->[0]
  //double eB[]={0.01,0.01,0.005,0.005};
  double T[]={0.205,0.215,0.179,0.173};//->[1]
  //double eT[]={0.004,0.005,0.006,0.006};
  double n[]={11.00,12.55,10.87,10.49};//->[2]
  //double en[]={0.29,0.41,0.43,0.40};
  double BR=35.8/63.9;//->p + pi- (63.9%) : ->n + pi0 (35.8%)
  double c_feeddown=0.8+0.2*BR;
  double CPVloss=0.98;//for minbias
  TF1 *f_nbar=new TF1("f_nbar","[3]*[4]*[0]/pow((1.+(sqrt(x*x+1.) - 1.)/([1]*[2])),[2])",0.,15.);
  f_nbar->SetParameters(B[3],T[3],n[3],c_feeddown,CPVloss);

  //get direct gammas pQCD:
  ifstream pQCDphotons("./datapoints/pQCD_Werner/rhic_cteq6_gamma_inv_sc1.dat");
  float ppx[100];
  float ppy[100];
  Int_t iii=0;
  cout<<"pqcd photons:"<<endl;
  while(iii<28){
    if(!pQCDphotons.good()) break;
    float dummy=0.;
    pQCDphotons>>ppx[iii]>>dummy>>dummy>>ppy[iii];
    ppy[iii]*=1.e-09;//convert to mb
    iii++;
  }
  TGraph *g_dirgamma=new TGraph(iii,ppx,ppy);
  //get direct gammas pQCD: scale 0.5*pT
  ifstream pQCDphotons05("./datapoints/pQCD_Werner/rhic_cteq6_gamma_inv_sc05.dat");
  float ppx05[100];
  float ppy05[100];
  Int_t iii05=0;
  while(iii05<28){
    if(!pQCDphotons05.good()) break;
    float dummy=0.;
    pQCDphotons05>>ppx05[iii05]>>dummy>>dummy>>ppy05[iii05];
    ppy05[iii05]*=1.e-09;//convert to mb
    iii05++;
  }
  TGraph *g_dirgamma05=new TGraph(iii05,ppx05,ppy05);

  //get direct gammas pQCD: scale 2*pT
  ifstream pQCDphotons2("./datapoints/pQCD_Werner/rhic_cteq6_gamma_inv_sc2.dat");
  float ppx2[100];
  float ppy2[100];
  Int_t iii2=0;
  while(iii2<28){
    if(!pQCDphotons2.good()) break;
    float dummy=0.;
    pQCDphotons2>>ppx2[iii2]>>dummy>>dummy>>ppy2[iii2];
    ppy2[iii2]*=1.e-09;//convert to mb
    iii2++;
  }
  TGraph *g_dirgamma2=new TGraph(iii2,ppx2,ppy2);
  //get phenix pions in pp
  ifstream phenix("./datapoints/phenix_xsec_pp.dat");
  float phex[100];
  float phey[100];
  Int_t iphe=0;
  while(iphe<16){
    if(!phenix.good()) break;
    phenix>>phex[iphe]>>phey[iphe];
    //is in mb already!!
    iphe++;
  }
  TGraphErrors *phenix_pp=new TGraphErrors(iphe,phex,phey);
  phenix_pp->SetMarkerStyle(24);
  phenix_pp->SetLineWidth(6);
  phenix_pp->SetName("phenix_pp");

  //frank's spin2006 pions:
  ifstream frank("./datapoints/frank_pp05_new.dat");
  float frx[100];
  float fry[100];
  float frex[100];
  float frey[100];
  Int_t ifr=0;
  while(ifr<12){
    if(!frank.good()) break;
    frank>>frx[ifr]>>fry[ifr]>>frey[ifr];
    frex[ifr]=0.;
    ifr++;
  }
  TGraphErrors *frank_pp=new TGraphErrors(ifr,frx,fry,frex,frey);
  frank_pp->SetMarkerStyle(25);
  frank_pp->SetMarkerColor(4);
  frank_pp->SetName("frank_pp");

  //sasha's pions:
  float x_pp2005_sasha[]={1.20358,1.70592,2.21238,2.71916,3.4032,4.4224,5.43571,6.44468,7.45056,8.83794,10.8659,12.8831,15.2692 };
  float xe_pp2005_sasha[]={0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.};
  float y_pp2005_sasha[]={0.212971,0.0337464,0.00811345,0.00248195,0.000467495,6.37683e-05,1.4487e-05,3.67539e-06,1.26723e-06,3.3676e-07,8.01941e-08,1.93813e-08,5.56059e-09};
  float ye_pp2005_sasha[]={0.00463771,0.000949529,0.000323778,0.000139023,3.68181e-05,7.61527e-07,2.28359e-07,9.19064e-08,4.93116e-08,8.16844e-09,3.66273e-09,1.75057e-09,7.36722e-10};

  TGraphErrors *sasha_pp05=new TGraphErrors(13,x_pp2005_sasha,y_pp2005_sasha,xe_pp2005_sasha,ye_pp2005_sasha);
  sasha_pp05->SetMarkerStyle(8);
  sasha_pp05->SetMarkerColor(TColor::GetColor(8,80,8));
  sasha_pp05->SetName("sasha_pp05");

  //get pions KKP  scale pT
  ifstream pQCDpions("./datapoints/pQCD_Werner/klaus_pi0inv_200_kkp_1.dat");
  float pionx[100];
  float piony[100];
  Int_t ipion=0;
  while(ipion<28){
    if(!pQCDpions.good()) break;
    pQCDpions>>pionx[ipion]>>piony[ipion];
    piony[ipion]*=1.e-09;//convert to mb
    ipion++;
  }
  TGraphErrors *kkp=new TGraphErrors(ipion,pionx,piony);
  kkp->SetLineColor(54);
  kkp->SetName("kkp");

  //get pions KKP  scale 0.5*pT
  ifstream pQCDpions05("./datapoints/pQCD_Werner/klaus_pi0inv_200_kkp_05.dat");
  float pionx05[100];
  float piony05[100];
  Int_t ipion05=0;
  while(ipion05<28){
    if(!pQCDpions05.good()) break;
    pQCDpions05>>pionx05[ipion05]>>piony05[ipion05];
    piony05[ipion05]*=1.e-09;//convert to mb
    ipion05++;
  }
  TGraphErrors *kkp05=new TGraphErrors(ipion05,pionx05,piony05);
  kkp05->SetLineStyle(2);
  kkp05->SetLineColor(54);
  kkp05->SetName("kkp05");

  //get pions KKP  scale 2*pT
  ifstream pQCDpions2("./datapoints/pQCD_Werner/klaus_pi0inv_200_kkp_2.dat");
  float pionx2[100];
  float piony2[100];
  Int_t ipion2=0;
  while(ipion2<28){
    if(!pQCDpions2.good()) break;
    pQCDpions2>>pionx2[ipion2]>>piony2[ipion2];
    piony2[ipion2]*=1.e-09;//convert to mb
    ipion2++;
  }
  TGraphErrors *kkp2=new TGraphErrors(ipion2,pionx2,piony2);
  kkp2->SetLineStyle(2);
  kkp2->SetLineColor(54);
  kkp2->SetName("kkp2");

  TFile *f_decaybg=new TFile("~/MyDecay/gammaDecayPPSum.root","OPEN");
  TH1F *h_decaybg=(TH1F*)f_decaybg->Get("gamma");
  TH1F *h_decaypion=(TH1F*)f_decaybg->Get("gamma_pion");
  TF1 *fit_decay=new TF1("fit_decay","[0]/pow(x,[1])+[2]",.3,15.);
  TF1 *fit_piondecay=new TF1(*fit_decay);
  fit_decay->SetParameters(1.,1.,.5);
  fit_piondecay->SetParameters(1.,1.,.5);
  h_decaybg->Fit(fit_decay,"R0Q");
  h_decaypion->Fit(fit_piondecay,"R0Q");

  //take ratio gamma_direct/pion and divide by gamma/pi and then +1:
  for(Int_t i=0;i<iii;i++){
    ppy[i]=ppy[i]/piony[i];
    ppy[i]=ppy[i]/fit_decay->Eval(ppx[i]);
    ppy[i]+=1.;
    ppy05[i]=ppy05[i]/piony05[i];
    ppy05[i]=ppy05[i]/fit_decay->Eval(ppx05[i]);
    ppy05[i]+=1.;
    ppy2[i]=ppy2[i]/piony2[i];
    ppy2[i]=ppy2[i]/fit_decay->Eval(ppx2[i]);
    ppy2[i]+=1.;
  }
  TGraphErrors *g_photonpqcd=new TGraphErrors(iii,ppx,ppy);
  g_photonpqcd->SetName("g_photonpqcd");
  TGraphErrors *g_photonpqcd05=new TGraphErrors(iii05,ppx05,ppy05);
  g_photonpqcd05->SetName("g_photonpqcd05");
  TGraphErrors *g_photonpqcd2=new TGraphErrors(iii2,ppx2,ppy2);
  g_photonpqcd2->SetName("g_photonpqcd2");

  //set outputfiles
  TString dir("/star/u/russcher/gamma/analysis/output/pp05/");
  dir.Append(pid);
  dir.Append("/");
  dir.Append(pid);
  TString psout=dir;
  TString psout_eta=dir;
  TString psout2=dir;
  TString psout3=dir;
  TString eFile=dir;
  TString eFileGamma=dir;
  TString pi0File=dir;
  TString nbarFile=dir;
  TString nbarOut=dir;
  
  eFile.Append("pion_eff.root");
  eFileGamma.Append("gamma_eff.root");
  pi0File.Append("pi0_pp05.root");
  nbarFile.Append("antineutron_eff.root");
  nbarOut.Append("nbar_contam.ps");
  psout2.Append("correctedspec.ps");
  psout_eta.Append("/dev/null");
  psout.Append("invmassplots.ps");

  //load *.so
  gSystem->Load("$HOME/MyEvent/MyEvent");
  gSystem->Load("$HOME/gamma/analysis/lib/AnaCuts");
  gSystem->Load("$HOME/gamma/analysis/lib/EventMixer");
  gSystem->Load("$HOME/gamma/analysis/lib/Pi0Analysis");


  AnaCuts *cuts=new AnaCuts("pp05");

  //get inv mass hists
  TFile f(pi0File.Data(),"OPEN");
  TH2F *h_mb=new TH2F(*h_minvMB);
  TH2F *h_ht1=new TH2F(*h_minvHT1);
  TH2F *h_ht2=new TH2F(*h_minvHT2);
  TH1F *h_ev=new TH1F(*h_events);

  //get anti-neutron
  TFile *file_nbar=new TFile(nbarFile,"OPEN");
  TH1F *h_nbarEffMB=new TH1F(*h_effMB);
  h_nbarEffMB->Sumw2();
  TH1F *h_nbarEffHT1=new TH1F(*h_effHT1);
  h_nbarEffHT1->Sumw2();
  TH1F *h_nbarEffHT2=new TH1F(*h_effHT2);
  h_nbarEffHT2->Sumw2();

  //get prescales
  int trigger=0;
  Int_t numberOfMB=0;
  Int_t numberOfHT1=0;
  Int_t numberOfHT2=0;
  for(Int_t i=1;i<=h_ev->GetNbinsX();i++)
    {
      trigger=(Int_t)h_ev->GetBinCenter(i);
      if(trigger&1) numberOfMB+=(Int_t)h_ev->GetBinContent(i);
      if(trigger&2) numberOfHT1+=(Int_t)h_ev->GetBinContent(i);
      if(trigger&4) numberOfHT2+=(Int_t)h_ev->GetBinContent(i);
    }

  cout<<"number of mb: "<<numberOfMB<<endl;
  //numberOfMB/=0.63;
  //cout<<"nmb after 62% vertex eff.: "<<numberOfMB<<endl;

  float psMB=32742;
  float psHT1=3.89;
  float psHT2=1.;

  //mb events for hightower:
  float nMBwithHT=328871;

  //get efficiencies+acceptance
  TFile g(eFile.Data(),"OPEN");
  TH1F *h_emb=new TH1F(*h_effMB);
  TH1F *h_eht1=new TH1F(*h_effHT1);
  TH1F *h_eht2=new TH1F(*h_effHT2);

  //bin corrections
  TFile binf("~/BinWidth/bincorrectionsPP.root","OPEN"); 
  TH1F *h_binmb=new TH1F(*h4mb);
  TH1F *h_binht1=new TH1F(*h4ht1);
  TH1F *h_binht2=new TH1F(*h4ht2);
  h_binmb->Sumw2();
  h_binht1->Sumw2();
  h_binht2->Sumw2();
  for(Int_t i=1;i<=h_binmb->GetNbinsX();i++) h_binmb->SetBinError(i,0);
  for(Int_t i=1;i<=h_binht1->GetNbinsX();i++) h_binht1->SetBinError(i,0);
  for(Int_t i=1;i<=h_binht2->GetNbinsX();i++) h_binht2->SetBinError(i,0);

  //corrections, all multiplicative, in case of
  //pions:
  TF1 *pion_cpv_corrMB=new TF1("pion_cpv_corrMB","1./(1.-0.01*(0.3+0.0*x))",0.,15.);
  TF1 *pion_cpv_corrHT1=new TF1("pion_cpv_corrHT1","1./(1.-0.01*(-0.1+0.16*x))",0.,15.);
  TF1 *pion_cpv_corrHT2=new TF1("pion_cpv_corrHT2","1./(1.-0.01*(-0.2+0.18*x))",0.,15.);
  //photons:
  TF1 *gamma_cpv_corrMB=new TF1("gamma_cpv_corrMB","1./(1.-0.01*(2.8+0.0*x))",0.,15.);
  TF1 *gamma_cpv_corrHT1=new TF1("gamma_cpv_corrHT1","1./(1.-0.01*(0.2+1.1*x))",0.,15.);
  TF1 *gamma_cpv_corrHT2=new TF1("gamma_cpv_corrHT2","1./(1.-0.01*(0.4+1.1*x))",0.,15.);
  TF1 *gamma_cont_corrMB=new TF1("gamma_cont_corrMB","0.985",0.,15.);
  TF1 *gamma_cont_corrHT1=new TF1("gamma_cont_corrHT1","0.98",0.,15.);
  TF1 *gamma_cont_corrHT2=new TF1("gamma_cont_corrHT2","0.96",0.,15.);

  //missing material
  //pions:
  TF1 *pion_conv_corrMB=new TF1("pion_conv_corrMB","1.1",0.,15.);
  TF1 *pion_conv_corrHT1=new TF1("pion_conv_corrHT1","1.1",0.,15.);
  TF1 *pion_conv_corrHT2=new TF1("pion_conv_corrHT2","1.1",0.,15.);
  //photons:
  TF1 *gamma_conv_corrMB=new TF1("gamma_conv_corrMB","1.05",0.,15.);
  TF1 *gamma_conv_corrHT1=new TF1("gamma_conv_corrHT1","1.05",0.,15.);
  TF1 *gamma_conv_corrHT2=new TF1("gamma_conv_corrHT2","1.05",0.,15.);


  //get yield
  Pi0Analysis *pi0=new Pi0Analysis(psout.Data(),psout_eta.Data(),"pp05");
  pi0->init("/dev/null");
  TH1F *pionYieldMB=new TH1F(*pi0->getYield(h_mb,"mb"));
  TH1F *pionYieldHT1=new TH1F(*pi0->getYield(h_ht1,"ht1"));
  TH1F *pionYieldHT2=new TH1F(*pi0->getYield(h_ht2,"ht2"));
  pi0->storeCanvases((dir+"canvases.root").Data());


  cout<<"***************************************"<<endl;
  cout<<"got yield, dividing by rapidity bite!!!"<<endl;
  float dy_gamma=cuts->rapidityMaxCUT - cuts->rapidityMinCUT;
  float dy_pion=cuts->rapPionMaxCUT - cuts->rapPionMinCUT;
  cout<<"***************************************"<<endl;
  cout<<endl;
  cout<<"    pion bite is "<<dy_pion<<endl;
  cout<<"    gamma bite is "<<dy_gamma<<endl;
  cout<<endl;
  cout<<"***************************************"<<endl;

  pionYieldMB->Scale(1./dy_pion);
  pionYieldHT1->Scale(1./dy_pion);
  pionYieldHT2->Scale(1./dy_pion);

  //set yield to zero
  /*
  for(Int_t i=0;i<pionYieldHT2->GetNbinsX();i++)
    {
      if(i<1)
	{
	  pionYieldMB->SetBinContent(i+1,0);
	  pionYieldMB->SetBinError(i+1,0);
	}
      if(i<4)
        {
          pionYieldHT1->SetBinContent(i+1,0);
          pionYieldHT1->SetBinError(i+1,0);
	}
      if(i>12)
	{
	  pionYieldHT1->SetBinContent(i+1,0);
          pionYieldHT1->SetBinError(i+1,0);
	}
      if(i<6) 
	{
	  pionYieldHT2->SetBinContent(i+1,0);
          pionYieldHT2->SetBinError(i+1,0);
	}
    }
  */

  //set colors:
  pionYieldMB->SetMarkerStyle(8);
  pionYieldMB->SetMarkerSize(1.0);
  pionYieldHT1->SetMarkerStyle(8);
  pionYieldHT1->SetMarkerSize(1.0); 
  pionYieldHT1->SetMarkerColor(4);
  pionYieldHT2->SetMarkerStyle(8);
  pionYieldHT2->SetMarkerSize(1.0);
  pionYieldHT2->SetMarkerColor(2);
  
  TF1 *scale=new TF1("scale","x",0.,15.);

  pionYieldMB->SetNameTitle("pionYieldMB","corrected yield MB");
  pionYieldMB->Divide(h_emb);
  pionYieldMB->Scale(psMB/(psMB*numberOfMB*2.*TMath::Pi()));
  pionYieldMB->Divide(scale);
  pionYieldMB->Multiply(h_binmb);
  pionYieldMB->Multiply(pion_cpv_corrMB);
  pionYieldMB->Multiply(pion_conv_corrMB);

  pionYieldHT1->SetNameTitle("pionYieldHT1","corrected yield HT1");
  pionYieldHT1->Divide(h_eht1);
  pionYieldHT1->Scale(psHT1/(psMB*nMBwithHT*2.*TMath::Pi()));
  pionYieldHT1->Divide(scale);
  pionYieldHT1->Multiply(h_binht1);
  pionYieldHT1->Multiply(pion_cpv_corrHT1);
  pionYieldHT1->Multiply(pion_conv_corrHT1);

  pionYieldHT2->SetNameTitle("pionYieldHT2","corrected yield HT2");
  pionYieldHT2->Divide(h_eht2);
  pionYieldHT2->Scale(psHT2/(psMB*nMBwithHT*2.*TMath::Pi()));
  pionYieldHT2->Divide(scale);
  pionYieldHT2->Multiply(h_binht2);
  pionYieldHT2->Multiply(pion_cpv_corrHT2);
  pionYieldHT2->Multiply(pion_conv_corrHT2);

  //create pion yield for double ratio:
  TH1F *pionYieldMBratio=new TH1F(*pionYieldMB);
  TH1F *pionYieldHT1ratio=new TH1F(*pionYieldHT1);
  TH1F *pionYieldHT2ratio=new TH1F(*pionYieldHT2);
  

  TH1F *pionXsMB=new TH1F(*pionYieldMB);
  TH1F *pionXsHT1=new TH1F(*pionYieldHT1);
  TH1F *pionXsHT2=new TH1F(*pionYieldHT2);
  pionXsMB->Scale((26.1/0.85));//times xs_bbc/bbc_eff
  pionXsHT1->Scale((26.1/0.85));
  pionXsHT2->Scale((26.1/0.85));


  TH1F *pionXsMBnoErr=new TH1F(*pionXsMB);
  TH1F *pionXsHT1noErr=new TH1F(*pionXsHT1);
  TH1F *pionXsHT2noErr=new TH1F(*pionXsHT2);
  for(int i=1;i<=pionXsMBnoErr->GetNbinsX();i++){
    pionXsMBnoErr->SetBinError(i,0.);
  }
  for(int i=1;i<=pionXsHT1noErr->GetNbinsX();i++){
    pionXsHT1noErr->SetBinError(i,0.);
  }
  for(int i=1;i<=pionXsHT2noErr->GetNbinsX();i++){
    pionXsHT2noErr->SetBinError(i,0.);
  }

  TGraphErrors *g_pionXsMB=new TGraphErrors(pionXsMB);
  g_pionXsMB->SetName("g_pionXsMB");
  removeThesePoints(g_pionXsMB,1);

  TGraphErrors *g_pionXsHT1=new TGraphErrors(pionXsHT1);
  g_pionXsHT1->SetName("g_pionXsHT1");
  removeThesePoints(g_pionXsHT1,2);

  TGraphErrors *g_pionXsHT2=new TGraphErrors(pionXsHT2);
  g_pionXsHT2->SetName("g_pionXsHT2");
  removeThesePoints(g_pionXsHT2,3);

  if(0){
    cout<<endl<<"xsec: x  y  ex  ey"<<endl;
    cout<<"minbias"<<endl;
    printPoints(g_pionXsMB);
    cout<<endl<<"hightower-1"<<endl;
    printPoints(g_pionXsHT1);
    cout<<endl<<"hightower-2"<<endl;
    printPoints(g_pionXsHT2);
    cout<<endl;
  }
  

  TMultiGraph *m_pions_fit=new TMultiGraph();
  m_pions_fit->SetName("m_pions_fit");
  m_pions_fit->SetMinimum(5.0e-9);
  m_pions_fit->SetMaximum(0.99);


  m_pions_fit->Add(g_pionXsMB);
  m_pions_fit->Add(g_pionXsHT1);
  m_pions_fit->Add(g_pionXsHT2);

  TF1 *fitQCD=new TF1("fitQCD",sumpqcd,1.,15.,6);
  fitQCD->SetParameters(600.,-8.2,4.,-8.5,2.,2.);
  fitQCD->FixParameter(4,2.);
  m_pions_fit->Fit(fitQCD,"R");
  
  bool inclPhenix=false;
  bool inclFrank=false;
  bool inclSasha=false;
  bool inclPqcd=false;

  TCanvas *compare=new TCanvas("compare","compare;p_{T}:xsec (mb)",600,750);
  compare->cd();

  TPad *padt=new TPad("padt","",0.0,0.3,1.,1.0);
  padt->SetBottomMargin(0.001);
  padt->SetLeftMargin(0.15);
  TPad *padb=new TPad("padb","",0.0,0.0,1.,0.3);
  padb->SetTopMargin(0.001);
  padb->SetBottomMargin(0.25);
  padb->SetLeftMargin(0.15);

  padt->Draw();
  padt->cd();
  gPad->SetLogy();

  TMultiGraph *m_pions=new TMultiGraph();
  m_pions->SetName("m_pions");

  if(inclPqcd){
    m_pions->Add(kkp,"c");
    m_pions->Add(kkp05,"c");
    m_pions->Add(kkp2,"c");
  }
  if(inclSasha){
    m_pions->Add(sasha_pp05);
  }
  if(inclFrank){
    m_pions->Add(frank_pp);
  }
  if(inclPhenix){
    m_pions->Add(phenix_pp);
  }

  //g_pionXsMB->Print();
  //cout<<endl<<endl;
  //g_pionXsHT1->Print();
  //cout<<endl<<endl;
  //g_pionXsHT2->Print();
  //cout<<endl;

  m_pions->Add(g_pionXsMB);
  m_pions->Add(g_pionXsHT1);
  m_pions->Add(g_pionXsHT2);

  m_pions->SetMinimum(1.0e-9);
  m_pions->SetMaximum(1.);

  m_pions->Draw("ap");

  //fitQCD->Draw("same");

  m_pions->GetXaxis()->SetLabelSize(0.);
  m_pions->GetYaxis()->SetTitle("Ed^{3}#sigma/dp^{3} (mb GeV^{-2}c^{2})");

  TLegend *leg=new TLegend(.5,.5,.85,.85);

  if(inclPhenix) leg->AddEntry(phenix_pp,"PHENIX p+p","p");
  if(inclFrank) leg->AddEntry(frank_pp,"STAR preliminary (upd.)","p");
  if(inclSasha) leg->AddEntry(sasha_pp05,"O.Grebenyuk p+p","p");
  leg->AddEntry(g_pionXsMB,"p+p minimum bias","p");
  leg->AddEntry(g_pionXsHT1,"hightower 1","p");
  leg->AddEntry(g_pionXsHT2,"hightower 2","p");
  if(inclPqcd){
    leg->AddEntry(kkp,"kkp + CTEQ6m, #mu=p_{T}","l");
    leg->AddEntry(kkp2,"#mu=2p_{T},p_{T}/2","l");
    leg->Draw("same");
  }

  leg->SetFillColor(0);
  leg->Draw();

  compare->cd();
  padb->Draw();
  padb->cd();

  TGraphErrors *sasha_pp05_overPqcd=new TGraphErrors(*sasha_pp05);
  divideGraphWithGraph(sasha_pp05_overPqcd,kkp);
  TGraphErrors *phenix_pp05_overPqcd=new TGraphErrors(*phenix_pp);
  divideGraphWithGraph(phenix_pp05_overPqcd,kkp);
  TGraphErrors *g_pionXsMB_overPqcd=new TGraphErrors(*g_pionXsMB);
  divideGraphWithGraph(g_pionXsMB_overPqcd,kkp);
  TGraphErrors *g_pionXsHT1_overPqcd=new TGraphErrors(*g_pionXsHT1);
  divideGraphWithGraph(g_pionXsHT1_overPqcd,kkp);
  TGraphErrors *g_pionXsHT2_overPqcd=new TGraphErrors(*g_pionXsHT2);
  divideGraphWithGraph(g_pionXsHT2_overPqcd,kkp);
  TGraphErrors *frank_pp05_overPqcd=new TGraphErrors(*frank_pp);
  divideGraphWithGraph(frank_pp05_overPqcd,kkp);

  TGraphErrors *kkp05_ratio=new TGraphErrors(*kkp05);
  divideGraphWithGraph(kkp05_ratio,kkp);
  TGraphErrors *kkp_ratio=new TGraphErrors(*kkp);
  divideGraphWithGraph(kkp_ratio,kkp);
  TGraphErrors *kkp2_ratio=new TGraphErrors(*kkp2);
  divideGraphWithGraph(kkp2_ratio,kkp);

  //systematic errors:
  TGraphErrors *g_pionXsMB_sys=new TGraphErrors(*g_pionXsMB_overPqcd);
  set_sys_pp_pion(g_pionXsMB_sys);
  TGraphErrors *g_pionXsHT1_sys=new TGraphErrors(*g_pionXsHT1_overPqcd);
  set_sys_pp_pion(g_pionXsHT1_sys);
  TGraphErrors *g_pionXsHT2_sys=new TGraphErrors(*g_pionXsHT2_overPqcd);
  set_sys_pp_pion(g_pionXsHT2_sys);
  
  TMultiGraph *m_pions_over_pqcd=new TMultiGraph();

  m_pions_over_pqcd->SetMinimum(0.0);
  m_pions_over_pqcd->SetMaximum(2.5);

  if(inclPqcd){
    m_pions_over_pqcd->Add(kkp05_ratio,"c");
    m_pions_over_pqcd->Add(kkp_ratio,"c");
    m_pions_over_pqcd->Add(kkp2_ratio,"c");
  }
  m_pions_over_pqcd->Add(g_pionXsMB_overPqcd);
  m_pions_over_pqcd->Add(g_pionXsHT1_overPqcd);
  m_pions_over_pqcd->Add(g_pionXsHT2_overPqcd);
  //m_pions_over_pqcd->Add(g_pionXsMB_sys,"c");
  //m_pions_over_pqcd->Add(g_pionXsHT1_sys,"c");
  //m_pions_over_pqcd->Add(g_pionXsHT2_sys,"c");
  if(inclPhenix) m_pions_over_pqcd->Add(phenix_pp05_overPqcd);
  if(inclFrank) m_pions_over_pqcd->Add(frank_pp05_overPqcd);
  if(inclSasha) m_pions_over_pqcd->Add(sasha_pp05_overPqcd);

  //m_pions_over_pqcd->Draw("ap");
  //m_pions_over_pqcd->GetXaxis()->SetTitle("p_{T} (GeV/c)");

  compare->SaveAs((dir+"pionxsec_pp.eps").Data());
  compare->SaveAs((dir+"pionxsec_pp.root").Data());


  TMultiGraph *m_pions_over_fit=new TMultiGraph();
  m_pions_over_fit->SetMinimum(0.01);
  m_pions_over_fit->SetMaximum(1.99);

  TGraphErrors *g_pionXsMB_overFit=new TGraphErrors(*g_pionXsMB);
  divideGraphWithFunction(g_pionXsMB_overFit,fitQCD);
  TGraphErrors *g_pionXsHT1_overFit=new TGraphErrors(*g_pionXsHT1);
  divideGraphWithFunction(g_pionXsHT1_overFit,fitQCD);
  TGraphErrors *g_pionXsHT2_overFit=new TGraphErrors(*g_pionXsHT2);
  divideGraphWithFunction(g_pionXsHT2_overFit,fitQCD);

  m_pions_over_fit->Add(g_pionXsMB_overFit);
  m_pions_over_fit->Add(g_pionXsHT1_overFit);
  m_pions_over_fit->Add(g_pionXsHT2_overFit);

  m_pions_over_fit->Draw("ap");

  compare->SaveAs((dir+"pionxsec_pp_overfit.eps").Data());
  compare->SaveAs((dir+"pionxsec_pp_overfit.root").Data());



  TCanvas *compare2=new TCanvas("compare2","compare2;p_{T};yield divided by fit",600,300);
  compare2->cd();

  //divide by fit:
  TGraphErrors *frank_pp2=new TGraphErrors(*frank_pp);  
  divideGraphWithFunction(frank_pp2,fitQCD);
  TGraphErrors *sasha_pp2=new TGraphErrors(*sasha_pp05);
  divideGraphWithFunction(sasha_pp2,fitQCD);
  TGraphErrors *phenix_pp2=new TGraphErrors(*phenix_pp);
  divideGraphWithFunction(phenix_pp2,fitQCD);
  TGraphErrors *g_pionXsMBcopy=new TGraphErrors(*g_pionXsMB);
  divideGraphWithFunction(g_pionXsMBcopy,fitQCD);
  TGraphErrors *g_pionXsHT1copy=new TGraphErrors(*g_pionXsHT1);
  divideGraphWithFunction(g_pionXsHT1copy,fitQCD);
  TGraphErrors *g_pionXsHT2copy=new TGraphErrors(*g_pionXsHT2);
  divideGraphWithFunction(g_pionXsHT2copy,fitQCD);

  inclPhenix=true;
  inclFrank=false;
  inclSasha=false;
  inclPqcd=false;

  TMultiGraph *m_pions2=new TMultiGraph();
  m_pions2->SetName("m_pions2");
  if(inclSasha) m_pions2->Add(sasha_pp2);
  if(inclFrank) m_pions2->Add(frank_pp2);
  if(inclPhenix) m_pions2->Add(phenix_pp2);
  
  m_pions2->Add(g_pionXsMBcopy);
  m_pions2->Add(g_pionXsHT1copy);
  m_pions2->Add(g_pionXsHT2copy);

  m_pions2->SetMinimum(0.000001);
  m_pions2->SetMaximum(3.);
  m_pions2->Draw("ap");

  TLegend *legg=new TLegend(.25,.55,.65,.85);
  legg->AddEntry(g_pionXsMBcopy,"minimum bias","p");
  legg->AddEntry(g_pionXsHT1copy,"hightower 1","p");
  legg->AddEntry(g_pionXsHT2copy,"hightower 2","p");
  if(inclFrank) legg->AddEntry(frank_pp2,"Frank's p+p (upd.)","p");
  if(inclSasha) legg->AddEntry(sasha_pp2,"Sasha's p+p","p");
  if(inclPhenix) legg->AddEntry(phenix_pp,"PHENIX p+p","p");
  legg->Draw("same");
  legg->SetFillColor(0);

  compare2->cd(0);
  compare2->SaveAs((dir+"pionxsec_pp_ratio.eps").Data());
  compare2->SaveAs((dir+"pionxsec_pp_ratio.root").Data());


  //********************************************
  //   Get double ratio:
  //********************************************

  //pion decay photon eff:
  TFile gg(eFile.Data(),"OPEN");  
  TH1F *effGammaMB=new TH1F(*h_effDaughtersMB);
  TH1F *effGammaHT1=new TH1F(*h_effDaughtersHT1);
  TH1F *effGammaHT2=new TH1F(*h_effDaughtersHT2);
  
  //single photon eff:
  TFile gg_single(eFileGamma.Data(),"OPEN");
  TH1F *effGammaSingleMB=new TH1F(*h_effMB);
  TH1F *effGammaSingleHT1=new TH1F(*h_effHT1);
  TH1F *effGammaSingleHT2=new TH1F(*h_effHT2);

  //raw neutral clusters:
  TFile ff(pi0File.Data(),"OPEN");
  TH1F *gammaYieldMB=new TH1F(*h_gammaMB);
  TH1F *gammaYieldHT1=new TH1F(*h_gammaHT1);
  TH1F *gammaYieldHT2=new TH1F(*h_gammaHT2);

  //divide rap. bite:
  gammaYieldMB->Scale(1./dy_gamma);
  gammaYieldHT1->Scale(1./dy_gamma);
  gammaYieldHT2->Scale(1./dy_gamma);


  for(Int_t i=1;i<=gammaYieldMB->GetNbinsX();i++){
    gammaYieldMB->SetBinContent(i,gammaYieldMB->GetBinContent(i)/gammaYieldMB->GetXaxis()->GetBinWidth(i));
    gammaYieldMB->SetBinError(i,gammaYieldMB->GetBinError(i)/gammaYieldMB->GetXaxis()->GetBinWidth(i));
  }
  gammaYieldMB->Scale(psMB/(psMB*numberOfMB*2.*TMath::Pi()));
  gammaYieldMB->Divide(scale);// ../pT
  gammaYieldMB->Multiply(h_binmb);
  gammaYieldMB->Divide(effGammaMB);
  gammaYieldMB->Multiply(gamma_cpv_corrMB);
  gammaYieldMB->Multiply(gamma_cont_corrMB);
  gammaYieldMB->Multiply(gamma_conv_corrMB);

  gammaYieldMB->SetMarkerStyle(8);
  gammaYieldMB->SetMarkerSize(1.);
  TGraphErrors *g_inclPhotonsMB=new TGraphErrors(gammaYieldMB);


  for(Int_t i=1;i<=gammaYieldHT1->GetNbinsX();i++){
    gammaYieldHT1->SetBinContent(i,gammaYieldHT1->GetBinContent(i)/gammaYieldHT1->GetXaxis()->GetBinWidth(i));
    gammaYieldHT1->SetBinError(i,gammaYieldHT1->GetBinError(i)/gammaYieldHT1->GetXaxis()->GetBinWidth(i));
  }
  gammaYieldHT1->Scale(psHT1/(psMB*nMBwithHT*2.*TMath::Pi()));
  gammaYieldHT1->Divide(scale);// ../pT
  gammaYieldHT1->Multiply(h_binht1);
  gammaYieldHT1->Divide(effGammaHT1);
  gammaYieldHT1->Multiply(gamma_cpv_corrHT1);
  gammaYieldHT1->Multiply(gamma_cont_corrHT1);
  gammaYieldHT1->Multiply(gamma_conv_corrHT1);

  gammaYieldHT1->SetMarkerStyle(8);
  gammaYieldHT1->SetMarkerSize(1.);
  gammaYieldHT1->SetMarkerColor(4);
  TGraphErrors *g_inclPhotonsHT1=new TGraphErrors(gammaYieldHT1);

  for(Int_t i=1;i<=gammaYieldHT2->GetNbinsX();i++){
    gammaYieldHT2->SetBinContent(i,gammaYieldHT2->GetBinContent(i)/gammaYieldHT2->GetXaxis()->GetBinWidth(i));
    gammaYieldHT2->SetBinError(i,gammaYieldHT2->GetBinError(i)/gammaYieldHT2->GetXaxis()->GetBinWidth(i));
  }
  gammaYieldHT2->Scale(psHT2/(psMB*nMBwithHT*2.*TMath::Pi()));
  gammaYieldHT2->Divide(scale);// ../pT
  gammaYieldHT2->Multiply(h_binht2);
  gammaYieldHT2->Divide(effGammaHT2);
  gammaYieldHT2->Multiply(gamma_cpv_corrHT2);
  gammaYieldHT2->Multiply(gamma_cont_corrHT2);
  gammaYieldHT2->Multiply(gamma_conv_corrHT2);

  gammaYieldHT2->SetMarkerStyle(8);
  gammaYieldHT2->SetMarkerSize(1.);
  gammaYieldHT2->SetMarkerColor(2);
  TGraphErrors *g_inclPhotonsHT2=new TGraphErrors(gammaYieldHT2);

  removeThesePoints(g_inclPhotonsMB,1);
  removeThesePoints(g_inclPhotonsHT1,2);
  removeThesePoints(g_inclPhotonsHT2,2);

  TMultiGraph *m_incl=new TMultiGraph();
  m_incl->SetName("m_incl");
  m_incl->SetTitle("inclusive photon invariant yield 0<y<1;p_{T} (GeV/c);#frac{1}{2#piNp_{T}} #frac{d^{2}N}{dydp_{T}}");
  m_incl->Add(g_inclPhotonsMB);
  m_incl->Add(g_inclPhotonsHT1);
  m_incl->Add(g_inclPhotonsHT2);

  m_incl->Fit(fitQCD,"R0");

  m_incl->SetMinimum(1.e-11);
  m_incl->SetMaximum(10.);
  TCanvas *c_incl=new TCanvas("c_incl","c_incl",600,400);
  gPad->SetLogy();
  m_incl->Draw("ap");
  c_incl->SaveAs((dir+"inclPhotonYield.eps").Data());
  c_incl->SaveAs((dir+"inclPhotonYield.root").Data());



  //get ratio:
  TH1F *gammaYieldMBratio=new TH1F(*gammaYieldMB);
  gammaYieldMBratio->SetName("gammaYieldMBratio");
  TH1F *gammaYieldHT1ratio=new TH1F(*gammaYieldHT1);
  gammaYieldHT1ratio->SetName("gammaYieldHT1ratio");
  TH1F *gammaYieldHT2ratio=new TH1F(*gammaYieldHT2);
  gammaYieldHT2ratio->SetName("gammaYieldHT2ratio");

  gammaYieldMBratio->Divide(pionYieldMBratio);
  gammaYieldHT1ratio->Divide(pionYieldHT1ratio);
  gammaYieldHT2ratio->Divide(pionYieldHT2ratio);


  //correct gamma over pion ratio, using two efficiencies:
  getRatio(gammaYieldMBratio,effGammaMB,effGammaSingleMB,fit_piondecay);
  getRatio(gammaYieldHT1ratio,effGammaHT1,effGammaSingleHT1,fit_piondecay);
  getRatio(gammaYieldHT2ratio,effGammaHT2,effGammaSingleHT2,fit_piondecay);

  TH1F *gammaYieldMBratio_incl=new TH1F(*gammaYieldMBratio);
  TH1F *gammaYieldHT1ratio_incl=new TH1F(*gammaYieldHT1ratio);
  TH1F *gammaYieldHT2ratio_incl=new TH1F(*gammaYieldHT2ratio);
  
  TH1F *gammaYieldMBratioNoErr=new TH1F(*gammaYieldMBratio);
  TH1F *gammaYieldHT1ratioNoErr=new TH1F(*gammaYieldHT1ratio);
  TH1F *gammaYieldHT2ratioNoErr=new TH1F(*gammaYieldHT2ratio);
  for(int i=1;i<=gammaYieldMBratioNoErr->GetNbinsX();i++){
    gammaYieldMBratioNoErr->SetBinError(i,0.);
  }
  for(int i=1;i<=gammaYieldHT1ratioNoErr->GetNbinsX();i++){
    gammaYieldHT1ratioNoErr->SetBinError(i,0.);
  }
  for(int i=1;i<=gammaYieldHT2ratioNoErr->GetNbinsX();i++){
    gammaYieldHT2ratioNoErr->SetBinError(i,0.);
  }

  TGraphErrors *g_ratioMB=new TGraphErrors(gammaYieldMBratio);
  g_ratioMB->SetName("g_ratioMB");
  TGraphErrors *g_ratioHT1=new TGraphErrors(gammaYieldHT1ratio);
  g_ratioHT1->SetName("g_ratioHT1");
  TGraphErrors *g_ratioHT2=new TGraphErrors(gammaYieldHT2ratio);
  g_ratioHT2->SetName("g_ratioHT2");


  removeThesePoints(g_ratioMB,1);
  removeThesePoints(g_ratioHT1,2);
  removeThesePoints(g_ratioHT2,3);


  TCanvas *c_ratio=new TCanvas("c_ratio","c_ratio",400,200);

  TMultiGraph *m_ratio=new TMultiGraph("m_ratio","p+p 2005;p_{T};#gamma/#pi^{0}");
  m_ratio->Add(g_ratioMB);
  m_ratio->Add(g_ratioHT1);
  m_ratio->Add(g_ratioHT2);

  m_ratio->Draw("ap");
  m_ratio->SetMinimum(.001);
  m_ratio->SetMaximum(1.5);

  TLegend *leg3=new TLegend(.35,.65,.65,.85);
  leg3->AddEntry(g_ratioMB,"minimum bias","p");
  leg3->AddEntry(g_ratioHT1,"hightower 1","p");
  leg3->AddEntry(g_ratioHT2,"hightower 2","p");
  leg3->AddEntry(fit_decay,"decay background (total)","l");
  leg3->AddEntry(fit_piondecay,"decay background (#pi^{0})","l");
  leg3->SetFillColor(0);
  leg3->Draw("same");

  fit_decay->SetLineColor(13);
  fit_decay->SetLineWidth(1);
  fit_decay->SetLineColor(1);
  fit_decay->Draw("same");
  fit_piondecay->SetLineColor(13);
  fit_piondecay->SetLineWidth(1);
  fit_piondecay->SetLineStyle(2);
  fit_piondecay->SetLineColor(1);
  fit_piondecay->Draw("same");

  c_ratio->SaveAs((dir+"gammaOverPion.eps").Data());
  c_ratio->SaveAs((dir+"gammaOverPion.root").Data());


  //create fully corrected incl. photons:
  gammaYieldMBratio_incl->Multiply(pionYieldMBratio);
  gammaYieldHT1ratio_incl->Multiply(pionYieldHT1ratio);
  gammaYieldHT2ratio_incl->Multiply(pionYieldHT2ratio);
  //gammaYieldMBratio_incl->Scale(7.5);
  //gammaYieldHT1ratio_incl->Scale(7.5);
  //gammaYieldHT2ratio_incl->Scale(7.5);
  
  TGraphErrors *g_incl_corrMB=new TGraphErrors(gammaYieldMBratio_incl);
  TGraphErrors *g_incl_corrHT1=new TGraphErrors(gammaYieldHT1ratio_incl);
  TGraphErrors *g_incl_corrHT2=new TGraphErrors(gammaYieldHT2ratio_incl);

  TCanvas *c_incl_corr=new TCanvas("c_incl_corr","c_incl_corr",400,300);
  gPad->SetLogy();
  TMultiGraph *m_incl_corr=new TMultiGraph();
  m_incl_corr->Add(g_incl_corrMB);
  m_incl_corr->Add(g_incl_corrHT1);
  m_incl_corr->Add(g_incl_corrHT2);

  m_incl_corr->SetMinimum(1.e-11);
  m_incl_corr->SetMaximum(1.);

  m_incl_corr->Draw("apX");
  c_incl_corr->SaveAs((dir+"inclPhotonYieldCorr.eps").Data());
  c_incl_corr->SaveAs((dir+"inclPhotonYieldCorr.root").Data());



  TCanvas *c_doubleratio=new TCanvas("c_doubleratio","c_doubleratio",400,300);
  gStyle->SetOptStat(0);
  c_doubleratio->cd(1);

  TH1F *gammaYieldMBdoubleratio=new TH1F(*gammaYieldMBratio);
  TH1F *gammaYieldHT1doubleratio=new TH1F(*gammaYieldHT1ratio);
  TH1F *gammaYieldHT2doubleratio=new TH1F(*gammaYieldHT2ratio);

  gammaYieldMBdoubleratio->Divide(fit_decay);
  gammaYieldHT1doubleratio->Divide(fit_decay);
  gammaYieldHT2doubleratio->Divide(fit_decay);

  TGraphErrors *g_doubleRatioMB=new TGraphErrors(gammaYieldMBdoubleratio);
  g_doubleRatioMB->SetName("g_doubleRatioMB");
  g_doubleRatioMB->SetMarkerStyle(8);
  TGraphErrors *g_doubleRatioHT1=new TGraphErrors(gammaYieldHT1doubleratio);
  g_doubleRatioHT1->SetName("g_doubleRatioHT1");
  g_doubleRatioHT1->SetMarkerStyle(8);
  TGraphErrors *g_doubleRatioHT2=new TGraphErrors(gammaYieldHT2doubleratio);
  g_doubleRatioHT2->SetName("g_doubleRatioHT2");
  g_doubleRatioHT2->SetMarkerStyle(8);

  removeThesePoints(g_doubleRatioMB,1);
  removeThesePoints(g_doubleRatioHT1,2);
  removeThesePoints(g_doubleRatioHT2,3);

  TMultiGraph *m_doubleratio=new TMultiGraph();
  m_doubleratio->SetName("m_doubleratio");
  m_doubleratio->SetMinimum(.5);
  m_doubleratio->SetMaximum(2.75);

  cout<<endl;
  g_doubleRatioHT1->Print();
  cout<<endl<<endl;
  g_doubleRatioHT2->Print();
  cout<<endl;

  //m_doubleratio->Add(g_doubleRatioMB,"p");
  m_doubleratio->Add(g_doubleRatioHT1,"p");
  m_doubleratio->Add(g_doubleRatioHT2,"p");

  g_photonpqcd->SetLineWidth(2);
  g_photonpqcd->SetLineColor(2);
  g_photonpqcd05->SetLineWidth(2);
  g_photonpqcd05->SetLineColor(2);
  g_photonpqcd05->SetLineStyle(2);
  g_photonpqcd2->SetLineWidth(2);
  g_photonpqcd2->SetLineColor(2);
  g_photonpqcd2->SetLineStyle(2);

  m_doubleratio->Add(g_photonpqcd,"c");
  m_doubleratio->Add(g_photonpqcd05,"c");
  m_doubleratio->Add(g_photonpqcd2,"c");

  //appropriate fit to photon pqcd result
  TF1 *fitGamma2=new TF1("fitGamma2","1.+[0]*pow(x,[1])",2.,15.);
  g_photonpqcd->Fit(fitGamma2,"R0");

  m_doubleratio->Draw("a");
  
  m_doubleratio->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  m_doubleratio->GetYaxis()->SetTitle("1 + #gamma_{dir}/#gamma_{incl}");
  m_doubleratio->GetXaxis()->SetRangeUser(2.,16.);
  

  TLegend *leg5=new TLegend(.15,.6,.6,.8);
  leg5->AddEntry(g_doubleRatioHT1,"hightower-1","p");
  leg5->AddEntry(g_doubleRatioHT2,"hightower-2","p");
  leg5->AddEntry(g_photonpqcd,"NLO (CTEQ6+KKP) #mu=p_{T}","l");
  leg5->AddEntry(g_photonpqcd05,"#mu=2p_{T}, #mu=p_{T}/2","l");
  leg5->SetFillColor(0);
  leg5->Draw("same");

  c_doubleratio->cd(0);  
  c_doubleratio->SaveAs((dir+"gammaDoubleRatio.eps").Data());
  c_doubleratio->SaveAs((dir+"gammaDoubleRatio.root").Data());


  TCanvas *c_dirphoton=new TCanvas("c_dirphoton","c_dirphoton",400,300);
  gStyle->SetOptStat(0);
  c_dirphoton->cd(1);

  TH1F *dirphotonYieldMB=new TH1F(*gammaYieldMBdoubleratio);
  TH1F *dirphotonYieldHT1=new TH1F(*gammaYieldHT1doubleratio);
  TH1F *dirphotonYieldHT2=new TH1F(*gammaYieldHT2doubleratio);

  TH1F *dirphotonYieldMBnoErr=new TH1F(*dirphotonYieldMB);
  for(int i=1;i<=dirphotonYieldMBnoErr->GetNbinsX();i++){
    dirphotonYieldMBnoErr->SetBinError(i,0.);
  }
  TH1F *dirphotonYieldHT1noErr=new TH1F(*dirphotonYieldHT1);
  for(int i=1;i<=dirphotonYieldHT1noErr->GetNbinsX();i++){
    dirphotonYieldHT1noErr->SetBinError(i,0.);
  }
  TH1F *dirphotonYieldHT2noErr=new TH1F(*dirphotonYieldHT2);
  for(int i=1;i<=dirphotonYieldHT1noErr->GetNbinsX();i++){
    dirphotonYieldHT2noErr->SetBinError(i,0.);
  }

  TF1 *f_unity=new TF1("f_unity","1.",0.,15.);
  dirphotonYieldMB->Add(f_unity,-1.);
  dirphotonYieldHT1->Add(f_unity,-1.);
  dirphotonYieldHT2->Add(f_unity,-1.);


  dirphotonYieldMB->Divide(dirphotonYieldMBnoErr);
  dirphotonYieldHT1->Divide(dirphotonYieldHT1noErr);
  dirphotonYieldHT2->Divide(dirphotonYieldHT2noErr);
  dirphotonYieldMB->Multiply(gammaYieldMBratioNoErr);
  dirphotonYieldHT1->Multiply(gammaYieldHT1ratioNoErr);
  dirphotonYieldHT2->Multiply(gammaYieldHT2ratioNoErr);
  dirphotonYieldMB->Multiply(pionXsMBnoErr);
  dirphotonYieldHT1->Multiply(pionXsHT1noErr);
  dirphotonYieldHT2->Multiply(pionXsHT2noErr);


  TGraphErrors *g_dirphotonMB=new TGraphErrors(dirphotonYieldMB);
  g_dirphotonMB->SetName("g_dirphotonMB");
  g_dirphotonMB->SetMarkerStyle(8);
  TGraphErrors *g_dirphotonHT1=new TGraphErrors(dirphotonYieldHT1);
  g_dirphotonHT1->SetName("g_dirphotonHT1");
  g_dirphotonHT1->SetMarkerStyle(8);
  TGraphErrors *g_dirphotonHT2=new TGraphErrors(dirphotonYieldHT2);
  g_dirphotonHT2->SetName("g_dirphotonHT2");
  g_dirphotonHT2->SetMarkerStyle(8);


  removeThesePoints(g_dirphotonMB,1);
  removeThesePoints(g_dirphotonHT1,2);
  removeThesePoints(g_dirphotonHT2,3);

  gPad->SetLogy();

  TMultiGraph *m_dirphoton=new TMultiGraph();
  m_dirphoton->SetName("m_dirphoton");
  m_dirphoton->SetMinimum(1.0e-11);
  m_dirphoton->SetMaximum(0.1);

  m_dirphoton->Add(g_dirgamma,"c");
  m_dirphoton->Add(g_dirgamma05,"c");
  m_dirphoton->Add(g_dirgamma2,"c");

  cout<<"direct photons:"<<endl;
  g_dirphotonHT1->Print();
  cout<<endl;
  g_dirphotonHT2->Print();
  cout<<endl;

  m_dirphoton->Add(g_dirphotonHT1,"p");
  m_dirphoton->Add(g_dirphotonHT2,"p");

  m_dirphoton->Draw("a");
  
  m_dirphoton->GetXaxis()->SetTitle("p_{T} (GeV/c)");
  m_dirphoton->GetYaxis()->SetTitle("1 - R^{-1}");
  m_dirphoton->GetXaxis()->SetRangeUser(2.,16.);
  

  TLegend *leg5=new TLegend(.15,.6,.6,.8);
  leg5->AddEntry(g_dirphotonHT1,"hightower-1","p");
  leg5->AddEntry(g_dirphotonHT2,"hightower-2","p");
  leg5->SetFillColor(0);
  leg5->Draw("same");

  c_dirphoton->cd(0);  
  c_dirphoton->SaveAs((dir+"gammaDirPhoton.eps").Data());
  c_dirphoton->SaveAs((dir+"gammaDirPhoton.root").Data());





  return;
}
Exemple #18
0
void CZSingleton::RemoveDrop()
{
	CString gg(AfxGetApp()->m_pszExeName);
	::RemoveProp(AfxGetApp()->GetMainWnd()->GetSafeHwnd(),gg);
	gg.Empty();
}
Exemple #19
0
}
constexpr S s = { };
int x1 = s.twice();     // ok
int x2 = s.t();         // error: S::t() not defined
constexpr int x2a = s.t();     // { dg-error "S::t" } error: S::t() not defined
constexpr int ff();     // ok
constexpr int gg();     // ok
int x3 = ff();          // error: ff() not defined
constexpr int x3a = ff();      // { dg-error "ff" } error: ff() not defined
constexpr int ff() {
    return 1;    // too late
}
constexpr int gg() {
    return 2;
}
int x4 = gg();  // ok


// 4.2 const-expression data

// 2
// storage  not allocated untill address taken
constexpr double x = 9484.748;
const double* p = &x;          // the &x forces x into memory

// 4.3 constant-expression constructors

// 1
struct complex {
    constexpr complex(double r, double i) : re(r), im(i) { }
    constexpr double real() {
 void forward( ccube_p<real> const & f ) override
 {
     guard gg(m);
     manager.require_done( pending_, &filter_ds_edge::do_forward, this, f );
 }