コード例 #1
0
ファイル: KVFAZIADetector.cpp プロジェクト: pwigg/kaliveda
//________________________________________________________________
Bool_t KVFAZIADetector::SetProperties()
{
	// detector name are assumed to be defined as
   // SI2-T2-Q2-B001
	//	CSI-T2-Q2-B001
	// SI1-T1-Q1-B001
	//
   
   KVString tmp;
   KVString sname(GetName());
   sname.Begin("-");
   SetLabel(sname.Next());
	gFazia->AddDetectorLabel(GetLabel());
   
	tmp = sname.Next(); tmp.ReplaceAll("T",""); fTelescope = tmp.Atoi();
	tmp = sname.Next(); tmp.ReplaceAll("Q",""); fQuartet = tmp.Atoi();
	tmp = sname.Next(); tmp.ReplaceAll("B",""); fBlock = tmp.Atoi();
	KVSignal* sig=0;
   //"QH1", "I1", "QL1", "Q2", "I2", "Q3
	if (fSignals)
   	delete fSignals;
   fSignals = new KVList(kTRUE);
	KVString lsignals="";
   if ( !strcmp(GetLabel(),"SI1") ) {	lsignals="QH1,I1,QL1";	}
   else if ( !strcmp(GetLabel(),"SI2" ) ) {	lsignals="Q2,I2";	}
	else if ( !strcmp(GetLabel(),"CSI" ) ) {	lsignals="Q3";	}
   else{
   	Warning("SetProperties","Unknown label \"%s\" for this detector : %s\n",GetLabel(),GetName());
		lsignals="";
	}
   
	lsignals.Begin(",");
	while ( !lsignals.End() )
	{
		KVString ssig = lsignals.Next();
		if (ssig.BeginsWith("Q")){
			sig = new KVChargeSignal(ssig.Data());
		}
		else if (ssig.BeginsWith("I")){
			sig = new KVCurrentSignal(ssig.Data());
		}
		else{
			Warning("unknown format signal detectorlabel=%s, signal=%s\n",GetLabel(),ssig.Data());
			sig = new KVSignal(ssig.Data(),"unknown");
		}
		
		sig->LoadPSAParameters(GetLabel());
		sig->SetDetectorName(GetName());
		fSignals->Add(sig);
	}
	
	return kTRUE;
}
コード例 #2
0
//___________________________________________________________________________________________
void KVIntegerList::SetPartition(const Char_t* par)
{
//protected method, utilisée par le Streamer qui utilise le champ fName de la classe TNamed
//voir également KVIntegerList::DeducePartitionFromTNamed
   KVString st(par);
   st.Begin(" ");
   TObjArray* toks = 0;
   while (!st.End()) {
      KVString tamp = st.Next();
      Int_t val;
      Int_t freq;
      if (tamp.Contains("(")) {
         if (!tamp.Contains(")")) {
            Warning("SetPartition", "%s ->pb de coherence dans les parentheses", tamp.Data());
            return;
         } else {
            toks = tamp.Tokenize("(");
            val = ((TObjString*)toks->At(0))->GetString().Atoi();
            freq = ((TObjString*)toks->At(1))->GetString().Atoi();
            delete toks;
         }
      } else {
         val = tamp.Atoi();
         freq = 1;
      }
      Add(val, freq);
   }

}
コード例 #3
0
Bool_t KVSimReader_SMF_asym::ReadHeader(){

	KVString snom;
	Int_t res = ReadLineAndCheck(1," ");
	switch (res){
	case 0:
		return kFALSE; 
	case 1:
		snom.Form("%s",GetReadPar(0).Data());
		snom.ReplaceAll("evt_","");
		//Info("ReadHeader","lecture %d",snom.Atoi());
		nv->SetValue("event_number",snom.Atoi());
		
		break;
	default:
		return kFALSE;	
	}
	
	res = ReadLineAndCheck(1," ");
	switch (res){
	case 0:
		return kFALSE; 
	case 1:
		nv->SetValue("ndes",GetIntReadPar(0));
		ndes = 0;
		
		return kTRUE;
	default:
		return kFALSE;	
	}


}