CMS 3D CMS Logo

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

#include <OscarProducer.h>

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

Public Types

typedef std::vector< std::shared_ptr< SimProducer > > Producers
 
- 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
 

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
 
 OscarProducer (edm::ParameterSet const &p)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
 ~OscarProducer () 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

Producers m_producers
 
std::unique_ptr< RunManagerm_runManager
 
std::unique_ptr< CustomUIsessionm_UIsession
 

Additional Inherited Members

- 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 16 of file OscarProducer.h.

Member Typedef Documentation

◆ Producers

typedef std::vector<std::shared_ptr<SimProducer> > OscarProducer::Producers

Definition at line 18 of file OscarProducer.h.

Constructor & Destructor Documentation

◆ OscarProducer()

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

Definition at line 64 of file OscarProducer.cc.

64  {
65  // Random number generation not allowed here
66  StaticRandomEngineSetUnset random(nullptr);
67 
70 
71  consumes<edm::HepMCProduct>(p.getParameter<edm::InputTag>("HepMCProductLabel"));
72  m_runManager = std::make_unique<RunManager>(p, consumesCollector());
73 
74  produces<edm::SimTrackContainer>().setBranchAlias("SimTracks");
75  produces<edm::SimVertexContainer>().setBranchAlias("SimVertices");
76  produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelLowTof");
77  produces<edm::PSimHitContainer>("TrackerHitsPixelBarrelHighTof");
78  produces<edm::PSimHitContainer>("TrackerHitsTIBLowTof");
79  produces<edm::PSimHitContainer>("TrackerHitsTIBHighTof");
80  produces<edm::PSimHitContainer>("TrackerHitsTIDLowTof");
81  produces<edm::PSimHitContainer>("TrackerHitsTIDHighTof");
82  produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapLowTof");
83  produces<edm::PSimHitContainer>("TrackerHitsPixelEndcapHighTof");
84  produces<edm::PSimHitContainer>("TrackerHitsTOBLowTof");
85  produces<edm::PSimHitContainer>("TrackerHitsTOBHighTof");
86  produces<edm::PSimHitContainer>("TrackerHitsTECLowTof");
87  produces<edm::PSimHitContainer>("TrackerHitsTECHighTof");
88 
89  produces<edm::PSimHitContainer>("TotemHitsT1");
90  produces<edm::PSimHitContainer>("TotemHitsT2Gem");
91  produces<edm::PSimHitContainer>("TotemHitsRP");
92  produces<edm::PSimHitContainer>("CTPPSPixelHits");
93  produces<edm::PSimHitContainer>("CTPPSTimingHits");
94  produces<edm::PSimHitContainer>("FP420SI");
95  produces<edm::PSimHitContainer>("BSCHits");
96  produces<edm::PSimHitContainer>("PLTHits");
97  produces<edm::PSimHitContainer>("BCM1FHits");
98  produces<edm::PSimHitContainer>("BHMHits");
99  produces<edm::PSimHitContainer>("FastTimerHitsBarrel");
100  produces<edm::PSimHitContainer>("FastTimerHitsEndcap");
101 
102  produces<edm::PCaloHitContainer>("EcalHitsEB");
103  produces<edm::PCaloHitContainer>("EcalHitsEE");
104  produces<edm::PCaloHitContainer>("EcalHitsES");
105  produces<edm::PCaloHitContainer>("HcalHits");
106  produces<edm::PCaloHitContainer>("CaloHitsTk");
107  produces<edm::PCaloHitContainer>("HGCHitsEE");
108  produces<edm::PCaloHitContainer>("HGCHitsHEfront");
109  produces<edm::PCaloHitContainer>("HGCHitsHEback");
110 
111  produces<edm::PSimHitContainer>("MuonDTHits");
112  produces<edm::PSimHitContainer>("MuonCSCHits");
113  produces<edm::PSimHitContainer>("MuonRPCHits");
114  produces<edm::PSimHitContainer>("MuonGEMHits");
115  produces<edm::PSimHitContainer>("MuonME0Hits");
116 
117  produces<edm::PCaloHitContainer>("CastorPL");
118  produces<edm::PCaloHitContainer>("CastorFI");
119  produces<edm::PCaloHitContainer>("CastorBU");
120  produces<edm::PCaloHitContainer>("CastorTU");
121  produces<edm::PCaloHitContainer>("EcalTBH4BeamHits");
122  produces<edm::PCaloHitContainer>("HcalTB06BeamHits");
123  produces<edm::PCaloHitContainer>("ZDCHITS");
124  produces<edm::PCaloHitContainer>("ChamberHits");
125  produces<edm::PCaloHitContainer>("FibreHits");
126  produces<edm::PCaloHitContainer>("WedgeHits");
127  produces<edm::PCaloHitContainer>("HFNoseHits");
128  produces<edm::PCaloHitContainer>("TotemHitsT2Scint");
129 
130  //register any products
131  m_producers = m_runManager->producers();
132 
133  for (Producers::iterator itProd = m_producers.begin(); itProd != m_producers.end(); ++itProd) {
134  (*itProd)->registerProducts(producesCollector());
135  }
136 
137  //UIsession manager for message handling
138  m_UIsession = std::make_unique<CustomUIsession>();
139 }

References edm::EDConsumerBase::consumesCollector(), edm::SharedResourceNames::kCLHEPRandomEngine, edm::SharedResourceNames::kGEANT, m_producers, m_runManager, m_UIsession, AlCaHLTBitMon_ParallelJobs::p, and edm::ProducerBase::producesCollector().

◆ ~OscarProducer()

OscarProducer::~OscarProducer ( )
override

Definition at line 141 of file OscarProducer.cc.

141 {}

Member Function Documentation

◆ beginRun()

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

Definition at line 143 of file OscarProducer.cc.

143  {
144  // Random number generation not allowed here
145  StaticRandomEngineSetUnset random(nullptr);
146  m_runManager->initG4(es);
147 }

References m_runManager.

◆ endRun()

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

Definition at line 149 of file OscarProducer.cc.

149 { m_runManager->stopG4(); }

References m_runManager.

◆ produce()

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

Implements edm::one::EDProducerBase.

Definition at line 151 of file OscarProducer.cc.

151  {
152  StaticRandomEngineSetUnset random(e.streamID());
153 
154  auto& sTk = m_runManager->sensTkDetectors();
155  auto& sCalo = m_runManager->sensCaloDetectors();
156 
157  try {
158  m_runManager->produce(e, es);
159  } catch (const SimG4Exception& simg4ex) {
160  edm::LogInfo("SimG4CoreApplication") << "SimG4Exception caght! " << simg4ex.what();
161  m_runManager->stopG4();
162 
164  << "SimG4CoreApplication exception in generation of event " << e.id() << " in stream " << e.streamID() << " \n"
165  << simg4ex.what();
166  }
167 
168  std::unique_ptr<edm::SimTrackContainer> p1(new edm::SimTrackContainer);
169  std::unique_ptr<edm::SimVertexContainer> p2(new edm::SimVertexContainer);
170  G4SimEvent* evt = m_runManager->simEvent();
171  evt->load(*p1);
172  evt->load(*p2);
173 
174  e.put(std::move(p1));
175  e.put(std::move(p2));
176 
177  for (auto& tracker : sTk) {
178  const std::vector<std::string>& v = tracker->getNames();
179  for (auto& name : v) {
180  std::unique_ptr<edm::PSimHitContainer> product(new edm::PSimHitContainer);
181  tracker->fillHits(*product, name);
182  e.put(std::move(product), name);
183  }
184  }
185  for (auto& calo : sCalo) {
186  const std::vector<std::string>& v = calo->getNames();
187 
188  for (auto& name : v) {
189  std::unique_ptr<edm::PCaloHitContainer> product(new edm::PCaloHitContainer);
190  calo->fillHits(*product, name);
191  e.put(std::move(product), name);
192  }
193  }
194 
195  for (auto& prod : m_producers) {
196  prod.get()->produce(e, es);
197  }
198 }

References MillePedeFileConverter_cfg::e, edm::errors::EventCorruption, Exception, G4SimEvent::load(), m_producers, m_runManager, eostools::move(), Skims_PA_cff::name, p1, p2, dumpMFGeometry_cfg::prod, PbPb_ZMuSkimMuonDPG_cff::tracker, findQualityFiles::v, and SimG4Exception::what().

Member Data Documentation

◆ m_producers

Producers OscarProducer::m_producers
private

Definition at line 28 of file OscarProducer.h.

Referenced by OscarProducer(), and produce().

◆ m_runManager

std::unique_ptr<RunManager> OscarProducer::m_runManager
private

Definition at line 27 of file OscarProducer.h.

Referenced by beginRun(), endRun(), OscarProducer(), and produce().

◆ m_UIsession

std::unique_ptr<CustomUIsession> OscarProducer::m_UIsession
private

Definition at line 29 of file OscarProducer.h.

Referenced by OscarProducer().

G4SimEvent
Definition: G4SimEvent.h:14
OscarProducer::m_UIsession
std::unique_ptr< CustomUIsession > m_UIsession
Definition: OscarProducer.h:29
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
G4SimEvent::load
void load(edm::SimTrackContainer &c) const
Definition: G4SimEvent.cc:37
SimG4Exception
Definition: SimG4Exception.h:13
edm::errors::EventCorruption
Definition: EDMException.h:43
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:46
edm::SharedResourceNames::kCLHEPRandomEngine
static const std::string kCLHEPRandomEngine
Definition: SharedResourceNames.h:25
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
findQualityFiles.v
v
Definition: findQualityFiles.py:179
dumpMFGeometry_cfg.prod
prod
Definition: dumpMFGeometry_cfg.py:24
p2
double p2[4]
Definition: TauolaWrapper.h:90
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
p1
double p1[4]
Definition: TauolaWrapper.h:89
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::SimTrackContainer
std::vector< SimTrack > SimTrackContainer
Definition: SimTrackContainer.h:12
Exception
Definition: hltDiff.cc:246
edm::SharedResourceNames::kGEANT
static const std::string kGEANT
Definition: SharedResourceNames.h:24
edm::PCaloHitContainer
std::vector< PCaloHit > PCaloHitContainer
Definition: PCaloHitContainer.h:8
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::PSimHitContainer
std::vector< PSimHit > PSimHitContainer
Definition: PSimHitContainer.h:11
calo
Definition: Common.h:9
OscarProducer::m_producers
Producers m_producers
Definition: OscarProducer.h:28
OscarProducer::m_runManager
std::unique_ptr< RunManager > m_runManager
Definition: OscarProducer.h:27
SimG4Exception::what
const char * what() const override
Definition: SimG4Exception.h:17
edm::ProducerBase::producesCollector
ProducesCollector producesCollector()
Definition: ProducerBase.cc:105
edm::SimVertexContainer
std::vector< SimVertex > SimVertexContainer
Definition: SimVertexContainer.h:12
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37