Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:29:41

0001 #include "GeneratorInterface/EvtGenInterface/interface/DataCardFileWriter.h"
0002 
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 #include <iostream>
0005 #include <fstream>
0006 #include <string>
0007 #include <vector>
0008 #include <cstdlib>
0009 
0010 using namespace gen;
0011 
0012 DataCardFileWriter::DataCardFileWriter(const edm::ParameterSet& pset) {
0013   std::string FileName = pset.getParameter<std::string>("FileName");
0014   std::string Base = std::getenv("CMSSW_BASE");
0015   Base += "/src/";
0016   std::cout << "Writting file:" << Base + FileName << std::endl;
0017   std::ofstream outputFile(Base + FileName);
0018   std::vector<std::string> FileContent = pset.getParameter<std::vector<std::string> >("FileContent");
0019   for (unsigned int i = 0; i < FileContent.size(); i++) {
0020     outputFile << FileContent.at(i) << std::endl;
0021   }
0022   outputFile.close();
0023   std::cout << "File:" << Base + FileName << " Complete." << std::endl;
0024 }
0025 
0026 DEFINE_FWK_MODULE(DataCardFileWriter);