77{
80
82
84
86 string detectorFile;
87 double T_s;
88 size_t numberOfEvents;
89 double E_GeV;
90 int run;
91 int id;
95
96 struct {
97 double l_abs = 5.0e3;
98 double ZMax_m = 150.0;
99 } parameters;
100
102 ULong_t seed;
104
105 try {
106
108
111
112 JParser<> zap(
" Auxiliary program to write signal acoustic data.");
113
114 zap[
'a'] =
make_field(detectorFile,
"detector.");
118 zap[
'E'] =
make_field(E_GeV,
"neutrino energy [GeV]");
119 zap[
'R'] =
make_field(run,
"run number") = -1;
120 zap[
'T'] =
make_field(T_s,
"time interval between events [s]");
125 zap[
'W'] =
make_field(
id,
"waveform identifier");
128
129 zap(argc, argv);
130 }
131 catch(const exception &error) {
132 FATAL(error.what() << endl);
133 }
134
135
136 gRandom->SetSeed(seed);
137
139
140 try {
142 }
145 }
146
147 const double RMax_m =
getRange(E_GeV, parameters.l_abs);
148
150 const JPosition3D center(cylinder.getX(), cylinder.getY(), 0.5 * (cylinder.getZmin() + cylinder.getZmax()));
151
152 TH1D h1("h1", NULL, 60, 6.0, 12.0);
153
154 for (Int_t i = 1; i <= h1.GetXaxis()->GetNbins(); ++i) {
155
156 const double x = h1.GetXaxis()->GetBinCenter(i);
157 const double E =
pow(10.0, x);
158 const double R =
getRange(E, parameters.l_abs);
159
160 h1.SetBinContent(i, R);
161 }
162
164
167
169
175
176 for (size_t i = 0; i != numberOfEvents; ++i) {
177
181
182 pos.add(center);
183
185
186 gRandom->Sphere(x, y, z, 1.0);
187
189
191
192 const double t0 = T_s * i;
193
194 size_t number_of_hits = 0;
195
196 for (JDetector::const_iterator module =
detector.begin(); module !=
detector.end(); ++module) {
197
198 if (module->getFloor() != 0) {
199
201
202 P.sub(pos);
203 P.rotate(R);
204
205 if (sqrt(P.getX()*P.getX() + P.getY()*P.getY()) <= RMax_m && fabs(P.getZ()) <= parameters.ZMax_m) {
206
207 const JReceiver receiver(module->getID(), module->getPosition(), module->getT0() * 1.0e-9);
208
209 const double t1 = V.
getTime(pos.getDistance(receiver), pos.getZ(), receiver.getZ());
210
211 toa.
DOMID = receiver.getID();
212 toa.
TOA_NS = llrint(1E9*receiver.putT(t0 + t1));
213
215
216 number_of_hits += 1;
217 }
218 }
219 }
220
221 STATUS(
"event: " << setw(6) << i <<
' '
222 <<
FIXED(12,2) << t0 <<
' '
223 <<
FIXED(9,2) << (pos.getX() - center.getX()) <<
' '
224 <<
FIXED(9,2) << (pos.getY() - center.getY()) <<
' '
225 <<
FIXED(9,2) << (pos.getZ() - center.getZ()) <<
' '
226 <<
FIXED(6,3) << dir.getDX() <<
' '
227 <<
FIXED(6,3) << dir.getDY() <<
' '
228 <<
FIXED(6,3) << dir.getDZ() <<
' '
229 << setw(4) << number_of_hits << endl);
230 }
232
233 return 0;
234}
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object
Utility class to parse parameter values.
Data structure for position in three dimensions.
Data structure for normalised vector in three dimensions.
Utility class to parse command line options.
static const JSoundVelocity getSoundVelocity(1541.0, -17.0e-3, -2000.0)
Function object for velocity of sound.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
T pow(const T &x, const double y)
Power .
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
range_type getRange(TAxis *pAxis)
Get range of given axis.
Auxiliary data structure for floating point format specification.
Type definition of range.
Implementation for depth dependend velocity of sound.
virtual double getTime(const double D_m, const double z1, const double z2) const override
Get propagation time of sound.
Time-of-arrival data from acoustic piezo sensor or hydrophone.
uint32_t DOMID
DAQ run number.
int64_t TOA_NS
Unique ID of the waveform that best described the signal around TOA_NS.
uint32_t QUALITYFACTOR
The ticks (16ns) part of the DAQ frame timestamp.
uint32_t QUALITYNORMALISATION
A measure of how good the waveform match was to the signal.
int32_t WAVEFORMID
DOM unique identifeir.
int32_t RUN
detector identifier
Empty structure for specification of parser element that is initialised (i.e. does not require input)...