Garfield++ v1r0
A toolkit for the detailed simulation of particle detectors based on ionisation measurement in gases and semiconductors
Loading...
Searching...
No Matches
basis Class Reference

#include <vec.h>

+ Inheritance diagram for basis:

Public Member Functions

vec Gex () const
 
vec Gey () const
 
vec Gez () const
 
basis switch_xyz (void) const
 
 basis (void)
 
 basis (const String &pname)
 
 basis (const vec &p, const String &fname)
 
 basis (const vec &p, const vec &c, const String &pname)
 
 basis (const basis &pb, const String &pname)
 
 basis (const vec &pex, const vec &pey, const vec &pez, const String &pname)
 
 AnyType_copy (basis, basis)
 
virtual void print (std::ostream &file, int l) const
 
virtual ~basis (void)
 

Public Attributes

String name
 

Protected Member Functions

virtual void get_components (ActivePtr< absref_transmit > &aref_tran)
 

Protected Attributes

vec ex
 
vec ey
 
vec ez
 

Static Protected Attributes

static absref absref::* aref [3]
 

Friends

std::ostream & operator<< (std::ostream &file, const basis &b)
 

Detailed Description

Definition at line 397 of file vec.h.

Constructor & Destructor Documentation

◆ basis() [1/6]

basis::basis ( void  )

Definition at line 393 of file vec.cpp.

393 : ex(1, 0, 0), ey(0, 1, 0), ez(0, 0, 1) {
394 name = "primary_bas";
395}
vec ey
Definition: vec.h:399
String name
Definition: vec.h:412
vec ex
Definition: vec.h:399
vec ez
Definition: vec.h:399

Referenced by switch_xyz().

◆ basis() [2/6]

basis::basis ( const String pname)

Definition at line 397 of file vec.cpp.

397 : ex(1, 0, 0), ey(0, 1, 0), ez(0, 0, 1) {
398 name = pname;
399}

◆ basis() [3/6]

basis::basis ( const vec p,
const String fname 
)

Definition at line 401 of file vec.cpp.

401 {
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}
Definition: vec.h:248
vfloat cos2vec(const vec &r1, const vec &r2)
Definition: vec.cpp:142
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

◆ basis() [4/6]

basis::basis ( const vec p,
const vec c,
const String pname 
)

Definition at line 430 of file vec.cpp.

430 {
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}

◆ basis() [5/6]

basis::basis ( const basis pb,
const String pname 
)

Definition at line 463 of file vec.cpp.

464 : ex(pb.ex), ey(pb.ey), ez(pb.ez) {
465 name = pname;
466}

◆ basis() [6/6]

basis::basis ( const vec pex,
const vec pey,
const vec pez,
const String pname 
)

Definition at line 468 of file vec.cpp.

469 {
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}
#define spexit(stream)
Definition: FunNameStack.h:536
#define mcerr
Definition: prstream.h:135
const vfloat vprecision
Definition: vfloat.h:17
int not_apeq(vfloat f1, vfloat f2, vfloat prec=vprecision)
Definition: vfloat.h:27

◆ ~basis()

virtual basis::~basis ( void  )
inlinevirtual

Definition at line 458 of file vec.h.

458{}

Member Function Documentation

◆ AnyType_copy()

basis::AnyType_copy ( basis  ,
basis   
)

◆ get_components()

void basis::get_components ( ActivePtr< absref_transmit > &  aref_tran)
protectedvirtual

Definition at line 379 of file vec.cpp.

379 {
380 aref_tran.pass(new absref_transmit(3, aref));
381}
static absref absref::* aref[3]
Definition: vec.h:408

◆ Gex()

vec basis::Gex ( ) const
inline

Definition at line 415 of file vec.h.

415{ return ex; }

Referenced by vec::down_new(), and vec::up_new().

◆ Gey()

vec basis::Gey ( ) const
inline

Definition at line 416 of file vec.h.

416{ return ey; }

Referenced by vec::down_new(), and vec::up_new().

◆ Gez()

vec basis::Gez ( ) const
inline

Definition at line 417 of file vec.h.

417{ return ez; }

Referenced by vec::down_new(), and vec::up_new().

◆ print()

void basis::print ( std::ostream &  file,
int  l 
) const
virtual

Definition at line 507 of file vec.cpp.

507{ file << (*this); }

◆ switch_xyz()

basis basis::switch_xyz ( void  ) const

Definition at line 388 of file vec.cpp.

388 {
389 pvecerror("basis basis::switch_xyz(void)");
390 return basis(ez, ex, ey, name);
391}
basis(void)
Definition: vec.cpp:393

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  file,
const basis b 
)
friend

Definition at line 509 of file vec.cpp.

509 {
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}
indentation indn
Definition: prstream.cpp:13
#define Ifile
Definition: prstream.h:207

Member Data Documentation

◆ aref

absref absref::* basis::aref
staticprotected
Initial value:
= {
reinterpret_cast<absref absref::*>(static_cast<vec absref::*>(&basis::ex)),
reinterpret_cast<absref absref::*>(static_cast<vec absref::*>(&basis::ey)),
reinterpret_cast<absref absref::*>(static_cast<vec absref::*>(&basis::ez))
}
Definition: vec.h:134

Definition at line 408 of file vec.h.

Referenced by get_components().

◆ ex

vec basis::ex
protected

Definition at line 399 of file vec.h.

Referenced by basis(), Gex(), and switch_xyz().

◆ ey

vec basis::ey
protected

Definition at line 399 of file vec.h.

Referenced by basis(), Gey(), and switch_xyz().

◆ ez

vec basis::ez
protected

Definition at line 399 of file vec.h.

Referenced by basis(), Gez(), and switch_xyz().

◆ name

String basis::name

Definition at line 412 of file vec.h.

Referenced by basis(), and switch_xyz().


The documentation for this class was generated from the following files: