1 #include <gearimpl/TPCModuleImpl.h>
2 #include <gearimpl/RectangularPadRowLayout.h>
3 #include <gearimpl/FixedPadSizeDiskLayout.h>
4 #include <gearimpl/GearMgrImpl.h>
5 #include <gearimpl/TPCParametersImpl.h>
6 #include <gear/PadRowLayout2D.h>
7 #include <gearxml/XMLHandlerMgr.h>
8 #include <gearxml/TPCParametersXML.h>
9 #include <gearxml/tinyxml.h>
10 #include <gearxml/GearXML.h>
20 cout <<
"#--------------------------------" << endl;
21 for (
int row = 0; row < layout->
getNRows() ; row++)
23 const std::vector< int > & padsInRow = layout->
getPadsInRow (row);
25 for (
unsigned int i=0; i < padsInRow.size() ; i++)
29 cout << padCenter[0] <<
"\t" << padCenter[1] << endl;
34 void dumpPlaneExtent(
TPCModule const * module)
42 double local_y_phi_step;
46 case PadRowLayout2D::POLAR :
48 local_y_phi_step = M_PI/180.;
51 case PadRowLayout2D::CARTESIAN :
53 local_y_phi_step = 1.;
63 cout <<
"0\t 0\t 0\t 0\t"<<globalCoords[0] <<
"\t"<< globalCoords[1] <<endl;
69 cout <<
"0\t 0\t 0\t 0\t"<<globalCoords[0] <<
"\t"<< globalCoords[1] <<endl;
76 cout <<
"0\t 0\t 0\t 0\t"<<globalCoords[0] <<
"\t"<< globalCoords[1] <<endl;
82 cout <<
"0\t 0\t 0\t 0\t"<<globalCoords[0] <<
"\t"<< globalCoords[1] <<endl;
86 void dumpModuleExtentDistances(
TPCModule const * module)
95 case PadRowLayout2D::POLAR :
97 y_phi_step = M_PI/180.;
100 case PadRowLayout2D::CARTESIAN :
138 double local_y_phi_step;
142 case PadRowLayout2D::POLAR :
144 local_y_phi_step = M_PI/180.;
147 case PadRowLayout2D::CARTESIAN :
149 local_y_phi_step = 1.;
159 cout <<
"0\t 0\t"<<globalCoords[0] <<
"\t"<< globalCoords[1] <<
"\t 0\t 0\t 0"<<endl;
165 cout <<
"0\t 0\t"<<globalCoords[0] <<
"\t"<< globalCoords[1] <<
"\t 0\t 0\t 0"<<endl;
172 cout <<
"0\t 0\t"<<globalCoords[0] <<
"\t"<< globalCoords[1] <<
"\t 0\t 0\t 0"<<endl;
178 cout <<
"0\t 0\t"<<globalCoords[0] <<
"\t"<< globalCoords[1]
179 <<
"\t 0\t 0\t 0"<<endl;
185 for (
double x = -100; x < 100; x+=2)
187 cout << x<<
"\t"<<100<<
"\t 0\t 0\t 0 \t 0\t"
190 cout << x<<
"\t"<<-100<<
"\t 0\t 0\t 0 \t 0\t"
195 for (
double y = -100; y < 100; y+=2)
197 cout << 100<<
"\t"<<y<<
"\t 0\t 0\t 0 \t 0\t"
200 cout << -100<<
"\t"<<y<<
"\t 0\t 0\t 0 \t 0\t"
206 int main(
int argc,
char* argv[] )
210 cout <<
"usage: testDistanceToModue gearfile.xml" << endl;
219 const std::vector<TPCModule *> & moduleVec = mTPC.
getModules();
221 for (std::vector<TPCModule *>::const_iterator moduleIter = moduleVec.begin();
222 moduleIter < moduleVec.end(); moduleIter++)
224 dumpModuleExtentDistances(*moduleIter);
225 dumpPlaneExtent(*moduleIter);
226 dumpCoordinates(*moduleIter);
227 dumpBox(*moduleIter);
230 delete xmlmgr;
delete mgr;
virtual const TPCParameters & getTPCParameters() const =0
Get the TPCParameters.
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...
GearMgr * createGearMgr()
Creates an instance of GearMgr from the data given in the XML file.
Base exception class for GEAR - all other exceptions extend this.
Implementation of GEAR using XML.
virtual Vector2D localToGlobal(double c0, double c1) const =0
Returns the global coordinates for a point in local coordinates.
virtual const std::vector< TPCModule * > & getModules() const =0
Returns vector of all modules in this TPC (endplate).
virtual const PadRowLayout2D & getLocalPadLayout() const =0
Returns a reference to the instance of the underlaying pad layout.
virtual int getCoordinateType() const =0
The type of the row layouts coordinate system: PadRowLayout2D.CARTESIAN or PadRowLayout2D.POLAR.
virtual const std::vector< double > & getLocalModuleExtent() const =0
The module extent in local coordinates.
virtual int getNRows() const =0
The number of rows.
virtual int getTPCCoordinateType() const =0
Returns the TPCs coordinate type.
Abstract interface for a manager class that returns the Gear classes for the relevant subdetectors...
virtual const std::vector< int > & getPadsInRow(int rowNumber) const =0
Indices of all pads in row rowNumber (row indices start from 0 at the bottom (CARTESIAN) or at the ce...
virtual const std::vector< double > & getPlaneExtent() const =0
Extent of the sensitive plane - [xmin,xmax,ymin,ymax] CARTESIAN or [rmin,rmax,phimin,phimax] POLAR.
virtual const std::vector< double > & getModuleExtent() const =0
Maximal extent of the sensitive plane, defined relative to global origin - [xmin,xmax,ymin,ymax] CARTESIAN or [rmin,rmax,phimin,phimax] POLAR, may contain dead space due to conversion from local to global coordinate system.
A wrapper Class for PadRowLayout2D which converts between the actual pad layouts local coodinate syst...
virtual double getDistanceToModule(double c0, double c1) const =0
Returns distastance from a global coodinate (c0,c1), to the module's nearest boundery; (c0...
virtual Vector2D getPadCenter(int padIndex) const =0
The center of the pad in 2d coordinates, (x,y) or (r,phi).