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 edm::EDConsumerBase

Public Member Functions

 ExternalLHEAsciiDumper (const edm::ParameterSet &)
 
 ~ExternalLHEAsciiDumper ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

std::string lheFileName_
 
edm::InputTag lheProduct_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 32 of file ExternalLHEAsciiDumper.cc.

Constructor & Destructor Documentation

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

Definition at line 49 of file ExternalLHEAsciiDumper.cc.

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

Definition at line 58 of file ExternalLHEAsciiDumper.cc.

59 {
60 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 63 of file ExternalLHEAsciiDumper.cc.

64 {
65 }
void ExternalLHEAsciiDumper::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 70 of file ExternalLHEAsciiDumper.cc.

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

70  {
71 
73  iRun.getByLabel(lheProduct_,LHEAscii);
74 
75  const std::vector<std::string>& lheOutputs = LHEAscii->getStrings();
76 
77  size_t lastdot = lheFileName_.find_last_of(".");
78  std::string basename = lheFileName_.substr(0, lastdot);
79  std::string extension = lastdot != std::string::npos ? lheFileName_.substr(lastdot+1, std::string::npos) : "";
80 
81  for (unsigned int i = 0; i < lheOutputs.size(); ++i){
82  std::ofstream outfile;
83  if (i == 0)
84  outfile.open (lheFileName_.c_str(), std::ofstream::out | std::ofstream::app);
85  else {
86  std::stringstream fname;
87  fname << basename << "_" << i ;
88  if (extension != "")
89  fname << "." << extension;
90  outfile.open (fname.str().c_str(), std::ofstream::out | std::ofstream::app);
91  }
92  outfile << lheOutputs[i];
93  outfile.close();
94  }
95 
96 }
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 43 of file ExternalLHEAsciiDumper.cc.

Referenced by endRun().

edm::InputTag ExternalLHEAsciiDumper::lheProduct_
private

Definition at line 42 of file ExternalLHEAsciiDumper.cc.

Referenced by endRun().