Esempio n. 1
0
void GausBF::Check(void)
{
  for (Int_t i = 0; i < Ns1; i++) 
    for (Int_t j = 0; j < Ns9; j++) {
      for (Int_t k = 0; k < Np/3; k++) {
	if (GetPar(i, j, k*3) == 0) continue;
	if (TMath::Abs(GetPar(i, j, k*3+2)) <   1 ||
	    TMath::Abs(GetPar(i, j, k*3+1)) > 200)
	  GetPar(i, j)[k*3] = GetPar(i, j)[k*3+1] = 0;
      }
    }
}
Esempio n. 2
0
TF1 *GausBF::GetDf(Int_t is1, Int_t is9, Double_t rgt) const
{
  AMSPoint  p1 = GetP1(is1);
  AMSPoint  p9 = GetP9(is9);
  AMSPoint pnt = p1;
  AMSDir   dir = p9-p1;

  TString str = "[1]+1/[2]*TMath::C()/1e12*(0";
  for (Int_t i = 0; i < 12; i++) str += SV(i*3+3);
  str += ")";

  static TF1 *func = 0;
  if (!func) func = new TF1("fdf", str);
  func->FixParameter(0, 0);
  func->FixParameter(1, dir.y()/dir.z());
  func->FixParameter(2, rgt);

  for (Int_t i = 0; i < Np; i++) {
    Double_t par = GetPar(is1, is9, i);
    if (par != 0 && (i < 3 || i%3 == 0)) func->SetParameter(i+3, par);
    else                                 func->FixParameter(i+3, par);
  }

  return func;
}
Esempio n. 3
0
TF1 *GausBF::GetBf(Int_t is1, Int_t is9) const
{
  TF1 *func = new TF1("fbf", FB(), -200, 200);
  for (Int_t i = 0; i < func->GetNpar() && i < Np; i++)
    func->SetParameter(i, GetPar(is1, is9, i));

  return func;
}
Esempio n. 4
0
File: envt.hpp Progetto: cenit/GDL
  T* IfDefGetParAs( SizeT pIx)
  {
    BaseGDL* p = GetPar( pIx);
    if( p == NULL) return NULL;
    if( p->Type() == T::t)
	return static_cast<T*>( p);
//     T* res = dynamic_cast<T*>( p);
//     if( res != NULL) return res;
    T* res = static_cast<T*>( p->Convert2( T::t, BaseGDL::COPY));
    this->DeleteAtExit( res);
    return res;
  }
Esempio n. 5
0
void Lexer(char* CharSource, Token* TokSource)
{
    char* CurChar = CharSource;
    Token* CurToken = TokSource;

    while (*CurChar != '\0')
    {
        GetNum(&CurChar, &CurToken);
        GetOper(&CurChar, &CurToken);
        GetPar(&CurChar, &CurToken);
        SkipChar(&CurChar);
    }
    CurToken->type = END;

    size_t i = 0;
    while ( TokSource[i].type != END )
    {
        switch (TokSource[i].type)
        {
        /* case OPER */
        case ADDITIVE_OPER:
            ;
        case MULTIPLICATIVE_OPER:
            ;
        case POWER_OPER:
            printf("%c", TokSource[i].value.oper);
            break;

        /* case PAR */
        case LPAR:
        case RPAR:
            printf("%c", TokSource[i].value.par);
            break;

        /* case NUM */
        case NUM:
            printf("[%f]", TokSource[i].value.number);
            break;
        case END:
            break;
        default:
            fprintf(stderr, "unexpected token %d\n", TokSource[i].type);
        }
        i++;
    }

    printf("\n");
}
Esempio n. 6
0
TF1 *GausBF::GetPr(Int_t is1, Int_t is9, Double_t rgt) const
{
  AMSPoint  p1 = GetP1(is1);
  AMSPoint  p9 = GetP9(is9);
  AMSPoint pnt = p1;
  AMSDir   dir = p9-p1;

  TF1 *fdr = GetDf(is1, is9, rgt);
  Double_t dy0 = fdr->Eval(p1.z())-dir.y()/dir.z();

  Int_t ip = 11;
  TString str = Form("[0]+[1]*(x-%.4f)-(%f)*(x-27)-[3]", p1.z(), dy0);
  str += SE(5)+SE(8);
  str += "+[4]*[2]*TMath::C()/1e12*(0";
  for (Int_t i = 0; i < 7; i++) str += SE(i*3+ip);
  str += ")";

  static TF1 *func = 0;
  if (!func) func = new TF1("fpr", str);
  func->SetParameter(0, pnt.y());
  func->SetParameter(1, dir.y()/dir.z());
  func->SetParameter(2, 1/rgt);
  func->SetParameter(3, 0);
  func->FixParameter(4, TMath::Sqrt(1.+(dir[0]*dir[0]
				       +dir[1]*dir[1])/dir[2]/dir[2])*
		                    (1.+dir[1]*dir[1] /dir[2]/dir[2]));

  func->SetParameter(5,   0); func->SetParameter( 8,   0);
  func->FixParameter(6,  65); func->FixParameter( 9, -65);
  func->FixParameter(7, 0.1); func->FixParameter(10, 0.1);

  for (Int_t i = 0; i < 21; i++) func->FixParameter(i+ip, GetPar(is1, is9, i));

  func->FixParameter(3, func->Eval(pnt.z())-p1.y());

  return func;
}
Esempio n. 7
0
void GausBF::SetPar(Int_t is1, Int_t is9, Int_t ip, Double_t par)
{
  Double_t *p = GetPar(is1, is9);
  if (p && 0 <= ip && ip < Np) p[ip] = par;
}
Esempio n. 8
0
Double_t GausBF::GetPar(Int_t is1, Int_t is9, Int_t ip) const
{
  const Double_t *p = GetPar(is1, is9);
  return (p && 0 <= ip && ip < Np) ? p[ip] : 0;
}