Example #1
0
    void Config::dumpConfig(TDirectory* const dir, std::string const name)
    {
      if (dir) {
        TObjArray array(getEnv().GetTable()->GetSize());
	array.SetOwner(kTRUE);

	TIter next(getEnv().GetTable());
	TEnvRec *er;
	static const char *lc[] = { "Global", "User", "Local", "Changed" };

	size_t index = 0;
	while ((er = (TEnvRec*) next())) {
	  TObjString* str = new TObjString(Form("%-25s: %-30s [%s]",
						er->GetName(),
						er->GetValue(),
						lc[er->GetLevel()]));
	  array[index] = str;
	  ++index;
	} // while

	dir->cd();
	array.Write(name.c_str(),TObject::kSingleKey);
	//      array.Write();
      }

      return;
    }
Example #2
0
    void Config::dumpConfig(std::ostream& stream)
    {
      TIter next(getEnv().GetTable());
      TEnvRec *er;
      static const char *lc[] = { "Global", "User", "Local", "Changed" };

      stream << "cafe::Config: Dumping configuration settings" << std::endl;
      while ((er = (TEnvRec*) next()))
        stream << Form("%-25s: %-30s [%s]",
		       er->GetName(),er->GetValue(),lc[er->GetLevel()]) << std::endl;
      stream << "cafe::Config: End of configuration settings" << std::endl;

      return;
    }
Example #3
0
void KVINDRA::LinkToCodeurs()
{

   // Link detectors with electronic modules
   // for the moment only QDC for Si and ChIo are implemented
   // This information is accessible via KVINDRADetector::GetNumeroCodeur()
   // To be active one has to put in the dataset directory
   // a file name Codeurs.dat containing the name of the file for the concerned type
   // of electronic module
   // for example see INDRA_e613 dataset
   // [dataset name].INDRADB.Codeurs:    ...


   KVFileReader flist;
   TString fp;
   if (!KVBase::SearchKVFile(gDataSet->GetDataSetEnv("INDRADB.Codeurs", ""), fp, gDataSet->GetName())) {
      Warning("LinkToCodeurs", "Fichier %s, inconnu au bataillon", gDataSet->GetDataSetEnv("INDRADB.Codeurs", ""));
      return;
   }

   if (!flist.OpenFileToRead(fp.Data())) {
      //Error("ReadGainList","Error opening file named %s",fp.Data());
      return;
   }
   Info("LinkToCodeurs()", "Reading correspondance Codeur-Detecteur ...");

   TEnv* env = 0;
   KVINDRADetector* idet = 0;
   while (flist.IsOK()) {
      flist.ReadLine(NULL);
      KVString file = flist.GetCurrentLine();
      if (file != "") {
         if (KVBase::SearchKVFile(file.Data(), fp, gDataSet->GetName())) {
            env = new TEnv();
            env->ReadFile(fp.Data(), kEnvAll);
            TEnvRec* rec = 0;
            TObjArray* toks = 0;
            TIter it(env->GetTable());
            while ((rec = (TEnvRec*)it.Next())) {
               if (!strcmp(rec->GetName(), "type")) {
                  Info("LinkToCodeurs", "Module type %s", rec->GetValue());
               }
               else {
                  toks = TString(rec->GetValue()).Tokenize(",");
                  for (Int_t ii = 0; ii < toks->GetEntries(); ii += 1) {
                     idet = (KVINDRADetector*)gIndra->GetDetector(((TObjString*)toks->At(ii))->GetString().Data());
                     if (idet)
                        idet->SetNumeroCodeur(TString(rec->GetName()).Atoi());
                  }
                  delete toks;
               }
            }
            delete env;
         }
      }
   }

   flist.CloseFile();


}