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


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

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


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

示例1: if

BranchBase::BranchBase(TString input_files)
{
	TString sMC = "MC";
	TString sDataHI = "DATA_hi";
	TString sDataPP = "DATA_pp";
	TString runType = "";

  	TChain * chain = new TChain("HeavyIonD3PD","");

  	//bool dataType = openFromFileList(input_files, chain);
  	runType = openFromFileList(input_files, chain);
	//if(dataType) runType = "DATA";
	//else runType = "MC";

	if (runType.CompareTo(sMC)==0) {
		isMC = true;
		std::cout << "Skimming Monte Carlo." << std::endl;
	}
	else if (runType.CompareTo(sDataHI)==0) {
		isData = true;
		std::cout << "Skimming Heavy Ion Data." << std::endl;
	}
	else if (runType.CompareTo(sDataPP)==0) {
		isData = true;
		isPP   = true;
		std::cout << "Skimming pp @2.76TeV Data." << std::endl;
	}
	else {
		std::cout << "Must choose DATA or MC. Abort." << std::endl;
		exit(0);
	 }	
  	//Init(chain);
	#include "SetBranchAddress.h"
}
开发者ID:Feynman27,项目名称:HIMuonSkimming,代码行数:34,代码来源:BranchBase_2012.30.09.C

示例2: main

int main(int argc, const char * argv[]){

    TupleMaker_min tm; 
    if (argc < 2) {help(); return 1;}
    TString tmp = argv[1];
    if (!tmp.CompareTo("-h") || !tmp.CompareTo("--help")) {
        help();
        return 0;
    } else if (!tmp.CompareTo("-w")) {
        if (argc < 5 ) { help(); return 1;}
        //USAGE 2
        tm.output_fname = argv[2];
        tm.input_fname = argv[3];
        for (size_t i=4; i<argc; i++) tm.weights_fname.push_back(argv[i]);
        tm.MakeNtupleWithWeights();
        return 0;
    } else if(argc>=2) {
        // USAGE 1
        //tm.ebeam       = ResbosRootNtuple::GetConfValue<double>("config_dump.txt","ebeam");
        tm.input_fname = argv[1];
        if (argc > 2) for (int i_wt = 2; i_wt < argc; i_wt++){
            tm.weights_fname.push_back(argv[i_wt]);
        }
        tm.MakeProfile();
        return 0;
    } else {
        help(); return 1;
    }


    return 0;
}
开发者ID:cuthik,项目名称:tupleMaker,代码行数:32,代码来源:tupleMaker_AI_RESBOS.cpp

示例3: CompileCorrectGammaV2

void CompileCorrectGammaV2(){
    
     
     //*****************************************************************************************
    // Find out which user is running the code and set RooUnfold directory accordingly
    // RooUnfold is a separate piece of software which needs to be compiled on your system
    // Please download it from https://github.com/skluth/RooUnfold and compile it!
    // Afterwards you have to add the location of the software here for your system
    //*****************************************************************************************
    TString homedirectory = gSystem->HomeDirectory();
	cout << "***************************************" << endl;
	cout << "HomeDirectory: " << homedirectory.Data() << endl;
	cout << "***************************************" << endl;
    if (homedirectory.CompareTo("/home/admin1") == 0){   
        gSystem->AddIncludePath("-I/home/admin1/leardini/photonconv/AnalysisSoftware/RooUnfold/RooUnfold-master/RooUnfold/src"); 
        gSystem->Load("/home/admin1/leardini/photonconv/AnalysisSoftware/RooUnfold/RooUnfold-master/libRooUnfold");
    } else if (homedirectory.CompareTo("/home/fbock") == 0){   
        gSystem->AddIncludePath("-I/home/fbock/Photon/Software/photonconv/AnalysisSoftware/RooUnfold/src"); 
		gSystem->Load("/home/fbock/Photon/Software/photonconv/AnalysisSoftware/RooUnfold/libRooUnfold");
	} else if (homedirectory.CompareTo("/home/daniel") == 0){
		gSystem->AddIncludePath("-I/home/daniel/data/work/photonconv/AnalysisSoftware/RooUnfold/src");
		gSystem->Load("/home/daniel/data/work/photonconv/AnalysisSoftware/RooUnfold/libRooUnfold");
    } else if (homedirectory.CompareTo("/Users/lucasaltenkaemper") == 0) {
        gSystem->AddIncludePath("-I/Volumes/MacintoshHD/Documents/Studium/Master/Thesis/photonconv/AnalysisSoftware/RooUnfold/src");
        gSystem->Load("/Volumes/MacintoshHD/Documents/Studium/Master/Thesis/photonconv/AnalysisSoftware/RooUnfold/libRooUnfold");
    } else {
        cout << "You have not defined where RooUnfold can be found on your system! This macro can't run without it!" << endl;
        return;
    }

    gROOT->LoadMacro("TaskV1/CorrectGammaV2.C+");

    return;
}
开发者ID:dhruvdixit,项目名称:afterburner,代码行数:34,代码来源:CompileCorrectGammaV2.C

示例4: DisplayTele

void DisplayTele(TXMLEngine* xml, XMLNodePointer_t node, Int_t level, const char* search ) 
{
 
  TString tel;
  TString sat;

  tel.Append( xml->GetNodeName(node)  );
  //    printf("<%s>\n", tel.Data() );


  if ( (leveloffset<0) ){
    if (tel.CompareTo( search )==0){
      leveloffset=level;  sprintf( output, "%s", "" );
      //   printf("Found level offset.... ==%d\n", leveloffset );
    }else{//neni to on, hledej
       // display all child nodes   
      XMLNodePointer_t child = xml->GetChild(node);
      while (child!=0) {
	DisplayTele(xml, child, level+1, search ); 
         child = xml->GetNext(child);
      }//while
    }
  }// HLEDEJ dokud neinicializujes



  if (leveloffset>=0){ // 
    if ( tel.CompareTo( search  )==0){
      //      printf("%*c<%s>\n",level+1,' ', addr[ level- leveloffset ].c_str()   );
      // display all child nodes   
      if (getattrlevel<=level){
	//	  printf("reached attr  level .... ==%d\n", level );

	// display attributes
	XMLAttrPointer_t attr = xml->GetFirstAttr(node);
	while (attr!=0) {
	  sat=xml->GetAttrName(attr);
	  //	  printf(" Checking   attr =%s/%s\n", sat.Data(), addr[ getattrlevel ].c_str()  );
	  if ( sat.CompareTo( addr[ getattrlevel ].c_str() )==0){
	    sprintf( output, "%s",   xml->GetAttrValue(attr) );
	    printf("%*c  attr <%s = %s>\n",level+1,' ',
		   sat.Data() ,  output  );
	  }// attr OK
	  // printf("%*c attr: %s value: %s\n",level+1,' ', xml->GetAttrName(attr), xml->GetAttrValue(attr));
	  attr = xml->GetNextAttr(attr);  
	}//display attributes
     }else{ 
      XMLNodePointer_t child = xml->GetChild(node);
      while (child!=0) {
	//	printf("searching %s\n", addr[level- leveloffset +1].c_str()  );
	DisplayTele(xml, child, level+1, addr[level- leveloffset +1].c_str() ); 
         child = xml->GetNext(child);
      }//reached attrlevel
      }//else attrlevel  
    }//compare OK
    
  }
  return;
}//DisplayTele------------------------------------------
开发者ID:jaromrax,项目名称:mkmat,代码行数:59,代码来源:mkmat_18876_22ne.C

示例5: AddAMEventMixingTest

Bool_t AddAMEventMixingTest(TString analysisSource = "proof", TString analysisMode = "test",TString input="aod",TString inputMC="", TString postfix = "",TString idStr="0")
{
  
   Bool_t useEventMixingPar      = 1;
   Int_t usePhysSel              = 1;
   Bool_t useMC = !inputMC.CompareTo("mc");

   input.ToLower();

   // ALICE stuff
   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) { Printf("Error[AddAMEventMixingTest] mgr is null !!!"); return kFALSE; }
   
   
   AliAnalysisGrid *analysisPlugin = mgr->GetGridHandler();
   if (!analysisPlugin) { Printf("Error[AddAMEventMixingTest] : analysisPlugin is null !!!"); return kFALSE; }

   TString myAdditionalLibs;
   if (useEventMixingPar) { AliAnalysisAlien::SetupPar("EventMixing"); myAdditionalLibs += " EventMixing.par"; }
   else { gSystem->Load("libEventMixing.so"); myAdditionalLibs += " libEventMixing.so"; }
   
   gROOT->LoadMacro("AliAnalysisTaskEx02.cxx++g");
   analysisPlugin->SetAnalysisSource("AliAnalysisTaskEx02.cxx+");
   myAdditionalLibs+=" AliAnalysisTaskEx02.h AliAnalysisTaskEx02.cxx";
   analysisPlugin->SetAdditionalLibs(myAdditionalLibs.Data());
   

  AliMultiInputEventHandler *multiInputHandler = mgr->GetInputEventHandler();

   if (usePhysSel && !input.CompareTo("esd")) {
      gROOT->LoadMacro("$ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C");
      AddTaskPhysicsSelection(useMC);

      // maybe we can put it in $ALICE_ROOT/ANALYSIS/macros/AddTaskPhysicsSelection.C
      AliMultiInputEventHandler *multiIH = dynamic_cast<AliMultiInputEventHandler *>(mgr->GetInputEventHandler());
      if (multiIH){
         AliESDInputHandler *esdIH = dynamic_cast<AliESDInputHandler *>(multiIH->GetFirstInputEventHandler());
         if (esdIH) esdIH->SetEventSelection(multiIH->GetEventSelection());
         AliAODInputHandler *aodIH = dynamic_cast<AliAODInputHandler *>(multiIH->GetFirstInputEventHandler());
         if (aodIH) aodIH->SetEventSelection(multiIH->GetEventSelection());
      }
   }

  // add mixing handler (uncomment to turn on Mixnig)
  gROOT->LoadMacro("AddMixingHandler.C");
  AddMixingHandler(multiInputHandler, input, useMC,postfix);

   // load and run AddTask macro
   gROOT->LoadMacro("AddEventMixingTestTask.C");
   AddEventMixingTestTask(input, useMC, postfix);

   return kTRUE;
}
开发者ID:musinsky,项目名称:AliRsnLite,代码行数:53,代码来源:AddAMEventMixingTest.C

示例6: exit

/******************************************************************************
 * CutElectronN::CutElectronN(EventContainer *EventContainerObj, TString electronType)    *
 *                                                                            *
 * Parameterized Constructor                                                  *
 *                                                                            *
 * Input:  Event Object class                                                 *
 * Output: None                                                               *
 ******************************************************************************/
CutElectronN::CutElectronN(EventContainer *EventContainerObj, TString electronTypePassed)
{
  // Check electronType parameter
  if( electronTypePassed.CompareTo("All") && electronTypePassed.CompareTo("UnIsolated") && electronTypePassed.CompareTo("Isolated") && 
      electronTypePassed.CompareTo("Tight") && electronTypePassed.CompareTo("PtEtaCut") && electronTypePassed.CompareTo("Veto") ){
    std::cout << "ERROR " << "<CutElectronN::CutElectronN()> " 
	      << "Must pass Tight, PtEtaCut, Veto, All, UnIsolated, or Isolated to constructor" << std::endl;
    exit(8);
  } //if
  electronType = electronTypePassed;

  // Set Event Container
  SetEventContainer(EventContainerObj);
} // CutElectronN
开发者ID:pengna,项目名称:tWIHEPFramework,代码行数:22,代码来源:CutElectronN.cpp

示例7: NonFriendBranch

bool NonFriendBranch(TTree *t, TString branchName)
{
  if (t->GetBranch(branchName)==0) return true;
  TString branchtree = t->GetBranch(branchName)->GetTree()->GetName();
  TString treename = t->GetName();
  return branchtree.CompareTo(treename) == 0;
}
开发者ID:istaslis,项目名称:pPbmacro,代码行数:7,代码来源:HelperProcess.C

示例8: AliAnalysisAlien

AliAnalysisAlien *CreateGridHandler(){
        //
        // Setup main settings of the Alien plugin
        //
        AliAnalysisAlien *plugin = new AliAnalysisAlien();
        plugin->SetRunMode(g_plugin_mode.Data());
        if(!g_plugin_mode.CompareTo("Terminate"))
                plugin->SetMergeViaJDL(kFALSE);
        else
                plugin->SetMergeViaJDL(kTRUE);
        plugin->SetOverwriteMode();
        plugin->SetNtestFiles(1);

        plugin->SetAPIVersion("V1.1x");
        plugin->SetROOTVersion(g_root_version.Data());
        plugin->SetAliROOTVersion(g_aliroot_version.Data());

        plugin->SetOutputToRunNo();
        plugin->AddIncludePath("-I. .I$ALIEN_ROOT/api/lib -I$ROOTSYS/lib -I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/PWGHF/ -I$ALICE_ROOT/PWGHF/hfe/macros -I$ALICE_ROOT/PWGHF/hfe -I$ALICE_ROOT/ANALYSIS -I$ALICE_ROOT/TENDER/Tender -I$ALICE_ROOT/TENDER/TenderSupplies -I$ALICE_ROOT/PWG/ -I$ALICE_ROOT/PWG/FLOW -I$ALICE_ROOT/PWG/Base -I$ALICE_ROOT/PWG/Tasks");
        plugin->SetAdditionalLibs("libGui.so  libXMLParser.so libSTEERBase.so libESD.so libAOD.so libCDB.so libANALYSIS.so libANALYSISalice.so libCORRFW.so  libPWGflowBase.so libPWGflowTasks.so libPWGHFhfe.so libTender.so libProof.so libRAWDatabase.so libSTEER.so libTOFbase.so libPWGTRD.so");
   
        plugin->SetDefaultOutputs(kFALSE);
        plugin->SetOutputFiles("AnalysisResults.root"); 
        plugin->SetExecutableCommand("aliroot -b -q");
        plugin->SetTTL(30000);
        plugin->SetInputFormat("xml-single");
        plugin->SetPrice(1);      
        plugin->SetSplitMode("se");
        return plugin;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:30,代码来源:runGridpPb.C

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

示例10: runAlien

//___________________________________________________________
void runAlien(TString data, TString mode = "test", Bool_t MC = kFALSE){  
  if(!gSystem->Getenv("ALICE_ROOT")){
    printf("AliRoot has to be initialized\n");  
    return;
  }
  
  // check for valid modes
  const int kModes = 5;
  TString allowed_modes[kModes] = {"proof", "prooftest", "test", "full", "submit"}; 
  Bool_t isValid = kFALSE;
  mode.ToLower();
  for(int imode = 0; imode < kModes; imode++){
    if(!mode.CompareTo(allowed_modes[imode])) isValid = kTRUE;
  }
  if(!isValid){
    printf("invalid analysis mode selected\n");
    return;
  }
  analysis_mode = mode; 
  Bool_t proofmode = mode.Contains("proof");
  // libraries to be loaded
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");
  gSystem->Load("libCORRFW");
  gSystem->Load("libPWGhfe");
  
  // Create Analysis Manager
  AliAnalysisManager *runAnalysis = new AliAnalysisManager("Heavy Flavour Electron Analysis");
  runAnalysis->SetCommonFileName(output_file.Data());
  runAnalysis->SetInputEventHandler(new AliESDInputHandler); 
  if(MC) runAnalysis->SetMCtruthEventHandler(new AliMCEventHandler);
  AliAnalysisAlien *alienhandler = CreateAlienHandler(proofmode);
  printf("alienhandler %p\n", alienhandler);
  runAnalysis->SetGridHandler(alienhandler);
  //return;
  
  // Specify input (runs or dataset)
  if(!proofmode){
    // Query sample ID and runs
    TString sample;
    TArrayI listofruns;
    DecodeDataString(data, sample, listofruns);
    AddInput(alienhandler, sample, listofruns, MC);
  } else {
    alienhandler->SetProofDataSet(data);
  }

  // Add Tasks
  gROOT->LoadMacro(Form("%s/OADB/macros/AddTaskPhysicsSelection.C", gSystem->Getenv("ALICE_ROOT")));
  gROOT->LoadMacro(Form("%s/PWG3/hfe/macros/AddTaskHFE.C", gSystem->Getenv("ALICE_ROOT")));
  AddTaskPhysicsSelection(MC);
  AddTaskHFE();     // @TODO: MC and PbPb flag to be fixed

  // Run Analysis
  TString anamode = proofmode ? "proof" : "grid";
  if(runAnalysis->InitAnalysis()){
    runAnalysis->PrintStatus();
    runAnalysis->StartAnalysis(anamode);
  }
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:61,代码来源:runAlien.C

示例11: IsMC

bool IsMC(const TString &val){
        // 
        // Determine whether sample is MC or Data
        //
        if(!val.CompareTo("MC")) return true;
        return false;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:7,代码来源:runGridpPb.C

示例12:

vector<double>  AlphaTCut_pushback( TString AlhaTBin){
  vector<double> hname;
  if( AlhaTBin.CompareTo("g055") == 0 ){
    hname.push_back(0.55);
    hname.push_back(1E30);
  }
  if( AlhaTBin.CompareTo("052To053") == 0 ){
    hname.push_back(0.52);
    hname.push_back(0.53);
  }
  if( AlhaTBin.CompareTo("053To055") == 0 ){
    hname.push_back(0.53);
    hname.push_back(0.55);
  }
  return hname;
}
开发者ID:mengzx,项目名称:CMS-SUSY-2012,代码行数:16,代码来源:readPlots_ForDifferentSamples.C

示例13: RunAnalysisManager

Bool_t RunAnalysisManager(TString anSrc = "proof", TString anMode = "test", Long64_t nEvents = 1e10, Long64_t nSkip = 0) {

   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();

   if (!mgr) { Printf("Error [RunAnalysisManager] : mgr is null !!!"); return kFALSE; }

   // Run analysis
   mgr->InitAnalysis();
   mgr->PrintStatus();

   if ((!anSrc.CompareTo("proof")) || (!anSrc.CompareTo("local"))) {
      mgr->StartAnalysis(anSrc.Data(), nEvents, nSkip);
   } else {
      mgr->StartAnalysis(anSrc.Data());
   }

   return kTRUE;
}
开发者ID:fbellini,项目名称:AliRsn,代码行数:18,代码来源:RunALICE.C

示例14: GetWeight

double GetWeight(TString filename){

  double wt =0.0;
  for(int i=0; i<nGen; i++) {
    TString st2 = basedir + inFileNames[i];
    if(  filename.CompareTo(st2) == 0) wt = weight[i]; 
  }

  return wt;
}
开发者ID:ajaykumar649,项目名称:scripts,代码行数:10,代码来源:plot_ZJetBalance.C

示例15: CreateInputHandlers

Bool_t CreateInputHandlers(TString input,TString inputMC,Bool_t useAODOut=kFALSE,Bool_t useMultiHandler=kTRUE) {

   input.ToLower();
   inputMC.ToLower();

   Bool_t useMC = !inputMC.CompareTo("mc");


   AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
   if (!mgr) { Printf("Error [CreateInputHandlers] : mgr is null !!!"); return kFALSE; }

   if (useMultiHandler) {
      AliMultiInputEventHandler *inputHandler = new AliMultiInputEventHandler();
      if (!input.CompareTo("esd")) {
         Printf("Adding ESD Input Handler ...");
         inputHandler->AddInputEventHandler(new AliESDInputHandler());
         if (useMC) inputHandler->AddInputEventHandler(new AliMCEventHandler());
      } else if (!input.CompareTo("aod")) {
         inputHandler->AddInputEventHandler(new AliAODInputHandler());
      }

      mgr->SetInputEventHandler(inputHandler);
   } else {
      if (!input.CompareTo("esd")) {
         mgr->SetInputEventHandler(new AliESDInputHandler());
         if (useMC) mgr->SetMCtruthEventHandler(new AliMCEventHandler());
      } else if (!input.CompareTo("aod")) {
         mgr->SetInputEventHandler(new AliAODInputHandler());
      }
   }

   if (useAODOut) {
      AliAODHandler *aodHandler   = new AliAODHandler();
      aodHandler->SetOutputFileName("AliAOD.root");
      mgr->SetOutputEventHandler(aodHandler);
   }

   return kTRUE;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:39,代码来源:RunALICE.C


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