Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
vec.cpp
Go to the documentation of this file.
1#include <stdlib.h>
2#include <iomanip>
3#ifdef VISUAL_STUDIO
4#define _USE_MATH_DEFINES
5// see comment in math.h:
6/* Define _USE_MATH_DEFINES before including math.h to expose these macro
7 * definitions for common math constants. These are placed under an #ifdef
8 * since these commonly-defined names are not part of the C/C++ standards.
9 */
10#endif
11#include <cmath>
14#ifdef USE_SRANLUX
16#else
17#include <CLHEP/Random/RandomEngine.h>
18extern HepRandomEngine& random_engine;
19#endif
20/*
21Copyright (c) 2000 Igor B. Smirnov
22
23The file can be used, copied, modified, and distributed
24according to the terms of GNU Lesser General Public License version 2.1
25as published by the Free Software Foundation,
26and provided that the above copyright notice, this permission notice,
27and notices about any modifications of the original text
28appear in all copies and in supporting documentation.
29The file is provided "as is" without express or implied warranty.
30*/
31int vecerror = 0;
32
33macro_copy_body(absref_transmit)
34//absref_transmit* absref_transmit::copy(void) const
35//{return new absref_transmit(*this);}
36
37void absref_transmit::print(std::ostream& file, int l) const {
38 if (l > 0) {
39 Ifile << "absref_transmit::print(l=" << l << ") qaref=" << qaref
40 << " qaref_pointer=" << qaref_pointer
41 << " qaref_other=" << qaref_other << "\n";
42 file.flush();
43 }
44}
45
46absref* absref_transmit::get_other(int /*n*/) { return NULL; }
47
48// **** absref ****
49
50void absref::down(const abssyscoor* fasc) {
51 if (fasc == NULL) return; // considered to be unchanged
53}
54
55void absref::up(const abssyscoor* fasc) {
56 if (fasc == NULL) return; // considered to be unchanged
58}
59
60void absref::turn(const vec& dir, vfloat angle) {
62}
63
64void absref::shift(const vec& dir) {
66}
67
68void absref::get_components(ActivePtr<absref_transmit>& aref_tran) {
69 aref_tran.put(NULL);
70}
71
72/*
73void absref::down(const abssyscoor* fasc) {
74 if (fasc == NULL) return; // considered to be unchanged
75 int qaref;
76 absref absref::**aref;
77 int qareff;
78 absref **areff;
79 Garef(qaref, aref, qareff, areff);
80 for (int n = 0; n < qaref; ++n) {
81 // changes only vectors
82 // down is virtual and it is redefined there
83 (this->*(aref[n])).down(fasc);
84 }
85 for (int n=0; n < qareff; ++n) {
86 areff[n]->down(fasc);
87 }
88}
89
90void absref::up(const abssyscoor* fasc) {
91 if (fasc == NULL) return; // considered to be unchanged
92 int qaref;
93 absref absref::**aref;
94 int qareff;
95 absref **areff;
96 Garef(qaref, aref, qareff, areff);
97 for (int n = 0; n < qaref; ++n) {
98 (this->*(aref[n])).up(fasc);
99 }
100 for (int n = 0; n < qareff; n++) {
101 areff[n]->up(fasc);
102 }
103
104}
105
106void absref::turn(const vec& dir, vfloat angle) {
107 int qaref;
108 absref absref::**aref;
109 int qareff;
110 absref **areff;
111 Garef(qaref, aref, qareff, areff);
112 for (int n = 0; n < qaref; ++n) {
113 (this->*(aref[n])).turn(dir, angle);
114 }
115 for (int n = 0; n < qareff; ++n) {
116 areff[n]->turn(dir, angle);
117 }
118}
119
120void absref::shift(const vec& dir) {
121 int qaref;
122 absref absref::**aref;
123 int qareff;
124 absref **areff;
125 Garef(qaref, aref, qareff, areff);
126 for (int n = 0; n < qaref; ++n) {
127 (this->*(aref[n])).shift(dir);
128 }
129 for (int n = 0; n < qareff; ++n) {
130 areff[n]->shift(dir);
131 }
132
133}
134
135void absref::Garef(int& qaref, absref absref::**&aref , // fixed memory
136 int& qareff, absref **&areff) { // free memory
137 qaref = 0; qareff = 0; aref = NULL; areff = NULL;
138}
139*/
140
141// **** vector ****
142vfloat cos2vec(const vec& r1, const vec& r2) {
143 // cosinus of angle between vectors
144 // If one of vectors has zero length, it returns 2.
145 pvecerror("vfloat cos2vec(const vec& r1, const vec& r2)");
146 vfloat lr1 = length2(r1);
147 vfloat lr2 = length2(r2);
148 //mcout<<"cos2vec:\n";
149 //Iprintn(mcout, lr1);
150 //Iprintn(mcout, lr2);
151 if (lr1 == 0 || lr2 == 0) {
152 vecerror = 1;
153 return 0;
154 }
155 vfloat cs = r1 * r2;
156 int sign = 1;
157 if (cs < 0) sign = -1;
158 cs = cs * cs;
159 cs = sign * sqrt(cs / (lr1 * lr2));
160 //mcout<<"r1="<<r1<<"r2="<<r2<<"cos="<<cs<<'\n';
161 return cs;
162 //return r1*r2/(lr1*lr2);
163}
164
165vfloat ang2vec(const vec& r1, const vec& r2) {
166 // angle between vectors
167 // instead of return acos(cos2vec(r1,r2)); which produces NaN on linux at
168 // parallel vectors
169 vfloat cs = cos2vec(r1, r2);
170 if (vecerror != 0) return 0;
171 if (cs > 0.707106781187 || cs < -0.707106781187) { // 1.0/sqrt(2)
172 // pass to sin, it will be more exactly
173 vfloat sn = sin2vec(r1, r2);
174 if (vecerror != 0) return 0;
175 if (cs > 0.0)
176 return asin(sn);
177 else
178 return M_PI - asin(sn);
179 }
180 return acos(cs);
181}
182
183vfloat sin2vec(const vec& r1, const vec& r2) {
184 // sinus of angle between vectors
185 pvecerror("vfloat sin2vec(const vec& r1, const vec& r2)");
186 vfloat lr1 = length2(r1);
187 vfloat lr2 = length2(r2);
188 if (lr1 == 0 || lr2 == 0) {
189 vecerror = 1;
190 return 0;
191 }
192 vfloat sn = length(r1 || r2);
193 sn = sn * sn;
194 sn = sqrt(sn / (lr1 * lr2));
195 //mcout<<"r1="<<r1<<"r2="<<r2<<"sin="<<sn<<'\n';
196 return sn;
197 //return sin(ang2vec(r1,r2));
198}
199
200vec project_to_plane(const vec& r, const vec& normal) {
201 pvecerror("vec project_to_plane(const vec& r, const vec& normal)");
202 vec per(normal || r);
203 if (per == dv0) {
204 // either one of vectors is 0 or they are parallel
205 return dv0;
206 }
207 vec ax = unit_vec(per || normal);
208 vfloat v = ax * r;
209 return v * ax;
210}
211
212vfloat ang2projvec(const vec& r1, const vec& r2, const vec& normal) {
213 pvecerror(
214 "vfloat ang2projvec(const vec& r1, const vec& r2, const vec& normal)");
215 vec rt1 = project_to_plane(r1, normal);
216 vec rt2 = project_to_plane(r2, normal);
217 if (rt1 == dv0 || rt2 == dv0) {
218 vecerror = 1;
219 return 0;
220 }
221 vfloat tang = ang2vec(rt1, rt2);
222 if (tang == 0) return tang; // projections are parallel
223 vec at = rt1 || rt2;
224 int i = check_par(at, normal, 0.0001);
225 //mcout<<"r1="<<r1<<"r2="<<r2<<"normal="<<normal
226 // <<"rt1="<<rt1<<"rt2="<<rt2<<"\ntang="<<tang
227 // <<"\nat="<<at<<" i="<<i<<'\n';
228 if (i == -1) return 2.0 * M_PI - tang;
229 return tang; // it works if angle <= PI
230}
231
232vec vec::down_new(const basis* fabas) {
233 //pvecerror("vec vec::down_new(void)");
234 vec r;
235 vec ex = fabas->Gex();
236 vec ey = fabas->Gey();
237 vec ez = fabas->Gez();
238 r.x = x * ex.x + y * ey.x + z * ez.x;
239 r.y = x * ex.y + y * ey.y + z * ez.y;
240 r.z = x * ex.z + y * ey.z + z * ez.z;
241 //mcout<<scout(*this);
242 //mcout<<scout(ex)<<scout(ey)<<scout(ez);
243 //mcout<<scout(r);
244 return r;
245}
246
247void vec::down(const basis* fabas) { *this = this->down_new(fabas); }
248
249vec vec::up_new(const basis* fabas_new) {
250 // it is assumed that fabas_new is derivative from old
251 pvecerrorp("vec vec::up_new((const basis *pbas)");
252 vec r;
253 //check_econd11(fabas_new , ==NULL, mcerr);
254 // not compiled in IRIX, reason is unkown
255 if (fabas_new == NULL) {
256 funnw.ehdr(mcerr);
257 mcerr << "fabas_new==NULL\n";
258 spexit(mcerr);
259 }
260 vec ex = fabas_new->Gex();
261 vec ey = fabas_new->Gey();
262 vec ez = fabas_new->Gez();
263 r.x = x * ex.x + y * ex.y + z * ex.z;
264 r.y = x * ey.x + y * ey.y + z * ey.z;
265 r.z = x * ez.x + y * ez.y + z * ez.z;
266 return r;
267}
268
269void vec::up(const basis* fabas_new) { *this = this->up_new(fabas_new); }
270
271vec vec::turn_new(const vec& dir, vfloat angle) {
272 pvecerror("vec turn(vec& dir, vfloat& angle)");
273 if (length(*this) == 0) return vec(0, 0, 0);
274 if (check_par(*this, dir, 0.0) != 0) {
275 // parallel vectors are not changed
276 return *this;
277 }
278 vfloat dirlen = length(dir);
279 check_econd11a(dirlen, == 0, "cannot turn around zero vector", mcerr);
280 vec u = dir / dirlen; // unit vector
281 vec constcomp = u * (*this) * u;
282 //vec perpcomp = (*this) - constcomp;
283 //vfloat len=length(perpcomp);
284 vec ort1 = unit_vec(u || (*this));
285 vec ort2 = ort1 || u;
286 vec perpcomp = ort2 * (*this) * ort2;
287 vfloat len = length(perpcomp);
288 //mcout<<" constcomp="<<constcomp<<" ort1="<<ort1<<" ort2="<<ort2;
289 ort1 = sin(angle) * len * ort1;
290 ort2 = cos(angle) * len * ort2;
291 //mcout<<" constcomp="<<constcomp<<" ort1="<<ort1<<" ort2="<<ort2
292 // <<" len="<<len<<" sin(angle)="<<sin(angle)<<" cos(angle)="<<cos(angle)
293 // <<" angle="<<angle<<'\n';
294 return constcomp + ort1 + ort2;
295
296}
297
298void vec::turn(const vec& dir, vfloat angle) {
299 *this = this->turn_new(dir, angle);
300}
301
302void vec::shift(const vec& /*dir*/) {
303 // Not defined for vectors
304}
305
306vec vec::down_new(const abssyscoor* fasc) { return down_new(fasc->Gabas()); }
307void vec::down(const abssyscoor* fasc) { down(fasc->Gabas()); }
308vec vec::up_new(const abssyscoor* fasc) { return up_new(fasc->Gabas()); }
309void vec::up(const abssyscoor* fasc) { up(fasc->Gabas()); }
310
312#ifdef USE_SRANLUX
313 vfloat phi = M_PI * 2.0 * SRANLUX();
314#else
315 vfloat phi = M_PI * 2.0 * random_engine.flat();
316#endif
317 x = sin(phi);
318 y = cos(phi);
319 z = 0;
320}
321
322void vec::random_conic_vec(double theta) {
323#ifdef USE_SRANLUX
324 vfloat phi = M_PI * 2.0 * SRANLUX();
325#else
326 vfloat phi = M_PI * 2.0 * random_engine.flat();
327#endif
328 double stheta = sin(theta);
329 x = sin(phi) * stheta;
330 y = cos(phi) * stheta;
331 z = cos(theta);
332}
333
335#ifdef USE_SRANLUX
336 vfloat cteta = 2.0 * SRANLUX() - 1.0;
337#else
338 vfloat cteta = 2.0 * random_engine.flat() - 1.0;
339#endif
341 vfloat steta = sqrt(1.0 - cteta * cteta);
342 *this = (*this) * steta;
343 z = cteta;
344}
345
346std::ostream& operator<<(std::ostream& file, const vec& v) {
347 Ifile << "vector=" << std::setw(13) << v.x << std::setw(13) << v.y
348 << std::setw(13) << v.z;
349 file << '\n';
350 file.flush();
351 return file;
352}
353
354vec dex(1, 0, 0);
355vec dey(0, 1, 0);
356vec dez(0, 0, 1);
357vec dv0(0, 0, 0);
358
359std::ostream& operator<<(std::ostream& file, const vecReg& v) {
360 Ifile << "vecReg=" << ((vec&)v);
361 return file;
362}
363
364#ifndef WCPPLIB_INLINE
365#include "geometry/vec.ic"
366#endif
367
368// **** basis ****
369//absref absref::*(basis::aref[3])=
370//{(absref absref::*)&basis::ex,
371// (absref absref::*)&basis::ey,
372// (absref absref::*)&basis::ez};
373absref absref::* basis::aref[3] = {
374 reinterpret_cast<absref absref::*>(static_cast<vec absref::*>(&basis::ex)),
375 reinterpret_cast<absref absref::*>(static_cast<vec absref::*>(&basis::ey)),
376 reinterpret_cast<absref absref::*>(static_cast<vec absref::*>(&basis::ez))
377};
378
379void basis::get_components(ActivePtr<absref_transmit>& aref_tran) {
380 aref_tran.pass(new absref_transmit(3, aref));
381}
382
383//void basis::Garef(int& fqaref , absref absref::**&faref, // fixed memory
384// int& fqareff, absref **&fareff) { // free memory
385// fqaref=3; fqareff=0; faref=&aref[0]; fareff=NULL;
386//}
387
389 pvecerror("basis basis::switch_xyz(void)");
390 return basis(ez, ex, ey, name);
391}
392
393basis::basis(void) : ex(1, 0, 0), ey(0, 1, 0), ez(0, 0, 1) {
394 name = "primary_bas";
395}
396
397basis::basis(const String& pname) : ex(1, 0, 0), ey(0, 1, 0), ez(0, 0, 1) {
398 name = pname;
399}
400
401basis::basis(const vec& p, const String& pname) {
402 pvecerror("basis::basis(vec &p)");
403 name = pname;
404 //strcpy(name,pname);
405 vec dex(1, 0, 0);
406 vec dey(0, 1, 0);
407 vec dez(0, 0, 1);
408 if (length(p) == 0) {
409 vecerror = 1;
410 ex = dex;
411 ey = dey;
412 ez = dez;
413 }
414 vfloat ca = cos2vec(p, dez);
415 if (ca == 1) {
416 ex = dex;
417 ey = dey;
418 ez = dez;
419 } else if (ca == -1) {
420 ex = -dex;
421 ey = -dey;
422 ez = -dez;
423 } else {
424 ez = unit_vec(p);
425 ey = unit_vec(ez || dez);
426 ex = ey || ez;
427 }
428}
429
430basis::basis(const vec& p, const vec& c, const String& pname) {
431 pvecerror("basis::basis(vec &p, vec &c, char pname[12])");
432 name = pname;
433 vec dex(1, 0, 0);
434 vec dey(0, 1, 0);
435 vec dez(0, 0, 1);
436
437 if (length(p) == 0 || length(c) == 0) {
438 vecerror = 1;
439 ex = dex;
440 ey = dey;
441 ez = dez;
442 }
443 vfloat ca = cos2vec(p, c);
444 if (ca == 1) {
445 vecerror = 1;
446 ex = dex;
447 ey = dey;
448 ez = dez;
449 } else if (ca == -1) {
450 vecerror = 1;
451 ex = dex;
452 ey = dey;
453 ez = dez;
454 } else {
455 ez = unit_vec(p);
456 ey = unit_vec(ez || c);
457 ex = ey || ez;
458 }
459
460}
461
462// the same basis with other name, useful for later turning
463basis::basis(const basis& pb, const String& pname)
464 : ex(pb.ex), ey(pb.ey), ez(pb.ez) {
465 name = pname;
466}
467
468basis::basis(const vec& pex, const vec& pey, const vec& pez,
469 const String& pname) {
470 pvecerror("basis::basis(vec &pex, vec &pey, vec &pez, char pname[12])");
471 if (!check_perp(pex, pey, vprecision) || !check_perp(pex, pez, vprecision) ||
472 !check_perp(pey, pez, vprecision)) {
473 mcerr << "ERROR in basis::basis(vec &pex, vec &pey, vec &pez) : \n"
474 << "the vectors are not perpendicular\n";
475 mcerr << " pex,pey,pez:\n";
476 mcerr << pex << pey << pez;
477 mcerr << "name=" << pname << '\n';
478 spexit(mcerr);
479 }
480 //if(length(pex)!=vfloat(1.0) ||
481 // length(pey)!=vfloat(1.0) ||
482 // length(pez)!=vfloat(1.0) )
483 if (not_apeq(length(pex), vfloat(1.0)) ||
484 not_apeq(length(pey), vfloat(1.0)) ||
485 not_apeq(length(pez), vfloat(1.0))) {
486 mcerr << "ERROR in basis::basis(vec &pex, vec &pey, vec &pez) : \n"
487 << "the vectors are not of unit length\n";
488 mcerr << " pex,pey,pez:\n";
489 mcerr << pex << pey << pez;
490 mcerr << "name=" << pname << '\n';
491 spexit(mcerr);
492 }
493 if (not_apeq(pex || pey, pez, vprecision)) {
494 mcerr << "ERROR in basis::basis(vec &pex, vec &pey, vec &pez) : \n";
495 mcerr << "wrong direction of pez\n";
496 mcerr << " pex,pey,pez:\n";
497 mcerr << pex << pey << pez;
498 mcerr << "name=" << pname << '\n';
499 spexit(mcerr);
500 }
501 name = pname;
502 ex = pex;
503 ey = pey;
504 ez = pez;
505}
506
507void basis::print(std::ostream& file, int /*l*/) const { file << (*this); }
508
509std::ostream& operator<<(std::ostream& file, const basis& b) {
510 Ifile << "basis: name=" << b.name << '\n';
511 indn.n += 2;
512 int indnsave = indn.n;
513 Ifile << "ex: ";
514 indn.n = 0;
515 file << b.ex;
516 indn.n = indnsave;
517 Ifile << "ey: ";
518 indn.n = 0;
519 file << b.ey;
520 indn.n = indnsave;
521 Ifile << "ez: ";
522 indn.n = 0;
523 file << b.ez;
524 indn.n = indnsave;
525 indn.n -= 2;
526 //file << '\n';
527 return file;
528}
529
530std::ostream& operator<<(std::ostream& file, const basisReg& b) {
531 Ifile << "basisReg=" << ((basis&)b);
532 return file;
533}
534
535// **** point ****
536
537//absref absref::*(point::aref)=(absref absref::*)&point::v;
538//absref absref::*(point::aref)=static_cast<absref absref::*>(&point::v);
539absref absref::*(point::aref) =
540 reinterpret_cast<absref absref::*>(static_cast<vec absref::*>(&point::v));
541
542void point::get_components(ActivePtr<absref_transmit>& aref_tran) {
543 aref_tran.pass(new absref_transmit(1, &aref));
544}
545
546void point::down(const abssyscoor* fasc) {
547 v.down(fasc);
548 shift(fasc->Gapiv()->v);
549}
550void point::up(const abssyscoor* fasc) {
551 shift(-fasc->Gapiv()->v);
552 v.up(fasc);
553}
554
555void point::print(std::ostream& file, int /*l*/) const { file << (*this); }
556
557std::ostream& operator<<(std::ostream& file, const point& p) {
558 Ifile << "point:\n";
559 indn.n += 2;
560 file << p.v;
561 indn.n -= 2;
562 return file;
563}
564
565std::ostream& operator<<(std::ostream& file, const pointReg& b) {
566 Ifile << "pointReg=" << ((point&)b);
567 return file;
568}
569
570// **** system of coordinates ****
571
572void abssyscoor::print(std::ostream& file, int l) const {
573 if (l > 0) {
574 Ifile << "abssyscoor::print(l=" << l << "): name=" << name << '\n';
575 if (l > 1) {
576 indn.n += 2;
577 const point* apiv = Gapiv();
578 if (apiv != NULL) {
579 Ifile << "piv=" << noindent << (*apiv);
580 } else {
581 Ifile << "apiv=NULL\n";
582 }
583 const basis* abas = Gabas();
584 if (abas != NULL) {
585 Ifile << "bas=" << noindent << (*abas);
586 } else {
587 Ifile << "abas=NULL\n";
588 }
589 indn.n -= 2;
590 }
591 file.flush();
592 }
593}
594
595std::ostream& operator<<(std::ostream& file, const abssyscoor& f) {
596 f.print(file, 2);
597 return file;
598}
599
600//void fixsyscoor::Papiv(const point* const fapiv)
601//{ piv=(fapiv!=NULL) ? (*fapiv) : point() ; }
602//void fixsyscoor::Pabas(const basis* const fabas)
603//{ bas=(fabas!=NULL) ? (*fabas) : basis() ; }
604//fixsyscoor::aref[2]=
605//{(absref::*)&fixsyscoor::piv, (absref::*)&fixsyscoor::bas};
606//absref absref::*(fixsyscoor::aref[2])=
607//{(absref absref::*)&fixsyscoor::piv, (absref absref::*)&fixsyscoor::bas};
609 reinterpret_cast<absref absref::*>(
610 static_cast<point absref::*>(&fixsyscoor::piv)),
611 reinterpret_cast<absref absref::*>(
612 static_cast<basis absref::*>(&fixsyscoor::bas))
613};
614
615void fixsyscoor::get_components(ActivePtr<absref_transmit>& aref_tran) {
616 aref_tran.pass(new absref_transmit(2, aref));
617}
618
619void fixsyscoor::Ppiv(const point& fpiv) { piv = fpiv; }
620void fixsyscoor::Pbas(const basis& fbas) { bas = fbas; }
621
622void fixsyscoor::print(std::ostream& file, int l) const {
623 if (l > 0) {
624 Ifile << "fixsyscoor::print(l=" << l << ")\n";
625 if (l > 1) {
626 indn.n += 2;
627 RegPassivePtr::print(file, l);
628 abssyscoor::print(file, l);
629 }
630 }
631}
632
633std::ostream& operator<<(std::ostream& file, const fixsyscoor& f) {
634 Ifile << "fixsyscoor:\n";
635 f.RegPassivePtr::print(file, 2);
636 f.abssyscoor::print(file, 2);
637 return file;
638}
#define macro_copy_body(type)
Definition: AbsPtr.h:297
DoubleAc cos(const DoubleAc &f)
Definition: DoubleAc.cpp:431
DoubleAc asin(const DoubleAc &f)
Definition: DoubleAc.cpp:468
DoubleAc sqrt(const DoubleAc &f)
Definition: DoubleAc.cpp:313
DoubleAc sin(const DoubleAc &f)
Definition: DoubleAc.cpp:383
DoubleAc acos(const DoubleAc &f)
Definition: DoubleAc.cpp:488
#define check_econd11a(a, signb, add, stream)
Definition: FunNameStack.h:395
#define spexit(stream)
Definition: FunNameStack.h:536
std::string String
Definition: String.h:75
Definition: vec.h:134
virtual void turn(const vec &dir, vfloat angle)
Definition: vec.cpp:60
virtual void shift(const vec &dir)
Definition: vec.cpp:64
virtual void up(const abssyscoor *fasc)
Definition: vec.cpp:55
virtual void down(const abssyscoor *fasc)
Definition: vec.cpp:50
String name
Definition: vec.h:562
virtual void print(std::ostream &file, int l) const
Definition: vec.cpp:572
virtual const basis * Gabas(void) const =0
virtual const point * Gapiv(void) const =0
Definition: vec.h:462
Definition: vec.h:397
vec Gez() const
Definition: vec.h:417
basis(void)
Definition: vec.cpp:393
vec Gex() const
Definition: vec.h:415
vec ey
Definition: vec.h:399
String name
Definition: vec.h:412
virtual void print(std::ostream &file, int l) const
Definition: vec.cpp:507
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
Definition: vec.cpp:379
vec Gey() const
Definition: vec.h:416
vec ex
Definition: vec.h:399
static absref absref::* aref[3]
Definition: vec.h:408
vec ez
Definition: vec.h:399
basis switch_xyz(void) const
Definition: vec.cpp:388
void Ppiv(const point &fpiv)
Definition: vec.cpp:619
static absrefabsref::*[2] aref
Definition: vec.h:620
virtual void get_components(ActivePtr< absref_transmit > &aref_tran)
Definition: vec.cpp:615
virtual void print(std::ostream &file, int l) const
Definition: vec.cpp:622
void Pbas(const basis &fbas)
Definition: vec.cpp:620
Definition: vec.h:538
Definition: vec.h:477
vec v
Definition: vec.h:479
virtual void print(std::ostream &file, int l) const
Definition: vec.cpp:555
virtual void up(const abssyscoor *fasc)
Definition: vec.cpp:550
virtual void shift(const vec &dir)
Definition: vec.h:497
virtual void down(const abssyscoor *fasc)
Definition: vec.cpp:546
Definition: vec.h:385
Definition: vec.h:248
void random_conic_vec(double theta)
Definition: vec.cpp:322
void shift(const vec &dir)
Definition: vec.cpp:302
vfloat y
Definition: vec.h:250
friend vfloat length(const vec &v)
Definition: vec.h:299
void down(const basis *fabas)
Definition: vec.cpp:247
void random_round_vec(void)
Definition: vec.cpp:311
friend wl_inline int check_par(const vec &r1, const vec &r2, vfloat prec)
vec up_new(const basis *fabas_new)
Definition: vec.cpp:249
void random_sfer_vec(void)
Definition: vec.cpp:334
void up(const basis *fabas_new)
Definition: vec.cpp:269
vec()
Definition: vec.h:339
vfloat x
Definition: vec.h:250
vec down_new(const basis *fabas)
Definition: vec.cpp:232
vfloat z
Definition: vec.h:250
friend wl_inline vec unit_vec(const vec &v)
void turn(const vec &dir, vfloat angle)
Definition: vec.cpp:298
vec turn_new(const vec &dir, vfloat angle)
Definition: vec.cpp:271
indentation indn
Definition: prstream.cpp:13
std::ostream & noindent(std::ostream &f)
Definition: prstream.cpp:15
#define Ifile
Definition: prstream.h:207
#define mcerr
Definition: prstream.h:135
ffloat SRANLUX(void)
Definition: ranluxint.h:262
std::ostream & operator<<(std::ostream &file, const vec &v)
Definition: vec.cpp:346
vfloat ang2vec(const vec &r1, const vec &r2)
Definition: vec.cpp:165
HepRandomEngine & random_engine
vec dey(0, 1, 0)
vec dez(0, 0, 1)
vec dex(1, 0, 0)
vec dv0(0, 0, 0)
vec project_to_plane(const vec &r, const vec &normal)
Definition: vec.cpp:200
vfloat cos2vec(const vec &r1, const vec &r2)
Definition: vec.cpp:142
vfloat ang2projvec(const vec &r1, const vec &r2, const vec &normal)
Definition: vec.cpp:212
vfloat sin2vec(const vec &r1, const vec &r2)
Definition: vec.cpp:183
int vecerror
Definition: vec.cpp:31
#define pvecerrorp(string)
Definition: vec.h:59
#define ApplyAnyFunctionToVecElements(func)
Definition: vec.h:220
vec dex
vec dey
vec dez
#define pvecerror(string)
Definition: vec.h:52
int vecerror
Definition: vec.cpp:31
double vfloat
Definition: vfloat.h:15
const vfloat vprecision
Definition: vfloat.h:17
int not_apeq(vfloat f1, vfloat f2, vfloat prec=vprecision)
Definition: vfloat.h:27