test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

void beginLuminosityBlock (edm::LuminosityBlock &, edm::EventSetup const &)
 
virtual void beginRun (const edm::Run &r, const edm::EventSetup &c) override
 
virtual void endRun (const edm::Run &r, const edm::EventSetup &c) override
 
 GeometryProducer (edm::ParameterSet const &p)
 
virtual 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 ()
 
virtual ~GeometryProducer () override
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::SharedResources, edm::one::WatchRuns >
 EDProducer ()=default
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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 & 
itemsToGetFromEvent () 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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void updateMagneticField (edm::EventSetup const &es)
 

Private Attributes

AttachSDm_attach
 
std::auto_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::auto_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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

Detailed Description

Definition at line 28 of file GeometryProducer.h.

Member Typedef Documentation

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

Definition at line 31 of file GeometryProducer.h.

Constructor & Destructor Documentation

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

Definition at line 60 of file GeometryProducer.cc.

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

60  :
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), m_p(p), m_firstRun ( true )
66 {
67  //Look for an outside SimActivityRegistry
68  //this is used by the visualization code
70  if (otherRegistry) m_registry.connect(*otherRegistry);
72  produces<int>();
73 }
void connect(Observer< const BeginOfJob * > *iObject)
edm::ParameterSet m_pField
std::vector< std::shared_ptr< SimWatcher > > m_watchers
G4RunManagerKernel * m_kernel
static void createWatchers(const edm::ParameterSet &iP, SimActivityRegistry &iReg, std::vector< std::shared_ptr< SimWatcher > > &oWatchers, std::vector< std::shared_ptr< SimProducer > > &oProds)
std::vector< std::shared_ptr< SimProducer > > m_producers
SimActivityRegistry m_registry
edm::ParameterSet m_p
GeometryProducer::~GeometryProducer ( )
overridevirtual

Definition at line 75 of file GeometryProducer.cc.

References m_attach, and m_kernel.

76 {
77  delete m_attach;
78  delete m_kernel;
79 }
G4RunManagerKernel * m_kernel

Member Function Documentation

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

Definition at line 100 of file GeometryProducer.cc.

References updateMagneticField().

100  {
101  // mag field can change in new lumi section
102  updateMagneticField( es );
103 }
void updateMagneticField(edm::EventSetup const &es)
void GeometryProducer::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

Definition at line 105 of file GeometryProducer.cc.

106 {}
void GeometryProducer::endRun ( const edm::Run r,
const edm::EventSetup c 
)
overridevirtual

Definition at line 108 of file GeometryProducer.cc.

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

Implements edm::one::EDProducerBase.

Definition at line 111 of file GeometryProducer.cc.

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

112 {
113  if ( !m_firstRun ) return;
114  m_firstRun = false;
115 
116  edm::LogInfo("GeometryProducer") << "Producing G4 Geom";
117 
118  m_kernel = G4RunManagerKernel::GetRunManagerKernel();
119  if (m_kernel==0) m_kernel = new G4RunManagerKernel();
120  edm::LogInfo("GeometryProducer") << " GeometryProducer initializing ";
121  // DDDWorld: get the DDCV from the ES and use it to build the World
123  es.get<IdealGeometryRecord>().get(pDD);
124 
126  SensitiveDetectorCatalog catalog_;
127  const DDDWorld * world = new DDDWorld(&(*pDD), map_, catalog_, false);
129 
130  updateMagneticField( es );
131 
133  {
134  edm::LogInfo("GeometryProducer") << " instantiating sensitive detectors ";
135  // instantiate and attach the sensitive detectors
136  m_trackManager = std::auto_ptr<SimTrackManager>(new SimTrackManager);
137  if (m_attach==0) m_attach = new AttachSD;
138  {
139  std::pair< std::vector<SensitiveTkDetector*>,
140  std::vector<SensitiveCaloDetector*> >
141  sensDets = m_attach->create(*world,(*pDD),catalog_,m_p,m_trackManager.get(),m_registry);
142 
143  m_sensTkDets.swap(sensDets.first);
144  m_sensCaloDets.swap(sensDets.second);
145  }
146 
147  edm::LogInfo("GeometryProducer") << " Sensitive Detector building finished; found "
148  << m_sensTkDets.size()
149  << " Tk type Producers, and " << m_sensCaloDets.size()
150  << " Calo type producers ";
151  }
152 
153  for(Producers::iterator itProd = m_producers.begin();itProd != m_producers.end();
154  ++itProd) {
155  (*itProd)->produce(e,es);
156  }
157 }
Map map_
std::auto_ptr< SimTrackManager > m_trackManager
G4RunManagerKernel * m_kernel
std::vector< std::shared_ptr< SimProducer > > m_producers
SimActivityRegistry m_registry
void updateMagneticField(edm::EventSetup const &es)
std::vector< SensitiveTkDetector * > m_sensTkDets
DDDWorldSignal dddWorldSignal_
std::pair< std::vector< SensitiveTkDetector * >, std::vector< SensitiveCaloDetector * > > create(const DDDWorld &w, const DDCompactView &cpv, const SensitiveDetectorCatalog &clg, edm::ParameterSet const &p, const SimTrackManager *m, SimActivityRegistry &reg) const
Definition: AttachSD.cc:23
edm::ParameterSet m_p
std::vector< SensitiveCaloDetector * > m_sensCaloDets
std::vector<std::shared_ptr<SimProducer> > GeometryProducer::producers ( ) const
inline

Definition at line 40 of file GeometryProducer.h.

References m_producers.

41  { return m_producers; }
std::vector< std::shared_ptr< SimProducer > > m_producers
std::vector<SensitiveCaloDetector*>& GeometryProducer::sensCaloDetectors ( )
inline

Definition at line 43 of file GeometryProducer.h.

References m_sensCaloDets.

43 { return m_sensCaloDets; }
std::vector< SensitiveCaloDetector * > m_sensCaloDets
std::vector<SensitiveTkDetector*>& GeometryProducer::sensTkDetectors ( )
inline

Definition at line 42 of file GeometryProducer.h.

References m_sensTkDets.

42 { return m_sensTkDets; }
std::vector< SensitiveTkDetector * > m_sensTkDets
void GeometryProducer::updateMagneticField ( edm::EventSetup const &  es)
private

Definition at line 81 of file GeometryProducer.cc.

References g, edm::EventSetup::get(), m_fieldBuilder, m_pField, and m_pUseMagneticField.

Referenced by beginLuminosityBlock(), and produce().

81  {
83  {
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  m_fieldBuilder = std::auto_ptr<sim::FieldBuilder>(new sim::FieldBuilder(&(*pMF), m_pField));
91 
92  G4TransportationManager * tM = G4TransportationManager::GetTransportationManager();
93  // update field here ...
94  m_fieldBuilder->build( tM->GetFieldManager(),tM->GetPropagatorInField());
95 
96  edm::LogInfo("GeometryProducer") << "Magentic field updated";
97  }
98 }
edm::ParameterSet m_pField
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
std::auto_ptr< sim::FieldBuilder > m_fieldBuilder

Member Data Documentation

AttachSD* GeometryProducer::m_attach
private

Definition at line 58 of file GeometryProducer.h.

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

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

Definition at line 56 of file GeometryProducer.h.

Referenced by updateMagneticField().

bool GeometryProducer::m_firstRun
private

Definition at line 62 of file GeometryProducer.h.

Referenced by produce().

G4RunManagerKernel* GeometryProducer::m_kernel
private

Definition at line 49 of file GeometryProducer.h.

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

edm::ParameterSet GeometryProducer::m_p
private

Definition at line 61 of file GeometryProducer.h.

Referenced by GeometryProducer(), and produce().

edm::ParameterSet GeometryProducer::m_pField
private

Definition at line 51 of file GeometryProducer.h.

Referenced by updateMagneticField().

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

Definition at line 55 of file GeometryProducer.h.

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

bool GeometryProducer::m_pUseMagneticField
private

Definition at line 50 of file GeometryProducer.h.

Referenced by updateMagneticField().

bool GeometryProducer::m_pUseSensitiveDetectors
private

Definition at line 52 of file GeometryProducer.h.

Referenced by produce().

SimActivityRegistry GeometryProducer::m_registry
private

Definition at line 53 of file GeometryProducer.h.

Referenced by GeometryProducer(), and produce().

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

Definition at line 60 of file GeometryProducer.h.

Referenced by produce(), and sensCaloDetectors().

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

Definition at line 59 of file GeometryProducer.h.

Referenced by produce(), and sensTkDetectors().

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

Definition at line 57 of file GeometryProducer.h.

Referenced by produce().

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

Definition at line 54 of file GeometryProducer.h.

Referenced by GeometryProducer().