void singleFile(TString name, double scalingFactor){
  // get the files
  loadingFiles(name); 
  // ---------------------------------------
  // !!! definition of output file(name) !!!
  // ---------------------------------------
  std::string path = (string)(name);
  size_t separator = path.find_last_of("/");
  TString file = (TString)(path.substr(separator+1));
  //  std::cout << "path: " << path << std::endl;
  //  std::cout << "separator: " << separator << std::endl;
  //  std::cout << "file: " << file << std::endl;

  TString outputfile="./diffXSecFromSignal/analysisRootFilesL1CorrPU/"+file+".root";
  TFile f(outputfile, "recreate");
  std::cout << "output file: " << outputfile << std::endl;
  std::cout << "scaling factor: " << setprecision(9) << fixed << scalingFactor;
  // ---------------------------------------------------------
  // !!! list of plots you want to combine !!!
  // and their directories within the input samples
  // example: addAndWeight("MyPlotFolder", "MyPlot", luminosity, f)
  // ---------------------------------------------------------
  TString folder ="";
  TString plot = "";
  // go to file
  files_[0]->cd();
  // loop objects in file
  TIter fileIterator(gDirectory->GetListOfKeys());
  TKey *fileKey;
  while( (fileKey = (TKey*)fileIterator()) ) {
    TObject *fileObject = fileKey->ReadObj(); 
    // check if object is a directory
    if(fileObject->InheritsFrom("TDirectory")){
      folder = (TString)fileObject->GetName();
      std::cout << std::endl << " - folder: " << folder << std::endl << "   plots: ";
      // go to directory
      ((TDirectory*)fileObject)->cd();
      // loop objects in directory
      TIter folderIterator(gDirectory->GetListOfKeys());
      TKey *folderKey;
      while( (folderKey = (TKey*)folderIterator()) ) {
	TObject *folderObject = folderKey->ReadObj(); 
	// check if object is a TH1 or TH2
	if( (folderObject->InheritsFrom("TH1")) || (folderObject->InheritsFrom("TH2"))){
	  plot = folderObject->GetName();
	  addAndWeight(folder, plot, f, scalingFactor);
	}
      }
    }
  }
  files_[0]->Close();
  

  f.Close();
}
Exemple #2
0
void StartGameLoading::loadImageCallBack(CCObject *pSender)
{
    gLoadedCount++;
    //float percent = 90 * (float)gLoadedCount / gInGameImageFiles.size();
	float percent = 100 * (float)gLoadedCount / gInGameImageFiles.size();
    m_loadProgress->setPercentage(percent);

    if(gLoadedCount == gInGameImageFiles.size())
    {
        loadingFiles();
    }
}