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


C++ KVNameValueList::GetNpar方法代码示例

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


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

示例1: 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

示例2: 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

示例3: AddGetSetMethods

void KVClassFactory::AddGetSetMethods(const KVNameValueList& nvl)
{
   // For each named parameter in the list, we add protected member variables and
   // public Get/Set methods with the name and type of the parameter.
   // Example: given a list containing NAME="some string" NUMBER=3 [integer]
   // PI=3.141592 [double], we generate the methods
   //   void SetNAME(const TString&);
   //   const TString& GetNAME() const;
   //   void SetNUMBER(Int_t);
   //   Int_t GetNUMBER() const;
   //   void SetPI(Double_t);
   //   Double_t GetPI() const;

   int npars = nvl.GetNpar();
   for(int i=0; i<npars; i++){
      KVNamedParameter* par = nvl.GetParameter(i);
      if(par->IsString()){
         KVClassMember* v = AddMember(par->GetName(),"TString","member automatically generated by KVClassFactory::AddGetSetMethods");
         KVClassMethod* m = AddMethod(Form("Set%s",par->GetName()), "void");
         m->AddArgument("const TString&");
         m->SetMethodBody(
Form("    // Method automatically generated by KVClassFactory::AddGetSetMethods\n"
"\n"
"    %s=arg1;", v->GetName())
         );
         m = AddMethod(Form("Get%s",par->GetName()), "const TString&", "public", kFALSE, kTRUE);
         m->SetMethodBody(
Form("    // Method automatically generated by KVClassFactory::AddGetSetMethods\n"
"\n"
"    return %s;", v->GetName())
                  );
         // make sure #include "TString.h" appears in header file
         if( ! fHeadInc.FindObject("TString.h") ) AddHeaderIncludeFile("TString.h");
      }
      else if(par->IsInt()){
         KVClassMember* v = AddMember(par->GetName(),"Int_t","member automatically generated by KVClassFactory::AddGetSetMethods");
         KVClassMethod* m = AddMethod(Form("Set%s",par->GetName()), "void");
         m->AddArgument("Int_t");
         m->SetMethodBody(
Form("    // Method automatically generated by KVClassFactory::AddGetSetMethods\n"
"\n"
"    %s=arg1;", v->GetName())
         );
         m = AddMethod(Form("Get%s",par->GetName()), "Int_t", "public", kFALSE, kTRUE);
         m->SetMethodBody(
Form("    // Method automatically generated by KVClassFactory::AddGetSetMethods\n"
"\n"
"    return %s;", v->GetName())
                  );
      }
      else if(par->IsDouble()){
         KVClassMember* v = AddMember(par->GetName(),"Double_t","member automatically generated by KVClassFactory::AddGetSetMethods");
         KVClassMethod* m = AddMethod(Form("Set%s",par->GetName()), "void");
         m->AddArgument("Double_t");
         m->SetMethodBody(
Form("    // Method automatically generated by KVClassFactory::AddGetSetMethods\n"
"\n"
"    %s=arg1;", v->GetName())
         );
         m = AddMethod(Form("Get%s",par->GetName()), "Double_t", "public", kFALSE, kTRUE);
         m->SetMethodBody(
Form("    // Method automatically generated by KVClassFactory::AddGetSetMethods\n"
"\n"
"    return %s;", v->GetName())
                  );
      }
   }
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:68,代码来源:KVClassFactory.cpp

示例4: DetectEvent

void KVINDRA_VAMOS::DetectEvent(KVEvent* event, KVReconstructedEvent* rec_event, const Char_t* detection_frame)
{

   // the ROOT geometry can not be use for filtering
   SetROOTGeometry(kFALSE);

   // iterate through list of particles
   // and detect in VAMOS
   KVNucleus* part, *_part;
   KVNameValueList* nvl = NULL;
   Bool_t isVAMOSevent = kFALSE;
   static KVVAMOSReconEvent tmp_rec_vamos_event;
   tmp_rec_vamos_event.Clear();

   while ((part = event->GetNextParticle())) {  // loop over particles


#ifdef KV_DEBUG
      cout << "DetectEvent(): looking at particle in VAMOS---->" << endl;
      part->Print();
#endif
      _part = (KVNucleus*)part->GetFrame(detection_frame, kFALSE);

      if (_part->GetTheta() > 14) continue;

      _part->SetE0();
      Double_t eLostInTarget = 0;

      if (fTarget && (fFilterType != kFilterType_Geo)) {
         fTarget->SetOutgoing(kTRUE);
         //simulate passage through target material
         Double_t ebef = _part->GetKE();
         fTarget->DetectParticle(_part);
         eLostInTarget = ebef - _part->GetKE();
         if (_part->GetKE() < 1.e-3) {
            part->GetParameters()->SetValue("UNDETECTED", "STOPPED IN TARGET");

            part->AddGroup("UNDETECTED");
            part->AddGroup("STOPPED IN TARGET");
         }
         fTarget->SetOutgoing(kFALSE);

      }


      if ((_part->GetKE() > 1.e-3) && (nvl = GetVAMOS()->DetectParticle(_part)) && (nvl->GetNpar() > 0)) {

         _part->SetMomentum(*_part->GetPInitial());

         isVAMOSevent = kTRUE;
         KVVAMOSReconNuc* recon_nuc = (KVVAMOSReconNuc*)tmp_rec_vamos_event.AddParticle();

         // copy parameter list
         part->GetParameters()->Copy(*(recon_nuc->GetParameters()));


         recon_nuc->SetZandA(part->GetZ(), part->GetA());

         recon_nuc->SetMomentum(_part->GetMomentum());
         recon_nuc->SetQ(_part->GetParameters()->GetIntValue("Q"));
         recon_nuc->SetBrho(_part->GetParameters()->GetDoubleValue("Brho"));
         recon_nuc->GetParameters()->SetValue("Delta", _part->GetParameters()->GetDoubleValue("Delta"));
         recon_nuc->SetThetaVandPhiV(_part->GetParameters()->GetDoubleValue("ThetaV"),
                                     _part->GetParameters()->GetDoubleValue("PhiV"));

         recon_nuc->GetParameters()->SetValue("DETECTED", "OK");
         recon_nuc->SetTargetEnergyLoss(eLostInTarget);
         recon_nuc->SetIsIdentified();
         recon_nuc->SetIsCalibrated();
         recon_nuc->SetIsOK();
         recon_nuc->SetZMeasured();
         recon_nuc->SetQMeasured();
         recon_nuc->SetAMeasured();
         //recon_nuc->SetIsBasicQandAidentified();

         // Clear this nucleus detected in VAMOS in order to inhibit the
         // its detection in INDRA
         part->Clear();

      } else _part->SetMomentum(*_part->GetPInitial());

      SafeDelete(nvl);
   }     //fin de loop over particles

   // if a nucleus is detected in VAMOS then continue filtering the event in INDRA
   if (isVAMOSevent) {
      //       Info("DetectEvent","event %d is a VAMOS event",event->GetNumber());
      GetINDRA()->DetectEvent(event, rec_event, detection_frame);

      // Set the reconstructed nucleus detected in VAMOS in the VAMOS event
      KVVAMOSReconEvent* rec_vamos_event = ((KVIVReconEvent*)rec_event)->GetVAMOSEvent();
      tmp_rec_vamos_event.Copy(*rec_vamos_event);

      //    rec_event->Print();
   }
}
开发者ID:FableQuentin,项目名称:kaliveda,代码行数:96,代码来源:KVINDRA_VAMOS.cpp


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