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

#include <surface.h>

+ Inheritance diagram for Heed::ulsvolume:

Public Member Functions

 ulsvolume (void)
 Constructors.
 
 ulsvolume (surface *fsurf[pqqsurf], int fqsurf, char *fname, vfloat fprec)
 
 ulsvolume (ulsvolume &f)
 
 ulsvolume (const ulsvolume &fv)
 
 macro_copy_header (ulsvolume)
 
virtual ~ulsvolume ()
 Destructor.
 
int check_point_inside (const point &fpt, const vec &dir) const
 
int range_ext (trajestep &fts, int s_ext) const
 
void ulsvolume_init (surface *fsurf[pqqsurf], int fqsurf, const String &fname, vfloat fprec)
 
virtual void income (gparticle *)
 
virtual void chname (char *nm) const
 
virtual void print (std::ostream &file, int l) const
 
virtual int mandatory (void) const
 
- Public Member Functions inherited from absvol
virtual ~absvol ()
 
virtual int check_point_inside (const point &fpt, const vec &dir) const =0
 
virtual int find_embed_vol (const point &fpt, const vec &dir, manip_absvol_treeid *atid) const
 
virtual int range (trajestep &fts, int s_ext, int &sb, manip_absvol_eid *faeid) const
 
virtual int range_ext (trajestep &fts, int s_ext) const =0
 
 macro_copy_header (absvol)
 
virtual void income (gparticle *)
 
virtual void chname (char *nm) const
 
virtual void print (std::ostream &file, int l) const
 
virtual DynLinArr< manip_absvol * > Gamanip_embed (void) const
 
- Public Member Functions inherited from absref
virtual ~absref ()
 
virtual void down (const abssyscoor *fasc)
 
virtual void up (const abssyscoor *fasc)
 
virtual void turn (const vec &dir, vfloat angle)
 
virtual void shift (const vec &dir)
 

Public Attributes

int qsurf
 
ActivePtr< surfacesurf [pqqsurf]
 
String name
 
- Public Attributes inherited from absvol
vfloat prec
 

Protected Member Functions

virtual void get_components (ActivePtr< absref_transmit > &aref_tran)
 

Protected Attributes

surfaceadrsurf [pqqsurf]
 

Detailed Description

Definition at line 128 of file surface.h.

Constructor & Destructor Documentation

◆ ulsvolume() [1/4]

Heed::ulsvolume::ulsvolume ( void  )

Constructors.

Definition at line 337 of file surface.cpp.

337: qsurf(0) { name = String("not inited ulsvolume"); }
std::string String
Definition: String.h:75
String name
Definition: surface.h:152

◆ ulsvolume() [2/4]

Heed::ulsvolume::ulsvolume ( surface fsurf[pqqsurf],
int  fqsurf,
char *  fname,
vfloat  fprec 
)

Definition at line 353 of file surface.cpp.

355 : qsurf(fqsurf), name(fname) {
356 mfunname("ulsvolume::ulsvolume(...)");
357 check_econd12(fqsurf, >, pqqsurf, mcerr);
358 prec = fprec;
359 for (int n = 0; n < qsurf; ++n)
360 surf[n].put(fsurf[n]);
361}
#define check_econd12(a, sign, b, stream)
Definition: FunNameStack.h:380
#define mfunname(string)
Definition: FunNameStack.h:67
ActivePtr< surface > surf[pqqsurf]
Definition: surface.h:151
vfloat prec
Definition: volume.h:95
const int pqqsurf
Definition: surface.h:26
#define mcerr
Definition: prstream.h:135

◆ ulsvolume() [3/4]

Heed::ulsvolume::ulsvolume ( ulsvolume f)

Definition at line 363 of file surface.cpp.

364 : absref(f), absvol(f), qsurf(f.qsurf), name(f.name) {
365 mfunname("ulsvolume::ulsvolume(...)");
366 check_econd12(f.qsurf, >, pqqsurf, mcerr);
367 prec = f.prec;
368 for (int n = 0; n < qsurf; ++n)
369 surf[n].put(f.surf[n].get());
370}
Definition: vec.h:134
Definition: volume.h:91

◆ ulsvolume() [4/4]

Heed::ulsvolume::ulsvolume ( const ulsvolume fv)

Definition at line 372 of file surface.cpp.

373 : absref(f), absvol(f), qsurf(f.qsurf), name(f.name) {
374 mfunname("ulsvolume::ulsvolume(...)");
375 check_econd12(f.qsurf, >, pqqsurf, mcerr);
376 prec = f.prec;
377 for (int n = 0; n < qsurf; ++n)
378 surf[n].put(f.surf[n].get());
379}

◆ ~ulsvolume()

virtual Heed::ulsvolume::~ulsvolume ( )
inlinevirtual

Destructor.

Definition at line 166 of file surface.h.

166{}

Member Function Documentation

◆ check_point_inside()

int Heed::ulsvolume::check_point_inside ( const point fpt,
const vec dir 
) const
virtual

Implements absvol.

Definition at line 196 of file surface.cpp.

196 {
197 mfunname("ulsvolume::check_point_inside(...)");
198 check_econd11(qsurf, <= 0, mcerr);
199 for (int n = 0; n < qsurf; n++) {
200 if (!(surf[n].get()->check_point_inside(fpt, dir, prec))) {
201 return 0;
202 }
203 }
204#ifdef TRACE_find_embed_vol
205 indn.n++;
206 Imcout << "ulsvolume::check_point_inside: the point is in volume\n";
207 Imcout << "point:" << fpt;
208 print(mcout, 0);
209 indn.n--;
210#endif
211 return 1;
212}
#define check_econd11(a, signb, stream)
Definition: FunNameStack.h:366
virtual void print(std::ostream &file, int l) const
int check_point_inside(const point &fpt, const vec &dir) const
Definition: surface.cpp:196
indentation indn
Definition: prstream.cpp:13
#define mcout
Definition: prstream.h:133
#define Imcout
Definition: prstream.h:208

Referenced by check_point_inside(), and range_ext().

◆ chname()

virtual void Heed::ulsvolume::chname ( char *  nm) const
inlinevirtual

Reimplemented from absvol.

Reimplemented in Heed::manip_ulsvolume.

Definition at line 177 of file surface.h.

177 {
178#ifdef USE_STLSTRING
179 strcpy(nm, "ulsvolume: ");
180 strcat(nm, name.c_str());
181#else
182 strcpy(nm, "ulsvolume: ");
183 strcat(nm, name);
184#endif
185 }

Referenced by Heed::macro_copy_body().

◆ get_components()

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

Reimplemented from absref.

Definition at line 191 of file surface.cpp.

191 {
192 for (int n = 0; n < qsurf; n++) adrsurf[n] = surf[n].get();
193 aref_tran.pass(new absref_transmit(qsurf, (absref**)adrsurf));
194}
surface * adrsurf[pqqsurf]
Definition: surface.h:155

◆ income()

virtual void Heed::ulsvolume::income ( gparticle )
inlinevirtual

Reimplemented from absvol.

Definition at line 176 of file surface.h.

176{}

◆ macro_copy_header()

Heed::ulsvolume::macro_copy_header ( ulsvolume  )

◆ mandatory()

virtual int Heed::ulsvolume::mandatory ( void  ) const
inlinevirtual

Definition at line 187 of file surface.h.

187{ return 0; }

◆ print()

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

Reimplemented from absvol.

Reimplemented in Heed::manip_ulsvolume.

Referenced by check_point_inside(), Heed::box::print(), and range_ext().

◆ range_ext()

int Heed::ulsvolume::range_ext ( trajestep fts,
int  s_ext 
) const
virtual

Implements absvol.

Definition at line 214 of file surface.cpp.

214 {
215 mfunnamep("int ulsvolume::range_ext(trajestep& fts, int s_ext) const");
216 check_econd11(qsurf, <= 0, mcerr);
217#ifdef DEBUG_ulsvolume_range_ext
218 mcout << "ulsvolume::range_ext, START, s_ext=" << s_ext << " qsurf=" << qsurf
219 << '\n';
220 mcout << fts;
221#endif
222 vfloat crange[pqcrossurf];
223 point cpt[pqcrossurf];
224 int fs_ext[pqcrossurf];
225 int n, m, nc;
226 int s = 0; // sign of crossing
227 if (s_ext == 1) {
228 for (n = 0; n < qsurf; n++) {
229 int qc = surf[n].get()->range(fts, crange, cpt, fs_ext);
230 for (m = 0; m < qc; m++) {
231 if (fs_ext[m] == 1) {
232 s = 1;
233 // The last minute change, it was 0 somewhy instead of m
234 fts.mrange = crange[m]; // reduce the range
235 fts.mpoint = cpt[m];
236 break; // take only the first exit point, it should be closest
237 } else if (fs_ext[m] == 0) {
238 if (!(surf[n]
239 .get()->check_point_inside(fts.currpos, fts.dir, prec))) {
240 funnw.ehdr(mcerr);
241 mcerr << "\nshould never happen\n"
242 << "It may happen if you call this function with s_ext==1\n"
243 << "for point outside the volume\n";
244 spexit(mcerr);
245 }
246 } else if (fs_ext[m] == 2)
247 break; // don't know what to do, safe to ignore
248 }
249 }
250
251 if (s == 1) {
252 fts.s_prec = 0;
253 }
254 return s;
255 } else { // for if(s_ext==1)
256 int ss = 0; // sign that there is cross with any of the surfaces
257 for (n = 0; n < qsurf; n++) {
258#ifdef DEBUG_ulsvolume_range_ext
259 Iprintn(mcout, n);
260#endif
261 int qc = surf[n].get()->range(fts, crange, cpt, fs_ext);
262#ifdef DEBUG_ulsvolume_range_ext
263 mcout << "ulsvolume::range_ext: qc=" << qc << "\n";
264 surf[n]->print(mcout, 1);
265#endif
266 for (nc = 0; nc < qc; nc++) // loop by crossing points
267 {
268#ifdef DEBUG_ulsvolume_range_ext
269 mcout << "nc=" << nc << " fs_ext[nc]=" << fs_ext[nc] << '\n';
270#endif
271 if (fs_ext[nc] == 0) // thus ignoring exitted surfaces
272 {
273 s = 1;
274 for (m = 0; m < qsurf; m++) // scan other surfaces and verify that
275 { // the crossing point is inside
276 if (m != n) {
277 if (surf[m].get()->check_point_inside1(cpt[nc], fs_ext[nc],
278 prec) == 0) {
279#ifdef DEBUG_ulsvolume_range_ext
280 mcout << "m=" << m << '\n';
281 mcout << "Since the point is outside of the other surface, "
282 << "it can not be border of volume\n";
283#endif
284 s = 0;
285 break;
286 }
287 }
288 }
289#ifdef DEBUG_ulsvolume_range_ext
290 Iprintn(mcout, s);
291#endif
292 if (s == 1) {
293#ifdef DEBUG_ulsvolume_range_ext
294 mcout << "The crossing point is inside all other surfaces, \n"
295 << "so it is good crossing point\n";
296#endif
297 ss = 1;
298 fts.mrange = crange[nc];
299 fts.mpoint = cpt[nc];
300 break; // since points are ordered, go to next surface,
301 // may be there is nearer crossing point
302 }
303 }
304 }
305 }
306 if (ss == 1) {
307 fts.s_prec = 0;
308 }
309#ifdef DEBUG_ulsvolume_range_ext
310 mcout << "ulsvolume::range_ext: at the end\n";
311 print(mcout, 1);
312 mcout << "ss=" << ss << '\n';
313#endif
314 return ss;
315 }
316}
#define mfunnamep(string)
Definition: FunNameStack.h:77
#define spexit(stream)
Definition: FunNameStack.h:536
Definition: vec.h:477
const int pqcrossurf
Definition: surface.h:27
#define Iprintn(file, name)
Definition: prstream.h:216
double vfloat
Definition: vfloat.h:15

Referenced by Heed::box::range_ext().

◆ ulsvolume_init()

void Heed::ulsvolume::ulsvolume_init ( surface fsurf[pqqsurf],
int  fqsurf,
const String fname,
vfloat  fprec 
)

Definition at line 339 of file surface.cpp.

340 {
341 prec = fprec;
342 name = fname;
343 if (qsurf > 0) {
344 for (int n = 0; n < qsurf; ++n)
345 surf[n].put(NULL);
346 }
347 qsurf = fqsurf;
348 for (int n = 0; n < qsurf; ++n) {
349 surf[n].put(fsurf[n]);
350 }
351}

Referenced by Heed::box::init_planes().

Member Data Documentation

◆ adrsurf

surface* Heed::ulsvolume::adrsurf[pqqsurf]
protected

Definition at line 155 of file surface.h.

Referenced by get_components().

◆ name

String Heed::ulsvolume::name

Definition at line 152 of file surface.h.

Referenced by chname(), Heed::manip_ulsvolume::chname(), ulsvolume(), and ulsvolume_init().

◆ qsurf

int Heed::ulsvolume::qsurf

◆ surf

ActivePtr<surface> Heed::ulsvolume::surf[pqqsurf]

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