Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
larsim
larsim
IonizationScintillation
ISCalcAna_module.cc
Go to the documentation of this file.
1
////////////////////////////////////////////////////////////////////////
2
// Class: ISCalcAna
3
// Plugin Type: analyzer (art v2_05_00)
4
// File: ISCalcAna_module.cc
5
//
6
// Generated at Tue Mar 7 14:59:03 2017 by Wesley Ketchum using cetskelgen
7
// from cetlib version v1_21_00.
8
// modified at Sept 30, 2019, by muve
9
////////////////////////////////////////////////////////////////////////
10
11
#include "
art/Framework/Core/EDAnalyzer.h
"
12
#include "
art/Framework/Core/ModuleMacros.h
"
13
#include "
art/Framework/Principal/Event.h
"
14
#include "
art/Framework/Principal/Handle.h
"
15
#include "
art/Framework/Principal/Run.h
"
16
#include "
art/Framework/Principal/SubRun.h
"
17
#include "
canvas/Utilities/InputTag.h
"
18
#include "
fhiclcpp/ParameterSet.h
"
19
#include "
messagefacility/MessageLogger/MessageLogger.h
"
20
#include "nurandom/RandomUtils/NuRandomService.h"
21
22
#include "TNtuple.h"
23
#include "art_root_io/TFileService.h"
24
25
#include "
larsim/IonizationScintillation/ISCalc.h
"
26
#include "
larsim/IonizationScintillation/ISCalcCorrelated.h
"
27
#include "
larsim/IonizationScintillation/ISCalcNESTLAr.h
"
28
#include "
larsim/IonizationScintillation/ISCalcSeparate.h
"
29
30
#include "
lardata/DetectorInfoServices/DetectorPropertiesService.h
"
31
#include "
lardata/DetectorInfoServices/LArPropertiesService.h
"
32
#include "
lardataobj/Simulation/SimEnergyDeposit.h
"
33
#include "
larevt/SpaceChargeServices/SpaceChargeService.h
"
34
#include "
larsim/Simulation/LArG4Parameters.h
"
35
36
namespace
larg4
{
37
class
ISCalcAna
:
public
art::EDAnalyzer
{
38
public
:
39
explicit
ISCalcAna
(
fhicl::ParameterSet
const
&
p
);
40
ISCalcAna
(
ISCalcAna
const
&) =
delete
;
41
ISCalcAna
(
ISCalcAna
&&) =
delete
;
42
ISCalcAna
&
operator=
(
ISCalcAna
const
&) =
delete
;
43
ISCalcAna
&
operator=
(
ISCalcAna
&&) =
delete
;
44
45
void
analyze
(
art::Event
const
&
event
)
override
;
46
void
beginJob
()
override
;
47
void
endJob
()
override
;
48
49
private
:
50
std::unique_ptr<ISCalc>
fISAlg
;
51
art::InputTag
fEDepTag
;
52
art::InputTag
calcTag
;
// name of calculator to use, NEST or Separate
53
CLHEP::HepRandomEngine&
fEngine
;
54
TNtuple*
fNtuple
;
55
};
56
57
ISCalcAna::ISCalcAna
(
fhicl::ParameterSet
const
& pset)
58
:
EDAnalyzer
(pset)
59
,
fEDepTag
{pset.
get
<
art::InputTag
>(
"SimulationLabel"
)}
60
,
calcTag
{pset.get<
art::InputTag
>(
"ISCalcAlg"
)}
61
,
fEngine
(
art::ServiceHandle<rndm::NuRandomService>
()
62
->createEngine(*
this
,
"HepJamesRandom"
,
"NEST"
, pset,
"SeedNEST"
))
63
{
64
std::cout <<
"ISCalcAna constructor."
<<
std::endl
;
65
}
66
67
void
68
ISCalcAna::beginJob
()
69
{
70
std::cout <<
"ISCalcAna beginJob."
<<
std::endl
;
71
std::cout <<
"Using "
<<
calcTag
.
label
() <<
" algorithm to calculate IS."
<<
std::endl
;
72
73
if
(
calcTag
.
label
() ==
"Separate"
)
74
fISAlg
= std::make_unique<larg4::ISCalcSeparate>();
75
else
if
(
calcTag
.
label
() ==
"Correlated"
) {
76
auto
const
detProp =
art::ServiceHandle<detinfo::DetectorPropertiesService>
()->DataForJob();
77
fISAlg
= std::make_unique<larg4::ISCalcCorrelated>(detProp);
78
}
79
else
if
(
calcTag
.
label
() ==
"NEST"
)
80
fISAlg
= std::make_unique<larg4::ISCalcNESTLAr>(
fEngine
);
81
else
82
mf::LogWarning
(
"IonAndScint"
) <<
"No ISCalculation set, this can't be good."
;
83
84
art::ServiceHandle<art::TFileService const>
tfs;
85
fNtuple
= tfs->make<TNtuple>(
86
"nt_is"
,
87
"EDep IS Calc Ntuple"
,
88
"run:event:t:x:y:z:ds:e:trackid:pdg:e_deposit:n_electron:n_photon:scintyield"
);
89
}
90
void
91
ISCalcAna::endJob
()
92
{
93
std::cout <<
"ISCalcAna endJob."
<<
std::endl
;
94
}
95
96
void
97
ISCalcAna::analyze
(
art::Event
const
&
event
)
98
{
99
art::Handle<std::vector<sim::SimEnergyDeposit>
> edep_handle;
100
if
(!event.
getByLabel
(
fEDepTag
, edep_handle)) {
101
std::cout <<
"PDFastSimPAR Module Cannot getByLabel: "
<<
fEDepTag
<<
std::endl
;
102
return
;
103
}
104
105
auto
const
detProp =
106
art::ServiceHandle<detinfo::DetectorPropertiesService const>
()->DataFor(event);
107
for
(
auto
const
& edepi : *edep_handle) {
108
auto
const
[energyDeposit, nElectrons, nPhotons, scintYieldRatio] =
109
fISAlg
->CalcIonAndScint(detProp, edepi);
110
fNtuple
->Fill(event.
run
(),
111
event
.event(),
112
edepi.T(),
113
edepi.X(),
114
edepi.Y(),
115
edepi.Z(),
116
edepi.StepLength(),
117
edepi.Energy(),
118
edepi.TrackID(),
119
edepi.PdgCode(),
120
energyDeposit,
121
nElectrons,
122
nPhotons,
123
scintYieldRatio);
124
}
125
126
std::cout <<
"ISCalcAna analyze completed."
<<
std::endl
;
127
}
128
}
129
DEFINE_ART_MODULE
(
larg4::ISCalcAna
)
LArG4Parameters.h
Store parameters for running LArG4.
larg4::ISCalcAna::beginJob
void beginJob() override
Definition:
ISCalcAna_module.cc:68
art::ServiceHandle
Definition:
ServiceHandle.h:37
Handle.h
larg4::ISCalcAna::analyze
void analyze(art::Event const &event) override
Definition:
ISCalcAna_module.cc:97
larg4
Geant4 interface.
Definition:
CheckAuxDetHit_module.cc:25
DetectorPropertiesService.h
art::Handle
Definition:
fwd.h:19
art::EDAnalyzer::EDAnalyzer
EDAnalyzer(fhicl::ParameterSet const &pset)
Definition:
EDAnalyzer.h:25
SpaceChargeService.h
larg4::ISCalcAna::operator=
ISCalcAna & operator=(ISCalcAna const &)=delete
MessageLogger.h
ParameterSet.h
art::InputTag::label
std::string const & label() const noexcept
Definition:
InputTag.cc:79
art::DataViewImpl::getByLabel
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
Definition:
DataViewImpl.h:633
larg4::ISCalcAna::ISCalcAna
ISCalcAna(fhicl::ParameterSet const &p)
Definition:
ISCalcAna_module.cc:57
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:67
fhicl::ParameterSet::get
T get(std::string const &key) const
Definition:
ParameterSet.h:271
larg4::ISCalcAna::fEDepTag
art::InputTag fEDepTag
Definition:
ISCalcAna_module.cc:51
larg4::ISCalcAna
Definition:
ISCalcAna_module.cc:37
ISCalc.h
art::InputTag
Definition:
InputTag.h:12
test.p
p
Definition:
test.py:223
SubRun.h
ISCalcCorrelated.h
ISCalcSeparate.h
art::DataViewImpl::run
RunNumber_t run() const
Definition:
DataViewImpl.cc:71
EDAnalyzer.h
larg4::ISCalcAna::calcTag
art::InputTag calcTag
Definition:
ISCalcAna_module.cc:52
ModuleMacros.h
larg4::ISCalcAna::fISAlg
std::unique_ptr< ISCalc > fISAlg
Definition:
ISCalcAna_module.cc:50
larg4::ISCalcAna::fEngine
CLHEP::HepRandomEngine & fEngine
Definition:
ISCalcAna_module.cc:53
ISCalcNESTLAr.h
art::Event
Definition:
Event.h:22
SimEnergyDeposit.h
contains information for a single step in the detector simulation
art::EDAnalyzer
Definition:
EDAnalyzer.h:20
mf::LogWarning
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
Definition:
MessageLogger.h:210
InputTag.h
LArPropertiesService.h
Event.h
Run.h
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
event
Event finding and building.
Definition:
EventCheater_module.cc:32
fhicl::ParameterSet
Definition:
ParameterSet.h:36
larg4::ISCalcAna::fNtuple
TNtuple * fNtuple
Definition:
ISCalcAna_module.cc:54
larg4::ISCalcAna::endJob
void endJob() override
Definition:
ISCalcAna_module.cc:91
Generated by
1.8.11