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


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

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


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

示例1: Begin

//_____________________________________________________________________________
void ProofSimple::Begin(TTree * /*tree*/)
{
   // The Begin() function is called at the start of the query.
   // When running with PROOF Begin() is only called on the client.
   // The tree argument is deprecated (on PROOF 0 is passed).

   TString option = GetOption();
   Ssiz_t iopt = kNPOS;

   // Histos array
   if (fInput->FindObject("ProofSimple_NHist")) {
      TParameter<Long_t> *p =
         dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimple_NHist"));
      fNhist = (p) ? (Int_t) p->GetVal() : fNhist;
   } else if ((iopt = option.Index("nhist=")) != kNPOS) {
      TString s;
      Ssiz_t from = iopt + strlen("nhist=");
      if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist = s.Atoi();
   }
   if (fNhist < 1) {
      Abort("fNhist must be > 0! Hint: proof->SetParameter(\"ProofSimple_NHist\","
            " (Long_t) <nhist>)", kAbortProcess);
      return;
   }

   if (fInput->FindObject("ProofSimple_NHist3")) {
      TParameter<Long_t> *p =
         dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimple_NHist3"));
      fNhist3 = (p) ? (Int_t) p->GetVal() : fNhist3;
   } else if ((iopt = option.Index("nhist3=")) != kNPOS) {
      TString s;
      Ssiz_t from = iopt + strlen("nhist3=");
      if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist3 = s.Atoi();
   }

   // Ntuple
   TNamed *nm = dynamic_cast<TNamed *>(fInput->FindObject("ProofSimple_Ntuple"));
   if (nm) {

      // Title is in the form
      //         merge                  merge via file
      //           |<fout>                      location of the output file if merge
      //           |retrieve                    retrieve to client machine
      //         dataset                create a dataset
      //           |<dsname>                    dataset name (default: dataset_ntuple)
      //         |plot                  for a final plot
      //         <empty> or other       keep in memory

      fHasNtuple = 1;
      
      TString ontp(nm->GetTitle());
      if (ontp.Contains("|plot") || ontp == "plot") {
         fPlotNtuple = kTRUE;
         ontp.ReplaceAll("|plot", "");
         if (ontp == "plot") ontp = "";
      }
      if (ontp.BeginsWith("dataset")) fHasNtuple = 2;
   }
}
开发者ID:My-Source,项目名称:root,代码行数:60,代码来源:ProofSimple.C

示例2: calculate_balance

void TExpenser::calculate_balance() {

    fBalanceXMLParser -> selectMainNode();
    fBalanceXMLParser -> selectNode("entry");
    TString balance = fBalanceXMLParser -> getNodeContent("amount");
    fBalanceXMLParser -> selectNode("date");
    TString balance_year = fBalanceXMLParser -> getNodeContent("year");
    TString balance_month = fBalanceXMLParser -> getNodeContent("month");

    fLastStatusLabel -> SetText(balance_month+"/"+balance_year+": " + balance + " eur");

    // now calculate the current balance (last - expenses since the last)
    TDatime time;

    fXMLParser->selectMainNode();
    fXMLParser->selectNode("expense");
    Double_t expenses_since_last_status = 0;
    while (fXMLParser->getCurrentNode() != 0) {
        XMLNodePointer_t current_node = fXMLParser->getCurrentNode();

        fXMLParser -> selectNode("date");
        TString year = fXMLParser -> getNodeContent("year");
        TString month = fXMLParser -> getNodeContent("month");
        fXMLParser -> setCurrentNode(current_node);

        bool year_more_recent = (year.Atoi() > balance_year.Atoi());
        bool year_same = (year.Atoi() == balance_year.Atoi());
        bool month_more_recent = (month.Atoi()>=balance_month.Atoi());
        bool expense_more_recent_than_balance = (year_more_recent || (year_same && month_more_recent));
        if (  expense_more_recent_than_balance && fXMLParser -> getNodeContent("withdrawn") == "Yes" ) {
            expenses_since_last_status += fXMLParser -> getNodeContent("amount").Atof();
        }

        fXMLParser->selectNextNode("expense");
    }

    // calculate total income since last balance
    fIncomeXMLParser->selectMainNode();
    fIncomeXMLParser->selectNode("entry");
    Double_t income_since_last_status = 0;
    while (fIncomeXMLParser->getCurrentNode() != 0) {
        XMLNodePointer_t current_node = fIncomeXMLParser->getCurrentNode();

        fIncomeXMLParser -> selectNode("date");
        TString year = fIncomeXMLParser -> getNodeContent("year");
        TString month = fIncomeXMLParser -> getNodeContent("month");
        fIncomeXMLParser -> setCurrentNode(current_node);

        if ( ( (month.Atoi()>=balance_month.Atoi()) && (year.Atoi()==balance_year.Atoi()) ) || (year.Atoi()>balance_year.Atoi()) ) {
            income_since_last_status += fIncomeXMLParser -> getNodeContent("amount").Atof();
        }

        fIncomeXMLParser->selectNextNode("entry");
    }

    Double_t new_balance = balance.Atof() - expenses_since_last_status + income_since_last_status;
    fCurrentStatusLabel -> SetText(toStr(time.GetDay())+"/"+toStr(time.GetMonth())+"/"+toStr(time.GetYear())+": " + toStr(new_balance,2) + " eur");
}
开发者ID:libov,项目名称:expenser,代码行数:58,代码来源:TExpenser.C

示例3: createExpensesTableInterface

void TExpenser::createExpensesTableInterface() {

    // create table interface
    const unsigned ncolumns =  6;
    fTableInterface = new TGExpenserTableInterface(ncolumns);
    TString columns[ncolumns]={"amount", "category", "description", "withdrawn","date", "id"};
    fTableInterface -> setColumnNames(columns);

    fXMLParser->selectMainNode();
    fXMLParser->selectNode("expense");
    vector<expense> expenses;
    while (fXMLParser->getCurrentNode() != 0) {
        XMLNodePointer_t current_node = fXMLParser->getCurrentNode();

        fXMLParser -> selectNode("date");
        TString year = fXMLParser -> getNodeContent("year");
        TString month = fXMLParser -> getNodeContent("month");
        TString day = fXMLParser -> getNodeContent("day");
        fXMLParser -> setCurrentNode(current_node);

        if (month.Atoi()<10) month="0"+month;
        if (day.Atoi()<10) day="0"+day;

        expense ex;
        ex.amount = fXMLParser -> getNodeContent("amount");
        ex.category = fXMLParser -> getNodeContent("category");
        ex.description = fXMLParser -> getNodeContent("description");
        ex.withdrawn = fXMLParser -> getNodeContent("withdrawn");
        ex.date = year+month+day;
        ex.dateForCell  = day+"/"+month+"/"+year;
        ex.id  = fXMLParser -> getNodeContent("id");

        fXMLParser->selectNextNode("expense");

        if (fFilterActive) {
            if ( fFilterCategory != "any" && ex.category != fFilterCategory) continue;
            if ( fFilterMonth != "any" && MONTHS[month.Atoi()-1] != fFilterMonth) continue;
            if ( fFilterYear != "any" && year != fFilterYear) continue;
            if ( fFilterWithdrawn != "any" && fFilterWithdrawn != ex.withdrawn ) continue;
            if ( ! ex.description.Contains(fFilterDescription, TString::kIgnoreCase) ) continue;
        }

        expenses.push_back(ex);
    }

    sort(expenses.begin(), expenses.end(), compare);

    for (unsigned i=0; i<expenses.size(); i++) {
        fTableInterface -> addCell (i, expenses[i].amount);
        fTableInterface -> addCell (i, expenses[i].category);
        fTableInterface -> addCell (i, expenses[i].description);
        fTableInterface -> addCell (i, expenses[i].withdrawn);
        fTableInterface -> addCell (i, expenses[i].dateForCell);
        fTableInterface -> addCell (i, expenses[i].id);
    }
    fTableEntries = expenses.size();

}
开发者ID:libov,项目名称:expenser,代码行数:58,代码来源:TExpenser.C

示例4: Print

void GausBF::Print(Option_t *option) const
{
  TString sopt = option; sopt.ToLower();
  if (sopt == "dump") {
    for (Int_t i = 0; i < Ns1*Ns9*Np; i++) {
      cout << Form(" %10.3e,", _par[i]);
      if (i%6 == 5) cout << endl;
    }
    cout << endl;
  }
  if (sopt.BeginsWith("p")) {
    TString ss = sopt(1, 2);
    if (ss.IsDigit()) {
      Int_t ip = ss.Atoi();
      if (0 <= ip && ip < Np)
	for (Int_t i = 0; i < Ns1; i++) {
	  for (Int_t j = 0; j < Ns9; j++) {
	    AMSPoint p1 = GetP1(i);
	    AMSPoint p9 = GetP9(j);
	    cout << Form("%3d %3d %6.2f %6.2f %7.2f %7.2f %10.3e",
			 i, j, p1.x(), p1.y(),
			       p9.x(), p9.y(), _par[(i*Ns9+j)*Np+ip]) << endl;
	  }
	}
    }
  }
}
开发者ID:krafczyk,项目名称:AMS,代码行数:27,代码来源:GausBF.C

示例5: filechk

int filechk(string fname)
{
  //TFile f("DQM_V0001_SiStrip_R000062940.root");
  TFile f(fname.c_str());

  if (f.IsZombie()){
    //cout << "File corrupted" << endl;
  return -1;
  }
  else
  {
    if ( fname.find("_SiStrip_") != string::npos ){
      TString rnStr = fname.substr(fname.find("_R") + 2, 9);
      TString runDirStr("Run ");
      runDirStr += rnStr.Atoi();
      TDirectoryFile* runDir = (TDirectoryFile*)f.FindObjectAny(runDirStr);
      if ( runDir == 0 )
        return 0; 
      
      TDirectoryFile* tracking = (TDirectoryFile*)runDir->FindObjectAny("Tracking");
      if ( tracking == 0 )
        return 0;
      
      TDirectoryFile* sistrip = (TDirectoryFile*)runDir->FindObjectAny("SiStrip");
      if ( sistrip == 0 )
        return 0;  
       
      TDirectoryFile* hist = (TDirectoryFile*)tracking->FindObjectAny("reportSummaryMap");
      if ( hist == 0 )
        return 0;
       
      hist = (TDirectoryFile*)sistrip->FindObjectAny("reportSummaryMap");
      if ( hist == 0 )
        return 0; 
      
      return 1;
    }
    
    //TH2F* hist;
    //hist = (TH2F*)f.FindObjectAny("reportSummaryMap");
    TDirectoryFile* hist;	
    //hist = (TDirectoryFile*)f.FindObjectAny("reportSummaryContents");
    hist = (TDirectoryFile*)f.FindObjectAny("reportSummaryMap");
    if (0 == hist) 
    {
      TDirectoryFile* hist2;
      hist2 = (TDirectoryFile*)f.FindObjectAny("EventInfo");
      if (0 != hist2)
        return 1;

      //cout << "File is incomplete" << endl;
      return 0;
    }
    else
    {
      //cout << "File is OK" << endl;
      return 1;
    }
  }
}
开发者ID:Andrej-CMS,项目名称:cmssw,代码行数:60,代码来源:filechk.C

示例6: parseAndSet_b

inline void parseAndSet_b(const TString& input, TString arg, bool& value) {
  TString newval = parseArg(input, arg);
  if (!newval.IsNull()) {
    if (newval.IsBin()) value = newval.Atoi();
    else if (newval == "true") value = true;
    else if (newval == "false") value = false;
  }
}
开发者ID:cmstas,项目名称:StopAnalysis,代码行数:8,代码来源:makeBkgEstimates.C

示例7: transferxSecFromTextToROOT

void transferxSecFromTextToROOT(std::string inputStr="xSec_T3G.txt"){

   ifstream fin(inputStr.c_str());
   char line[200];
   TFile *xSecProspinoFile =0;
   TH1D *xSecProspino =0; 
   int minMom = 1000000, maxMom = 0;
   int nBins = 0;

   std::vector<int> momVec; std::vector<double> xSecVec, xSecErrVec;
   while( fin.getline(line, 200) ){
      TString lineT(line);
      if( lineT.Contains("Interactions") ) continue;
      TObjArray *vlist = lineT.Tokenize(" ");
      int nEntries = vlist->GetEntries();
      int mMom;
      double xSec =0, xSecRelErr =0;
      for(int ie=0; ie<nEntries; ie++){
         TObjString* perObj = dynamic_cast<TObjString*>(vlist->At(ie));
         TString perStr = perObj->GetString();
         if( ie==0 ){
            mMom = perStr.Atoi();
            if( minMom > mMom ) minMom = mMom;
            if( maxMom < mMom ) maxMom = mMom;
         }
         if( ie==1 ) xSec = perStr.Atof();
         if( ie==2 ) xSecRelErr = perStr.Atof();
      }
      nBins ++;
      momVec.push_back(mMom); xSecVec.push_back(xSec); xSecErrVec.push_back(xSec*xSecRelErr/100.);
//      std::cout<<"mMom : "<<mMom<<"  xSec : "<<xSec<<"  xSecRelErr : "<<xSecRelErr<<std::endl;
   }
   double divBin = 1.0*(maxMom - minMom)/(nBins-1);
   double lowMom = minMom-divBin/2.0, highMom = maxMom+divBin/2.0;
   std::cout<<"nBins : "<<nBins<<"  minMom : "<<minMom<<"  maxMom : "<<maxMom<<"  divBin : "<<divBin<<"  lowMom : "<<lowMom<<"  highMom : "<<highMom<<std::endl;

   TString rootStrT(inputStr);
   rootStrT.ReplaceAll("txt", "root");

   std::cout<<"root file : "<<rootStrT<<std::endl;
   xSecProspinoFile = new TFile(rootStrT, "RECREATE");

   if( rootStrT.Contains("T1") ) xSecProspino = new TH1D("gluino_xsection", "gluino_xsection", nBins, lowMom, highMom);
   if( rootStrT.Contains("T2") ) xSecProspino = new TH1D("squark_xsection", "squark_xsection", nBins, lowMom, highMom);
   if( rootStrT.Contains("T3G") ) xSecProspino = new TH1D("stop_xsection", "stop_xsection", nBins, lowMom, highMom);

   for(int iv=0; iv<(int)momVec.size(); iv++){
      double mMom = (double)momVec[iv];
      int ib = xSecProspino->FindFixBin(mMom);
      xSecProspino->SetBinContent(ib, xSecVec[iv]);
      xSecProspino->SetBinError(ib, xSecErrVec[iv]);
   }

//   xSecProspino->Write();
   xSecProspinoFile->Write(); xSecProspinoFile->Close();

}
开发者ID:safarzad,项目名称:StatisticalTools,代码行数:57,代码来源:transferxSecFromTextToROOT.C

示例8: Begin

void TTSelector::Begin(TTree *){
  TString option = GetOption();
  TObjArray *strobj = option.Tokenize(" ");
  gTrigger = ((TObjString*)strobj->At(0))->GetString().Atoi();
  
  gMode = ((TObjString*)strobj->At(1))->GetString().Atoi();
  CreateMap();
  TString filedir=ginFile;
  filedir.Remove(filedir.Last('.')-4);
  fFile = new TFile(goutFile,"RECREATE");
  fTree = new TTree("M","Tree for GSI Prt Analysis");  
  fEvent = new TPrtEvent();
  fTree->Branch("TPrtEvent", "TPrtEvent", &fEvent, 64000, 2);

  TFile f(gcFile);
  TIter nextkey(f.GetListOfKeys());
  TKey *key;

  while ((key = (TKey*)nextkey())) {
    TGraph *gr = (TGraph*)key->ReadObj();
    TString name = gr->GetName();
    Int_t channel = name.Atoi();

    gGr[channel]= new TGraph(*gr);
  }
  f.Close();

  if(gMode == 1){
    TFile f2(gtFile);
    TIter nextkey2(f2.GetListOfKeys());
    TKey *key2;

    while ((key2 = (TKey*)nextkey2())) {
      TGraph *gr = (TGraph*)key2->ReadObj();
      TString name = gr->GetName();
      Int_t channel = name.Atoi();

      gGrDiff[channel]= new TGraph(*gr);
    }
    f2.Close();
  }
  std::cout<<"Initialization successful"<<std::endl;
  
}
开发者ID:rdom,项目名称:hldmacro,代码行数:44,代码来源:tcalibration.C

示例9: RunCreateMap

void RunCreateMap() {

  cout << "RunCreateMap" << endl; 

  TString DataRangeString = gSystem->Getenv("DATARANGE");
  int DataRange = DataRangeString.Atoi() - 1; 

  CreateMap(false, DataRange);

}
开发者ID:scodella,项目名称:AnalysisCMS,代码行数:10,代码来源:RunCreateMap.C

示例10: get_sample_name

TString get_sample_name(TString name)
{
  TObjArray* arr = name.Tokenize(".");
  
  TString out = ((TObjString*)arr->At(arr->GetEntries()-2))->GetString();
  out.ReplaceAll("_JER_up", "");
  out.ReplaceAll("_JER_down", "");
  out.ReplaceAll("_JEC_up", "");
  out.ReplaceAll("_JEC_down", "");

  out.ReplaceAll("_PU_down", "");
  out.ReplaceAll("_PU_up", "");
  out.ReplaceAll("_LJets_up", "");
  out.ReplaceAll("_LJets_down", "");
  out.ReplaceAll("_BJets_up", "");
  out.ReplaceAll("_BJets_down", "");
  out.ReplaceAll("_MuonSF_down", "");
  out.ReplaceAll("_MuonSF_up", "");
  out.ReplaceAll("_BJets_down", "");
  out.ReplaceAll("_BJets_down", "");
  out.ReplaceAll("_matching_down", "");
  out.ReplaceAll("_matching_up", "");
  out.ReplaceAll("_scale_down", "");
  out.ReplaceAll("_scale_up", "");

  out.ToLower();

  out.ReplaceAll("dyjets_50toinf", "zlight");
  out.ReplaceAll("dyjets", "zlight");
  out.ReplaceAll("dy", "zlight");
  out.ReplaceAll("wjets_bflavor", "wb");
  out.ReplaceAll("wjets_cflavor", "wc");
  out.ReplaceAll("wjets_lflavor", "wlight");
  //out.ReplaceAll("tt", "ttbar");

  
  if (out.Contains("zp")){
    TString temp = out;
    temp.ReplaceAll("zp","");
    temp.ReplaceAll("p", ".");
    TObjArray* arr2 = temp.Tokenize("w");
    TString nom = ((TObjString*)arr2->At(1))->GetString();
    TString denom = ((TObjString*)arr2->At(0))->GetString();
    cout << "nom = " << nom << " denom = " << denom << endl;
    Int_t p = (100*nom.Atof())/denom.Atof();
    cout << "p = " << p << endl;
    out = TString::Format("zp %d w %d p",denom.Atoi(), p);
    out.ReplaceAll(" ", "");
  }
  
  return out;
}
开发者ID:isando3,项目名称:ThetaScripts,代码行数:52,代码来源:write_test_theta_file.C

示例11: DecodeRunlist

void DecodeRunlist(const TString &val){
        //
        // Tokenize run list
        //
        TObjArray *runstrings = val.Tokenize(",");
        TObjString *os;
        TString runstr;
        TIter runIter(runstrings);
        g_runlist.Set(runstrings->GetEntries());
        int nruns(0);
        while((os = dynamic_cast<TObjString *>(runIter()))){
                runstr = os->String();
                g_runlist[nruns++] = runstr.Atoi();
        }
        delete runstrings;
}
开发者ID:ktf,项目名称:AliPhysics,代码行数:16,代码来源:runGridpPb.C

示例12: Begin

//_____________________________________________________________________________
void ProofSimpleFile::Begin(TTree * /*tree*/)
{
   // The Begin() function is called at the start of the query.
   // When running with PROOF Begin() is only called on the client.
   // The tree argument is deprecated (on PROOF 0 is passed).

   TString option = GetOption();

   // Number of histograms (needed in terminate)
   if (fInput->FindObject("ProofSimpleFile_NHist")) {
      TParameter<Long_t> *p =
         dynamic_cast<TParameter<Long_t>*>(fInput->FindObject("ProofSimpleFile_NHist"));
      fNhist = (p) ? (Int_t) p->GetVal() : fNhist;
   } else if ((iopt = option.Index("nhist=")) != kNPOS) {
      TString s;
      Ssiz_t from = iopt + strlen("nhist=");
      if (option.Tokenize(s, from, ";") && s.IsDigit()) fNhist = s.Atoi();
   }
}
开发者ID:chunjie-sam-liu,项目名称:genome_resequencing_pipeline,代码行数:20,代码来源:ProofSimpleFile.C

示例13: runCalibSummary

void runCalibSummary(TString runNumberString ="0")
{

  Int_t irun = runNumberString.Atoi();

  // Load libraries
  gSystem->Load("libANALYSIS");
  gSystem->Load("libTPCcalib");

  // Configure OCDB
  gROOT->LoadMacro("ConfigOCDB.C");
  ConfigOCDB(irun);

  // run extraction of the calibration summary ...
  AliTPCcalibSummary *calibSummary = new AliTPCcalibSummary;
  calibSummary->ProcessRun(irun);
  delete calibSummary;

  return;
}
开发者ID:alisw,项目名称:AliRoot,代码行数:20,代码来源:runCalibSummary.C

示例14: Configure

// ======= FIXME: Hall A lib ================================================
//_____________________________________________________________________________
Int_t TrigBitLoc::Configure( const TObjArray* params, Int_t start )
{
  // Initialize CrateLoc from given parmeters

  // Load name, crate, slot, channel
  Int_t ret = CrateLocMulti::Configure( params, start );
  if( ret )
    return ret;

  // Additional parameters: lower and upper TDC cuts
  cutlo = GetString( params, start+4 ).Atoi();
  cuthi = GetString( params, start+5 ).Atoi();
  
  // The bit number is determined from any trailing digits of the name,
  // which must be in the range 0-31
  assert( fName.Length() > 0 ); // else bug in base class Configure()
  Int_t pos = fName.Length()-1, end = pos;
  TString e;
  do {
    e = fName(pos); 
  } while( e.IsDigit() && pos-- > 0 );
  if( pos == end ) { // No digits at the end of the name
    Error( "TrigBitLoc", "Name of trigger bit variable %s must end with bit "
	   "number (0-31). Example: \"bit12\". Fix database.", GetName() );
    return 50;
  }
  e = fName(pos+1,end-pos);
  Int_t val = e.Atoi();
  if( val < 0 || val > 31 ) {
    Error( "TrigBitLoc", "Illegal bit number %d in trigger bit name %s. "
	   "Must be 0-31. Fix database.", val, GetName() );
    return 50;
  }
  bitnum = val;
  
  return 0;
}
开发者ID:hansenjo,项目名称:analyzer,代码行数:39,代码来源:BdataLoc.C

示例15: FillVZEROEPOADBFull

void FillVZEROEPOADBFull(const char* filename = "AOD083.txt", Bool_t mbOnly = kFALSE)
{
  gSystem->Load("libCore");
  gSystem->Load("libTree");
  gSystem->Load("libGeom");
  gSystem->Load("libVMC");
  gSystem->Load("libPhysics");
  gSystem->Load("libMinuit");
  gSystem->Load("libSTEERBase");
  gSystem->Load("libESD");
  gSystem->Load("libAOD");
  gSystem->Load("libANALYSIS");
  gSystem->Load("libANALYSISalice");   
  gSystem->Load("libOADB");

  AliOADBContainer * oadbCont = new AliOADBContainer("vzeroEP");

  {
    TList *defaultList = new TList;
    defaultList->SetName("Default");
    TProfile *profHisto = NULL;
    TFile fInputDefault("minbias/VZERO.EPFlatenning.PS.LHC11h_AOD083_000170162.root");
    TList *inputList = (TList*)fInputDefault.Get("coutput");
    for(Int_t i = 0; i < 11; ++i) {
      profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
      profHisto->SetDirectory(0);
      defaultList->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
      profHisto->SetDirectory(0);
      defaultList->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
      profHisto->SetDirectory(0);
      defaultList->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
      profHisto->SetDirectory(0);
      defaultList->Add(profHisto);
    }
    fInputDefault.Close();
    oadbCont->AddDefaultObject(defaultList);
    printf("Run 170162 filled\n");
  }

  {
    TList *list1 = new TList;
    TProfile *profHisto = NULL;
    TFile fInput1("minbias/VZERO.EPFlatenning.PS.LHC11h_AOD083_000169683.root");
    TList *inputList = (TList*)fInput1.Get("coutput");
    for(Int_t i = 0; i < 11; ++i) {
      profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
      profHisto->SetDirectory(0);
      list1->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
      profHisto->SetDirectory(0);
      list1->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fX2Y2_%d",i))->Clone(Form("fX2Y2_%d",i));
      profHisto->SetDirectory(0);
      list1->Add(profHisto);
      profHisto = (TProfile*)inputList->FindObject(Form("fCos8Psi_%d",i))->Clone(Form("fCos8Psi_%d",i));
      profHisto->SetDirectory(0);
      list1->Add(profHisto);
    }
    oadbCont->AppendObject(list1, 169683, 169683);
    printf("Run 169683 filled\n");
  }

  // loop of over all other runs
  Int_t runList[500];
  ifstream *fruns = new ifstream (filename);
  if (!*fruns) return;
  TString strLine;
  Int_t count = 0;
  while (strLine.ReadLine(*fruns)) {
    runList[count++] = strLine.Atoi();
  }
  delete fruns;

  for(Int_t irun = 0; irun < count; ++irun) {
    TList *list2 = new TList;
    TProfile *profHisto = NULL;
    TFile fInput2(Form("csemi/VZERO.EPFlatenning.PS.LHC11h_AOD083_000%d.root",runList[irun]));
    TList *inputList = (TList*)fInput2.Get("coutput");
    TFile fInput3(Form("cpbi2/VZERO.EPFlatenning.PS.LHC11h_AOD083_000%d.root",runList[irun]));
    TList *inputListBis = (TList*)fInput3.Get("coutput");
    for(Int_t i = 0; i < 11; ++i) {
      profHisto = (TProfile*)inputList->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
      profHisto->SetDirectory(0);
      Int_t ibin = profHisto->FindBin(62.5);
      profHisto->SetBinContent(ibin,0);
      profHisto->SetBinError(ibin,0);
      profHisto->SetBinEntries(ibin,0);
      if (mbOnly) {
	profHisto = (TProfile*)inputListBis->FindObject(Form("fX2_%d",i))->Clone(Form("fX2_%d",i));
	profHisto->SetDirectory(0);
      }
      else
	profHisto->Add((TProfile*)inputListBis->FindObject(Form("fX2_%d",i)));
      list2->Add(profHisto);

      profHisto = (TProfile*)inputList->FindObject(Form("fY2_%d",i))->Clone(Form("fY2_%d",i));
      profHisto->SetDirectory(0);
//.........这里部分代码省略.........
开发者ID:ktf,项目名称:AliPhysics,代码行数:101,代码来源:FillVZEROEPOADBFull.C


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