当前位置: 首页>>代码示例>>C++>>正文


C++ KVNameValueList类代码示例

本文整理汇总了C++中KVNameValueList的典型用法代码示例。如果您正苦于以下问题:C++ KVNameValueList类的具体用法?C++ KVNameValueList怎么用?C++ KVNameValueList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KVNameValueList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TGeoMixture

TGeoMaterial* KVIonRangeTableMaterial::GetTGeoMaterial() const
{
   // Create and return pointer to a TGeoMaterial or TGeoMixture (for compound materials)
   // with the properties of this material.
   // gGeoManager must exist.

   TGeoMaterial* gmat = 0x0;
   if (!gGeoManager) return gmat;
   if (IsCompound()) {
      gmat = new TGeoMixture(GetTitle(), GetComposition()->GetEntries(), GetDensity());
      TIter next(GetComposition());
      KVNameValueList* nvl;
      while ((nvl = (KVNameValueList*)next())) {
         KVNucleus n(nvl->GetIntValue("Z"), nvl->GetIntValue("A"));
         TGeoElement* gel = gGeoManager->GetElementTable()->FindElement(n.GetSymbol("EL"));
         float poids = nvl->GetDoubleValue("NormWeight");
         ((TGeoMixture*)gmat)->AddElement(gel, poids);
      }
   }
   else {
      gmat = new TGeoMaterial(GetTitle(), GetMass(), GetZ(), GetDensity());
   }
   // set state of material
   if (IsGas()) gmat->SetState(TGeoMaterial::kMatStateGas);
   else gmat->SetState(TGeoMaterial::kMatStateSolid);
   return gmat;
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:27,代码来源:KVIonRangeTableMaterial.cpp

示例2: ReadFile

Int_t KVAvailableRunsFile::Count(Int_t run)
{
   //Count the number of times a given run number appears in the file
   //If available runs file does not exist, Update() is called to create it.

//    //does runlist exist ?
//    if (!OpenAvailableRunsFile()) {
//       Error("Count", "Error opening available runs file");
//       return 0;
//    }
//    //loop over lines in runlist file
//    //look for line beginning with 'run|'
//    TString line;
//    Int_t occurs = 0;
//    line.ReadLine(fRunlist);
//    while (fRunlist.good()) {
//       if (line.BeginsWith(Form("%d|", run))) {
//          occurs++;
//       }
//       line.ReadLine(fRunlist);
//    }
//    CloseAvailableRunsFile();
//    return occurs;
   ReadFile();
   KVNameValueList* nvlrun = (KVNameValueList*)fAvailableRuns->FindObject(Form("%d",run));
   if(nvlrun) return nvlrun->GetIntValue("Occurs");
   return 0;
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:28,代码来源:KVAvailableRunsFile.cpp

示例3: MultiJobsMode

void KV_CCIN2P3_GE::GetBatchSystemParameterList(KVNameValueList& nl)
{
   // Fill the list with all relevant parameters for batch system,
   // set to their default values.
   //
   // Parameters defined here are:
   //   JobTime        [string]
   //   JobMemory      [string]
   //   JobDisk        [string]
   //   MultiJobsMode  [bool]
   //   RunsPerJob     [int]
   //   EMailOnStart   [bool]
   //   EMailOnEnd     [bool]
   //   EMailAddress   [string]

   KVBatchSystem::GetBatchSystemParameterList(nl);
   nl.SetValue("JobTime", fDefJobTime);
   nl.SetValue("JobMemory", fDefJobMem);
   nl.SetValue("JobDisk", fDefJobDisk);
   nl.SetValue("MultiJobsMode", MultiJobsMode());
   nl.SetValue("RunsPerJob", fRunsPerJob);
   nl.SetValue("EMailOnStart", kFALSE);
   nl.SetValue("EMailOnEnd", kFALSE);
   TString email = gSystem->GetFromPipe("email");
   if (email.Index('=') > -1) {
      email.Remove(0, email.Index('=') + 2);
      nl.SetValue("EMailAddress", email);
   }
   else
      nl.SetValue("EMailAddress", "");
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:31,代码来源:KV_CCIN2P3_GE.cpp

示例4: Merge

void KVNameValueList::Merge(const KVNameValueList& other)
{
   // Merge other list into this one.
   // Any parameters in 'other' which do not exist in this one are added.
   // Any parameters which exist in both have their values summed.

   for (int i = 0; i < other.GetNpar(); ++i) {
      KVNamedParameter* np_other = other.GetParameter(i);
      AddValue(*np_other);
   }
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:11,代码来源:KVNameValueList.cpp

示例5: it

KVNameValueList KVNameValueList::operator += (const KVNameValueList& nvl)
{
   TIter it(nvl.GetList());
   KVNamedParameter* par = 0;
   while ((par = (KVNamedParameter*)it())) SetValue(*par);
   return *this;
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:7,代码来源:KVNameValueList.cpp

示例6: GetArrayMultiplicities

void KVExpSetUp::GetArrayMultiplicities(KVReconstructedEvent* e, KVNameValueList& m, Option_t* opt)
{
   // Calculate multiplicities of particles in each array of the setup.
   // They will appear in the KVNameValueList as parameters with the name of the array.
   // e.g.
   //
   //    "INDRA" = 21
   //    "FAZIA" = 3
   //
   // Any option given will be used to determine the type of event iterator used -
   // see KVEvent::GetNextParticleIterator(Option_t*).

   m.Clear();
   for (KVEvent::Iterator it = e->GetNextParticleIterator(opt); it != e->end(); ++it) {
      m.IncrementValue((*it).GetParameters()->GetStringValue("ARRAY"), 1);
   }
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:17,代码来源:KVExpSetUp.cpp

示例7: Compare

//______________________________________________
Int_t KVNameValueList::Compare(const TObject* obj) const
{
   // Compare the contents of two KVNameValueList
   // Returns the number of same parameters (name and value)

   KVNameValueList* nvl = (KVNameValueList*)obj;
   Int_t neq = 0;
   Int_t np1 = GetNpar();
   Int_t np2 = nvl->GetNpar();
   for (Int_t ii = 0; ii < np1; ii += 1) {
      for (Int_t jj = 0; jj < np2; jj += 1) {

         if (*(GetParameter(ii)) == *(GetParameter(jj)))  neq += 1;
      }
   }
   return neq;

}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:19,代码来源:KVNameValueList.cpp

示例8: RunHasFileWithDateAndName

KVNameValueList* KVAvailableRunsFile::RunHasFileWithDateAndName(Int_t run, const Char_t* filename, TDatime modtime, Int_t& OccNum)
{
   // look in previously read infos (see ReadFile) to see if, for a given run, there is a file with the
   // given name and modification date/time
   // if so, returns the address of the KVNameValueList for the run & sets OccNum to the index number of
   // the corresponding entry (in case of several files for the run)
   // if not, returns NULL
   
   if(!fAvailableRuns) return NULL;
   // is run already in list ?
   KVNameValueList* NVL = (KVNameValueList*)fAvailableRuns->FindObject(Form("%d",run));
   if(!NVL) return NULL;
   Int_t Occurs = NVL->GetIntValue("Occurs");
   for(OccNum=0; OccNum<Occurs; OccNum++){
      if( NVL->IsValue( Form("Filename[%d]",OccNum) , filename ) && NVL->IsValue( Form("Date[%d]",OccNum) , modtime.AsSQLString() ) ) return NVL;
   }
   return NULL;
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:18,代码来源:KVAvailableRunsFile.cpp

示例9: if

void KVIonRangeTableMaterial::PrintComposition(ostream& output) const
{
   // Print to stream the composition of this material, in a format compatible with the VEDALOSS parameter file.
   if (IsCompound()) output << "COMPOUND";
   else if (IsMixture()) output << "MIXTURE";
   else output << "ELEMENT";
   output << endl;
   if (IsCompound() || IsMixture()) {
      output << fComposition->GetEntries() << endl;
      TIter next(fComposition);
      KVNameValueList* nvl;
      while ((nvl = (KVNameValueList*)next())) {
         KVNucleus n(nvl->GetIntValue("Z"), nvl->GetIntValue("A"));
         output << n.GetZ() << " " << n.GetA() << " " << nvl->GetIntValue("Natoms");
         if (IsMixture()) output << " " << nvl->GetDoubleValue("Proportion");
         output << endl;
      }
   }
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:19,代码来源:KVIonRangeTableMaterial.cpp

示例10: SetJobTime

void KV_CCIN2P3_GE::SetBatchSystemParameters(const KVNameValueList& nl)
{
   // Use the parameters in the list to set all relevant parameters for batch system.

   KVBatchSystem::SetBatchSystemParameters(nl);
   SetJobTime(nl.GetStringValue("JobTime"));
   SetJobMemory(nl.GetStringValue("JobMemory"));
   SetJobDisk(nl.GetStringValue("JobDisk"));
   SetMultiJobsMode(nl.GetBoolValue("MultiJobsMode"));
   SetRunsPerJob(nl.GetIntValue("RunsPerJob"));
   if (nl.GetTStringValue("EMailAddress") != "") {
      if (nl.GetBoolValue("EMailOnStart")) SetSendMailOnJobStart();
      if (nl.GetBoolValue("EMailOnEnd")) SetSendMailOnJobEnd();
      SetSendMailAddress(nl.GetStringValue("EMailAddress"));
   }
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:16,代码来源:KV_CCIN2P3_GE.cpp

示例11: sysdir

Int_t KVRunListCreator::ScanDirectory()
{
   // Return number of runs found

   KVSystemDirectory sysdir("rundir", GetRunDir());
   TIter it(sysdir.GetListOfFiles());
   KVSystemFile* sysfile;
   int howmany = 0;
   while ((sysfile = (KVSystemFile*)it())) {
      int run_num;
      if ((run_num = KVAvailableRunsFile::IsRunFileName(GetFileFormat(), sysfile->GetName()))) {
         KVDatime when;
         if (KVAvailableRunsFile::ExtractDateFromFileName(GetFileFormat(), sysfile->GetName(), when)) {
            ++howmany;
            KVNameValueList* infos = new KVNameValueList;
            infos->SetName(Form("run%06d", run_num));
            infos->SetValue("Run", run_num);
            infos->SetValue("Start", when.AsSQLString());
            infos->SetValue("End", sysfile->GetDate());
            Int_t x = sysfile->GetSize();
            if (x == sysfile->GetSize())
               infos->SetValue("Size", x);
            else
               infos->SetValue64bit("Size", sysfile->GetSize());
            if (fDataType != "") {
               fReader.reset(KVRawDataReader::OpenFile(fDataType, Form("%s/%s", sysdir.GetTitle(), sysfile->GetName())));
               ULong64_t events = 0;
               while (fReader->GetNextEvent()) ++events;
               Int_t x = events;
               if (x == events)
                  infos->SetValue("Events", x);
               else
                  infos->SetValue64bit("Events", events);
            }
            infos->ls();
            fRunInfos.Add(infos);
         }
      }
   }
   return howmany;
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:41,代码来源:KVRunListCreator.cpp

示例12: next

void KVRangeYanezMaterial::Initialize()
{
   KVIonRangeTableMaterial::Initialize();
   if(IsCompound()){
      fNelem=0;
      iabso=-1;
      TIter next(fComposition);
      KVNameValueList* nvl;
      while( (nvl = (KVNameValueList*)next()) ){
         fAbsorb[fNelem].z = nvl->GetIntValue("Z");
         fAbsorb[fNelem].a = nvl->GetIntValue("A");
         fAbsorb[fNelem].w = nvl->GetDoubleValue("Ar*Weight");
         fNelem++;
      }
   }
   else if(IsMixture()){
      fNelem=0;
      iabso=-1;
      TIter next(fComposition);
      KVNameValueList* nvl;
      while( (nvl = (KVNameValueList*)next()) ){
         fAbsorb[fNelem].z = nvl->GetIntValue("Z");
         fAbsorb[fNelem].a = nvl->GetIntValue("A");
         fAbsorb[fNelem].w = nvl->GetDoubleValue("Ar*Weight");
         fNelem++;
      }
   }
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:28,代码来源:KVRangeYanezMaterial.cpp

示例13: printf

void KVIonRangeTableMaterial::Print(Option_t*) const
{
   printf("Material : %s (%s)   State : %s\n",
          GetName(), GetSymbol(), fState.Data());
   printf("\tEffective Z=%f, A=%f  ", fZmat, fAmat);
   if (IsGas()) printf(" Molar Weight = %f g.", fMoleWt);
   else printf(" Density = %f g/cm**3", fDens);
   printf("\n");
   if (IsCompound()) printf("\tCompound material:\n");
   else if (IsMixture())  printf("\tMixed material:\n");
   if (IsCompound() || IsMixture()) {
      TIter next(fComposition);
      KVNameValueList* nvl;
      while ((nvl = (KVNameValueList*)next())) {
         KVNucleus n(nvl->GetIntValue("Z"), nvl->GetIntValue("A"));
         printf("\t\tElement: %s   Ar=%f g.   Natoms=%d", n.GetSymbol(), n.GetAtomicMass(), nvl->GetIntValue("Natoms"));
         if (IsMixture()) printf("   Proportion=%f", nvl->GetDoubleValue("Proportion"));
         printf("\n");
      }
   }
   printf("\n\n");
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:22,代码来源:KVIonRangeTableMaterial.cpp

示例14: n

void KVIonRangeTableMaterial::AddCompoundElement(Int_t Z, Int_t A, Int_t Natoms)
{
   // Add an element to a compound material
   // Example: to define C3F8 gas:
   //      toto.AddCompoundElement(6,12,3);
   //      toto.AddCompoundElement(9,19,8);

   fCompound = kTRUE;
   KVNucleus n(Z, A);
   Int_t nel = 0;
   if (!fComposition) {
      fComposition = new KVList;
   }
   else nel = fComposition->GetEntries();
   KVNameValueList* l = new KVNameValueList(Form("Compound element %d", nel + 1));
   l->SetValue("Z", Z);
   l->SetValue("A", A);
   l->SetValue("Ar", n.GetAtomicMass());
   l->SetValue("Natoms", Natoms);
   l->SetValue("Weight", Natoms);
   l->SetValue("Ar*Weight", n.GetAtomicMass()*Natoms);
   fComposition->Add(l);
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:23,代码来源:KVIonRangeTableMaterial.cpp

示例15: next

void KVIonRangeTableMaterial::Initialize()
{
   // Correctly initialize material ready for use
   // For compound or mixed materials, calculate normalised weights of components,
   // effective Z and A, and molar weight of substance

   fMoleWt = 0.;
   if (IsCompound() || IsMixture()) {
      // mixture or compound
      // calculate molar weight and effective Z & A
      fZmat = fAmat = 0;
      TIter next(fComposition);
      KVNameValueList* nvl;
      Double_t totW = 0;
      while ((nvl = (KVNameValueList*)next())) {
         Double_t arw = nvl->GetDoubleValue("Ar*Weight");
         Double_t poid = nvl->GetDoubleValue("Weight");
         fMoleWt += arw;
         totW += poid;
         fZmat += poid * nvl->GetIntValue("Z");
         fAmat += poid * nvl->GetIntValue("A");
      }
      fZmat /= totW;
      fAmat /= totW;
      next.Reset();
      while ((nvl = (KVNameValueList*)next())) {
         Double_t prop = nvl->GetDoubleValue("Weight");
         nvl->SetValue("NormWeight", prop / totW);
      }
   }
   else {
      // isotopically-pure elemental material
      // get mass of 1 mole of element
      KVNucleus n(fZmat, fAmat);
      fMoleWt = n.GetAtomicMass();
   }
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:37,代码来源:KVIonRangeTableMaterial.cpp


注:本文中的KVNameValueList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。