예제 #1
0
//___________________________________________________________________________________________
void KVIntegerList::Update()
{
//protected method, Mise a jour du nom de la partition (via SetName()), de sa longueur (fLength)
//Le bit kHastobeComputed es mis à 0 pour indiquer que la mise à jour a été faite
//
   KVString snom = "", stamp = "";
   for (Int_t ii = fLimiteRegle; ii >= 0; ii -= 1) {
      Int_t contenu = fRegle->At(ii);
      if (contenu > 0) {
         //Formattage du nom de la partition
         stamp.Form("%d", ii);
         snom += stamp;
         if (contenu > 1) {
            stamp.Form("(%d)", contenu);
            snom += stamp;
         }
         snom += " ";
      }
   }
   if (snom != "") snom.Remove(snom.Length() - 1);
   SetName(snom.Data());
   fLength = snom.Length();

   SetBit(kHastobeComputed, kFALSE);

}
예제 #2
0
void KVGeoNavigator::FormatStructureName(const Char_t* type, Int_t number, KVString& name)
{
   // If a format for naming structures of given type has been defined by a call
   // to SetStructureNameFormat(const Char_t *, const Char_t *), we use it to
   // format the name in the TString.
   // If no format was given, we use by default "[type]_[number]"
   // If SetNameCorrespondanceList(const Char_t *) was used, we use it to translate
   // any names resulting from this formatting to their final value.

   name = "";
   if (fStrucNameFmt.HasParameter(type)) {
      KVString fmt = fStrucNameFmt.GetStringValue(type);
      fmt.Begin("$");
      while (!fmt.End()) {
         KVString bit = fmt.Next();
         if (bit.BeginsWith("type")) {
            Ssiz_t ind = bit.Index("%");
            if (ind > -1) {
               bit.Remove(0, ind);
               name += Form(bit.Data(), type);
            } else
               name += type;
         } else if (bit.BeginsWith("number")) {
            Ssiz_t ind = bit.Index("%");
            if (ind > -1) {
               bit.Remove(0, ind);
               name += Form(bit.Data(), number);
            } else
               name += number;
         } else
            name += bit;
      }
   } else
      name.Form("%s_%d", type, number);
   TString tmp;
   GetNameCorrespondance(name.Data(), tmp);
   name = tmp;
}
예제 #3
0
void KVGeoNavigator::FormatDetectorName(const Char_t* basename, KVString& name)
{
   // If a format for naming detectors has been defined by a call
   // to SetDetectorNameFormat(const Char_t *), we use it to
   // format the name in the TString.
   // If no format was given we prefix the names of the parent structures
   // to the basename in order to generate the full name of the detector:
   //    [struc1-name]_[struc2-name]_..._[detector-basename]
   // If SetNameCorrespondanceList(const Char_t *) was used, we use it to translate
   // any names resulting from this formatting to their final value.

   name = "";
   if (!fCurStrucNumber) {
      // no parent structures
      name = basename;
   } else {
      if (fDetNameFmt == "") {
         for (int i = 0; i < fCurStrucNumber; i++) {
            KVGeoStrucElement* el = (KVGeoStrucElement*)fCurrentStructures[i];
            name += Form("%s_", el->GetName());
         }
         name += basename;
      } else {
         //    $det:name$             - will be replaced by the detector basename
         //    $struc:[type]:name$    - will be replaced by the name of the parent structure of given type
         //    $struc:[type]:type$    - will be replaced by the type of the parent structure of given type
         //    $struc:[type]:number$  - will be replaced by the number of the parent structure of given type
         fDetNameFmt.Begin("$");
         while (!fDetNameFmt.End()) {
            KVString bit = fDetNameFmt.Next();
            if (bit.Contains(":")) {
               bit.Begin(":");
               KVString itbit = bit.Next();
               if (itbit == "det") {
                  itbit = bit.Next();
                  if (itbit.BeginsWith("name")) {
                     Ssiz_t ind = itbit.Index("%");
                     if (ind > -1) {
                        itbit.Remove(0, ind);
                        name += Form(itbit.Data(), basename);
                     } else
                        name += basename;
                  }
               } else if (itbit == "struc") {
                  KVString struc_typ = bit.Next();
                  KVGeoStrucElement* el = 0;
                  for (int i = 0; i < fCurStrucNumber; i++) {
                     el = (KVGeoStrucElement*)fCurrentStructures[i];
                     if (el->IsType(struc_typ)) break;
                  }
                  if (el) {
                     itbit = bit.Next();
                     if (itbit.BeginsWith("name")) {
                        Ssiz_t ind = itbit.Index("%");
                        if (ind > -1) {
                           itbit.Remove(0, ind);
                           name += Form(itbit.Data(), el->GetName());
                        } else
                           name += el->GetName();
                     } else if (itbit.BeginsWith("type")) {
                        Ssiz_t ind = itbit.Index("%");
                        if (ind > -1) {
                           itbit.Remove(0, ind);
                           name += Form(itbit.Data(), el->GetType());
                        } else
                           name += el->GetType();
                     } else if (itbit.BeginsWith("number")) {
                        Ssiz_t ind = itbit.Index("%");
                        if (ind > -1) {
                           itbit.Remove(0, ind);
                           name += Form(itbit.Data(), el->GetNumber());
                        } else
                           name += el->GetNumber();
                     }
                  }
               }
            } else
               name += bit;
         }
      }
   }
   TString tmp;
   GetNameCorrespondance(name.Data(), tmp);
   name = tmp;
}
예제 #4
0
파일: KVTGID.cpp 프로젝트: pwigg/kaliveda
KVTGID* KVTGID::ReadFromAsciiFile(const Char_t* name, ifstream & gridfile)
{
    // Read parameters of LTG fit in file (which must have been written with
    // current version of KVTGID::WriteToAsciiFile)

    KVTGID* LTGfit=0;
    Int_t Ftyp, Flite, FZorA, Fmass;
    FZorA=Fmass=Ftyp=Flite=0;

    KVString line;
    line.ReadLine(gridfile);
    TString buff= GetValue(line,'=');
    Ftyp = buff.Atoi();
    line.ReadLine(gridfile);
    buff = GetValue(line,'=');
    Flite = buff.Atoi();
    line.ReadLine(gridfile);
    buff = GetValue(line,'=');
    FZorA =buff.Atoi();
    if (FZorA)
    {
        line.ReadLine(gridfile);
        buff = GetValue(line,'=');
        Fmass = buff.Atoi();
    }

    LTGfit = MakeTGID(name,Ftyp,Flite,FZorA,Fmass);

    line.ReadLine(gridfile); // skip "Functional=" line : name of functional not used
    line.ReadLine(gridfile);
    LTGfit->SetValidRuns( KVNumberList(GetValue(line, '=').Data()) );
    line.ReadLine(gridfile);
    LTGfit->SetStringTelescopes( GetValue(line,'=') );
    line.ReadLine(gridfile);
	line.Remove(0,6);
	line.Remove(KVString::kBoth,' ');
    LTGfit->SetVarX(line.Data());
    line.ReadLine(gridfile);
	line.Remove(0,6);
	line.Remove(KVString::kBoth,' ');
    LTGfit->SetVarY(line.Data());
    line.ReadLine(gridfile);
    Int_t zmin,zmax;
    sscanf(line.Data(), "ZMIN=%d ZMAX=%d", &zmin, &zmax);
    LTGfit->SetIDmin(zmin);
    LTGfit->SetIDmax(zmax);
    Bool_t type1 = (Ftyp==1);
    line.ReadLine(gridfile);
    buff = GetValue(line,'=');
    LTGfit->SetLambda( buff.Atof() );
    if (type1){
        line.ReadLine(gridfile);
        buff = GetValue(line,'=');
        LTGfit->SetAlpha( buff.Atof() );
        line.ReadLine(gridfile);
        buff = GetValue(line,'=');
        LTGfit->SetBeta( buff.Atof() );
    }
    line.ReadLine(gridfile);
    buff = GetValue(line,'=');
    LTGfit->SetMu( buff.Atof() );
    if (type1){
        line.ReadLine(gridfile);
        buff = GetValue(line,'=');
        LTGfit->SetNu( buff.Atof() );
        line.ReadLine(gridfile);
        buff = GetValue(line,'=');
        LTGfit->SetXi( buff.Atof() );
    }
    line.ReadLine(gridfile);
    buff = GetValue(line,'=');
    LTGfit->SetG( buff.Atof() );
    line.ReadLine(gridfile);
    buff = GetValue(line,'=');
    LTGfit->SetPdx( buff.Atof() );
    line.ReadLine(gridfile);
    buff = GetValue(line,'=');
    LTGfit->SetPdy( buff.Atof() );
    if (Flite==1){
        line.ReadLine(gridfile);
        buff = GetValue(line,'=');
        LTGfit->SetEta( buff.Atof() );
    }
    line.ReadLine(gridfile);
    return LTGfit;
}