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


C++ TString::Prepend方法代码示例

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


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

示例1: FinishBatch

void FinishBatch(TString sInput="", TString sOutput="ARHist"){

  // Stuff to do at the end of an analysis run
  // Here all spectra are saved to disk
  printf("Events: %d      Events Accepted: %d\n",
	 gAN->GetNEvent(), gAN->GetNEvAnalysed() );
  printf("End-of-Run macro executing\n");

  TString sDir = gAR->GetTreeDir();
  TString sFile;
  if (gAR->IsOnline()) sFile = gAR->GetFileName();
  else sFile = gAR->GetTreeFile()->GetName();
  while(sFile.Contains("/")) sFile.Remove(0,1+sFile.Index("/"));
  sFile.ReplaceAll(".dat",".root");
  if(sInput.Length() && sFile.BeginsWith(sInput)) sFile.Remove(0,sInput.Length());
  else sFile.Prepend("_");
  sFile.Prepend(sOutput);
  sFile.Prepend(sDir);
  
  // Save histograms to file and close it
  TFile f(sFile, "recreate");
  if( !f ){
    printf("Open file %s for histogram save FAILED!!\n",sFile.Data());
    return;
  }
  gROOT->GetList()->Write();
  f.Close();
  printf("All histograms saved to %s\n",sFile.Data());

  if (!(gAR->IsOnline())) gSystem->Exit(0);

}
开发者ID:collicott,项目名称:acqu,代码行数:32,代码来源:FinishBatch.C

示例2: Finish

void Finish(TString sDir = "")
{

  // Finishing Macro for running with Worker
  printf("Events: %d      Events Accepted: %d\n", 
	gAN->GetNEvent(), gAN->GetNEvAnalysed() );

  printf("\nEnd-of-Run macro executing\n");

  // If user has not specified output directory, pull from AR
  if(sDir.Length() == 0) sDir = gAR->GetTreeDir();
  if(sDir.Length() == 0) sDir = "~/";
  
  // Append "/" to Directory if unspecified
  if(!(sDir.EndsWith("/"))) sDir.Append("/");

  // Create output filename from input file name
  TString sFile;
  if (gAR->IsOnline()) sFile = gAR->GetFileName();
  else sFile = gAR->GetTreeFile()->GetName();
  while(sFile.Contains("/")) sFile.Remove(0,1+sFile.Index("/"));
  sFile.ReplaceAll(".dat",".root");
  sFile.Prepend("Hist_");
  sFile.Prepend(sDir);

  // Save histograms to file and close it
  TFile f(sFile, "recreate");
  f.SetCompressionLevel(4);
  gROOT->GetList()->Write();
  f.Close();
  cout << "All histograms saved to " << sFile << endl;

  gSystem->Exit(0);

}
开发者ID:LightninGreen,项目名称:acqu,代码行数:35,代码来源:FinishWorker.C

示例3: RecoQA

void RecoQA(const char* inFile) {
  gROOT->LoadMacro("bfcread_hist_prefixes_add_to_ps.C");

  TString baseName = inFile;
  if (baseName.EndsWith(".daq"))
    baseName.ReplaceAll(".daq",".hist.root");
  else if (baseName.EndsWith(".event.root"))
    baseName.ReplaceAll(".event.root",".hist.root");
  else if (baseName.EndsWith(".MuDst.root"))
    baseName.ReplaceAll(".MuDst.root",".hist.root");

  TString histFile = baseName;

  baseName.Remove(0,baseName.Last('/')+1);

  TString outputName = baseName;
  outputName.ReplaceAll(".root",".CC");

  TString histList = "StRoot/St_QA_Maker/QAhlist_Reco.h";
  if (! gSystem->Which(".",histList.Data()))
    histList.Prepend(gSystem->ExpandPathName("$STAR/"));
  
  bfcread_hist_prefixes_add_to_ps(histFile.Data(),"EventQA",
    "bfcTree",outputName.Data(),baseName.Data(),histList.Data());
}
开发者ID:star-bnl,项目名称:star-macros,代码行数:25,代码来源:RecoQA.C

示例4: SETUP_LoadLibraries

Bool_t SETUP_LoadLibraries(const TString &libs) {

  // Loads a list of colon-separated libraries. Returns kTRUE on success, kFALSE
  // if at least one library couldn't load properly. Does not check for double
  // loads (but ROOT does).

  TString l;
  Ssiz_t from;

  while ( libs.Tokenize(l, from, ":") ) {
    if (l.IsNull()) continue;
    if (!l.BeginsWith("lib")) l.Prepend("lib");
    if (l.EndsWith(".so")) l.Remove(l.Length()-3, l.Length());

    ::Info(gMessTag.Data(), ">> Loading library %s...", l.Data());

    if (gSystem->Load(l.Data()) < 0) {
       ::Error(gMessTag.Data(), "Error loading %s, aborting", l.Data());
       return kFALSE;  // failure
    }
  }

  return kTRUE;  // success

  return 0;
}
开发者ID:MycrofD,项目名称:cern-alice-setup,代码行数:26,代码来源:AliRoot_SETUP.C

示例5: RsnSetData

void RsnSetData(AliAnalysisAlien *plugin,TString dsConf,Int_t numRuns = 1000,Int_t numRunsSkip=0,Int_t maxRunsPerMaster = 1000) {

   Bool_t dsFound = kTRUE;
   Int_t nRunsPerMaster = 0;

   Bool_t valid = kTRUE;
   TString legoTrainPath = AliAnalysisManager::GetGlobalStr("rsnLegoTrainPath",valid);

   if (gSystem->AccessPathName(dsConf.Data())) dsConf.Prepend(Form("%s/",legoTrainPath.Data()));
   dsConf = gSystem->ExpandPathName(dsConf.Data());

   if (dsConf.Contains(".txt")) {
      ifstream in;
      in.open(dsConf.Data());
      if (!in.is_open()) Fatal("RsnSetData",Form("File %s was not found !!!",dsConf.Data()));
      Printf("DS config file : %s",dsConf.Data());
      TString line;
      Bool_t isRun = kFALSE;
      while (in.good())
      {
         in >> line;
         if (line.IsNull()) continue;
         if (line.Contains("BASE")) {
            GetParameterFromConfig(line);
            plugin->SetGridDataDir(line.Data());
            Printf("BASE -> %s",line.Data());
            continue;
         }
         if (line.Contains("PREFIX")) {
            GetParameterFromConfig(line);
            plugin->SetRunPrefix(line.Data());
            Printf("PREFIX -> %s",line.Data());
            continue;
         }
         if (line.Contains("DATA_PATTERN")) {
            GetParameterFromConfig(line);
            plugin->SetDataPattern(line.Data());
            Printf("DATA_PATTERN -> %s",line.Data());
            continue;
         }
         if (!line.CompareTo("RUNS")) {
            isRun = kTRUE;
            in >> line;
         }
         if (isRun) {
            if (numRunsSkip>0) {
               numRunsSkip--;
               continue;
            } else {
               if (nRunsPerMaster < numRuns ) {
                  Printf("Adding RUN : %s",line.Data());
                  plugin->AddRunNumber(line.Data());
                  nRunsPerMaster++;
               } else {
                  break;
               }

            }
         }
      }
开发者ID:fbellini,项目名称:AliRsn,代码行数:60,代码来源:RsnGridPlugin.C

示例6: FinishData

void FinishData( TString proc, TString tgt, TString name)
{
	TString path;

	cout << "End-of-Run macro executing";
	cout << endl;

	path =  "histograms/";

	if ( proc == "comp") path.Append( "Compton/");
	else if ( proc == "pi0") path.Append( "Pi0/");
	if ( tgt == "full") path.Append( "Full/");
	else if ( tgt == "empty") path.Append( "Empty/");

	path.Append( name);
	path.Append( ".root");
	TFile f( path, "recreate");
	gROOT->GetList()->Write();
	f.Close();

	path.Prepend( "All histograms saved to \"");
	path.Append( "\"");
	cout << path;
	cout << endl;
}
开发者ID:collicott,项目名称:old-working-acqu,代码行数:25,代码来源:Finish.C

示例7: WritePreProc

//___________________________________________________
void KVClassFactory::WritePreProc(ofstream & file)
{
   //Write pre-processor directives in file
   //i.e. '#ifndef __TOTO_H' etc.
   //If this class has inheritance, we add '#include "base_class.h"' for each of the base classes.
   //and any other include files added using AddHeaderIncludeFile

   TString tmp = fClassName;
   tmp.ToUpper();
   tmp.Prepend("__");
   tmp.Append("_H");
   file << "#ifndef " << tmp.Data() << endl;
   file << "#define " << tmp.Data() << "\n" << endl;
   //base class(es) ?
   if (fHasBaseClass) {
		if(WithMultipleBaseClasses()){
			fBaseClassName.Begin(",");
			while( !fBaseClassName.End() )
				file << "#include \"" << fBaseClassName.Next(kTRUE) << ".h\"" << endl;
			file << endl;
		}
		else
	file << "#include \"" << fBaseClassName.Data() << ".h\"\n" << endl;
   }
   if( fHeadInc.GetSize() ){
      TIter next(&fHeadInc); TObjString* str;
      while( (str = (TObjString*)next()) ){
         file << "#include \"" << str->String().Data() << "\"\n" << endl;
      }
   }
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:32,代码来源:KVClassFactory.cpp

示例8: PlotDataResults

//_______________________________________
void PlotDataResults(const char* filenameData, const char* filenameMC="", Bool_t save=kFALSE)
{
  if (!addToName.IsNull()) addToName.Prepend("-");
  AliDielectronCFdraw d(filenameData);
  AliDielectronCFdraw dCorr("corrCont","corrCont");
  TString nameCorr(filenameMC);
  if (!nameCorr.IsNull()) d.SetCFContainers(nameCorr.Data());
  TFile f(filenameData);
  TH1 *hStats=(TH1*)f.Get("hEventStat");
  if (!f.IsOpen() || f.IsZombie() || !hStats) return;
  hStats->SetDirectory(0);
  f.Close();
  
  Int_t stepFirst=0, stepAny=1, stepTOFmix=2;
  
  gStyle->SetOptStat(0);
  //Set common Ranges
  d.SetRangeUser("Leg1_NclsTPC",70.,170.);
  d.SetRangeUser("Leg2_NclsTPC",70.,170.);
  d.SetRangeUser("Leg1_Pt",1.01,100000);
  d.SetRangeUser("Leg2_Pt",1.01,100000);
  d.SetRangeUser("Leg1_Eta",-0.899,0.899);
  d.SetRangeUser("Leg2_Eta",-0.899,0.899);

  d.SetRangeUser("Leg1_TPC_nSigma_Electrons",-3.,2.99);
  d.SetRangeUser("Leg2_TPC_nSigma_Electrons",-3.,2.99);
  d.SetRangeUser("Leg1_TPC_nSigma_Pions",3.51,20); 
  d.SetRangeUser("Leg2_TPC_nSigma_Pions",3.51,20); 
  d.SetRangeUser("Leg1_TPC_nSigma_Protons",3.01,20); 
  d.SetRangeUser("Leg2_TPC_nSigma_Protons",3.01,20);

//   d.SetRangeUser("Pt",0,1000);
  
  d.SetRangeUser("M",0.5,5.);
  //============================
  //SPD first
  //
  
  //--- Like sign subtraction
  AliDielectronSignalBase *sigFirst=GetSignalLS(d,stepFirst);
  SetStyle(sigFirst,"ITS First - Like Sign subtraction");
  DrawSpectra(sigFirst,"cFirst",hStats,save);
  //--- Like sign subtraction Arithmetic mean
  AliDielectronSignalBase *sigFirstArith=GetSignalLS(d,stepFirst,AliDielectronSignalBase::kLikeSignArithm);
  SetStyle(sigFirstArith,"ITS FirstArith - Like Sign subtraction");
  DrawSpectra(sigFirstArith,"cFirstArith",hStats,save);
  
  //============================
  //SPD any
  //
  AliDielectronSignalBase *sigAny=GetSignalLS(d,stepAny);
  SetStyle(sigAny,"ITS Any - Like Sign subtraction");
  DrawSpectra(sigAny,"cAny",hStats,save);
  //--- like sign with arithmetic mean
  AliDielectronSignalBase *sigAnyArith=GetSignalLS(d,stepAny,AliDielectronSignalBase::kLikeSignArithm);
  SetStyle(sigAnyArith,"ITS Any - Like Sign subtraction (Arithm. mean)");
  DrawSpectra(sigAnyArith,"cAnyArith",hStats,save);
  
  if (hStats) delete hStats;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:61,代码来源:PlotDataResults.C

示例9: OpenGeneData

Bool_t KVINDRAPulserDataTree::OpenGeneData(Int_t run, ifstream &f)
{
	// Open gene data for one run
	// We look for file 'runXXXX.gene' in the directory given by
	// environment variable KVINDRAPulserDataTree.GeneDetDir.

	TString fname; fname.Form("/run%d.gene", run);
	fname.Prepend(gDataSet->GetDataSetEnv("KVINDRAPulserDataTree.GeneDetDir",""));
	return gDataSet->OpenDataSetFile(fname.Data(),f);
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:10,代码来源:KVINDRAPulserDataTree.cpp

示例10: PublishCanvas

void PublishCanvas(TList *qaList, const char* det, const char* name, TString nadd)
{
  //
  // draw all nSigma + signal histo
  //


  TObjArray arrHistos;

  TPaveText pt(.1,.1,.9,.9,"NDC");
  pt.SetBorderSize(1);
  pt.SetFillColor(0);
  pt.SetTextSizePixels(16);
  pt.AddText(Form("%s PID QA",det));
  if (!nadd.IsNull()){
    pt.AddText(nadd.Data());
    nadd.Prepend("_");
  }
  arrHistos.Add(&pt);

  TH2 *hSig=Get2DHistogramfromList(qaList,det,Form("hSigP_%s",det));
  if (hSig){
    hSig->SetOption("colz");
    arrHistos.Add(hSig);
  }

  for (Int_t i=0;i<AliPID::kSPECIESC;++i){
    //     for (Int_t i=0;i<AliPID::kSPECIES;++i){
    if (i==(Int_t)AliPID::kMuon) continue;
    TH2 *h=Get2DHistogramfromList(qaList,det,Form(name,AliPID::ParticleName(i)));
    if (!h) continue;
    h->SetOption("colz");
    AddFit(h);
    arrHistos.Add(h);
  }

  Int_t nPads=arrHistos.GetEntriesFast();
  Int_t nCols = (Int_t)TMath::Ceil( TMath::Sqrt(nPads) );
  Int_t nRows = (Int_t)TMath::Ceil( (Double_t)nPads/(Double_t)nCols );

  
  fCanvas->Divide(nCols,nRows);


  for (Int_t i=0; i<nPads;++i) {
    fCanvas->cd(i+1);
    SetupPadStyle();
    arrHistos.At(i)->Draw();
  }

  fCanvas->Update();
  fCanvas->Clear();

}
开发者ID:ktf,项目名称:AliRoot,代码行数:54,代码来源:MakePIDqaReport.C

示例11: OpenPinData

Bool_t KVINDRAPulserDataTree::OpenPinData(Int_t run, ifstream &f)
{
	// Open pin data for one run
	// We look for one of the following files in the directory given by
	// environment variable KVINDRAPulserDataTree.GenePinDir:
	//
	// 	runXXXX.genepin
	// OR	runXXXX.laserpin
	// OR	runXXXX.genelaserpin

	TString fname;
	fname.Form("/run%d.genepin", run);
	TString pindir(gDataSet->GetDataSetEnv("KVINDRAPulserDataTree.GenePinDir",""));
	fname.Prepend(pindir);
	if(gDataSet->OpenDataSetFile(fname.Data(),f)) return kTRUE;
	fname.Form("/run%d.laserpin", run);
	fname.Prepend(pindir);
	if(gDataSet->OpenDataSetFile(fname.Data(),f)) return kTRUE;
	fname.Form("/run%d.genelaserpin", run);
	fname.Prepend(pindir);
	return gDataSet->OpenDataSetFile(fname.Data(),f);
}
开发者ID:pwigg,项目名称:kaliveda,代码行数:22,代码来源:KVINDRAPulserDataTree.cpp

示例12: FinishMC5

void FinishMC5( TString process, Int_t energy, Int_t chan)
{
	TString name;

	name = Form( "histograms/MonteCarlo/%s_e%d_t%d.root",
			process.Data(), energy, chan);

	printf( "End-of-Run macro executing\n");

	TFile f( name, "recreate");
	gROOT->GetList()->Write();
	f.Close();

	name.Prepend( "All histograms saved to ");
	cout << name << endl;
}
开发者ID:MegMorris,项目名称:acqu,代码行数:16,代码来源:Finish.C

示例13: misalignmentDependence

void misalignmentDependence(Int_t nFiles,TString *files,TString *names,TString misalignment,Double_t *values,Double_t *phases,TString xvar,TString yvar,
                            TString function,Int_t nParameters,Int_t *parameters,TString *parameternames,TString functionname = "",
                            Bool_t resolution = false,
                            TString saveas = "")
{
    for (int i = 0; i < nParameters; i++)
    {
        TString saveasi = saveas;
        TString insert = nPart(1,parameternames[i]);
        insert.Prepend(".");
        saveasi.Insert(saveasi.Last('.'),insert);    //insert the parameter name before the file extension
        misalignmentDependence(nFiles,files,names,misalignment,values,phases,xvar,yvar,
                               function,parameters[i],parameternames[i],functionname,
                               resolution,
                               saveasi);
    }
}
开发者ID:hroskes,项目名称:HiggsPlot,代码行数:17,代码来源:misalignmentDependence.C

示例14: FinishMC3

void FinishMC3( TString savedir, TString encl, TString process, TString tgt,
		UInt_t eg)
{
	TString name;

	name = "End-of-Run macro executing";
	cout << name << endl;

	name = Form( "histograms/MonteCarlo/%s/%s/%s_%s_%d.root",
			savedir.Data(), encl.Data(), process.Data(),
			tgt.Data(), eg);

	TFile f( name, "recreate");
	gROOT->GetList()->Write();
	f.Close();

	name.Prepend( "All histograms save to ");
	cout << name << endl;
}
开发者ID:MegMorris,项目名称:acqu,代码行数:19,代码来源:Finish.C

示例15: FinishBasic

void FinishBasic( TString name)
{
	TString path;

	cout << "End-of-Run macro executing";
	cout << endl;

	path =  "histograms/";

	path.Append( name);
	path.Append( ".root");
	TFile f( path, "recreate");
	gROOT->GetList()->Write();
	f.Close();

	path.Prepend( "All histograms saved to \"");
	path.Append( "\"");
	cout << path;
	cout << endl;
}
开发者ID:MegMorris,项目名称:acqu,代码行数:20,代码来源:Finish.C


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