Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
larwirecell
larwirecell
Modules
BlipMaker_module.cc
Go to the documentation of this file.
1
#include "
fhiclcpp/ParameterSet.h
"
2
#include "
art/Framework/Core/ModuleMacros.h
"
3
#include "
art/Framework/Core/EDProducer.h
"
4
#include "
art/Framework/Principal/Event.h
"
5
6
#include "
lardataobj/Simulation/SimEnergyDeposit.h
"
7
8
namespace
bogoblip
{
9
// struct BlipMakerConfig {
10
// };
11
class
BlipMaker
:
public
art::EDProducer
{
12
public
:
13
14
// using Parameters = art::EDProducer::Table<BlipMakerConfig>;
15
16
// explicit BlipMaker(Parameters const& params);
17
explicit
BlipMaker
(
fhicl::ParameterSet
const
& pset);
18
19
void
produce
(
art::Event
&
evt
);
20
21
private
:
22
23
// const BlipMakerConfig m_cfg;
24
int
m_count
;
25
26
std::vector<double>
m_head
;
// start of the ray [cm]
27
std::vector<double>
m_tail
;
// end of the ray [cm]
28
double
m_time
;
// depo's time [ns]
29
double
m_charge
;
// charge per step [electron]
30
double
m_step
;
// step length [cm]
31
};
32
}
33
34
#include <string>
35
const
std::string
instance
=
"bogus"
;
// fixme: make configurable
36
37
// bogoblip::BlipMaker::BlipMaker(Parameters const& params)
38
// : EDProducer{params}
39
// , m_cfg(params())
40
// , m_count(0)
41
// {
42
// produces< std::vector<sim::SimEnergyDeposit> >(instance);
43
// }
44
45
bogoblip::BlipMaker::BlipMaker
(
fhicl::ParameterSet
const
& pset)
46
:
EDProducer
{pset}
47
,
m_count
(0)
48
,
m_head
{pset.get< std::vector<double> >(
"Head"
, {100.,0.,0.})}
49
,
m_tail
{pset.get< std::vector<double> >(
"Tail"
, {50.,10.,50.})}
50
,
m_time
{pset.get<
double
>(
"Time"
, 0.0)}
51
,
m_charge
{pset.get<
double
>(
"ElectronPerCm"
, 50000)}
52
,
m_step
{pset.get<
double
>(
"StepSize"
, 0.1)}
53
{
54
produces< std::vector<sim::SimEnergyDeposit> >(
instance
);
55
}
56
57
58
void
bogoblip::BlipMaker::produce
(
art::Event
&
event
)
59
{
60
++
m_count
;
61
62
std::cout <<
"head: "
<<
m_head
.at(0) <<
" "
<<
m_head
.at(1) <<
" "
<<
m_head
.at(2) <<
std::endl
;
63
std::cout <<
"tail: "
<<
m_tail
.at(0) <<
" "
<<
m_tail
.at(1) <<
" "
<<
m_tail
.at(2) <<
std::endl
;
64
std::cout <<
"time: "
<<
m_time
<<
" e/cm: "
<<
m_charge
<<
" step: "
<<
m_step
<<
std::endl
;
65
66
auto
out = std::make_unique< std::vector<sim::SimEnergyDeposit> >();
67
68
int
nphotons = 0;
69
const
int
nelepercm =
m_charge
;
// 50000;
70
const
double
mevpercm = 2.0;
71
72
double
t0
= 0.;
73
double
t1
= 0.;
74
int
trackid = 0;
75
76
// implicit units are cm, ns and MeV.
77
sim::SimEnergyDeposit::Point_t
start = {
m_head
.at(0),
m_head
.at(1),
m_head
.at(2)};
// {100.,0.,0.};
78
sim::SimEnergyDeposit::Point_t
end
= {
m_tail
.at(0),
m_tail
.at(1),
m_tail
.at(2)};
// {150.,10.,50.};
79
const
auto
vdiff = end-start;
80
const
auto
vlen
= sqrt(vdiff.Mag2());
81
const
auto
vdir = vdiff.unit();
82
83
const
double
stepsize =
m_step
;
// 0.1; // cm
84
const
int
nsteps =
vlen
/stepsize;
85
86
// larsoft works in ns
87
const
double
ns
= 1.0;
88
// const double us = 1000.0*ns;
89
// const double ms = 1000.0*us;
90
91
// MB: WCT sim should cut the first, the second should just be on
92
// the edge of time acceptance. The last two bracket the BNB beam
93
// gate.
94
for
(
double
jump : {
m_time
* ns}
/*{ -1.6*ms, -1*ms, +3125*ns, (3125+1600)*ns, }*/
) {
95
sim::SimEnergyDeposit::Point_t
last = start;
96
for
(
int
istep=1; istep<nsteps; ++istep) {
97
const
sim::SimEnergyDeposit::Point_t
next(start + stepsize*istep*vdir);
98
//std::cerr << last << " -> " << next << "\n";
99
out->emplace_back(
sim::SimEnergyDeposit
(nphotons,
100
stepsize * nelepercm,
101
1.0,
//scintillatin yield ratio
102
stepsize * mevpercm,
103
last, next,
104
jump + t0,
105
jump + t1, trackid));
106
last = next;
107
}
108
}
109
110
std::cerr <<
"BlipMaker making "
<< out->size() <<
" depos to instance: "
<<
instance
<<
std::endl
;
111
112
113
event
.put(
std::move
(out),
instance
);
114
}
115
116
117
namespace
bogoblip
{
118
DEFINE_ART_MODULE
(
BlipMaker
)
119
}
ValidateOpDetReco.end
end
while True: pbar.update(maxval-len(onlies[E][S])) #print iS, "/", len(onlies[E][S]) found = False for...
Definition:
ValidateOpDetReco.py:548
t0
code to link reconstructed objects back to the MC truth information
Definition:
DirectHitParticleAssns_tool.cc:12
bogoblip::BlipMaker::m_head
std::vector< double > m_head
Definition:
BlipMaker_module.cc:26
test_gpu_visible.vlen
int vlen
Definition:
test_gpu_visible.py:6
string
std::string string
Definition:
nybbler.cc:12
art::EDProducer::EDProducer
EDProducer(fhicl::ParameterSet const &pset)
Definition:
EDProducer.h:20
instance
const std::string instance
Definition:
BlipMaker_module.cc:35
bogoblip::BlipMaker::m_time
double m_time
Definition:
BlipMaker_module.cc:28
ParameterSet.h
DEFINE_ART_MODULE
#define DEFINE_ART_MODULE(klass)
Definition:
ModuleMacros.h:67
bogoblip
Definition:
BlipMaker_module.cc:8
wirecell.gen.depos.move
def move(depos, offset)
Definition:
depos.py:107
test_gpu_visible.t1
t1
Definition:
test_gpu_visible.py:16
bogoblip::BlipMaker::m_tail
std::vector< double > m_tail
Definition:
BlipMaker_module.cc:27
ModuleMacros.h
art::EDProducer
Definition:
EDProducer.h:15
EDProducer.h
bogoblip::BlipMaker::produce
void produce(art::Event &evt)
Definition:
BlipMaker_module.cc:58
art::Event
Definition:
Event.h:22
bogoblip::BlipMaker
Definition:
BlipMaker_module.cc:11
SimEnergyDeposit.h
contains information for a single step in the detector simulation
sim::SimEnergyDeposit
Energy deposition in the active material.
Definition:
SimEnergyDeposit.h:42
sim::SimEnergyDeposit::Point_t
geo::Point_t Point_t
Definition:
SimEnergyDeposit.h:48
bogoblip::BlipMaker::m_count
int m_count
Definition:
BlipMaker_module.cc:24
bogoblip::BlipMaker::m_charge
double m_charge
Definition:
BlipMaker_module.cc:29
tca::evt
TCEvent evt
Definition:
DataStructs.cxx:7
Event.h
ns
QAsciiDict< Entry > ns
Definition:
tclscanner.cpp:1147
endl
QTextStream & endl(QTextStream &s)
Definition:
qtextstream.cpp:2030
event
Event finding and building.
Definition:
EventCheater_module.cc:32
bogoblip::BlipMaker::BlipMaker
BlipMaker(fhicl::ParameterSet const &pset)
Definition:
BlipMaker_module.cc:45
bogoblip::BlipMaker::m_step
double m_step
Definition:
BlipMaker_module.cc:30
fhicl::ParameterSet
Definition:
ParameterSet.h:36
Generated by
1.8.11