GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
TrackerPlanesLayerLayoutImpl.h
1 // -*- C++ -*-
2 #ifndef GEAR_TrackerPlanesLayerLayoutImpl_H
3 #define GEAR_TrackerPlanesLayerLayoutImpl_H 1
4 
5 #include "gear/TrackerPlanesLayerLayout.h"
6 #include <vector>
7 #include <iostream>
8 
9 namespace gear {
10 
19 // basic scattering only layer
21 
22  private:
23 
25  int ID {};
27  std::string info{};
29  double PositionX {};
31  double PositionY {};
33  double PositionZ {};
35  double RotationXY{};
37  double RotationZX{};
39  double RotationZY{};
41  double SizeX {};
43  double SizeY {};
45  double Thickness {};
47  double RadLength {};
48 
49  public:
51  TrackerPlanesMaterialLayerImpl() : ID(0), info(""), PositionX(0.), PositionY(0.), PositionZ(0.), RotationXY(0.), RotationZX(0.), RotationZY(0.), SizeX(0.), SizeY(0.), Thickness(0.), RadLength(0.) {} ;
52 
54 
55  virtual ~TrackerPlanesMaterialLayerImpl() { /* nop */; }
57  virtual int getID() const { return ID ; }
59  virtual std::string getInfo() const { return info ; }
61  virtual double getPositionX() const { return PositionX ; }
63  virtual double getPositionY() const { return PositionY ; }
65  virtual double getPositionZ() const { return PositionZ ; }
67  virtual double getRotationXY() const { return RotationXY ; }
69  virtual double getRotationZX() const { return RotationZX ; }
71  virtual double getRotationZY() const { return RotationZY ; }
73  virtual double getSizeX() const { return SizeX ; }
75  virtual double getSizeY() const { return SizeY ; }
77  virtual double getThickness() const { return Thickness ; }
79  virtual double getRadLength() const { return RadLength ; }
80 
81  // add "set" methods:
83  virtual void setID( int value ) { ID = value ; }
85  virtual void setInfo( std::string value) { info = value ; }
87  virtual void setRadLength( double value) { RadLength = value ; }
89  virtual void setPositionX( double value) { PositionX = value ; }
91  virtual void setPositionY( double value) { PositionY = value ; }
93  virtual void setPositionZ( double value) { PositionZ = value ; }
95  virtual void setRotationXY( double value) { RotationXY = value ; }
97  virtual void setRotationZX( double value) { RotationZX = value ; }
99  virtual void setRotationZY( double value) { RotationZY = value ; }
101  virtual void setSizeX( double value) { SizeX = value ; }
103  virtual void setSizeY( double value) { SizeY = value ; }
105  virtual void setThickness( double value) { Thickness = value ; }
106 
107 
108 };
109 
110 //basic scattering and sensitve layer
112 
113  private:
114 
116  int ID {};
118  std::string info{};
120  double PositionX {};
122  double PositionY {};
124  double PositionZ {};
126  double RotationXY{};
128  double RotationZX{};
130  double RotationZY{};
132  double SizeX {};
134  double SizeY {};
136  double Thickness {};
138  double RadLength {};
139 
141  int NpixelX{};
143  int NpixelY{};
145  double PitchX{};
147  double PitchY{};
149  double ResolutionX{};
151  double ResolutionY{};
152 
153  public:
155  TrackerPlanesSensitiveLayerImpl() : ID(0), info(""), PositionX(0.), PositionY(0.), PositionZ(0.), RotationXY(0.), RotationZX(0.), RotationZY(0.), SizeX(0.), SizeY(0.), Thickness(0.), RadLength(0.)
156  , NpixelX(0), NpixelY(0), PitchX(0.), PitchY(0.), ResolutionX(0.), ResolutionY(0.)
157  {} ;
158 
160  virtual ~TrackerPlanesSensitiveLayerImpl() { /* nop */; }
161 
163  virtual int getID() const { return ID ; }
165  virtual std::string getInfo() const { return info ; }
167  virtual double getPositionX() const { return PositionX ; }
169  virtual double getPositionY() const { return PositionY ; }
171  virtual double getPositionZ() const { return PositionZ ; }
173  virtual double getRotationXY() const { return RotationXY ; }
175  virtual double getRotationZX() const { return RotationZX ; }
177  virtual double getRotationZY() const { return RotationZY ; }
179  virtual double getSizeX() const { return SizeX ; }
181  virtual double getSizeY() const { return SizeY ; }
183  virtual double getThickness() const { return Thickness ; }
185  virtual double getRadLength() const { return RadLength ; }
186 
188  virtual int getNpixelX() const { return NpixelX ; }
190  virtual int getNpixelY() const { return NpixelY ; }
192  virtual double getPitchX() const { return PitchX ; }
194  virtual double getPitchY() const { return PitchY ; }
196  virtual double getResolutionX() const { return ResolutionX ; }
198  virtual double getResolutionY() const { return ResolutionY ; }
199 
201  virtual void setID( int value ) { ID = value ; }
203  virtual void setInfo( std::string value) { info = value ; }
205  virtual void setRadLength( double value) { RadLength = value ; }
207  virtual void setPositionX( double value) { PositionX = value ; }
209  virtual void setPositionY( double value) { PositionY = value ; }
211  virtual void setPositionZ( double value) { PositionZ = value ; }
213  virtual void setRotationXY( double value) { RotationXY = value ; }
215  virtual void setRotationZX( double value) { RotationZX = value ; }
217  virtual void setRotationZY( double value) { RotationZY = value ; }
219  virtual void setSizeX( double value) { SizeX = value ; }
221  virtual void setSizeY( double value) { SizeY = value ; }
223  virtual void setThickness( double value) { Thickness = value ; }
227  virtual void setNpixelX( int value ) { NpixelX = value ; }
229  virtual void setNpixelY( double value ) { NpixelY = value ; }
231  virtual void setPitchX( double value ) { PitchX = value ; }
233  virtual void setPitchY( double value ) { PitchY = value ; }
235  virtual void setResolutionX( double value ) { ResolutionX = value ; }
237  virtual void setResolutionY( double value ) { ResolutionY = value ; }
238 
239 };
240 
241  typedef std::vector<TrackerPlanesMaterialLayerImpl> TrackerPlanesMaterialLayerImplVec ;
242  typedef std::vector<TrackerPlanesSensitiveLayerImpl> TrackerPlanesSensitiveLayerImplVec ;
243 
244 
245 // a detector element consisting of a vector of scatterrers and sensors
247 
248  private:
249 
251  int ID{};
252 
254  std::string info{};
255 
257  TrackerPlanesMaterialLayerImplVec _materialVec {};
258 
260  TrackerPlanesSensitiveLayerImplVec _sensitiveVec {};
261 
262  public:
263 
265  TrackerPlanesLayerImpl() : ID(0), info("")
266  {};
267 
269  TrackerPlanesLayerImpl( TrackerPlanesMaterialLayerImplVec& materials, TrackerPlanesSensitiveLayerImplVec& sensors) : ID(0), info("")
270  {
271  //
272  _materialVec.clear();
273  for(unsigned int i=0; i< materials.size(); i++){
274  _materialVec.push_back( materials.at(i) );
275  }
276 
277  //
278  _sensitiveVec.clear();
279  for(unsigned int i=0; i< sensors.size(); i++){
280  _sensitiveVec.push_back( sensors.at(i) );
281  }
282  }
283 
286  virtual ~TrackerPlanesLayerImpl() { /* nop */; }
287 
290  virtual int getID() const { return ID; }
291 
294  virtual std::string getInfo() const { return info ; }
295 
298  virtual void setID(int value) { ID = value; }
299 
302  virtual void setInfo( std::string value) { info = value ; }
303 
305  virtual int getNMaterialLayers() const { return _materialVec.size(); }
306 
308  virtual int getNSensitiveLayers() const {return _sensitiveVec.size(); }
309 
312  TrackerPlanesMaterialLayerImplVec& getMaterialLayerVec(){ return _materialVec;}
313 
316  TrackerPlanesSensitiveLayerImplVec& getSensitiveLayerVec(){ return _sensitiveVec;}
317 
320  virtual void addMaterialLayer(
321  int ID, std::string info,
322  double PositionX, double PositionY, double PositionZ,
323  double RotationXY, double RotationZX, double RotationZY,
324  double SizeX, double SizeY, double Thickness, double RadLength
325  );
326 
327 
330  virtual void addSensitiveLayer(
331  int ID, std::string info,
332  double PositionX, double PositionY, double PositionZ,
333  double RotationXY, double RotationZX, double RotationZY,
334  double SizeX, double SizeY, double Thickness, double RadLength,
335  int NpixelX, int NpixelY,
336  double PitchX,double PitchY, double ResolutionX, double ResolutionY
337  );
338 
339 };
340 
342 typedef std::vector<TrackerPlanesLayerImpl> TrackerPlanesLayerImplVec ;
343 
346 
347  protected:
348 
350  typedef double MyMatrix[2][2];
351 
352  private:
353 
355  int ID{};
356 
358  std::string info{};
359 
361  TrackerPlanesLayerImplVec _layerVec {};
362 
363  public:
364 
366  TrackerPlanesLayerLayoutImpl() {
367  _layerVec.clear();
368  };
369 
371  virtual void addLayer( TrackerPlanesLayerImpl* layer ){
372  _layerVec.push_back( *layer ) ;
373  }
374 
376  virtual ~TrackerPlanesLayerLayoutImpl() { /* nop */; }
377 
379  virtual int getID() const { return 0; }
380 
382  virtual void setID(int value) { ID = value; }
383 
385  virtual std::string getInfo() const { return info; }
386 
388  virtual void setInfo(std::string value) { info = value; }
389 
391  virtual int getNLayers() const {
392  return _layerVec.size() ;
393  }
394 
396  virtual const TrackerPlanesLayerImpl* getLayer( unsigned int id ) const {
397 
398  if( id < _layerVec.size() ) {
399  return &(_layerVec.at(id)); // return an address
400  }
401 
402  return 0;
403  }
404 
406  virtual const TrackerPlanesLayerImpl* getLayerByID( int id ) const {
407 
408  for( TrackerPlanesLayerImplVec::const_iterator it = _layerVec.begin(); it != _layerVec.end(); it++ ) {
409  if( (*it).getID() == id ) return &(*it); // return a pointer (*it) is the element of the vector
410  }
411 
412  return 0;
413  }
414 
416  virtual void PrintHeader( std::ostream& s ) const {
417 
418  // layers
419  s << " Number of layers : " << getNLayers() << std::endl << std::endl ;
420  s << " layer parameters : " << std::endl ;
421 
422  char buffer[1024] ;
423 sprintf(buffer,"|------------------|------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|\n") ;
424  s << buffer ;
425 sprintf(buffer,"| layer: | ladder/scattering only | sensitive / scattering part ` measurement part |\n") ;
426  s << buffer ;
427 sprintf(buffer,"| ID info | ID info pozX pozY pozZ rotXY rotZX rotZY sizX sizY Thick X | ID info pozX pozY pozZ rotXY rotZX rotZY sizX sizY Thick X ` NX NY PitchX PitchY ResX RexY| \n") ;
428  s << buffer ;
429 sprintf(buffer,"|------------------|------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------|\n") ;
430  s << buffer ;
431 
432  }
433 
435  virtual void PrintLayers( std::ostream& s) const {
436 
437  char buffer[1024] ;
438  const char* a="";
439 
440  for( TrackerPlanesLayerImplVec::const_iterator it = _layerVec.begin(); it != _layerVec.end(); it++ ) {
441  TrackerPlanesLayerImpl* layer = const_cast<TrackerPlanesLayerImpl* > (&(*it)) ;
442 
443  sprintf(buffer,"|%3d %14s|%3s %14s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s|%3s %14s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s`%5s %5s %6s %6s %6s %6s|\n"
444  , layer->getID()
445  , layer->getInfo().c_str()
446  , a,a ,a,a,a,a,a,a,a,a,a,a, a,a ,a,a,a,a,a,a,a,a,a,a, a,a,a,a,a,a
447  );
448  s << buffer ;
449 
450  TrackerPlanesMaterialLayerImplVec::const_iterator mb = layer->getMaterialLayerVec().begin();
451  TrackerPlanesMaterialLayerImplVec::const_iterator me = layer->getMaterialLayerVec().end();
452  TrackerPlanesSensitiveLayerImplVec::const_iterator sb = layer->getSensitiveLayerVec().begin();
453  TrackerPlanesSensitiveLayerImplVec::const_iterator se = layer->getSensitiveLayerVec().end();
454 
455  for( TrackerPlanesMaterialLayerImplVec::const_iterator ml = mb ; ml < me; ml++) {
456  sprintf(buffer,"|%3s %14s|%3d %14s %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.2f %5.2f %5.2f %5.2f|%3s %14s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s`%5s %5s %6s %6s %6s %6s|\n"
457  , a,a
458  , (*ml).getID()
459  , (*ml).getInfo().c_str()
460  , (*ml).getPositionX()
461  , (*ml).getPositionY()
462  , (*ml).getPositionZ()
463  , (*ml).getRotationXY()
464  , (*ml).getRotationZX()
465  , (*ml).getRotationZY()
466  , (*ml).getSizeX()
467  , (*ml).getSizeY()
468  , (*ml).getThickness()
469  , (*ml).getRadLength()
470  , a,a ,a,a,a,a,a,a,a,a,a,a, a,a,a,a,a,a
471  );
472  s << buffer ;
473  }
474 
475  for( TrackerPlanesSensitiveLayerImplVec::const_iterator sl = sb ; sl < se; sl++) {
476  sprintf(buffer,"|%3s %14s|%3s %14s %5s %5s %5s %5s %5s %5s %5s %5s %5s %5s|%3d %14s %5.0f %5.0f %5.0f %5.0f %5.0f %5.0f %5.2f %5.2f %5.2f %5.2f`%5d %5d %5.4f %5.4f %5.4f %5.4f|\n"
477  , a,a, a,a, a,a, a,a, a,a, a,a, a,a
478  , (*sl).getID()
479  , (*sl).getInfo().c_str()
480  , (*sl).getPositionX()
481  , (*sl).getPositionY()
482  , (*sl).getPositionZ()
483  , (*sl).getRotationXY()
484  , (*sl).getRotationZX()
485  , (*sl).getRotationZY()
486  , (*sl).getSizeX()
487  , (*sl).getSizeY()
488  , (*sl).getThickness()
489  , (*sl).getRadLength()
490 
491  , (*sl).getNpixelX()
492  , (*sl).getNpixelY()
493  , (*sl).getPitchX()
494  , (*sl).getPitchY()
495  , (*sl).getResolutionX()
496  , (*sl).getResolutionY()
497  );
498  s << buffer ;
499  }
500  }
501 sprintf(buffer,"|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n") ;
502  s << buffer ;
503 
504  }
505 
507  virtual void PrintFooter( std::ostream& s) const {
508  char buffer[1024] ;
509 
510 sprintf(buffer,"|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n") ;
511  s << buffer ;
512 
513  }
514 
515 
516 
517 }; // class
518 
519 } // namespace gear
520 #endif /* #ifndef GEAR_TrackerPlanesLayerLayoutImpl_H */
521 
virtual void setPositionX(double value)
a free parameter string field
virtual int getID() const
ID of sensitive volume of layer layerIndex - layer indexing starts at 0 for the layer closest to the ...
virtual int getNMaterialLayers() const
The total number of nonSense layers.
virtual void addLayer(TrackerPlanesLayerImpl *layer)
a free parameter string field
virtual double getRotationXY() const
rotation angles according to Euler implementation scheme (in XY plane -&gt; around axis Z: gamma ) ...
virtual double getResolutionY() const
Intrinsic resolution of layer layerIndex - layer indexing starts at 0 for the layer closest to the be...
virtual const TrackerPlanesLayerImpl * getLayerByID(int id) const
a free parameter string field
virtual void setID(int value)
a free parameter string field
virtual int getNpixelX() const
Number of pixels in x direction in sensitive volume of layer layerIndex - layer indexing starts at 0 ...
virtual double getRotationZX() const
rotation angles according to Euler implmentation scheme (in ZX plane -&gt; around axis Y: beta ) ...
virtual void setID(int value)
a free parameter string field
virtual void setThickness(double value)
a free parameter string field
TrackerPlanesLayerImpl(TrackerPlanesMaterialLayerImplVec &materials, TrackerPlanesSensitiveLayerImplVec &sensors)
normal constructor
virtual void setRotationZX(double value)
a free parameter string field
virtual void setPositionY(double value)
a free parameter string field
virtual void PrintHeader(std::ostream &s) const
a free parameter string field
virtual double getSizeY() const
Size in y direction of sensitive volume of layer layerIndex - layer indexing starts at 0 for the laye...
virtual double getPositionZ() const
z position of the center of sensitive volume of layer layerIndex - layer indexing starts at 0 for the...
virtual void setThickness(double value)
a free parameter string field
virtual double getRotationZY() const
rotation angles according to Euler implmentation scheme (in ZY plane -&gt; around axis X: alfa ) ...
virtual double getSizeX() const
Size in x direction of sensitive volume of layer layerIndex - layer indexing starts at 0 for the laye...
virtual void PrintLayers(std::ostream &s) const
a free parameter string field
virtual double getSizeY() const
Size in y direction of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for the l...
virtual double getPositionY() const
y position of the center of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for ...
virtual void addMaterialLayer(int ID, std::string info, double PositionX, double PositionY, double PositionZ, double RotationXY, double RotationZX, double RotationZY, double SizeX, double SizeY, double Thickness, double RadLength)
add methods
virtual void setPositionZ(double value)
a free parameter string field
virtual double getThickness() const
Thickness of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for the layer close...
virtual double getPositionZ() const
z position of the center of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for ...
virtual void setRotationZX(double value)
a free parameter string field
virtual void setRotationZY(double value)
a free parameter string field
virtual double getRotationZX() const
rotation angles according to Euler implmentation scheme (in ZX plane -&gt; around axis Y: beta ) ...
virtual void setSizeX(double value)
a free parameter string field
virtual void setInfo(std::string value)
get methods
virtual double getPositionX() const
x position of the center of sensitive volume of layer layerIndex - layer indexing starts at 0 for the...
virtual int getNLayers() const
The total number of layers.
virtual void setPositionZ(double value)
a free parameter string field
virtual std::string getInfo() const
get methods
virtual double getResolutionX() const
Intrinsic resolution of layer layerIndex - layer indexing starts at 0 for the layer closest to the be...
TrackerPlanesSensitiveLayerImplVec & getSensitiveLayerVec()
get methods
virtual int getNpixelY() const
Number of pixels in y direction in sensitive volume of layer layerIndex - layer indexing starts at 0 ...
virtual void addSensitiveLayer(int ID, std::string info, double PositionX, double PositionY, double PositionZ, double RotationXY, double RotationZX, double RotationZY, double SizeX, double SizeY, double Thickness, double RadLength, int NpixelX, int NpixelY, double PitchX, double PitchY, double ResolutionX, double ResolutionY)
add methods
virtual double getRotationZY() const
rotation angles according to Euler implmentation scheme (in ZY plane -&gt; around axis X: alfa ) ...
virtual void setRotationXY(double value)
a free parameter string field
virtual const TrackerPlanesLayerImpl * getLayer(unsigned int id) const
a free parameter string field
TrackerPlanesMaterialLayerImpl()
safe default contructor
virtual double getPositionY() const
y position of the center of sensitive volume of layer layerIndex - layer indexing starts at 0 for the...
virtual double getSizeX() const
Size in x direction of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for the l...
virtual double getRadLength() const
The radiation length of sensitive volume of layer layerIndex - layer indexing starts at 0 for the lay...
virtual int getNSensitiveLayers() const
The total number of Sensitive layers.
virtual double getPositionX() const
x position of the center of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for ...
a collection of layers = telescope description
virtual void setSizeX(double value)
a free parameter string field
virtual void setSizeY(double value)
a free parameter string field
virtual double getRotationXY() const
rotation angles according to Euler implementation scheme (in XY plane -&gt; around axis Z: gamma ) ...
Abstract description of layers in pixel beam telescope.
virtual double getPitchY() const
Pitch size in y direction in sensitive volume of layer layerIndex - layer indexing starts at 0 for th...
virtual void setPositionY(double value)
a free parameter string field
virtual void PrintFooter(std::ostream &s) const
a free parameter string field
virtual int getID() const
Layer ID of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for the layer closes...
virtual void setPositionX(double value)
a free parameter string field
virtual void setSizeY(double value)
a free parameter string field
virtual void setRadLength(double value)
a free parameter string field
virtual void setRotationXY(double value)
a free parameter string field
virtual void setRadLength(double value)
a free parameter string field
virtual void setRotationZY(double value)
a free parameter string field
virtual double getRadLength() const
The radiation length of nonsensitive volume of layer layerIndex - layer indexing starts at 0 for the ...
virtual double getPitchX() const
Pitch size in x direction in sensitive volume of layer layerIndex - layer indexing starts at 0 for th...
virtual void setID(int value)
set methods
virtual int getID() const
get methods
TrackerPlanesMaterialLayerImplVec & getMaterialLayerVec()
get methods
virtual double getThickness() const
Thickness of sensitive volume of layer layerIndex - layer indexing starts at 0 for the layer closest ...