SimG4Core
CustomPhysics
plugins
RHStopDump.cc
Go to the documentation of this file.
1
#include "
SimG4Core/CustomPhysics/interface/RHStopDump.h
"
2
3
#include "
FWCore/Framework/interface/Event.h
"
4
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
5
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
6
7
RHStopDump::RHStopDump
(
edm::ParameterSet
const
&
parameters
)
8
: mStream(
parameters
.getParameter<
std
::
string
>(
"stoppedFile"
).c_str()),
9
mProducer(
parameters
.getUntrackedParameter<
std
::
string
>(
"producer"
,
"g4SimHits"
)) {}
10
11
void
RHStopDump::analyze
(
const
edm::Event
&
fEvent
,
const
edm::EventSetup
&) {
12
edm::Handle<std::vector<std::string>
>
names
;
13
fEvent
.getByLabel(
mProducer
,
"StoppedParticlesName"
,
names
);
14
edm::Handle<std::vector<float>
> xs;
15
fEvent
.getByLabel(
mProducer
,
"StoppedParticlesX"
, xs);
16
edm::Handle<std::vector<float>
> ys;
17
fEvent
.getByLabel(
mProducer
,
"StoppedParticlesY"
, ys);
18
edm::Handle<std::vector<float>
> zs;
19
fEvent
.getByLabel(
mProducer
,
"StoppedParticlesZ"
, zs);
20
edm::Handle<std::vector<float>
> ts;
21
fEvent
.getByLabel(
mProducer
,
"StoppedParticlesTime"
, ts);
22
edm::Handle<std::vector<int>
> ids;
23
fEvent
.getByLabel(
mProducer
,
"StoppedParticlesPdgId"
, ids);
24
edm::Handle<std::vector<float>
>
masses
;
25
fEvent
.getByLabel(
mProducer
,
"StoppedParticlesMass"
,
masses
);
26
edm::Handle<std::vector<float>
>
charges
;
27
fEvent
.getByLabel(
mProducer
,
"StoppedParticlesCharge"
,
charges
);
28
29
if
(
names
->size() != xs->size() || xs->size() != ys->size() || ys->size() != zs->size()) {
30
edm::LogError
(
"RHStopDump"
) <<
"mismatch array sizes name/x/y/z:"
<<
names
->size() <<
'/'
<< xs->size() <<
'/'
31
<< ys->size() <<
'/'
<< zs->size() << std::endl;
32
}
else
{
33
for
(
size_t
i
= 0;
i
<
names
->size(); ++
i
) {
34
mStream
<< (*names)[
i
] <<
' '
<< (*xs)[
i
] <<
' '
<< (*ys)[
i
] <<
' '
<< (*zs)[
i
] <<
' '
<< (*ts)[
i
] << std::endl;
35
mStream
<< (*ids)[
i
] <<
' '
<< (*masses)[
i
] <<
' '
<< (*charges)[
i
] << std::endl;
36
}
37
}
38
}
RHStopDump.h
RHStopDump::mProducer
std::string mProducer
Definition:
RHStopDump.h:20
BeamSpotPI::parameters
parameters
Definition:
BeamSpotPayloadInspectorHelper.h:30
CosmicGenFilterHelix_cfi.charges
charges
only generated particles of these IDs are considered
Definition:
CosmicGenFilterHelix_cfi.py:6
mps_fire.i
i
Definition:
mps_fire.py:428
MessageLogger.h
RHStopDump::RHStopDump
RHStopDump(const edm::ParameterSet &)
Definition:
RHStopDump.cc:7
edm::Handle
Definition:
AssociativeIterator.h:50
names
const std::string names[nVars_]
Definition:
PhotonIDValueMapProducer.cc:124
edm::ParameterSet
Definition:
ParameterSet.h:47
Event.h
RHStopDump::mStream
std::ofstream mStream
Definition:
RHStopDump.h:19
edm::EventSetup
Definition:
EventSetup.h:58
edm::LogError
Log< level::Error, false > LogError
Definition:
MessageLogger.h:123
particleFlowDisplacedVertex_cfi.masses
masses
Definition:
particleFlowDisplacedVertex_cfi.py:80
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
hcaldqm::fEvent
Definition:
DQTask.h:32
std
Definition:
JetResolutionObject.h:76
RHStopDump::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition:
RHStopDump.cc:11
ParameterSet.h
edm::Event
Definition:
Event.h:73
Generated for CMSSW Reference Manual by
1.8.16