GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
TPCParametersImpl.h
1 #ifndef GEAR_TPCParametersImpl_H
2 #define GEAR_TPCParametersImpl_H 1
3 
4 #include "gear/TPCParameters.h"
5 #include <map>
6 #include "gearimpl/GearParametersImpl.h"
7 #include "gearimpl/GlobalPadIndex.h"
8 
9 
10 
11 namespace gear {
12 
13 class TPCModule;
14 
26 
27  public:
28 
29  TPCParametersImpl( double maxDriftLength=-1., int coordinateType=-1 ) ;
31 
33 
34 // /** Copy constructor for base parameters */
35 // TPCParametersImpl( GearParameters& gearParameters ) ;
36 
38  virtual ~TPCParametersImpl() ;
39 
44  virtual const TPCModule& getModule(int moduleID) const;
45 
48  virtual int getNModules() const;
49 
56  virtual const TPCModule & getNearestModule(double c0, double c1) const;
57 
62  virtual const TPCModule & getNearestModule(double c0, double c1, double z) const;
63 
66  virtual double getMaxDriftLength() const;
67 
75  virtual bool isInsideModule(double c0, double c1) const;
76 
81  virtual bool isInsideModule(double c0, double c1, double z) const;
82 
87  virtual bool isInsidePad(double c0, double c1) const;
88 
93  virtual bool isInsidePad(double c0, double c1, double z) const;
94 
101  virtual GlobalPadIndex getNearestPad(double c0, double c1) const;
102 
107  virtual GlobalPadIndex getNearestPad(double c0, double c1, double z) const;
108 
114  virtual const std::vector<double> & getPlaneExtent() const;
115 
119  virtual int getCoordinateType() const;
120 
123  virtual const std::vector<TPCModule *> & getModules() const;
124 
127  virtual void addModule( TPCModule * TPCModule ) ;
128 
138  virtual const PadRowLayout2D& getPadLayout() const ;
139 
145  virtual double getDriftVelocity() const ;
146 
154  virtual double getReadoutFrequency() const ;
155 
158  virtual void setPadLayout( PadRowLayout2D * padLayout ) ;
159 
162  virtual void setMaxDriftLength( double maxDriftLength ) ;
163 
166  virtual void setDriftVelocity( double driftVelocity ) ;
167 
170  virtual void setReadoutFrequency( double readoutFrequency ) ;
171 
172 protected:
173 
174  // one vector with all the modules, and one for each half tpc
175  std::vector<TPCModule *> _TPCModules{}, _modulesPositiveHalfTPC{}, _modulesNegativeHalfTPC{};
176 
178  const TPCModule & getNearestModule(double c0, double c1,
179  std::vector<TPCModule *> const & modulesVector) const;
180 
182  bool isInsideModule(double c0, double c1, std::vector<TPCModule *> const & modulesVector) const;
183 
185  bool isInsidePad(double c0, double c1, std::vector<TPCModule *> const & modulesVector ) const;
186 
188  GlobalPadIndex getNearestPad(double c0, double c1,
189  std::vector<TPCModule *> const & modulesVector ) const;
190 
191 
192  double _maxDriftLength {};
193 
194  int _coordinateType{};
195 
202 
206  std::map<int,int> _moduleIDMap {};
207 
208  std::vector<double> _planeExtent {};
209 
211  double _driftVelocity {};
212 
217  void copy_and_assign(const TPCParametersImpl & );
218 
223  void cleanup();
224 
225  // Internal function to avoid code duplication
226  // Recalculation of the z postion is necessary when a module is added and when the
227  // maximal drift distance is changed.
228  void setCathodePosition();
229 
230 }; // class
231 
232 } // namespace gear
233 
234 
235 #endif /* ifndef GEAR_TPCParametersImpl_H */
virtual ~TPCParametersImpl()
Copy constructor for base parameters.
double _driftVelocity
Drift velocity is deprecated, should come from conditions data.
Implementation of GearParameters - a set off parameters that can be used to describe the geometrical ...
virtual void setDriftVelocity(double driftVelocity)
Abstract description of a planar subdetector with pads (cells) that are positioned in rows (circular ...
Proposal for an abstract interface that defines the geometry properties of a TPC like detector needed...
Definition: TPCParameters.h:24
virtual double getReadoutFrequency() const
Kept for backward compatibility.
virtual bool isInsideModule(double c0, double c1) const
True if coordinate (c0,c1) is within any module.
virtual const PadRowLayout2D & getPadLayout() const
Kept for backward compatibility.
virtual void setPadLayout(PadRowLayout2D *padLayout)
Global pad index implimentation .
virtual const std::vector< double > & getPlaneExtent() const
Extent of the sensitive plane - [xmin,xmax,ymin,ymax] CARTESIAN or [rmin,rmax,phimin,phimax] POLAR.
virtual int getNModules() const
Returns the number of modules in the TPC (endplate)
virtual double getMaxDriftLength() const
The maximum drift length in the TPC in mm.
virtual int getCoordinateType() const
Returns coordinate type as an int (see PadRowLayout2D::CARTESIAN, PadRowLayout2D::POLAR) ...
virtual const TPCModule & getModule(int moduleID) const
Returns module with the given module ID.
virtual void setMaxDriftLength(double maxDriftLength)
std::map< int, int > _moduleIDMap
A map with the moduleID as key and the index in the _TPCModules vector as value.
virtual void setReadoutFrequency(double readoutFrequency)
virtual const std::vector< TPCModule * > & getModules() const
Returns vector of all modules in this TPC (endplate).
A Container for TPCModules which describe the geometry properties of a given TPC. ...
void cleanup()
function to delete all the objects pointed to and owned by the GearMgr.
TPCParametersImpl(double maxDriftLength=-1., int coordinateType=-1)
virtual GlobalPadIndex getNearestPad(double c0, double c1) const
Returns globalPadindex Object for nearest pad to given coordinates (2D).
virtual double getDriftVelocity() const
The electron drift velocity in the TPC in mm/s.
virtual void addModule(TPCModule *TPCModule)
Adds a Module to the vector of modules, or throws an exception.
TPCParametersImpl & operator=(const TPCParametersImpl &)
Assignment operator.
virtual const TPCModule & getNearestModule(double c0, double c1) const
Returns nearest module to given coordinates (2D).
double _cathodePosition
The cathode position is needed internally to distinguish the half TPCs.
void copy_and_assign(const TPCParametersImpl &)
function to copy all internal variables, incl.
A wrapper Class for PadRowLayout2D which converts between the actual pad layouts local coodinate syst...
Definition: TPCModule.h:41
virtual bool isInsidePad(double c0, double c1) const
True if coordinate (c0,c1) is within any pad, on any module.