GEAR  1.9.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Friends Pages
PadRowLayout2DXML.cc
1 #include "gearxml/PadRowLayout2DXML.h"
2 
3 #include "gearxml/FixedPadSizeDiskLayoutXML.h"
4 #include "gearxml/FixedPadAngleDiskLayoutXML.h"
5 #include "gearxml/RectangularPadRowLayoutXML.h"
6 #include "gearxml/VersatileDiskRowLayoutXML.h"
7 #include "gear/PadRowLayout2D.h"
8 
9 #include <typeinfo>
10 #include <iostream>
11 
12 namespace gear {
13 
14 
15  PadRowLayout2DXML* PadRowLayout2DXML::getHandler( const std::string& typeName ) {
16 
17  return PadRowLayout2DXML::map()[ typeName ] ;
18  }
19 
21 
22  std::string typeName("UNKNOWN") ;
23 
24  switch(l->getPadLayoutImplType() )
25  {
26  case PadRowLayout2D::FIXEDPADSIZEDISKLAYOUT:
27  typeName = "FixedPadSizeDiskLayout" ; break;
28  case PadRowLayout2D::FIXEDPADANGLEDISKLAYOUT:
29  typeName = "FixedPadAngleDiskLayout" ; break;
30  case PadRowLayout2D::RECTANGULARPADROWLAYOUT:
31  typeName = "RectangularPadRowLayout" ; break;
32  case PadRowLayout2D::VERSATILEDISKROWLAYOUT:
33  typeName = "VersatileDiskRowLayout" ; break;
34  // The TPCMODULE is not treated by PadRowLayout2DXML, as
35  // PadRowLayout2DXML only treats PadLayouts contained by a module,
36  // which cannot be a module itself.
37  }
38 
39  return getHandler( typeName ) ;
40  }
41 
42 
43  PadRowLayout2DXML::Map& PadRowLayout2DXML::map() {
44 
45  static PadRowLayout2DXML::Map theMap ;
46  static FixedPadSizeDiskLayoutXML aFixedPadSizeDiskLayoutXML ;
47  static FixedPadAngleDiskLayoutXML aFixedPadAngleDiskLayoutXML ;
48  static RectangularPadRowLayoutXML aRectangularPadRowLayoutXML ;
49  static VersatileDiskRowLayoutXML aVersatileDiskRowLayoutXML ;
50 
51  if( theMap.size() == 0 ) {
52 
53  theMap["FixedPadSizeDiskLayout"] = & aFixedPadSizeDiskLayoutXML ;
54  theMap["FixedPadAngleDiskLayout"] = & aFixedPadAngleDiskLayoutXML ;
55  theMap["RectangularPadRowLayout"] = & aRectangularPadRowLayoutXML ;
56  theMap["VersatileDiskRowLayout"] = & aVersatileDiskRowLayoutXML ;
57  }
58  return theMap ;
59  }
60 
61 
62 // std::string PadRowLayout2DXML::typeName( const PadRowLayout2D* l ) {
63 
64 // if( dynamic_cast<const FixedPadSizeDiskLayout*>(l) != 0 ) return "FixedPadSizeDiskLayout" ;
65 // else
66 // return "UNKNOWN" ;
67 // }
68 }
69 
Abstract XML handler for RectangularPadRowLayoutXML.
Abstract description of a planar subdetector with pads (cells) that are positioned in rows (circular ...
static Map & map()
The map with available xml handler objects (PadRowLayout2DXML)
virtual int getPadLayoutImplType() const =0
The type of the row layout implementation: PadRowLayout2D.RECTANGULARPADROWLAYOUT, PadRowLayout2D.FIXEDPADSIZEDISKLAYOUT, PadRowLayout2D.FIXEDPADANGLEDISKLAYOUT or PadRowLayout2D.TPCMODULE.
Abstract XML handler for FixedPadAngleDiskLayoutXML.
static PadRowLayout2DXML * getHandler(const std::string &typeName)
Get handler for given type.
Abstract XML handler for FixedPadSizeDiskLayoutXML.
XML handler for VersatileDiskRowLayoutXML.
Abstract XML handler for PadRowLayout2DXML.