CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
MFProducer Class Reference
Inheritance diagram for MFProducer:
edm::one::EDProducer<> edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 MFProducer (const edm::ParameterSet &)
 
 ~MFProducer (void) override
 
- Public Member Functions inherited from edm::one::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
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
 
const EDProduceroperator= (const EDProducer &)=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::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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 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 beginJob (void) override
 
void endJob (void) override
 
void evaluate (const double point[3], double field[3]) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

unsigned m_mapDensityX
 
unsigned m_mapDensityY
 
unsigned m_mapDensityZ
 
double m_maxX
 
double m_maxY
 
double m_maxZ
 
edm::ESHandle< MagneticFieldm_mf
 
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecordm_mfToken
 
double m_minX
 
double m_minY
 
double m_minZ
 
bool m_valid
 
double m_xBaseDir
 
double m_yBaseDir
 
double m_zBaseDir
 

Additional Inherited Members

- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- 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 12 of file MFProducer.cc.

Constructor & Destructor Documentation

◆ MFProducer()

MFProducer::MFProducer ( const edm::ParameterSet iPset)
explicit

Definition at line 39 of file MFProducer.cc.

References edm::ParameterSet::getUntrackedParameter(), m_mapDensityX, m_mapDensityY, m_mapDensityZ, m_maxX, m_maxY, m_maxZ, m_minX, m_minY, m_minZ, m_xBaseDir, m_yBaseDir, and m_zBaseDir.

39  : m_valid(false), m_mfToken(esConsumes()) {
40  m_mapDensityX = iPset.getUntrackedParameter<unsigned>("mapDensityX", 10);
41  m_mapDensityY = iPset.getUntrackedParameter<unsigned>("mapDensityY", 10);
42  m_mapDensityZ = iPset.getUntrackedParameter<unsigned>("mapDensityY", 10);
43  m_minX = iPset.getUntrackedParameter<double>("minX", -18.0);
44  m_maxX = iPset.getUntrackedParameter<double>("maxX", 18.0);
45  m_minY = iPset.getUntrackedParameter<double>("minY", -18.0);
46  m_maxY = iPset.getUntrackedParameter<double>("maxY", 18.0);
47  m_minZ = iPset.getUntrackedParameter<double>("minZ", -18.0);
48  m_maxZ = iPset.getUntrackedParameter<double>("maxZ", 18.0);
49 
53 }
unsigned m_mapDensityZ
Definition: MFProducer.cc:24
double m_minX
Definition: MFProducer.cc:25
double m_minZ
Definition: MFProducer.cc:29
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_mfToken
Definition: MFProducer.cc:35
unsigned m_mapDensityY
Definition: MFProducer.cc:23
unsigned m_mapDensityX
Definition: MFProducer.cc:22
double m_maxX
Definition: MFProducer.cc:26
bool m_valid
Definition: MFProducer.cc:34
double m_xBaseDir
Definition: MFProducer.cc:31
double m_maxZ
Definition: MFProducer.cc:30
T getUntrackedParameter(std::string const &, T const &) const
double m_maxY
Definition: MFProducer.cc:28
double m_zBaseDir
Definition: MFProducer.cc:33
double m_yBaseDir
Definition: MFProducer.cc:32
double m_minY
Definition: MFProducer.cc:27

◆ ~MFProducer()

MFProducer::~MFProducer ( void  )
override

Definition at line 55 of file MFProducer.cc.

55 {}

Member Function Documentation

◆ beginJob()

void MFProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 84 of file MFProducer.cc.

84 {}

◆ endJob()

void MFProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 86 of file MFProducer.cc.

86 {}

◆ evaluate()

void MFProducer::evaluate ( const double  point[3],
double  field[3] 
) const
private

Definition at line 76 of file MFProducer.cc.

References b, MagneticField::inTesla(), m_mf, and point.

Referenced by produce().

76  {
78 
79  field[0] = b.x();
80  field[1] = b.y();
81  field[2] = b.z();
82 }
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
edm::ESHandle< MagneticField > m_mf
Definition: MFProducer.cc:36
double b
Definition: hdecay.h:120
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

◆ produce()

void MFProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 57 of file MFProducer.cc.

References gather_cfg::cout, evaluate(), edm::EventSetup::getHandle(), mps_fire::i, edm::ESHandleBase::isValid(), dqmiolumiharvest::j, m_mapDensityX, m_mapDensityY, m_mf, m_mfToken, m_minX, m_minY, m_valid, m_xBaseDir, m_yBaseDir, DiDispStaMuonMonitor_cfi::pt, funct::true, heppy_batch::val, x, y, and z.

57  {
58  m_mf = iSetup.getHandle(m_mfToken);
59  m_mf.isValid() ? m_valid = true : m_valid = false;
60 
61  for (unsigned i = 0; i <= m_mapDensityX; ++i) {
62  for (unsigned j = 0; j <= m_mapDensityY; ++j) {
63  // Prepare field position and get value.
64  double x = m_minX + m_xBaseDir * i;
65  double y = m_minY + m_yBaseDir * j;
66  double z = 0.;
67  double pt[3] = {x, y, z};
68  double val[3];
69  evaluate(pt, val);
70  std::cout << "(" << x << ", " << y << ", " << z << ") " << val[0] << ":" << val[1] << ":" << val[2] << "; ";
71  }
72  std::cout << std::endl;
73  }
74 }
double m_minX
Definition: MFProducer.cc:25
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > m_mfToken
Definition: MFProducer.cc:35
unsigned m_mapDensityY
Definition: MFProducer.cc:23
unsigned m_mapDensityX
Definition: MFProducer.cc:22
bool m_valid
Definition: MFProducer.cc:34
double m_xBaseDir
Definition: MFProducer.cc:31
void evaluate(const double point[3], double field[3]) const
Definition: MFProducer.cc:76
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:130
bool isValid() const
Definition: ESHandle.h:44
edm::ESHandle< MagneticField > m_mf
Definition: MFProducer.cc:36
double m_yBaseDir
Definition: MFProducer.cc:32
double m_minY
Definition: MFProducer.cc:27

Member Data Documentation

◆ m_mapDensityX

unsigned MFProducer::m_mapDensityX
private

Definition at line 22 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

◆ m_mapDensityY

unsigned MFProducer::m_mapDensityY
private

Definition at line 23 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

◆ m_mapDensityZ

unsigned MFProducer::m_mapDensityZ
private

Definition at line 24 of file MFProducer.cc.

Referenced by MFProducer().

◆ m_maxX

double MFProducer::m_maxX
private

Definition at line 26 of file MFProducer.cc.

Referenced by MFProducer().

◆ m_maxY

double MFProducer::m_maxY
private

Definition at line 28 of file MFProducer.cc.

Referenced by MFProducer().

◆ m_maxZ

double MFProducer::m_maxZ
private

Definition at line 30 of file MFProducer.cc.

Referenced by MFProducer().

◆ m_mf

edm::ESHandle<MagneticField> MFProducer::m_mf
private

Definition at line 36 of file MFProducer.cc.

Referenced by evaluate(), and produce().

◆ m_mfToken

const edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> MFProducer::m_mfToken
private

Definition at line 35 of file MFProducer.cc.

Referenced by produce().

◆ m_minX

double MFProducer::m_minX
private

Definition at line 25 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

◆ m_minY

double MFProducer::m_minY
private

Definition at line 27 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

◆ m_minZ

double MFProducer::m_minZ
private

Definition at line 29 of file MFProducer.cc.

Referenced by MFProducer().

◆ m_valid

bool MFProducer::m_valid
private

Definition at line 34 of file MFProducer.cc.

Referenced by produce().

◆ m_xBaseDir

double MFProducer::m_xBaseDir
private

Definition at line 31 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

◆ m_yBaseDir

double MFProducer::m_yBaseDir
private

Definition at line 32 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

◆ m_zBaseDir

double MFProducer::m_zBaseDir
private

Definition at line 33 of file MFProducer.cc.

Referenced by MFProducer().