CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 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
 
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)
 
 ~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
 
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::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
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices 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,
IdealMagneticFieldRecord
m_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
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
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 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)
 
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 ( 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 }
T getUntrackedParameter(std::string const &, T const &) const
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
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 ( void  )
override

Definition at line 55 of file MFProducer.cc.

55 {}

Member Function Documentation

void MFProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 84 of file MFProducer.cc.

84 {}
void MFProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 86 of file MFProducer.cc.

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

Definition at line 76 of file MFProducer.cc.

References b, m_mf, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

76  {
77  GlobalVector b = m_mf->inTesla(GlobalPoint(point[0], point[1], point[2]));
78 
79  field[0] = b.x();
80  field[1] = b.y();
81  field[2] = b.z();
82 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:60
T z() const
Definition: PV3DBase.h:61
edm::ESHandle< MagneticField > m_mf
Definition: MFProducer.cc:36
double b
Definition: hdecay.h:118
T x() const
Definition: PV3DBase.h:59
*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
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, hgcalPerformanceValidation::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
edm::ESHandle< MagneticField > m_mf
Definition: MFProducer.cc:36
tuple cout
Definition: gather_cfg.py:144
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
bool isValid() const
Definition: ESHandle.h:44
double m_yBaseDir
Definition: MFProducer.cc:32
double m_minY
Definition: MFProducer.cc:27

Member Data Documentation

unsigned MFProducer::m_mapDensityX
private

Definition at line 22 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

unsigned MFProducer::m_mapDensityY
private

Definition at line 23 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

unsigned MFProducer::m_mapDensityZ
private

Definition at line 24 of file MFProducer.cc.

Referenced by MFProducer().

double MFProducer::m_maxX
private

Definition at line 26 of file MFProducer.cc.

Referenced by MFProducer().

double MFProducer::m_maxY
private

Definition at line 28 of file MFProducer.cc.

Referenced by MFProducer().

double MFProducer::m_maxZ
private

Definition at line 30 of file MFProducer.cc.

Referenced by MFProducer().

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

Definition at line 36 of file MFProducer.cc.

Referenced by evaluate(), and produce().

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

Definition at line 35 of file MFProducer.cc.

Referenced by produce().

double MFProducer::m_minX
private

Definition at line 25 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

double MFProducer::m_minY
private

Definition at line 27 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

double MFProducer::m_minZ
private

Definition at line 29 of file MFProducer.cc.

Referenced by MFProducer().

bool MFProducer::m_valid
private

Definition at line 34 of file MFProducer.cc.

Referenced by produce().

double MFProducer::m_xBaseDir
private

Definition at line 31 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

double MFProducer::m_yBaseDir
private

Definition at line 32 of file MFProducer.cc.

Referenced by MFProducer(), and produce().

double MFProducer::m_zBaseDir
private

Definition at line 33 of file MFProducer.cc.

Referenced by MFProducer().