Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
larsim
larsim
EventGenerator
MARLEY
ActiveVolumeVertexSampler.h
Go to the documentation of this file.
1
//////////////////////////////////////////////////////////////////////////////
2
/// \file ActiveVolumeVertexSampler.h
3
/// \brief Algorithm that samples vertex locations uniformly within the
4
/// active volume of a detector. It is fully experiment-agnostic and multi-TPC
5
/// aware.
6
///
7
/// \author Steven Gardiner <sjgardiner@ucdavis.edu>
8
//////////////////////////////////////////////////////////////////////////////
9
10
#ifndef LARSIM_ALGORITHMS_ACTIVEVOLUMEVERTEXSAMPLER_H
11
#define LARSIM_ALGORITHMS_ACTIVEVOLUMEVERTEXSAMPLER_H
12
13
// standard library includes
14
#include <memory>
15
#include <random>
16
#include <string>
17
18
// framework includes
19
#include "
fhiclcpp/types/OptionalAtom.h
"
20
#include "
fhiclcpp/types/Sequence.h
"
21
#include "
fhiclcpp/types/Table.h
"
22
#include "cetlib_except/exception.h"
23
namespace
fhicl
{
class
ParameterSet; }
24
25
// art extensions
26
namespace
rndm
{
class
NuRandomService; }
27
#include "nurandom/RandomUtils/NuRandomService.h"
28
29
// LArSoft includes
30
namespace
geo
{
class
Geometry; }
31
32
// ROOT includes
33
#include "TLorentzVector.h"
34
35
namespace
evgen
{
36
37
class
ActiveVolumeVertexSampler
{
38
39
public
:
40
41
using
Name
=
fhicl::Name
;
42
using
Comment
=
fhicl::Comment
;
43
44
/// Collection of configuration parameters used to
45
/// determine the vertex location for each event
46
struct
Config
{
47
fhicl::Atom<std::string>
type_ {
48
Name
(
"type"
),
49
Comment
(
"Technique used to choose vertex locations"
),
50
"sampled"
// default value
51
};
52
53
fhicl::OptionalAtom<std::string>
seed_ {
54
Name
(
"seed"
),
55
Comment
(
"Seed used for sampling vertex locations"
),
56
[
this
]() ->
bool
{
return
type_() !=
"fixed"
; }
57
};
58
59
fhicl::Sequence<double, 3>
position_ {
60
Name
(
"position"
),
61
Comment
(
"Coordinates of the fixed vertex position"
),
62
[
this
]() ->
bool
{
return
type_() ==
"fixed"
; }
63
};
64
65
fhicl::Sequence<double, 3>
min_position_ {
66
Name
(
"min_position"
),
67
Comment
(
"The minimum allowed values for the x, y, and z coordinates"
),
68
[
this
]() ->
bool
{
return
type_() ==
"box"
; }
69
};
70
71
fhicl::Sequence<double, 3>
max_position_ {
72
Name
(
"max_position"
),
73
Comment
(
"The maximum allowed values for the x, y, and z coordinates"
),
74
[
this
]() ->
bool
{
return
type_() ==
"box"
; }
75
};
76
77
fhicl::OptionalAtom<bool>
check_active_ {
78
Name
(
"check_active"
),
79
Comment
(
"Whether to enforce that the sampled vertices are within a TPC"
80
" active volume"
),
81
[
this
]() ->
bool
{
return
type_() ==
"box"
; }
82
};
83
84
};
// struct Config
85
86
enum class
vertex_type_t
{ kSampled,
kFixed
, kBox };
87
88
// Configuration-checking constructors
89
ActiveVolumeVertexSampler
(
const
fhicl::Table<Config>
&
conf
,
90
rndm::NuRandomService& rand_service,
const
geo::Geometry
& geom,
91
const
std::string
& generator_name);
92
93
ActiveVolumeVertexSampler
(
const
fhicl::ParameterSet
& pset,
94
rndm::NuRandomService& rand_service,
const
geo::Geometry
& geom,
95
const
std::string
& generator_name)
96
:
ActiveVolumeVertexSampler
(
fhicl
::Table<
Config
>(pset, {}),
97
rand_service, geom, generator_name) {}
98
99
void
reconfigure
(
const
fhicl::Table<Config>
& conf,
100
const
geo::Geometry
& geom);
101
102
// Function that selects a primary vertex location for each event.
103
// TODO: add time sampling
104
TLorentzVector sample_vertex_pos(
const
geo::Geometry
& geom);
105
106
protected
:
107
108
// Currently sampled vertex position (doesn't change value if the vertex
109
// is fixed)
110
TLorentzVector
fVertexPosition
;
111
112
vertex_type_t
fVertexType
;
113
114
std::string
fGeneratorName
;
115
116
// Discrete distribution object used to sample TPCs based on their active
117
// masses
118
std::unique_ptr<std::discrete_distribution<size_t> >
fTPCDist
;
119
120
// RNG object used to sample TPCs
121
std::mt19937_64
fTPCEngine
;
122
123
// Helper variables used only for "box" sampling mode
124
double
fXmin
;
125
double
fYmin
;
126
double
fZmin
;
127
128
double
fXmax
;
129
double
fYmax
;
130
double
fZmax
;
131
132
bool
fCheckActive
;
133
134
};
// class evgen::ActiveVolumeVertexSampler
135
136
}
// namespace evgen
137
138
#endif
Sequence.h
fhicl::Table< Config >
evgen::ActiveVolumeVertexSampler::fVertexType
vertex_type_t fVertexType
Definition:
ActiveVolumeVertexSampler.h:112
evgen::ActiveVolumeVertexSampler::fYmin
double fYmin
Definition:
ActiveVolumeVertexSampler.h:125
evgen::ActiveVolumeVertexSampler::fVertexPosition
TLorentzVector fVertexPosition
Definition:
ActiveVolumeVertexSampler.h:110
evgen::ActiveVolumeVertexSampler::fZmin
double fZmin
Definition:
ActiveVolumeVertexSampler.h:126
string
std::string string
Definition:
nybbler.cc:12
tca::kFixed
vertex position fixed manually - no fitting done
Definition:
DataStructs.h:95
Name
ChannelGroupService::Name Name
Definition:
FixedChannelGroupService_service.cc:19
conf
Definition:
conf.py:1
OptionalAtom.h
evgen::ActiveVolumeVertexSampler
Definition:
ActiveVolumeVertexSampler.h:37
evgen::ActiveVolumeVertexSampler::fCheckActive
bool fCheckActive
Definition:
ActiveVolumeVertexSampler.h:132
RunHistoryService::reconfigure
virtual void reconfigure(fhicl::ParameterSet const &pset)
fhicl
Definition:
InputSourceFactory.h:7
fhicl::Atom< std::string >
geo::Geometry
The geometry of one entire detector, as served by art.
Definition:
Geometry.h:196
evgen::ActiveVolumeVertexSampler::Config
Definition:
ActiveVolumeVertexSampler.h:46
evgen::ActiveVolumeVertexSampler::fXmax
double fXmax
Definition:
ActiveVolumeVertexSampler.h:128
evgen::ActiveVolumeVertexSampler::vertex_type_t
vertex_type_t
Definition:
ActiveVolumeVertexSampler.h:86
evgen::ActiveVolumeVertexSampler::fZmax
double fZmax
Definition:
ActiveVolumeVertexSampler.h:130
Comment
#define Comment
Definition:
commentscan.cpp:4062
rndm
Definition:
ActiveVolumeVertexSampler.h:26
Table.h
evgen::ActiveVolumeVertexSampler::fYmax
double fYmax
Definition:
ActiveVolumeVertexSampler.h:129
evgen::ActiveVolumeVertexSampler::fTPCDist
std::unique_ptr< std::discrete_distribution< size_t > > fTPCDist
Definition:
ActiveVolumeVertexSampler.h:118
evgen::ActiveVolumeVertexSampler::ActiveVolumeVertexSampler
ActiveVolumeVertexSampler(const fhicl::ParameterSet &pset, rndm::NuRandomService &rand_service, const geo::Geometry &geom, const std::string &generator_name)
Definition:
ActiveVolumeVertexSampler.h:93
fhicl::Sequence< double, 3 >
evgen::ActiveVolumeVertexSampler::fGeneratorName
std::string fGeneratorName
Definition:
ActiveVolumeVertexSampler.h:114
geo
LArSoft geometry interface.
Definition:
ChannelGeo.h:16
evgen::ActiveVolumeVertexSampler::fXmin
double fXmin
Definition:
ActiveVolumeVertexSampler.h:124
evgen
Event Generation using GENIE, cosmics or single particles.
Definition:
CRTGen_module.cc:33
fhicl::OptionalAtom< std::string >
fhicl::Comment
Definition:
Comment.h:33
fhicl::Name
Definition:
Name.h:10
fhicl::ParameterSet
Definition:
ParameterSet.h:36
evgen::ActiveVolumeVertexSampler::fTPCEngine
std::mt19937_64 fTPCEngine
Definition:
ActiveVolumeVertexSampler.h:121
Generated by
1.8.11