CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

ExternalLHEAsciiDumper Class Reference

Inheritance diagram for ExternalLHEAsciiDumper:
edm::EDAnalyzer

List of all members.

Public Member Functions

 ExternalLHEAsciiDumper (const edm::ParameterSet &)
 ~ExternalLHEAsciiDumper ()

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_

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.

                                                                       :
  lheProduct_( ps.getParameter<edm::InputTag>("lheProduct") ),
  lheFileName_( ps.getParameter<std::string>("lheFileName") )
{
  
  return;
  
}
ExternalLHEAsciiDumper::~ExternalLHEAsciiDumper ( )

Definition at line 61 of file ExternalLHEAsciiDumper.cc.

{
}

Member Function Documentation

void ExternalLHEAsciiDumper::analyze ( const edm::Event ,
const edm::EventSetup  
) [private, virtual]

Implements edm::EDAnalyzer.

Definition at line 66 of file ExternalLHEAsciiDumper.cc.

{
}
void ExternalLHEAsciiDumper::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 101 of file ExternalLHEAsciiDumper.cc.

                                    {
}
void ExternalLHEAsciiDumper::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
) [private, virtual]

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.

                                                                       {

  edm::Handle< LHEXMLStringProduct > LHEAscii;
  iRun.getByLabel(lheProduct_,LHEAscii);
  
  const std::vector<std::string>& lheOutputs = LHEAscii->getStrings();

  size_t lastdot = lheFileName_.find_last_of(".");
  std::string basename = lheFileName_.substr(0, lastdot);
  std::string extension = lastdot != std::string::npos ?  lheFileName_.substr(lastdot+1, std::string::npos) : "";

  for (unsigned int i = 0; i < lheOutputs.size(); ++i){
    std::ofstream outfile;
    if (i == 0)
      outfile.open (lheFileName_.c_str(), std::ofstream::out | std::ofstream::app);
    else {
      std::stringstream fname;
      fname << basename << "_" << i ;
      if (extension != "")
        fname << "." << extension;
      outfile.open (fname.str().c_str(), std::ofstream::out | std::ofstream::app);
    }
    outfile << lheOutputs[i];
    outfile.close();
  }

}

Member Data Documentation

std::string ExternalLHEAsciiDumper::lheFileName_ [private]

Definition at line 46 of file ExternalLHEAsciiDumper.cc.

Referenced by endRun().

Definition at line 45 of file ExternalLHEAsciiDumper.cc.

Referenced by endRun().