44{
47
49
53 int type;
55 string option;
58
59 try {
60
62
65 zap[
'C'] =
make_field(cylinder,
"generation volume");
66 zap[
'P'] =
make_field(type,
"PDG particle code");
67 zap[
'E'] =
make_field(E_GeV,
"energy range [log10(E)]");
68 zap[
'O'] =
make_field(option) = surface_t, volume_t;
71
72 zap(argc, argv);
73 }
74 catch(const exception& error) {
75 FATAL(error.what() << endl);
76 }
77
79
81
84
85 const double A[] = {
89 };
90
91 double W = 0.0;
92
93 for (int i = 0; i != sizeof(A)/sizeof(A[0]); ++i) {
94 W += A[i];
95 }
96
97 for (
counter_type counter = 0; counter != numberOfEvents; ++counter) {
98
99 STATUS(
"event: " << setw(10) << counter <<
'\r');
DEBUG(endl);
100
103
104 for ( ; ; ) {
105
106 if (option == volume_t) {
107
109
110 } else if (option == surface_t) {
111
112 const double phi = gRandom->Uniform(-PI, +PI);
113 const double u = gRandom->Uniform(0.0, W);
114
115 double R;
116 double z;
117
118 if (u <= A[0]) {
119
122
123 } else if (u <= A[1]) {
124
127
128 } else if (u <= A[2]) {
129
132
133 } else {
134
135 continue;
136 }
137
139 cylinder.
getY() + R*sin(phi),
140 z);
141
142 } else {
143
144 FATAL(
"Invalid option " << option << endl);
145 }
146
148
150 break;
151 }
152 }
153
155 const double E =
pow(10.0, x);
156
158
160
162
169
171
173 }
175
177
178 {
179 JHead buffer(header);
180
181 buffer.fixedcan.xcenter = cylinder.
getX();
182 buffer.fixedcan.ycenter = cylinder.
getY();
183 buffer.fixedcan.radius = cylinder.
getRadius();
184 buffer.fixedcan.zmin = cylinder.
getZmin();
185 buffer.fixedcan.zmax = cylinder.
getZmax();
186
188
189 copy(buffer, header);
190 }
191
194
196}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
JAANET::fixedcan fixedcan
double getRadius() const
Get radius.
double getY() const
Get y position.
double getX() const
Get x position.
double getZmin() const
Get minimal z position.
intersection_type getIntersection(const JAxis3D &axis) const
Get intersection points of axis with cylinder.
double getZmax() const
Get maximal z position.
Data structure for direction in three dimensions.
Data structure for vector in three dimensions.
Utility class to parse command line options.
JDirection3D getDirection(const Vec &dir)
Get direction.
void copy(const Head &from, JHead &to)
Copy header from from to to.
JPosition3D getPosition(const Vec &pos)
Get position.
JVector3D getRandomPosition(const JSphere3D &sphere)
Get random position.
T pow(const T &x, const double y)
Power .
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Long64_t counter_type
Type definition for counter.
void randomize(JDAQChronometer *p)
Randomize chronometer.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
double mc_t
MC: time where the mc-event was put in the timeslice, since start of run (offset+frameidx*timeslice_d...
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Type definition of range.
Auxiliary data structure to configure random number generator.
bool set(TRandom *&pr) const
Configure random number generator.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
int status
MC status code, see km3net-dataformat/definitions/trkmembers.csv for values.
int type
MC: particle type in PDG encoding.
double E
Energy [GeV] (either MC truth or reconstructed)
double t
track time [ns] (when the particle is at pos )
Vec pos
postion [m] of the track at time t
static const int TRK_ST_FINALSTATE
for MC: the particle must be processed by detector simulation ('track_in' tag in evt files)....