Fireworks
Geometry
plugins
MFProducer.cc
Go to the documentation of this file.
1
#include "
FWCore/Framework/interface/Frameworkfwd.h
"
2
#include "
FWCore/Framework/interface/EDProducer.h
"
3
#include "
FWCore/Framework/interface/ESHandle.h
"
4
#include "
FWCore/Framework/interface/MakerMacros.h
"
5
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
6
#include "
DataFormats/GeometryVector/interface/GlobalPoint.h
"
7
#include "
DataFormats/GeometryVector/interface/GlobalVector.h
"
8
#include "
MagneticField/Records/interface/IdealMagneticFieldRecord.h
"
9
#include "
MagneticField/Engine/interface/MagneticField.h
"
10
#include <iostream>
11
12
class
MFProducer
:
public
edm::EDProducer
{
13
public
:
14
explicit
MFProducer
(
const
edm::ParameterSet
&);
15
~MFProducer
(
void
)
override
;
16
17
private
:
18
void
beginJob
(
void
)
override
;
19
void
produce
(
edm::Event
&,
const
edm::EventSetup
&)
override
;
20
void
endJob
(
void
)
override
;
21
void
evaluate
(
const
double
point
[3],
double
field[3])
const
;
22
unsigned
m_mapDensityX
;
23
unsigned
m_mapDensityY
;
24
unsigned
m_mapDensityZ
;
25
double
m_minX
;
26
double
m_maxX
;
27
double
m_minY
;
28
double
m_maxY
;
29
double
m_minZ
;
30
double
m_maxZ
;
31
double
m_xBaseDir
;
32
double
m_yBaseDir
;
33
double
m_zBaseDir
;
34
bool
m_valid
;
35
edm::ESHandle<MagneticField>
m_mf
;
36
};
37
38
MFProducer::MFProducer
(
const
edm::ParameterSet
& iPset) : m_valid(
false
) {
39
m_mapDensityX
= iPset.
getUntrackedParameter
<
unsigned
>(
"mapDensityX"
, 10);
40
m_mapDensityY
= iPset.
getUntrackedParameter
<
unsigned
>(
"mapDensityY"
, 10);
41
m_mapDensityZ
= iPset.
getUntrackedParameter
<
unsigned
>(
"mapDensityY"
, 10);
42
m_minX
= iPset.
getUntrackedParameter
<
double
>(
"minX"
, -18.0);
43
m_maxX
= iPset.
getUntrackedParameter
<
double
>(
"maxX"
, 18.0);
44
m_minY
= iPset.
getUntrackedParameter
<
double
>(
"minY"
, -18.0);
45
m_maxY
= iPset.
getUntrackedParameter
<
double
>(
"maxY"
, 18.0);
46
m_minZ
= iPset.
getUntrackedParameter
<
double
>(
"minZ"
, -18.0);
47
m_maxZ
= iPset.
getUntrackedParameter
<
double
>(
"maxZ"
, 18.0);
48
49
m_xBaseDir
= (
m_maxX
-
m_minX
) /
m_mapDensityX
;
50
m_yBaseDir
= (
m_maxY
-
m_minY
) /
m_mapDensityY
;
51
m_zBaseDir
= (
m_maxZ
-
m_minZ
) /
m_mapDensityZ
;
52
}
53
54
MFProducer::~MFProducer
(
void
) {}
55
56
void
MFProducer::produce
(
edm::Event
&
iEvent
,
const
edm::EventSetup
& iSetup) {
57
iSetup.
get
<
IdealMagneticFieldRecord
>().
get
(
m_mf
);
58
m_mf
.
isValid
() ?
m_valid
=
true
:
m_valid
=
false
;
59
60
for
(
unsigned
i
= 0;
i
<=
m_mapDensityX
; ++
i
) {
61
for
(
unsigned
j
= 0;
j
<=
m_mapDensityY
; ++
j
) {
62
// Prepare field position and get value.
63
double
x
=
m_minX
+
m_xBaseDir
*
i
;
64
double
y
=
m_minY
+
m_yBaseDir
*
j
;
65
double
z
= 0.;
66
double
pt
[3] = {
x
,
y
,
z
};
67
double
val
[3];
68
evaluate
(
pt
,
val
);
69
std::cout
<<
"("
<<
x
<<
", "
<<
y
<<
", "
<<
z
<<
") "
<<
val
[0] <<
":"
<<
val
[1] <<
":"
<<
val
[2] <<
"; "
;
70
}
71
std::cout
<< std::endl;
72
}
73
}
74
75
void
MFProducer::evaluate
(
const
double
point
[3],
double
field[3])
const
{
76
GlobalVector
b
=
m_mf
->
inTesla
(
GlobalPoint
(
point
[0],
point
[1],
point
[2]));
77
78
field[0] =
b
.x();
79
field[1] =
b
.y();
80
field[2] =
b
.z();
81
}
82
83
void
MFProducer::beginJob
(
void
) {}
84
85
void
MFProducer::endJob
(
void
) {}
86
87
DEFINE_FWK_MODULE
(
MFProducer
);
Vector3DBase
Definition:
Vector3DBase.h:8
DDAxes::y
MagneticField::inTesla
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
mps_fire.i
i
Definition:
mps_fire.py:428
funct::false
false
Definition:
Factorize.h:29
EDProducer.h
ESHandle.h
MFProducer::m_minZ
double m_minZ
Definition:
MFProducer.cc:29
DiDispStaMuonMonitor_cfi.pt
pt
Definition:
DiDispStaMuonMonitor_cfi.py:39
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
MFProducer::m_mapDensityY
unsigned m_mapDensityY
Definition:
MFProducer.cc:23
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
DDAxes::x
MFProducer::m_valid
bool m_valid
Definition:
MFProducer.cc:34
IdealMagneticFieldRecord
Definition:
IdealMagneticFieldRecord.h:11
MakerMacros.h
edm::EventSetup::get
T get() const
Definition:
EventSetup.h:80
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition:
MakerMacros.h:16
MFProducer::m_mapDensityZ
unsigned m_mapDensityZ
Definition:
MFProducer.cc:24
DDAxes::z
IdealMagneticFieldRecord.h
edm::ESHandle< MagneticField >
MFProducer::m_minY
double m_minY
Definition:
MFProducer.cc:27
GlobalPoint
Global3DPoint GlobalPoint
Definition:
GlobalPoint.h:10
MFProducer::m_zBaseDir
double m_zBaseDir
Definition:
MFProducer.cc:33
MFProducer::m_maxX
double m_maxX
Definition:
MFProducer.cc:26
b
double b
Definition:
hdecay.h:118
MFProducer::m_mapDensityX
unsigned m_mapDensityX
Definition:
MFProducer.cc:22
funct::true
true
Definition:
Factorize.h:173
edm::ParameterSet
Definition:
ParameterSet.h:47
MFProducer::evaluate
void evaluate(const double point[3], double field[3]) const
Definition:
MFProducer.cc:75
MFProducer
Definition:
MFProducer.cc:12
MFProducer::m_xBaseDir
double m_xBaseDir
Definition:
MFProducer.cc:31
iEvent
int iEvent
Definition:
GenABIO.cc:224
MFProducer::MFProducer
MFProducer(const edm::ParameterSet &)
Definition:
MFProducer.cc:38
MFProducer::m_maxY
double m_maxY
Definition:
MFProducer.cc:28
MagneticField.h
MFProducer::m_maxZ
double m_maxZ
Definition:
MFProducer.cc:30
edm::EventSetup
Definition:
EventSetup.h:57
MFProducer::m_minX
double m_minX
Definition:
MFProducer.cc:25
get
#define get
edm::ESHandleBase::isValid
bool isValid() const
Definition:
ESHandle.h:44
heppy_batch.val
val
Definition:
heppy_batch.py:351
MFProducer::m_mf
edm::ESHandle< MagneticField > m_mf
Definition:
MFProducer.cc:35
Frameworkfwd.h
GlobalVector.h
edm::EDProducer
Definition:
EDProducer.h:35
MFProducer::~MFProducer
~MFProducer(void) override
Definition:
MFProducer.cc:54
MFProducer::beginJob
void beginJob(void) override
Definition:
MFProducer.cc:83
MFProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition:
MFProducer.cc:56
ParameterSet.h
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
point
*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
edm::Event
Definition:
Event.h:73
MFProducer::m_yBaseDir
double m_yBaseDir
Definition:
MFProducer.cc:32
GlobalPoint.h
MFProducer::endJob
void endJob(void) override
Definition:
MFProducer.cc:85
Generated for CMSSW Reference Manual by
1.8.16