Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-28 03:54:33

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   char* tmp = std::getenv("CMSSW_BASE");
0015   assert(tmp);
0016   std::string Base(tmp);
0017   Base += "/src/";
0018   std::cout << "Writting file:" << Base + FileName << std::endl;
0019   std::ofstream outputFile(Base + FileName);
0020   std::vector<std::string> FileContent = pset.getParameter<std::vector<std::string> >("FileContent");
0021   for (unsigned int i = 0; i < FileContent.size(); i++) {
0022     outputFile << FileContent.at(i) << std::endl;
0023   }
0024   outputFile.close();
0025   std::cout << "File:" << Base + FileName << " Complete." << std::endl;
0026 }
0027 
0028 DEFINE_FWK_MODULE(DataCardFileWriter);