CMS 3D CMS Logo

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

#include <GeometryProducer.h>

Inheritance diagram for GeometryProducer:
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 beginLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &)
 
void beginRun (const edm::Run &r, const edm::EventSetup &c) override
 
void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
 GeometryProducer (edm::ParameterSet const &p)
 
void produce (edm::Event &e, const edm::EventSetup &c) override
 
std::vector< std::shared_ptr< SimProducer > > producers () const
 
std::vector< SensitiveCaloDetector * > & sensCaloDetectors ()
 
std::vector< SensitiveTkDetector * > & sensTkDetectors ()
 
 ~GeometryProducer () 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 hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () 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
 
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 updateMagneticField (edm::EventSetup const &es)
 

Private Attributes

AttachSDm_attach
 
std::unique_ptr< sim::FieldBuilderm_fieldBuilder
 
bool m_firstRun
 
G4RunManagerKernel * m_kernel
 
edm::ParameterSet m_p
 
edm::ParameterSet m_pField
 
std::vector< std::shared_ptr< SimProducer > > m_producers
 
bool m_pUseMagneticField
 
bool m_pUseSensitiveDetectors
 
SimActivityRegistry m_registry
 
std::vector< SensitiveCaloDetector * > m_sensCaloDets
 
std::vector< SensitiveTkDetector * > m_sensTkDets
 
std::unique_ptr< SimTrackManagerm_trackManager
 
std::vector< std::shared_ptr< SimWatcher > > m_watchers
 

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>
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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 GeometryProducer.h.

Member Typedef Documentation

◆ Producers

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

Definition at line 32 of file GeometryProducer.h.

Constructor & Destructor Documentation

◆ GeometryProducer()

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

Definition at line 60 of file GeometryProducer.cc.

61  : m_kernel(nullptr),
62  m_pUseMagneticField(p.getParameter<bool>("UseMagneticField")),
63  m_pField(p.getParameter<edm::ParameterSet>("MagneticField")),
64  m_pUseSensitiveDetectors(p.getParameter<bool>("UseSensitiveDetectors")),
65  m_attach(nullptr),
66  m_p(p),
67  m_firstRun(true) {
68  // Look for an outside SimActivityRegistry
69  // this is used by the visualization code
71  if (otherRegistry)
72  m_registry.connect(*otherRegistry);
74  produces<int>();
75 }

References SimActivityRegistry::connect(), createWatchers(), m_p, m_producers, m_registry, and m_watchers.

◆ ~GeometryProducer()

GeometryProducer::~GeometryProducer ( )
override

Definition at line 77 of file GeometryProducer.cc.

77  {
78  delete m_attach;
79  delete m_kernel;
80 }

References m_attach, and m_kernel.

Member Function Documentation

◆ beginLuminosityBlock()

void GeometryProducer::beginLuminosityBlock ( edm::LuminosityBlock ,
edm::EventSetup const &   
)

Definition at line 99 of file GeometryProducer.cc.

99  {
100  // mag field cannot be change in new lumi section - this is commented out
101  // updateMagneticField( es );
102 }

◆ beginRun()

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

Definition at line 104 of file GeometryProducer.cc.

104 { updateMagneticField(es); }

References updateMagneticField().

◆ endRun()

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

Definition at line 106 of file GeometryProducer.cc.

106 {}

◆ produce()

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

Implements edm::one::EDProducerBase.

Definition at line 108 of file GeometryProducer.cc.

108  {
109  if (!m_firstRun)
110  return;
111  m_firstRun = false;
112 
113  edm::LogInfo("GeometryProducer") << "Producing G4 Geom";
114 
115  m_kernel = G4RunManagerKernel::GetRunManagerKernel();
116  if (m_kernel == nullptr)
117  m_kernel = new G4RunManagerKernel();
118  edm::LogInfo("GeometryProducer") << " GeometryProducer initializing ";
119  // DDDWorld: get the DDCV from the ES and use it to build the World
121  es.get<IdealGeometryRecord>().get(pDD);
122 
124  SensitiveDetectorCatalog catalog_;
125  const DDDWorld *world = new DDDWorld(&(*pDD), map_, catalog_, false);
127 
129 
131  edm::LogInfo("GeometryProducer") << " instantiating sensitive detectors ";
132  // instantiate and attach the sensitive detectors
133  m_trackManager = std::unique_ptr<SimTrackManager>(new SimTrackManager);
134  if (m_attach == nullptr)
135  m_attach = new AttachSD;
136  {
137  std::pair<std::vector<SensitiveTkDetector *>, std::vector<SensitiveCaloDetector *>> sensDets =
138  m_attach->create(es, catalog_, m_p, m_trackManager.get(), m_registry);
139 
140  m_sensTkDets.swap(sensDets.first);
141  m_sensCaloDets.swap(sensDets.second);
142  }
143 
144  edm::LogInfo("GeometryProducer") << " Sensitive Detector building finished; found " << m_sensTkDets.size()
145  << " Tk type Producers, and " << m_sensCaloDets.size() << " Calo type producers ";
146  }
147 
148  for (Producers::iterator itProd = m_producers.begin(); itProd != m_producers.end(); ++itProd) {
149  (*itProd)->produce(e, es);
150  }
151 }

References AttachSD::create(), SimActivityRegistry::dddWorldSignal_, MillePedeFileConverter_cfg::e, edm::EventSetup::get(), get, m_attach, m_firstRun, m_kernel, m_p, m_producers, m_pUseSensitiveDetectors, m_registry, m_sensCaloDets, m_sensTkDets, m_trackManager, and updateMagneticField().

◆ producers()

std::vector<std::shared_ptr<SimProducer> > GeometryProducer::producers ( ) const
inline

Definition at line 41 of file GeometryProducer.h.

41 { return m_producers; }

References m_producers.

◆ sensCaloDetectors()

std::vector<SensitiveCaloDetector *>& GeometryProducer::sensCaloDetectors ( )
inline

Definition at line 43 of file GeometryProducer.h.

43 { return m_sensCaloDets; }

References m_sensCaloDets.

◆ sensTkDetectors()

std::vector<SensitiveTkDetector *>& GeometryProducer::sensTkDetectors ( )
inline

Definition at line 42 of file GeometryProducer.h.

42 { return m_sensTkDets; }

References m_sensTkDets.

◆ updateMagneticField()

void GeometryProducer::updateMagneticField ( edm::EventSetup const &  es)
private

Definition at line 82 of file GeometryProducer.cc.

82  {
83  if (m_pUseMagneticField) {
84  // setup the magnetic field
86  es.get<IdealMagneticFieldRecord>().get(pMF);
87  const GlobalPoint g(0., 0., 0.);
88  edm::LogInfo("GeometryProducer") << "B-field(T) at (0,0,0)(cm): " << pMF->inTesla(g);
89 
90  sim::FieldBuilder fieldBuilder(pMF.product(), m_pField);
91  CMSFieldManager *fieldManager = new CMSFieldManager();
92  G4TransportationManager *tM = G4TransportationManager::GetTransportationManager();
93  tM->SetFieldManager(fieldManager);
94  fieldBuilder.build(fieldManager, tM->GetPropagatorInField());
95  edm::LogInfo("GeometryProducer") << "Magentic field is built";
96  }
97 }

References g, edm::EventSetup::get(), get, MagneticField::inTesla(), m_pField, m_pUseMagneticField, and edm::ESHandle< T >::product().

Referenced by beginRun(), and produce().

Member Data Documentation

◆ m_attach

AttachSD* GeometryProducer::m_attach
private

Definition at line 57 of file GeometryProducer.h.

Referenced by produce(), and ~GeometryProducer().

◆ m_fieldBuilder

std::unique_ptr<sim::FieldBuilder> GeometryProducer::m_fieldBuilder
private

Definition at line 55 of file GeometryProducer.h.

◆ m_firstRun

bool GeometryProducer::m_firstRun
private

Definition at line 61 of file GeometryProducer.h.

Referenced by produce().

◆ m_kernel

G4RunManagerKernel* GeometryProducer::m_kernel
private

Definition at line 48 of file GeometryProducer.h.

Referenced by produce(), and ~GeometryProducer().

◆ m_p

edm::ParameterSet GeometryProducer::m_p
private

Definition at line 60 of file GeometryProducer.h.

Referenced by GeometryProducer(), and produce().

◆ m_pField

edm::ParameterSet GeometryProducer::m_pField
private

Definition at line 50 of file GeometryProducer.h.

Referenced by updateMagneticField().

◆ m_producers

std::vector<std::shared_ptr<SimProducer> > GeometryProducer::m_producers
private

Definition at line 54 of file GeometryProducer.h.

Referenced by GeometryProducer(), produce(), and producers().

◆ m_pUseMagneticField

bool GeometryProducer::m_pUseMagneticField
private

Definition at line 49 of file GeometryProducer.h.

Referenced by updateMagneticField().

◆ m_pUseSensitiveDetectors

bool GeometryProducer::m_pUseSensitiveDetectors
private

Definition at line 51 of file GeometryProducer.h.

Referenced by produce().

◆ m_registry

SimActivityRegistry GeometryProducer::m_registry
private

Definition at line 52 of file GeometryProducer.h.

Referenced by GeometryProducer(), and produce().

◆ m_sensCaloDets

std::vector<SensitiveCaloDetector *> GeometryProducer::m_sensCaloDets
private

Definition at line 59 of file GeometryProducer.h.

Referenced by produce(), and sensCaloDetectors().

◆ m_sensTkDets

std::vector<SensitiveTkDetector *> GeometryProducer::m_sensTkDets
private

Definition at line 58 of file GeometryProducer.h.

Referenced by produce(), and sensTkDetectors().

◆ m_trackManager

std::unique_ptr<SimTrackManager> GeometryProducer::m_trackManager
private

Definition at line 56 of file GeometryProducer.h.

Referenced by produce().

◆ m_watchers

std::vector<std::shared_ptr<SimWatcher> > GeometryProducer::m_watchers
private

Definition at line 53 of file GeometryProducer.h.

Referenced by GeometryProducer().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
SimTrackManager
Definition: SimTrackManager.h:35
MagneticField::inTesla
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
GeometryProducer::m_p
edm::ParameterSet m_p
Definition: GeometryProducer.h:60
GeometryProducer::m_pUseSensitiveDetectors
bool m_pUseSensitiveDetectors
Definition: GeometryProducer.h:51
GeometryProducer::m_sensCaloDets
std::vector< SensitiveCaloDetector * > m_sensCaloDets
Definition: GeometryProducer.h:59
DDDWorld
Definition: DDDWorld.h:14
DDMapper< G4LogicalVolume *, DDLogicalPart >
GeometryProducer::m_registry
SimActivityRegistry m_registry
Definition: GeometryProducer.h:52
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::LogInfo
Definition: MessageLogger.h:254
CMSFieldManager
Definition: CMSFieldManager.h:24
SimActivityRegistry::dddWorldSignal_
DDDWorldSignal dddWorldSignal_
Definition: SimActivityRegistry.h:54
AttachSD::create
std::pair< std::vector< SensitiveTkDetector * >, std::vector< SensitiveCaloDetector * > > create(const edm::EventSetup &, const SensitiveDetectorCatalog &, edm::ParameterSet const &, const SimTrackManager *, SimActivityRegistry &reg) const
Definition: AttachSD.cc:15
IdealMagneticFieldRecord
Definition: IdealMagneticFieldRecord.h:11
edm::ESHandle< MagneticField >
GeometryProducer::m_attach
AttachSD * m_attach
Definition: GeometryProducer.h:57
SensitiveDetectorCatalog
Definition: SensitiveDetectorCatalog.h:10
Point3DBase< float, GlobalTag >
GeometryProducer::updateMagneticField
void updateMagneticField(edm::EventSetup const &es)
Definition: GeometryProducer.cc:82
edm::ParameterSet
Definition: ParameterSet.h:36
edm::Service
Definition: Service.h:30
GeometryProducer::m_kernel
G4RunManagerKernel * m_kernel
Definition: GeometryProducer.h:48
GeometryProducer::m_sensTkDets
std::vector< SensitiveTkDetector * > m_sensTkDets
Definition: GeometryProducer.h:58
createWatchers
static void createWatchers(const edm::ParameterSet &iP, SimActivityRegistry &iReg, std::vector< std::shared_ptr< SimWatcher >> &oWatchers, std::vector< std::shared_ptr< SimProducer >> &oProds)
Definition: GeometryProducer.cc:32
get
#define get
edm::ESTransientHandle
Definition: ESTransientHandle.h:41
GeometryProducer::m_producers
std::vector< std::shared_ptr< SimProducer > > m_producers
Definition: GeometryProducer.h:54
GeometryProducer::m_firstRun
bool m_firstRun
Definition: GeometryProducer.h:61
SimActivityRegistry::connect
void connect(Observer< const BeginOfJob * > *iObject)
Definition: SimActivityRegistry.h:51
AttachSD
Definition: AttachSD.h:17
GeometryProducer::m_watchers
std::vector< std::shared_ptr< SimWatcher > > m_watchers
Definition: GeometryProducer.h:53
GeometryProducer::m_trackManager
std::unique_ptr< SimTrackManager > m_trackManager
Definition: GeometryProducer.h:56
GeometryProducer::m_pUseMagneticField
bool m_pUseMagneticField
Definition: GeometryProducer.h:49
IdealGeometryRecord
Definition: IdealGeometryRecord.h:27
g
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
sim::FieldBuilder
Definition: FieldBuilder.h:15
GeometryProducer::m_pField
edm::ParameterSet m_pField
Definition: GeometryProducer.h:50