CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
ExternalLHEAsciiDumper Class Reference
Inheritance diagram for ExternalLHEAsciiDumper:
edm::EDAnalyzer

Public Member Functions

 ExternalLHEAsciiDumper (const edm::ParameterSet &)
 
 ~ExternalLHEAsciiDumper ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void endJob ()
 
virtual void endRun (edm::Run const &, edm::EventSetup const &)
 

Private Attributes

std::string lheFileName_
 
edm::InputTag lheProduct_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

Definition at line 34 of file ExternalLHEAsciiDumper.cc.

Constructor & Destructor Documentation

ExternalLHEAsciiDumper::ExternalLHEAsciiDumper ( const edm::ParameterSet ps)
explicit

Definition at line 52 of file ExternalLHEAsciiDumper.cc.

52  :
53  lheProduct_( ps.getParameter<edm::InputTag>("lheProduct") ),
54  lheFileName_( ps.getParameter<std::string>("lheFileName") )
55 {
56 
57  return;
58 
59 }
T getParameter(std::string const &) const
ExternalLHEAsciiDumper::~ExternalLHEAsciiDumper ( )

Definition at line 61 of file ExternalLHEAsciiDumper.cc.

62 {
63 }

Member Function Documentation

void ExternalLHEAsciiDumper::analyze ( const edm::Event ,
const edm::EventSetup  
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 66 of file ExternalLHEAsciiDumper.cc.

67 {
68 }
void ExternalLHEAsciiDumper::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 120 of file ExternalLHEAsciiDumper.cc.

120  {
121 }
void ExternalLHEAsciiDumper::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 73 of file ExternalLHEAsciiDumper.cc.

References alignmentValidation::fname, edm::Run::getByLabel(), i, lheFileName_, lheProduct_, dbtoconf::out, and EdgesToViz::outfile.

73  {
74 
76  iRun.getByLabel(lheProduct_,LHEAscii);
77 
78  const std::vector<std::string>& lheOutputs = LHEAscii->getStrings();
79 
80  unsigned int iout = 0;
81 
82  size_t lastdot = lheFileName_.find_last_of(".");
83  std::string basename = lheFileName_.substr(0, lastdot);
84  std::string extension = lastdot != std::string::npos ? lheFileName_.substr(lastdot+1, std::string::npos) : "";
85 
86  for (unsigned int i = 0; i < lheOutputs.size(); ++i){
87  std::ofstream outfile;
88  if (iout == 0)
89  outfile.open (lheFileName_.c_str(), std::ofstream::out | std::ofstream::app);
90  else {
91  std::stringstream fname;
92  fname << basename << "_" << iout ;
93  if (extension != "")
94  fname << "." << extension;
95  outfile.open (fname.str().c_str(), std::ofstream::out | std::ofstream::app);
96  }
97  outfile << lheOutputs[i];
98  outfile.close();
99  ++iout;
100  }
101 
102  for (unsigned int i = 0; i < LHEAscii->getCompressed().size(); ++i){
103  std::ofstream outfile;
104  if (iout == 0)
105  outfile.open (lheFileName_.c_str(), std::ofstream::out | std::ofstream::app);
106  else {
107  std::stringstream fname;
108  fname << basename << "_" << iout ;
109  if (extension != "")
110  fname << "." << extension;
111  outfile.open (fname.str().c_str(), std::ofstream::out | std::ofstream::app);
112  }
113  LHEAscii->writeCompressedContent(outfile,i);
114  outfile.close();
115  ++iout;
116  }
117 
118 }
int i
Definition: DBlmapReader.cc:9
list outfile
Definition: EdgesToViz.py:91
tuple out
Definition: dbtoconf.py:99
string fname
main script

Member Data Documentation

std::string ExternalLHEAsciiDumper::lheFileName_
private

Definition at line 46 of file ExternalLHEAsciiDumper.cc.

Referenced by endRun().

edm::InputTag ExternalLHEAsciiDumper::lheProduct_
private

Definition at line 45 of file ExternalLHEAsciiDumper.cc.

Referenced by endRun().