CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HectorProducer Class Reference

#include <HectorProducer.h>

Inheritance diagram for HectorProducer:
edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void beginRun (const edm::Run &r, const edm::EventSetup &c) override
 
void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
 HectorProducer (edm::ParameterSet const &p)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~HectorProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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 Attributes

HepMC::GenEventevt_
 
int m_evtAnalysed
 just to count events that have been analysed More...
 
bool m_FP420Transport
 
Hectorm_Hector
 
edm::EDGetTokenT< edm::HepMCProductm_HepMC
 
bool m_verbosity
 
bool m_ZDCTransport
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- 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 27 of file HectorProducer.h.

Constructor & Destructor Documentation

◆ HectorProducer()

HectorProducer::HectorProducer ( edm::ParameterSet const &  p)
explicit

Definition at line 35 of file HectorProducer.cc.

36  : m_HepMC(consumes<edm::HepMCProduct>(p.getParameter<edm::InputTag>("HepMCProductLabel"))) {
37  m_verbosity = p.getParameter<bool>("Verbosity");
38  m_FP420Transport = p.getParameter<bool>("FP420Transport");
39  m_ZDCTransport = p.getParameter<bool>("ZDCTransport");
40  m_evtAnalysed = 0;
41 
42  produces<edm::HepMCProduct>();
43  produces<edm::LHCTransportLinkContainer>();
44 
46 
48  if (!rng.isAvailable()) {
49  throw cms::Exception("Configuration") << "LHCTransport (HectorProducer) requires the "
50  "RandomNumberGeneratorService\n"
51  "which is not present in the configuration file. You must add the "
52  "service\n"
53  "in the configuration file or remove the modules that require it.";
54  }
55  edm::LogVerbatim("SimTransportHectorProducer") << "Hector is created";
56 }

References Exception, HectorTransport_cfi::Hector, edm::Service< T >::isAvailable(), m_evtAnalysed, m_FP420Transport, m_Hector, m_verbosity, m_ZDCTransport, and AlCaHLTBitMon_ParallelJobs::p.

◆ ~HectorProducer()

HectorProducer::~HectorProducer ( )
override

Definition at line 58 of file HectorProducer.cc.

58 {}

Member Function Documentation

◆ beginRun()

void HectorProducer::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
override

Definition at line 60 of file HectorProducer.cc.

60 {}

◆ endRun()

void HectorProducer::endRun ( const edm::Run r,
const edm::EventSetup c 
)
override

Definition at line 62 of file HectorProducer.cc.

62 {}

◆ produce()

void HectorProducer::produce ( edm::Event e,
const edm::EventSetup c 
)
overridevirtual

Implements edm::one::EDProducerBase.

Definition at line 64 of file HectorProducer.cc.

64  {
66  CLHEP::HepRandomEngine *engine = &rng->getEngine(iEvent.streamID());
67  if (engine->name() != "TRandom3") {
68  throw cms::Exception("Configuration") << "The TRandom3 engine type must be used with HectorProducer, "
69  << "Random Number Generator Service not correctly configured!";
70  }
71  TRandom3 *rootEngine = ((edm::TRandomAdaptor *)engine)->getRootEngine();
72 
73  ++m_evtAnalysed;
74 
75  edm::LogVerbatim("SimTransportHectorProducer") << "produce evt " << m_evtAnalysed;
76 
78  iEvent.getByToken(m_HepMC, HepMCEvt);
79 
80  if (!HepMCEvt.isValid()) {
81  throw cms::Exception("InvalidReference") << "Invalid reference to HepMCProduct\n";
82  }
83 
84  if (HepMCEvt.provenance()->moduleLabel() == "LHCTransport") {
85  throw cms::Exception("LogicError") << "HectorTrasported HepMCProduce already exists\n";
86  }
87 
88  evt_ = new HepMC::GenEvent(*HepMCEvt->GetEvent());
90  if (m_FP420Transport) {
91  m_Hector->clear();
92  m_Hector->add(evt_, es);
93  m_Hector->filterFP420(rootEngine);
94  }
95  if (m_ZDCTransport) {
96  m_Hector->clear();
97  m_Hector->add(evt_, es);
98  m_Hector->filterZDC(rootEngine);
99 
100  m_Hector->clear();
101  m_Hector->add(evt_, es);
102  m_Hector->filterD1(rootEngine);
103  }
105  if (m_verbosity)
106  evt_->print();
107 
108  edm::LogVerbatim("SimTransportHectorProducer") << "new HepMC product ";
109 
110  unique_ptr<edm::HepMCProduct> NewProduct(new edm::HepMCProduct());
111  NewProduct->addHepMCData(evt_);
112 
113  iEvent.put(std::move(NewProduct));
114 
115  edm::LogVerbatim("SimTransportHectorProducer") << "new LHCTransportLinkContainer ";
116  unique_ptr<edm::LHCTransportLinkContainer> NewCorrespondenceMap(new edm::LHCTransportLinkContainer());
118  (*NewCorrespondenceMap).swap(thisLink);
119 
120  if (m_verbosity) {
121  for (unsigned int i = 0; i < (*NewCorrespondenceMap).size(); ++i)
122  edm::LogVerbatim("HectorEventProcessing") << "Hector correspondence table: " << (*NewCorrespondenceMap)[i];
123  }
124 
125  iEvent.put(std::move(NewCorrespondenceMap));
126  edm::LogVerbatim("SimTransportHectorProducer") << "produce end ";
127 }

References Hector::add(), Hector::addPartToHepMC(), Hector::clear(), Hector::clearApertureFlags(), evt_, Exception, Hector::filterD1(), Hector::filterFP420(), Hector::filterZDC(), Hector::getCorrespondenceMap(), edm::RandomNumberGenerator::getEngine(), edm::HepMCProduct::GetEvent(), mps_fire::i, iEvent, edm::HandleBase::isValid(), m_evtAnalysed, m_FP420Transport, m_Hector, m_HepMC, m_verbosity, m_ZDCTransport, edm::Provenance::moduleLabel(), eostools::move(), and edm::HandleBase::provenance().

Member Data Documentation

◆ evt_

HepMC::GenEvent* HectorProducer::evt_
private

Definition at line 36 of file HectorProducer.h.

Referenced by produce().

◆ m_evtAnalysed

int HectorProducer::m_evtAnalysed
private

just to count events that have been analysed

Definition at line 43 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

◆ m_FP420Transport

bool HectorProducer::m_FP420Transport
private

Definition at line 41 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

◆ m_Hector

Hector* HectorProducer::m_Hector
private

Definition at line 37 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

◆ m_HepMC

edm::EDGetTokenT<edm::HepMCProduct> HectorProducer::m_HepMC
private

Definition at line 39 of file HectorProducer.h.

Referenced by produce().

◆ m_verbosity

bool HectorProducer::m_verbosity
private

Definition at line 40 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

◆ m_ZDCTransport

bool HectorProducer::m_ZDCTransport
private

Definition at line 42 of file HectorProducer.h.

Referenced by HectorProducer(), and produce().

edm::Provenance::moduleLabel
std::string const & moduleLabel() const
Definition: Provenance.h:55
Hector::addPartToHepMC
HepMC::GenEvent * addPartToHepMC(HepMC::GenEvent *event)
Definition: Hector.cc:503
edm::RandomNumberGenerator::getEngine
virtual CLHEP::HepRandomEngine & getEngine(StreamID const &)=0
Use this engine in event methods.
mps_fire.i
i
Definition: mps_fire.py:428
edm::LHCTransportLinkContainer
std::vector< LHCTransportLink > LHCTransportLinkContainer
Definition: LHCTransportLinkContainer.h:8
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
HectorProducer::m_evtAnalysed
int m_evtAnalysed
just to count events that have been analysed
Definition: HectorProducer.h:43
HectorProducer::evt_
HepMC::GenEvent * evt_
Definition: HectorProducer.h:36
HectorProducer::m_verbosity
bool m_verbosity
Definition: HectorProducer.h:40
edm::Handle< edm::HepMCProduct >
edm::Service::isAvailable
bool isAvailable() const
Definition: Service.h:40
Hector::filterD1
void filterD1(TRandom3 *)
Definition: Hector.cc:402
HepMC::GenEvent
Definition: hepmc_rootio.cc:9
HectorProducer::m_HepMC
edm::EDGetTokenT< edm::HepMCProduct > m_HepMC
Definition: HectorProducer.h:39
Hector::add
void add(const HepMC::GenEvent *ev, const edm::EventSetup &es)
Definition: Hector.cc:164
Hector::getCorrespondenceMap
std::vector< LHCTransportLink > & getCorrespondenceMap()
Definition: Hector.h:73
HectorProducer::m_Hector
Hector * m_Hector
Definition: HectorProducer.h:37
edm::HandleBase::provenance
Provenance const * provenance() const
Definition: HandleBase.h:74
edm::TRandomAdaptor
Definition: TRandomAdaptor.h:13
Hector::clear
void clear()
Definition: Hector.cc:152
Hector::clearApertureFlags
void clearApertureFlags()
Definition: Hector.cc:146
edm::Service< edm::RandomNumberGenerator >
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::HepMCProduct::GetEvent
const HepMC::GenEvent * GetEvent() const
Definition: HepMCProduct.h:34
Hector::filterFP420
void filterFP420(TRandom3 *)
Definition: Hector.cc:227
eostools.move
def move(src, dest)
Definition: eostools.py:511
HectorProducer::m_ZDCTransport
bool m_ZDCTransport
Definition: HectorProducer.h:42
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
Exception
Definition: hltDiff.cc:246
HectorProducer::m_FP420Transport
bool m_FP420Transport
Definition: HectorProducer.h:41
Hector::filterZDC
void filterZDC(TRandom3 *)
Definition: Hector.cc:319
edm::HepMCProduct
Definition: HepMCProduct.h:18
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
HectorTransport_cfi.Hector
Hector
Definition: HectorTransport_cfi.py:9
edm::Log
Definition: MessageLogger.h:70
edm::InputTag
Definition: InputTag.h:15