CMS 3D CMS Logo

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 () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< LHEXMLStringProductLHEAsciiToken_
 
std::string lheFileName_
 
edm::InputTag lheProduct_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 30 of file ExternalLHEAsciiDumper.cc.

Constructor & Destructor Documentation

◆ ExternalLHEAsciiDumper()

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

Definition at line 47 of file ExternalLHEAsciiDumper.cc.

48  : lheProduct_(ps.getParameter<edm::InputTag>("lheProduct")),
49  lheFileName_(ps.getParameter<std::string>("lheFileName")) {
50  LHEAsciiToken_ = consumes<LHEXMLStringProduct, edm::InRun>(edm::InputTag(lheProduct_));
51 
52  return;
53 }

References LHEAsciiToken_, and lheProduct_.

◆ ~ExternalLHEAsciiDumper()

ExternalLHEAsciiDumper::~ExternalLHEAsciiDumper ( )
override

Definition at line 55 of file ExternalLHEAsciiDumper.cc.

55 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 57 of file ExternalLHEAsciiDumper.cc.

57 {}

◆ endRun()

void ExternalLHEAsciiDumper::endRun ( edm::Run const &  iRun,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 61 of file ExternalLHEAsciiDumper.cc.

61  {
63  iRun.getByToken(LHEAsciiToken_, LHEAscii);
64 
65  const std::vector<std::string>& lheOutputs = LHEAscii->getStrings();
66 
67  unsigned int iout = 0;
68 
69  size_t lastdot = lheFileName_.find_last_of('.');
70  std::string basename = lheFileName_.substr(0, lastdot);
71  std::string extension = lastdot != std::string::npos ? lheFileName_.substr(lastdot + 1, std::string::npos) : "";
72 
73  for (unsigned int i = 0; i < lheOutputs.size(); ++i) {
74  std::ofstream outfile;
75  if (iout == 0)
76  outfile.open(lheFileName_.c_str(), std::ofstream::out | std::ofstream::app);
77  else {
78  std::stringstream fname;
79  fname << basename << "_" << iout;
80  if (!extension.empty())
81  fname << "." << extension;
82  outfile.open(fname.str().c_str(), std::ofstream::out | std::ofstream::app);
83  }
84  outfile << lheOutputs[i];
85  outfile.close();
86  ++iout;
87  }
88 
89  for (unsigned int i = 0; i < LHEAscii->getCompressed().size(); ++i) {
90  std::ofstream outfile;
91  if (iout == 0)
92  outfile.open(lheFileName_.c_str(), std::ofstream::out | std::ofstream::app);
93  else {
94  std::stringstream fname;
95  fname << basename << "_" << iout;
96  if (!extension.empty())
97  fname << "." << extension;
98  outfile.open(fname.str().c_str(), std::ofstream::out | std::ofstream::app);
99  }
100  LHEAscii->writeCompressedContent(outfile, i);
101  outfile.close();
102  ++iout;
103  }
104 }

References runGCPTkAlMap::extension, alignmentValidation::fname, edm::Run::getByToken(), LHEXMLStringProduct::getCompressed(), LHEXMLStringProduct::getStrings(), mps_fire::i, LHEAsciiToken_, lheFileName_, MillePedeFileConverter_cfg::out, timingPdfMaker::outfile, AlCaHLTBitMon_QueryRunRegistry::string, and LHEXMLStringProduct::writeCompressedContent().

Member Data Documentation

◆ LHEAsciiToken_

edm::EDGetTokenT<LHEXMLStringProduct> ExternalLHEAsciiDumper::LHEAsciiToken_
private

Definition at line 42 of file ExternalLHEAsciiDumper.cc.

Referenced by endRun(), and ExternalLHEAsciiDumper().

◆ lheFileName_

std::string ExternalLHEAsciiDumper::lheFileName_
private

Definition at line 40 of file ExternalLHEAsciiDumper.cc.

Referenced by endRun().

◆ lheProduct_

edm::InputTag ExternalLHEAsciiDumper::lheProduct_
private

Definition at line 39 of file ExternalLHEAsciiDumper.cc.

Referenced by ExternalLHEAsciiDumper().

ExternalLHEAsciiDumper::LHEAsciiToken_
edm::EDGetTokenT< LHEXMLStringProduct > LHEAsciiToken_
Definition: ExternalLHEAsciiDumper.cc:42
mps_fire.i
i
Definition: mps_fire.py:428
LHEXMLStringProduct::getCompressed
const std::vector< std::vector< uint8_t > > & getCompressed() const
Definition: LHEXMLStringProduct.h:22
LHEXMLStringProduct::writeCompressedContent
void writeCompressedContent(std::ostream &output, unsigned int i) const
Definition: LHEXMLStringProduct.cc:84
edm::Handle
Definition: AssociativeIterator.h:50
ExternalLHEAsciiDumper::lheFileName_
std::string lheFileName_
Definition: ExternalLHEAsciiDumper.cc:40
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ExternalLHEAsciiDumper::lheProduct_
edm::InputTag lheProduct_
Definition: ExternalLHEAsciiDumper.cc:39
runGCPTkAlMap.extension
extension
Definition: runGCPTkAlMap.py:188
alignmentValidation.fname
string fname
main script
Definition: alignmentValidation.py:959
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
timingPdfMaker.outfile
outfile
Definition: timingPdfMaker.py:351
LHEXMLStringProduct::getStrings
const std::vector< std::string > & getStrings() const
Definition: LHEXMLStringProduct.h:20
edm::InputTag
Definition: InputTag.h:15