CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
ExternalLHEAsciiDumper Class Reference
Inheritance diagram for ExternalLHEAsciiDumper:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 ExternalLHEAsciiDumper (const edm::ParameterSet &)
 
 ~ExternalLHEAsciiDumper () override=default
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~EDAnalyzerBase () 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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

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

Additional Inherited Members

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

Detailed Description

Definition at line 30 of file ExternalLHEAsciiDumper.cc.

Constructor & Destructor Documentation

◆ ExternalLHEAsciiDumper()

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

Definition at line 48 of file ExternalLHEAsciiDumper.cc.

49  : lheProduct_(ps.getParameter<edm::InputTag>("lheProduct")),
50  lheFileName_(ps.getParameter<std::string>("lheFileName")),
51  LHEAsciiToken_(consumes<LHEXMLStringProduct, edm::InRun>(edm::InputTag(lheProduct_))) {}
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::InputTag lheProduct_
const edm::EDGetTokenT< LHEXMLStringProduct > LHEAsciiToken_

◆ ~ExternalLHEAsciiDumper()

ExternalLHEAsciiDumper::~ExternalLHEAsciiDumper ( )
overridedefault

Member Function Documentation

◆ analyze()

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

Implements edm::one::EDAnalyzerBase.

Definition at line 36 of file ExternalLHEAsciiDumper.cc.

36 {}

◆ beginRun()

void ExternalLHEAsciiDumper::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
inlineoverrideprivate

Definition at line 37 of file ExternalLHEAsciiDumper.cc.

37 {}

◆ endRun()

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

Definition at line 55 of file ExternalLHEAsciiDumper.cc.

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

55  {
56  const edm::Handle<LHEXMLStringProduct>& LHEAscii = iRun.getHandle(LHEAsciiToken_);
57 
58  const std::vector<std::string>& lheOutputs = LHEAscii->getStrings();
59 
60  unsigned int iout = 0;
61 
62  size_t lastdot = lheFileName_.find_last_of('.');
63  std::string basename = lheFileName_.substr(0, lastdot);
64  std::string extension = lastdot != std::string::npos ? lheFileName_.substr(lastdot + 1, std::string::npos) : "";
65 
66  for (unsigned int i = 0; i < lheOutputs.size(); ++i) {
67  std::ofstream outfile;
68  if (iout == 0)
69  outfile.open(lheFileName_.c_str(), std::ofstream::out | std::ofstream::app);
70  else {
71  std::stringstream fname;
72  fname << basename << "_" << iout;
73  if (!extension.empty())
74  fname << "." << extension;
75  outfile.open(fname.str().c_str(), std::ofstream::out | std::ofstream::app);
76  }
77  outfile << lheOutputs[i];
78  outfile.close();
79  ++iout;
80  }
81 
82  for (unsigned int i = 0; i < LHEAscii->getCompressed().size(); ++i) {
83  std::ofstream outfile;
84  if (iout == 0)
85  outfile.open(lheFileName_.c_str(), std::ofstream::out | std::ofstream::app);
86  else {
87  std::stringstream fname;
88  fname << basename << "_" << iout;
89  if (!extension.empty())
90  fname << "." << extension;
91  outfile.open(fname.str().c_str(), std::ofstream::out | std::ofstream::app);
92  }
93  LHEAscii->writeCompressedContent(outfile, i);
94  outfile.close();
95  ++iout;
96  }
97 }
void writeCompressedContent(std::ostream &output, unsigned int i) const
const std::vector< std::vector< uint8_t > > & getCompressed() const
const std::vector< std::string > & getStrings() const
string fname
main script
const edm::EDGetTokenT< LHEXMLStringProduct > LHEAsciiToken_

Member Data Documentation

◆ LHEAsciiToken_

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

Definition at line 43 of file ExternalLHEAsciiDumper.cc.

Referenced by endRun().

◆ lheFileName_

const std::string ExternalLHEAsciiDumper::lheFileName_
private

Definition at line 41 of file ExternalLHEAsciiDumper.cc.

Referenced by endRun().

◆ lheProduct_

const edm::InputTag ExternalLHEAsciiDumper::lheProduct_
private

Definition at line 40 of file ExternalLHEAsciiDumper.cc.