SimG4CMS
Calo
plugins
CaloTrkProcessingBuilder.cc
Go to the documentation of this file.
1
// -*- C++ -*-
2
//
3
// Package: SimG4CMS/Calo
4
// Class : CaloTrkProcessingBuilder
5
//
6
// Implementation:
7
// [Notes on implementation]
8
//
9
// Original Author: Sunanda Banerjee
10
// Created: Tue, 12 Jul 2021 23:18:17 GMT
11
//
12
13
// system include files
14
#include <string>
15
#include <vector>
16
17
// user include files
18
#include "
SimG4Core/SensitiveDetector/interface/SensitiveDetectorMakerBase.h
"
19
#include "
SimG4Core/Notification/interface/SimActivityRegistryEnroller.h
"
20
#include "
SimG4Core/SensitiveDetector/interface/SensitiveDetectorPluginFactory.h
"
21
22
#include "
CondFormats/GeometryObjects/interface/CaloSimulationParameters.h
"
23
#include "
Geometry/Records/interface/HcalParametersRcd.h
"
24
#include "
SimG4CMS/Calo/interface/CaloTrkProcessing.h
"
25
26
#include "
FWCore/Framework/interface/ESHandle.h
"
27
#include "
FWCore/Framework/interface/EventSetup.h
"
28
#include "
FWCore/Framework/interface/ConsumesCollector.h
"
29
#include "
FWCore/Utilities/interface/ESGetToken.h
"
30
#include "
FWCore/PluginManager/interface/ModuleDef.h
"
31
#include "
FWCore/ParameterSet/interface/ParameterSet.h
"
32
33
class
CaloTrkProcessingBuilder
:
public
SensitiveDetectorMakerBase
{
34
public
:
35
explicit
CaloTrkProcessingBuilder
(
edm::ParameterSet
const
&
p
,
edm::ConsumesCollector
cc
)
36
:
cspsToken_
{
cc
.esConsumes<
edm::Transition::BeginRun
>()},
caloSimPar_
{
nullptr
} {
37
bool
dd4hep
=
p
.getParameter<
bool
>(
"g4GeometryDD4hepSource"
);
38
addlevel_
=
dd4hep
? 1 : 0;
39
edm::ParameterSet
csps =
p
.getParameter<
edm::ParameterSet
>(
"CaloTrkProcessing"
);
40
testBeam_
= csps.
getParameter
<
bool
>(
"TestBeam"
);
41
eMin_
= csps.
getParameter
<
double
>(
"EminTrack"
) *
CLHEP::MeV
;
42
putHistory_
= csps.
getParameter
<
bool
>(
"PutHistory"
);
43
doFineCalo_
= csps.
getParameter
<
bool
>(
"DoFineCalo"
);
44
eMinFine_
= csps.
getParameter
<
double
>(
"EminFineTrack"
) *
CLHEP::MeV
;
45
fineNames_
= csps.
getParameter
<std::vector<std::string> >(
"FineCaloNames"
);
46
fineLevels_
= csps.
getParameter
<std::vector<int> >(
"FineCaloLevels"
);
47
useFines_
= csps.
getParameter
<std::vector<int> >(
"UseFineCalo"
);
48
for
(
auto
&
level
:
fineLevels_
)
49
level
+=
addlevel_
;
50
}
51
52
void
beginRun
(
const
edm::EventSetup
& es)
final
{
caloSimPar_
= &es.getData(
cspsToken_
); }
53
54
std::unique_ptr<SensitiveDetector>
make
(
const
std::string
& iname,
55
const
SensitiveDetectorCatalog
& clg,
56
const
edm::ParameterSet
&
p
,
57
const
SimTrackManager
* man,
58
SimActivityRegistry
& reg)
const
final
{
59
auto
sd
= std::make_unique<CaloTrkProcessing>(iname,
60
*
caloSimPar_
,
61
clg,
62
testBeam_
,
63
eMin_
,
64
putHistory_
,
65
doFineCalo_
,
66
eMinFine_
,
67
addlevel_
,
68
fineNames_
,
69
fineLevels_
,
70
useFines_
,
71
man);
72
SimActivityRegistryEnroller::enroll
(reg,
sd
.get());
73
return
sd
;
74
}
75
76
private
:
77
const
edm::ESGetToken<CaloSimulationParameters, HcalParametersRcd>
cspsToken_
;
78
const
CaloSimulationParameters
*
caloSimPar_
;
79
bool
testBeam_
;
80
double
eMin_
;
81
bool
putHistory_
;
82
bool
doFineCalo_
;
83
double
eMinFine_
;
84
int
addlevel_
;
85
std::vector<std::string>
fineNames_
;
86
std::vector<int>
fineLevels_
;
87
std::vector<int>
useFines_
;
88
};
89
90
DEFINE_SENSITIVEDETECTORBUILDER
(
CaloTrkProcessingBuilder
,
CaloTrkProcessing
);
personalPlayback.level
level
Definition:
personalPlayback.py:22
SimTrackManager
Definition:
SimTrackManager.h:35
CaloSimulationParameters
Definition:
CaloSimulationParameters.h:6
ESHandle.h
CaloTrkProcessingBuilder::caloSimPar_
const CaloSimulationParameters * caloSimPar_
Definition:
CaloTrkProcessingBuilder.cc:78
CaloTrkProcessingBuilder::eMin_
double eMin_
Definition:
CaloTrkProcessingBuilder.cc:80
MeV
const double MeV
CaloTrkProcessingBuilder::putHistory_
bool putHistory_
Definition:
CaloTrkProcessingBuilder.cc:81
ESGetToken.h
CaloTrkProcessingBuilder::CaloTrkProcessingBuilder
CaloTrkProcessingBuilder(edm::ParameterSet const &p, edm::ConsumesCollector cc)
Definition:
CaloTrkProcessingBuilder.cc:35
CaloTrkProcessing.h
HcalParametersRcd.h
CaloSimulationParameters.h
CaloTrkProcessingBuilder::make
std::unique_ptr< SensitiveDetector > make(const std::string &iname, const SensitiveDetectorCatalog &clg, const edm::ParameterSet &p, const SimTrackManager *man, SimActivityRegistry ®) const final
Definition:
CaloTrkProcessingBuilder.cc:54
SensitiveDetectorCatalog
Definition:
SensitiveDetectorCatalog.h:10
CaloTrkProcessing
Definition:
CaloTrkProcessing.h:27
edm::ParameterSet
Definition:
ParameterSet.h:47
AlCaHLTBitMon_ParallelJobs.p
def p
Definition:
AlCaHLTBitMon_ParallelJobs.py:153
CaloTrkProcessingBuilder::eMinFine_
double eMinFine_
Definition:
CaloTrkProcessingBuilder.cc:83
SensitiveDetectorMakerBase
Definition:
SensitiveDetectorMakerBase.h:28
ModuleDef.h
CaloTrkProcessingBuilder::fineLevels_
std::vector< int > fineLevels_
Definition:
CaloTrkProcessingBuilder.cc:86
CaloTrkProcessingBuilder::fineNames_
std::vector< std::string > fineNames_
Definition:
CaloTrkProcessingBuilder.cc:85
SimActivityRegistryEnroller::enroll
static void enroll(SimActivityRegistry &iReg, T *iObj)
Definition:
SimActivityRegistryEnroller.h:50
edm::EventSetup
Definition:
EventSetup.h:58
cc
edm::ESGetToken< CaloSimulationParameters, HcalParametersRcd >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition:
AlCaHLTBitMon_QueryRunRegistry.py:256
CaloTrkProcessingBuilder::useFines_
std::vector< int > useFines_
Definition:
CaloTrkProcessingBuilder.cc:87
SimActivityRegistryEnroller.h
SimActivityRegistry
Definition:
SimActivityRegistry.h:39
DEFINE_SENSITIVEDETECTORBUILDER
#define DEFINE_SENSITIVEDETECTORBUILDER(type, name)
Definition:
SensitiveDetectorPluginFactory.h:21
edm::Transition::BeginRun
dd4hep
Definition:
DDPlugins.h:8
CaloTrkProcessingBuilder::testBeam_
bool testBeam_
Definition:
CaloTrkProcessingBuilder.cc:79
EventSetup.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition:
ParameterSet.h:303
CaloTrkProcessingBuilder::cspsToken_
const edm::ESGetToken< CaloSimulationParameters, HcalParametersRcd > cspsToken_
Definition:
CaloTrkProcessingBuilder.cc:77
sd
double sd
Definition:
CascadeWrapper.h:113
ConsumesCollector.h
SensitiveDetectorPluginFactory.h
CaloTrkProcessingBuilder::beginRun
void beginRun(const edm::EventSetup &es) final
Definition:
CaloTrkProcessingBuilder.cc:52
ParameterSet.h
CaloTrkProcessingBuilder::doFineCalo_
bool doFineCalo_
Definition:
CaloTrkProcessingBuilder.cc:82
SensitiveDetectorMakerBase.h
CaloTrkProcessingBuilder
Definition:
CaloTrkProcessingBuilder.cc:33
CaloTrkProcessingBuilder::addlevel_
int addlevel_
Definition:
CaloTrkProcessingBuilder.cc:84
edm::ConsumesCollector
Definition:
ConsumesCollector.h:45
Generated for CMSSW Reference Manual by
1.8.16