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


C++ TObjArray::GetLast方法代码示例

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


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

示例1: fi

void TGo4LoadedLibraries::RefreshLibs()
{
   LoadedLibsD->clear();

   TObjArray* libs = TString(gInterpreter->GetSharedLibs()).Tokenize(" ,\t\n");

   if (libs!=0)
      for (int n=0; n<=libs->GetLast(); n++) {
         QFileInfo fi(libs->At(n)->GetName());

         QStringList columns;

         columns << fi.fileName() << QString::number(fi.size()) << fi.lastModified().toString() << fi.owner() << fi.group();

         LoadedLibsD->addTopLevelItem(new QTreeWidgetItem(columns));
      }

   delete libs;

   LoadedLibsS->clear();

   libs = TString(gSystem->GetLinkedLibs()).Tokenize(" ,\t\n");

   if (libs!=0)
      for (int n=0; n<=libs->GetLast(); n++) {
         QStringList columns;
         columns << libs->At(n)->GetName();
         LoadedLibsS->addTopLevelItem(new QTreeWidgetItem(columns));
      }
   delete libs;
}
开发者ID:svn2github,项目名称:Go4,代码行数:31,代码来源:TGo4LoadedLibraries.cpp

示例2: AddHistSame

//_____________________________________________________
TLegendEntry* GFHistManager::AddHistSame(TH1* hist, Int_t layer, Int_t histNum,
					 const char* legendTitle, const char* legOpt)
{
  // adds hist to layer to draw it in the same pad as histNum's histo of that layer 
  if(!hist){
    this->Warning("AddHistSame", "adding NULL pointer will be ignored!");
    return NULL;
  }
  if (histNum > 0 && this->CheckDepth("AddHistSame", layer, kTRUE) //maybe added layer?
      && !this->GetHistsOf(layer, histNum-1)) {
    this->Error("AddHistSame", "usage as AddHist only for next free histNum, not %d", histNum);
    return NULL;
  }
  GFHistArray *histsArray = this->GetHistsOf(layer, histNum, kTRUE);// expand!
  TLegendEntry* result = NULL;
  if(histsArray) {
    histsArray->Add(hist); 
    if(legendTitle && strlen(legendTitle)){
      TObjArray* legends = this->MakeLegends(layer);
      TLegend* legend = NULL;
      if(legends->GetLast() >= histNum
	 && legends->At(histNum)){
	legend = static_cast<TLegend*>(legends->At(histNum));
      } else {
	legend = new TLegend(fLegendX1, fLegendY1, fLegendX2, fLegendY2);
#if ROOT_VERSION_CODE < ROOT_VERSION(5,6,0)
	if (TString(gStyle->GetName()) == "Plain") legend->SetBorderSize(1);
#endif
	legends->AddAtAndExpand(legend, histNum);
      }
      result = legend->AddEntry(hist,legendTitle, legOpt ? legOpt : fgLegendEntryOption.Data());
    }
  }
  return result;
}
开发者ID:12345ieee,项目名称:cmg-cmssw,代码行数:36,代码来源:GFHistManager.C

示例3: DrawLegend

//________________________________________________________
void GFHistManager::DrawLegend(Int_t layer, Int_t histNo)
{
  // histNo starting at '0'
  // We must already be in the correct pad, layer and histNo must exist

  if(fLegendArrays && layer <= fLegendArrays->GetLast() && fLegendArrays->At(layer)){
    TObjArray* legends = static_cast<TObjArray*>(fLegendArrays->At(layer));
    TObject* legend = (histNo <= legends->GetLast() ? legends->At(histNo) : NULL);
    if(legend) legend->Draw();
  }
}
开发者ID:12345ieee,项目名称:cmg-cmssw,代码行数:12,代码来源:GFHistManager.C

示例4: GetObjectsOf

//________________________________________________________
TList* GFHistManager::GetObjectsOf(Int_t layer, Int_t histNo)
{
  if(!this->CheckHistNum("GetObjectsOf", layer, histNo, kFALSE)) return NULL;

  if(fObjLists && layer <= fObjLists->GetLast() && fObjLists->At(layer)){
    TObjArray* layerLists = static_cast<TObjArray*>(fObjLists->At(layer));
    if(histNo <= layerLists->GetLast() && layerLists->At(histNo)){
      return static_cast<TList*>(layerLists->At(histNo));
    }
  }

  return NULL;
}
开发者ID:12345ieee,项目名称:cmg-cmssw,代码行数:14,代码来源:GFHistManager.C

示例5: DrawRays

void DrawRays()
{
 for(int i = 0; i < kNtheta; i++){
   TObjArray* focused = gArray[i]->GetFocused();
   
    for(Int_t j = 0; j <= focused->GetLast(); j++){
      ARay* ray = (ARay*)(*focused)[j];
      TPolyLine3D* pol = ray->MakePolyLine3D();
      pol->SetLineColor(i + 2);
      pol->Draw();
    } // j
  } // i
}
开发者ID:ROBAST,项目名称:ROBAST,代码行数:13,代码来源:Optimize.C

示例6: DrawObjects

//________________________________________________________
void GFHistManager::DrawObjects(Int_t layer, Int_t histNo)
{
  // histNo starting at '0'
  // We must already be in the correct pad, layer and histNo must exist
  if(fObjLists && layer <= fObjLists->GetLast() && fObjLists->At(layer)){
    TObjArray* layerLists = static_cast<TObjArray*>(fObjLists->At(layer));
    if(histNo <= layerLists->GetLast() && layerLists->At(histNo)){
      TObjLink *lnk = static_cast<TList*>(layerLists->At(histNo))->FirstLink();
      while (lnk) {
	lnk->GetObject()->Draw(lnk->GetOption());
	lnk = lnk->Next();
      }
    }
  }
}
开发者ID:12345ieee,项目名称:cmg-cmssw,代码行数:16,代码来源:GFHistManager.C

示例7: DrawPSF

void DrawPSF()
{
  TCanvas* can = new TCanvas("can", "can", 1200, 400);
  can->Divide(3, 1, 1e-10, 1e-10);
  TGraph* graph[kNtheta];
  for(int i = 0; i < kNtheta; i++){
    TH2D tmp("", "", 1, 0, 0, 1, 0, 0);
    
    TObjArray* focused = gArray[i]->GetFocused();
    
    for(Int_t j = 0; j <= focused->GetLast(); j++){
      ARay* ray = (ARay*)(*focused)[j];
      Double_t p[4];    
      ray->GetLastPoint(p);
      tmp.Fill(p[0], p[1]);
    } // j
    
    double meany = tmp.GetMean(2);
    
    graph[i] = new TGraph();
    
    for(Int_t j = 0; j <= focused->GetLast(); j++){
      ARay* ray = (ARay*)(*focused)[j];
      Double_t p[4];    
      ray->GetLastPoint(p);
      graph[i]->SetPoint(j, p[0]/um, (p[1] - meany)/um);
    } // j
    
    can->cd(i + 1);
    gPad->DrawFrame(-300, -300, 300, 300, Form("%.1f (deg);X (#it{#mu}m);Y (#it{#mu}m)", kTheta[i]));
    graph[i]->SetMarkerColor(2);
    graph[i]->SetMarkerStyle(5);
    graph[i]->SetMarkerSize(0.5);
    graph[i]->Draw("p same");
  } // i
}
开发者ID:ROBAST,项目名称:ROBAST,代码行数:36,代码来源:Optimize.C

示例8: MakeObjList

//________________________________________________________
TList* GFHistManager::MakeObjList(Int_t layer, Int_t histoNum)
{
  // return list of objects to be drawn upon hists in pad histoNum of 'layer' 
  // (to be called if 'layer' really exist!)
  if(!fObjLists) fObjLists = new TObjArray(fDepth);
  if(layer > fObjLists->GetLast() || !fObjLists->At(layer)){
    fObjLists->AddAtAndExpand(new TObjArray(this->GetNumHistsOf(layer)),layer);
  }
  TObjArray* layerLists = static_cast<TObjArray*>(fObjLists->At(layer));
  if(histoNum > layerLists->GetLast() || !layerLists->At(histoNum)){
    layerLists->AddAtAndExpand(new TList, histoNum); 
  }

  return static_cast<TList*>(layerLists->At(histoNum));
}
开发者ID:12345ieee,项目名称:cmg-cmssw,代码行数:16,代码来源:GFHistManager.C

示例9: GetSpotSize

double GetSpotSize(ARayArray* array)
{
  // Returns standard deviation of a spot
  TObjArray* focused = array->GetFocused();
  TH2D h("", "", 1, 0, 0, 1, 0, 0);
  
  for(int i = 0; i < focused->GetLast(); i++){
    ARay* ray = (ARay*)(*focused)[i];
    double p[4];    
    ray->GetLastPoint(p);
    h.Fill(p[0], p[1]);
  } // i

  double sx = h.GetStdDev(1);
  double sy = h.GetStdDev(2);

  return TMath::Sqrt(sx*sx + sy*sy);
}
开发者ID:ROBAST,项目名称:ROBAST,代码行数:18,代码来源:Optimize.C

示例10:

Bool_t h10looper::Notify()
{
    // The Notify() function is called when a new file is opened. This
    // can be either for a new TTree in a TChain or when when a new TTree
    // is started when using PROOF. It is normally not necessary to make changes
    // to the generated code, but the routine can be extended by the
    // user if needed. The return value is currently not used.
    int tn = fChain->GetTreeNumber();
    if (tn != fTreeNumber) {
        TString fullfn = ((TChain*)fChain)->GetFile()->GetName();
        TObjArray *tokens = fullfn.Tokenize("/");
        TObjString *tok = (TObjString*)tokens->At(tokens->GetLast());
        TString fn = tok->GetString();
        data->run = ((TString)fn(*fRegExp_run)).Atoi();
        data->file_anum = ((TString)((TString)fn(*fRegExp_Anum))(1,2)).Atoi();
        data->filename = fn.Data();
        delete tokens;
    }
    return kTRUE;
}
开发者ID:evan-phelps,项目名称:phys-ana-omega,代码行数:20,代码来源:h10looper.cpp

示例11: BeautifyGraphs

//-------------------------------------------------------------------------------------------------------------------------------------------
void BeautifyGraphs(TObjArray& array, const char* yAxisName) // Is differrent from the one in RealEfficiency.C since now the xaxis name is set in CreateRatioGraph
{
  TGraphAsymmErrors* g;
  
  for ( Int_t i = 0 ; i <= array.GetLast() ; ++ i )
  {
    g = static_cast<TGraphAsymmErrors*>(array.At(i));
  
    g->SetLineStyle(1);
    g->SetLineColor(1);
    g->SetMarkerStyle(20);
    g->SetMarkerSize(0.7);
    g->SetMarkerColor(2);
    g->GetXaxis()->CenterTitle(kTRUE);
    g->GetXaxis()->SetLabelFont(22);
    g->GetXaxis()->SetTitleFont(22);
    g->GetYaxis()->SetTitle(yAxisName);
    g->GetYaxis()->CenterTitle(kTRUE);
    g->GetYaxis()->SetLabelFont(22);
    g->GetYaxis()->SetTitleFont(22);
  }

}
开发者ID:benjaminaudurier,项目名称:Macro,代码行数:24,代码来源:ComparisonDataMC.C

示例12: splitSignal_SMaTGC

void splitSignal_SMaTGC(TString inputFile){

  ifstream  input(inputFile);
  const int linesize=1024;
  char inbuf[linesize];
  char inbufChain[linesize];
  const int max_files = 200;
  int nfiles=0;
  while (input.getline(inbuf,linesize)) {
    
    //    cout << "read line: " << inbuf << endl;
    if (inbuf[0] == '#') {
      //      cout << "comment \n";
      continue;
    }
    istrstream istline(inbuf);

    TString file_name;
    TString file_withCorrHisto_name;
    TString CorrHisto_name;
    //    vector<TString> errNames;
    TString errNames;
    TString signal_file_name;
    TString channel_name_old;
    TString channel_name_new;

    istline >> file_name
	    >> file_withCorrHisto_name
	    >> CorrHisto_name
	    >> errNames
	    >> signal_file_name
	    >> channel_name_old
	    >> channel_name_new
	    ;

    cout <<"reading file: "<<file_name<< "\t and correcting SM histo by "<< file_withCorrHisto_name<<":"<< CorrHisto_name <<"\t err anmes: "<<errNames<< endl;

    
    std::vector<TString> histos_updown_v;
    if (errNames!="0"){
      TObjArray *strL = errNames.Tokenize(",");
      
      for (int k=0;k<strL->GetLast()+1;k++){
	TString histo=((TObjString *)strL->At(k))->GetString();
	histos_updown_v.push_back(histo);
      }
      delete strL;
    }

  
    // correcting SM histo with file_withCorrHisto:CorrHisto_name
    bool do_corr=false;
    TH1D * histo_corr=new TH1D();
    if (file_withCorrHisto_name!="0" && CorrHisto_name!="0"){
      cout <<"  -> correcting SM histo by "<< file_withCorrHisto_name<<":"<< CorrHisto_name  << endl;
      TFile * file_withCorrHisto=new TFile(file_withCorrHisto_name,"read");
      file_withCorrHisto->cd();
      histo_corr=(TH1D*)(file_withCorrHisto->Get(CorrHisto_name)->Clone("clone_name"));
      do_corr=true;
    }

  TH1D * plot_SM=new TH1D("plot_SM","plot_SM",10,0.,10.);

  TFile * file_in=new TFile(file_name,"read");
  file_in->cd();
  //  file_in->ls();


  TList * list_histos=file_in->GetListOfKeys();
  TString file_out=file_name;
  file_out=file_out.ReplaceAll(channel_name_old,channel_name_new);
  cout <<" ----> output: "<< file_out<<"\n" << endl;
  TFile *outFile=new TFile(file_out,"recreate");
  outFile->cd();

  
  for (int i=0;i<list_histos->GetEntries();i++){
    // read histos one by one
    TString histo_name= list_histos->At(i)->GetName();

    cout <<"\treading histo \""<< histo_name <<"\""<< endl;
    // from "diboson" make: "dibosonSM"="diboson" and "diboson"=histo with all bin contents equal to 1!

    // check if this is one of syst up/down histos affecting signal
    bool signal_syst=false;
    //    int signal_syst=false;
    for (int j=0;j<histos_updown_v.size();j++){
      TString name=histo_name;
      name.ReplaceAll("Up","");
      name.ReplaceAll("Down","");
      if (histos_updown_v[j]==name)
	signal_syst=true;
    }

    if (histo_name=="diboson"){
      cout << "\t -> reading diboson"<< endl;
      // save "diboson" as "dibosonSM"
      TH1D * plot_diboson=(TH1D*)(file_in->Get(histo_name)->Clone("namec"));
      plot_SM=(TH1D*)(file_in->Get(histo_name)->Clone("somename"));
      plot_diboson=(TH1D*)(file_in->Get(histo_name)->Clone("namej"));
//.........这里部分代码省略.........
开发者ID:senka,项目名称:CombinedEWKAnalysis_wzANDwvANDunEqBinns_cfg_signalUnc_lnN,代码行数:101,代码来源:splitSignal_SMaTGC.C

示例13: RayTrace

void RayTrace(AOpticsManager* manager, TCanvas* can3D)
{
  const int kNdeg = 8;
  TH2D* h2[kNdeg];
  TGraph* graph = new TGraph();
  TCanvas* can = new TCanvas("can", "can", 900, 900);
  TCanvas* can2= new TCanvas("can2", "can2", 900, 900);
  can->Divide(3, 3, 1e-10, 1e-10);

  TH2D* hMirror = new TH2D("hMirror", ";X (mm);Y (mm)", 1000, -7, 7, 1000, -7, 7);

  for(int i = 0; i < kNdeg; i++){

    double deg = i*0.5;
    TGeoTranslation raytr("raytr", -2*kF*TMath::Sin(deg*TMath::DegToRad()), 0, 2*kF*TMath::Cos(deg*TMath::DegToRad()));
    TVector3 dir;
    dir.SetMagThetaPhi(1, TMath::Pi() - deg*TMath::DegToRad(), 0);
    double lambda = 400*nm; // dummy
    ARayArray* array = ARayShooter::Square(lambda, 14*m, 401, 0, &raytr, &dir);

    manager->TraceNonSequential(*array);

    h2[i] = new TH2D("", Form("#it{#theta} = %3.1f#circ;x (mm); y (mm)", deg), 200, -40, 100, 200, -70, 70);
    TH2D tmp("", "", 100, -1e5, 1e5, 100, -1e5, 1e5);

    TObjArray* focused = array->GetFocused();

    for(Int_t j = 0; j <= focused->GetLast(); j++){
      ARay* ray = (ARay*)(*focused)[j];
      Double_t p[4];
      ray->GetLastPoint(p);
      tmp.Fill(p[0], p[1]);

      if (i == 0) {
        int n = ray->FindNodeNumberStartWith("mirror");
        const double* pn = ray->GetPoint(n);
        hMirror->Fill(pn[0]/m, pn[1]/m);
      } // if

      if (i == kNdeg - 1 && gRandom->Uniform() < 0.001) {
        TPolyLine3D* pol = ray->MakePolyLine3D();
        pol->SetLineColor(2);
        can3D->cd();
        pol->Draw();
      } // if
    } // j

    double meanx = tmp.GetMean();

    for(Int_t j = 0; j <= focused->GetLast(); j++){
      ARay* ray = (ARay*)(*focused)[j];
      Double_t p[4];
      ray->GetLastPoint(p);
      h2[i]->Fill((p[0] - meanx)/mm, p[1]/mm);
    } // j

    can->cd(i + 1);
    h2[i]->Draw("colz");

    if(i == 0){
      can2->cd();
      hMirror->Draw("colz");
    } // i

    delete array;
  } // i
}
开发者ID:ROBAST,项目名称:ROBAST,代码行数:67,代码来源:DaviesCotton.C

示例14: main

int main(int argc, char* argv[]){
	if (argc != 6){
    		std::cout << "wrong number of arguments: usage ./topDataClass_doAnalysis <file name> <mod #> <row #> <col #> <ch #>" << std::endl;
    		return 0;
  	}

	//define application object
	theApp = new TApplication("App", &argc, argv);
	TString inputFileName = theApp->Argv()[1];
	std::cout << "Input file name "  << inputFileName << std::endl;

	//create target6 interface object
	topDataClass *data = new topDataClass();

	//specify channel of interest
	int inMod = atoi(theApp->Argv()[2]);
	int inRow = atoi(theApp->Argv()[3]);
	int inCol = atoi(theApp->Argv()[4]);
	int inCh = atoi(theApp->Argv()[5]);
	data->setAnalysisChannel( inMod, inRow, inCol, inCh );

	//specify timing marker channel
	data->setTimingMarkerChannel( 0, 0, 1, 2 );

	//specify time window
	data->windowTime = windowTime;

	//open summary tree file
	data->openSummaryTree(inputFileName);

	//create output file
  	TObjArray* strings = inputFileName.Tokenize("/");
  	TObjString* objstring = (TObjString*) strings->At(strings->GetLast());
  	TString inputFileNameBase(objstring->GetString());
	TString outputFileName = "output_topDataClass_doAnalysis_doublePulseSampleDTFit_";
  	outputFileName += inMod;
  	outputFileName += "_";
  	outputFileName += inRow;
  	outputFileName += "_";
  	outputFileName += inCol;
  	outputFileName += "_";
  	outputFileName += inCh;
  	outputFileName += "_";
  	outputFileName += inputFileNameBase;
  	//outputFileName += ".root";
  	std::cout << " outputFileName " << outputFileName << std::endl;
  	outputFile = new TFile( outputFileName , "RECREATE");

	//initialize histograms
	initializeGlobalHistograms();

	//initialize tree branches
	data->setTreeBranches();

	//load pulse info into arrays
	data->selectPulsesForArray();

	//loop over selected events, apply corrections histogram pulse time distributions
	//monitor pulse time vs event #
  	gPulseTimeVsEventNum = new TGraphErrors();
  	for(int entry = 0; entry < data->numUsed; entry++) {
		//skip events not in arrays
  		if( entry >= maxNumEvt )
			continue;

		double pulseTime = data->measurePulseTimeArrayEntry(entry,1);
		double pulseHeight = data->adc_0_A[entry];
		int smpBinNumIn128Array = data->getSmpBinNumIn128Array(entry);
		double smpPos =	data->getSmpPos(entry);

		//apply analysis cuts
		//if( smpBinNumIn128Array >= 127 )
		//	continue;
		//measure pulse time vs event #
		gPulseTimeVsEventNum->SetPoint( gPulseTimeVsEventNum->GetN() , data->eventNum_A[entry],  pulseTime );
		//cut on event #
		if( data->eventNum_A[entry] < 0 )
			continue;

		//histogram selected pulse distributions
		hPulseHeightInitial->Fill( data->adc_0_A[entry] );
		hPulseTimeInitial->Fill( pulseTime );
		hPulseSampleInitial->Fill(data->smp_0_A[entry]);
       		hPulseSmp128Initial->Fill(smpBinNumIn128Array);
		hPulseTimeVsSmp128Initial->Fill(smpBinNumIn128Array, pulseTime );
		hPulseTimeVsSmp128PosInitial->Fill(smpBinNumIn128Array + smpPos, pulseTime );
		hPulseTimeVsHeightInitial->Fill(pulseHeight, pulseTime );
		hPulseTimeVsFTSWInitial->Fill(data->ftsw_A[entry], pulseTime );
   		hFTSWVsSmp128Initial->Fill(smpBinNumIn128Array, data->ftsw_A[entry]);
	}
	
	//loop over selected events, measure time difference between timing marker and selected channel pulses
	gTest = new TGraphErrors();
	data->measurePulseMarkerTimeDifferenceDistribution(hPulseTimeMarkTimeDiffInitial,hPulseTimeMarkTimeDiffVsMarkSmpBinNumInitial );

	//run fit analysis
	doDoublePulseFit(data);

	//write output file
	writeOutputFile();
//.........这里部分代码省略.........
开发者ID:everil456,项目名称:idlab-scrod,代码行数:101,代码来源:topDataClass_doAnalysis_doublePulseSampleDTFit.cpp

示例15: SkimChain

void SkimChain(TChain* chain, const TString DataDir, TString SkimDir, TString skimname){

  TObjArray *listOfFiles = chain->GetListOfFiles();
  TIter fileIter(listOfFiles);
  TPRegexp fileNameMatchPattern("(.*?)/([^/]*)$");
  TPRegexp dataDirMatchPattern(DataDir);
  
  unsigned int nEventsTotal = 0;
  unsigned int nEventsSelectedTotal = 0;

  std::vector<FileEntry> files;
  while (TChainElement *currentFile = (TChainElement*)fileIter.Next()) {
    FileEntry file;
    TObjArray* matches = fileNameMatchPattern.MatchS(currentFile->GetTitle());
    assert(matches);
    assert(matches && matches->GetLast()==2);
    TString inputFileName(currentFile->GetTitle());
    TString fileName(((TObjString*)matches->At(2))->GetString());
    file.fileName = fileName.Data();
    TString outputDirectory(((TObjString*)matches->At(1))->GetString());
    file.inputDir = outputDirectory.Data();
    dataDirMatchPattern.Substitute(outputDirectory,SkimDir);
    outputDirectory += "/" + skimname;
    file.outputDir = outputDirectory.Data();
    // make output directory if it doesn't exist yet
    if ( gSystem->AccessPathName(outputDirectory.Data()) ){
      gSystem->mkdir(outputDirectory.Data(),true);
      assert( !gSystem->AccessPathName(outputDirectory.Data()) );
    }
    TString outputFileName(outputDirectory+"/"+fileName);
    cout << "Skimming " << inputFileName << " -> " << outputFileName << endl;

    TFile *output = TFile::Open(outputFileName.Data(), "RECREATE");
    assert(output);
    TFile *input = TFile::Open(inputFileName.Data());
    assert(input);
    TTree *tree = (TTree*)input->Get("Events");
    TTree *newtree = tree->CloneTree(0);
    newtree->SetDirectory(output);
    
    cms2.Init(newtree);
    cms2.Init(tree);
    
    // Event Loop
    const unsigned int nEvents = tree->GetEntries();
    unsigned int nEventsSelected = 0;
    int i_permille_old = 0;
    for (unsigned int event = 0; event < nEvents; ++event, ++nEventsTotal) {
      int i_permille = (int)floor(10000 * event / float(nEvents));
      if (i_permille != i_permille_old) {
	// xterm magic from L. Vacavant and A. Cerri
	if (isatty(1)) {
	  printf("\015\033[32m ---> \033[1m\033[31m%5.2f%%"
		 "\033[0m\033[32m <---\033[0m\015", i_permille/100.);
	  fflush(stdout);
	}
	i_permille_old = i_permille;
      }
      cms2.GetEntry(event);
      //set condition to skip event
      if ( not passedSkimSelection() ) continue;
            
      ++nEventsSelected;
      cms2.LoadAllBranches();
      // fill the new tree
      newtree->Fill();
    }
    file.nIn = nEvents;
    file.nOut = nEventsSelected;
    files.push_back(file);
    nEventsSelectedTotal += nEventsSelected;
    output->cd();
    newtree->Write();
    output->Close();
    input->Close();
  }
  cout << Form("Processed events: %u, \tselected: %u\n",nEventsTotal,nEventsSelectedTotal) << endl;
}
开发者ID:cmstas,项目名称:CMS2_ArchiveJul2013,代码行数:78,代码来源:SkimChain.C


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